From 2eb0d2e822d0476cfdda65106f70a240c89fe51c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 8 Mar 2010 10:14:37 +0000 Subject: [PATCH] fine-tune -watch --- Fltk/graphicWindow.cpp | 4 ++++ Fltk/menuWindow.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 5bd6f70c0b..6dea613748 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -229,6 +229,10 @@ void status_play_manual(int time, int incr) static bool busy = false; if(busy) return; busy = true; + + // if we watch some files this is a good time to check for new data + file_watch_cb(0, 0); + if(time) { for(unsigned int i = 0; i < PView::list.size(); i++){ if(opt_view_visible(i, GMSH_GET, 0)){ diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index bf24133351..71873fc7a3 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -417,6 +417,8 @@ void file_quit_cb(Fl_Widget *w, void *data) void file_watch_cb(Fl_Widget *w, void *data) { + if(CTX::instance()->watchFilePattern.empty()) return; + std::string pattern = FixRelativePath (GModel::current()->getFileName(), CTX::instance()->watchFilePattern); std::string directory = SplitFileName(pattern)[0]; @@ -434,7 +436,8 @@ void file_watch_cb(Fl_Widget *w, void *data) } if(files) free((void*)files); - Msg::Info("%d files matching pattern '%s'", num, pattern.c_str()); + Msg::Info("%d match%s for pattern '%s'", (int)matches.size(), + (matches.size() > 1) ? "es" : "", pattern.c_str()); std::set<std::string> allFiles; for(unsigned int i = 0; i < GModel::list.size(); i++) -- GitLab