diff --git a/Common/Context.h b/Common/Context.h index 34b1c0165e6b60f4a583cb23ab8a7b17e1626e35..f324232b97e8e6c0b666e9b9507fdfd370584e86 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -23,12 +23,14 @@ struct contextMeshOptions { int points, lines, triangles, quadrangles, tetrahedra, hexahedra, prisms, pyramids; int surfacesEdges, surfacesFaces, volumesEdges, volumesFaces, numSubEdges; int pointsNum, linesNum, surfacesNum, volumesNum, qualityType, labelType; - int optimize, optimizeNetgen, optimizeLloyd, smoothCrossField, refineSteps, remove4triangles; + int optimize, optimizeNetgen, optimizeLloyd, smoothCrossField, refineSteps; + int remove4triangles; double normals, tangents, explode, angleSmoothNormals, allowSwapEdgeAngle; double mshFileVersion, mshFilePartitioned, pointSize, lineWidth; double qualityInf, qualitySup, radiusInf, radiusSup; double scalingFactor, lcFactor, randFactor, lcIntegrationPrecision; - double lcMin, lcMax, toleranceEdgeLength, anisoMax, smoothRatio; + double lcMin, lcMax, toleranceEdgeLength, toleranceInitialDelaunay; + double anisoMax, smoothRatio; int lcFromPoints, lcFromCurvature, lcExtendFromBoundary; int dual, voronoi, drawSkinOnly, colorCarousel, labelSampling; int fileFormat, nbSmoothing, algo2d, algo3d, algoSubdivide; @@ -187,6 +189,8 @@ class CTX { // font name, FLTK enum and size for opengl graphics std::string glFont, glFontTitle, glFontEngine; int glFontEnum, glFontEnumTitle, glFontSize, glFontSizeTitle; + // font size of messages + int msgFontSize; // point/line widths double pointSize, lineWidth; // light options diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 57172b927bb55b376ef20e4773da5a582cf9ad57..c24426d9196a083be86974e4ab4d9245d1a42414 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -597,6 +597,8 @@ StringXNumber GeneralOptions_Number[] = { "Horizontal position (in pixels) of the (detached) menu tree" }, { F|S, "MenuPositionY" , opt_general_menu_position1 , 400. , "Vertical position (in pixels) of the (detached) menu tree" }, + { F|O, "MessageFontSize" , opt_general_message_fontsize , -1. , + "Size of the font in the message window (-1=automatic)" }, { F|S, "MessageHeight" , opt_general_message_size , 300. , "Height (in pixels) of the message console when it is visible (should be > 0)" }, { F, "MinX" , opt_general_xmin , 0. , @@ -1194,6 +1196,8 @@ StringXNumber MeshOptions_Number[] = { { F|O, "ToleranceEdgeLength" , opt_mesh_tolerance_edge_length, 0.0, "Skip a model edge in mesh generation if its length is less than user's " "defined tolerance" }, + { F|O, "ToleranceInitialDelaunay" , opt_mesh_tolerance_initial_delaunay, 1.e-8, + "Tolerance for initial 3D Delaunay mesher" }, { F|O, "Triangles" , opt_mesh_triangles , 1. , "Display mesh triangles?" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 86e1ef60a8e5eaa67ad34d0af34261231bdba5f7..62296cb7ea3f186593be73775efb5e939feeb406 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -2079,6 +2079,19 @@ double opt_general_message_size(OPT_ARGS_NUM) return CTX::instance()->msgSize; } +double opt_general_message_fontsize(OPT_ARGS_NUM) +{ + if(action & GMSH_SET){ + CTX::instance()->msgFontSize = (int)val; +#if defined(HAVE_FLTK) + if(FlGui::available() && (action & GMSH_GUI)){ + FlGui::instance()->graph[0]->setMessageFontSize(CTX::instance()->msgFontSize); + } +#endif + } + return CTX::instance()->msgFontSize; +} + double opt_general_detached_menu(OPT_ARGS_NUM) { if(action & GMSH_SET){ @@ -4784,6 +4797,13 @@ double opt_mesh_tolerance_edge_length(OPT_ARGS_NUM) return CTX::instance()->mesh.toleranceEdgeLength; } +double opt_mesh_tolerance_initial_delaunay(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->mesh.toleranceInitialDelaunay = val; + return CTX::instance()->mesh.toleranceInitialDelaunay; +} + double opt_mesh_lc_from_curvature(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index b2a800df076948677578df8bc882b93641acffa6..d6c51a09b0c0d47d0bceb661f3a8c3199a5d4d44 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -133,6 +133,7 @@ double opt_general_polygon_offset_factor(OPT_ARGS_NUM); double opt_general_polygon_offset_units(OPT_ARGS_NUM); double opt_general_system_menu_bar(OPT_ARGS_NUM); double opt_general_message_size(OPT_ARGS_NUM); +double opt_general_message_fontsize(OPT_ARGS_NUM); double opt_general_detached_menu(OPT_ARGS_NUM); double opt_general_menu_size0(OPT_ARGS_NUM); double opt_general_menu_size1(OPT_ARGS_NUM); @@ -384,6 +385,7 @@ double opt_mesh_scaling_factor(OPT_ARGS_NUM); double opt_mesh_lc_min(OPT_ARGS_NUM); double opt_mesh_lc_max(OPT_ARGS_NUM); double opt_mesh_tolerance_edge_length(OPT_ARGS_NUM); +double opt_mesh_tolerance_initial_delaunay(OPT_ARGS_NUM); double opt_mesh_lc_factor(OPT_ARGS_NUM); double opt_mesh_lc_from_curvature(OPT_ARGS_NUM); double opt_mesh_lc_from_points(OPT_ARGS_NUM); diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 8b9951d0997c249da1325b095fdf58017ff66d47..ec91132d2433318273392166744c7bb5ff4b9fec 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -2728,6 +2728,20 @@ static void message_menu_save_cb(Fl_Widget *w, void *data) g->saveMessages(fileChooserGetName(1).c_str()); } +#if 0 +static void message_menu_increase_font_cb(Fl_Widget *w, void *data) +{ + graphicWindow *g = (graphicWindow*)data; + g->changeMessageFontSize(1); +} + +static void message_menu_decrease_font_cb(Fl_Widget *w, void *data) +{ + graphicWindow *g = (graphicWindow*)data; + g->changeMessageFontSize(-1); +} +#endif + static void message_browser_cb(Fl_Widget *w, void *data) { graphicWindow *g = (graphicWindow*)data; @@ -2738,6 +2752,8 @@ static void message_browser_cb(Fl_Widget *w, void *data) message_menu_scroll_cb, g }, { "Clear Messages", 0, message_menu_clear_cb, g }, { "Save Messages...", 0, message_menu_save_cb, g }, + //{ "Increase font size", 0, message_menu_increase_font_cb, g }, + //{ "Decrease font size", 0, message_menu_decrease_font_cb, g }, { 0 } }; const Fl_Menu_Item *m = rclick_menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, 0); @@ -2996,7 +3012,12 @@ graphicWindow::graphicWindow(bool main, int numTiles, bool detachedMenu) _browser = new Fl_Browser(twidth, mh + glheight, glwidth, mheight); _browser->box(GMSH_SIMPLE_TOP_BOX); _browser->textfont(FL_SCREEN); - _browser->textsize(FL_NORMAL_SIZE - 2); + int s = CTX::instance()->msgFontSize; +#if defined(WIN32) // screen font on Windows is really small + _browser->textsize(s <= 0 ? FL_NORMAL_SIZE - 1 : s); +#else + _browser->textsize(s <= 0 ? FL_NORMAL_SIZE - 2 : s); +#endif _browser->type(FL_MULTI_BROWSER); _browser->callback(message_browser_cb, this); _browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars @@ -3251,7 +3272,7 @@ void graphicWindow::setStereo(bool st) gl[i]->mode(FL_RGB | FL_DEPTH | FL_DOUBLE | FL_STEREO); } else{ - gl[i]->mode(FL_RGB | FL_DEPTH | FL_DOUBLE ); + gl[i]->mode(FL_RGB | FL_DEPTH | FL_DOUBLE); } gl[i]->show(); } @@ -3452,6 +3473,23 @@ void graphicWindow::copySelectedMessagesToClipboard() Fl::copy(buff.c_str(), buff.size(), 1); } +void graphicWindow::setMessageFontSize(int size) +{ + if(!_browser) return; +#if defined(WIN32) // screen font on Windows is really small + _browser->textsize(size <= 0 ? FL_NORMAL_SIZE - 1 : size); +#else + _browser->textsize(size <= 0 ? FL_NORMAL_SIZE - 2 : size); +#endif + _browser->redraw(); +} + +void graphicWindow::changeMessageFontSize(int incr) +{ + if(!_browser) return; + setMessageFontSize(_browser->textsize() + incr); +} + void graphicWindow::fillRecentHistoryMenu() { #if defined(__APPLE__) diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index c8d54460515fdd7633317eb5db08da63ac35d811..b3cd3e94bcabda6c9c5b04b1ef583bbe5ef5359d 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -81,6 +81,8 @@ class graphicWindow{ void clearMessages(); void saveMessages(const char *filename); void copySelectedMessagesToClipboard(); + void setMessageFontSize(int size); + void changeMessageFontSize(int incr); void fillRecentHistoryMenu(); }; diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp index 68990517ea4605f9029b841b639505a8385b8e55..647f464037bc75e7a8f1fc0f704eb948b5748cbc 100644 --- a/Mesh/meshGRegion.cpp +++ b/Mesh/meshGRegion.cpp @@ -1153,9 +1153,9 @@ bool CreateAnEmptyVolumeMesh(GRegion *gr) char opts[128]; buildTetgenStructure(gr, in, numberedV, sqr); printf("tetgen structure created\n"); - sprintf(opts, "-Ype%c", - (Msg::GetVerbosity() < 3) ? 'Q': - (Msg::GetVerbosity() > 6) ? 'V': '\0'); + sprintf(opts, "-Ype%sT%g", + (Msg::GetVerbosity() < 3) ? "Q" : (Msg::GetVerbosity() > 6) ? "V" : "", + CTX::instance()->mesh.toleranceInitialDelaunay); try{ tetrahedralize(opts, &in, &out); } @@ -1214,29 +1214,10 @@ void MeshDelaunayVolumeTetgen(std::vector<GRegion*> ®ions) std::vector<MVertex*> numberedV; char opts[128]; buildTetgenStructure(gr, in, numberedV, sqr); - if(CTX::instance()->mesh.algo3d == ALGO_3D_FRONTAL_DEL || - CTX::instance()->mesh.algo3d == ALGO_3D_FRONTAL_HEX || - CTX::instance()->mesh.algo3d == ALGO_3D_MMG3D || - CTX::instance()->mesh.algo2d == ALGO_2D_FRONTAL_QUAD || - CTX::instance()->mesh.algo2d == ALGO_2D_BAMG){ - sprintf(opts, "Ype%c", (Msg::GetVerbosity() < 3) ? 'Q': - (Msg::GetVerbosity() > 6) ? 'V': '\0'); - // removed -q because mesh sizes at new vertices are wrong - // sprintf(opts, "-q1.5pY%c", (Msg::GetVerbosity() < 3) ? 'Q': - // (Msg::GetVerbosity() > 6) ? 'V': '\0'); - } - else if (CTX::instance()->mesh.algo3d == ALGO_3D_RTREE){ - sprintf(opts, "S0Ype%c", (Msg::GetVerbosity() < 3) ? 'Q': - (Msg::GetVerbosity() > 6) ? 'V': '\0'); - } - else { - sprintf(opts, "Ype%c", - (Msg::GetVerbosity() < 3) ? 'Q': - (Msg::GetVerbosity() > 6) ? 'V': '\0'); - // removed -q because mesh sizes at new vertices are wrong - // sprintf(opts, "-q3.5Ype%c", (Msg::GetVerbosity() < 3) ? 'Q': - // (Msg::GetVerbosity() > 6) ? 'V': '\0');*/ - } + sprintf(opts, "%sYpe%sT%g", + CTX::instance()->mesh.algo3d == ALGO_3D_RTREE ? "S0" : "", + (Msg::GetVerbosity() < 3) ? "Q" : (Msg::GetVerbosity() > 6) ? "V" : "", + CTX::instance()->mesh.toleranceInitialDelaunay); try{ tetrahedralize(opts, &in, &out); }