diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 091c3dea6ff0916779863b7bb73e7913c2fbe171..f0ffccaed57aceb65f38b56cd56d246c695ad393 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 6aad58d4397812fbf946833f9fdffac915d915e5..89b28e1c9b3980843edd030d0cdecfbdd1f08e79 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 f0cbc83e6ec21d6691fd16c01ee6519012c87786..d0e5dc3b1db58aec3041543027a896c1f18aa535 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 2afed172b353dc68823289b2f3385ad2583720a1..97219a2a9d2c7a8cb4687cea9b70ef74a47c9338 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 74e7b76d00fa4abb7bacf9b860ab6b3f4d3a686d..186cee64478ea81d140ca768ca65646edb0976a2 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 320c88e6070c36e7e314f922c0088e32ee544b1f..338faf94377caeaaddc29030b58b608e6f4fa798 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{""}@*