diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 5e02118424c102d41c01c474204bc03ab9b54bba..f07b71fdafefe408e1a67c0b3e4aa5652c6bf1b0 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1127,7 +1127,8 @@ StringXNumber ViewOptions_Number[] = { { F|O, "ArrowSizeMin" , opt_view_arrow_size_min , 0. , "Minimum display size of arrows (in pixels)" }, { F|O, "AutoPosition" , opt_view_auto_position , 1. , - "Position the scale or 2D plot automatically" }, + "Position the scale or 2D plot automatically (0: manual, 1: automatic, 2: top left, " + "3: top right, 4: bottom left, 5: bottom right)" }, { F|O, "Axes" , opt_view_axes , 0 , "Axes (0=none, 1=simple axes, 2=box, 3=full grid, 4=open grid, 5=ruler)" }, { F|O, "AxesMikado" , opt_view_axes_mikado , 0. , diff --git a/Common/Options.cpp b/Common/Options.cpp index a0db5004b570ddd26fe1d6dceee52758c7e2fde4..ed9d51a500881c055836aef19da4a7b3011d446e 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -6445,10 +6445,12 @@ double opt_view_auto_position(OPT_ARGS_NUM) GET_VIEW(0.); if(action & GMSH_SET) { opt->autoPosition = (int)val; + if(opt->autoPosition < 0 || opt->autoPosition > 5) + opt->autoPosition = 0; } #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)) { - FlGui::instance()->options->view.butt[7]->value(opt->autoPosition); + FlGui::instance()->options->view.choice[16]->value(opt->autoPosition); FlGui::instance()->options->activate("view_axes_auto_2d"); } #endif diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 486ce34d88d49144442bb79419db9f892d7e90be..fa831e915a5493b0c45c5b8a3bb35e8c6822c9ac 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -96,6 +96,16 @@ static Fl_Menu_Item menu_axes_mode[] = { {0} }; +static Fl_Menu_Item menu_position[] = { + {"Manual", 0, 0, 0}, + {"Automatic", 0, 0, 0}, + {"Top left", 0, 0, 0}, + {"Top right", 0, 0, 0}, + {"Bottom left", 0, 0, 0}, + {"Bottom right", 0, 0, 0}, + {0} +}; + Fl_Menu_Item menu_font_names[] = { {"Times-Roman", 0, 0, (void*)FL_TIMES}, {"Times-Bold", 0, 0, (void*)FL_TIMES_BOLD}, @@ -827,6 +837,10 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) if(force || (val != center_glyphs)) opt_view_center_glyphs(i, GMSH_SET, val); + val = o->view.choice[16]->value(); + if(force || (val != auto_position)) + opt_view_auto_position(i, GMSH_SET, val); + // view_butts val = o->view.butt[0]->value(); @@ -853,10 +867,6 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) if(force || (val != mikado)) opt_view_axes_mikado(i, GMSH_SET, val); - val = o->view.butt[7]->value(); - if(force || (val != auto_position)) - opt_view_auto_position(i, GMSH_SET, val); - val = o->view.butt[25]->value(); if(force || (val != axes_auto_position)) opt_view_axes_auto_position(i, GMSH_SET, val); @@ -2896,10 +2906,11 @@ optionWindow::optionWindow(int deltaFontSize) view.value[18]->align(FL_ALIGN_RIGHT); view.value[18]->callback(view_options_ok_cb); - view.butt[7] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Position 2D axes/value scale automatically"); - view.butt[7]->type(FL_TOGGLE_BUTTON); - view.butt[7]->callback(view_options_ok_cb, (void*)"view_axes_auto_2d"); + view.choice[16] = new Fl_Choice + (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "2D axes/value scale position"); + view.choice[16]->menu(menu_position); + view.choice[16]->align(FL_ALIGN_RIGHT); + view.choice[16]->callback(view_options_ok_cb, (void*)"view_axes_auto_2d"); view.value[20] = new Fl_Value_Input (L + 2 * WB, 2 * WB + 9 * BH, IW / 2, BH); @@ -3876,7 +3887,7 @@ void optionWindow::activate(const char *what) } } else if(!strcmp(what, "view_axes_auto_2d")){ - if(view.butt[7]->value()){ + if(view.choice[16]->value()){ view.value[20]->deactivate(); view.value[21]->deactivate(); view.value[22]->deactivate(); diff --git a/Graphics/drawGraph2d.cpp b/Graphics/drawGraph2d.cpp index d39748ce4060d31c9bb98d5a07e66e3d9e221562..e04a32a632838350ebd8782ab038ff2503f1eabc 100644 --- a/Graphics/drawGraph2d.cpp +++ b/Graphics/drawGraph2d.cpp @@ -168,6 +168,17 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop, PViewData *data = p->getData(); PViewOptions *opt = p->getOptions(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(0.5, 0.5, 0.5, 0.5); + glBegin(GL_QUADS); + glVertex2d(xleft, ytop); + glVertex2d(xleft + width, ytop); + glVertex2d(xleft + width, ytop - height); + glVertex2d(xleft, ytop - height); + glEnd(); + glDisable(GL_BLEND); + if(!opt->axes) return; // total font height @@ -467,14 +478,7 @@ void drawContext::drawGraph2d() for(unsigned int i = 0; i < graphs.size(); i++){ PView *p = graphs[i]; PViewOptions *opt = graphs[i]->getOptions(); - if(!opt->autoPosition){ - double x = opt->position[0], y = opt->position[1]; - int center = fix2dCoordinates(&x, &y); - drawGraph(this, p, x - (center & 1 ? opt->size[0] / 2. : 0), - y + (center & 2 ? opt->size[1] / 2. : 0), - opt->size[0], opt->size[1]); - } - else{ + if(opt->autoPosition == 1){ // automatic double winw = viewport[2] - viewport[0]; double winh = viewport[3] - viewport[1]; if(graphs.size() == 1){ @@ -499,11 +503,33 @@ void drawContext::drawGraph2d() double w = fracw * winw / 2. - xsep; double h = frach * winh / 2. - ysep; double x = viewport[0] + (1 - fracw) / 3. * winw; - if(i == 1 || i == 3) x += (w + xsep + (1-fracw)/3. * winw); + if(i == 1 || i == 3) x += (w + xsep + (1 - fracw) / 3. * winw); double y = viewport[1] + (1 - frach) / 3. * winh; if(i == 2 || i == 3) y += (h + ysep + (1 - frach) / 3. * winh); drawGraph(this, p, x + 0.95 * xsep, viewport[3] - (y + 0.4 * ysep), w, h); } } + else if(opt->autoPosition >= 2 && opt->autoPosition <= 5){ + // top left (2), top right (3), bottom left (4), bottom right (5) + double winw = viewport[2] - viewport[0]; + double winh = viewport[3] - viewport[1]; + double fracw = 0.85, frach = 0.85; + double w = fracw * winw / 2. - xsep; + double h = frach * winh / 2. - ysep; + double x = viewport[0] + (1 - fracw) / 3. * winw; + if(opt->autoPosition == 3 || opt->autoPosition == 5) + x += (w + xsep + (1 - fracw) / 3. * winw); + double y = viewport[1] + (1 - frach) / 3. * winh; + if(opt->autoPosition == 4 || opt->autoPosition == 5) + y += (h + ysep + (1 - frach) / 3. * winh); + drawGraph(this, p, x + 0.95 * xsep, viewport[3] - (y + 0.4 * ysep), w, h); + } + else{ // manual + double x = opt->position[0], y = opt->position[1]; + int center = fix2dCoordinates(&x, &y); + drawGraph(this, p, x - (center & 1 ? opt->size[0] / 2. : 0), + y + (center & 2 ? opt->size[1] / 2. : 0), + opt->size[0], opt->size[1]); + } } } diff --git a/Post/PView.cpp b/Post/PView.cpp index 99dd1084b27e481428ac047ed9adc57f5d94da5a..f8491948d8f27eeea2ebc65136f2f4584e98e532 100644 --- a/Post/PView.cpp +++ b/Post/PView.cpp @@ -91,6 +91,8 @@ PView::PView(const std::string &xname, const std::string &yname, _options = new PViewOptions(PViewOptions::reference); _options->type = PViewOptions::Plot2D; _options->axes = 2; + _options->lineWidth = 2.; + _options->pointSize = 4.; _options->axesLabel[0] = xname; } diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index 2b1d17dae56b475044e1744f0a93db5da2dfaa3b..ae30bebe87ca3313a6b1d415dee3ae1d0b74907e 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -6,8 +6,8 @@ viewport around visible entities (shift+1:1 in GUI); unified post-processing field export; new experimental stereo+camera visualization mode; experimental BAMG & MMG3D support for anisotropic mesh generation; new OCC cut&merge algorithm imported from Salome; new ability to connect extruded meshes to -tetrahedral grids using pyramids; Abaqus (INP) mesh export; various bug fixes -and improvements. +tetrahedral grids using pyramids; new homology solver; Abaqus (INP) mesh export; +various bug fixes and improvements. 2.5.0 (Oct 15, 2010): new compound geometrical entities (for remeshing and/or trans-patch meshing); improved mesh reclassification tool; new client/server