diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 48bc840a2c556df466aa4066cf69a566a5258654..2ed3661b6be9177ff2af694ad8e5ab87cef51887 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -665,21 +665,28 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) o->activate((const char*)data); if(data){ - const char *str = (const char*)data; - if(!strcmp(str, "range_min") || !strcmp(str, "range_max")){ - int vindex = o->view.index; - if(vindex >= 0 && vindex < (int)PView::list.size()){ - // compute min/max taking current visibility status into account - int step = (int)opt_view_timestep(vindex, GMSH_GET, 0); - PViewData *data = PView::list[vindex]->getData(true); - PViewOptions *opt = PView::list[vindex]->getOptions(); - if(!strcmp(str, "range_min")) - o->view.value[31]->value(data->getMin(step, true, opt->forceNumComponents, - opt->componentMap)); - else if(!strcmp(str, "range_max")) - o->view.value[32]->value(data->getMax(step, true, opt->forceNumComponents, - opt->componentMap)); + std::string str((const char*)data); + if(str == "range_min" || str == "range_max"){ + double vmin = 1e200; + double vmax = -1e200; + for(int i = 0; i < (int)PView::list.size(); i++) { + if(i == current || FlGui::instance()->options->browser->selected(i + 6)) { + // compute min/max taking current visibility status into account + int step = (int)opt_view_timestep(i, GMSH_GET, 0); + PViewData *data = PView::list[i]->getData(true); + PViewOptions *opt = PView::list[i]->getOptions(); + if(str == "range_min") + vmin = std::min(vmin, data->getMin(step, true, opt->forceNumComponents, + opt->componentMap)); + else if(str == "range_max") + vmax = std::max(vmax, data->getMax(step, true, opt->forceNumComponents, + opt->componentMap)); + } } + if(str == "range_min") + o->view.value[31]->value(vmin); + else if(str == "range_max") + o->view.value[32]->value(vmax); } }