From 5b8b85a3148c7a4cb31b52ae8d0bae0351bff18b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 21 Jun 2015 12:41:19 +0000 Subject: [PATCH] test view groups --- Common/DefaultOptions.h | 2 ++ Common/Options.cpp | 13 +++++++++++++ Common/Options.h | 1 + Fltk/onelabGroup.cpp | 19 +++++++++++++++---- Post/PViewOptions.h | 2 +- doc/texinfo/opt_view.texi | 5 +++++ 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 091c3dea6f..f0ffccaed5 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -273,6 +273,8 @@ StringXString ViewOptions_String[] = { { F|O, "GeneralizedRaiseZ" , opt_view_gen_raise2 , "v2" , "Generalized elevation of the view along Z-axis (in model coordinates, " "using formula possibly containing x, y, z, s[tep], t[ime], v0, ... v8)" }, + { F|O, "Group" , opt_view_group , "" , + "Group to which this view belongs" }, { F, "Name" , opt_view_name , "" , "Default post-processing view name" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 6aad58d439..89b28e1c9b 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1651,6 +1651,19 @@ std::string opt_view_double_clicked_command(OPT_ARGS_STR) #endif } +std::string opt_view_group(OPT_ARGS_STR) +{ +#if defined(HAVE_POST) + GET_VIEWo(""); + if(action & GMSH_SET) { + opt->group = val; + } + return opt->group; +#else + return ""; +#endif +} + std::string opt_view_filename(OPT_ARGS_STR) { #if defined(HAVE_POST) diff --git a/Common/Options.h b/Common/Options.h index f0cbc83e6e..d0e5dc3b1d 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -103,6 +103,7 @@ std::string opt_view_name(OPT_ARGS_STR); std::string opt_view_format(OPT_ARGS_STR); std::string opt_view_filename(OPT_ARGS_STR); std::string opt_view_double_clicked_command(OPT_ARGS_STR); +std::string opt_view_group(OPT_ARGS_STR); std::string opt_view_axes_label0(OPT_ARGS_STR); std::string opt_view_axes_label1(OPT_ARGS_STR); std::string opt_view_axes_label2(OPT_ARGS_STR); diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index 2afed172b3..97219a2a9d 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -44,6 +44,7 @@ typedef unsigned long intptr_t; #include "CreateFile.h" #include "drawContext.h" #include "PView.h" +#include "PViewOptions.h" #include "treeIcons.h" // This file contains the Gmsh/FLTK specific parts of the ONELAB @@ -573,7 +574,11 @@ void onelabGroup::_addSolverMenu(int num) void onelabGroup::_addViewMenu(int num) { std::ostringstream path; - path << "0Modules/Post-processing/View" << num; + path << "0Modules/Post-processing/"; + if(num >= 0 && num < PView::list.size() && + PView::list[num]->getOptions()->group.size()) + path << PView::list[num]->getOptions()->group << "/"; + path << "View" << num; Fl_Tree_Item *n = _tree->add(path.str().c_str()); int ww = _baseWidth - (n->depth() + 1) * _indent; int hh = n->labelsize() + 4; @@ -590,7 +595,12 @@ void onelabGroup::_addViewMenu(int num) viewButton *onelabGroup::getViewButton(int num) { char tmp[256]; - sprintf(tmp, "0Modules/Post-processing/View%d", num); + if(num >= 0 && num < PView::list.size() && + PView::list[num]->getOptions()->group.size()) + sprintf(tmp, "0Modules/Post-processing/%s/View%d", + PView::list[num]->getOptions()->group.c_str(), num); + else + sprintf(tmp, "0Modules/Post-processing/View%d", num); Fl_Tree_Item *n = _tree->find_item(tmp); if(n){ Fl_Group *grp = (Fl_Group*)n->widget(); @@ -1046,11 +1056,11 @@ void onelabGroup::rebuildTree(bool deleteWidgets) if(CTX::instance()->guiColorScheme){ _tree->openicon(&open_pixmap_dark); - _tree->closeicon(&open_pixmap_dark); + _tree->closeicon(&close_pixmap_dark); } else{ _tree->openicon(&open_pixmap_light); - _tree->closeicon(&open_pixmap_light); + _tree->closeicon(&close_pixmap_light); } _tree->sortorder(FL_TREE_SORT_ASCENDING); _tree->selectmode(FL_TREE_SELECT_NONE); @@ -1128,6 +1138,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets) but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); but->callback(onelab_subtree_cb, (void*)n); #else + // FIXME: if view group, add special widget with on/off switch Fl_Box *but = new Fl_Box(1, 1, ww, hh); //but->labelfont(FL_HELVETICA_ITALIC); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index 74e7b76d00..186cee6447 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -99,7 +99,7 @@ class PViewOptions { int clip; // status of clip planes (bit array) int forceNumComponents, componentMap[9]; int sampling; - std::string attributes, doubleClickedCommand; + std::string attributes, doubleClickedCommand, group; struct{ unsigned int point, line, triangle, quadrangle; unsigned int tetrahedron, hexahedron, prism, pyramid; diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index 320c88e607..338faf9437 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -69,6 +69,11 @@ Generalized elevation of the view along Z-axis (in model coordinates, using form Default value: @code{"v2"}@* Saved in: @code{General.OptionsFileName} +@item View.Group +Group to which this view belongs@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + @item View.Name Default post-processing view name@* Default value: @code{""}@* -- GitLab