From 2ae11558124b293efd8024aa494ef3c6bd11726f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 10 Sep 2007 05:31:35 +0000 Subject: [PATCH] *** empty log message *** --- Fltk/Callbacks.cpp | 45 ++++++++++++++++----------------------------- Fltk/Callbacks.h | 2 +- Fltk/GUI.cpp | 15 ++++++++++++++- Fltk/GUI.h | 1 + Fltk/Main.cpp | 8 +++++--- Parser/OpenFile.cpp | 7 +++---- 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 88b521478f..dda33e34b1 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.542 2007-09-10 04:47:02 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.543 2007-09-10 05:31:35 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -56,19 +56,6 @@ extern GUI *WID; // Helper routines -void UpdateViewsInGUI() -{ - if(WID) { - WID->check_anim_buttons(); - if(WID->get_context() == 3) - WID->set_context(menu_post, 0); - WID->reset_option_browser(); - WID->reset_plugin_view_browser(); - WID->reset_clip_browser(); - WID->reset_external_view_list(); - } -} - int SetGlobalShortcut(int event) { return WID->global_shortcuts(event); @@ -1836,7 +1823,7 @@ void statistics_histogram_cb(CALLBACK_ARGS) std::vector<double> x, y; for(int i = 0; i < 100; i++) y.push_back(WID->quality[type][i]); new PView(name, "# Elements", x, y); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4266,7 +4253,7 @@ void view_remove_other_cb(CALLBACK_ARGS) if(PView::list.empty()) return; for(int i = PView::list.size() - 1; i >= 0; i--) if(i != (long)data) delete PView::list[i]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4274,7 +4261,7 @@ void view_remove_all_cb(CALLBACK_ARGS) { if(PView::list.empty()) return; while(PView::list.size()) delete PView::list[0]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4283,7 +4270,7 @@ void view_remove_visible_cb(CALLBACK_ARGS) if(PView::list.empty()) return; for(int i = PView::list.size() - 1; i >= 0; i--) if(opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4292,7 +4279,7 @@ void view_remove_invisible_cb(CALLBACK_ARGS) if(PView::list.empty()) return; for(int i = PView::list.size() - 1; i >= 0; i--) if(!opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4301,14 +4288,14 @@ void view_remove_empty_cb(CALLBACK_ARGS) if(PView::list.empty()) return; for(int i = PView::list.size() - 1; i >= 0; i--) if(PView::list[i]->getData()->empty()) delete PView::list[i]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_remove_cb(CALLBACK_ARGS) { delete PView::list[(int)(long)data]; - UpdateViewsInGUI(); + WID->update_views(); Draw(); } @@ -4362,56 +4349,56 @@ void view_save_msh_cb(CALLBACK_ARGS) void view_alias_cb(CALLBACK_ARGS) { new PView(PView::list[(int)(long)data], false); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_alias_with_options_cb(CALLBACK_ARGS) { new PView(PView::list[(int)(long)data], true); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_space_all_cb(CALLBACK_ARGS) { PView::combine(false, 1, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_space_visible_cb(CALLBACK_ARGS) { PView::combine(false, 0, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_space_by_name_cb(CALLBACK_ARGS) { PView::combine(false, 2, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_time_all_cb(CALLBACK_ARGS) { PView::combine(true, 1, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_time_visible_cb(CALLBACK_ARGS) { PView::combine(true, 0, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } void view_combine_time_by_name_cb(CALLBACK_ARGS) { PView::combine(true, 2, CTX.post.combine_remove_orig); - UpdateViewsInGUI(); + WID->update_views(); Draw(); } diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 63f56af925..49b4b14fd7 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -24,8 +24,8 @@ #define CALLBACK_ARGS Fl_Widget* w, void* data -int SetGlobalShortcut(int event); void ManualPlay(int time, int step); +int SetGlobalShortcut(int event); // Common callbacks diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index af5d476205..13c3396e3d 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.636 2007-09-10 04:47:02 geuzaine Exp $ +// $Id: GUI.cpp,v 1.637 2007-09-10 05:31:35 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -1544,6 +1544,19 @@ void GUI::set_title(char *str) g_window->label(str); } +// Update GUI when views get added or deleted + +void GUI::update_views() +{ + check_anim_buttons(); + if(get_context() == 3) + set_context(menu_post, 0); + reset_option_browser(); + reset_plugin_view_browser(); + reset_clip_browser(); + reset_external_view_list(); +} + // Set animation button void GUI::set_anim_buttons(int mode) diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 0d2ec1619a..10b8a39e8e 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -304,6 +304,7 @@ public: void set_size(int w, int h); void set_context(Context_Item menu[], int flag); int get_context(); + void update_views(); void set_anim_buttons(int mode); void check_anim_buttons(); void set_status(char *msg, int num); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index a7654be1c4..b177268456 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.109 2007-09-10 04:47:02 geuzaine Exp $ +// $Id: Main.cpp,v 1.110 2007-09-10 05:31:35 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -182,9 +182,11 @@ int main(int argc, char *argv[]) OpenProject(CTX.filename); for(int i = 1; i < List_Nbr(CTX.files); i++) MergeFile(*(char**)List_Pointer(CTX.files, i)); - if(CTX.post.combine_time) + if(CTX.post.combine_time){ PView::combine(true, 2, CTX.post.combine_remove_orig); - + WID->update_views(); + } + // Init first context switch (CTX.initial_context) { case 1: diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 609a098c5a..7e16d5f2c6 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.159 2007-09-10 04:47:07 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.160 2007-09-10 05:31:35 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -42,7 +42,6 @@ #include "SelectBuffer.h" #include "GUI.h" extern GUI *WID; -extern void UpdateViewsInGUI(); #endif extern Context_T CTX; @@ -238,7 +237,7 @@ int ParseFile(char *f, int close, int warn_if_missing) #if defined(HAVE_FLTK) if(numViewsBefore != PView::list.size()) - UpdateViewsInGUI(); + WID->update_views(); #endif return 1; @@ -399,7 +398,7 @@ int MergeFile(char *name, int warn_if_missing) #if defined(HAVE_FLTK) if(numViewsBefore != PView::list.size()) - UpdateViewsInGUI(); + WID->update_views(); #endif Msg(STATUS2, "Read '%s'", name); -- GitLab