diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index d26a0aa5e95cdeb394c72e1c66185cd93d520da4..bdd5f835bb5acbc97c39ba69ea7c3d2706e864a7 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -73,7 +73,7 @@ void FlGui::wait(double time) void FlGui::lock() { #if defined(_OPENMP) - if(Msg::GetThreadNum() > 0){ + if(Msg::GetThreadNum() > 0) { Fl::lock(); } #endif @@ -82,9 +82,9 @@ void FlGui::lock() void FlGui::unlock() { #if defined(_OPENMP) - if(Msg::GetThreadNum() > 0){ + if(Msg::GetThreadNum() > 0) { Fl::unlock(); - //Fl::awake(); + // Fl::awake(); } #endif } @@ -117,46 +117,82 @@ static int globalShortcut(int event) static void simple_right_box_draw(int x, int y, int w, int h, Fl_Color c) { - fl_color(c); fl_rectf(x, y, w, h); - fl_color(FL_DARK2); fl_line(x + w - 1, y, x + w - 1, y + h); + fl_color(c); + fl_rectf(x, y, w, h); + fl_color(FL_DARK2); + fl_line(x + w - 1, y, x + w - 1, y + h); } static void simple_top_box_draw(int x, int y, int w, int h, Fl_Color c) { - fl_color(c); fl_rectf(x, y, w, h); - fl_color(FL_DARK2); fl_line(x, y, x + w, y); + fl_color(c); + fl_rectf(x, y, w, h); + fl_color(FL_DARK2); + fl_line(x, y, x + w, y); } // Icons for the satus bar -#define vv(x,y) fl_vertex(x,y) +#define vv(x, y) fl_vertex(x, y) #define bl fl_begin_loop() #define el fl_end_loop() static void gmsh_play(Fl_Color c) { fl_color(c); - bl; vv(-0.3,0.8); vv(0.5,0.0); vv(-0.3,-0.8); el; + bl; + vv(-0.3, 0.8); + vv(0.5, 0.0); + vv(-0.3, -0.8); + el; } static void gmsh_pause(Fl_Color c) { fl_color(c); - bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el; - bl; vv(0.0,-0.8); vv(0.5,-0.8); vv(0.5,0.8); vv(0.0,0.8); el; + bl; + vv(-0.8, -0.8); + vv(-0.3, -0.8); + vv(-0.3, 0.8); + vv(-0.8, 0.8); + el; + bl; + vv(0.0, -0.8); + vv(0.5, -0.8); + vv(0.5, 0.8); + vv(0.0, 0.8); + el; } static void gmsh_rewind(Fl_Color c) { fl_color(c); - bl; vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); el; - bl; vv(-0.3,0.0); vv(0.5,-0.8); vv(0.5,0.8); el; + bl; + vv(-0.8, -0.8); + vv(-0.3, -0.8); + vv(-0.3, 0.8); + vv(-0.8, 0.8); + el; + bl; + vv(-0.3, 0.0); + vv(0.5, -0.8); + vv(0.5, 0.8); + el; } static void gmsh_forward(Fl_Color c) { fl_color(c); - bl; vv(0.0,0.8); vv(0.8,0.0); vv(0.0,-0.8); el; - bl; vv(-0.8,0.8); vv(-0.3,0.8); vv(-0.3,-0.8); vv(-0.8,-0.8); el; + bl; + vv(0.0, 0.8); + vv(0.8, 0.0); + vv(0.0, -0.8); + el; + bl; + vv(-0.8, 0.8); + vv(-0.3, 0.8); + vv(-0.3, -0.8); + vv(-0.8, -0.8); + el; } static void gmsh_back(Fl_Color c) @@ -168,17 +204,35 @@ static void gmsh_back(Fl_Color c) static void gmsh_rotate(Fl_Color c) { fl_color(c); - fl_begin_line(); fl_arc(0.0, -0.1, 0.7, 0.0, 270.0); fl_end_line(); - fl_begin_polygon(); vv(0.5,0.6); vv(-0.1,0.9); vv(-0.1,0.3); fl_end_polygon(); + fl_begin_line(); + fl_arc(0.0, -0.1, 0.7, 0.0, 270.0); + fl_end_line(); + fl_begin_polygon(); + vv(0.5, 0.6); + vv(-0.1, 0.9); + vv(-0.1, 0.3); + fl_end_polygon(); } static void gmsh_models(Fl_Color c) { fl_color(c); - bl; vv(-0.8,-0.7); vv(0.8,-0.7); el; - bl; vv(-0.8,-0.2); vv(0.8,-0.2); el; - bl; vv(-0.8,0.3); vv(0.8,0.3); el; - bl; vv(-0.8,0.8); vv(0.8,0.8); el; + bl; + vv(-0.8, -0.7); + vv(0.8, -0.7); + el; + bl; + vv(-0.8, -0.2); + vv(0.8, -0.2); + el; + bl; + vv(-0.8, 0.3); + vv(0.8, 0.3); + el; + bl; + vv(-0.8, 0.8); + vv(0.8, 0.8); + el; } static void gmsh_gear(Fl_Color c) @@ -196,7 +250,7 @@ static void gmsh_gear(Fl_Color c) fl_circle(0, 0, 0.5); fl_end_line(); fl_line_style(FL_SOLID); - for(int i = 0; i < 8; i++){ + for(int i = 0; i < 8; i++) { fl_rotate(45); fl_begin_polygon(); fl_vertex(h1, -w); @@ -210,8 +264,17 @@ static void gmsh_gear(Fl_Color c) static void gmsh_graph(Fl_Color c) { fl_color(c); - fl_begin_line(); vv(-0.8,-0.8); vv(-0.8,0.8); vv(0.8,0.8); fl_end_line(); - fl_begin_line(); vv(-0.8,0.3); vv(-0.2,-0.2); vv(0.3,0.1); vv(0.8,-0.4); fl_end_line(); + fl_begin_line(); + vv(-0.8, -0.8); + vv(-0.8, 0.8); + vv(0.8, 0.8); + fl_end_line(); + fl_begin_line(); + vv(-0.8, 0.3); + vv(-0.2, -0.2); + vv(0.3, 0.1); + vv(0.8, -0.4); + fl_end_line(); } static void gmsh_search(Fl_Color col) @@ -219,10 +282,15 @@ static void gmsh_search(Fl_Color col) double e = 0.5; fl_color(col); fl_begin_polygon(); - vv(.6-e, .33); vv(1.2-e, .93); vv(.93-e, 1.2); vv(.33-e, .6); + vv(.6 - e, .33); + vv(1.2 - e, .93); + vv(.93 - e, 1.2); + vv(.33 - e, .6); fl_end_polygon(); fl_line_style(FL_SOLID, 2); - fl_begin_loop(); fl_circle(0-e, 0, .6); fl_end_loop(); + fl_begin_loop(); + fl_circle(0 - e, 0, .6); + fl_end_loop(); fl_line_style(FL_SOLID); } @@ -230,15 +298,24 @@ static void gmsh_colormap(Fl_Color col) { fl_color(FL_RED); fl_begin_polygon(); - vv(-0.8,-0.8); vv(-0.3,-0.8); vv(-0.3,0.8); vv(-0.8,0.8); + vv(-0.8, -0.8); + vv(-0.3, -0.8); + vv(-0.3, 0.8); + vv(-0.8, 0.8); fl_end_polygon(); fl_color(FL_GREEN); fl_begin_polygon(); - vv(-0.3,-0.8); vv(0.2,-0.8); vv(0.2,0.8); vv(-0.3,0.8); + vv(-0.3, -0.8); + vv(0.2, -0.8); + vv(0.2, 0.8); + vv(-0.3, 0.8); fl_end_polygon(); fl_color(FL_BLUE); fl_begin_polygon(); - vv(0.2,-0.8); vv(0.7,-0.8); vv(0.7,0.8); vv(0.2,0.8); + vv(0.2, -0.8); + vv(0.7, -0.8); + vv(0.7, 0.8); + vv(0.2, 0.8); fl_end_polygon(); } @@ -249,11 +326,11 @@ static void gmsh_colormap(Fl_Color col) // question presence of gamepad every 3. seconds static void gamepad_handler(void *data) { - if (CTX::instance()->gamepad && CTX::instance()->gamepad->active) { + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { CTX::instance()->gamepad->read_event(); Fl::add_timeout(CTX::instance()->gamepad->frequency, gamepad_handler, data); } - else{ + else { Fl::add_timeout(.5, gamepad_handler, data); } } @@ -265,12 +342,12 @@ static void error_handler(const char *fmt, ...) va_start(args, fmt); vsnprintf(str, sizeof(str), fmt, args); va_end(args); - if(!strcmp(str, "Insufficient GL support")){ // this should be fatal + if(!strcmp(str, "Insufficient GL support")) { // this should be fatal CTX::instance()->terminal = 1; Msg::Error("%s (FLTK internal error)", str); Msg::Fatal("Your system does not seem to support OpenGL - aborting"); } - else{ + else { Msg::Error("%s (FLTK internal error)", str); } } @@ -292,23 +369,23 @@ void FlGui::applyColorScheme() int N = 4 + FL_NUM_GRAY; static std::vector<unsigned char> r(N, 0), g(N, 0), b(N, 0); - if(first){ + if(first) { // store default (OS-dependent) interface colors: Fl::get_system_colors(); Fl::get_color(FL_BACKGROUND_COLOR, r[0], g[0], b[0]); Fl::get_color(FL_BACKGROUND2_COLOR, r[1], g[1], b[1]); Fl::get_color(FL_FOREGROUND_COLOR, r[2], g[2], b[2]); Fl::get_color(FL_SELECTION_COLOR, r[3], g[3], b[3]); - for (int i = 0; i < FL_NUM_GRAY; i++) { + for(int i = 0; i < FL_NUM_GRAY; i++) { Fl::get_color(fl_gray_ramp(i), r[4 + i], g[4 + i], b[4 + i]); } } - if(CTX::instance()->guiColorScheme == 1){ // dark mode + if(CTX::instance()->guiColorScheme == 1) { // dark mode Fl::set_color(FL_BACKGROUND_COLOR, 50, 50, 50); Fl::set_color(FL_BACKGROUND2_COLOR, 120, 120, 120); Fl::set_color(FL_FOREGROUND_COLOR, 240, 240, 240); - for (int i = 0; i < FL_NUM_GRAY; i++) { + for(int i = 0; i < FL_NUM_GRAY; i++) { double min = 0., max = 135.; int d = (int)(min + i * (max - min) / (FL_NUM_GRAY - 1.)); Fl::set_color(fl_gray_ramp(i), d, d, d); @@ -317,13 +394,13 @@ void FlGui::applyColorScheme() Fl::set_color(FL_SELECTION_COLOR, 200, 200, 200); if(available()) updateViews(true, true); } - else if(!first && available() && CTX::instance()->guiColorScheme == 0){ + else if(!first && available() && CTX::instance()->guiColorScheme == 0) { // retore default colors (only if not calling the routine from the // constructor) Fl::set_color(FL_BACKGROUND_COLOR, r[0], g[0], b[0]); Fl::set_color(FL_BACKGROUND2_COLOR, r[1], g[1], b[1]); Fl::set_color(FL_FOREGROUND_COLOR, r[2], g[2], b[2]); - for (int i = 0; i < FL_NUM_GRAY; i++) { + for(int i = 0; i < FL_NUM_GRAY; i++) { Fl::set_color(fl_gray_ramp(i), r[4 + i], g[4 + i], b[4 + i]); } Fl::reload_scheme(); @@ -364,15 +441,13 @@ FlGui::FlGui(int argc, char **argv) Fl::set_boxtype(GMSH_SIMPLE_TOP_BOX, simple_top_box_draw, 0, 1, 0, 1); // add gamepad handler - if(CTX::instance()->gamepad) - Fl::add_timeout(5.,gamepad_handler, (void*)0); + if(CTX::instance()->gamepad) Fl::add_timeout(5., gamepad_handler, (void *)0); // add global shortcuts Fl::add_handler(globalShortcut); // make sure a global drawing context is setup - if(!drawContext::global()) - drawContext::setGlobal(new drawContextFltk); + if(!drawContext::global()) drawContext::setGlobal(new drawContextFltk); // set default font size FL_NORMAL_SIZE = drawContext::global()->getFontSize(); @@ -384,9 +459,9 @@ FlGui::FlGui(int argc, char **argv) Fl_Tooltip::delay(0.5); // use retina resolution if available -#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) +#if(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) Fl::use_high_res_GL(CTX::instance()->highResolutionGraphics); -#elif (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) +#elif(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) Fl::use_high_res_GL(CTX::instance()->highResolutionGraphics); #endif @@ -421,11 +496,12 @@ FlGui::FlGui(int argc, char **argv) // create main graphic window (note that we create all the windows even if // some are not displayed, since the shortcuts should be valid even for hidden // windows, and we don't want to test for widget existence every time) - graph.push_back(new graphicWindow(true, CTX::instance()->numTiles, - CTX::instance()->detachedMenu ? true : false)); + graph.push_back( + new graphicWindow(true, CTX::instance()->numTiles, + CTX::instance()->detachedMenu ? true : false)); #if defined(WIN32) - graph[0]->getWindow()->icon - ((const void*)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON))); + graph[0]->getWindow()->icon( + (const void *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON))); #elif defined(__APPLE__) // nothing to do here #else @@ -442,12 +518,11 @@ FlGui::FlGui(int argc, char **argv) \x08\x00\xff\x1f\x08\x00\xff\x1f\x04\x40\xfd\x3f\ \x04\xa8\xea\x3f\x02\x55\x55\x7f\xa2\xaa\xaa\x7a\ \xff\xff\xff\xff\x00\x00\x00\x00"; - graph[0]->getWindow()->icon - ((const char*)XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display), - gmsh32x32, 32, 32)); + graph[0]->getWindow()->icon((const char *)XCreateBitmapFromData( + fl_display, DefaultRootWindow(fl_display), gmsh32x32, 32, 32)); #endif - graph[0]->getWindow()->show(argc >0 ? 1 : 0, argv); + graph[0]->getWindow()->show(argc > 0 ? 1 : 0, argv); if(graph[0]->getMenuWindow()) graph[0]->getMenuWindow()->show(); // re-apply color scheme (necessary for some reason to get the selection color @@ -462,12 +537,11 @@ FlGui::FlGui(int argc, char **argv) onelab = graph.back()->getMenu(); // create additional graphic windows - for(int i = 1; i < CTX::instance()->numWindows; i++){ + for(int i = 1; i < CTX::instance()->numWindows; i++) { graphicWindow *g = new graphicWindow(false, CTX::instance()->numTiles); - g->getWindow()->resize(graph.back()->getWindow()->x() + 10, - graph.back()->getWindow()->y() + 10, - graph.back()->getWindow()->w(), - graph.back()->getWindow()->h()); + g->getWindow()->resize( + graph.back()->getWindow()->x() + 10, graph.back()->getWindow()->y() + 10, + graph.back()->getWindow()->w(), graph.back()->getWindow()->h()); g->getWindow()->show(); graph.push_back(g); } @@ -484,7 +558,7 @@ FlGui::FlGui(int argc, char **argv) fullscreen->mode(mode); fullscreen->end(); fullscreen->fullscreen(); -#if !defined (__APPLE__) +#if !defined(__APPLE__) fullscreen->icon(graph[0]->getWindow()->icon()); #endif @@ -497,7 +571,8 @@ FlGui::FlGui(int argc, char **argv) highordertools = new highOrderToolsWindow(CTX::instance()->deltaFontSize); clipping = new clippingWindow(CTX::instance()->deltaFontSize); manip = new manipWindow(CTX::instance()->deltaFontSize); - elementaryContext = new elementaryContextWindow(CTX::instance()->deltaFontSize); + elementaryContext = + new elementaryContextWindow(CTX::instance()->deltaFontSize); transformContext = new transformContextWindow(CTX::instance()->deltaFontSize); physicalContext = new physicalContextWindow(CTX::instance()->deltaFontSize); meshContext = new meshContextWindow(CTX::instance()->deltaFontSize); @@ -511,24 +586,19 @@ FlGui::FlGui(int argc, char **argv) for(unsigned int j = 0; j < graph[i]->gl.size(); j++) graph[i]->gl[j]->redraw(); - if(CTX::instance()->showOptionsOnStartup) - options->win->show(); - if(CTX::instance()->showMessagesOnStartup) - graph[0]->showMessages(); + if(CTX::instance()->showOptionsOnStartup) options->win->show(); + if(CTX::instance()->showMessagesOnStartup) graph[0]->showMessages(); } FlGui *FlGui::_instance = 0; std::string FlGui::_openedThroughMacFinder = ""; bool FlGui::_finishedProcessingCommandLine = false; -bool FlGui::available() -{ - return _instance != 0; -} +bool FlGui::available() { return _instance != 0; } FlGui *FlGui::instance(int argc, char **argv) { - if(!_instance){ + if(!_instance) { _instance = new FlGui(argc, argv); // set all options in the new GUI InitOptionsGUI(0); @@ -591,12 +661,14 @@ int FlGui::testGlobalShortcuts(int event) mesh_3d_cb(0, 0); status = 1; } - else if(Fl::test_shortcut(FL_CTRL + 'q') || Fl::test_shortcut(FL_META + 'q')){ + else if(Fl::test_shortcut(FL_CTRL + 'q') || + Fl::test_shortcut(FL_META + 'q')) { // only necessary when using the system menu bar, but hey, it cannot hurt... file_quit_cb(0, 0); status = 1; } - else if(Fl::test_shortcut(FL_CTRL + 't') || Fl::test_shortcut(FL_META + 't')){ + else if(Fl::test_shortcut(FL_CTRL + 't') || + Fl::test_shortcut(FL_META + 't')) { show_hide_menu_cb(0, 0); status = 1; } @@ -685,29 +757,29 @@ int FlGui::testGlobalShortcuts(int event) Fl::test_shortcut(FL_SHIFT + FL_Escape) || Fl::test_shortcut(FL_CTRL + FL_Escape) || Fl::test_shortcut(FL_ALT + FL_Escape)) { - if(fullscreen->shown()){ - window_cb(0, (void*)"fullscreen"); + if(fullscreen->shown()) { + window_cb(0, (void *)"fullscreen"); status = 1; } - else{ + else { bool lasso = false; for(unsigned int i = 0; i < graph.size(); i++) for(unsigned int j = 0; j < graph[i]->gl.size(); j++) if(graph[i]->gl[j]->lassoMode) lasso = true; - if(lasso){ + if(lasso) { for(unsigned int i = 0; i < graph.size(); i++) for(unsigned int j = 0; j < graph[i]->gl.size(); j++) graph[i]->gl[j]->lassoMode = false; status = 2; } - else{ + else { status_options_cb(0, (void *)"S"); status = 1; } } } else if(Fl::test_shortcut(FL_SHIFT + 'a')) { - window_cb(0, (void*)"front"); + window_cb(0, (void *)"front"); status = 1; } else if(Fl::test_shortcut(FL_SHIFT + 'o')) { @@ -731,12 +803,13 @@ int FlGui::testGlobalShortcuts(int event) status = 1; } else if(Fl::test_shortcut(FL_SHIFT + 'w')) { - view_options_cb(0, (void*)-1); + view_options_cb(0, (void *)-1); status = 1; } else if(Fl::test_shortcut(FL_SHIFT + 'u')) { - if(PView::list.size()){ - if(options->view.index >= 0 && options->view.index < (int)PView::list.size()) + if(PView::list.size()) { + if(options->view.index >= 0 && + options->view.index < (int)PView::list.size()) plugins->show(options->view.index); else plugins->show(0); @@ -744,43 +817,41 @@ int FlGui::testGlobalShortcuts(int event) status = 1; } else if(Fl::test_shortcut(FL_ALT + 'f')) { - opt_general_fast_redraw - (0, GMSH_SET | GMSH_GUI, !opt_general_fast_redraw(0, GMSH_GET, 0)); + opt_general_fast_redraw(0, GMSH_SET | GMSH_GUI, + !opt_general_fast_redraw(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'b')) { - opt_general_draw_bounding_box - (0, GMSH_SET | GMSH_GUI, !opt_general_draw_bounding_box(0, GMSH_GET, 0)); + opt_general_draw_bounding_box( + 0, GMSH_SET | GMSH_GUI, !opt_general_draw_bounding_box(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'i')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_show_scale - (i, GMSH_SET | GMSH_GUI, !opt_view_show_scale(i, GMSH_GET, 0)); + opt_view_show_scale(i, GMSH_SET | GMSH_GUI, + !opt_view_show_scale(i, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'c')) { - opt_general_color_scheme - (0, GMSH_SET | GMSH_GUI, opt_general_color_scheme(0, GMSH_GET, 0) + 1); + opt_general_color_scheme(0, GMSH_SET | GMSH_GUI, + opt_general_color_scheme(0, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'c')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_colormap_number - (i, GMSH_SET | GMSH_GUI, opt_view_colormap_number(i, GMSH_GET, 0) + 1); + opt_view_colormap_number(i, GMSH_SET | GMSH_GUI, + opt_view_colormap_number(i, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'w')) { - opt_geometry_light - (0, GMSH_SET | GMSH_GUI, !opt_geometry_light(0, GMSH_GET, 0)); - opt_mesh_light - (0, GMSH_SET | GMSH_GUI, !opt_mesh_light(0, GMSH_GET, 0)); + opt_geometry_light(0, GMSH_SET | GMSH_GUI, + !opt_geometry_light(0, GMSH_GET, 0)); + opt_mesh_light(0, GMSH_SET | GMSH_GUI, !opt_mesh_light(0, GMSH_GET, 0)); for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_light - (i, GMSH_SET | GMSH_GUI, !opt_view_light(i, GMSH_GET, 0)); + opt_view_light(i, GMSH_SET | GMSH_GUI, !opt_view_light(i, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'x') || @@ -803,36 +874,37 @@ int FlGui::testGlobalShortcuts(int event) status = 1; } else if(Fl::test_shortcut(FL_ALT + 'a')) { - opt_general_axes - (0, GMSH_SET | GMSH_GUI, opt_general_axes(0, GMSH_GET, 0) + 1); + opt_general_axes(0, GMSH_SET | GMSH_GUI, + opt_general_axes(0, GMSH_GET, 0) + 1); for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_axes(i, GMSH_SET | GMSH_GUI, opt_view_axes(i, GMSH_GET, 0) + 1); + opt_view_axes(i, GMSH_SET | GMSH_GUI, + opt_view_axes(i, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'a')) { - opt_general_small_axes - (0, GMSH_SET | GMSH_GUI, !opt_general_small_axes(0, GMSH_GET, 0)); + opt_general_small_axes(0, GMSH_SET | GMSH_GUI, + !opt_general_small_axes(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'p')) { - opt_geometry_points - (0, GMSH_SET | GMSH_GUI, !opt_geometry_points(0, GMSH_GET, 0)); + opt_geometry_points(0, GMSH_SET | GMSH_GUI, + !opt_geometry_points(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'l')) { - opt_geometry_curves - (0, GMSH_SET | GMSH_GUI, !opt_geometry_curves(0, GMSH_GET, 0)); + opt_geometry_curves(0, GMSH_SET | GMSH_GUI, + !opt_geometry_curves(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 's')) { - opt_geometry_surfaces - (0, GMSH_SET | GMSH_GUI, !opt_geometry_surfaces(0, GMSH_GET, 0)); + opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, + !opt_geometry_surfaces(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'v')) { - opt_geometry_volumes - (0, GMSH_SET | GMSH_GUI, !opt_geometry_volumes(0, GMSH_GET, 0)); + opt_geometry_volumes(0, GMSH_SET | GMSH_GUI, + !opt_geometry_volumes(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'p')) { @@ -840,33 +912,32 @@ int FlGui::testGlobalShortcuts(int event) status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'l')) { - opt_mesh_lines - (0, GMSH_SET | GMSH_GUI, !opt_mesh_lines(0, GMSH_GET, 0)); + opt_mesh_lines(0, GMSH_SET | GMSH_GUI, !opt_mesh_lines(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 's')) { - opt_mesh_surfaces_edges - (0, GMSH_SET | GMSH_GUI, !opt_mesh_surfaces_edges(0, GMSH_GET, 0)); + opt_mesh_surfaces_edges(0, GMSH_SET | GMSH_GUI, + !opt_mesh_surfaces_edges(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'v')) { - opt_mesh_volumes_edges - (0, GMSH_SET | GMSH_GUI, !opt_mesh_volumes_edges(0, GMSH_GET, 0)); + opt_mesh_volumes_edges(0, GMSH_SET | GMSH_GUI, + !opt_mesh_volumes_edges(0, GMSH_GET, 0)); status = 2; } - else if(Fl::test_shortcut(FL_ALT + 'd')){ - opt_geometry_surface_type - (0, GMSH_SET | GMSH_GUI, opt_geometry_surface_type(0, GMSH_GET, 0) + 1); + else if(Fl::test_shortcut(FL_ALT + 'd')) { + opt_geometry_surface_type(0, GMSH_SET | GMSH_GUI, + opt_geometry_surface_type(0, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'd')) { - opt_mesh_surfaces_faces - (0, GMSH_SET | GMSH_GUI, !opt_mesh_surfaces_faces(0, GMSH_GET, 0)); + opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI, + !opt_mesh_surfaces_faces(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 'b')) { - opt_mesh_volumes_faces - (0, GMSH_SET | GMSH_GUI, !opt_mesh_volumes_faces(0, GMSH_GET, 0)); + opt_mesh_volumes_faces(0, GMSH_SET | GMSH_GUI, + !opt_mesh_volumes_faces(0, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'm')) { @@ -875,7 +946,7 @@ int FlGui::testGlobalShortcuts(int event) } else if(Fl::test_shortcut(FL_ALT + 't')) { for(unsigned int i = 0; i < PView::list.size(); i++) - if(opt_view_visible(i, GMSH_GET, 0)){ + if(opt_view_visible(i, GMSH_GET, 0)) { int t = opt_view_intervals_type(i, GMSH_GET, 0) + 1; if(t == 4) t = 1; // skip numeric display opt_view_intervals_type(i, GMSH_SET | GMSH_GUI, t); @@ -885,30 +956,30 @@ int FlGui::testGlobalShortcuts(int event) else if(Fl::test_shortcut(FL_ALT + FL_SHIFT + 't')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_intervals_type - (i, GMSH_SET | GMSH_GUI, opt_view_intervals_type(i, GMSH_GET, 0) + 1); + opt_view_intervals_type(i, GMSH_SET | GMSH_GUI, + opt_view_intervals_type(i, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'r')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_range_type - (i, GMSH_SET | GMSH_GUI, opt_view_range_type(i, GMSH_GET, 0) + 1); + opt_view_range_type(i, GMSH_SET | GMSH_GUI, + opt_view_range_type(i, GMSH_GET, 0) + 1); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'n')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_draw_strings - (i, GMSH_SET | GMSH_GUI, !opt_view_draw_strings(i, GMSH_GET, 0)); + opt_view_draw_strings(i, GMSH_SET | GMSH_GUI, + !opt_view_draw_strings(i, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'e') || Fl::test_shortcut(FL_ALT + FL_SHIFT + 'e')) { for(unsigned int i = 0; i < PView::list.size(); i++) if(opt_view_visible(i, GMSH_GET, 0)) - opt_view_show_element - (i, GMSH_SET | GMSH_GUI, !opt_view_show_element(i, GMSH_GET, 0)); + opt_view_show_element(i, GMSH_SET | GMSH_GUI, + !opt_view_show_element(i, GMSH_GET, 0)); status = 2; } else if(Fl::test_shortcut(FL_ALT + 'h')) { @@ -922,7 +993,7 @@ int FlGui::testGlobalShortcuts(int event) status = 1; } - if(status == 2){ + if(status == 2) { drawContext::global()->draw(); return 1; } @@ -969,7 +1040,7 @@ int FlGui::testArrowShortcuts() void FlGui::setGraphicTitle(const std::string &title) { - for(unsigned int i = 0; i < graph.size(); i++){ + for(unsigned int i = 0; i < graph.size(); i++) { std::ostringstream sstream; if(title.empty()) sstream << "Gmsh"; @@ -983,9 +1054,8 @@ void FlGui::setGraphicTitle(const std::string &title) void FlGui::updateViews(bool numberOfViewsHasChanged, bool deleteWidgets) { - for(unsigned int i = 0; i < graph.size(); i++) - graph[i]->checkAnimButtons(); - if(numberOfViewsHasChanged){ + for(unsigned int i = 0; i < graph.size(); i++) graph[i]->checkAnimButtons(); + if(numberOfViewsHasChanged) { if(onelab) onelab->rebuildTree(deleteWidgets); options->resetBrowser(); options->resetExternalViewList(); @@ -1002,10 +1072,8 @@ void FlGui::updateFields() void FlGui::resetVisibility() { - if(visibility->win->shown()) - visibility_cb(NULL, NULL); - if(help->options->shown()) - help_options_cb(NULL, NULL); + if(visibility->win->shown()) visibility_cb(NULL, NULL); + if(help->options->shown()) help_options_cb(NULL, NULL); } openglWindow *FlGui::getCurrentOpenglWindow() @@ -1019,9 +1087,8 @@ openglWindow *FlGui::getCurrentOpenglWindow() void FlGui::splitCurrentOpenglWindow(char how) { openglWindow *g = getCurrentOpenglWindow(); - for(unsigned int i = 0; i < graph.size(); i++){ - if(graph[i]->split(g, how)) - break; + for(unsigned int i = 0; i < graph.size(); i++) { + if(graph[i]->split(g, how)) break; } } @@ -1035,13 +1102,14 @@ void FlGui::copyCurrentOpenglWindowToClipboard() width -= width % 4; // get pixels - PixelBuffer *buffer = new PixelBuffer(width, height, GL_RGB, GL_UNSIGNED_BYTE); + PixelBuffer *buffer = + new PixelBuffer(width, height, GL_RGB, GL_UNSIGNED_BYTE); buffer->fill(0); - unsigned char *pixels = (unsigned char*)buffer->getPixels(); + unsigned char *pixels = (unsigned char *)buffer->getPixels(); // swap R and B since Windows bitmap format is BGR int nBytes = 3 * width * height; - for(int i = 0; i < nBytes; i += 3){ + for(int i = 0; i < nBytes; i += 3) { unsigned char tmp = pixels[i]; pixels[i] = pixels[i + 2]; pixels[i + 2] = tmp; @@ -1062,8 +1130,9 @@ void FlGui::copyCurrentOpenglWindowToClipboard() header.biClrImportant = 0; // generate handle - HANDLE handle = (HANDLE)::GlobalAlloc(GHND, sizeof(BITMAPINFOHEADER) + nBytes); - if(handle != NULL){ + HANDLE handle = + (HANDLE)::GlobalAlloc(GHND, sizeof(BITMAPINFOHEADER) + nBytes); + if(handle != NULL) { // lock handle char *pData = (char *)::GlobalLock((HGLOBAL)handle); // copy header and data @@ -1084,42 +1153,44 @@ void FlGui::copyCurrentOpenglWindowToClipboard() char FlGui::selectEntity(int type) { - return getCurrentOpenglWindow()->selectEntity - (type, selectedVertices, selectedEdges, selectedFaces, selectedRegions, - selectedElements, selectedPoints, selectedViews); + return getCurrentOpenglWindow()->selectEntity( + type, selectedVertices, selectedEdges, selectedFaces, selectedRegions, + selectedElements, selectedPoints, selectedViews); } void FlGui::setStatus(const std::string &msg, bool opengl) { - if(!opengl){ + if(!opengl) { _lastStatus = msg; static char buff[1024]; std::string tmp = std::string(" ") + msg; int ne = Msg::GetErrorCount(), nw = Msg::GetWarningCount(); - if((ne || nw) && graph[0]->getMessageHeight() < FL_NORMAL_SIZE){ + if((ne || nw) && graph[0]->getMessageHeight() < FL_NORMAL_SIZE) { tmp += " - "; - char n[128]; sprintf(n, "%d", ne ? ne : nw); + char n[128]; + sprintf(n, "%d", ne ? ne : nw); tmp += n; - tmp += (ne > 1) ? " Errors" : ne ? " Error" : (nw > 1) ? " Warnings" : " Warning"; + tmp += (ne > 1) ? " Errors" : + ne ? " Error" : (nw > 1) ? " Warnings" : " Warning"; tmp += " : Click to show messages [ ... "; tmp += (ne ? Msg::GetFirstError() : Msg::GetFirstWarning()); tmp += " ... ]"; } strncpy(buff, tmp.c_str(), sizeof(buff) - 1); buff[sizeof(buff) - 1] = '\0'; - for(unsigned int i = 0; i < graph.size(); i++){ + for(unsigned int i = 0; i < graph.size(); i++) { graph[i]->getProgress()->label(buff); graph[i]->getProgress()->redraw(); } } - else{ + else { openglWindow *gl = getCurrentOpenglWindow(); int n = msg.size(); int i = 0; - while(i < n) if(msg[i++] == '\n') break; + while(i < n) + if(msg[i++] == '\n') break; gl->screenMessage[0] = msg; - if(i) - gl->screenMessage[0].resize(i - 1); + if(i) gl->screenMessage[0].resize(i - 1); if(i < n) gl->screenMessage[1] = msg.substr(i); else @@ -1130,14 +1201,14 @@ void FlGui::setStatus(const std::string &msg, bool opengl) void FlGui::setLastStatus(int col) { - for(unsigned int i = 0; i < graph.size(); i++){ - if(col >= 0 && graph[0]->getMessageHeight() < FL_NORMAL_SIZE){ + for(unsigned int i = 0; i < graph.size(); i++) { + if(col >= 0 && graph[0]->getMessageHeight() < FL_NORMAL_SIZE) { if(CTX::instance()->guiColorScheme) // dark graph[i]->getProgress()->color(col); else graph[i]->getProgress()->labelcolor(col); } - else{ + else { graph[i]->getProgress()->color(FL_BACKGROUND_COLOR); graph[i]->getProgress()->labelcolor(FL_FOREGROUND_COLOR); } @@ -1145,9 +1216,10 @@ void FlGui::setLastStatus(int col) setStatus(_lastStatus); } -void FlGui::setProgress(const std::string &msg, double val, double min, double max) +void FlGui::setProgress(const std::string &msg, double val, double min, + double max) { - for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) { if(FlGui::instance()->graph[i]->getProgress()->value() != val) FlGui::instance()->graph[i]->getProgress()->value(val); if(FlGui::instance()->graph[i]->getProgress()->minimum() != min) @@ -1165,9 +1237,10 @@ void FlGui::storeCurrentWindowsInfo() CTX::instance()->glSize[0] = graph[0]->getGlWidth(); CTX::instance()->glSize[1] = graph[0]->getGlHeight(); CTX::instance()->msgSize = graph[0]->getMessageHeight() ? - graph[0]->getMessageHeight() : CTX::instance()->msgSize; + graph[0]->getMessageHeight() : + CTX::instance()->msgSize; CTX::instance()->menuSize[0] = graph[0]->getMenuWidth(); - if(graph[0]->isMenuDetached()){ + if(graph[0]->isMenuDetached()) { CTX::instance()->detachedMenu = 1; CTX::instance()->menuSize[1] = graph[0]->getMenuHeight(); CTX::instance()->menuPosition[0] = graph[0]->getMenuPositionX(); @@ -1213,18 +1286,15 @@ void FlGui::callForSolverPlugin(int dim) // Callbacks -void redraw_cb(Fl_Widget *w, void *data) -{ - drawContext::global()->draw(); -} +void redraw_cb(Fl_Widget *w, void *data) { drawContext::global()->draw(); } void window_cb(Fl_Widget *w, void *data) { static int oldx = 0, oldy = 0, oldw = 0, oldh = 0, zoom = 0, fullscreen = 0; - std::string str((const char*)data); + std::string str((const char *)data); - if(str == "minimize"){ + if(str == "minimize") { for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) if(FlGui::instance()->graph[i]->getWindow()->shown()) FlGui::instance()->graph[i]->getWindow()->iconize(); @@ -1245,52 +1315,53 @@ void window_cb(Fl_Widget *w, void *data) if(FlGui::instance()->stats->win->shown()) FlGui::instance()->stats->win->iconize(); } - else if(str == "zoom"){ - if(!zoom){ + else if(str == "zoom") { + if(!zoom) { oldx = FlGui::instance()->graph[0]->getWindow()->x(); oldy = FlGui::instance()->graph[0]->getWindow()->y(); oldw = FlGui::instance()->graph[0]->getWindow()->w(); oldh = FlGui::instance()->graph[0]->getWindow()->h(); - FlGui::instance()->graph[0]->getWindow()->resize(Fl::x(), Fl::y(), Fl::w(), Fl::h()); + FlGui::instance()->graph[0]->getWindow()->resize(Fl::x(), Fl::y(), + Fl::w(), Fl::h()); zoom = 1; } - else{ + else { FlGui::instance()->graph[0]->getWindow()->resize(oldx, oldy, oldw, oldh); zoom = 0; } } - else if(str == "fullscreen"){ - if(!fullscreen){ - int x,y,w,h; + else if(str == "fullscreen") { + if(!fullscreen) { + int x, y, w, h; Fl::screen_xywh(x, y, w, h); FlGui::instance()->fullscreen->resize(x, y, w, h); FlGui::instance()->fullscreen->valid(0); FlGui::instance()->fullscreen->show(); - while (!FlGui::instance()->fullscreen->valid()) FlGui::wait(); - FlGui::instance()->fullscreen->getDrawContext()->copyViewAttributes - (FlGui::instance()->getCurrentOpenglWindow()->getDrawContext()); + while(!FlGui::instance()->fullscreen->valid()) FlGui::wait(); + FlGui::instance()->fullscreen->getDrawContext()->copyViewAttributes( + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext()); openglWindow::setLastHandled(FlGui::instance()->fullscreen); for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->getWindow()->hide(); drawContext::global()->draw(); fullscreen = 1; } - else{ + else { for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->gl[0]->valid(0); for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->getWindow()->show(); for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) while(!FlGui::instance()->graph[i]->gl[0]->valid()) FlGui::wait(); - FlGui::instance()->graph[0]->gl[0]->getDrawContext()->copyViewAttributes - (FlGui::instance()->getCurrentOpenglWindow()->getDrawContext()); + FlGui::instance()->graph[0]->gl[0]->getDrawContext()->copyViewAttributes( + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext()); openglWindow::setLastHandled(FlGui::instance()->graph[0]->gl[0]); FlGui::instance()->fullscreen->hide(); drawContext::global()->draw(); fullscreen = 0; } } - else if(str == "front"){ + else if(str == "front") { // the order is important! for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) FlGui::instance()->graph[i]->getWindow()->show(); @@ -1323,7 +1394,7 @@ void window_cb(Fl_Widget *w, void *data) void FlGui::addMessage(const char *msg) { - for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) { FlGui::instance()->graph[i]->addMessage(msg); } } diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index 3b521298fe29cdf753601ac814854c33efe6c85b..067f12ffd37fb5d189e37ee3d1e229bb5b165015 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -11,13 +11,13 @@ #include "SPoint2.h" #define GMSH_WINDOW_BOX FL_FLAT_BOX -#define GMSH_SIMPLE_RIGHT_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+1) -#define GMSH_SIMPLE_TOP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE+2) +#define GMSH_SIMPLE_RIGHT_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE + 1) +#define GMSH_SIMPLE_TOP_BOX (Fl_Boxtype)(FL_FREE_BOXTYPE + 2) -#define IW (10 * FL_NORMAL_SIZE) // input field width -#define BB (7 * FL_NORMAL_SIZE) // width of a button with internal label +#define IW (10 * FL_NORMAL_SIZE) // input field width +#define BB (7 * FL_NORMAL_SIZE) // width of a button with internal label #define BH (2 * FL_NORMAL_SIZE + 1) // button height -#define WB (5) // window border +#define WB (5) // window border class graphicWindow; class openglWindow; @@ -45,22 +45,24 @@ class GRegion; class MElement; class PView; -class FlGui{ - private: +class FlGui { +private: static FlGui *_instance; static std::string _openedThroughMacFinder; static bool _finishedProcessingCommandLine; std::string _lastStatus; - public: - std::vector<GVertex*> selectedVertices; - std::vector<GEdge*> selectedEdges; - std::vector<GFace*> selectedFaces; - std::vector<GRegion*> selectedRegions; - std::vector<MElement*> selectedElements; + +public: + std::vector<GVertex *> selectedVertices; + std::vector<GEdge *> selectedEdges; + std::vector<GFace *> selectedFaces; + std::vector<GRegion *> selectedRegions; + std::vector<MElement *> selectedElements; std::vector<SPoint2> selectedPoints; - std::vector<PView*> selectedViews; - public: - std::vector<graphicWindow*> graph; + std::vector<PView *> selectedViews; + +public: + std::vector<graphicWindow *> graph; optionWindow *options; onelabWindow *onelab2; fieldWindow *fields; @@ -77,11 +79,12 @@ class FlGui{ helpWindow *help; onelabGroup *onelab; openglWindow *fullscreen; - public: + +public: FlGui(int argc, char **argv); - ~FlGui(){} + ~FlGui() {} // return the single static instance of the GUI - static FlGui *instance(int argc=0, char **argv=0); + static FlGui *instance(int argc = 0, char **argv = 0); // check if the GUI is available static bool available(); // run the GUI until there's no window left @@ -125,9 +128,9 @@ class FlGui{ // select an entity in the most recent graphic window char selectEntity(int type); // display status message - void setStatus(const std::string &msg, bool opengl=false); + void setStatus(const std::string &msg, bool opengl = false); // redisplay last status message - void setLastStatus(int col=-1); + void setLastStatus(int col = -1); // display status message and update progress bar void setProgress(const std::string &msg, double val, double min, double max); // create the window for physical context dependant definitions diff --git a/Fltk/Navigator.cpp b/Fltk/Navigator.cpp index 86f19b7fa32a065d00e21128994a0375c26d786c..81437e737b4079604612e035dea3b5d3803a589a 100644 --- a/Fltk/Navigator.cpp +++ b/Fltk/Navigator.cpp @@ -15,9 +15,9 @@ #include "drawContext.h" #include "gl2ps.h" -Navigator::Navigator(double _freq, drawContext* _ctx): - ax0(0.), ax1(0.), ax0_cur(0.), ax1_cur(0.), speed(0.), awake(true), - ctx(_ctx), frequency(_freq) +Navigator::Navigator(double _freq, drawContext *_ctx) + : ax0(0.), ax1(0.), ax0_cur(0.), ax1_cur(0.), speed(0.), awake(true), + ctx(_ctx), frequency(_freq) { ctx->camera.init(); pad = CTX::instance()->gamepad; @@ -29,7 +29,7 @@ Navigator::Navigator(double _freq, drawContext* _ctx): Navigator::~Navigator(){}; -void Navigator::setDrawContext( drawContext* _ctx) +void Navigator::setDrawContext(drawContext *_ctx) { ctx = _ctx; ctx->camera.init(); @@ -38,639 +38,657 @@ void Navigator::setDrawContext( drawContext* _ctx) void Navigator::setFrequency(double _freq) { frequency = _freq; - reference_angle = 3.14*frequency/5.; - reference_speed = 1.5*frequency*(ctx->camera.Lc)/100.; + reference_angle = 3.14 * frequency / 5.; + reference_speed = 1.5 * frequency * (ctx->camera.Lc) / 100.; } void Navigator::setResponseFrequency(double _freq) { - reference_angle = 3.14*frequency/5.*(_freq/.01); - reference_speed = 1.5*frequency*(ctx->camera.Lc)/100.*(_freq/.01); + reference_angle = 3.14 * frequency / 5. * (_freq / .01); + reference_speed = 1.5 * frequency * (ctx->camera.Lc) / 100. * (_freq / .01); } void Navigator::drawIcons() { - double l = CTX::instance()->smallAxesSize ; - double dx = CTX::instance()->smallAxesPos[0]+.5*l ; - double dy = 1.25*l; + double l = CTX::instance()->smallAxesSize; + double dx = CTX::instance()->smallAxesPos[0] + .5 * l; + double dy = 1.25 * l; ctx->fix2dCoordinates(&dx, &dy); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLineWidth( (float)CTX::instance()->lineWidth); + glLineWidth((float)CTX::instance()->lineWidth); gl2psLineWidth((float)(CTX::instance()->lineWidth * - CTX::instance()->print.epsLineWidthFactor)); + CTX::instance()->print.epsLineWidthFactor)); - glColor4ubv((GLubyte *) & CTX::instance()->color.smallAxes); + glColor4ubv((GLubyte *)&CTX::instance()->color.smallAxes); - double scale=l/100.; - glEnable (GL_BLEND); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable (GL_LINE_SMOOTH); + double scale = l / 100.; + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_LINE_SMOOTH); - switch(mode){ - case PEDESTRIAN : + switch(mode) { + case PEDESTRIAN: glBegin(GL_LINES); - glVertex2d(dx+scale*3.01052761E+01,dy+scale* 4.07178345E+01 ); - glVertex2d(dx+scale*3.69660988E+01,dy+scale* 3.01357174E+01); - glVertex2d(dx+scale*3.69660988E+01,dy+scale* 3.01357174E+01 ); - glVertex2d(dx+scale*4.07505989E+01,dy+scale* 2.80945930E+01); - glVertex2d(dx+scale*4.07505989E+01,dy+scale* 2.80945930E+01 ); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 2.00446148E+01); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 2.00446148E+01 ); - glVertex2d(dx+scale*5.38157959E+01,dy+scale* 1.13534155E+01); - glVertex2d(dx+scale*5.38157959E+01,dy+scale* 1.13534155E+01 ); - glVertex2d(dx+scale*5.25646591E+01,dy+scale* 3.44290900E+00); - glVertex2d(dx+scale*5.25646591E+01,dy+scale* 3.44290900E+00 ); - glVertex2d(dx+scale*5.01248283E+01,dy+scale* 2.56559372E+00); - glVertex2d(dx+scale*5.01248283E+01,dy+scale* 2.56559372E+00 ); - glVertex2d(dx+scale*5.01248283E+01,dy+scale* 1.18554187E+00); - glVertex2d(dx+scale*5.01248283E+01,dy+scale* 1.18554187E+00 ); - glVertex2d(dx+scale*5.57356987E+01,dy+scale* 1.18554187E+00); - glVertex2d(dx+scale*5.57356987E+01,dy+scale* 1.18554187E+00 ); - glVertex2d(dx+scale*5.98938141E+01,dy+scale* 7.02665806E+00); - glVertex2d(dx+scale*5.98938141E+01,dy+scale* 7.02665806E+00 ); - glVertex2d(dx+scale*6.34061890E+01,dy+scale* 1.35390358E+01); - glVertex2d(dx+scale*6.34061890E+01,dy+scale* 1.35390358E+01 ); - glVertex2d(dx+scale*6.04280853E+01,dy+scale* 1.56590576E+01); - glVertex2d(dx+scale*6.04280853E+01,dy+scale* 1.56590576E+01 ); - glVertex2d(dx+scale*5.67851448E+01,dy+scale* 1.66882896E+01); - glVertex2d(dx+scale*5.67851448E+01,dy+scale* 1.66882896E+01 ); - glVertex2d(dx+scale*5.56003265E+01,dy+scale* 1.87117329E+01); - glVertex2d(dx+scale*5.56003265E+01,dy+scale* 1.87117329E+01 ); - glVertex2d(dx+scale*5.12019005E+01,dy+scale* 2.62234058E+01); - glVertex2d(dx+scale*5.12019005E+01,dy+scale* 2.62234058E+01 ); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 3.04505730E+01); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 3.04505730E+01 ); - glVertex2d(dx+scale*4.26556816E+01,dy+scale* 3.47723503E+01); - glVertex2d(dx+scale*4.26556816E+01,dy+scale* 3.47723503E+01 ); - glVertex2d(dx+scale*4.11023293E+01,dy+scale* 3.66784554E+01); - glVertex2d(dx+scale*4.11023293E+01,dy+scale* 3.66784554E+01 ); - glVertex2d(dx+scale*4.07505989E+01,dy+scale* 3.88915939E+01); - glVertex2d(dx+scale*4.07505989E+01,dy+scale* 3.88915939E+01 ); - glVertex2d(dx+scale*3.96205177E+01,dy+scale* 4.60021973E+01); - glVertex2d(dx+scale*3.96205177E+01,dy+scale* 4.60021973E+01 ); - glVertex2d(dx+scale*3.76618462E+01,dy+scale* 5.14492989E+01); - glVertex2d(dx+scale*3.76618462E+01,dy+scale* 5.14492989E+01 ); - glVertex2d(dx+scale*3.82070084E+01,dy+scale* 5.48961716E+01); - glVertex2d(dx+scale*3.82070084E+01,dy+scale* 5.48961716E+01 ); - glVertex2d(dx+scale*3.82070084E+01,dy+scale* 5.79802170E+01); - glVertex2d(dx+scale*3.82070084E+01,dy+scale* 5.79802170E+01 ); - glVertex2d(dx+scale*3.69349632E+01,dy+scale* 6.15177956E+01); - glVertex2d(dx+scale*3.69349632E+01,dy+scale* 6.15177956E+01 ); - glVertex2d(dx+scale*3.25736656E+01,dy+scale* 6.68695145E+01); - glVertex2d(dx+scale*3.25736656E+01,dy+scale* 6.68695145E+01 ); - glVertex2d(dx+scale*3.18467827E+01,dy+scale* 7.03163834E+01); - glVertex2d(dx+scale*3.18467827E+01,dy+scale* 7.03163834E+01 ); - glVertex2d(dx+scale*3.38457108E+01,dy+scale* 7.73915405E+01); - glVertex2d(dx+scale*3.38457108E+01,dy+scale* 7.73915405E+01 ); - glVertex2d(dx+scale*3.38457108E+01,dy+scale* 8.45574112E+01); - glVertex2d(dx+scale*3.38457108E+01,dy+scale* 8.45574112E+01 ); - glVertex2d(dx+scale*3.38457108E+01,dy+scale* 8.58094559E+01); - glVertex2d(dx+scale*3.45101509E+01,dy+scale* 5.14492989E+01 ); - glVertex2d(dx+scale*3.01052761E+01,dy+scale* 4.07178345E+01); - glVertex2d(dx+scale*1.95475960E+01,dy+scale* 7.45358734E+01 ); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 6.88279419E+01); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 6.88279419E+01 ); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 6.32443161E+01); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 6.32443161E+01 ); - glVertex2d(dx+scale*2.39542980E+01,dy+scale* 5.92237206E+01); - glVertex2d(dx+scale*2.39542980E+01,dy+scale* 5.92237206E+01 ); - glVertex2d(dx+scale*2.06011562E+01,dy+scale* 5.10545654E+01); - glVertex2d(dx+scale*2.06011562E+01,dy+scale* 5.10545654E+01 ); - glVertex2d(dx+scale*1.91084385E+01,dy+scale* 4.16166077E+01); - glVertex2d(dx+scale*1.91084385E+01,dy+scale* 4.16166077E+01 ); - glVertex2d(dx+scale*1.89741859E+01,dy+scale* 3.61561012E+01); - glVertex2d(dx+scale*1.89741859E+01,dy+scale* 3.61561012E+01 ); - glVertex2d(dx+scale*1.80558548E+01,dy+scale* 3.29056969E+01); - glVertex2d(dx+scale*1.80558548E+01,dy+scale* 3.29056969E+01 ); - glVertex2d(dx+scale*1.80558548E+01,dy+scale* 2.96775036E+01); - glVertex2d(dx+scale*1.80558548E+01,dy+scale* 2.96775036E+01 ); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 2.55330906E+01); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 2.55330906E+01 ); - glVertex2d(dx+scale*1.53084030E+01,dy+scale* 1.60425396E+01); - glVertex2d(dx+scale*1.53084030E+01,dy+scale* 1.60425396E+01 ); - glVertex2d(dx+scale*1.19248409E+01,dy+scale* 9.76899910E+00); - glVertex2d(dx+scale*1.19248409E+01,dy+scale* 9.76899910E+00 ); - glVertex2d(dx+scale*1.04403715E+01,dy+scale* 1.05696316E+01); - glVertex2d(dx+scale*1.04403715E+01,dy+scale* 1.05696316E+01 ); - glVertex2d(dx+scale*7.35945797E+00,dy+scale* 8.76561642E+00); - glVertex2d(dx+scale*7.35945797E+00,dy+scale* 8.76561642E+00 ); - glVertex2d(dx+scale*4.11787891E+00,dy+scale* 8.65881157E+00); - glVertex2d(dx+scale*4.11787891E+00,dy+scale* 8.65881157E+00 ); - glVertex2d(dx+scale*1.94821942E+00,dy+scale* 9.27180004E+00); - glVertex2d(dx+scale*1.94821942E+00,dy+scale* 9.27180004E+00 ); - glVertex2d(dx+scale*2.77175337E-01,dy+scale* 8.18839359E+00); - glVertex2d(dx+scale*2.77175337E-01,dy+scale* 8.18839359E+00 ); - glVertex2d(dx+scale*1.94821942E+00,dy+scale* 5.61097956E+00); - glVertex2d(dx+scale*1.94821942E+00,dy+scale* 5.61097956E+00 ); - glVertex2d(dx+scale*6.22622919E+00,dy+scale* 2.56559372E+00); - glVertex2d(dx+scale*6.22622919E+00,dy+scale* 2.56559372E+00 ); - glVertex2d(dx+scale*1.11108894E+01,dy+scale* 1.18554187E+00); - glVertex2d(dx+scale*1.11108894E+01,dy+scale* 1.18554187E+00 ); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 1.18554187E+00); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 1.18554187E+00 ); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 7.02665806E+00); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 7.02665806E+00 ); - glVertex2d(dx+scale*1.65164566E+01,dy+scale* 8.18839359E+00); - glVertex2d(dx+scale*1.65164566E+01,dy+scale* 8.18839359E+00 ); - glVertex2d(dx+scale*2.46518440E+01,dy+scale* 2.32723999E+01); - glVertex2d(dx+scale*2.46518440E+01,dy+scale* 2.32723999E+01 ); - glVertex2d(dx+scale*2.46518440E+01,dy+scale* 3.04505730E+01); - glVertex2d(dx+scale*2.46518440E+01,dy+scale* 3.04505730E+01 ); - glVertex2d(dx+scale*2.58728657E+01,dy+scale* 3.47723503E+01); - glVertex2d(dx+scale*2.58728657E+01,dy+scale* 3.47723503E+01 ); - glVertex2d(dx+scale*3.01052761E+01,dy+scale* 4.07178345E+01); - glVertex2d(dx+scale*2.75617714E+01,dy+scale* 8.75848465E+01 ); - glVertex2d(dx+scale*3.76618462E+01,dy+scale* 8.47312927E+01); - glVertex2d(dx+scale*3.76618462E+01,dy+scale* 8.47312927E+01 ); - glVertex2d(dx+scale*3.92328835E+01,dy+scale* 8.36129227E+01); - glVertex2d(dx+scale*3.92328835E+01,dy+scale* 8.36129227E+01 ); - glVertex2d(dx+scale*4.11023293E+01,dy+scale* 7.90666428E+01); - glVertex2d(dx+scale*4.11023293E+01,dy+scale* 7.90666428E+01 ); - glVertex2d(dx+scale*4.46455917E+01,dy+scale* 7.30154266E+01); - glVertex2d(dx+scale*4.46455917E+01,dy+scale* 7.30154266E+01 ); - glVertex2d(dx+scale*4.62260017E+01,dy+scale* 7.03163834E+01); - glVertex2d(dx+scale*4.62260017E+01,dy+scale* 7.03163834E+01 ); - glVertex2d(dx+scale*4.56109505E+01,dy+scale* 6.64276276E+01); - glVertex2d(dx+scale*4.56109505E+01,dy+scale* 6.64276276E+01 ); - glVertex2d(dx+scale*4.56109505E+01,dy+scale* 6.53531952E+01); - glVertex2d(dx+scale*4.56109505E+01,dy+scale* 6.53531952E+01 ); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 6.36727524E+01); - glVertex2d(dx+scale*4.87266998E+01,dy+scale* 6.36727524E+01 ); - glVertex2d(dx+scale*5.15070915E+01,dy+scale* 6.64276276E+01); - glVertex2d(dx+scale*5.15070915E+01,dy+scale* 6.64276276E+01 ); - glVertex2d(dx+scale*5.15070915E+01,dy+scale* 6.88279419E+01); - glVertex2d(dx+scale*5.15070915E+01,dy+scale* 6.88279419E+01 ); - glVertex2d(dx+scale*4.95096855E+01,dy+scale* 7.22391281E+01); - glVertex2d(dx+scale*4.95096855E+01,dy+scale* 7.22391281E+01 ); - glVertex2d(dx+scale*4.58495522E+01,dy+scale* 8.24180374E+01); - glVertex2d(dx+scale*4.58495522E+01,dy+scale* 8.24180374E+01 ); - glVertex2d(dx+scale*4.32594948E+01,dy+scale* 8.68413620E+01); - glVertex2d(dx+scale*4.32594948E+01,dy+scale* 8.68413620E+01 ); - glVertex2d(dx+scale*4.18205223E+01,dy+scale* 8.72479095E+01); - glVertex2d(dx+scale*4.18205223E+01,dy+scale* 8.72479095E+01 ); - glVertex2d(dx+scale*3.02508583E+01,dy+scale* 9.19968338E+01); - glVertex2d(dx+scale*3.02508583E+01,dy+scale* 9.19968338E+01 ); - glVertex2d(dx+scale*2.86896305E+01,dy+scale* 9.26376648E+01); - glVertex2d(dx+scale*2.86896305E+01,dy+scale* 9.26376648E+01 ); - glVertex2d(dx+scale*2.80653210E+01,dy+scale* 9.37038651E+01); - glVertex2d(dx+scale*2.80653210E+01,dy+scale* 9.37038651E+01 ); - glVertex2d(dx+scale*2.71819935E+01,dy+scale* 9.52124176E+01); - glVertex2d(dx+scale*2.71819935E+01,dy+scale* 9.52124176E+01 ); - glVertex2d(dx+scale*2.96779137E+01,dy+scale* 9.61099014E+01); - glVertex2d(dx+scale*2.96779137E+01,dy+scale* 9.61099014E+01 ); - glVertex2d(dx+scale*3.02764988E+01,dy+scale* 9.90064621E+01); - glVertex2d(dx+scale*3.02764988E+01,dy+scale* 9.90064621E+01 ); - glVertex2d(dx+scale*2.92283592E+01,dy+scale* 1.05601486E+02); - glVertex2d(dx+scale*2.92283592E+01,dy+scale* 1.05601486E+02 ); - glVertex2d(dx+scale*2.25053406E+01,dy+scale* 1.08361038E+02); - glVertex2d(dx+scale*2.25053406E+01,dy+scale* 1.08361038E+02 ); - glVertex2d(dx+scale*1.72556629E+01,dy+scale* 1.05287109E+02); - glVertex2d(dx+scale*1.72556629E+01,dy+scale* 1.05287109E+02 ); - glVertex2d(dx+scale*1.52413979E+01,dy+scale* 9.81576691E+01); - glVertex2d(dx+scale*1.52413979E+01,dy+scale* 9.81576691E+01 ); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 9.25170364E+01); - glVertex2d(dx+scale*1.72696590E+01,dy+scale* 9.25170364E+01 ); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 9.32052612E+01); - glVertex2d(dx+scale*2.16000557E+01,dy+scale* 9.32052612E+01 ); - glVertex2d(dx+scale*2.31259499E+01,dy+scale* 8.89617233E+01); - glVertex2d(dx+scale*2.31259499E+01,dy+scale* 8.89617233E+01 ); - glVertex2d(dx+scale*2.01361866E+01,dy+scale* 8.34183350E+01); - glVertex2d(dx+scale*2.01361866E+01,dy+scale* 8.34183350E+01 ); - glVertex2d(dx+scale*1.86794548E+01,dy+scale* 8.07173691E+01); - glVertex2d(dx+scale*1.86794548E+01,dy+scale* 8.07173691E+01 ); - glVertex2d(dx+scale*1.86794548E+01,dy+scale* 7.69501953E+01); - glVertex2d(dx+scale*1.86794548E+01,dy+scale* 7.69501953E+01 ); - glVertex2d(dx+scale*1.98941078E+01,dy+scale* 7.35722198E+01); - glVertex2d(dx+scale*1.38444281E+01,dy+scale* 7.19181519E+01 ); - glVertex2d(dx+scale*1.31145697E+01,dy+scale* 7.24377136E+01); - glVertex2d(dx+scale*1.31145697E+01,dy+scale* 7.24377136E+01 ); - glVertex2d(dx+scale*7.04405022E+00,dy+scale* 7.85644531E+01); - glVertex2d(dx+scale*7.04405022E+00,dy+scale* 7.85644531E+01 ); - glVertex2d(dx+scale*6.26990461E+00,dy+scale* 8.07173691E+01); - glVertex2d(dx+scale*6.26990461E+00,dy+scale* 8.07173691E+01 ); - glVertex2d(dx+scale*6.94693804E+00,dy+scale* 8.31137161E+01); - glVertex2d(dx+scale*6.94693804E+00,dy+scale* 8.31137161E+01 ); - glVertex2d(dx+scale*6.52368259E+00,dy+scale* 8.57768860E+01); - glVertex2d(dx+scale*6.52368259E+00,dy+scale* 8.57768860E+01 ); - glVertex2d(dx+scale*5.51406002E+00,dy+scale* 8.63214188E+01); - glVertex2d(dx+scale*5.51406002E+00,dy+scale* 8.63214188E+01 ); - glVertex2d(dx+scale*2.57401466E+00,dy+scale* 8.62266617E+01); - glVertex2d(dx+scale*2.57401466E+00,dy+scale* 8.62266617E+01 ); - glVertex2d(dx+scale*2.63223171E-01,dy+scale* 8.29805756E+01); - glVertex2d(dx+scale*2.63223171E-01,dy+scale* 8.29805756E+01 ); - glVertex2d(dx+scale*5.74481070E-01,dy+scale* 8.10221024E+01); - glVertex2d(dx+scale*5.74481070E-01,dy+scale* 8.10221024E+01 ); - glVertex2d(dx+scale*3.50635505E+00,dy+scale* 7.89349899E+01); - glVertex2d(dx+scale*3.50635505E+00,dy+scale* 7.89349899E+01 ); - glVertex2d(dx+scale*4.06134844E+00,dy+scale* 7.73915405E+01); - glVertex2d(dx+scale*4.06134844E+00,dy+scale* 7.73915405E+01 ); - glVertex2d(dx+scale*1.02916317E+01,dy+scale* 6.82235336E+01); - glVertex2d(dx+scale*1.02916317E+01,dy+scale* 6.82235336E+01 ); - glVertex2d(dx+scale*1.35903749E+01,dy+scale* 6.68695145E+01); - glVertex2d(dx+scale*1.35903749E+01,dy+scale* 6.68695145E+01 ); - glVertex2d(dx+scale*1.50925760E+01,dy+scale* 6.74096756E+01); - glVertex2d(dx+scale*1.50925760E+01,dy+scale* 6.74096756E+01 ); - glVertex2d(dx+scale*2.02666225E+01,dy+scale* 7.25362473E+01); - glVertex2d(dx+scale*1.33335953E+01,dy+scale* 7.23014450E+01 ); - glVertex2d(dx+scale*1.86794548E+01,dy+scale* 7.88337784E+01); + glVertex2d(dx + scale * 3.01052761E+01, dy + scale * 4.07178345E+01); + glVertex2d(dx + scale * 3.69660988E+01, dy + scale * 3.01357174E+01); + glVertex2d(dx + scale * 3.69660988E+01, dy + scale * 3.01357174E+01); + glVertex2d(dx + scale * 4.07505989E+01, dy + scale * 2.80945930E+01); + glVertex2d(dx + scale * 4.07505989E+01, dy + scale * 2.80945930E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 2.00446148E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 2.00446148E+01); + glVertex2d(dx + scale * 5.38157959E+01, dy + scale * 1.13534155E+01); + glVertex2d(dx + scale * 5.38157959E+01, dy + scale * 1.13534155E+01); + glVertex2d(dx + scale * 5.25646591E+01, dy + scale * 3.44290900E+00); + glVertex2d(dx + scale * 5.25646591E+01, dy + scale * 3.44290900E+00); + glVertex2d(dx + scale * 5.01248283E+01, dy + scale * 2.56559372E+00); + glVertex2d(dx + scale * 5.01248283E+01, dy + scale * 2.56559372E+00); + glVertex2d(dx + scale * 5.01248283E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 5.01248283E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 5.57356987E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 5.57356987E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 5.98938141E+01, dy + scale * 7.02665806E+00); + glVertex2d(dx + scale * 5.98938141E+01, dy + scale * 7.02665806E+00); + glVertex2d(dx + scale * 6.34061890E+01, dy + scale * 1.35390358E+01); + glVertex2d(dx + scale * 6.34061890E+01, dy + scale * 1.35390358E+01); + glVertex2d(dx + scale * 6.04280853E+01, dy + scale * 1.56590576E+01); + glVertex2d(dx + scale * 6.04280853E+01, dy + scale * 1.56590576E+01); + glVertex2d(dx + scale * 5.67851448E+01, dy + scale * 1.66882896E+01); + glVertex2d(dx + scale * 5.67851448E+01, dy + scale * 1.66882896E+01); + glVertex2d(dx + scale * 5.56003265E+01, dy + scale * 1.87117329E+01); + glVertex2d(dx + scale * 5.56003265E+01, dy + scale * 1.87117329E+01); + glVertex2d(dx + scale * 5.12019005E+01, dy + scale * 2.62234058E+01); + glVertex2d(dx + scale * 5.12019005E+01, dy + scale * 2.62234058E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 3.04505730E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 3.04505730E+01); + glVertex2d(dx + scale * 4.26556816E+01, dy + scale * 3.47723503E+01); + glVertex2d(dx + scale * 4.26556816E+01, dy + scale * 3.47723503E+01); + glVertex2d(dx + scale * 4.11023293E+01, dy + scale * 3.66784554E+01); + glVertex2d(dx + scale * 4.11023293E+01, dy + scale * 3.66784554E+01); + glVertex2d(dx + scale * 4.07505989E+01, dy + scale * 3.88915939E+01); + glVertex2d(dx + scale * 4.07505989E+01, dy + scale * 3.88915939E+01); + glVertex2d(dx + scale * 3.96205177E+01, dy + scale * 4.60021973E+01); + glVertex2d(dx + scale * 3.96205177E+01, dy + scale * 4.60021973E+01); + glVertex2d(dx + scale * 3.76618462E+01, dy + scale * 5.14492989E+01); + glVertex2d(dx + scale * 3.76618462E+01, dy + scale * 5.14492989E+01); + glVertex2d(dx + scale * 3.82070084E+01, dy + scale * 5.48961716E+01); + glVertex2d(dx + scale * 3.82070084E+01, dy + scale * 5.48961716E+01); + glVertex2d(dx + scale * 3.82070084E+01, dy + scale * 5.79802170E+01); + glVertex2d(dx + scale * 3.82070084E+01, dy + scale * 5.79802170E+01); + glVertex2d(dx + scale * 3.69349632E+01, dy + scale * 6.15177956E+01); + glVertex2d(dx + scale * 3.69349632E+01, dy + scale * 6.15177956E+01); + glVertex2d(dx + scale * 3.25736656E+01, dy + scale * 6.68695145E+01); + glVertex2d(dx + scale * 3.25736656E+01, dy + scale * 6.68695145E+01); + glVertex2d(dx + scale * 3.18467827E+01, dy + scale * 7.03163834E+01); + glVertex2d(dx + scale * 3.18467827E+01, dy + scale * 7.03163834E+01); + glVertex2d(dx + scale * 3.38457108E+01, dy + scale * 7.73915405E+01); + glVertex2d(dx + scale * 3.38457108E+01, dy + scale * 7.73915405E+01); + glVertex2d(dx + scale * 3.38457108E+01, dy + scale * 8.45574112E+01); + glVertex2d(dx + scale * 3.38457108E+01, dy + scale * 8.45574112E+01); + glVertex2d(dx + scale * 3.38457108E+01, dy + scale * 8.58094559E+01); + glVertex2d(dx + scale * 3.45101509E+01, dy + scale * 5.14492989E+01); + glVertex2d(dx + scale * 3.01052761E+01, dy + scale * 4.07178345E+01); + glVertex2d(dx + scale * 1.95475960E+01, dy + scale * 7.45358734E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 6.88279419E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 6.88279419E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 6.32443161E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 6.32443161E+01); + glVertex2d(dx + scale * 2.39542980E+01, dy + scale * 5.92237206E+01); + glVertex2d(dx + scale * 2.39542980E+01, dy + scale * 5.92237206E+01); + glVertex2d(dx + scale * 2.06011562E+01, dy + scale * 5.10545654E+01); + glVertex2d(dx + scale * 2.06011562E+01, dy + scale * 5.10545654E+01); + glVertex2d(dx + scale * 1.91084385E+01, dy + scale * 4.16166077E+01); + glVertex2d(dx + scale * 1.91084385E+01, dy + scale * 4.16166077E+01); + glVertex2d(dx + scale * 1.89741859E+01, dy + scale * 3.61561012E+01); + glVertex2d(dx + scale * 1.89741859E+01, dy + scale * 3.61561012E+01); + glVertex2d(dx + scale * 1.80558548E+01, dy + scale * 3.29056969E+01); + glVertex2d(dx + scale * 1.80558548E+01, dy + scale * 3.29056969E+01); + glVertex2d(dx + scale * 1.80558548E+01, dy + scale * 2.96775036E+01); + glVertex2d(dx + scale * 1.80558548E+01, dy + scale * 2.96775036E+01); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 2.55330906E+01); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 2.55330906E+01); + glVertex2d(dx + scale * 1.53084030E+01, dy + scale * 1.60425396E+01); + glVertex2d(dx + scale * 1.53084030E+01, dy + scale * 1.60425396E+01); + glVertex2d(dx + scale * 1.19248409E+01, dy + scale * 9.76899910E+00); + glVertex2d(dx + scale * 1.19248409E+01, dy + scale * 9.76899910E+00); + glVertex2d(dx + scale * 1.04403715E+01, dy + scale * 1.05696316E+01); + glVertex2d(dx + scale * 1.04403715E+01, dy + scale * 1.05696316E+01); + glVertex2d(dx + scale * 7.35945797E+00, dy + scale * 8.76561642E+00); + glVertex2d(dx + scale * 7.35945797E+00, dy + scale * 8.76561642E+00); + glVertex2d(dx + scale * 4.11787891E+00, dy + scale * 8.65881157E+00); + glVertex2d(dx + scale * 4.11787891E+00, dy + scale * 8.65881157E+00); + glVertex2d(dx + scale * 1.94821942E+00, dy + scale * 9.27180004E+00); + glVertex2d(dx + scale * 1.94821942E+00, dy + scale * 9.27180004E+00); + glVertex2d(dx + scale * 2.77175337E-01, dy + scale * 8.18839359E+00); + glVertex2d(dx + scale * 2.77175337E-01, dy + scale * 8.18839359E+00); + glVertex2d(dx + scale * 1.94821942E+00, dy + scale * 5.61097956E+00); + glVertex2d(dx + scale * 1.94821942E+00, dy + scale * 5.61097956E+00); + glVertex2d(dx + scale * 6.22622919E+00, dy + scale * 2.56559372E+00); + glVertex2d(dx + scale * 6.22622919E+00, dy + scale * 2.56559372E+00); + glVertex2d(dx + scale * 1.11108894E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 1.11108894E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 1.18554187E+00); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 7.02665806E+00); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 7.02665806E+00); + glVertex2d(dx + scale * 1.65164566E+01, dy + scale * 8.18839359E+00); + glVertex2d(dx + scale * 1.65164566E+01, dy + scale * 8.18839359E+00); + glVertex2d(dx + scale * 2.46518440E+01, dy + scale * 2.32723999E+01); + glVertex2d(dx + scale * 2.46518440E+01, dy + scale * 2.32723999E+01); + glVertex2d(dx + scale * 2.46518440E+01, dy + scale * 3.04505730E+01); + glVertex2d(dx + scale * 2.46518440E+01, dy + scale * 3.04505730E+01); + glVertex2d(dx + scale * 2.58728657E+01, dy + scale * 3.47723503E+01); + glVertex2d(dx + scale * 2.58728657E+01, dy + scale * 3.47723503E+01); + glVertex2d(dx + scale * 3.01052761E+01, dy + scale * 4.07178345E+01); + glVertex2d(dx + scale * 2.75617714E+01, dy + scale * 8.75848465E+01); + glVertex2d(dx + scale * 3.76618462E+01, dy + scale * 8.47312927E+01); + glVertex2d(dx + scale * 3.76618462E+01, dy + scale * 8.47312927E+01); + glVertex2d(dx + scale * 3.92328835E+01, dy + scale * 8.36129227E+01); + glVertex2d(dx + scale * 3.92328835E+01, dy + scale * 8.36129227E+01); + glVertex2d(dx + scale * 4.11023293E+01, dy + scale * 7.90666428E+01); + glVertex2d(dx + scale * 4.11023293E+01, dy + scale * 7.90666428E+01); + glVertex2d(dx + scale * 4.46455917E+01, dy + scale * 7.30154266E+01); + glVertex2d(dx + scale * 4.46455917E+01, dy + scale * 7.30154266E+01); + glVertex2d(dx + scale * 4.62260017E+01, dy + scale * 7.03163834E+01); + glVertex2d(dx + scale * 4.62260017E+01, dy + scale * 7.03163834E+01); + glVertex2d(dx + scale * 4.56109505E+01, dy + scale * 6.64276276E+01); + glVertex2d(dx + scale * 4.56109505E+01, dy + scale * 6.64276276E+01); + glVertex2d(dx + scale * 4.56109505E+01, dy + scale * 6.53531952E+01); + glVertex2d(dx + scale * 4.56109505E+01, dy + scale * 6.53531952E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 6.36727524E+01); + glVertex2d(dx + scale * 4.87266998E+01, dy + scale * 6.36727524E+01); + glVertex2d(dx + scale * 5.15070915E+01, dy + scale * 6.64276276E+01); + glVertex2d(dx + scale * 5.15070915E+01, dy + scale * 6.64276276E+01); + glVertex2d(dx + scale * 5.15070915E+01, dy + scale * 6.88279419E+01); + glVertex2d(dx + scale * 5.15070915E+01, dy + scale * 6.88279419E+01); + glVertex2d(dx + scale * 4.95096855E+01, dy + scale * 7.22391281E+01); + glVertex2d(dx + scale * 4.95096855E+01, dy + scale * 7.22391281E+01); + glVertex2d(dx + scale * 4.58495522E+01, dy + scale * 8.24180374E+01); + glVertex2d(dx + scale * 4.58495522E+01, dy + scale * 8.24180374E+01); + glVertex2d(dx + scale * 4.32594948E+01, dy + scale * 8.68413620E+01); + glVertex2d(dx + scale * 4.32594948E+01, dy + scale * 8.68413620E+01); + glVertex2d(dx + scale * 4.18205223E+01, dy + scale * 8.72479095E+01); + glVertex2d(dx + scale * 4.18205223E+01, dy + scale * 8.72479095E+01); + glVertex2d(dx + scale * 3.02508583E+01, dy + scale * 9.19968338E+01); + glVertex2d(dx + scale * 3.02508583E+01, dy + scale * 9.19968338E+01); + glVertex2d(dx + scale * 2.86896305E+01, dy + scale * 9.26376648E+01); + glVertex2d(dx + scale * 2.86896305E+01, dy + scale * 9.26376648E+01); + glVertex2d(dx + scale * 2.80653210E+01, dy + scale * 9.37038651E+01); + glVertex2d(dx + scale * 2.80653210E+01, dy + scale * 9.37038651E+01); + glVertex2d(dx + scale * 2.71819935E+01, dy + scale * 9.52124176E+01); + glVertex2d(dx + scale * 2.71819935E+01, dy + scale * 9.52124176E+01); + glVertex2d(dx + scale * 2.96779137E+01, dy + scale * 9.61099014E+01); + glVertex2d(dx + scale * 2.96779137E+01, dy + scale * 9.61099014E+01); + glVertex2d(dx + scale * 3.02764988E+01, dy + scale * 9.90064621E+01); + glVertex2d(dx + scale * 3.02764988E+01, dy + scale * 9.90064621E+01); + glVertex2d(dx + scale * 2.92283592E+01, dy + scale * 1.05601486E+02); + glVertex2d(dx + scale * 2.92283592E+01, dy + scale * 1.05601486E+02); + glVertex2d(dx + scale * 2.25053406E+01, dy + scale * 1.08361038E+02); + glVertex2d(dx + scale * 2.25053406E+01, dy + scale * 1.08361038E+02); + glVertex2d(dx + scale * 1.72556629E+01, dy + scale * 1.05287109E+02); + glVertex2d(dx + scale * 1.72556629E+01, dy + scale * 1.05287109E+02); + glVertex2d(dx + scale * 1.52413979E+01, dy + scale * 9.81576691E+01); + glVertex2d(dx + scale * 1.52413979E+01, dy + scale * 9.81576691E+01); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 9.25170364E+01); + glVertex2d(dx + scale * 1.72696590E+01, dy + scale * 9.25170364E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 9.32052612E+01); + glVertex2d(dx + scale * 2.16000557E+01, dy + scale * 9.32052612E+01); + glVertex2d(dx + scale * 2.31259499E+01, dy + scale * 8.89617233E+01); + glVertex2d(dx + scale * 2.31259499E+01, dy + scale * 8.89617233E+01); + glVertex2d(dx + scale * 2.01361866E+01, dy + scale * 8.34183350E+01); + glVertex2d(dx + scale * 2.01361866E+01, dy + scale * 8.34183350E+01); + glVertex2d(dx + scale * 1.86794548E+01, dy + scale * 8.07173691E+01); + glVertex2d(dx + scale * 1.86794548E+01, dy + scale * 8.07173691E+01); + glVertex2d(dx + scale * 1.86794548E+01, dy + scale * 7.69501953E+01); + glVertex2d(dx + scale * 1.86794548E+01, dy + scale * 7.69501953E+01); + glVertex2d(dx + scale * 1.98941078E+01, dy + scale * 7.35722198E+01); + glVertex2d(dx + scale * 1.38444281E+01, dy + scale * 7.19181519E+01); + glVertex2d(dx + scale * 1.31145697E+01, dy + scale * 7.24377136E+01); + glVertex2d(dx + scale * 1.31145697E+01, dy + scale * 7.24377136E+01); + glVertex2d(dx + scale * 7.04405022E+00, dy + scale * 7.85644531E+01); + glVertex2d(dx + scale * 7.04405022E+00, dy + scale * 7.85644531E+01); + glVertex2d(dx + scale * 6.26990461E+00, dy + scale * 8.07173691E+01); + glVertex2d(dx + scale * 6.26990461E+00, dy + scale * 8.07173691E+01); + glVertex2d(dx + scale * 6.94693804E+00, dy + scale * 8.31137161E+01); + glVertex2d(dx + scale * 6.94693804E+00, dy + scale * 8.31137161E+01); + glVertex2d(dx + scale * 6.52368259E+00, dy + scale * 8.57768860E+01); + glVertex2d(dx + scale * 6.52368259E+00, dy + scale * 8.57768860E+01); + glVertex2d(dx + scale * 5.51406002E+00, dy + scale * 8.63214188E+01); + glVertex2d(dx + scale * 5.51406002E+00, dy + scale * 8.63214188E+01); + glVertex2d(dx + scale * 2.57401466E+00, dy + scale * 8.62266617E+01); + glVertex2d(dx + scale * 2.57401466E+00, dy + scale * 8.62266617E+01); + glVertex2d(dx + scale * 2.63223171E-01, dy + scale * 8.29805756E+01); + glVertex2d(dx + scale * 2.63223171E-01, dy + scale * 8.29805756E+01); + glVertex2d(dx + scale * 5.74481070E-01, dy + scale * 8.10221024E+01); + glVertex2d(dx + scale * 5.74481070E-01, dy + scale * 8.10221024E+01); + glVertex2d(dx + scale * 3.50635505E+00, dy + scale * 7.89349899E+01); + glVertex2d(dx + scale * 3.50635505E+00, dy + scale * 7.89349899E+01); + glVertex2d(dx + scale * 4.06134844E+00, dy + scale * 7.73915405E+01); + glVertex2d(dx + scale * 4.06134844E+00, dy + scale * 7.73915405E+01); + glVertex2d(dx + scale * 1.02916317E+01, dy + scale * 6.82235336E+01); + glVertex2d(dx + scale * 1.02916317E+01, dy + scale * 6.82235336E+01); + glVertex2d(dx + scale * 1.35903749E+01, dy + scale * 6.68695145E+01); + glVertex2d(dx + scale * 1.35903749E+01, dy + scale * 6.68695145E+01); + glVertex2d(dx + scale * 1.50925760E+01, dy + scale * 6.74096756E+01); + glVertex2d(dx + scale * 1.50925760E+01, dy + scale * 6.74096756E+01); + glVertex2d(dx + scale * 2.02666225E+01, dy + scale * 7.25362473E+01); + glVertex2d(dx + scale * 1.33335953E+01, dy + scale * 7.23014450E+01); + glVertex2d(dx + scale * 1.86794548E+01, dy + scale * 7.88337784E+01); glEnd(); break; - case DIVER : + case DIVER: glBegin(GL_LINES); - glVertex2d(dx+scale*4.70261803E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*4.34834213E+01,dy+scale* 3.27708626E+01); - glVertex2d(dx+scale*4.34834213E+01,dy+scale* 3.27708626E+01 ); - glVertex2d(dx+scale*4.13941002E+01,dy+scale* 3.19546795E+01); - glVertex2d(dx+scale*4.13941002E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*3.96319656E+01,dy+scale* 3.27708626E+01); - glVertex2d(dx+scale*4.70261803E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*6.37407417E+01,dy+scale* 2.29766846E+01); - glVertex2d(dx+scale*6.37407417E+01,dy+scale* 2.29766846E+01 ); - glVertex2d(dx+scale*6.88277817E+01,dy+scale* 2.83272076E+01); - glVertex2d(dx+scale*6.88277817E+01,dy+scale* 2.83272076E+01 ); - glVertex2d(dx+scale*7.49140625E+01,dy+scale* 3.19546795E+01); - glVertex2d(dx+scale*7.49140625E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*7.75205078E+01,dy+scale* 3.05546646E+01); - glVertex2d(dx+scale*5.73819389E+01,dy+scale* 1.82609520E+01 ); - glVertex2d(dx+scale*6.51033478E+01,dy+scale* 1.64820938E+01); - glVertex2d(dx+scale*6.51033478E+01,dy+scale* 1.64820938E+01 ); - glVertex2d(dx+scale*6.72513809E+01,dy+scale* 1.64820938E+01); - glVertex2d(dx+scale*6.72513809E+01,dy+scale* 1.64820938E+01 ); - glVertex2d(dx+scale*6.88277817E+01,dy+scale* 1.81401482E+01); - glVertex2d(dx+scale*6.88277817E+01,dy+scale* 1.81401482E+01 ); - glVertex2d(dx+scale*7.75205078E+01,dy+scale* 3.05546646E+01); - glVertex2d(dx+scale*7.75205078E+01,dy+scale* 3.05546646E+01 ); - glVertex2d(dx+scale*7.91115646E+01,dy+scale* 3.05546646E+01); - glVertex2d(dx+scale*7.91115646E+01,dy+scale* 3.05546646E+01 ); - glVertex2d(dx+scale*7.96394882E+01,dy+scale* 3.28461914E+01); - glVertex2d(dx+scale*7.96394882E+01,dy+scale* 3.28461914E+01 ); - glVertex2d(dx+scale*8.69550934E+01,dy+scale* 3.72063484E+01); - glVertex2d(dx+scale*8.69550934E+01,dy+scale* 3.72063484E+01 ); - glVertex2d(dx+scale*9.21887970E+01,dy+scale* 3.60006065E+01); - glVertex2d(dx+scale*9.21887970E+01,dy+scale* 3.60006065E+01 ); - glVertex2d(dx+scale*9.73070221E+01,dy+scale* 4.33102036E+01); - glVertex2d(dx+scale*9.73070221E+01,dy+scale* 4.33102036E+01 ); - glVertex2d(dx+scale*9.48979111E+01,dy+scale* 4.38652153E+01); - glVertex2d(dx+scale*9.48979111E+01,dy+scale* 4.38652153E+01 ); - glVertex2d(dx+scale*7.96394882E+01,dy+scale* 3.86619072E+01); - glVertex2d(dx+scale*7.96394882E+01,dy+scale* 3.86619072E+01 ); - glVertex2d(dx+scale*7.41574936E+01,dy+scale* 3.60006065E+01); - glVertex2d(dx+scale*7.41574936E+01,dy+scale* 3.60006065E+01 ); - glVertex2d(dx+scale*7.35288086E+01,dy+scale* 3.32717209E+01); - glVertex2d(dx+scale*7.35288086E+01,dy+scale* 3.32717209E+01 ); - glVertex2d(dx+scale*7.49140625E+01,dy+scale* 3.19546795E+01); - glVertex2d(dx+scale*7.25460358E+01,dy+scale* 2.34503746E+01 ); - glVertex2d(dx+scale*7.35393219E+01,dy+scale* 2.14043198E+01); - glVertex2d(dx+scale*7.35393219E+01,dy+scale* 2.14043198E+01 ); - glVertex2d(dx+scale*7.72988739E+01,dy+scale* 2.26863708E+01); - glVertex2d(dx+scale*7.72988739E+01,dy+scale* 2.26863708E+01 ); - glVertex2d(dx+scale*8.08417358E+01,dy+scale* 1.53884392E+01); - glVertex2d(dx+scale*8.08417358E+01,dy+scale* 1.53884392E+01 ); - glVertex2d(dx+scale*9.27881927E+01,dy+scale* 5.54670620E+00); - glVertex2d(dx+scale*9.27881927E+01,dy+scale* 5.54670620E+00 ); - glVertex2d(dx+scale*1.00075905E+02,dy+scale* 8.03190613E+00); - glVertex2d(dx+scale*1.00075905E+02,dy+scale* 8.03190613E+00 ); - glVertex2d(dx+scale*8.60352936E+01,dy+scale* 1.99065475E+01); - glVertex2d(dx+scale*8.60352936E+01,dy+scale* 1.99065475E+01 ); - glVertex2d(dx+scale*7.86158524E+01,dy+scale* 2.84351845E+01); - glVertex2d(dx+scale*7.86158524E+01,dy+scale* 2.84351845E+01 ); - glVertex2d(dx+scale*7.69795456E+01,dy+scale* 2.67141228E+01); - glVertex2d(dx+scale*7.69795456E+01,dy+scale* 2.67141228E+01 ); - glVertex2d(dx+scale*7.41574936E+01,dy+scale* 2.57517700E+01); - glVertex2d(dx+scale*7.30426788E+01,dy+scale* 2.24273472E+01 ); - glVertex2d(dx+scale*7.14492264E+01,dy+scale* 2.18839607E+01); - glVertex2d(dx+scale*6.16945724E+01,dy+scale* 2.40757561E+01 ); - glVertex2d(dx+scale*6.62687149E+01,dy+scale* 2.56355934E+01); - glVertex2d(dx+scale*3.96319656E+01,dy+scale* 3.27708626E+01 ); - glVertex2d(dx+scale*2.45886974E+01,dy+scale* 3.97385635E+01); - glVertex2d(dx+scale*2.45886974E+01,dy+scale* 3.97385635E+01 ); - glVertex2d(dx+scale*2.06685200E+01,dy+scale* 3.97385635E+01); - glVertex2d(dx+scale*5.73819389E+01,dy+scale* 1.82609520E+01 ); - glVertex2d(dx+scale*5.58739510E+01,dy+scale* 2.29766846E+01); - glVertex2d(dx+scale*5.58739510E+01,dy+scale* 2.29766846E+01 ); - glVertex2d(dx+scale*5.10441551E+01,dy+scale* 2.47799721E+01); - glVertex2d(dx+scale*5.10441551E+01,dy+scale* 2.47799721E+01 ); - glVertex2d(dx+scale*3.96319656E+01,dy+scale* 3.27708626E+01); - glVertex2d(dx+scale*1.71485100E+01,dy+scale* 3.83634911E+01 ); - glVertex2d(dx+scale*2.31309643E+01,dy+scale* 3.34350243E+01); - glVertex2d(dx+scale*2.31309643E+01,dy+scale* 3.34350243E+01 ); - glVertex2d(dx+scale*3.66521492E+01,dy+scale* 3.01534729E+01); - glVertex2d(dx+scale*3.66521492E+01,dy+scale* 3.01534729E+01 ); - glVertex2d(dx+scale*4.84622536E+01,dy+scale* 2.18839607E+01); - glVertex2d(dx+scale*4.84622536E+01,dy+scale* 2.18839607E+01 ); - glVertex2d(dx+scale*5.24489517E+01,dy+scale* 1.73012562E+01); - glVertex2d(dx+scale*5.24489517E+01,dy+scale* 1.73012562E+01 ); - glVertex2d(dx+scale*5.73819389E+01,dy+scale* 1.82609520E+01); - glVertex2d(dx+scale*2.31120663E+01,dy+scale* 2.08601875E+01 ); - glVertex2d(dx+scale*2.65303173E+01,dy+scale* 1.84667053E+01); - glVertex2d(dx+scale*2.65303173E+01,dy+scale* 1.84667053E+01 ); - glVertex2d(dx+scale*2.76829071E+01,dy+scale* 1.88597527E+01); - glVertex2d(dx+scale*2.76829071E+01,dy+scale* 1.88597527E+01 ); - glVertex2d(dx+scale*2.98293095E+01,dy+scale* 2.46085243E+01); - glVertex2d(dx+scale*2.98293095E+01,dy+scale* 2.46085243E+01 ); - glVertex2d(dx+scale*2.20083504E+01,dy+scale* 2.88094444E+01); - glVertex2d(dx+scale*2.20083504E+01,dy+scale* 2.88094444E+01 ); - glVertex2d(dx+scale*1.73340797E+01,dy+scale* 3.05546646E+01); - glVertex2d(dx+scale*1.73340797E+01,dy+scale* 3.05546646E+01 ); - glVertex2d(dx+scale*1.43467293E+01,dy+scale* 3.55669289E+01); - glVertex2d(dx+scale*1.43467293E+01,dy+scale* 3.55669289E+01 ); - glVertex2d(dx+scale*1.43467293E+01,dy+scale* 3.66936073E+01); - glVertex2d(dx+scale*2.31120663E+01,dy+scale* 2.08601875E+01 ); - glVertex2d(dx+scale*1.77385178E+01,dy+scale* 2.08601875E+01); - glVertex2d(dx+scale*1.77385178E+01,dy+scale* 2.08601875E+01 ); - glVertex2d(dx+scale*1.45902586E+01,dy+scale* 2.89193249E+01); - glVertex2d(dx+scale*1.45902586E+01,dy+scale* 2.89193249E+01 ); - glVertex2d(dx+scale*1.09701309E+01,dy+scale* 3.08638268E+01); - glVertex2d(dx+scale*1.09701309E+01,dy+scale* 3.08638268E+01 ); - glVertex2d(dx+scale*1.09701309E+01,dy+scale* 3.19546795E+01); - glVertex2d(dx+scale*1.09701309E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*1.02964087E+01,dy+scale* 2.72419567E+01); - glVertex2d(dx+scale*1.02964087E+01,dy+scale* 2.72419567E+01 ); - glVertex2d(dx+scale*1.43467293E+01,dy+scale* 1.33082447E+01); - glVertex2d(dx+scale*1.43467293E+01,dy+scale* 1.33082447E+01 ); - glVertex2d(dx+scale*1.55345182E+01,dy+scale* 9.59382534E+00); - glVertex2d(dx+scale*1.55345182E+01,dy+scale* 9.59382534E+00 ); - glVertex2d(dx+scale*1.72489243E+01,dy+scale* 9.19886017E+00); - glVertex2d(dx+scale*1.72489243E+01,dy+scale* 9.19886017E+00 ); - glVertex2d(dx+scale*1.69032230E+01,dy+scale* 1.32596684E+01); - glVertex2d(dx+scale*1.69032230E+01,dy+scale* 1.32596684E+01 ); - glVertex2d(dx+scale*1.31571884E+01,dy+scale* 2.49741650E+01); - glVertex2d(dx+scale*1.31571884E+01,dy+scale* 2.49741650E+01 ); - glVertex2d(dx+scale*1.69212170E+01,dy+scale* 2.29523678E+01); - glVertex2d(dx+scale*3.90322609E+01,dy+scale* 1.84667053E+01 ); - glVertex2d(dx+scale*5.05798721E+01,dy+scale* 1.94497623E+01); - glVertex2d(dx+scale*2.31120663E+01,dy+scale* 2.08601875E+01 ); - glVertex2d(dx+scale*3.18689404E+01,dy+scale* 1.13308659E+01); - glVertex2d(dx+scale*3.18689404E+01,dy+scale* 1.13308659E+01 ); - glVertex2d(dx+scale*3.67675819E+01,dy+scale* 1.42504940E+01); - glVertex2d(dx+scale*3.67675819E+01,dy+scale* 1.42504940E+01 ); - glVertex2d(dx+scale*3.90322609E+01,dy+scale* 1.84667053E+01); - glVertex2d(dx+scale*4.70261803E+01,dy+scale* 3.19546795E+01 ); - glVertex2d(dx+scale*4.75925865E+01,dy+scale* 3.30091743E+01); - glVertex2d(dx+scale*4.75925865E+01,dy+scale* 3.30091743E+01 ); - glVertex2d(dx+scale*4.81551323E+01,dy+scale* 3.54509926E+01); - glVertex2d(dx+scale*4.81551323E+01,dy+scale* 3.54509926E+01 ); - glVertex2d(dx+scale*4.75925865E+01,dy+scale* 3.66097794E+01); - glVertex2d(dx+scale*4.75925865E+01,dy+scale* 3.66097794E+01 ); - glVertex2d(dx+scale*4.65963593E+01,dy+scale* 3.86619072E+01); - glVertex2d(dx+scale*4.65963593E+01,dy+scale* 3.86619072E+01 ); - glVertex2d(dx+scale*2.57703133E+01,dy+scale* 4.64376678E+01); - glVertex2d(dx+scale*2.57703133E+01,dy+scale* 4.64376678E+01 ); - glVertex2d(dx+scale*2.36515903E+01,dy+scale* 4.62573013E+01); - glVertex2d(dx+scale*2.36515903E+01,dy+scale* 4.62573013E+01 ); - glVertex2d(dx+scale*2.06685200E+01,dy+scale* 4.50919800E+01); - glVertex2d(dx+scale*2.06685200E+01,dy+scale* 4.50919800E+01 ); - glVertex2d(dx+scale*2.02995567E+01,dy+scale* 4.41037750E+01); - glVertex2d(dx+scale*4.15640564E+01,dy+scale* 2.67141228E+01 ); - glVertex2d(dx+scale*3.90322609E+01,dy+scale* 1.84667053E+01); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.55669289E+01 ); - glVertex2d(dx+scale*3.22941685E+00,dy+scale* 3.47821503E+01); - glVertex2d(dx+scale*1.57866726E+01,dy+scale* 3.79439583E+01 ); - glVertex2d(dx+scale*1.53819942E+01,dy+scale* 4.26975594E+01); - glVertex2d(dx+scale*1.53819942E+01,dy+scale* 4.26975594E+01 ); - glVertex2d(dx+scale*1.34937668E+01,dy+scale* 4.58656845E+01); - glVertex2d(dx+scale*1.34937668E+01,dy+scale* 4.58656845E+01 ); - glVertex2d(dx+scale*9.24889469E+00,dy+scale* 4.68436165E+01); - glVertex2d(dx+scale*9.24889469E+00,dy+scale* 4.68436165E+01 ); - glVertex2d(dx+scale*6.85485315E+00,dy+scale* 4.68436165E+01); - glVertex2d(dx+scale*6.85485315E+00,dy+scale* 4.68436165E+01 ); - glVertex2d(dx+scale*2.90823507E+00,dy+scale* 4.44914017E+01); - glVertex2d(dx+scale*2.90823507E+00,dy+scale* 4.44914017E+01 ); - glVertex2d(dx+scale*2.90823507E+00,dy+scale* 4.07268143E+01); - glVertex2d(dx+scale*5.95178938E+00,dy+scale* 3.35593605E+01 ); - glVertex2d(dx+scale*5.95178938E+00,dy+scale* 3.16901569E+01); - glVertex2d(dx+scale*5.95178938E+00,dy+scale* 3.16901569E+01 ); - glVertex2d(dx+scale*7.64524508E+00,dy+scale* 3.16901569E+01); - glVertex2d(dx+scale*7.64524508E+00,dy+scale* 3.16901569E+01 ); - glVertex2d(dx+scale*1.12084312E+01,dy+scale* 3.38138428E+01); - glVertex2d(dx+scale*1.12084312E+01,dy+scale* 3.38138428E+01 ); - glVertex2d(dx+scale*1.73539886E+01,dy+scale* 3.62145729E+01); - glVertex2d(dx+scale*1.73539886E+01,dy+scale* 3.62145729E+01 ); - glVertex2d(dx+scale*2.15019493E+01,dy+scale* 3.78349495E+01); - glVertex2d(dx+scale*2.15019493E+01,dy+scale* 3.78349495E+01 ); - glVertex2d(dx+scale*2.46490135E+01,dy+scale* 3.97106285E+01); - glVertex2d(dx+scale*2.46490135E+01,dy+scale* 3.97106285E+01 ); - glVertex2d(dx+scale*2.73888340E+01,dy+scale* 4.13435822E+01); - glVertex2d(dx+scale*2.73888340E+01,dy+scale* 4.13435822E+01 ); - glVertex2d(dx+scale*2.86334686E+01,dy+scale* 4.46771202E+01); - glVertex2d(dx+scale*2.86334686E+01,dy+scale* 4.46771202E+01 ); - glVertex2d(dx+scale*2.71944695E+01,dy+scale* 4.76413078E+01); - glVertex2d(dx+scale*2.71944695E+01,dy+scale* 4.76413078E+01 ); - glVertex2d(dx+scale*2.39893608E+01,dy+scale* 4.83796997E+01); - glVertex2d(dx+scale*2.39893608E+01,dy+scale* 4.83796997E+01 ); - glVertex2d(dx+scale*1.62659492E+01,dy+scale* 4.59099236E+01); - glVertex2d(dx+scale*1.62659492E+01,dy+scale* 4.59099236E+01 ); - glVertex2d(dx+scale*1.52036419E+01,dy+scale* 4.47925949E+01); - glVertex2d(dx+scale*1.52036419E+01,dy+scale* 4.47925949E+01 ); - glVertex2d(dx+scale*1.52036419E+01,dy+scale* 4.29968033E+01); - glVertex2d(dx+scale*8.08595753E+00,dy+scale* 3.58040657E+01 ); - glVertex2d(dx+scale*5.95178938E+00,dy+scale* 3.35593605E+01); - glVertex2d(dx+scale*1.56476307E+01,dy+scale* 4.10665283E+01 ); - glVertex2d(dx+scale*1.93166199E+01,dy+scale* 4.10665283E+01); - glVertex2d(dx+scale*1.93166199E+01,dy+scale* 4.10665283E+01 ); - glVertex2d(dx+scale*2.33771973E+01,dy+scale* 4.10665283E+01); - glVertex2d(dx+scale*2.33771973E+01,dy+scale* 4.10665283E+01 ); - glVertex2d(dx+scale*2.33771973E+01,dy+scale* 4.26527710E+01); - glVertex2d(dx+scale*2.33771973E+01,dy+scale* 4.26527710E+01 ); - glVertex2d(dx+scale*2.13850403E+01,dy+scale* 4.40476913E+01); - glVertex2d(dx+scale*2.13850403E+01,dy+scale* 4.40476913E+01 ); - glVertex2d(dx+scale*1.70507278E+01,dy+scale* 4.36787071E+01); - glVertex2d(dx+scale*1.70507278E+01,dy+scale* 4.36787071E+01 ); - glVertex2d(dx+scale*1.55381908E+01,dy+scale* 4.08627815E+01); - glVertex2d(dx+scale*5.44178314E+01,dy+scale* 5.39478874E+00 ); - glVertex2d(dx+scale*5.19188347E+01,dy+scale* 1.05424643E+01); - glVertex2d(dx+scale*5.19188347E+01,dy+scale* 1.05424643E+01 ); - glVertex2d(dx+scale*4.79111748E+01,dy+scale* 1.68014603E+01); - glVertex2d(dx+scale*4.79111748E+01,dy+scale* 1.68014603E+01 ); - glVertex2d(dx+scale*4.09703102E+01,dy+scale* 2.47799721E+01); - glVertex2d(dx+scale*1.97410069E+01,dy+scale* 2.08601875E+01 ); - glVertex2d(dx+scale*3.03358269E+01,dy+scale* 1.29992170E+01); - glVertex2d(dx+scale*3.34980812E+01,dy+scale* 1.23018475E+01 ); - glVertex2d(dx+scale*4.00906754E+01,dy+scale* 6.03390121E+00); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.55669289E+01 ); - glVertex2d(dx+scale*5.95178938E+00,dy+scale* 3.35593605E+01); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.55669289E+01 ); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.72466736E+01); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.72466736E+01 ); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.80246620E+01); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.80246620E+01 ); - glVertex2d(dx+scale*6.44296885E+00,dy+scale* 3.80246620E+01); - glVertex2d(dx+scale*6.44296885E+00,dy+scale* 3.80246620E+01 ); - glVertex2d(dx+scale*7.81519079E+00,dy+scale* 3.80246620E+01); - glVertex2d(dx+scale*7.81519079E+00,dy+scale* 3.80246620E+01 ); - glVertex2d(dx+scale*9.44908714E+00,dy+scale* 4.10665283E+01); - glVertex2d(dx+scale*9.44908714E+00,dy+scale* 4.10665283E+01 ); - glVertex2d(dx+scale*7.57615042E+00,dy+scale* 4.31311188E+01); - glVertex2d(dx+scale*7.57615042E+00,dy+scale* 4.31311188E+01 ); - glVertex2d(dx+scale*3.57823205E+00,dy+scale* 4.07483292E+01); - glVertex2d(dx+scale*3.57823205E+00,dy+scale* 4.07483292E+01 ); - glVertex2d(dx+scale*2.90823507E+00,dy+scale* 3.95009766E+01); - glVertex2d(dx+scale*2.90823507E+00,dy+scale* 3.95009766E+01 ); - glVertex2d(dx+scale*8.70941460E-01,dy+scale* 3.73581619E+01); - glVertex2d(dx+scale*8.70941460E-01,dy+scale* 3.73581619E+01 ); - glVertex2d(dx+scale*3.22941685E+00,dy+scale* 3.47821503E+01); - glVertex2d(dx+scale*3.22941685E+00,dy+scale* 3.47821503E+01 ); - glVertex2d(dx+scale*5.23835278E+00,dy+scale* 3.55669289E+01); - glVertex2d(dx+scale*5.53392906E+01,dy+scale* 5.84212208E+00 ); - glVertex2d(dx+scale*5.34963722E+01,dy+scale* 4.94745588E+00); - glVertex2d(dx+scale*5.34963722E+01,dy+scale* 4.94745588E+00 ); - glVertex2d(dx+scale*5.33497162E+01,dy+scale* 2.90410757E+00); - glVertex2d(dx+scale*5.33497162E+01,dy+scale* 2.90410757E+00 ); - glVertex2d(dx+scale*5.50459785E+01,dy+scale* 1.75542593E+00); - glVertex2d(dx+scale*5.50459785E+01,dy+scale* 1.75542593E+00 ); - glVertex2d(dx+scale*5.68888969E+01,dy+scale* 2.65009236E+00); - glVertex2d(dx+scale*5.68888969E+01,dy+scale* 2.65009236E+00 ); - glVertex2d(dx+scale*5.70355530E+01,dy+scale* 4.69344044E+00); - glVertex2d(dx+scale*5.70355530E+01,dy+scale* 4.69344044E+00 ); - glVertex2d(dx+scale*5.53392906E+01,dy+scale* 5.84212208E+00); - glVertex2d(dx+scale*4.06703568E+01,dy+scale* 6.64360666E+00 ); - glVertex2d(dx+scale*3.95109940E+01,dy+scale* 5.42419529E+00); - glVertex2d(dx+scale*3.95109940E+01,dy+scale* 5.42419529E+00 ); - glVertex2d(dx+scale*3.99873543E+01,dy+scale* 3.81045246E+00); - glVertex2d(dx+scale*3.99873543E+01,dy+scale* 3.81045246E+00 ); - glVertex2d(dx+scale*4.16230736E+01,dy+scale* 3.41612053E+00); - glVertex2d(dx+scale*4.16230736E+01,dy+scale* 3.41612053E+00 ); - glVertex2d(dx+scale*4.20994339E+01,dy+scale* 1.80237734E+00); - glVertex2d(dx+scale*4.20994339E+01,dy+scale* 1.80237734E+00 ); - glVertex2d(dx+scale*4.37351570E+01,dy+scale* 1.40804553E+00); - glVertex2d(dx+scale*4.37351570E+01,dy+scale* 1.40804553E+00 ); - glVertex2d(dx+scale*4.48945198E+01,dy+scale* 2.62745667E+00); - glVertex2d(dx+scale*4.48945198E+01,dy+scale* 2.62745667E+00 ); - glVertex2d(dx+scale*4.44181595E+01,dy+scale* 4.24119997E+00); - glVertex2d(dx+scale*4.44181595E+01,dy+scale* 4.24119997E+00 ); - glVertex2d(dx+scale*4.27824364E+01,dy+scale* 4.63553190E+00); - glVertex2d(dx+scale*4.27824364E+01,dy+scale* 4.63553190E+00 ); - glVertex2d(dx+scale*4.23060799E+01,dy+scale* 6.24927473E+00); - glVertex2d(dx+scale*4.23060799E+01,dy+scale* 6.24927473E+00 ); - glVertex2d(dx+scale*4.06703568E+01,dy+scale* 6.64360666E+00); - glVertex2d(dx+scale*2.04135437E+01,dy+scale* 5.37603645E+01 ); - glVertex2d(dx+scale*2.09234962E+01,dy+scale* 5.39400024E+01); - glVertex2d(dx+scale*2.09234962E+01,dy+scale* 5.39400024E+01 ); - glVertex2d(dx+scale*2.10229034E+01,dy+scale* 5.44714508E+01); - glVertex2d(dx+scale*2.10229034E+01,dy+scale* 5.44714508E+01 ); - glVertex2d(dx+scale*2.06123581E+01,dy+scale* 5.48232651E+01); - glVertex2d(dx+scale*2.06123581E+01,dy+scale* 5.48232651E+01 ); - glVertex2d(dx+scale*2.01024036E+01,dy+scale* 5.46436272E+01); - glVertex2d(dx+scale*2.01024036E+01,dy+scale* 5.46436272E+01 ); - glVertex2d(dx+scale*2.00029964E+01,dy+scale* 5.41121788E+01); - glVertex2d(dx+scale*2.00029964E+01,dy+scale* 5.41121788E+01 ); - glVertex2d(dx+scale*2.04135437E+01,dy+scale* 5.37603645E+01); - glVertex2d(dx+scale*2.92241192E+01,dy+scale* 5.89225616E+01 ); - glVertex2d(dx+scale*2.92241192E+01,dy+scale* 6.01559525E+01); - glVertex2d(dx+scale*2.92241192E+01,dy+scale* 6.01559525E+01 ); - glVertex2d(dx+scale*2.81559734E+01,dy+scale* 6.07726440E+01); - glVertex2d(dx+scale*2.81559734E+01,dy+scale* 6.07726440E+01 ); - glVertex2d(dx+scale*2.70878277E+01,dy+scale* 6.01559525E+01); - glVertex2d(dx+scale*2.70878277E+01,dy+scale* 6.01559525E+01 ); - glVertex2d(dx+scale*2.70878277E+01,dy+scale* 5.89225616E+01); - glVertex2d(dx+scale*2.70878277E+01,dy+scale* 5.89225616E+01 ); - glVertex2d(dx+scale*2.81559734E+01,dy+scale* 5.83058662E+01); - glVertex2d(dx+scale*2.81559734E+01,dy+scale* 5.83058662E+01 ); - glVertex2d(dx+scale*2.92241192E+01,dy+scale* 5.89225616E+01); - glVertex2d(dx+scale*4.00748558E+01,dy+scale* 6.66682663E+01 ); - glVertex2d(dx+scale*4.00748558E+01,dy+scale* 6.86397629E+01); - glVertex2d(dx+scale*4.00748558E+01,dy+scale* 6.86397629E+01 ); - glVertex2d(dx+scale*3.83674927E+01,dy+scale* 6.96255112E+01); - glVertex2d(dx+scale*3.83674927E+01,dy+scale* 6.96255112E+01 ); - glVertex2d(dx+scale*3.66601257E+01,dy+scale* 6.86397629E+01); - glVertex2d(dx+scale*3.66601257E+01,dy+scale* 6.86397629E+01 ); - glVertex2d(dx+scale*3.66601257E+01,dy+scale* 6.66682663E+01); - glVertex2d(dx+scale*3.66601257E+01,dy+scale* 6.66682663E+01 ); - glVertex2d(dx+scale*3.83674927E+01,dy+scale* 6.56825180E+01); - glVertex2d(dx+scale*3.83674927E+01,dy+scale* 6.56825180E+01 ); - glVertex2d(dx+scale*4.00748558E+01,dy+scale* 6.66682663E+01); - glVertex2d(dx+scale*3.55498581E+01,dy+scale* 5.91182632E+01 ); - glVertex2d(dx+scale*3.62619553E+01,dy+scale* 5.99602509E+01); - glVertex2d(dx+scale*3.62619553E+01,dy+scale* 5.99602509E+01 ); - glVertex2d(dx+scale*3.58888245E+01,dy+scale* 6.09979362E+01); - glVertex2d(dx+scale*3.58888245E+01,dy+scale* 6.09979362E+01 ); - glVertex2d(dx+scale*3.48035927E+01,dy+scale* 6.11936378E+01); - glVertex2d(dx+scale*3.48035927E+01,dy+scale* 6.11936378E+01 ); - glVertex2d(dx+scale*3.40914955E+01,dy+scale* 6.03516541E+01); - glVertex2d(dx+scale*3.40914955E+01,dy+scale* 6.03516541E+01 ); - glVertex2d(dx+scale*3.44646263E+01,dy+scale* 5.93139648E+01); - glVertex2d(dx+scale*3.44646263E+01,dy+scale* 5.93139648E+01 ); - glVertex2d(dx+scale*3.55498581E+01,dy+scale* 5.91182632E+01); + glVertex2d(dx + scale * 4.70261803E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 4.34834213E+01, dy + scale * 3.27708626E+01); + glVertex2d(dx + scale * 4.34834213E+01, dy + scale * 3.27708626E+01); + glVertex2d(dx + scale * 4.13941002E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 4.13941002E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 3.96319656E+01, dy + scale * 3.27708626E+01); + glVertex2d(dx + scale * 4.70261803E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 6.37407417E+01, dy + scale * 2.29766846E+01); + glVertex2d(dx + scale * 6.37407417E+01, dy + scale * 2.29766846E+01); + glVertex2d(dx + scale * 6.88277817E+01, dy + scale * 2.83272076E+01); + glVertex2d(dx + scale * 6.88277817E+01, dy + scale * 2.83272076E+01); + glVertex2d(dx + scale * 7.49140625E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 7.49140625E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 7.75205078E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 5.73819389E+01, dy + scale * 1.82609520E+01); + glVertex2d(dx + scale * 6.51033478E+01, dy + scale * 1.64820938E+01); + glVertex2d(dx + scale * 6.51033478E+01, dy + scale * 1.64820938E+01); + glVertex2d(dx + scale * 6.72513809E+01, dy + scale * 1.64820938E+01); + glVertex2d(dx + scale * 6.72513809E+01, dy + scale * 1.64820938E+01); + glVertex2d(dx + scale * 6.88277817E+01, dy + scale * 1.81401482E+01); + glVertex2d(dx + scale * 6.88277817E+01, dy + scale * 1.81401482E+01); + glVertex2d(dx + scale * 7.75205078E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 7.75205078E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 7.91115646E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 7.91115646E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 7.96394882E+01, dy + scale * 3.28461914E+01); + glVertex2d(dx + scale * 7.96394882E+01, dy + scale * 3.28461914E+01); + glVertex2d(dx + scale * 8.69550934E+01, dy + scale * 3.72063484E+01); + glVertex2d(dx + scale * 8.69550934E+01, dy + scale * 3.72063484E+01); + glVertex2d(dx + scale * 9.21887970E+01, dy + scale * 3.60006065E+01); + glVertex2d(dx + scale * 9.21887970E+01, dy + scale * 3.60006065E+01); + glVertex2d(dx + scale * 9.73070221E+01, dy + scale * 4.33102036E+01); + glVertex2d(dx + scale * 9.73070221E+01, dy + scale * 4.33102036E+01); + glVertex2d(dx + scale * 9.48979111E+01, dy + scale * 4.38652153E+01); + glVertex2d(dx + scale * 9.48979111E+01, dy + scale * 4.38652153E+01); + glVertex2d(dx + scale * 7.96394882E+01, dy + scale * 3.86619072E+01); + glVertex2d(dx + scale * 7.96394882E+01, dy + scale * 3.86619072E+01); + glVertex2d(dx + scale * 7.41574936E+01, dy + scale * 3.60006065E+01); + glVertex2d(dx + scale * 7.41574936E+01, dy + scale * 3.60006065E+01); + glVertex2d(dx + scale * 7.35288086E+01, dy + scale * 3.32717209E+01); + glVertex2d(dx + scale * 7.35288086E+01, dy + scale * 3.32717209E+01); + glVertex2d(dx + scale * 7.49140625E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 7.25460358E+01, dy + scale * 2.34503746E+01); + glVertex2d(dx + scale * 7.35393219E+01, dy + scale * 2.14043198E+01); + glVertex2d(dx + scale * 7.35393219E+01, dy + scale * 2.14043198E+01); + glVertex2d(dx + scale * 7.72988739E+01, dy + scale * 2.26863708E+01); + glVertex2d(dx + scale * 7.72988739E+01, dy + scale * 2.26863708E+01); + glVertex2d(dx + scale * 8.08417358E+01, dy + scale * 1.53884392E+01); + glVertex2d(dx + scale * 8.08417358E+01, dy + scale * 1.53884392E+01); + glVertex2d(dx + scale * 9.27881927E+01, dy + scale * 5.54670620E+00); + glVertex2d(dx + scale * 9.27881927E+01, dy + scale * 5.54670620E+00); + glVertex2d(dx + scale * 1.00075905E+02, dy + scale * 8.03190613E+00); + glVertex2d(dx + scale * 1.00075905E+02, dy + scale * 8.03190613E+00); + glVertex2d(dx + scale * 8.60352936E+01, dy + scale * 1.99065475E+01); + glVertex2d(dx + scale * 8.60352936E+01, dy + scale * 1.99065475E+01); + glVertex2d(dx + scale * 7.86158524E+01, dy + scale * 2.84351845E+01); + glVertex2d(dx + scale * 7.86158524E+01, dy + scale * 2.84351845E+01); + glVertex2d(dx + scale * 7.69795456E+01, dy + scale * 2.67141228E+01); + glVertex2d(dx + scale * 7.69795456E+01, dy + scale * 2.67141228E+01); + glVertex2d(dx + scale * 7.41574936E+01, dy + scale * 2.57517700E+01); + glVertex2d(dx + scale * 7.30426788E+01, dy + scale * 2.24273472E+01); + glVertex2d(dx + scale * 7.14492264E+01, dy + scale * 2.18839607E+01); + glVertex2d(dx + scale * 6.16945724E+01, dy + scale * 2.40757561E+01); + glVertex2d(dx + scale * 6.62687149E+01, dy + scale * 2.56355934E+01); + glVertex2d(dx + scale * 3.96319656E+01, dy + scale * 3.27708626E+01); + glVertex2d(dx + scale * 2.45886974E+01, dy + scale * 3.97385635E+01); + glVertex2d(dx + scale * 2.45886974E+01, dy + scale * 3.97385635E+01); + glVertex2d(dx + scale * 2.06685200E+01, dy + scale * 3.97385635E+01); + glVertex2d(dx + scale * 5.73819389E+01, dy + scale * 1.82609520E+01); + glVertex2d(dx + scale * 5.58739510E+01, dy + scale * 2.29766846E+01); + glVertex2d(dx + scale * 5.58739510E+01, dy + scale * 2.29766846E+01); + glVertex2d(dx + scale * 5.10441551E+01, dy + scale * 2.47799721E+01); + glVertex2d(dx + scale * 5.10441551E+01, dy + scale * 2.47799721E+01); + glVertex2d(dx + scale * 3.96319656E+01, dy + scale * 3.27708626E+01); + glVertex2d(dx + scale * 1.71485100E+01, dy + scale * 3.83634911E+01); + glVertex2d(dx + scale * 2.31309643E+01, dy + scale * 3.34350243E+01); + glVertex2d(dx + scale * 2.31309643E+01, dy + scale * 3.34350243E+01); + glVertex2d(dx + scale * 3.66521492E+01, dy + scale * 3.01534729E+01); + glVertex2d(dx + scale * 3.66521492E+01, dy + scale * 3.01534729E+01); + glVertex2d(dx + scale * 4.84622536E+01, dy + scale * 2.18839607E+01); + glVertex2d(dx + scale * 4.84622536E+01, dy + scale * 2.18839607E+01); + glVertex2d(dx + scale * 5.24489517E+01, dy + scale * 1.73012562E+01); + glVertex2d(dx + scale * 5.24489517E+01, dy + scale * 1.73012562E+01); + glVertex2d(dx + scale * 5.73819389E+01, dy + scale * 1.82609520E+01); + glVertex2d(dx + scale * 2.31120663E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 2.65303173E+01, dy + scale * 1.84667053E+01); + glVertex2d(dx + scale * 2.65303173E+01, dy + scale * 1.84667053E+01); + glVertex2d(dx + scale * 2.76829071E+01, dy + scale * 1.88597527E+01); + glVertex2d(dx + scale * 2.76829071E+01, dy + scale * 1.88597527E+01); + glVertex2d(dx + scale * 2.98293095E+01, dy + scale * 2.46085243E+01); + glVertex2d(dx + scale * 2.98293095E+01, dy + scale * 2.46085243E+01); + glVertex2d(dx + scale * 2.20083504E+01, dy + scale * 2.88094444E+01); + glVertex2d(dx + scale * 2.20083504E+01, dy + scale * 2.88094444E+01); + glVertex2d(dx + scale * 1.73340797E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 1.73340797E+01, dy + scale * 3.05546646E+01); + glVertex2d(dx + scale * 1.43467293E+01, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 1.43467293E+01, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 1.43467293E+01, dy + scale * 3.66936073E+01); + glVertex2d(dx + scale * 2.31120663E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 1.77385178E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 1.77385178E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 1.45902586E+01, dy + scale * 2.89193249E+01); + glVertex2d(dx + scale * 1.45902586E+01, dy + scale * 2.89193249E+01); + glVertex2d(dx + scale * 1.09701309E+01, dy + scale * 3.08638268E+01); + glVertex2d(dx + scale * 1.09701309E+01, dy + scale * 3.08638268E+01); + glVertex2d(dx + scale * 1.09701309E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 1.09701309E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 1.02964087E+01, dy + scale * 2.72419567E+01); + glVertex2d(dx + scale * 1.02964087E+01, dy + scale * 2.72419567E+01); + glVertex2d(dx + scale * 1.43467293E+01, dy + scale * 1.33082447E+01); + glVertex2d(dx + scale * 1.43467293E+01, dy + scale * 1.33082447E+01); + glVertex2d(dx + scale * 1.55345182E+01, dy + scale * 9.59382534E+00); + glVertex2d(dx + scale * 1.55345182E+01, dy + scale * 9.59382534E+00); + glVertex2d(dx + scale * 1.72489243E+01, dy + scale * 9.19886017E+00); + glVertex2d(dx + scale * 1.72489243E+01, dy + scale * 9.19886017E+00); + glVertex2d(dx + scale * 1.69032230E+01, dy + scale * 1.32596684E+01); + glVertex2d(dx + scale * 1.69032230E+01, dy + scale * 1.32596684E+01); + glVertex2d(dx + scale * 1.31571884E+01, dy + scale * 2.49741650E+01); + glVertex2d(dx + scale * 1.31571884E+01, dy + scale * 2.49741650E+01); + glVertex2d(dx + scale * 1.69212170E+01, dy + scale * 2.29523678E+01); + glVertex2d(dx + scale * 3.90322609E+01, dy + scale * 1.84667053E+01); + glVertex2d(dx + scale * 5.05798721E+01, dy + scale * 1.94497623E+01); + glVertex2d(dx + scale * 2.31120663E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 3.18689404E+01, dy + scale * 1.13308659E+01); + glVertex2d(dx + scale * 3.18689404E+01, dy + scale * 1.13308659E+01); + glVertex2d(dx + scale * 3.67675819E+01, dy + scale * 1.42504940E+01); + glVertex2d(dx + scale * 3.67675819E+01, dy + scale * 1.42504940E+01); + glVertex2d(dx + scale * 3.90322609E+01, dy + scale * 1.84667053E+01); + glVertex2d(dx + scale * 4.70261803E+01, dy + scale * 3.19546795E+01); + glVertex2d(dx + scale * 4.75925865E+01, dy + scale * 3.30091743E+01); + glVertex2d(dx + scale * 4.75925865E+01, dy + scale * 3.30091743E+01); + glVertex2d(dx + scale * 4.81551323E+01, dy + scale * 3.54509926E+01); + glVertex2d(dx + scale * 4.81551323E+01, dy + scale * 3.54509926E+01); + glVertex2d(dx + scale * 4.75925865E+01, dy + scale * 3.66097794E+01); + glVertex2d(dx + scale * 4.75925865E+01, dy + scale * 3.66097794E+01); + glVertex2d(dx + scale * 4.65963593E+01, dy + scale * 3.86619072E+01); + glVertex2d(dx + scale * 4.65963593E+01, dy + scale * 3.86619072E+01); + glVertex2d(dx + scale * 2.57703133E+01, dy + scale * 4.64376678E+01); + glVertex2d(dx + scale * 2.57703133E+01, dy + scale * 4.64376678E+01); + glVertex2d(dx + scale * 2.36515903E+01, dy + scale * 4.62573013E+01); + glVertex2d(dx + scale * 2.36515903E+01, dy + scale * 4.62573013E+01); + glVertex2d(dx + scale * 2.06685200E+01, dy + scale * 4.50919800E+01); + glVertex2d(dx + scale * 2.06685200E+01, dy + scale * 4.50919800E+01); + glVertex2d(dx + scale * 2.02995567E+01, dy + scale * 4.41037750E+01); + glVertex2d(dx + scale * 4.15640564E+01, dy + scale * 2.67141228E+01); + glVertex2d(dx + scale * 3.90322609E+01, dy + scale * 1.84667053E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 3.22941685E+00, dy + scale * 3.47821503E+01); + glVertex2d(dx + scale * 1.57866726E+01, dy + scale * 3.79439583E+01); + glVertex2d(dx + scale * 1.53819942E+01, dy + scale * 4.26975594E+01); + glVertex2d(dx + scale * 1.53819942E+01, dy + scale * 4.26975594E+01); + glVertex2d(dx + scale * 1.34937668E+01, dy + scale * 4.58656845E+01); + glVertex2d(dx + scale * 1.34937668E+01, dy + scale * 4.58656845E+01); + glVertex2d(dx + scale * 9.24889469E+00, dy + scale * 4.68436165E+01); + glVertex2d(dx + scale * 9.24889469E+00, dy + scale * 4.68436165E+01); + glVertex2d(dx + scale * 6.85485315E+00, dy + scale * 4.68436165E+01); + glVertex2d(dx + scale * 6.85485315E+00, dy + scale * 4.68436165E+01); + glVertex2d(dx + scale * 2.90823507E+00, dy + scale * 4.44914017E+01); + glVertex2d(dx + scale * 2.90823507E+00, dy + scale * 4.44914017E+01); + glVertex2d(dx + scale * 2.90823507E+00, dy + scale * 4.07268143E+01); + glVertex2d(dx + scale * 5.95178938E+00, dy + scale * 3.35593605E+01); + glVertex2d(dx + scale * 5.95178938E+00, dy + scale * 3.16901569E+01); + glVertex2d(dx + scale * 5.95178938E+00, dy + scale * 3.16901569E+01); + glVertex2d(dx + scale * 7.64524508E+00, dy + scale * 3.16901569E+01); + glVertex2d(dx + scale * 7.64524508E+00, dy + scale * 3.16901569E+01); + glVertex2d(dx + scale * 1.12084312E+01, dy + scale * 3.38138428E+01); + glVertex2d(dx + scale * 1.12084312E+01, dy + scale * 3.38138428E+01); + glVertex2d(dx + scale * 1.73539886E+01, dy + scale * 3.62145729E+01); + glVertex2d(dx + scale * 1.73539886E+01, dy + scale * 3.62145729E+01); + glVertex2d(dx + scale * 2.15019493E+01, dy + scale * 3.78349495E+01); + glVertex2d(dx + scale * 2.15019493E+01, dy + scale * 3.78349495E+01); + glVertex2d(dx + scale * 2.46490135E+01, dy + scale * 3.97106285E+01); + glVertex2d(dx + scale * 2.46490135E+01, dy + scale * 3.97106285E+01); + glVertex2d(dx + scale * 2.73888340E+01, dy + scale * 4.13435822E+01); + glVertex2d(dx + scale * 2.73888340E+01, dy + scale * 4.13435822E+01); + glVertex2d(dx + scale * 2.86334686E+01, dy + scale * 4.46771202E+01); + glVertex2d(dx + scale * 2.86334686E+01, dy + scale * 4.46771202E+01); + glVertex2d(dx + scale * 2.71944695E+01, dy + scale * 4.76413078E+01); + glVertex2d(dx + scale * 2.71944695E+01, dy + scale * 4.76413078E+01); + glVertex2d(dx + scale * 2.39893608E+01, dy + scale * 4.83796997E+01); + glVertex2d(dx + scale * 2.39893608E+01, dy + scale * 4.83796997E+01); + glVertex2d(dx + scale * 1.62659492E+01, dy + scale * 4.59099236E+01); + glVertex2d(dx + scale * 1.62659492E+01, dy + scale * 4.59099236E+01); + glVertex2d(dx + scale * 1.52036419E+01, dy + scale * 4.47925949E+01); + glVertex2d(dx + scale * 1.52036419E+01, dy + scale * 4.47925949E+01); + glVertex2d(dx + scale * 1.52036419E+01, dy + scale * 4.29968033E+01); + glVertex2d(dx + scale * 8.08595753E+00, dy + scale * 3.58040657E+01); + glVertex2d(dx + scale * 5.95178938E+00, dy + scale * 3.35593605E+01); + glVertex2d(dx + scale * 1.56476307E+01, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 1.93166199E+01, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 1.93166199E+01, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 2.33771973E+01, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 2.33771973E+01, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 2.33771973E+01, dy + scale * 4.26527710E+01); + glVertex2d(dx + scale * 2.33771973E+01, dy + scale * 4.26527710E+01); + glVertex2d(dx + scale * 2.13850403E+01, dy + scale * 4.40476913E+01); + glVertex2d(dx + scale * 2.13850403E+01, dy + scale * 4.40476913E+01); + glVertex2d(dx + scale * 1.70507278E+01, dy + scale * 4.36787071E+01); + glVertex2d(dx + scale * 1.70507278E+01, dy + scale * 4.36787071E+01); + glVertex2d(dx + scale * 1.55381908E+01, dy + scale * 4.08627815E+01); + glVertex2d(dx + scale * 5.44178314E+01, dy + scale * 5.39478874E+00); + glVertex2d(dx + scale * 5.19188347E+01, dy + scale * 1.05424643E+01); + glVertex2d(dx + scale * 5.19188347E+01, dy + scale * 1.05424643E+01); + glVertex2d(dx + scale * 4.79111748E+01, dy + scale * 1.68014603E+01); + glVertex2d(dx + scale * 4.79111748E+01, dy + scale * 1.68014603E+01); + glVertex2d(dx + scale * 4.09703102E+01, dy + scale * 2.47799721E+01); + glVertex2d(dx + scale * 1.97410069E+01, dy + scale * 2.08601875E+01); + glVertex2d(dx + scale * 3.03358269E+01, dy + scale * 1.29992170E+01); + glVertex2d(dx + scale * 3.34980812E+01, dy + scale * 1.23018475E+01); + glVertex2d(dx + scale * 4.00906754E+01, dy + scale * 6.03390121E+00); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 5.95178938E+00, dy + scale * 3.35593605E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.72466736E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.72466736E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 6.44296885E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 6.44296885E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 7.81519079E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 7.81519079E+00, dy + scale * 3.80246620E+01); + glVertex2d(dx + scale * 9.44908714E+00, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 9.44908714E+00, dy + scale * 4.10665283E+01); + glVertex2d(dx + scale * 7.57615042E+00, dy + scale * 4.31311188E+01); + glVertex2d(dx + scale * 7.57615042E+00, dy + scale * 4.31311188E+01); + glVertex2d(dx + scale * 3.57823205E+00, dy + scale * 4.07483292E+01); + glVertex2d(dx + scale * 3.57823205E+00, dy + scale * 4.07483292E+01); + glVertex2d(dx + scale * 2.90823507E+00, dy + scale * 3.95009766E+01); + glVertex2d(dx + scale * 2.90823507E+00, dy + scale * 3.95009766E+01); + glVertex2d(dx + scale * 8.70941460E-01, dy + scale * 3.73581619E+01); + glVertex2d(dx + scale * 8.70941460E-01, dy + scale * 3.73581619E+01); + glVertex2d(dx + scale * 3.22941685E+00, dy + scale * 3.47821503E+01); + glVertex2d(dx + scale * 3.22941685E+00, dy + scale * 3.47821503E+01); + glVertex2d(dx + scale * 5.23835278E+00, dy + scale * 3.55669289E+01); + glVertex2d(dx + scale * 5.53392906E+01, dy + scale * 5.84212208E+00); + glVertex2d(dx + scale * 5.34963722E+01, dy + scale * 4.94745588E+00); + glVertex2d(dx + scale * 5.34963722E+01, dy + scale * 4.94745588E+00); + glVertex2d(dx + scale * 5.33497162E+01, dy + scale * 2.90410757E+00); + glVertex2d(dx + scale * 5.33497162E+01, dy + scale * 2.90410757E+00); + glVertex2d(dx + scale * 5.50459785E+01, dy + scale * 1.75542593E+00); + glVertex2d(dx + scale * 5.50459785E+01, dy + scale * 1.75542593E+00); + glVertex2d(dx + scale * 5.68888969E+01, dy + scale * 2.65009236E+00); + glVertex2d(dx + scale * 5.68888969E+01, dy + scale * 2.65009236E+00); + glVertex2d(dx + scale * 5.70355530E+01, dy + scale * 4.69344044E+00); + glVertex2d(dx + scale * 5.70355530E+01, dy + scale * 4.69344044E+00); + glVertex2d(dx + scale * 5.53392906E+01, dy + scale * 5.84212208E+00); + glVertex2d(dx + scale * 4.06703568E+01, dy + scale * 6.64360666E+00); + glVertex2d(dx + scale * 3.95109940E+01, dy + scale * 5.42419529E+00); + glVertex2d(dx + scale * 3.95109940E+01, dy + scale * 5.42419529E+00); + glVertex2d(dx + scale * 3.99873543E+01, dy + scale * 3.81045246E+00); + glVertex2d(dx + scale * 3.99873543E+01, dy + scale * 3.81045246E+00); + glVertex2d(dx + scale * 4.16230736E+01, dy + scale * 3.41612053E+00); + glVertex2d(dx + scale * 4.16230736E+01, dy + scale * 3.41612053E+00); + glVertex2d(dx + scale * 4.20994339E+01, dy + scale * 1.80237734E+00); + glVertex2d(dx + scale * 4.20994339E+01, dy + scale * 1.80237734E+00); + glVertex2d(dx + scale * 4.37351570E+01, dy + scale * 1.40804553E+00); + glVertex2d(dx + scale * 4.37351570E+01, dy + scale * 1.40804553E+00); + glVertex2d(dx + scale * 4.48945198E+01, dy + scale * 2.62745667E+00); + glVertex2d(dx + scale * 4.48945198E+01, dy + scale * 2.62745667E+00); + glVertex2d(dx + scale * 4.44181595E+01, dy + scale * 4.24119997E+00); + glVertex2d(dx + scale * 4.44181595E+01, dy + scale * 4.24119997E+00); + glVertex2d(dx + scale * 4.27824364E+01, dy + scale * 4.63553190E+00); + glVertex2d(dx + scale * 4.27824364E+01, dy + scale * 4.63553190E+00); + glVertex2d(dx + scale * 4.23060799E+01, dy + scale * 6.24927473E+00); + glVertex2d(dx + scale * 4.23060799E+01, dy + scale * 6.24927473E+00); + glVertex2d(dx + scale * 4.06703568E+01, dy + scale * 6.64360666E+00); + glVertex2d(dx + scale * 2.04135437E+01, dy + scale * 5.37603645E+01); + glVertex2d(dx + scale * 2.09234962E+01, dy + scale * 5.39400024E+01); + glVertex2d(dx + scale * 2.09234962E+01, dy + scale * 5.39400024E+01); + glVertex2d(dx + scale * 2.10229034E+01, dy + scale * 5.44714508E+01); + glVertex2d(dx + scale * 2.10229034E+01, dy + scale * 5.44714508E+01); + glVertex2d(dx + scale * 2.06123581E+01, dy + scale * 5.48232651E+01); + glVertex2d(dx + scale * 2.06123581E+01, dy + scale * 5.48232651E+01); + glVertex2d(dx + scale * 2.01024036E+01, dy + scale * 5.46436272E+01); + glVertex2d(dx + scale * 2.01024036E+01, dy + scale * 5.46436272E+01); + glVertex2d(dx + scale * 2.00029964E+01, dy + scale * 5.41121788E+01); + glVertex2d(dx + scale * 2.00029964E+01, dy + scale * 5.41121788E+01); + glVertex2d(dx + scale * 2.04135437E+01, dy + scale * 5.37603645E+01); + glVertex2d(dx + scale * 2.92241192E+01, dy + scale * 5.89225616E+01); + glVertex2d(dx + scale * 2.92241192E+01, dy + scale * 6.01559525E+01); + glVertex2d(dx + scale * 2.92241192E+01, dy + scale * 6.01559525E+01); + glVertex2d(dx + scale * 2.81559734E+01, dy + scale * 6.07726440E+01); + glVertex2d(dx + scale * 2.81559734E+01, dy + scale * 6.07726440E+01); + glVertex2d(dx + scale * 2.70878277E+01, dy + scale * 6.01559525E+01); + glVertex2d(dx + scale * 2.70878277E+01, dy + scale * 6.01559525E+01); + glVertex2d(dx + scale * 2.70878277E+01, dy + scale * 5.89225616E+01); + glVertex2d(dx + scale * 2.70878277E+01, dy + scale * 5.89225616E+01); + glVertex2d(dx + scale * 2.81559734E+01, dy + scale * 5.83058662E+01); + glVertex2d(dx + scale * 2.81559734E+01, dy + scale * 5.83058662E+01); + glVertex2d(dx + scale * 2.92241192E+01, dy + scale * 5.89225616E+01); + glVertex2d(dx + scale * 4.00748558E+01, dy + scale * 6.66682663E+01); + glVertex2d(dx + scale * 4.00748558E+01, dy + scale * 6.86397629E+01); + glVertex2d(dx + scale * 4.00748558E+01, dy + scale * 6.86397629E+01); + glVertex2d(dx + scale * 3.83674927E+01, dy + scale * 6.96255112E+01); + glVertex2d(dx + scale * 3.83674927E+01, dy + scale * 6.96255112E+01); + glVertex2d(dx + scale * 3.66601257E+01, dy + scale * 6.86397629E+01); + glVertex2d(dx + scale * 3.66601257E+01, dy + scale * 6.86397629E+01); + glVertex2d(dx + scale * 3.66601257E+01, dy + scale * 6.66682663E+01); + glVertex2d(dx + scale * 3.66601257E+01, dy + scale * 6.66682663E+01); + glVertex2d(dx + scale * 3.83674927E+01, dy + scale * 6.56825180E+01); + glVertex2d(dx + scale * 3.83674927E+01, dy + scale * 6.56825180E+01); + glVertex2d(dx + scale * 4.00748558E+01, dy + scale * 6.66682663E+01); + glVertex2d(dx + scale * 3.55498581E+01, dy + scale * 5.91182632E+01); + glVertex2d(dx + scale * 3.62619553E+01, dy + scale * 5.99602509E+01); + glVertex2d(dx + scale * 3.62619553E+01, dy + scale * 5.99602509E+01); + glVertex2d(dx + scale * 3.58888245E+01, dy + scale * 6.09979362E+01); + glVertex2d(dx + scale * 3.58888245E+01, dy + scale * 6.09979362E+01); + glVertex2d(dx + scale * 3.48035927E+01, dy + scale * 6.11936378E+01); + glVertex2d(dx + scale * 3.48035927E+01, dy + scale * 6.11936378E+01); + glVertex2d(dx + scale * 3.40914955E+01, dy + scale * 6.03516541E+01); + glVertex2d(dx + scale * 3.40914955E+01, dy + scale * 6.03516541E+01); + glVertex2d(dx + scale * 3.44646263E+01, dy + scale * 5.93139648E+01); + glVertex2d(dx + scale * 3.44646263E+01, dy + scale * 5.93139648E+01); + glVertex2d(dx + scale * 3.55498581E+01, dy + scale * 5.91182632E+01); glEnd(); break; default: break; } - glDisable (GL_BLEND); - glDisable (GL_LINE_SMOOTH); + glDisable(GL_BLEND); + glDisable(GL_LINE_SMOOTH); glPopMatrix(); } void Navigator::move() { - if(pad->toggle( pad->button_map[3])){ - switch (mode){ - case PEDESTRIAN : mode = DIVER ; break; - case DIVER : mode = PEDESTRIAN ; break; + if(pad->toggle(pad->button_map[3])) { + switch(mode) { + case PEDESTRIAN: mode = DIVER; break; + case DIVER: mode = PEDESTRIAN; break; default: break; } } // reset 1:1 - if(pad->toggle( pad->button_map[8]) ){ + if(pad->toggle(pad->button_map[8])) { ctx->camera.lookAtCg(); - reference_speed= 1.5*frequency*(ctx->camera.Lc)/100.; + reference_speed = 1.5 * frequency * (ctx->camera.Lc) / 100.; } // change the plane - if(pad->toggle( pad->button_map[0]) ) ctx->camera.lookAtCg(); - if(pad->toggle( pad->button_map[1]) ){ - switch(along){ - case AXE_X : along=AXE_Y; ctx->camera.alongY(); break; - case AXE_Y : along=AXE_Z; ctx->camera.alongZ(); break; - case AXE_Z : along=AXE_X; ctx->camera.alongX(); break; + if(pad->toggle(pad->button_map[0])) ctx->camera.lookAtCg(); + if(pad->toggle(pad->button_map[1])) { + switch(along) { + case AXE_X: + along = AXE_Y; + ctx->camera.alongY(); + break; + case AXE_Y: + along = AXE_Z; + ctx->camera.alongZ(); + break; + case AXE_Z: + along = AXE_X; + ctx->camera.alongX(); + break; default: break; } } // reset vertical axe or invers it - if(pad->toggle( pad->button_map[2] ) ){ - switch(along){ - case AXE_X : ctx->camera.upZ(); break; - case AXE_Y : ctx->camera.upX(); break; - case AXE_Z : ctx->camera.upY(); break; + if(pad->toggle(pad->button_map[2])) { + switch(along) { + case AXE_X: ctx->camera.upZ(); break; + case AXE_Y: ctx->camera.upX(); break; + case AXE_Z: ctx->camera.upY(); break; default: break; } } // head movement is damped to avoid nausea - if(pad->button[ pad->button_map[4] ] ){ - ax0 = int(pad->axe[ pad->axe_map[0] ]*10)/10.; - ax1 =int( pad->axe[ pad->axe_map[1] ]*10)/10.; - if(ax1 >0.) ax0=-ax0; + if(pad->button[pad->button_map[4]]) { + ax0 = int(pad->axe[pad->axe_map[0]] * 10) / 10.; + ax1 = int(pad->axe[pad->axe_map[1]] * 10) / 10.; + if(ax1 > 0.) ax0 = -ax0; + } + else { + ax0 = 0.; + ax1 = 0.; } - else { - ax0 =0.; ax1 =0. ; + if((ax0 - ax0_cur) > 0.) { + ax0_cur = ax0_cur + std::min((ax0 - ax0_cur), 0.005); + } + else { + ax0_cur = ax0_cur + std::max((ax0 - ax0_cur), -0.005); } - if( (ax0-ax0_cur)>0. ) { ax0_cur=ax0_cur + std::min((ax0-ax0_cur),0.005); } - else{ ax0_cur=ax0_cur + std::max((ax0-ax0_cur), -0.005); } - if( (ax1-ax1_cur) >0.) { ax1_cur=ax1_cur + std::min((ax1-ax1_cur),0.005); } - else{ ax1_cur=ax1_cur + std::max((ax1-ax1_cur), -0.005); } + if((ax1 - ax1_cur) > 0.) { + ax1_cur = ax1_cur + std::min((ax1 - ax1_cur), 0.005); + } + else { + ax1_cur = ax1_cur + std::max((ax1 - ax1_cur), -0.005); + } - azimut = -(ax0_cur) *(2.*ctx->camera.aperture*0.01745329 ) ; - elevation = (ax1_cur) *(2.*ctx->camera.aperture*0.01745329 ); + azimut = -(ax0_cur) * (2. * ctx->camera.aperture * 0.01745329); + elevation = (ax1_cur) * (2. * ctx->camera.aperture * 0.01745329); //======================================================== - switch(mode){ - case PEDESTRIAN : + switch(mode) { + case PEDESTRIAN: //------------------------------------------ // accelaration - if(!pad->button[ pad->button_map[4] ] ){ - if(pad->axe[ pad->axe_map[1] ]!=0.){ - acc=-pad->axe[ pad->axe_map[1] ] * ctx->camera.Lc / 500. * frequency ; - if (acc>0.){ - speed = reference_speed +acc; + if(!pad->button[pad->button_map[4]]) { + if(pad->axe[pad->axe_map[1]] != 0.) { + acc = -pad->axe[pad->axe_map[1]] * ctx->camera.Lc / 500. * frequency; + if(acc > 0.) { + speed = reference_speed + acc; } - else{ - speed = reference_speed + 2.*acc; + else { + speed = reference_speed + 2. * acc; } - speed = std::max(speed,(frequency * ctx->camera.Lc / 1000.)); - reference_speed = std::min(speed,(frequency*(ctx->camera.Lc))); + speed = std::max(speed, (frequency * ctx->camera.Lc / 1000.)); + reference_speed = std::min(speed, (frequency * (ctx->camera.Lc))); /* std::cout<<"acc: "<< acc << std::endl; std::cout<<"lc: "<< ctx->camera.Lc << std::endl; @@ -678,65 +696,64 @@ void Navigator::move() */ } } - lift = -.25 *pad->axe[ pad->axe_map[5] ] *reference_speed ; - lateral= 0.25* pad->axe[ pad->axe_map[4] ] *reference_speed ; - angular_lat= -1.0 * (pad->axe[ pad->axe_map[2] ]) *reference_angle; + lift = -.25 * pad->axe[pad->axe_map[5]] * reference_speed; + lateral = 0.25 * pad->axe[pad->axe_map[4]] * reference_speed; + angular_lat = -1.0 * (pad->axe[pad->axe_map[2]]) * reference_angle; // walk else run - if(pad->button[ pad->button_map[6]] ){ - speed = -1.0 * pad->axe[ pad->axe_map[3] ] *reference_speed ; + if(pad->button[pad->button_map[6]]) { + speed = -1.0 * pad->axe[pad->axe_map[3]] * reference_speed; } - else{ - speed= -4.0 * (pad->axe[ pad->axe_map[3] ]) *reference_speed ; + else { + speed = -4.0 * (pad->axe[pad->axe_map[3]]) * reference_speed; } - ctx->camera.move_and_look(speed, lateral, lift, 0., 0., - angular_lat, azimut, elevation); + ctx->camera.move_and_look(speed, lateral, lift, 0., 0., angular_lat, azimut, + elevation); //------------------------------------- break; // end of mode PESDESTRIAN - case DIVER : + case DIVER: //------------------------------------- // accelaration // pad->affiche(); - if(!pad->button[ pad->button_map[4] ]) { - angular_fr = 1.0 * (pad->axe[ pad->axe_map[0] ]) *reference_angle; - if(pad->axe[ pad->axe_map[1] ]!=0.){ - acc=-pad->axe[ pad->axe_map[1] ] * ctx->camera.Lc / 1000. * frequency ; - if (acc>0.) { - speed = reference_speed +acc; + if(!pad->button[pad->button_map[4]]) { + angular_fr = 1.0 * (pad->axe[pad->axe_map[0]]) * reference_angle; + if(pad->axe[pad->axe_map[1]] != 0.) { + acc = -pad->axe[pad->axe_map[1]] * ctx->camera.Lc / 1000. * frequency; + if(acc > 0.) { + speed = reference_speed + acc; } - else { - speed = reference_speed + 2.*acc; + else { + speed = reference_speed + 2. * acc; } - speed = std::max(speed,(frequency * ctx->camera.Lc / 1000.)); - reference_speed = std::min(speed,(frequency*(ctx->camera.Lc))); + speed = std::max(speed, (frequency * ctx->camera.Lc / 1000.)); + reference_speed = std::min(speed, (frequency * (ctx->camera.Lc))); } - if(pad->button[ pad->button_map[6] ] ) { - speed = reference_speed ; + if(pad->button[pad->button_map[6]]) { + speed = reference_speed; } - else { - speed = 0.; + else { + speed = 0.; } } - lift = -.25 *pad->axe[ pad->axe_map[5] ] *reference_speed ; - lateral= 0.25* pad->axe[ pad->axe_map[4] ] *reference_speed ; - angular_lat= -1.0 * (pad->axe[ pad->axe_map[2] ]) *reference_angle; - angular_up = 1.0 * (pad->axe[ pad->axe_map[3] ]) *reference_angle; + lift = -.25 * pad->axe[pad->axe_map[5]] * reference_speed; + lateral = 0.25 * pad->axe[pad->axe_map[4]] * reference_speed; + angular_lat = -1.0 * (pad->axe[pad->axe_map[2]]) * reference_angle; + angular_up = 1.0 * (pad->axe[pad->axe_map[3]]) * reference_angle; ctx->camera.move_and_look(speed, lateral, lift, angular_fr, angular_up, angular_lat, azimut, elevation); //------------------------------------- break; // end of mode DIVER - case PLANE : + case PLANE: break; // end of mode PLANE - case CAR : + case CAR: break; // end of mode CAR - default: break; + default: break; } // end of switch(mode) - } diff --git a/Fltk/Navigator.h b/Fltk/Navigator.h index f655c00f8e0a5f9af710c771def741512ec4a06b..4bdeac3ab0b0d41aa259c90704e674fe508f5bb4 100644 --- a/Fltk/Navigator.h +++ b/Fltk/Navigator.h @@ -13,13 +13,13 @@ #include "Camera.h" #include "GamePad.h" -typedef enum { AXE_X, AXE_Y, AXE_Z } AXE ; -typedef enum { PLANE, PEDESTRIAN, DIVER, CAR } NAV_MODE ; +typedef enum { AXE_X, AXE_Y, AXE_Z } AXE; +typedef enum { PLANE, PEDESTRIAN, DIVER, CAR } NAV_MODE; class Navigator { - public: - double ax0 ,ax1,ax0_cur,ax1_cur; - double speed,acc; +public: + double ax0, ax1, ax0_cur, ax1_cur; + double speed, acc; double lateral; double angular_lat; double angular_up; @@ -34,20 +34,21 @@ class Navigator { double angle_up; double angle_rl; double angle_fr; - drawContext* ctx; + drawContext *ctx; double frequency; - GamePad* pad; + GamePad *pad; double azimut; double elevation; double lift; int ncount; - public: - Navigator(double _freq, drawContext* _ctx); + +public: + Navigator(double _freq, drawContext *_ctx); Navigator(); ~Navigator(); void setFrequency(double _freq); void setResponseFrequency(double _freq); - void setDrawContext( drawContext* _ctx); + void setDrawContext(drawContext *_ctx); void move(); void drawIcons(); }; diff --git a/Fltk/WinIcon.h b/Fltk/WinIcon.h index 976f790774eeb7254b9a57659a9da9a6cf69da42..3192ab966b9fca4b5e435aca118c382ba894d3da 100644 --- a/Fltk/WinIcon.h +++ b/Fltk/WinIcon.h @@ -1 +1 @@ -#define IDI_ICON 101 +#define IDI_ICON 101 diff --git a/Fltk/classificationEditor.cpp b/Fltk/classificationEditor.cpp index aa7a70896903cd2d9ceb98b521b19a5d6ddd0721..0c05a060ab3061fd22b04aa57bcab3db3eb0f773 100644 --- a/Fltk/classificationEditor.cpp +++ b/Fltk/classificationEditor.cpp @@ -50,7 +50,7 @@ static void ElementsSelectedMode(classificationEditor *e) static void update_edges_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; if(!e->selected) return; @@ -59,21 +59,22 @@ static void update_edges_cb(Fl_Widget *w, void *data) e->selected->lines.clear(); double threshold = e->inputs[CLASS_VALUE_ANGLE]->value() / 180. * M_PI; - for(unsigned int i = 0; i < e->edges_detected.size(); i++){ + for(unsigned int i = 0; i < e->edges_detected.size(); i++) { edge_angle ea = e->edges_detected[i]; if(ea.angle <= threshold) break; e->selected->lines.push_back(new MLine(ea.v1, ea.v2)); } - if(e->toggles[CLASS_TOGGLE_BOUNDARY]->value()){ - for(unsigned int i = 0 ; i < e->edges_lonly.size(); i++){ + if(e->toggles[CLASS_TOGGLE_BOUNDARY]->value()) { + for(unsigned int i = 0; i < e->edges_lonly.size(); i++) { edge_angle ea = e->edges_lonly[i]; e->selected->lines.push_back(new MLine(ea.v1, ea.v2)); } } - Msg::Info("Edges: %d inside, %d boundary, %d selected", (int)e->edges_detected.size(), - (int)e->edges_lonly.size(), (int)e->selected->lines.size()); + Msg::Info("Edges: %d inside, %d boundary, %d selected", + (int)e->edges_detected.size(), (int)e->edges_lonly.size(), + (int)e->selected->lines.size()); CTX::instance()->mesh.changed = ENT_ALL; drawContext::global()->draw(); @@ -81,26 +82,27 @@ static void update_edges_cb(Fl_Widget *w, void *data) static void select_elements_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; bool all = (w == e->buttons[CLASS_BUTTON_SELECT_ALL_ELEMENTS]); // allocate discrete edge to hold the selected mesh segments - if(!e->selected){ - e->selected = new discreteEdge - (GModel::current(), GModel::current()->getMaxElementaryNumber(1) + 1, 0, 0); + if(!e->selected) { + e->selected = + new discreteEdge(GModel::current(), + GModel::current()->getMaxElementaryNumber(1) + 1, 0, 0); GModel::current()->add(e->selected); } - if(all){ + if(all) { for(GModel::fiter it = GModel::current()->firstFace(); - it != GModel::current()->lastFace(); ++it){ + it != GModel::current()->lastFace(); ++it) { e->elements.insert(e->elements.end(), (*it)->triangles.begin(), (*it)->triangles.end()); e->elements.insert(e->elements.end(), (*it)->quadrangles.begin(), (*it)->quadrangles.end()); } } - else{ + else { CTX::instance()->pickElements = 1; while(1) { CTX::instance()->mesh.changed = ENT_ALL; @@ -110,19 +112,22 @@ static void select_elements_cb(Fl_Widget *w, void *data) char ib = FlGui::instance()->selectEntity(ENT_ALL); if(ib == 'l') { - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) { MElement *me = FlGui::instance()->selectedElements[i]; - if(me->getDim() == 2 && me->getVisibility() != 2){ + if(me->getDim() == 2 && me->getVisibility() != 2) { me->setVisibility(2); e->elements.push_back(me); } } } if(ib == 'r') { - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) { MElement *me = FlGui::instance()->selectedElements[i]; if(me->getVisibility() == 2) - e->elements.erase(std::find(e->elements.begin(), e->elements.end(), me)); + e->elements.erase( + std::find(e->elements.begin(), e->elements.end(), me)); me->setVisibility(1); } } @@ -156,17 +161,17 @@ static void hide_cb(Fl_Widget *w, void *data) static void show_only_edges_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; static int old_sf = (int)opt_mesh_surfaces_faces(0, GMSH_GET, 0.); static int old_se = (int)opt_mesh_surfaces_edges(0, GMSH_GET, 0.); - if(e->toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES]->value()){ + if(e->toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES]->value()) { opt_mesh_lines(0, GMSH_SET | GMSH_GUI, 1.); old_sf = (int)opt_mesh_surfaces_faces(0, GMSH_GET, 0.); old_se = (int)opt_mesh_surfaces_edges(0, GMSH_GET, 0.); opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI, 0.); opt_mesh_surfaces_edges(0, GMSH_SET | GMSH_GUI, 0.); } - else{ + else { opt_mesh_surfaces_faces(0, GMSH_SET | GMSH_GUI, old_sf); opt_mesh_surfaces_edges(0, GMSH_SET | GMSH_GUI, old_se); } @@ -175,12 +180,12 @@ static void show_only_edges_cb(Fl_Widget *w, void *data) static void delete_edge_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; if(!e->selected) return; CTX::instance()->pickElements = 1; - std::vector<MLine*> ele; + std::vector<MLine *> ele; while(1) { CTX::instance()->mesh.changed = ENT_ALL; @@ -191,16 +196,18 @@ static void delete_edge_cb(Fl_Widget *w, void *data) char ib = FlGui::instance()->selectEntity(ENT_ALL); if(ib == 'l') { - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) { MElement *me = FlGui::instance()->selectedElements[i]; - if(me->getType() == TYPE_LIN && me->getVisibility() != 2){ + if(me->getType() == TYPE_LIN && me->getVisibility() != 2) { me->setVisibility(2); - ele.push_back((MLine*)me); + ele.push_back((MLine *)me); } } } if(ib == 'r') { - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) { MElement *me = FlGui::instance()->selectedElements[i]; if(me->getVisibility() == 2) ele.erase(std::find(ele.begin(), ele.end(), me)); @@ -221,10 +228,11 @@ static void delete_edge_cb(Fl_Widget *w, void *data) std::sort(ele.begin(), ele.end()); // look in all selected edges if a deleted one is present and delete it - std::vector<MLine*> temp = e->selected->lines; + std::vector<MLine *> temp = e->selected->lines; e->selected->lines.clear(); - for(unsigned int i = 0; i < temp.size(); i++){ - std::vector<MLine*>::iterator it = std::find(ele.begin(), ele.end(), temp[i]); + for(unsigned int i = 0; i < temp.size(); i++) { + std::vector<MLine *>::iterator it = + std::find(ele.begin(), ele.end(), temp[i]); if(it != ele.end()) delete temp[i]; else @@ -242,7 +250,7 @@ static void delete_edge_cb(Fl_Widget *w, void *data) static void reset_selection_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; if(!e->selected) return; for(unsigned int i = 0; i < e->selected->lines.size(); i++) delete e->selected->lines[i]; @@ -255,17 +263,17 @@ static void reset_selection_cb(Fl_Widget *w, void *data) static void select_surfaces_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; bool all = (w == e->buttons[CLASS_BUTTON_SELECT_ALL_SURFACES]); - if(all){ + if(all) { for(GModel::fiter it = GModel::current()->firstFace(); it != GModel::current()->lastFace(); ++it) e->faces.insert(*it); } - else{ - std::vector<GFace*> temp; + else { + std::vector<GFace *> temp; opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); while(1) { CTX::instance()->mesh.changed = ENT_ALL; @@ -274,15 +282,15 @@ static void select_surfaces_cb(Fl_Widget *w, void *data) "[Press 'e' to end selection or 'q' to abort]"); char ib = FlGui::instance()->selectEntity(ENT_SURFACE); if(ib == 'l') { - for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); i++){ + for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); + i++) { FlGui::instance()->selectedFaces[i]->setSelection(1); temp.push_back(FlGui::instance()->selectedFaces[i]); } } if(ib == 'e') { // store the list of gfaces GModel::current()->setSelection(0); - for(unsigned int i = 0; i < temp.size(); i++) - e->faces.insert(temp[i]); + for(unsigned int i = 0; i < temp.size(); i++) e->faces.insert(temp[i]); break; } if(ib == 'q') { // do nothing @@ -292,8 +300,7 @@ static void select_surfaces_cb(Fl_Widget *w, void *data) } } - if(e->faces.size()) - e->buttons[CLASS_BUTTON_CLASSIFY]->activate(); + if(e->faces.size()) e->buttons[CLASS_BUTTON_CLASSIFY]->activate(); CTX::instance()->mesh.changed = ENT_ALL; drawContext::global()->draw(); @@ -302,12 +309,12 @@ static void select_surfaces_cb(Fl_Widget *w, void *data) static void classify_cb(Fl_Widget *w, void *data) { - classificationEditor *e = (classificationEditor*)data; + classificationEditor *e = (classificationEditor *)data; GModel::current()->classifyFaces(e->faces); // remove selected, but do not delete its elements - if(e->selected){ + if(e->selected) { GModel::current()->remove(e->selected); e->selected->lines.clear(); delete e->selected; @@ -327,29 +334,32 @@ classificationEditor::classificationEditor() : selected(0) int BBB = (int)(1.4 * BB); const int width = (int)(3.15 * BBB), height = (int)(9.5 * BH); - window = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Reclassify 2D"); + window = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Reclassify 2D"); window->box(GMSH_WINDOW_BOX); int x = WB, y = WB; { - Fl_Box *b = new Fl_Box - (x, y, width, BH, "1. Select mesh elements on which to perform edge detection"); + Fl_Box *b = + new Fl_Box(x, y, width, BH, + "1. Select mesh elements on which to perform edge detection"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); x += WB; y += BH; - buttons[CLASS_BUTTON_SELECT_ELEMENTS] = new Fl_Button - (x, y, BBB, BH, "Select elements"); + buttons[CLASS_BUTTON_SELECT_ELEMENTS] = + new Fl_Button(x, y, BBB, BH, "Select elements"); buttons[CLASS_BUTTON_SELECT_ELEMENTS]->callback(select_elements_cb, this); - buttons[CLASS_BUTTON_SELECT_ALL_ELEMENTS] = new Fl_Button - (x + BBB + WB, y, (int)(0.5 * BBB) - WB, BH, "All"); - buttons[CLASS_BUTTON_SELECT_ALL_ELEMENTS]->callback(select_elements_cb, this); + buttons[CLASS_BUTTON_SELECT_ALL_ELEMENTS] = + new Fl_Button(x + BBB + WB, y, (int)(0.5 * BBB) - WB, BH, "All"); + buttons[CLASS_BUTTON_SELECT_ALL_ELEMENTS]->callback(select_elements_cb, + this); - toggles[CLASS_TOGGLE_HIDE] = new Fl_Check_Button - ((int)(x + 1.5 * BBB + WB), y, (int)(width - 1.5 * BBB - x - 2 * WB), BH, - "Hide unselected elements"); + toggles[CLASS_TOGGLE_HIDE] = new Fl_Check_Button( + (int)(x + 1.5 * BBB + WB), y, (int)(width - 1.5 * BBB - x - 2 * WB), BH, + "Hide unselected elements"); toggles[CLASS_TOGGLE_HIDE]->type(FL_TOGGLE_BUTTON); toggles[CLASS_TOGGLE_HIDE]->callback(hide_cb, this); @@ -357,20 +367,19 @@ classificationEditor::classificationEditor() : selected(0) } { y += BH / 2; - Fl_Box* b = new Fl_Box(x, y + BH - WB, width - 2 * WB, 2); + Fl_Box *b = new Fl_Box(x, y + BH - WB, width - 2 * WB, 2); b->box(FL_ENGRAVED_FRAME); b->labeltype(FL_NO_LABEL); } { y += BH; - Fl_Box *b = new Fl_Box - (x, y, width, BH, "2. Fine-tune edge selection"); + Fl_Box *b = new Fl_Box(x, y, width, BH, "2. Fine-tune edge selection"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); x += WB; y += BH; - inputs[CLASS_VALUE_ANGLE] = new Fl_Value_Input - (x, y, 2 * BBB / 3, BH, "Threshold angle"); + inputs[CLASS_VALUE_ANGLE] = + new Fl_Value_Input(x, y, 2 * BBB / 3, BH, "Threshold angle"); inputs[CLASS_VALUE_ANGLE]->value(40); inputs[CLASS_VALUE_ANGLE]->maximum(180); inputs[CLASS_VALUE_ANGLE]->minimum(0); @@ -379,26 +388,26 @@ classificationEditor::classificationEditor() : selected(0) inputs[CLASS_VALUE_ANGLE]->when(FL_WHEN_RELEASE); inputs[CLASS_VALUE_ANGLE]->callback(update_edges_cb, this); - toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES] = new Fl_Check_Button - ((int)(x + 1.5 * BBB + WB), y, (int)(width - x - 1.5 * BBB - 2 * WB), BH, - "Show only edges"); + toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES] = new Fl_Check_Button( + (int)(x + 1.5 * BBB + WB), y, (int)(width - x - 1.5 * BBB - 2 * WB), BH, + "Show only edges"); toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES]->type(FL_TOGGLE_BUTTON); toggles[CLASS_TOGGLE_SHOW_ONLY_EDGES]->callback(show_only_edges_cb, this); y += BH; - toggles[CLASS_TOGGLE_BOUNDARY] = new Fl_Check_Button - (x, y, width - x - 2 * WB, BH, "Include edges on boundary (closure)"); + toggles[CLASS_TOGGLE_BOUNDARY] = new Fl_Check_Button( + x, y, width - x - 2 * WB, BH, "Include edges on boundary (closure)"); toggles[CLASS_TOGGLE_BOUNDARY]->type(FL_TOGGLE_BUTTON); toggles[CLASS_TOGGLE_BOUNDARY]->callback(update_edges_cb, this); y += BH; - buttons[CLASS_BUTTON_DELETE_FROM_SELECTION] = new Fl_Button - (x, y, (int)(1.5 * BBB), BH, "Delete edges from selection"); + buttons[CLASS_BUTTON_DELETE_FROM_SELECTION] = + new Fl_Button(x, y, (int)(1.5 * BBB), BH, "Delete edges from selection"); buttons[CLASS_BUTTON_DELETE_FROM_SELECTION]->callback(delete_edge_cb, this); buttons[CLASS_BUTTON_DELETE_FROM_SELECTION]->deactivate(); - buttons[CLASS_BUTTON_RESET_SELECTION] = new Fl_Button - (x + (int)(1.5 * BBB + WB), y, BBB, BH, "Reset selection"); + buttons[CLASS_BUTTON_RESET_SELECTION] = + new Fl_Button(x + (int)(1.5 * BBB + WB), y, BBB, BH, "Reset selection"); buttons[CLASS_BUTTON_RESET_SELECTION]->callback(reset_selection_cb, this); buttons[CLASS_BUTTON_RESET_SELECTION]->deactivate(); @@ -406,29 +415,30 @@ classificationEditor::classificationEditor() : selected(0) } { y += BH / 2; - Fl_Box* b = new Fl_Box(x, y + BH - WB, width - 2 * WB, 2); + Fl_Box *b = new Fl_Box(x, y + BH - WB, width - 2 * WB, 2); b->box(FL_ENGRAVED_FRAME); b->labeltype(FL_NO_LABEL); } { y += BH; - Fl_Box *b = new Fl_Box - (x, y, width, BH, "3. Reclassify surfaces using selected edges"); + Fl_Box *b = new Fl_Box(x, y, width, BH, + "3. Reclassify surfaces using selected edges"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); x += WB; y += BH; - buttons[CLASS_BUTTON_SELECT_SURFACES] = new Fl_Button - (x, y, BBB, BH, "Select surfaces"); + buttons[CLASS_BUTTON_SELECT_SURFACES] = + new Fl_Button(x, y, BBB, BH, "Select surfaces"); buttons[CLASS_BUTTON_SELECT_SURFACES]->callback(select_surfaces_cb, this); - buttons[CLASS_BUTTON_SELECT_ALL_SURFACES] = new Fl_Button - (x + BBB + WB, y, (int)(0.5 * BBB) - WB, BH, "All"); - buttons[CLASS_BUTTON_SELECT_ALL_SURFACES]->callback(select_surfaces_cb, this); + buttons[CLASS_BUTTON_SELECT_ALL_SURFACES] = + new Fl_Button(x + BBB + WB, y, (int)(0.5 * BBB) - WB, BH, "All"); + buttons[CLASS_BUTTON_SELECT_ALL_SURFACES]->callback(select_surfaces_cb, + this); - buttons[CLASS_BUTTON_CLASSIFY] = new Fl_Return_Button - ((int)(x + 1.5 * BBB + WB), y, BBB, BH, "Reclassify"); + buttons[CLASS_BUTTON_CLASSIFY] = + new Fl_Return_Button((int)(x + 1.5 * BBB + WB), y, BBB, BH, "Reclassify"); buttons[CLASS_BUTTON_CLASSIFY]->callback(classify_cb, this); buttons[CLASS_BUTTON_CLASSIFY]->deactivate(); @@ -441,7 +451,7 @@ classificationEditor::classificationEditor() : selected(0) NoElementsSelectedMode(this); } -void mesh_classify_cb(Fl_Widget* w, void* data) +void mesh_classify_cb(Fl_Widget *w, void *data) { // create the (static) editor static classificationEditor *editor = 0; diff --git a/Fltk/classificationEditor.h b/Fltk/classificationEditor.h index d684c545124401d90746870ac8063aef3ee20d7f..d430c47607a9e26713ad1ef57c8b46e4a5986ef2 100644 --- a/Fltk/classificationEditor.h +++ b/Fltk/classificationEditor.h @@ -15,24 +15,24 @@ #include "MElement.h" #include "meshGFaceOptimize.h" -#define CLASS_BUTTON_SELECT_ELEMENTS 0 -#define CLASS_BUTTON_SELECT_ALL_ELEMENTS 1 +#define CLASS_BUTTON_SELECT_ELEMENTS 0 +#define CLASS_BUTTON_SELECT_ALL_ELEMENTS 1 #define CLASS_BUTTON_DELETE_FROM_SELECTION 2 -#define CLASS_BUTTON_RESET_SELECTION 3 -#define CLASS_BUTTON_SELECT_SURFACES 4 -#define CLASS_BUTTON_SELECT_ALL_SURFACES 5 -#define CLASS_BUTTON_CLASSIFY 6 +#define CLASS_BUTTON_RESET_SELECTION 3 +#define CLASS_BUTTON_SELECT_SURFACES 4 +#define CLASS_BUTTON_SELECT_ALL_SURFACES 5 +#define CLASS_BUTTON_CLASSIFY 6 -#define CLASS_TOGGLE_HIDE 0 -#define CLASS_TOGGLE_BOUNDARY 1 -#define CLASS_TOGGLE_SHOW_ONLY_EDGES 2 +#define CLASS_TOGGLE_HIDE 0 +#define CLASS_TOGGLE_BOUNDARY 1 +#define CLASS_TOGGLE_SHOW_ONLY_EDGES 2 -#define CLASS_VALUE_ANGLE 0 +#define CLASS_VALUE_ANGLE 0 class classificationEditor { - public: - std::vector<MElement*> elements; - std::set<GFace*> faces; +public: + std::vector<MElement *> elements; + std::set<GFace *> faces; Fl_Window *window; Fl_Button *buttons[10]; Fl_Check_Button *toggles[10]; @@ -40,9 +40,9 @@ class classificationEditor { GEdge *selected; std::vector<edge_angle> edges_detected, edges_lonly; classificationEditor(); - void show(){ window->show(); } + void show() { window->show(); } }; -void mesh_classify_cb(Fl_Widget* w, void* data); +void mesh_classify_cb(Fl_Widget *w, void *data); #endif diff --git a/Fltk/clippingWindow.cpp b/Fltk/clippingWindow.cpp index 2f58bd9456a0b5a1ad08def99316e0e08e3f688d..244b5ec9bb8948a790e3a1a78b3b6bac21c577b8 100644 --- a/Fltk/clippingWindow.cpp +++ b/Fltk/clippingWindow.cpp @@ -15,10 +15,7 @@ #include "PViewOptions.h" #include "Context.h" -void clip_cb(Fl_Widget *w, void *data) -{ - FlGui::instance()->clipping->show(); -} +void clip_cb(Fl_Widget *w, void *data) { FlGui::instance()->clipping->show(); } static void clip_num_cb(Fl_Widget *w, void *data) { @@ -27,14 +24,14 @@ static void clip_num_cb(Fl_Widget *w, void *data) static void clip_update_cb(Fl_Widget *w, void *data) { - if(FlGui::instance()->clipping->group[0]->visible()){ // plane tab + if(FlGui::instance()->clipping->group[0]->visible()) { // plane tab int idx = FlGui::instance()->clipping->choice->value(); CTX::instance()->geom.clip &= ~(1 << idx); CTX::instance()->mesh.clip &= ~(1 << idx); for(unsigned int i = 0; i < PView::list.size(); i++) PView::list[i]->getOptions()->clip &= ~(1 << idx); - for(int i = 0; i < FlGui::instance()->clipping->browser->size(); i++){ - if(FlGui::instance()->clipping->browser->selected(i + 1)){ + for(int i = 0; i < FlGui::instance()->clipping->browser->size(); i++) { + if(FlGui::instance()->clipping->browser->selected(i + 1)) { if(i == 0) CTX::instance()->geom.clip |= (1 << idx); else if(i == 1) @@ -44,17 +41,18 @@ static void clip_update_cb(Fl_Widget *w, void *data) } } for(int j = 0; j < 4; j++) - CTX::instance()->clipPlane[idx][j] = FlGui::instance()->clipping->plane[j]->value(); + CTX::instance()->clipPlane[idx][j] = + FlGui::instance()->clipping->plane[j]->value(); FlGui::instance()->clipping->fillBoxValuesFromPlaneValues(); } - else{ // box tab + else { // box tab CTX::instance()->geom.clip = 0; CTX::instance()->mesh.clip = 0; for(unsigned int i = 0; i < PView::list.size(); i++) PView::list[i]->getOptions()->clip = 0; - for(int i = 0; i < FlGui::instance()->clipping->browser->size(); i++){ - if(FlGui::instance()->clipping->browser->selected(i + 1)){ - for(int idx = 0; idx < 6; idx++){ + for(int i = 0; i < FlGui::instance()->clipping->browser->size(); i++) { + if(FlGui::instance()->clipping->browser->selected(i + 1)) { + for(int idx = 0; idx < 6; idx++) { if(i == 0) CTX::instance()->geom.clip |= (1 << idx); else if(i == 1) @@ -103,13 +101,14 @@ static void clip_update_cb(Fl_Widget *w, void *data) int idx = FlGui::instance()->clipping->choice->value(); for(int j = 0; j < 4; j++) - FlGui::instance()->clipping->plane[j]->value(CTX::instance()->clipPlane[idx][j]); + FlGui::instance()->clipping->plane[j]->value( + CTX::instance()->clipPlane[idx][j]); } if(CTX::instance()->clipWholeElements || CTX::instance()->clipWholeElements != - FlGui::instance()->clipping->butt[0]->value()){ - for(int clip = 0; clip < 6; clip++){ + FlGui::instance()->clipping->butt[0]->value()) { + for(int clip = 0; clip < 6; clip++) { if(CTX::instance()->mesh.clip) CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME); for(unsigned int index = 0; index < PView::list.size(); index++) @@ -137,8 +136,8 @@ static void clip_update_cb(Fl_Widget *w, void *data) static void clip_invert_cb(Fl_Widget *w, void *data) { for(int i = 0; i < 4; i++) - FlGui::instance()->clipping->plane[i]->value - (-FlGui::instance()->clipping->plane[i]->value()); + FlGui::instance()->clipping->plane[i]->value( + -FlGui::instance()->clipping->plane[i]->value()); clip_update_cb(NULL, NULL); } @@ -152,8 +151,7 @@ static void clip_reset_cb(Fl_Widget *w, void *data) // Warning: for consistency these reset values should match the // default values for the associated options for(int i = 0; i < 6; i++) - for(int j = 0; j < 4; j++) - CTX::instance()->clipPlane[0][0] = 0.; + for(int j = 0; j < 4; j++) CTX::instance()->clipPlane[0][0] = 0.; CTX::instance()->clipPlane[0][0] = 1.; CTX::instance()->clipPlane[1][1] = 1.; CTX::instance()->clipPlane[2][2] = 1.; @@ -164,7 +162,7 @@ static void clip_reset_cb(Fl_Widget *w, void *data) CTX::instance()->clipPlane[4][3] = 1.; CTX::instance()->clipPlane[5][3] = 1.; - if(CTX::instance()->clipWholeElements){ + if(CTX::instance()->clipWholeElements) { CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME); for(unsigned int index = 0; index < PView::list.size(); index++) PView::list[index]->setChanged(true); @@ -178,34 +176,33 @@ clippingWindow::clippingWindow(int deltaFontSize) { FL_NORMAL_SIZE -= deltaFontSize; - static Fl_Menu_Item plane_number[] = { - {"Plane 0", 0, 0}, - {"Plane 1", 0, 0}, - {"Plane 2", 0, 0}, - {"Plane 3", 0, 0}, - {"Plane 4", 0, 0}, - {"Plane 5", 0, 0}, - {0} - }; + static Fl_Menu_Item plane_number[] = {{"Plane 0", 0, 0}, + {"Plane 1", 0, 0}, + {"Plane 2", 0, 0}, + {"Plane 3", 0, 0}, + {"Plane 4", 0, 0}, + {"Plane 5", 0, 0}, + {0}}; int width = 26 * FL_NORMAL_SIZE; int height = 10 * BH + 5 * WB; int L = 7 * FL_NORMAL_SIZE; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Clipping"); + win = new paletteWindow( + width, height, CTX::instance()->nonModalWindows ? true : false, "Clipping"); win->box(GMSH_WINDOW_BOX); browser = new Fl_Multi_Browser(0, 0, L, height); browser->callback(clip_update_cb); browser->box(GMSH_SIMPLE_RIGHT_BOX); - browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars - Fl_Tabs *o = new Fl_Tabs - (L + WB, WB, width - L - 2 * WB, height - 3 * WB - 4 * BH); + Fl_Tabs *o = + new Fl_Tabs(L + WB, WB, width - L - 2 * WB, height - 3 * WB - 4 * BH); { - group[0] = new Fl_Group - (L + WB, WB + BH, width - L - 2 * WB, height - 3 * WB - 5 * BH, "Planes"); + group[0] = new Fl_Group(L + WB, WB + BH, width - L - 2 * WB, + height - 3 * WB - 5 * BH, "Planes"); int BW = width - L - 4 * WB - 4 * FL_NORMAL_SIZE; @@ -213,21 +210,21 @@ clippingWindow::clippingWindow(int deltaFontSize) choice->menu(plane_number); choice->callback(clip_num_cb); - Fl_Button *invert = new Fl_Button - (L + 2 * WB, 2 * WB + 2 * BH, FL_NORMAL_SIZE, 4 * BH, "-"); + Fl_Button *invert = + new Fl_Button(L + 2 * WB, 2 * WB + 2 * BH, FL_NORMAL_SIZE, 4 * BH, "-"); invert->box(FL_THIN_UP_BOX); invert->callback(clip_invert_cb); invert->tooltip("Invert orientation"); - plane[0] = new Fl_Value_Input - (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 2 * BH, BW - FL_NORMAL_SIZE, BH, "A"); - plane[1] = new Fl_Value_Input - (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 3 * BH, BW - FL_NORMAL_SIZE, BH, "B"); - plane[2] = new Fl_Value_Input - (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 4 * BH, BW - FL_NORMAL_SIZE, BH, "C"); - plane[3] = new Fl_Value_Input - (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 5 * BH, BW - FL_NORMAL_SIZE, BH, "D"); - for(int j = 0; j < 4; j++){ + plane[0] = new Fl_Value_Input(L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 2 * BH, + BW - FL_NORMAL_SIZE, BH, "A"); + plane[1] = new Fl_Value_Input(L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 3 * BH, + BW - FL_NORMAL_SIZE, BH, "B"); + plane[2] = new Fl_Value_Input(L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 4 * BH, + BW - FL_NORMAL_SIZE, BH, "C"); + plane[3] = new Fl_Value_Input(L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 5 * BH, + BW - FL_NORMAL_SIZE, BH, "D"); + for(int j = 0; j < 4; j++) { plane[j]->align(FL_ALIGN_RIGHT); plane[j]->callback(clip_update_cb); } @@ -235,8 +232,8 @@ clippingWindow::clippingWindow(int deltaFontSize) group[0]->end(); } { - group[1] = new Fl_Group - (L + WB, WB + BH, width - L - 2 * WB, height - 3 * WB - 5 * BH, "Box"); + group[1] = new Fl_Group(L + WB, WB + BH, width - L - 2 * WB, + height - 3 * WB - 5 * BH, "Box"); group[1]->hide(); int w2 = (width - L - 4 * WB) / 2; @@ -247,7 +244,7 @@ clippingWindow::clippingWindow(int deltaFontSize) box[3] = new Fl_Value_Input(L + 2 * WB + w2, 2 * WB + 1 * BH, BW, BH, "Wx"); box[4] = new Fl_Value_Input(L + 2 * WB + w2, 2 * WB + 2 * BH, BW, BH, "Wy"); box[5] = new Fl_Value_Input(L + 2 * WB + w2, 2 * WB + 3 * BH, BW, BH, "Wz"); - for(int i = 0; i < 6; i++){ + for(int i = 0; i < 6; i++) { box[i]->align(FL_ALIGN_RIGHT); box[i]->callback(clip_update_cb); } @@ -257,13 +254,13 @@ clippingWindow::clippingWindow(int deltaFontSize) o->callback(clip_update_cb); // force update when we switch tabs o->end(); - butt[0] = new Fl_Check_Button - (L + WB, 3 * WB + 6 * BH, width - L - 2 * WB, BH, "Keep whole elements"); - butt[1] = new Fl_Check_Button - (L + WB, 3 * WB + 7 * BH, width - L - 2 * WB, BH, "Only draw volume layer"); - butt[2] = new Fl_Check_Button - (L + WB, 3 * WB + 8 * BH, width - L - 2 * WB, BH, "Cut only volume elements"); - for(int i = 0; i < 3; i++){ + butt[0] = new Fl_Check_Button(L + WB, 3 * WB + 6 * BH, width - L - 2 * WB, BH, + "Keep whole elements"); + butt[1] = new Fl_Check_Button(L + WB, 3 * WB + 7 * BH, width - L - 2 * WB, BH, + "Only draw volume layer"); + butt[2] = new Fl_Check_Button(L + WB, 3 * WB + 8 * BH, width - L - 2 * WB, BH, + "Cut only volume elements"); + for(int i = 0; i < 3; i++) { butt[i]->type(FL_TOGGLE_BUTTON); butt[i]->callback(clip_update_cb); } @@ -271,17 +268,18 @@ clippingWindow::clippingWindow(int deltaFontSize) resetBrowser(); { - Fl_Return_Button *o = new Fl_Return_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Redraw"); + Fl_Return_Button *o = new Fl_Return_Button( + width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Redraw"); o->callback(redraw_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Reset"); + Fl_Button *o = + new Fl_Button(width - BB - WB, height - BH - WB, BB, BH, "Reset"); o->callback(clip_reset_cb); } - win->position(CTX::instance()->clipPosition[0], CTX::instance()->clipPosition[1]); + win->position(CTX::instance()->clipPosition[0], + CTX::instance()->clipPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -301,7 +299,7 @@ void clippingWindow::resetBrowser() int idx = choice->value(); browser->deselect(); - for(int i = 0; i < browser->size(); i++){ + for(int i = 0; i < browser->size(); i++) { if((i == 0 && CTX::instance()->geom.clip & (1 << idx)) || (i == 1 && CTX::instance()->mesh.clip & (1 << idx)) || (i > 1 && i - 2 < (int)PView::list.size() && @@ -329,7 +327,7 @@ void clippingWindow::resetBrowser() fillBoxValuesFromPlaneValues(); - for(int i = 0; i < 6; i++){ + for(int i = 0; i < 6; i++) { box[i]->step(val1 / 200., 1); box[i]->minimum(-val1); box[i]->maximum(val1); @@ -338,12 +336,15 @@ void clippingWindow::resetBrowser() void clippingWindow::fillBoxValuesFromPlaneValues() { - double c[3] = {(-CTX::instance()->clipPlane[0][3] + CTX::instance()->clipPlane[3][3]) / 2., - (-CTX::instance()->clipPlane[1][3] + CTX::instance()->clipPlane[4][3]) / 2., - (-CTX::instance()->clipPlane[2][3] + CTX::instance()->clipPlane[5][3]) / 2.}; - double d[3] = {CTX::instance()->clipPlane[0][3] + CTX::instance()->clipPlane[3][3], - CTX::instance()->clipPlane[1][3] + CTX::instance()->clipPlane[4][3], - CTX::instance()->clipPlane[2][3] + CTX::instance()->clipPlane[5][3]}; + double c[3] = { + (-CTX::instance()->clipPlane[0][3] + CTX::instance()->clipPlane[3][3]) / 2., + (-CTX::instance()->clipPlane[1][3] + CTX::instance()->clipPlane[4][3]) / 2., + (-CTX::instance()->clipPlane[2][3] + CTX::instance()->clipPlane[5][3]) / + 2.}; + double d[3] = { + CTX::instance()->clipPlane[0][3] + CTX::instance()->clipPlane[3][3], + CTX::instance()->clipPlane[1][3] + CTX::instance()->clipPlane[4][3], + CTX::instance()->clipPlane[2][3] + CTX::instance()->clipPlane[5][3]}; box[0]->value(c[0]); box[1]->value(c[1]); box[2]->value(c[2]); diff --git a/Fltk/clippingWindow.h b/Fltk/clippingWindow.h index cd272a5c74967d713a0c67049e6cf066cd303f12..bc758b6389b5732af5e7f106bc04cd2283a474da 100644 --- a/Fltk/clippingWindow.h +++ b/Fltk/clippingWindow.h @@ -13,8 +13,8 @@ #include <FL/Fl_Check_Button.H> #include <FL/Fl_Group.H> -class clippingWindow{ - public: +class clippingWindow { +public: Fl_Window *win; Fl_Choice *choice; Fl_Multi_Browser *browser; @@ -23,8 +23,9 @@ class clippingWindow{ Fl_Check_Button *butt[3]; Fl_Group *group[2]; void fillBoxValuesFromPlaneValues(); - public: - clippingWindow(int deltaFontSize=0); + +public: + clippingWindow(int deltaFontSize = 0); void resetBrowser(); void show(); }; diff --git a/Fltk/colorbarWindow.cpp b/Fltk/colorbarWindow.cpp index 91c5cc755d160d32cc4efc8d11793060df0c861b..bd1a547bfe3e6930c64cad9433f02ae558d80d0a 100644 --- a/Fltk/colorbarWindow.cpp +++ b/Fltk/colorbarWindow.cpp @@ -43,8 +43,7 @@ int colorbarWindow::index_to_x(int index) { int x; x = (int)(index * (double)w() / (double)(ct->size - 1)); - if(x >= w()) - x = w() - 1; + if(x >= w()) x = w() - 1; return x; } @@ -78,10 +77,8 @@ void colorbarWindow::redraw_range(int a, int b) int intensity = 0; double H, S, V; - if(a < 0) - a = 0; - if(b >= ct->size) - b = ct->size - 1; + if(a < 0) a = 0; + if(b >= ct->size) b = ct->size - 1; // calculate region to update x1 = index_to_x(a); @@ -94,10 +91,8 @@ void colorbarWindow::redraw_range(int a, int b) fl_rectf(x1, y1, x2 - x1 + 1, y2 - y1 + 1); // redraw region of entries in interval [a,b] - if(a > 0) - a--; - if(b < ct->size - 1) - b++; + if(a > 0) a--; + if(b < ct->size - 1) b++; // draw red or hue levels for(i = a; i <= b; i++) { @@ -284,18 +279,17 @@ void colorbarWindow::draw() label_y = h() - 5; marker_y = label_y - marker_height - font_height; wedge_y = marker_y - wedge_height; - color_bg = fl_color_cube(CTX::instance()->unpackRed(CTX::instance()->color.bg) * - FL_NUM_RED / 256, - CTX::instance()->unpackGreen(CTX::instance()->color.bg) * - FL_NUM_GREEN / 256, - CTX::instance()->unpackBlue(CTX::instance()->color.bg) * - FL_NUM_BLUE / 256); + color_bg = fl_color_cube( + CTX::instance()->unpackRed(CTX::instance()->color.bg) * FL_NUM_RED / 256, + CTX::instance()->unpackGreen(CTX::instance()->color.bg) * FL_NUM_GREEN / + 256, + CTX::instance()->unpackBlue(CTX::instance()->color.bg) * FL_NUM_BLUE / 256); redraw_range(0, ct->size - 1); redraw_marker(); } void colorbarWindow::update(const char *name, double min, double max, - GmshColorTable *table, bool *changed) + GmshColorTable *table, bool *changed) { label = name; ct = table; @@ -316,18 +310,15 @@ int colorbarWindow::handle(int event) modify = 0; compute = 0; - switch (event) { - + switch(event) { case FL_FOCUS: // accept focus events when asked - case FL_UNFOCUS: - return 1; + case FL_UNFOCUS: return 1; case FL_ENTER: take_focus(); // force keyboard focus as soon as the mouse enters return 1; - case FL_LEAVE: - return 1; + case FL_LEAVE: return 1; case FL_SHORTCUT: case FL_KEYBOARD: @@ -473,28 +464,24 @@ int colorbarWindow::handle(int event) } else if(Fl::test_shortcut('b')) { ct->dpar[COLORTABLE_BETA] += 0.05; - if(ct->dpar[COLORTABLE_BETA] > 1.0) - ct->dpar[COLORTABLE_BETA] = 1.0; + if(ct->dpar[COLORTABLE_BETA] > 1.0) ct->dpar[COLORTABLE_BETA] = 1.0; compute = 1; } else if(Fl::test_shortcut(FL_CTRL + 'b') || Fl::test_shortcut(FL_META + 'b')) { ct->dpar[COLORTABLE_BETA] -= 0.05; - if(ct->dpar[COLORTABLE_BETA] < -1.0) - ct->dpar[COLORTABLE_BETA] = -1.0; + if(ct->dpar[COLORTABLE_BETA] < -1.0) ct->dpar[COLORTABLE_BETA] = -1.0; compute = 1; } else if(Fl::test_shortcut('a')) { ct->dpar[COLORTABLE_ALPHA] -= 0.05; - if(ct->dpar[COLORTABLE_ALPHA] < 0.0) - ct->dpar[COLORTABLE_ALPHA] = 0.0; + if(ct->dpar[COLORTABLE_ALPHA] < 0.0) ct->dpar[COLORTABLE_ALPHA] = 0.0; compute = 1; } else if(Fl::test_shortcut(FL_CTRL + 'a') || Fl::test_shortcut(FL_META + 'a')) { ct->dpar[COLORTABLE_ALPHA] += 0.05; - if(ct->dpar[COLORTABLE_ALPHA] > 1.0) - ct->dpar[COLORTABLE_ALPHA] = 1.0; + if(ct->dpar[COLORTABLE_ALPHA] > 1.0) ct->dpar[COLORTABLE_ALPHA] = 1.0; compute = 1; } else if(Fl::test_shortcut('p')) { @@ -565,8 +552,7 @@ int colorbarWindow::handle(int event) // determine which curve to modify if(Fl::event_state(FL_CTRL) || Fl::event_state(FL_META)) p4 = 1; - else if(ibut == 1 && !Fl::event_state(FL_SHIFT) - && !Fl::event_state(FL_ALT)) + else if(ibut == 1 && !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)) p1 = 1; else if(ibut == 2 || (ibut == 1 && Fl::event_state(FL_SHIFT))) p2 = 1; @@ -597,7 +583,6 @@ int colorbarWindow::handle(int event) default: // don't know what to do with the event: passing it to parent return Fl_Window::handle(event); - } // Modify one or more of the color curves diff --git a/Fltk/colorbarWindow.h b/Fltk/colorbarWindow.h index f989c333cac07a50e079615c96dae3c4622d32a1..4dcd6a6372f21590af68d6e9a51942b9351bf895 100644 --- a/Fltk/colorbarWindow.h +++ b/Fltk/colorbarWindow.h @@ -11,7 +11,7 @@ #include "ColorTable.h" class colorbarWindow : public Fl_Window { - private: +private: int font_height, marker_height, wedge_height; const char *label; double minval, maxval; // min and max data values @@ -35,8 +35,9 @@ class colorbarWindow : public Fl_Window { void redraw_range(int a, int b); // redraw the marker and the text void redraw_marker(); - public: - colorbarWindow(int x, int y, int w, int h, const char *l=0); + +public: + colorbarWindow(int x, int y, int w, int h, const char *l = 0); void draw(); int handle(int); void update(const char *name, double min, double max, GmshColorTable *ct, diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp index 0f247a2cccf6aab7ae933db56f565513997bcdf0..901a33b7699c7e0e22335a180af9df8fb608ee84 100644 --- a/Fltk/contextWindow.cpp +++ b/Fltk/contextWindow.cpp @@ -33,9 +33,10 @@ static bool getval(const char *str, double &val) std::vector<double> valVar; // we should probably use the actual .geo parser instead... - for(std::map<std::string, gmsh_yysymbol>::iterator it = gmsh_yysymbols.begin(); - it != gmsh_yysymbols.end(); it++){ - if(it->second.value.size() == 1){ + for(std::map<std::string, gmsh_yysymbol>::iterator it = + gmsh_yysymbols.begin(); + it != gmsh_yysymbols.end(); it++) { + if(it->second.value.size() == 1) { var.push_back(it->first); valVar.push_back(it->second.value[0]); } @@ -51,7 +52,8 @@ static bool getval(const char *str, double &val) return true; } -static void draw_stl(std::vector<SPoint3> &vertices, std::vector<SVector3> &normals, +static void draw_stl(std::vector<SPoint3> &vertices, + std::vector<SVector3> &normals, std::vector<int> &triangles) { GLint mode[2]; @@ -62,10 +64,10 @@ static void draw_stl(std::vector<SPoint3> &vertices, std::vector<SVector3> &norm glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_LIGHTING); glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - glColor4ubv((GLubyte *) & CTX::instance()->color.geom.highlight[0]); + glColor4ubv((GLubyte *)&CTX::instance()->color.geom.highlight[0]); VertexArray va(3, triangles.size()); - for(unsigned int i = 0; i < triangles.size(); i+=3){ + for(unsigned int i = 0; i < triangles.size(); i += 3) { SPoint3 p1 = vertices[triangles[i]]; SPoint3 p2 = vertices[triangles[i + 1]]; SPoint3 p3 = vertices[triangles[i + 2]]; @@ -108,9 +110,12 @@ static void elementary_draw_point_cb(Fl_Widget *w, void *data) { if(data) return; // we are here from do_callback() double x, y, z; - if(!getval(FlGui::instance()->elementaryContext->input[4]->value(), x)) return; - if(!getval(FlGui::instance()->elementaryContext->input[5]->value(), y)) return; - if(!getval(FlGui::instance()->elementaryContext->input[6]->value(), z)) return; + if(!getval(FlGui::instance()->elementaryContext->input[4]->value(), x)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[5]->value(), y)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[6]->value(), z)) + return; FlGui::instance()->getCurrentOpenglWindow()->setPoint(x, y, z); drawContext::global()->draw(); } @@ -130,17 +135,24 @@ static void elementary_add_point_cb(Fl_Widget *w, void *data) static void draw_circle(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, r, angle1, angle2; - if(!getval(FlGui::instance()->elementaryContext->input[8]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[9]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[10]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[11]->value(), r)) return; - if(!getval(FlGui::instance()->elementaryContext->input[12]->value(), angle1)) return; - if(!getval(FlGui::instance()->elementaryContext->input[13]->value(), angle2)) return; + if(!getval(FlGui::instance()->elementaryContext->input[8]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[9]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[10]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[11]->value(), r)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[12]->value(), angle1)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[13]->value(), angle2)) + return; if(angle2 <= angle1) return; - glColor4ubv((GLubyte *) & CTX::instance()->color.geom.highlight[0]); + glColor4ubv((GLubyte *)&CTX::instance()->color.geom.highlight[0]); glBegin(GL_LINE_STRIP); const int N = 30; for(int i = 0; i < N; i++) { @@ -176,17 +188,25 @@ static void elementary_add_circle_cb(Fl_Widget *w, void *data) static void draw_ellipse(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, rx, ry, angle1, angle2; - if(!getval(FlGui::instance()->elementaryContext->input[14]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[15]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[16]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[17]->value(), rx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[18]->value(), ry)) return; - if(!getval(FlGui::instance()->elementaryContext->input[19]->value(), angle1)) return; - if(!getval(FlGui::instance()->elementaryContext->input[20]->value(), angle2)) return; + if(!getval(FlGui::instance()->elementaryContext->input[14]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[15]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[16]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[17]->value(), rx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[18]->value(), ry)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[19]->value(), angle1)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[20]->value(), angle2)) + return; if(angle2 <= angle1) return; - glColor4ubv((GLubyte *) & CTX::instance()->color.geom.highlight[0]); + glColor4ubv((GLubyte *)&CTX::instance()->color.geom.highlight[0]); glBegin(GL_LINE_STRIP); const int N = 30; for(int i = 0; i < N; i++) { @@ -223,18 +243,24 @@ static void elementary_add_ellipse_cb(Fl_Widget *w, void *data) static void draw_disk(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, rx, ry; - if(!getval(FlGui::instance()->elementaryContext->input[21]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[22]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[23]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[24]->value(), rx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[25]->value(), ry)) return; + if(!getval(FlGui::instance()->elementaryContext->input[21]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[22]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[23]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[24]->value(), rx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[25]->value(), ry)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeDiskSTL - (xc, yc, zc, rx, ry, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeDiskSTL( + xc, yc, zc, rx, ry, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -261,19 +287,26 @@ static void elementary_add_disk_cb(Fl_Widget *w, void *data) static void draw_rectangle(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double x, y, z, dx, dy, r; - if(!getval(FlGui::instance()->elementaryContext->input[26]->value(), x)) return; - if(!getval(FlGui::instance()->elementaryContext->input[27]->value(), y)) return; - if(!getval(FlGui::instance()->elementaryContext->input[28]->value(), z)) return; - if(!getval(FlGui::instance()->elementaryContext->input[29]->value(), dx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[30]->value(), dy)) return; - if(!getval(FlGui::instance()->elementaryContext->input[31]->value(), r)) return; + if(!getval(FlGui::instance()->elementaryContext->input[26]->value(), x)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[27]->value(), y)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[28]->value(), z)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[29]->value(), dx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[30]->value(), dy)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[31]->value(), r)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeRectangleSTL - (x, y, z, dx, dy, r, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeRectangleSTL( + x, y, z, dx, dy, r, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -301,20 +334,28 @@ static void elementary_add_rectangle_cb(Fl_Widget *w, void *data) static void draw_sphere(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, r, angle1, angle2, angle3; - if(!getval(FlGui::instance()->elementaryContext->input[32]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[33]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[34]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[35]->value(), r)) return; - if(!getval(FlGui::instance()->elementaryContext->input[36]->value(), angle1)) return; - if(!getval(FlGui::instance()->elementaryContext->input[37]->value(), angle2)) return; - if(!getval(FlGui::instance()->elementaryContext->input[38]->value(), angle3)) return; + if(!getval(FlGui::instance()->elementaryContext->input[32]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[33]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[34]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[35]->value(), r)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[36]->value(), angle1)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[37]->value(), angle2)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[38]->value(), angle3)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeSphereSTL - (xc, yc, zc, r, angle1, angle2, angle3, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeSphereSTL( + xc, yc, zc, r, angle1, angle2, angle3, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -344,21 +385,30 @@ static void elementary_add_sphere_cb(Fl_Widget *w, void *data) static void draw_cylinder(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, dx, dy, dz, r, angle; - if(!getval(FlGui::instance()->elementaryContext->input[39]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[40]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[41]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[42]->value(), dx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[43]->value(), dy)) return; - if(!getval(FlGui::instance()->elementaryContext->input[44]->value(), dz)) return; - if(!getval(FlGui::instance()->elementaryContext->input[45]->value(), r)) return; - if(!getval(FlGui::instance()->elementaryContext->input[46]->value(), angle)) return; + if(!getval(FlGui::instance()->elementaryContext->input[39]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[40]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[41]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[42]->value(), dx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[43]->value(), dy)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[44]->value(), dz)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[45]->value(), r)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[46]->value(), angle)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeCylinderSTL - (xc, yc, zc, dx, dy, dz, r, angle, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeCylinderSTL( + xc, yc, zc, dx, dy, dz, r, angle, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -388,19 +438,26 @@ static void elementary_add_cylinder_cb(Fl_Widget *w, void *data) static void draw_box(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double x, y, z, dx, dy, dz; - if(!getval(FlGui::instance()->elementaryContext->input[47]->value(), x)) return; - if(!getval(FlGui::instance()->elementaryContext->input[48]->value(), y)) return; - if(!getval(FlGui::instance()->elementaryContext->input[49]->value(), z)) return; - if(!getval(FlGui::instance()->elementaryContext->input[50]->value(), dx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[51]->value(), dy)) return; - if(!getval(FlGui::instance()->elementaryContext->input[52]->value(), dz)) return; + if(!getval(FlGui::instance()->elementaryContext->input[47]->value(), x)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[48]->value(), y)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[49]->value(), z)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[50]->value(), dx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[51]->value(), dy)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[52]->value(), dz)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeBoxSTL - (x, y, z, dx, dy, dz, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeBoxSTL( + x, y, z, dx, dy, dz, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -428,19 +485,26 @@ static void elementary_add_box_cb(Fl_Widget *w, void *data) static void draw_torus(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, r1, r2, angle; - if(!getval(FlGui::instance()->elementaryContext->input[53]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[54]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[55]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[56]->value(), r1)) return; - if(!getval(FlGui::instance()->elementaryContext->input[57]->value(), r2)) return; - if(!getval(FlGui::instance()->elementaryContext->input[58]->value(), angle)) return; + if(!getval(FlGui::instance()->elementaryContext->input[53]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[54]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[55]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[56]->value(), r1)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[57]->value(), r2)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[58]->value(), angle)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeTorusSTL - (xc, yc, zc, r1, r2, angle, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeTorusSTL( + xc, yc, zc, r1, r2, angle, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -468,22 +532,32 @@ static void elementary_add_torus_cb(Fl_Widget *w, void *data) static void draw_cone(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double xc, yc, zc, dx, dy, dz, r1, r2, angle; - if(!getval(FlGui::instance()->elementaryContext->input[59]->value(), xc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[60]->value(), yc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[61]->value(), zc)) return; - if(!getval(FlGui::instance()->elementaryContext->input[62]->value(), dx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[63]->value(), dy)) return; - if(!getval(FlGui::instance()->elementaryContext->input[64]->value(), dz)) return; - if(!getval(FlGui::instance()->elementaryContext->input[65]->value(), r1)) return; - if(!getval(FlGui::instance()->elementaryContext->input[66]->value(), r2)) return; - if(!getval(FlGui::instance()->elementaryContext->input[67]->value(), angle)) return; + if(!getval(FlGui::instance()->elementaryContext->input[59]->value(), xc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[60]->value(), yc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[61]->value(), zc)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[62]->value(), dx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[63]->value(), dy)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[64]->value(), dz)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[65]->value(), r1)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[66]->value(), r2)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[67]->value(), angle)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeConeSTL - (xc, yc, zc, dx, dy, dz, r1, r2, angle, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeConeSTL( + xc, yc, zc, dx, dy, dz, r1, r2, angle, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -514,20 +588,28 @@ static void elementary_add_cone_cb(Fl_Widget *w, void *data) static void draw_wedge(void *context) { - if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals(); + if(!GModel::current()->getOCCInternals()) + GModel::current()->createOCCInternals(); double x, y, z, dx, dy, dz, ltx; - if(!getval(FlGui::instance()->elementaryContext->input[68]->value(), x)) return; - if(!getval(FlGui::instance()->elementaryContext->input[69]->value(), y)) return; - if(!getval(FlGui::instance()->elementaryContext->input[70]->value(), z)) return; - if(!getval(FlGui::instance()->elementaryContext->input[71]->value(), dx)) return; - if(!getval(FlGui::instance()->elementaryContext->input[72]->value(), dy)) return; - if(!getval(FlGui::instance()->elementaryContext->input[73]->value(), dz)) return; - if(!getval(FlGui::instance()->elementaryContext->input[74]->value(), ltx)) return; + if(!getval(FlGui::instance()->elementaryContext->input[68]->value(), x)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[69]->value(), y)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[70]->value(), z)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[71]->value(), dx)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[72]->value(), dy)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[73]->value(), dz)) + return; + if(!getval(FlGui::instance()->elementaryContext->input[74]->value(), ltx)) + return; std::vector<SPoint3> vertices; std::vector<SVector3> normals; std::vector<int> triangles; - if(!GModel::current()->getOCCInternals()->makeWedgeSTL - (x, y, z, dx, dy, dz, ltx, vertices, normals, triangles)) + if(!GModel::current()->getOCCInternals()->makeWedgeSTL( + x, y, z, dx, dy, dz, ltx, vertices, normals, triangles)) return; draw_stl(vertices, normals, triangles); } @@ -556,11 +638,11 @@ static void elementary_add_wedge_cb(Fl_Widget *w, void *data) static void elementary_switch_tabs_cb(Fl_Widget *w, void *data) { - if(FlGui::instance()->elementaryContext->tab1->visible()){ + if(FlGui::instance()->elementaryContext->tab1->visible()) { FlGui::instance()->elementaryContext->tab1->hide(); FlGui::instance()->elementaryContext->tab2->show(); } - else{ + else { FlGui::instance()->elementaryContext->tab2->hide(); FlGui::instance()->elementaryContext->tab1->show(); } @@ -568,9 +650,12 @@ static void elementary_switch_tabs_cb(Fl_Widget *w, void *data) static void elementary_snap_cb(Fl_Widget *w, void *data) { - CTX::instance()->geom.snap[0] = FlGui::instance()->elementaryContext->value[0]->value(); - CTX::instance()->geom.snap[1] = FlGui::instance()->elementaryContext->value[1]->value(); - CTX::instance()->geom.snap[2] = FlGui::instance()->elementaryContext->value[2]->value(); + CTX::instance()->geom.snap[0] = + FlGui::instance()->elementaryContext->value[0]->value(); + CTX::instance()->geom.snap[1] = + FlGui::instance()->elementaryContext->value[1]->value(); + CTX::instance()->geom.snap[2] = + FlGui::instance()->elementaryContext->value[2]->value(); } elementaryContextWindow::elementaryContextWindow(int deltaFontSize) @@ -580,15 +665,16 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) int width = 34 * FL_NORMAL_SIZE; int height = 5 * WB + 10 * BH; - win = new paletteWindow(width, height, CTX::instance()->nonModalWindows ? true : false, + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, "Elementary Entity Context"); win->box(GMSH_WINDOW_BOX); { tab1 = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH); // 0: Parameter { - group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Parameter"); + group[0] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Parameter"); input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Name"); input[0]->value("lc"); input[1] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Value"); @@ -597,20 +683,20 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[2]->value(""); input[3] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Path"); input[3]->value("Parameters"); - for(int i = 0; i < 4; i++){ + for(int i = 0; i < 4; i++) { input[i]->align(FL_ALIGN_RIGHT); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_parameter_cb); } group[0]->end(); } // 1: Point { - group[1] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Point"); + group[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Point"); input[4] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X"); input[4]->value("0"); input[5] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y"); @@ -620,21 +706,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[7] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Prescribed mesh size at point"); input[7]->value("1.0"); - for(int i = 4; i < 8; i++){ + for(int i = 4; i < 8; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_point_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_point_cb); } group[1]->end(); } // 2: Circle { - group[2] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Circle"); + group[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Circle"); input[8] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[8]->value("0"); input[9] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -647,21 +733,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[12]->value("0"); input[13] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Angle 2"); input[13]->value("2*Pi"); - for(int i = 8; i < 14; i++){ + for(int i = 8; i < 14; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_circle_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_circle_cb); } group[2]->end(); } // 3: Ellipse { - group[3] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Ellipse"); + group[3] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Ellipse"); input[14] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[14]->value("0"); input[15] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -676,21 +762,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[19]->value("0"); input[20] = new Fl_Input(2 * WB, 2 * WB + 7 * BH, IW, BH, "Angle 2"); input[20]->value("2*Pi"); - for(int i = 14; i < 21; i++){ + for(int i = 14; i < 21; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_ellipse_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_ellipse_cb); } group[3]->end(); } // 4: Disk { - group[4] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Disk"); + group[4] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Disk"); input[21] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[21]->value("0"); input[22] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -701,21 +787,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[24]->value("0.5"); input[25] = new Fl_Input(2 * WB, 2 * WB + 5 * BH, IW, BH, "Radius Y"); input[25]->value("0.25"); - for(int i = 21; i < 26; i++){ + for(int i = 21; i < 26; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_disk_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_disk_cb); } group[4]->end(); } // 5: Rectangle { - group[5] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Rectangle"); + group[5] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Rectangle"); input[26] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X"); input[26]->value("0"); input[27] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y"); @@ -726,15 +812,16 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[29]->value("1"); input[30] = new Fl_Input(2 * WB, 2 * WB + 5 * BH, IW, BH, "DY"); input[30]->value("0.5"); - input[31] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Rounded radius"); + input[31] = + new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Rounded radius"); input[31]->value("0"); - for(int i = 26; i < 32; i++){ + for(int i = 26; i < 32; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_rectangle_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_rectangle_cb); } group[5]->end(); @@ -745,8 +832,8 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) tab2 = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH); // 6: Sphere { - group[6] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Sphere"); + group[6] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Sphere"); input[32] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[32]->value("0"); input[33] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -761,26 +848,29 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[37]->value("Pi/2"); input[38] = new Fl_Input(2 * WB, 2 * WB + 7 * BH, IW, BH, "Angle 3"); input[38]->value("2*Pi"); - for(int i = 32; i < 39; i++){ + for(int i = 32; i < 39; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_sphere_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_sphere_cb); } group[6]->end(); } // 7: Cylinder { - group[7] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Cylinder"); - input[39] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center base X"); + group[7] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Cylinder"); + input[39] = + new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center base X"); input[39]->value("0"); - input[40] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center base Y"); + input[40] = + new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center base Y"); input[40]->value("0"); - input[41] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Center base Z"); + input[41] = + new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Center base Z"); input[41]->value("0"); input[42] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Axis DX"); input[42]->value("1"); @@ -792,21 +882,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[45]->value("0.5"); input[46] = new Fl_Input(2 * WB, 2 * WB + 8 * BH, IW, BH, "Angle"); input[46]->value("2*Pi"); - for(int i = 39; i < 47; i++){ + for(int i = 39; i < 47; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_cylinder_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_cylinder_cb); } group[7]->end(); } // 8: Box { - group[8] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Box"); + group[8] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Box"); input[47] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X"); input[47]->value("0"); input[48] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y"); @@ -819,21 +909,21 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[51]->value("1"); input[52] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "DZ"); input[52]->value("1"); - for(int i = 47; i < 53; i++){ + for(int i = 47; i < 53; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_box_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_box_cb); } group[8]->end(); } // 9: Torus { - group[9] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Torus"); + group[9] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Torus"); input[53] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[53]->value("0"); input[54] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -846,26 +936,29 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[57]->value("0.2"); input[58] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Angle"); input[58]->value("2*Pi"); - for(int i = 53; i < 59; i++){ + for(int i = 53; i < 59; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_torus_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_torus_cb); } group[9]->end(); } // 10: Cone { - group[10] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Cone"); - input[59] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center base X"); + group[10] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Cone"); + input[59] = + new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center base X"); input[59]->value("0"); - input[60] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center base Y"); + input[60] = + new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center base Y"); input[60]->value("0"); - input[61] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Center base Z"); + input[61] = + new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Center base Z"); input[61]->value("0"); input[62] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Axis DX"); input[62]->value("1"); @@ -873,27 +966,30 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[63]->value("0"); input[64] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Axis DZ"); input[64]->value("0"); - input[65] = new Fl_Input(2 * WB + (width - 2 * WB)/2, 2 * WB + 4 * BH, IW, BH, "Radius 1"); + input[65] = new Fl_Input(2 * WB + (width - 2 * WB) / 2, 2 * WB + 4 * BH, + IW, BH, "Radius 1"); input[65]->value("0.5"); - input[66] = new Fl_Input(2 * WB + (width - 2 * WB)/2, 2 * WB + 5 * BH, IW, BH, "Radius 2"); + input[66] = new Fl_Input(2 * WB + (width - 2 * WB) / 2, 2 * WB + 5 * BH, + IW, BH, "Radius 2"); input[66]->value("0.1"); - input[67] = new Fl_Input(2 * WB + (width - 2 * WB)/2, 2 * WB + 6 * BH, IW, BH, "Angle"); + input[67] = new Fl_Input(2 * WB + (width - 2 * WB) / 2, 2 * WB + 6 * BH, + IW, BH, "Angle"); input[67]->value("2*Pi"); - for(int i = 59; i < 68; i++){ + for(int i = 59; i < 68; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_cone_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_cone_cb); } group[10]->end(); } // 11: Wedge { - group[11] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Wedge"); + group[11] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Wedge"); input[68] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X"); input[68]->value("0"); input[69] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y"); @@ -908,13 +1004,13 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) input[73]->value("0.5"); input[74] = new Fl_Input(2 * WB, 2 * WB + 7 * BH, IW, BH, "Top DX"); input[74]->value("0"); - for(int i = 68; i < 75; i++){ + for(int i = 68; i < 75; i++) { input[i]->align(FL_ALIGN_RIGHT); input[i]->callback(elementary_draw_wedge_cb); } { - Fl_Button *o = new Fl_Button - (width - BB - 2 * WB, height - 3 * WB - 2 * BH, BB, BH, "Add"); + Fl_Button *o = new Fl_Button(width - BB - 2 * WB, + height - 3 * WB - 2 * BH, BB, BH, "Add"); o->callback(elementary_add_wedge_cb); } group[11]->end(); @@ -923,29 +1019,35 @@ elementaryContextWindow::elementaryContextWindow(int deltaFontSize) } { - Fl_Button *o = new Fl_Button(width - 4 * WB, WB, 3*WB, 3*WB, "..."); + Fl_Button *o = new Fl_Button(width - 4 * WB, WB, 3 * WB, 3 * WB, "..."); o->callback(elementary_switch_tabs_cb); } { - value[0] = new Fl_Value_Input(WB, height - WB - BH, IW/3, BH, "X"); - value[1] = new Fl_Value_Input(WB + IW/2, height - WB - BH, IW/3, BH, "Y"); - value[2] = new Fl_Value_Input(WB + IW, height - WB - BH, IW/3, BH, "Z snap"); + value[0] = new Fl_Value_Input(WB, height - WB - BH, IW / 3, BH, "X"); + value[1] = + new Fl_Value_Input(WB + IW / 2, height - WB - BH, IW / 3, BH, "Y"); + value[2] = + new Fl_Value_Input(WB + IW, height - WB - BH, IW / 3, BH, "Z snap"); for(int i = 0; i < 3; i++) { value[i]->align(FL_ALIGN_RIGHT); value[i]->callback(elementary_snap_cb); } - butt[0] = new Fl_Check_Button(width - 6 * BH, height - WB - BH, 1.2 * BH, BH, "X"); + butt[0] = + new Fl_Check_Button(width - 6 * BH, height - WB - BH, 1.2 * BH, BH, "X"); butt[0]->tooltip("Toggle (x) or exclusive unselect (Shift+x)"); - butt[1] = new Fl_Check_Button(width - 6 * BH + 1.2 * BH, height - WB - BH, 1.2*BH, BH, "Y"); + butt[1] = new Fl_Check_Button(width - 6 * BH + 1.2 * BH, height - WB - BH, + 1.2 * BH, BH, "Y"); butt[1]->tooltip("Toggle (y) or exclusive unselect (Shift+y)"); - butt[2] = new Fl_Check_Button(width - 6 * BH + 2.4 * BH, height - WB - BH, (6 - 2*1.2) * BH - WB, BH, "Z freeze"); + butt[2] = new Fl_Check_Button(width - 6 * BH + 2.4 * BH, height - WB - BH, + (6 - 2 * 1.2) * BH - WB, BH, "Z freeze"); butt[2]->tooltip("Toggle (z) or exclusive unselect (Shift+z)"); } tab1->show(); tab2->hide(); - win->position(CTX::instance()->ctxPosition[0], CTX::instance()->ctxPosition[1]); + win->position(CTX::instance()->ctxPosition[0], + CTX::instance()->ctxPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -959,16 +1061,16 @@ bool elementaryContextWindow::frozenPointCoord(int coord) void elementaryContextWindow::updatePoint(double pt[3], int which) { - for(int i = 0; i < 3; i++){ - if(!frozenPointCoord(i)){ + for(int i = 0; i < 3; i++) { + if(!frozenPointCoord(i)) { char str[32]; sprintf(str, "%g", pt[i]); - if(which == 1){ + if(which == 1) { int start[11] = {4, 8, 14, 21, 26, 32, 39, 47, 53, 59, 68}; - for(int k = 0; k < 11; k++){ + for(int k = 0; k < 11; k++) { input[start[k] + i]->value(str); - if(input[start[k] + i]->parent()->active()){ - input[start[k] + i]->do_callback(0, (void*)"no_redraw"); + if(input[start[k] + i]->parent()->active()) { + input[start[k] + i]->do_callback(0, (void *)"no_redraw"); } } } @@ -980,16 +1082,16 @@ void elementaryContextWindow::show(int pane) { if(pane < 0 || pane > 11) return; - for(int i = 0; i < 12; i++){ + for(int i = 0; i < 12; i++) { group[i]->hide(); group[i]->deactivate(); } - if(pane < 6){ + if(pane < 6) { tab1->show(); tab2->hide(); } - else{ + else { tab1->hide(); tab2->show(); } @@ -1000,19 +1102,14 @@ void elementaryContextWindow::show(int pane) } static Fl_Menu_Item menu_selection_mode[] = { - {"All entities", 0, 0, 0}, - {"Points", 0, 0, 0}, - {"Curves", 0, 0, 0}, - {"Surfaces", 0, 0, 0}, - {"Volumes", 0, 0, 0}, - {0} -}; + {"All entities", 0, 0, 0}, {"Points", 0, 0, 0}, {"Curves", 0, 0, 0}, + {"Surfaces", 0, 0, 0}, {"Volumes", 0, 0, 0}, {0}}; static void selection_mode_cb(Fl_Widget *w, void *data) { - Fl_Choice *c = (Fl_Choice*)w; + Fl_Choice *c = (Fl_Choice *)w; int mode = ENT_ALL; - switch(c->value()){ + switch(c->value()) { case 1: mode = ENT_POINT; opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); @@ -1043,15 +1140,16 @@ transformContextWindow::transformContextWindow(int deltaFontSize) int width = 34 * FL_NORMAL_SIZE; int height = 5 * WB + 10 * BH; - win = new paletteWindow(width, height, CTX::instance()->nonModalWindows ? true : false, + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, "Elementary Operation Context"); win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH); // 0: Translate { - group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Translate"); + group[0] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Translate"); input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "DX"); input[0]->value("0"); input[1] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "DY"); @@ -1070,25 +1168,29 @@ transformContextWindow::transformContextWindow(int deltaFontSize) input[21] = new Fl_Input(2 * WB, 2 * WB + 6 * BH, IW, BH, "Mesh layers"); input[21]->value("5"); input[21]->align(FL_ALIGN_RIGHT); - butt[8] = new Fl_Check_Button - (width / 2 + 2 * WB, 2 * WB + 6 * BH, width / 2 - 4 * WB, BH, "Recombine"); + butt[8] = new Fl_Check_Button(width / 2 + 2 * WB, 2 * WB + 6 * BH, + width / 2 - 4 * WB, BH, "Recombine"); butt[8]->value(1); group[0]->end(); } // 1: Rotate { - group[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Rotate"); + group[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Rotate"); input[3] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Axis point X"); input[3]->value("0"); input[4] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Axis point Y"); input[4]->value("0"); input[5] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Axis point Z"); input[5]->value("0"); - input[6] = new Fl_Input(width / 2 + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axis DX"); + input[6] = + new Fl_Input(width / 2 + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axis DX"); input[6]->value("0"); - input[7] = new Fl_Input(width / 2 + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Axis DY"); + input[7] = + new Fl_Input(width / 2 + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Axis DY"); input[7]->value("1"); - input[8] = new Fl_Input(width / 2 + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Axis DZ"); + input[8] = + new Fl_Input(width / 2 + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Axis DZ"); input[8]->value("0"); input[9] = new Fl_Input(2 * WB, 2 * WB + 4 * BH, IW, BH, "Angle"); input[9]->value("Pi/4"); @@ -1104,14 +1206,15 @@ transformContextWindow::transformContextWindow(int deltaFontSize) input[22] = new Fl_Input(2 * WB, 2 * WB + 7 * BH, IW, BH, "Mesh layers"); input[22]->value("5"); input[22]->align(FL_ALIGN_RIGHT); - butt[10] = new Fl_Check_Button - (width / 2 + 2 * WB, 2 * WB + 7 * BH, width / 2 - 4 * WB, BH, "Recombine"); + butt[10] = new Fl_Check_Button(width / 2 + 2 * WB, 2 * WB + 7 * BH, + width / 2 - 4 * WB, BH, "Recombine"); butt[10]->value(1); group[1]->end(); } // 2: Scale { - group[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Scale"); + group[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Scale"); input[10] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Center X"); input[10]->value("0"); input[11] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Center Y"); @@ -1134,8 +1237,8 @@ transformContextWindow::transformContextWindow(int deltaFontSize) } // 3: Symmetry { - group[3] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Symmetry"); + group[3] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Symmetry"); input[16] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Plane A"); input[16]->value("1"); input[17] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Plane B"); @@ -1154,8 +1257,8 @@ transformContextWindow::transformContextWindow(int deltaFontSize) } // 4: Boolean { - group[4] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Boolean"); + group[4] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Boolean"); butt[4] = new Fl_Check_Button(2 * WB, 2 * WB + 1 * BH, width - 4 * WB, BH, "Delete object"); butt[4]->value(1); @@ -1166,8 +1269,8 @@ transformContextWindow::transformContextWindow(int deltaFontSize) } // 5: Fillet { - group[5] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Fillet"); + group[5] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Fillet"); input[20] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Radius"); input[20]->value("0.1"); input[20]->align(FL_ALIGN_RIGHT); @@ -1175,8 +1278,8 @@ transformContextWindow::transformContextWindow(int deltaFontSize) } // 6: Delete { - group[6] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Delete"); + group[6] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Delete"); butt[6] = new Fl_Check_Button(2 * WB, 2 * WB + 1 * BH, width - 4 * WB, BH, "Recursive"); butt[6]->value(1); @@ -1190,7 +1293,8 @@ transformContextWindow::transformContextWindow(int deltaFontSize) choice->align(FL_ALIGN_RIGHT); choice->callback(selection_mode_cb); - win->position(CTX::instance()->ctxPosition[0], CTX::instance()->ctxPosition[1]); + win->position(CTX::instance()->ctxPosition[0], + CTX::instance()->ctxPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -1198,28 +1302,36 @@ transformContextWindow::transformContextWindow(int deltaFontSize) void transformContextWindow::show(int pane, bool extrude, bool selection) { - for(int i = 0; i < 7; i++){ + for(int i = 0; i < 7; i++) { group[i]->hide(); group[i]->deactivate(); } - for(int i = 0; i < 4; i++){ - if(extrude) butt[i]->deactivate(); - else butt[i]->activate(); + for(int i = 0; i < 4; i++) { + if(extrude) + butt[i]->deactivate(); + else + butt[i]->activate(); } - for(int i = 7; i < 11; i++){ - if(!extrude) butt[i]->deactivate(); - else butt[i]->activate(); + for(int i = 7; i < 11; i++) { + if(!extrude) + butt[i]->deactivate(); + else + butt[i]->activate(); } - for(int i = 21; i < 23; i++){ - if(!extrude) input[i]->deactivate(); - else input[i]->activate(); + for(int i = 21; i < 23; i++) { + if(!extrude) + input[i]->deactivate(); + else + input[i]->activate(); } - if(selection) choice->activate(); - else choice->deactivate(); - if(pane < 0 || pane > 6){ + if(selection) + choice->activate(); + else + choice->deactivate(); + if(pane < 0 || pane > 6) { group[0]->show(); } - else{ + else { group[pane]->show(); group[pane]->activate(); } @@ -1229,31 +1341,34 @@ void transformContextWindow::show(int pane, bool extrude, bool selection) static void physical_cb(Fl_Widget *w, void *data) { std::string what; - if(!data) what = ""; - else what = (const char*)data; + if(!data) + what = ""; + else + what = (const char *)data; std::string name = FlGui::instance()->physicalContext->input[0]->value(); int number = FlGui::instance()->physicalContext->value[0]->value(); std::string existingName = ""; int existingNumber = 0; - if(what != "Number"){ + if(what != "Number") { for(GModel::piter it = GModel::current()->firstPhysicalName(); - it != GModel::current()->lastPhysicalName(); it++){ - if(it->second == name){ + it != GModel::current()->lastPhysicalName(); it++) { + if(it->second == name) { existingName = name; existingNumber = it->first.second; break; } } } - if(what != "Name"){ - std::map<int, std::vector<GEntity*> > groups[4]; + if(what != "Name") { + std::map<int, std::vector<GEntity *> > groups[4]; GModel::current()->getPhysicalGroups(groups); - for(int i = 0; i < 4; i++){ - for(std::map<int, std::vector<GEntity*> >::iterator it = groups[i].begin(); - it != groups[i].end(); it++){ - if(it->first == number){ + for(int i = 0; i < 4; i++) { + for(std::map<int, std::vector<GEntity *> >::iterator it = + groups[i].begin(); + it != groups[i].end(); it++) { + if(it->first == number) { existingNumber = number; existingName = GModel::current()->getPhysicalName(i, number); break; @@ -1262,26 +1377,29 @@ static void physical_cb(Fl_Widget *w, void *data) } } - if(existingName.size() || existingNumber){ - FlGui::instance()->physicalContext->input[0]->textcolor - (FlGui::instance()->physicalContext->color); - FlGui::instance()->physicalContext->value[0]->textcolor - (FlGui::instance()->physicalContext->color); - if(what != "Name" && !strlen(FlGui::instance()->physicalContext->input[0]->value())) + if(existingName.size() || existingNumber) { + FlGui::instance()->physicalContext->input[0]->textcolor( + FlGui::instance()->physicalContext->color); + FlGui::instance()->physicalContext->value[0]->textcolor( + FlGui::instance()->physicalContext->color); + if(what != "Name" && + !strlen(FlGui::instance()->physicalContext->input[0]->value())) FlGui::instance()->physicalContext->input[0]->value(existingName.c_str()); if(what != "Number") FlGui::instance()->physicalContext->value[0]->value(existingNumber); FlGui::instance()->physicalContext->append = true; } - else{ - FlGui::instance()->physicalContext->input[0]->textcolor(FL_FOREGROUND_COLOR); - FlGui::instance()->physicalContext->value[0]->textcolor(FL_FOREGROUND_COLOR); + else { + FlGui::instance()->physicalContext->input[0]->textcolor( + FL_FOREGROUND_COLOR); + FlGui::instance()->physicalContext->value[0]->textcolor( + FL_FOREGROUND_COLOR); if(what != "Number" && FlGui::instance()->physicalContext->mode != "Remove") FlGui::instance()->physicalContext->value[0]->value(NEWPHYSICAL()); FlGui::instance()->physicalContext->append = false; } - if(FlGui::instance()->physicalContext->butt[0]->active()){ + if(FlGui::instance()->physicalContext->butt[0]->active()) { if(FlGui::instance()->physicalContext->butt[0]->value()) FlGui::instance()->physicalContext->value[0]->deactivate(); else @@ -1300,29 +1418,33 @@ physicalContextWindow::physicalContextWindow(int deltaFontSize) int width = 28 * FL_NORMAL_SIZE; int height = 2 * WB + 3 * BH; - win = new paletteWindow(width, height, CTX::instance()->nonModalWindows ? true : false, + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, "Physical Group Context"); win->box(GMSH_WINDOW_BOX); { input[0] = new Fl_Input_Choice(WB, WB, (3 * width) / 4, BH, "Name"); input[0]->value(""); input[0]->align(FL_ALIGN_RIGHT); - input[0]->callback(physical_cb, (void*)"Name"); + input[0]->callback(physical_cb, (void *)"Name"); input[0]->when(FL_WHEN_CHANGED); - butt[0] = new Fl_Check_Button(WB, WB + BH, width - 2 * WB, BH, "Automatic numbering"); + butt[0] = new Fl_Check_Button(WB, WB + BH, width - 2 * WB, BH, + "Automatic numbering"); butt[0]->value(1); butt[0]->callback(physical_cb); - value[0] = new Fl_Value_Input(WB, WB + 2 * BH, (3 * width) / 4, BH, "Number"); + value[0] = + new Fl_Value_Input(WB, WB + 2 * BH, (3 * width) / 4, BH, "Number"); value[0]->value(0); value[0]->deactivate(); value[0]->align(FL_ALIGN_RIGHT); - value[0]->callback(physical_cb, (void*)"Number"); + value[0]->callback(physical_cb, (void *)"Number"); value[0]->when(FL_WHEN_CHANGED); } - win->position(CTX::instance()->ctxPosition[0], CTX::instance()->ctxPosition[1]); + win->position(CTX::instance()->ctxPosition[0], + CTX::instance()->ctxPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -1331,15 +1453,13 @@ physicalContextWindow::physicalContextWindow(int deltaFontSize) void physicalContextWindow::show(bool remove) { static std::vector<Fl_Menu_Item> menu; - static std::vector<char*> names; - for(unsigned int i = 0; i < menu.size(); i++) - menu[i].text = ""; - for(unsigned int i = 0; i < names.size(); i++) - free(names[i]); + static std::vector<char *> names; + for(unsigned int i = 0; i < menu.size(); i++) menu[i].text = ""; + for(unsigned int i = 0; i < names.size(); i++) free(names[i]); names.clear(); menu.clear(); for(GModel::piter it = GModel::current()->firstPhysicalName(); - it != GModel::current()->lastPhysicalName(); it++){ + it != GModel::current()->lastPhysicalName(); it++) { char *str = strdup(it->second.c_str()); Fl_Menu_Item item = {str, 0, 0, 0, 0}; names.push_back(str); @@ -1349,13 +1469,13 @@ void physicalContextWindow::show(bool remove) menu.push_back(item); input[0]->menubutton()->copy(&menu[0]); - if(remove){ + if(remove) { mode = "Remove"; butt[0]->deactivate(); value[0]->activate(); color = (!CTX::instance()->guiColorScheme ? FL_DARK_GREEN : FL_GREEN); } - else{ + else { mode = "Add"; butt[0]->activate(); if(butt[0]->value()) @@ -1364,7 +1484,7 @@ void physicalContextWindow::show(bool remove) value[0]->activate(); color = (!CTX::instance()->guiColorScheme ? FL_DARK_RED : FL_RED); } - physical_cb(0, (void*)"Name"); + physical_cb(0, (void *)"Name"); if(!win->shown()) win->show(); } @@ -1373,24 +1493,20 @@ meshContextWindow::meshContextWindow(int deltaFontSize) FL_NORMAL_SIZE -= deltaFontSize; static Fl_Menu menu_transfinite_dir[] = { - {"Left", 0, 0, 0}, - {"Right", 0, 0, 0}, - {"Alternated", 0, 0, 0}, - {0} - }; + {"Left", 0, 0, 0}, {"Right", 0, 0, 0}, {"Alternated", 0, 0, 0}, {0}}; int width = 29 * FL_NORMAL_SIZE; int height = 4 * WB + 4 * BH; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows, "Mesh Context"); + win = new paletteWindow(width, height, CTX::instance()->nonModalWindows, + "Mesh Context"); win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 2 * WB); // 0: Element size at points { - group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Element size"); + group[0] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Element size"); input[0] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Value"); input[0]->value("0.1"); input[0]->align(FL_ALIGN_RIGHT); @@ -1398,9 +1514,10 @@ meshContextWindow::meshContextWindow(int deltaFontSize) } // 1: Transfinite line { - group[1] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfinite curve"); - input[1] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Number of points"); + group[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Transfinite curve"); + input[1] = + new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "Number of points"); input[1]->value("10"); input[2] = new Fl_Input(2 * WB, 2 * WB + 3 * BH, IW, BH, "Parameter"); input[2]->value("1"); @@ -1408,10 +1525,7 @@ meshContextWindow::meshContextWindow(int deltaFontSize) input[i]->align(FL_ALIGN_RIGHT); } static Fl_Menu_Item menu_trsf_mesh[] = { - {"Progression", 0, 0, 0}, - {"Bump", 0, 0, 0}, - {0} - }; + {"Progression", 0, 0, 0}, {"Bump", 0, 0, 0}, {0}}; choice[0] = new Fl_Choice(2 * WB, 2 * WB + 2 * BH, IW, BH, "Type"); choice[0]->menu(menu_trsf_mesh); choice[0]->align(FL_ALIGN_RIGHT); @@ -1420,11 +1534,11 @@ meshContextWindow::meshContextWindow(int deltaFontSize) // 2: Transfinite surface { - group[2] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfinite Surface"); + group[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, + "Transfinite Surface"); - choice[1] = new Fl_Choice - (2 * WB, 2 * WB + 1 * BH, IW, BH, "Transfinite Arrangement"); + choice[1] = new Fl_Choice(2 * WB, 2 * WB + 1 * BH, IW, BH, + "Transfinite Arrangement"); choice[1]->menu(menu_transfinite_dir); choice[1]->align(FL_ALIGN_RIGHT); @@ -1433,7 +1547,8 @@ meshContextWindow::meshContextWindow(int deltaFontSize) o->end(); } - win->position(CTX::instance()->ctxPosition[0], CTX::instance()->ctxPosition[1]); + win->position(CTX::instance()->ctxPosition[0], + CTX::instance()->ctxPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -1441,7 +1556,7 @@ meshContextWindow::meshContextWindow(int deltaFontSize) void meshContextWindow::show(int pane) { - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { group[i]->hide(); group[i]->deactivate(); } diff --git a/Fltk/contextWindow.h b/Fltk/contextWindow.h index f61d5f393bec18c9ce8abc82650ccb18406603e4..34394333531e7f680c51b6d1c91487d90737cac4 100644 --- a/Fltk/contextWindow.h +++ b/Fltk/contextWindow.h @@ -15,38 +15,40 @@ #include <FL/Fl_Group.H> #include <FL/Fl_Tabs.H> -class elementaryContextWindow{ - public: +class elementaryContextWindow { +public: Fl_Window *win; Fl_Tabs *tab1, *tab2; Fl_Input *input[80]; Fl_Value_Input *value[10]; Fl_Group *group[20]; Fl_Check_Button *butt[3]; - public: - elementaryContextWindow(int deltaFontSize=0); + +public: + elementaryContextWindow(int deltaFontSize = 0); void show(int pane); - void hide(){ win->hide(); } + void hide() { win->hide(); } void updatePoint(double pt[3], int which); bool frozenPointCoord(int coord); }; -class transformContextWindow{ - public: +class transformContextWindow { +public: Fl_Window *win; Fl_Input *input[30]; Fl_Value_Input *value[10]; Fl_Group *group[10]; Fl_Check_Button *butt[20]; Fl_Choice *choice; - public: - transformContextWindow(int deltaFontSize=0); - void show(int pane, bool extrude=false, bool selection=true); - void hide(){ win->hide(); } + +public: + transformContextWindow(int deltaFontSize = 0); + void show(int pane, bool extrude = false, bool selection = true); + void hide() { win->hide(); } }; -class physicalContextWindow{ - public: +class physicalContextWindow { +public: Fl_Window *win; Fl_Input_Choice *input[10]; Fl_Check_Button *butt[10]; @@ -54,22 +56,24 @@ class physicalContextWindow{ std::string mode; bool append; Fl_Color color; + public: - physicalContextWindow(int deltaFontSize=0); + physicalContextWindow(int deltaFontSize = 0); void show(bool remove); - void hide(){ win->hide(); } + void hide() { win->hide(); } }; -class meshContextWindow{ - public: +class meshContextWindow { +public: Fl_Window *win; Fl_Input *input[20]; Fl_Choice *choice[20]; Fl_Group *group[10]; - public: - meshContextWindow(int deltaFontSize=0); + +public: + meshContextWindow(int deltaFontSize = 0); void show(int pane); - void hide(){ win->hide(); } + void hide() { win->hide(); } }; #endif diff --git a/Fltk/drawContextFltk.h b/Fltk/drawContextFltk.h index 6c1588b5c1b3d5d69fab278f1c6e8f61d6f58093..a1f86941bb4deeac48eca21b7bc92a51bac38f1d 100644 --- a/Fltk/drawContextFltk.h +++ b/Fltk/drawContextFltk.h @@ -21,23 +21,25 @@ typedef unsigned long intptr_t; #include "openglWindow.h" #include "Context.h" -class drawContextFltk : public drawContextGlobal{ - public: +class drawContextFltk : public drawContextGlobal { +public: void draw() { if(!FlGui::available()) return; - if(FlGui::instance()->fullscreen->shown()){ + if(FlGui::instance()->fullscreen->shown()) { FlGui::instance()->fullscreen->make_current(); FlGui::instance()->fullscreen->redraw(); } - else{ - for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ - for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++){ + else { + for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) { + for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); + j++) { FlGui::instance()->graph[i]->gl[j]->make_current(); FlGui::instance()->graph[i]->gl[j]->redraw(); glFlush(); // FIXME: I don't think this should be done here - drawContext *ctx = FlGui::instance()->graph[i]->gl[j]->getDrawContext(); + drawContext *ctx = + FlGui::instance()->graph[i]->gl[j]->getDrawContext(); ctx->camera.update(); } } @@ -55,10 +57,9 @@ class drawContextFltk : public drawContextGlobal{ } int getFontIndex(const char *fontname) { - if(fontname){ + if(fontname) { for(int i = 0; i < NUM_FONTS; i++) - if(!strcmp(menu_font_names[i].label(), fontname)) - return i; + if(!strcmp(menu_font_names[i].label(), fontname)) return i; } Msg::Error("Unknown font \"%s\" (using \"Helvetica\" instead)", fontname); Msg::Info("Available fonts:"); @@ -74,18 +75,17 @@ class drawContextFltk : public drawContextGlobal{ } const char *getFontName(int index) { - if(index >= 0 && index < NUM_FONTS) - return menu_font_names[index].label(); + if(index >= 0 && index < NUM_FONTS) return menu_font_names[index].label(); return "Helvetica"; } int getFontAlign(const char *alignstr) { - if(alignstr){ + if(alignstr) { if(!strcmp(alignstr, "BottomLeft") || !strcmp(alignstr, "Left") || !strcmp(alignstr, "left")) return 0; - else if(!strcmp(alignstr, "BottomCenter") || !strcmp(alignstr, "Center") || - !strcmp(alignstr, "center")) + else if(!strcmp(alignstr, "BottomCenter") || + !strcmp(alignstr, "Center") || !strcmp(alignstr, "center")) return 1; else if(!strcmp(alignstr, "BottomRight") || !strcmp(alignstr, "Right") || !strcmp(alignstr, "right")) @@ -103,7 +103,8 @@ class drawContextFltk : public drawContextGlobal{ else if(!strcmp(alignstr, "CenterRight")) return 8; } - Msg::Error("Unknown font alignment \"%s\" (using \"Left\" instead)", alignstr); + Msg::Error("Unknown font alignment \"%s\" (using \"Left\" instead)", + alignstr); Msg::Info("Available font alignments:"); Msg::Info(" \"Left\" (or \"BottomLeft\")"); Msg::Info(" \"Center\" (or \"BottomCenter\")"); @@ -118,15 +119,19 @@ class drawContextFltk : public drawContextGlobal{ } int getFontSize() { - if(CTX::instance()->fontSize > 0){ + if(CTX::instance()->fontSize > 0) { return CTX::instance()->fontSize; } - else{ + else { int w = Fl::w(); - if(w <= 1024) return 11; - else if(w <= 1440) return 12; - else if(w <= 1680) return 13; - else if(w <= 1920) return 14; + if(w <= 1024) + return 11; + else if(w <= 1440) + return 12; + else if(w <= 1680) + return 13; + else if(w <= 1920) + return 14; return (w - 1920) / 160 + 15; /* float dpih, dpiv; @@ -135,33 +140,19 @@ class drawContextFltk : public drawContextGlobal{ */ } } - void setFont(int fontid, int fontsize) - { - gl_font(fontid, fontsize); - } - double getStringWidth(const char *str) - { - return gl_width(str); - } - int getStringHeight() - { - return gl_height(); - } - int getStringDescent() - { - return gl_descent(); - } - void drawString(const char *str) - { - gl_draw(str); - } + void setFont(int fontid, int fontsize) { gl_font(fontid, fontsize); } + double getStringWidth(const char *str) { return gl_width(str); } + int getStringHeight() { return gl_height(); } + int getStringDescent() { return gl_descent(); } + void drawString(const char *str) { gl_draw(str); } void resetFontTextures() { #if defined(__APPLE__) - gl_texture_pile_height(gl_texture_pile_height()); // force font texture recomputation + gl_texture_pile_height( + gl_texture_pile_height()); // force font texture recomputation #endif } - std::string getName(){ return "Fltk"; } + std::string getName() { return "Fltk"; } }; #endif diff --git a/Fltk/drawContextFltkCairo.cpp b/Fltk/drawContextFltkCairo.cpp index f924795488fc35e8712a8cfb8ebca121d1d966b5..51efe7914ce205eb6ea0097b705ed0540dc7370d 100644 --- a/Fltk/drawContextFltkCairo.cpp +++ b/Fltk/drawContextFltkCairo.cpp @@ -16,7 +16,7 @@ #endif class drawContextFltkCairo::queueString { - public : +public: typedef struct { std::string text; GLfloat x, y, z; @@ -27,11 +27,11 @@ class drawContextFltkCairo::queueString { double xBearing, yBearing; } element; - private: +private: std::vector<element> _elements; int _totalWidth, _maxHeight; - public: +public: queueString() { _totalWidth = 0; @@ -40,15 +40,15 @@ class drawContextFltkCairo::queueString { ~queueString() { - for(std::vector<element>::iterator it = _elements.begin(); it != _elements.end(); ++it) { + for(std::vector<element>::iterator it = _elements.begin(); + it != _elements.end(); ++it) { cairo_font_face_destroy(it->fontFace); } } void append(const element &elem) { - if (_totalWidth + elem.width > 1000) - flush(); + if(_totalWidth + elem.width > 1000) flush(); _elements.push_back(elem); _totalWidth += elem.width; _maxHeight = std::max(_maxHeight, (int)elem.height + 1); @@ -57,10 +57,11 @@ class drawContextFltkCairo::queueString { void flush() { if(_elements.empty()) return; - cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_A8, _totalWidth, _maxHeight); + cairo_surface_t *surface = + cairo_image_surface_create(CAIRO_FORMAT_A8, _totalWidth, _maxHeight); cairo_t *cr = cairo_create(surface); int pos = 0; - cairo_set_source_rgba (cr, 0., 0., 0., 0); + cairo_set_source_rgba(cr, 0., 0., 0., 0); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); cairo_paint(cr); cairo_set_operator(cr, CAIRO_OPERATOR_OVER); @@ -72,7 +73,8 @@ class drawContextFltkCairo::queueString { cairo_font_options_destroy(fontOptions); cairo_set_source_rgba(cr, 1, 1, 1, 1); - for(std::vector<element>::iterator it = _elements.begin(); it != _elements.end(); ++it) { + for(std::vector<element>::iterator it = _elements.begin(); + it != _elements.end(); ++it) { cairo_move_to(cr, pos - it->xBearing, -it->yBearing); cairo_set_font_size(cr, it->fontSize); cairo_set_font_face(cr, it->fontFace); @@ -81,21 +83,21 @@ class drawContextFltkCairo::queueString { pos += it->width; } cairo_destroy(cr); - //setup matrices + // setup matrices GLint matrixMode; GLuint textureId; - glGetIntegerv (GL_MATRIX_MODE, &matrixMode); - glMatrixMode (GL_PROJECTION); + glGetIntegerv(GL_MATRIX_MODE, &matrixMode); + glMatrixMode(GL_PROJECTION); glPushMatrix(); - glLoadIdentity (); - glMatrixMode (GL_MODELVIEW); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLoadIdentity (); + glLoadIdentity(); float winw = Fl_Window::current()->w(); float winh = Fl_Window::current()->h(); - glScalef (2.0f / winw, 2.0f / winh, 1.0f); - glTranslatef (-winw / 2.0f, -winh / 2.0f, 0.0f); - //write the texture on screen + glScalef(2.0f / winw, 2.0f / winh, 1.0f); + glTranslatef(-winw / 2.0f, -winh / 2.0f, 0.0f); + // write the texture on screen glEnable(GL_TEXTURE_RECTANGLE_ARB); glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); glDisable(GL_LIGHTING); @@ -106,29 +108,30 @@ class drawContextFltkCairo::queueString { glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureId); glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_ALPHA, cairo_image_surface_get_width(surface), - cairo_image_surface_get_height(surface), 0, - GL_ALPHA, GL_UNSIGNED_BYTE, cairo_image_surface_get_data(surface)); - //glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_SRC0_ALPHA); - //printf("error %i %s\n", __LINE__, gluErrorString(glGetError())); + cairo_image_surface_get_height(surface), 0, GL_ALPHA, + GL_UNSIGNED_BYTE, cairo_image_surface_get_data(surface)); + // glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_SRC0_ALPHA); + // printf("error %i %s\n", __LINE__, gluErrorString(glGetError())); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pos = 0; - for(std::vector<element>::iterator it = _elements.begin(); it != _elements.end(); ++it) { + for(std::vector<element>::iterator it = _elements.begin(); + it != _elements.end(); ++it) { glTranslatef(it->x, it->y, it->z); glColor4f(it->r, it->g, it->b, it->alpha); int Lx = it->width; int Ly = it->height; - glBegin (GL_QUADS); - glTexCoord2f (pos, 0); - glVertex2f (0.0f, Ly); - glTexCoord2f (pos + Lx, 0); - glVertex2f (Lx, Ly); - glTexCoord2f (pos + Lx, Ly); - glVertex2f (Lx, 0.0f); - glTexCoord2f (pos, Ly); - glVertex2f (0.0f, 0.0f); - glEnd (); + glBegin(GL_QUADS); + glTexCoord2f(pos, 0); + glVertex2f(0.0f, Ly); + glTexCoord2f(pos + Lx, 0); + glVertex2f(Lx, Ly); + glTexCoord2f(pos + Lx, Ly); + glVertex2f(Lx, 0.0f); + glTexCoord2f(pos, Ly); + glVertex2f(0.0f, 0.0f); + glEnd(); pos += Lx; glTranslatef(-it->x, -it->y, -it->z); } @@ -138,9 +141,9 @@ class drawContextFltkCairo::queueString { // reset original matrices glPopMatrix(); // GL_MODELVIEW - glMatrixMode (GL_PROJECTION); + glMatrixMode(GL_PROJECTION); glPopMatrix(); - glMatrixMode (matrixMode); + glMatrixMode(matrixMode); _elements.clear(); _maxHeight = 0; _totalWidth = 0; @@ -155,15 +158,9 @@ double drawContextFltkCairo::getStringWidth(const char *str) return e.width; } -void drawContextFltkCairo::draw() -{ - drawContextFltk::draw(); -} +void drawContextFltkCairo::draw() { drawContextFltk::draw(); } -void drawContextFltkCairo::flushString() -{ - _queue->flush(); -} +void drawContextFltkCairo::flushString() { _queue->flush(); } void drawContextFltkCairo::drawString(const char *str) { @@ -173,9 +170,20 @@ void drawContextFltkCairo::drawString(const char *str) cairo_set_font_size(_cr, _currentFontSize); cairo_text_extents_t extent; cairo_text_extents(_cr, str, &extent); - queueString::element elem = {str, pos[0], pos[1], pos[2], color[0], color[1], color[2], color[3], - _currentFontSize, cairo_get_font_face(_cr), (int)ceil(extent.width) + 2, (int)ceil(extent.height) + 2, - extent.x_bearing - 1, extent.y_bearing - 1}; + queueString::element elem = {str, + pos[0], + pos[1], + pos[2], + color[0], + color[1], + color[2], + color[3], + _currentFontSize, + cairo_get_font_face(_cr), + (int)ceil(extent.width) + 2, + (int)ceil(extent.height) + 2, + extent.x_bearing - 1, + extent.y_bearing - 1}; cairo_font_face_reference(elem.fontFace); _queue->append(elem); } @@ -203,34 +211,38 @@ drawContextFltkCairo::drawContextFltkCairo() void drawContextFltkCairo::setFont(int fontid, int fontsize) { - if (_currentFontId != fontid) { - switch (fontid) { - case FL_HELVETICA : - case FL_HELVETICA_BOLD : - case FL_HELVETICA_BOLD_ITALIC : - case FL_HELVETICA_ITALIC : - cairo_select_font_face(_cr, "sans", - fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, - fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); - break; - case FL_COURIER : - case FL_COURIER_BOLD : - case FL_COURIER_BOLD_ITALIC : - case FL_COURIER_ITALIC : - cairo_select_font_face(_cr, "courier", - fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, - fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); - break; - case FL_TIMES : - case FL_TIMES_BOLD : - case FL_TIMES_BOLD_ITALIC : - case FL_TIMES_ITALIC : - cairo_select_font_face(_cr, "serif", - fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, - fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); - break; - default : - cairo_select_font_face(_cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); + if(_currentFontId != fontid) { + switch(fontid) { + case FL_HELVETICA: + case FL_HELVETICA_BOLD: + case FL_HELVETICA_BOLD_ITALIC: + case FL_HELVETICA_ITALIC: + cairo_select_font_face( + _cr, "sans", + fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, + fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); + break; + case FL_COURIER: + case FL_COURIER_BOLD: + case FL_COURIER_BOLD_ITALIC: + case FL_COURIER_ITALIC: + cairo_select_font_face( + _cr, "courier", + fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, + fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); + break; + case FL_TIMES: + case FL_TIMES_BOLD: + case FL_TIMES_BOLD_ITALIC: + case FL_TIMES_ITALIC: + cairo_select_font_face( + _cr, "serif", + fontid & FL_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL, + fontid & FL_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); + break; + default: + cairo_select_font_face(_cr, "sans", CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); } _currentFontId = fontid; } diff --git a/Fltk/drawContextFltkCairo.h b/Fltk/drawContextFltkCairo.h index c3454dd30a43a46db1bb763eacc15acfa1353cc6..b0aed7a8964ad239cb8b99184928a80278d41057 100644 --- a/Fltk/drawContextFltkCairo.h +++ b/Fltk/drawContextFltkCairo.h @@ -23,17 +23,18 @@ class drawContextFltkCairo : public drawContextFltk { cairo_t *_cr; int _currentFontId; int _currentFontSize; - public: + +public: void draw(); drawContextFltkCairo(); ~drawContextFltkCairo(); double getStringWidth(const char *str); - //int getStringHeight(); - //int getStringDescent(); + // int getStringHeight(); + // int getStringDescent(); void flushString(); void drawString(const char *str); void setFont(int fontid, int fontsize); - std::string getName(){ return "Cairo"; } + std::string getName() { return "Cairo"; } }; #endif diff --git a/Fltk/drawContextFltkStringTexture.cpp b/Fltk/drawContextFltkStringTexture.cpp index 11470c180aebc3cbf78e2175c0b2db8b13a8c03e..f432373735c0cde8c49dd471a021a171fef606c2 100644 --- a/Fltk/drawContextFltkStringTexture.cpp +++ b/Fltk/drawContextFltkStringTexture.cpp @@ -14,7 +14,7 @@ #endif class drawContextFltkStringTexture::queueString { - public : +public: typedef struct { std::string text; GLfloat x, y, z; @@ -24,11 +24,11 @@ class drawContextFltkStringTexture::queueString { int height; } element; - private: +private: std::vector<element> _elements; int _totalWidth, _maxHeight; - public: +public: queueString() { _totalWidth = 0; @@ -36,8 +36,7 @@ class drawContextFltkStringTexture::queueString { } void append(const element &elem) { - if (_totalWidth + elem.width > 1000) - flush(); + if(_totalWidth + elem.width > 1000) flush(); _elements.push_back(elem); _totalWidth += elem.width; _maxHeight = std::max(_maxHeight, elem.height); @@ -45,7 +44,7 @@ class drawContextFltkStringTexture::queueString { void flush() { if(_elements.empty()) return; - //1000 should be _totalWidth but it does not work + // 1000 should be _totalWidth but it does not work int w = 1000, h = _maxHeight; Fl_Offscreen offscreen = fl_create_offscreen(w, h); fl_begin_offscreen(offscreen); @@ -53,25 +52,26 @@ class drawContextFltkStringTexture::queueString { fl_rectf(0, 0, w, h); fl_color(255, 255, 255); int pos = 0; - for(std::vector<element>::iterator it = _elements.begin(); it != _elements.end(); ++it) { + for(std::vector<element>::iterator it = _elements.begin(); + it != _elements.end(); ++it) { fl_font(it->fontId, it->fontSize); fl_draw(it->text.c_str(), pos, it->height - fl_descent()); pos += it->width; } uchar *data = fl_read_image(NULL, 0, 0, w, h); - for (int i = 0; i < w * h; ++i) { + for(int i = 0; i < w * h; ++i) { data[i] = data[i * 3]; } fl_end_offscreen(); fl_delete_offscreen(offscreen); - //setup matrices + // setup matrices GLint matrixMode; GLuint textureId; glGetIntegerv(GL_MATRIX_MODE, &matrixMode); glMatrixMode(GL_PROJECTION); glPushMatrix(); - glLoadIdentity (); + glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); @@ -81,10 +81,10 @@ class drawContextFltkStringTexture::queueString { // The size of the QUAD needs to be changed, too. float winw = Fl_Window::current()->w(); float winh = Fl_Window::current()->h(); - glScalef(2.0f / winw, 2.0f / winh, 1.0f); + glScalef(2.0f / winw, 2.0f / winh, 1.0f); glTranslatef(-winw / 2.0f, -winh / 2.0f, 0.0f); - //write the texture on screen + // write the texture on screen glEnable(GL_TEXTURE_RECTANGLE_ARB); glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_COLOR_BUFFER_BIT); glDisable(GL_LIGHTING); @@ -93,19 +93,20 @@ class drawContextFltkStringTexture::queueString { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glGenTextures(1, &textureId); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureId); - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_ALPHA, w, h, 0, - GL_ALPHA, GL_UNSIGNED_BYTE, data); - //glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_SRC0_ALPHA); - //printf("error %i %s\n", __LINE__, gluErrorString(glGetError())); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_ALPHA, w, h, 0, GL_ALPHA, + GL_UNSIGNED_BYTE, data); + // glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_SRC0_ALPHA); + // printf("error %i %s\n", __LINE__, gluErrorString(glGetError())); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); pos = 0; - for(std::vector<element>::iterator it = _elements.begin(); it != _elements.end(); ++it) { + for(std::vector<element>::iterator it = _elements.begin(); + it != _elements.end(); ++it) { glTranslatef(it->x, it->y, it->z); glColor4f(it->r, it->g, it->b, it->alpha); int Lx = it->width; int Ly = it->height; - glBegin (GL_QUADS); + glBegin(GL_QUADS); glTexCoord2f(pos, 0); glVertex2f(0.0f, Ly); glTexCoord2f(pos + Lx, 0); @@ -124,36 +125,40 @@ class drawContextFltkStringTexture::queueString { // reset original matrices glPopMatrix(); // GL_MODELVIEW - glMatrixMode (GL_PROJECTION); + glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(matrixMode); _elements.clear(); _maxHeight = 0; _totalWidth = 0; - delete []data; + delete[] data; } }; -void drawContextFltkStringTexture::flushString() -{ - _queue->flush(); -} +void drawContextFltkStringTexture::flushString() { _queue->flush(); } -//ensure the surface is large enough +// ensure the surface is large enough void drawContextFltkStringTexture::drawString(const char *str) { GLfloat pos[4], color[4]; glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); glGetFloatv(GL_CURRENT_COLOR, color); - queueString::element elem = {str, pos[0], pos[1], pos[2], color[0], color[1], color[2], color[3], - _currentFontSize, _currentFontId, (int)getStringWidth(str) + 1, getStringHeight()}; + queueString::element elem = {str, + pos[0], + pos[1], + pos[2], + color[0], + color[1], + color[2], + color[3], + _currentFontSize, + _currentFontId, + (int)getStringWidth(str) + 1, + getStringHeight()}; _queue->append(elem); } -drawContextFltkStringTexture::~drawContextFltkStringTexture() -{ - delete _queue; -} +drawContextFltkStringTexture::~drawContextFltkStringTexture() { delete _queue; } drawContextFltkStringTexture::drawContextFltkStringTexture() { diff --git a/Fltk/drawContextFltkStringTexture.h b/Fltk/drawContextFltkStringTexture.h index 2f39119bbbbce47f0b15cd61c5200f09c6736709..39b5175adefd00e2de86f84b92407ba8f145364a 100644 --- a/Fltk/drawContextFltkStringTexture.h +++ b/Fltk/drawContextFltkStringTexture.h @@ -10,19 +10,19 @@ #include "drawContextFltk.h" - class drawContextFltkStringTexture : public drawContextFltk { class queueString; queueString *_queue; int _currentFontId; int _currentFontSize; - public: + +public: drawContextFltkStringTexture(); ~drawContextFltkStringTexture(); void flushString(); void drawString(const char *str); void setFont(int fontid, int fontsize); - std::string getName(){ return "StringTexture"; } + std::string getName() { return "StringTexture"; } }; #endif diff --git a/Fltk/extraDialogs.cpp b/Fltk/extraDialogs.cpp index 896bbea94ae1971e4f5b8b67836453de218e4d73..f988582a43d988ec7fcb7ace22d584dff93499ac 100644 --- a/Fltk/extraDialogs.cpp +++ b/Fltk/extraDialogs.cpp @@ -38,17 +38,18 @@ int arrowEditor(const char *title, double &a, double &b, double &c) { - struct _editor{ + struct _editor { Fl_Window *window; Fl_Value_Slider *sa, *sb, *sc; Fl_Button *apply, *cancel; }; static _editor *editor = 0; - if(!editor){ + if(!editor) { editor = new _editor; - editor->window = new paletteWindow - (2 * BB + 3 * WB, 4 * BH + 3 * WB, CTX::instance()->nonModalWindows ? true : false); + editor->window = + new paletteWindow(2 * BB + 3 * WB, 4 * BH + 3 * WB, + CTX::instance()->nonModalWindows ? true : false); editor->sa = new Fl_Value_Slider(WB, WB, BB, BH, "Head radius"); editor->sa->type(FL_HOR_SLIDER); editor->sa->align(FL_ALIGN_RIGHT); @@ -59,7 +60,8 @@ int arrowEditor(const char *title, double &a, double &b, double &c) editor->sc->type(FL_HOR_SLIDER); editor->sc->align(FL_ALIGN_RIGHT); editor->apply = new Fl_Return_Button(WB, 2 * WB + 3 * BH, BB, BH, "Apply"); - editor->cancel = new Fl_Button(2 * WB + BB, 2 * WB + 3 * BH, BB, BH, "Cancel"); + editor->cancel = + new Fl_Button(2 * WB + BB, 2 * WB + 3 * BH, BB, BH, "Cancel"); editor->window->end(); editor->window->hotspot(editor->window); } @@ -70,18 +72,18 @@ int arrowEditor(const char *title, double &a, double &b, double &c) editor->sc->value(c); editor->window->show(); - while(editor->window->shown()){ + while(editor->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == editor->apply) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == editor->apply) { a = editor->sa->value(); b = editor->sb->value(); c = editor->sc->value(); return 1; } - if (o == editor->window || o == editor->cancel){ + if(o == editor->window || o == editor->cancel) { editor->window->hide(); return 0; } @@ -95,15 +97,17 @@ int arrowEditor(const char *title, double &a, double &b, double &c) class historyBrowser : public Fl_Hold_Browser { int handle(int event) { - switch (event) { + switch(event) { case FL_SHORTCUT: case FL_KEYBOARD: - if(Fl::test_shortcut(FL_Delete) || Fl::test_shortcut(FL_BackSpace)){ + if(Fl::test_shortcut(FL_Delete) || Fl::test_shortcut(FL_BackSpace)) { int i = value(); - if(i){ + if(i) { remove(i); - if(i <= size()) select(i); - else if(i > 1) select(i - 1); + if(i <= size()) + select(i); + else if(i > 1) + select(i - 1); } return 1; } @@ -111,24 +115,29 @@ class historyBrowser : public Fl_Hold_Browser { } return Fl_Hold_Browser::handle(event); }; - public: - historyBrowser(int x, int y, int w, int h, const char *l=0) - : Fl_Hold_Browser(x, y, w, h, l) {} + +public: + historyBrowser(int x, int y, int w, int h, const char *l = 0) + : Fl_Hold_Browser(x, y, w, h, l) + { + } }; -class historyChooser{ - private: +class historyChooser { +private: std::string _prefix, _label, _commandLabel, _defaultCommand, _okLabel; - public: + +public: Fl_Double_Window *window; Fl_Input *input; historyBrowser *browser; Fl_Return_Button *ok; Fl_Button *cancel; - public: + +public: historyChooser(const std::string &prefix, const std::string &label, - const std::string &commandLabel, const std::string &defaultCommand, - const std::string &okLabel) + const std::string &commandLabel, + const std::string &defaultCommand, const std::string &okLabel) : _prefix(prefix), _label(label), _commandLabel(commandLabel), _defaultCommand(defaultCommand), _okLabel(okLabel) { @@ -137,23 +146,22 @@ class historyChooser{ window->set_modal(); window->label(_label.c_str()); Fl_Box *b1 = new Fl_Box(WB, WB, w, BH, _commandLabel.c_str()); - b1->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); + b1->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); input = new Fl_Input(WB, WB + BH, w - 2 * WB, BH); Fl_Box *b2 = new Fl_Box(WB, 2 * WB + 2 * BH, w, BH, "History:"); - b2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - browser = new historyBrowser - (WB, 2 * WB + 3 * BH, w - 2 * WB, h - 4 * BH - 4 * WB); - cancel = new Fl_Button - (w - WB - BB, h - WB - BH, BB, BH, "Cancel"); - ok = new Fl_Return_Button - (w - 2 * WB - 2 * BB, h - WB - BH, BB, BH, _okLabel.c_str()); + b2->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + browser = + new historyBrowser(WB, 2 * WB + 3 * BH, w - 2 * WB, h - 4 * BH - 4 * WB); + cancel = new Fl_Button(w - WB - BB, h - WB - BH, BB, BH, "Cancel"); + ok = new Fl_Return_Button(w - 2 * WB - 2 * BB, h - WB - BH, BB, BH, + _okLabel.c_str()); Fl_Box *b3 = new Fl_Box(WB, h - WB - BB, WB, WB); b3->hide(); window->resizable(b3); } void save(Fl_Preferences &prefs) { - for(int i = 0; i < 100; i++){ + for(int i = 0; i < 100; i++) { char name[256]; sprintf(name, "%s%02d", _prefix.c_str(), i); if(i < browser->size()) @@ -177,16 +185,16 @@ class historyChooser{ window->resize(x, y, w, h); int old = browser->value(); browser->clear(); - for (int i = 0; i < 100; i++) { + for(int i = 0; i < 100; i++) { char name[256], value[1024]; sprintf(name, "%s%02d", _prefix.c_str(), i); - if(prefs.entryExists(name)){ + if(prefs.entryExists(name)) { prefs.get(name, value, "", sizeof(value)); browser->add(value); } } int n = browser->size(); - if(n){ + if(n) { if(old > 0 && old <= n) input->value(browser->text(old)); else @@ -195,16 +203,16 @@ class historyChooser{ else input->value(_defaultCommand.c_str()); window->show(); - while(window->shown()){ + while(window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == ok) { - if(strlen(input->value())){ + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == ok) { + if(strlen(input->value())) { // insert choosen value at the top of the history - for(int i = 0; i < browser->size(); i++){ - if(!strcmp(input->value(), browser->text(i + 1))){ + for(int i = 0; i < browser->size(); i++) { + if(!strcmp(input->value(), browser->text(i + 1))) { browser->remove(i + 1); break; } @@ -215,7 +223,7 @@ class historyChooser{ window->hide(); return input->value(); } - if (o == window || o == cancel){ + if(o == window || o == cancel) { save(prefs); window->hide(); return ""; @@ -227,7 +235,7 @@ class historyChooser{ }; static historyChooser *_connectionChooser = 0; -static void connection_select_cb(Fl_Widget* w, void *data) +static void connection_select_cb(Fl_Widget *w, void *data) { int i = _connectionChooser->browser->value(); if(i) _connectionChooser->input->value(_connectionChooser->browser->text(i)); @@ -235,17 +243,17 @@ static void connection_select_cb(Fl_Widget* w, void *data) std::string connectionChooser() { - if(!_connectionChooser){ - _connectionChooser = new historyChooser - ("connection", "Remote Start", "Command:", "./gmsh ../tutorial/view3.pos", - "Run"); + if(!_connectionChooser) { + _connectionChooser = + new historyChooser("connection", "Remote Start", + "Command:", "./gmsh ../tutorial/view3.pos", "Run"); _connectionChooser->browser->callback(connection_select_cb); } return _connectionChooser->run(); } static historyChooser *_patternChooser = 0; -static void pattern_select_cb(Fl_Widget* w, void *data) +static void pattern_select_cb(Fl_Widget *w, void *data) { int i = _patternChooser->browser->value(); if(i) _patternChooser->input->value(_patternChooser->browser->text(i)); @@ -253,23 +261,24 @@ static void pattern_select_cb(Fl_Widget* w, void *data) std::string patternChooser() { - if(!_patternChooser){ - _patternChooser = new historyChooser - ("pattern", "Watch Pattern", "Pattern:", "output/*.msh", "Watch"); + if(!_patternChooser) { + _patternChooser = new historyChooser("pattern", "Watch Pattern", + "Pattern:", "output/*.msh", "Watch"); _patternChooser->browser->callback(pattern_select_cb); } return _patternChooser->run(); } - class cgnsImportDialog { - private: +private: std::string _prefix, _label, _commandLabel, _defaultCommand, _okLabel; - public: + +public: Fl_Double_Window *window; Fl_Return_Button *ok; Fl_Input_Choice *input_choice; - public: + +public: cgnsImportDialog() { _prefix = "cgns"; @@ -278,7 +287,8 @@ class cgnsImportDialog { window->set_modal(); window->label("CGNS import"); - input_choice = new Fl_Input_Choice(WB + 2 * BB, WB, 1*BB, BH, "Import mesh as order"); + input_choice = + new Fl_Input_Choice(WB + 2 * BB, WB, 1 * BB, BH, "Import mesh as order"); ok = new Fl_Return_Button(w - WB - BB, h - WB - BH, BB, BH, "Import"); } @@ -304,33 +314,33 @@ class cgnsImportDialog { int order = 1; input_choice->clear(); char text[128]; - while (order < 5 && order <= order_max && order_max < 10 && order_max > 0) { + while(order < 5 && order <= order_max && order_max < 10 && order_max > 0) { sprintf(text, "%d", order); input_choice->add(text); - order*=2; + order *= 2; } input_choice->value(0); window->show(); - while(window->shown()){ + while(window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == ok) { - const char* str = input_choice->value(); - int order = 1; - if (strcmp("2", str) == 0) - order = 2; - else if (strcmp("4", str) == 0) - order = 4; - //else if (strcmp("8", str) == 0) - // order = 8; + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == ok) { + const char *str = input_choice->value(); + int order = 1; + if(strcmp("2", str) == 0) + order = 2; + else if(strcmp("4", str) == 0) + order = 4; + // else if (strcmp("8", str) == 0) + // order = 8; save(prefs); window->hide(); return order; } - if (o == window){ + if(o == window) { save(prefs); window->hide(); return 1; @@ -341,8 +351,7 @@ class cgnsImportDialog { } }; - -static cgnsImportDialog* _cgnsImport = 0; +static cgnsImportDialog *_cgnsImport = 0; /*static void pattern_select_cb(Fl_Widget* w, void *data) { _cgnsImport->input_choice->value("1"); @@ -350,7 +359,7 @@ static cgnsImportDialog* _cgnsImport = 0; */ int cgnsImport() { - if (!_cgnsImport) { + if(!_cgnsImport) { _cgnsImport = new cgnsImportDialog(); } return _cgnsImport->run(); diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index b2c999e43b70886682f76c0d82d044e0e5effe87..8fe6e6761fcda69387d3983d7dd6c7338fa7573a 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -38,19 +38,18 @@ void field_cb(Fl_Widget *w, void *data) static void field_delete_cb(Fl_Widget *w, void *data) { - Field *f = (Field*)FlGui::instance()->fields->editor_group->user_data(); + Field *f = (Field *)FlGui::instance()->fields->editor_group->user_data(); delete_field(f->id, GModel::current()->getFileName()); FlGui::instance()->fields->editField(NULL); } static void field_new_cb(Fl_Widget *w, void *data) { - Fl_Menu_Button* mb = ((Fl_Menu_Button*)w); + Fl_Menu_Button *mb = ((Fl_Menu_Button *)w); FieldManager *fields = GModel::current()->getFields(); int id = fields->newId(); add_field(id, mb->text(), GModel::current()->getFileName()); - if((*fields)[id]) - FlGui::instance()->fields->editField((*fields)[id]); + if((*fields)[id]) FlGui::instance()->fields->editField((*fields)[id]); } static void field_apply_cb(Fl_Widget *w, void *data) @@ -61,17 +60,17 @@ static void field_apply_cb(Fl_Widget *w, void *data) static void field_browser_cb(Fl_Widget *w, void *data) { int selected = FlGui::instance()->fields->browser->value(); - if(!selected){ + if(!selected) { FlGui::instance()->fields->editField(NULL); } - Field *f = (Field*)FlGui::instance()->fields->browser->data(selected); + Field *f = (Field *)FlGui::instance()->fields->browser->data(selected); FlGui::instance()->fields->editField(f); } static void field_put_on_view_cb(Fl_Widget *w, void *data) { - Fl_Menu_Button* mb = ((Fl_Menu_Button*)w); - Field *field = (Field*)FlGui::instance()->fields->editor_group->user_data(); + Fl_Menu_Button *mb = ((Fl_Menu_Button *)w); + Field *field = (Field *)FlGui::instance()->fields->editor_group->user_data(); if(mb->value() == 0) field->putOnNewView(); else if(mb->value() - 1 < (int)PView::list.size()) @@ -82,15 +81,15 @@ static void field_put_on_view_cb(Fl_Widget *w, void *data) static void field_callback_cb(Fl_Widget *w, void *data) { - FieldCallback *cb = (FieldCallback*) data; + FieldCallback *cb = (FieldCallback *)data; cb->run(); } static void field_select_file_cb(Fl_Widget *w, void *data) { - Fl_Input *input = (Fl_Input*)data; + Fl_Input *input = (Fl_Input *)data; int ret = fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", input->value()); - if(ret){ + if(ret) { input->value(fileChooserGetName(0).c_str()); input->set_changed(); } @@ -102,13 +101,16 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) int width0 = 34 * FL_NORMAL_SIZE + WB; int height0 = 12 * BH + 4 * WB; - int width = (CTX::instance()->fieldSize[0] < width0) ? width0 : - CTX::instance()->fieldSize[0]; - int height = (CTX::instance()->fieldSize[1] < height0) ? height0 : - CTX::instance()->fieldSize[1]; - - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Size fields"); + int width = (CTX::instance()->fieldSize[0] < width0) ? + width0 : + CTX::instance()->fieldSize[0]; + int height = (CTX::instance()->fieldSize[1] < height0) ? + height0 : + CTX::instance()->fieldSize[1]; + + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Size fields"); win->box(GMSH_WINDOW_BOX); int x = WB, y = WB, w = (int)(1.5 * BB), h = height - 2 * WB - 3 * BH; @@ -116,7 +118,7 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) Fl_Menu_Button *new_btn = new Fl_Menu_Button(x, y, w, BH, "New"); FieldManager &fields = *GModel::current()->getFields(); - std::map<std::string, FieldFactory*>::iterator it; + std::map<std::string, FieldFactory *>::iterator it; for(it = fields.map_type_name.begin(); it != fields.map_type_name.end(); it++) new_btn->add(it->first.c_str()); new_btn->callback(field_new_cb); @@ -137,7 +139,8 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) y = WB; w = width - x - WB; h = height - y - WB; - empty_message = new Fl_Box(x, y, w, h, "Create a new field\n\n" + empty_message = new Fl_Box(x, y, w, h, + "Create a new field\n\n" "- or -\n\nSelect a field in the browser"); empty_message->align(FL_ALIGN_CENTER); @@ -149,7 +152,7 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) y += BH + WB; h -= BH + WB; - Fl_Tabs *tabs = new Fl_Tabs(x, y , w, h); + Fl_Tabs *tabs = new Fl_Tabs(x, y, w, h); y += BH; h -= BH; x += WB; @@ -160,14 +163,15 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) options_scroll = new Fl_Scroll(x, y + WB, w, h - BH - 3 * WB); options_scroll->end(); - Fl_Button *apply_btn = new Fl_Return_Button - (x + w - BB, y + h - BH - WB, BB, BH, "Apply"); + Fl_Button *apply_btn = + new Fl_Return_Button(x + w - BB, y + h - BH - WB, BB, BH, "Apply"); apply_btn->callback(field_apply_cb, this); - background_btn = new Fl_Round_Button - (x, y + h - BH - WB, w - BB - WB, BH, "Set as background field"); - background_btn->tooltip("Only a single field can be set as background field.\n" - "To combine multiple fields use the Min or Max fields."); + background_btn = new Fl_Round_Button(x, y + h - BH - WB, w - BB - WB, BH, + "Set as background field"); + background_btn->tooltip( + "Only a single field can be set as background field.\n" + "To combine multiple fields use the Min or Max fields."); options_tab->end(); Fl_Group *help_tab = new Fl_Group(x, y, w, h, "Help"); @@ -189,7 +193,8 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) width - 9 * WB - 5 * BB, height - 3 * BH - 5 * WB)); win->size_range(width0, height0); - win->position(CTX::instance()->fieldPosition[0], CTX::instance()->fieldPosition[1]); + win->position(CTX::instance()->fieldPosition[0], + CTX::instance()->fieldPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -213,96 +218,92 @@ void fieldWindow::loadFieldViewList() void fieldWindow::loadFieldList() { FieldManager &fields = *GModel::current()->getFields(); - Field *selected_field = (Field*)editor_group->user_data(); + Field *selected_field = (Field *)editor_group->user_data(); browser->clear(); int i_entry = 0; - for(FieldManager::iterator it = fields.begin(); it != fields.end(); it++){ + for(FieldManager::iterator it = fields.begin(); it != fields.end(); it++) { i_entry++; Field *field = it->second; std::ostringstream sstream; - if(it->first == fields.getBackgroundField()) - sstream << "@b"; + if(it->first == fields.getBackgroundField()) sstream << "@b"; sstream << it->first << " " << field->getName(); browser->add(sstream.str().c_str(), field); - if(it->second == selected_field) - browser->select(i_entry); + if(it->second == selected_field) browser->select(i_entry); } } void fieldWindow::saveFieldOptions() { - std::list<Fl_Widget*>::iterator input = options_widget.begin(); - Field *f = (Field*)editor_group->user_data(); + std::list<Fl_Widget *>::iterator input = options_widget.begin(); + Field *f = (Field *)editor_group->user_data(); std::ostringstream sstream; int i; char a; double d; sstream.precision(16); - for(std::map<std::string, FieldOption*>::iterator it = f->options.begin(); - it != f->options.end(); it++){ + for(std::map<std::string, FieldOption *>::iterator it = f->options.begin(); + it != f->options.end(); it++) { FieldOption *option = it->second; sstream.str(""); - switch(option->getType()){ + switch(option->getType()) { case FIELD_OPTION_STRING: case FIELD_OPTION_PATH: - sstream << "\"" << ((Fl_Input*)*input)->value() << "\""; + sstream << "\"" << ((Fl_Input *)*input)->value() << "\""; break; case FIELD_OPTION_INT: - sstream << (int)((Fl_Value_Input*)*input)->value(); + sstream << (int)((Fl_Value_Input *)*input)->value(); break; case FIELD_OPTION_DOUBLE: - sstream << ((Fl_Value_Input*)*input)->value(); + sstream << ((Fl_Value_Input *)*input)->value(); break; case FIELD_OPTION_BOOL: - sstream << (bool)((Fl_Check_Button*)*input)->value(); + sstream << (bool)((Fl_Check_Button *)*input)->value(); break; - case FIELD_OPTION_LIST: - { - sstream << "{"; - std::istringstream istream(((Fl_Input*)*input)->value()); - while(istream >> i){ - sstream << i; - if(istream >> a){ - if(a != ',') - Msg::Error("Unexpected character \'%c\' while parsing option " - "'%s' of field \'%d\'", a, it->first.c_str(), f->id); - sstream << ", "; - } + case FIELD_OPTION_LIST: { + sstream << "{"; + std::istringstream istream(((Fl_Input *)*input)->value()); + while(istream >> i) { + sstream << i; + if(istream >> a) { + if(a != ',') + Msg::Error("Unexpected character \'%c\' while parsing option " + "'%s' of field \'%d\'", + a, it->first.c_str(), f->id); + sstream << ", "; } - sstream << "}"; } - break; - case FIELD_OPTION_LIST_DOUBLE: - { - sstream << "{"; - std::istringstream istream(((Fl_Input*)*input)->value()); - while(istream >> d){ - sstream << d; - if(istream >> a){ - if(a != ',') - Msg::Error("Unexpected character \'%c\' while parsing option " - "'%s' of field \'%d\'", a, it->first.c_str(), f->id); - sstream << ", "; - } + sstream << "}"; + } break; + case FIELD_OPTION_LIST_DOUBLE: { + sstream << "{"; + std::istringstream istream(((Fl_Input *)*input)->value()); + while(istream >> d) { + sstream << d; + if(istream >> a) { + if(a != ',') + Msg::Error("Unexpected character \'%c\' while parsing option " + "'%s' of field \'%d\'", + a, it->first.c_str(), f->id); + sstream << ", "; } - sstream << "}"; } - break; + sstream << "}"; + } break; } - if((*input)->changed()){ - add_field_option - (f->id, it->first, sstream.str(), GModel::current()->getFileName()); + if((*input)->changed()) { + add_field_option(f->id, it->first, sstream.str(), + GModel::current()->getFileName()); (*input)->clear_changed(); } input++; } int is_bg_field = background_btn->value(); FieldManager &fields = *GModel::current()->getFields(); - if(is_bg_field && fields.getBackgroundField() != f->id){ + if(is_bg_field && fields.getBackgroundField() != f->id) { set_background_field(f->id, GModel::current()->getFileName()); loadFieldList(); } - if(!is_bg_field && fields.getBackgroundField() == f->id){ + if(!is_bg_field && fields.getBackgroundField() == f->id) { set_background_field(-1, GModel::current()->getFileName()); loadFieldList(); } @@ -310,52 +311,51 @@ void fieldWindow::saveFieldOptions() void fieldWindow::loadFieldOptions() { - Field *f = (Field*)editor_group->user_data(); - std::list<Fl_Widget*>::iterator input = options_widget.begin(); - for(std::map<std::string, FieldOption*>::iterator it = f->options.begin(); - it != f->options.end(); it++){ + Field *f = (Field *)editor_group->user_data(); + std::list<Fl_Widget *>::iterator input = options_widget.begin(); + for(std::map<std::string, FieldOption *>::iterator it = f->options.begin(); + it != f->options.end(); it++) { FieldOption *option = it->second; std::ostringstream vstr; std::list<int>::const_iterator list_it; std::list<double>::const_iterator listdouble_it; - switch(option->getType()){ + switch(option->getType()) { case FIELD_OPTION_STRING: case FIELD_OPTION_PATH: - ((Fl_Input*)(*input))->value(option->string().c_str()); + ((Fl_Input *)(*input))->value(option->string().c_str()); break; case FIELD_OPTION_INT: case FIELD_OPTION_DOUBLE: - ((Fl_Value_Input*)(*input))->value(option->numericalValue()); + ((Fl_Value_Input *)(*input))->value(option->numericalValue()); break; case FIELD_OPTION_BOOL: - ((Fl_Check_Button*)(*input))->value((int)option->numericalValue()); + ((Fl_Check_Button *)(*input))->value((int)option->numericalValue()); break; case FIELD_OPTION_LIST: vstr.str(""); for(list_it = option->list().begin(); list_it != option->list().end(); - list_it++){ - if(list_it!=option->list().begin()) - vstr << ", "; + list_it++) { + if(list_it != option->list().begin()) vstr << ", "; vstr << *list_it; } - ((Fl_Input*)(*input))->value(vstr.str().c_str()); + ((Fl_Input *)(*input))->value(vstr.str().c_str()); break; case FIELD_OPTION_LIST_DOUBLE: vstr.str(""); vstr.precision(16); - for(listdouble_it = option->listdouble().begin(); listdouble_it != option->listdouble().end(); - listdouble_it++){ - if(listdouble_it!=option->listdouble().begin()) - vstr << ", "; + for(listdouble_it = option->listdouble().begin(); + listdouble_it != option->listdouble().end(); listdouble_it++) { + if(listdouble_it != option->listdouble().begin()) vstr << ", "; vstr << *listdouble_it; } - ((Fl_Input*)(*input))->value(vstr.str().c_str()); + ((Fl_Input *)(*input))->value(vstr.str().c_str()); break; } (*input)->clear_changed(); input++; } - background_btn->value(GModel::current()->getFields()->getBackgroundField() == f->id); + background_btn->value(GModel::current()->getFields()->getBackgroundField() == + f->id); } void fieldWindow::editField(Field *f) @@ -363,7 +363,7 @@ void fieldWindow::editField(Field *f) editor_group->user_data(f); put_on_view_btn->deactivate(); delete_btn->deactivate(); - if(f == NULL){ + if(f == NULL) { selected_id = -1; editor_group->hide(); empty_message->show(); @@ -386,15 +386,15 @@ void fieldWindow::editField(Field *f) std::string help = f->getDescription(); ConvertToHTML(help); - if (! f->options.empty()) + if(!f->options.empty()) help += std::string("<p><center><b>Options</b></center>"); - for(std::map<std::string, FieldOption*>::iterator it = f->options.begin(); - it != f->options.end(); it++){ + for(std::map<std::string, FieldOption *>::iterator it = f->options.begin(); + it != f->options.end(); it++) { Fl_Widget *input; help += std::string("<p><b>") + it->first + "</b>"; help += " (<em>" + it->second->getTypeName() + "</em>): "; help += it->second->getDescription(); - switch(it->second->getType()){ + switch(it->second->getType()) { case FIELD_OPTION_INT: case FIELD_OPTION_DOUBLE: input = new Fl_Value_Input(xx, yy, IW, BH, it->first.c_str()); @@ -404,15 +404,13 @@ void fieldWindow::editField(Field *f) input = new Fl_Check_Button(xx, yy, 2 * BB, BH, it->first.c_str()); input->type(FL_TOGGLE_BUTTON); break; - case FIELD_OPTION_PATH: - { - input = new Fl_Input(xx, yy, IW, BH, it->first.c_str()); - input->align(FL_ALIGN_RIGHT); - int tw = (int)fl_width(it->first.c_str()); - Fl_Button *b = new Fl_Button(xx + IW + tw + 2 * WB, yy, BB, BH, "Choose"); - b->callback(field_select_file_cb, input); - } - break; + case FIELD_OPTION_PATH: { + input = new Fl_Input(xx, yy, IW, BH, it->first.c_str()); + input->align(FL_ALIGN_RIGHT); + int tw = (int)fl_width(it->first.c_str()); + Fl_Button *b = new Fl_Button(xx + IW + tw + 2 * WB, yy, BB, BH, "Choose"); + b->callback(field_select_file_cb, input); + } break; case FIELD_OPTION_STRING: input = new Fl_Input(xx, yy, IW, BH, it->first.c_str()); input->align(FL_ALIGN_RIGHT); @@ -427,10 +425,11 @@ void fieldWindow::editField(Field *f) options_widget.push_back(input); yy += BH; } - if (! f->callbacks.empty()) + if(!f->callbacks.empty()) help += std::string("<p><center><b>Actions</b></center>"); - for(std::map<std::string, FieldCallback*>::iterator it = f->callbacks.begin(); - it != f->callbacks.end(); it++){ + for(std::map<std::string, FieldCallback *>::iterator it = + f->callbacks.begin(); + it != f->callbacks.end(); it++) { Fl_Widget *btn; help += std::string("<p><b>") + it->first + "</b>: "; help += it->second->getDescription(); diff --git a/Fltk/fieldWindow.h b/Fltk/fieldWindow.h index a8727436ee2109eeb5b122ca11ca988a3098d3c1..5aafd0280ef185984576bd3760764d2b127795e9 100644 --- a/Fltk/fieldWindow.h +++ b/Fltk/fieldWindow.h @@ -19,13 +19,14 @@ class Field; -class fieldWindow{ - private: +class fieldWindow { +private: int _deltaFontSize; - public: + +public: Fl_Window *win; Fl_Hold_Browser *browser; - std::list<Fl_Widget*> options_widget; + std::list<Fl_Widget *> options_widget; Fl_Scroll *options_scroll; Fl_Group *editor_group; Fl_Box *title, *empty_message; @@ -34,8 +35,9 @@ class fieldWindow{ Fl_Help_View *help_display; Fl_Button *delete_btn; int selected_id; - public: - fieldWindow(int deltaFontSize=0); + +public: + fieldWindow(int deltaFontSize = 0); void loadFieldViewList(); void loadFieldList(); void saveFieldOptions(); diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 5c865540a2b1c89e6d420ae56744f185f4666466..78d24b4af0180b93c3871f171d8a911bd793988a 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -53,38 +53,57 @@ class flFileChooser : public Fl_File_Chooser { // chooser doesn't expose its window to the world, so we need to use // a cheap hack to get to it. Even worse is the hack used to get the // focus on the file input widget.) - private: +private: Fl_Window *_win; Fl_File_Input *_in; - public: + +public: flFileChooser(const char *d, const char *p, int t, const char *title) : Fl_File_Chooser(d, p, t, title) { - _win = dynamic_cast<Fl_Window*>(newButton->parent()->parent()); - _in = dynamic_cast<Fl_File_Input *>(previewButton->parent()->parent()->resizable()); + _win = dynamic_cast<Fl_Window *>(newButton->parent()->parent()); + _in = dynamic_cast<Fl_File_Input *>( + previewButton->parent()->parent()->resizable()); } void show() { - if(_win){ + if(_win) { _win->show(); rescan(); // necessary since fltk 1.1.7 - if(_in) _in->take_focus(); - else _win->take_focus(); + if(_in) + _in->take_focus(); + else + _win->take_focus(); } else Fl_File_Chooser::show(); } - void position(int x, int y){ if(_win) _win->position(x,y); } - int x(){ if(_win) return _win->x(); else return 100; } - int y(){ if(_win) return _win->y(); else return 100; } + void position(int x, int y) + { + if(_win) _win->position(x, y); + } + int x() + { + if(_win) + return _win->x(); + else + return 100; + } + int y() + { + if(_win) + return _win->y(); + else + return 100; + } }; static flFileChooser *fc = 0; #endif -int fileChooser(FILE_CHOOSER_TYPE type, const char *message, - const char *filter, const char *fname) +int fileChooser(FILE_CHOOSER_TYPE type, const char *message, const char *filter, + const char *fname) { static char thefilter[1024] = ""; static int thefilterindex = 0; @@ -99,8 +118,9 @@ int fileChooser(FILE_CHOOSER_TYPE type, const char *message, std::string thepath; if(fname) thepath = std::string(fname); - else{ - std::vector<std::string> tmp = SplitFileName(GModel::current()->getFileName()); + else { + std::vector<std::string> tmp = + SplitFileName(GModel::current()->getFileName()); thepath = tmp[0] + tmp[1]; // i.e., without the extension! } std::vector<std::string> split = SplitFileName(thepath); @@ -108,37 +128,43 @@ int fileChooser(FILE_CHOOSER_TYPE type, const char *message, #if defined(HAVE_NATIVE_FILE_CHOOSER) if(!fc) fc = new Fl_Native_File_Chooser(); - switch(type){ + switch(type) { case FILE_CHOOSER_MULTI: - fc->type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); break; + fc->type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); + break; case FILE_CHOOSER_CREATE: - fc->type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE); break; + fc->type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE); + break; case FILE_CHOOSER_DIRECTORY: - fc->type(Fl_Native_File_Chooser::BROWSE_DIRECTORY); break; - default: - fc->type(Fl_Native_File_Chooser::BROWSE_FILE); break; + fc->type(Fl_Native_File_Chooser::BROWSE_DIRECTORY); + break; + default: fc->type(Fl_Native_File_Chooser::BROWSE_FILE); break; } fc->title(message); fc->filter(filter); fc->filter_value(thefilterindex); static bool first = true; - if(first){ + if(first) { // preset the path and the file only the first time in a given // session. Afterwards, always reuse the last directory fc->preset_file(thepath.c_str()); first = false; } - else{ + else { std::string name = split[1] + split[2]; fc->preset_file(name.c_str()); } int ret = 0; switch(fc->show()) { - case -1: break; // error - case 1: break; // cancel - default: if(fc->filename()) ret = fc->count(); break; + case -1: + break; // error + case 1: + break; // cancel + default: + if(fc->filename()) ret = fc->count(); + break; } thefilterindex = fc->filter_value(); // hack to clear the KEYDOWN state that remains when calling the @@ -149,32 +175,29 @@ int fileChooser(FILE_CHOOSER_TYPE type, const char *message, Fl_File_Chooser::show_label = "Format:"; Fl_File_Chooser::all_files_label = "All files (*)"; if(!fc) { - fc = new flFileChooser(getenv("PWD") ? "." : CTX::instance()->homeDir.c_str(), - thefilter, Fl_File_Chooser::SINGLE, message); + fc = + new flFileChooser(getenv("PWD") ? "." : CTX::instance()->homeDir.c_str(), + thefilter, Fl_File_Chooser::SINGLE, message); fc->position(CTX::instance()->fileChooserPosition[0], CTX::instance()->fileChooserPosition[1]); } - switch(type){ - case FILE_CHOOSER_MULTI: - fc->type(Fl_File_Chooser::MULTI); break; - case FILE_CHOOSER_CREATE: - fc->type(Fl_File_Chooser::CREATE); break; - case FILE_CHOOSER_DIRECTORY: - fc->type(Fl_File_Chooser::DIRECTORY); break; - default: - fc->type(Fl_File_Chooser::SINGLE); break; + switch(type) { + case FILE_CHOOSER_MULTI: fc->type(Fl_File_Chooser::MULTI); break; + case FILE_CHOOSER_CREATE: fc->type(Fl_File_Chooser::CREATE); break; + case FILE_CHOOSER_DIRECTORY: fc->type(Fl_File_Chooser::DIRECTORY); break; + default: fc->type(Fl_File_Chooser::SINGLE); break; } fc->label(message); fc->filter(thefilter); fc->filter_value(thefilterindex); static bool first = true; - if(first){ + if(first) { // preset the path and the file only the first time in a given // session. Afterwards, always reuse the last directory fc->value(thepath.c_str()); first = false; } - else{ + else { std::string name = split[1] + split[2]; fc->value(name.c_str()); } @@ -217,7 +240,7 @@ void fileChooserGetPosition(int *x, int *y) int genericBitmapFileDialog(const char *name, const char *title, int format) { - struct _genericBitmapFileDialog{ + struct _genericBitmapFileDialog { Fl_Window *window; Fl_Value_Slider *s[2]; Fl_Check_Button *b[3]; @@ -226,39 +249,44 @@ int genericBitmapFileDialog(const char *name, const char *title, int format) }; static _genericBitmapFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _genericBitmapFileDialog; int h = 3 * WB + 7 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print text strings"); y += BH; + dialog->b[0] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print text strings"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print background"); y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print background"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Composite all window tiles"); y += BH; + dialog->b[2] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Composite all window tiles"); + y += BH; dialog->b[2]->type(FL_TOGGLE_BUTTON); - dialog->v[0] = new Fl_Value_Input - (WB, y, BB / 2, BH); + dialog->v[0] = new Fl_Value_Input(WB, y, BB / 2, BH); dialog->v[0]->minimum(-1); dialog->v[0]->maximum(5000); dialog->v[0]->step(1); - dialog->v[1] = new Fl_Value_Input - (WB + BB / 2, y, BB - BB / 2, BH, "Dimensions"); y += BH; + dialog->v[1] = + new Fl_Value_Input(WB + BB / 2, y, BB - BB / 2, BH, "Dimensions"); + y += BH; dialog->v[1]->minimum(-1); dialog->v[1]->maximum(5000); dialog->v[1]->step(1); dialog->v[1]->align(FL_ALIGN_RIGHT); - dialog->s[0] = new Fl_Value_Slider(WB, y, BB, BH, "Quality"); y += BH; + dialog->s[0] = new Fl_Value_Slider(WB, y, BB, BH, "Quality"); + y += BH; dialog->s[0]->type(FL_HOR_SLIDER); dialog->s[0]->align(FL_ALIGN_RIGHT); dialog->s[0]->minimum(1); dialog->s[0]->maximum(100); dialog->s[0]->step(1); - dialog->s[1] = new Fl_Value_Slider(WB, y, BB, BH, "Smoothing"); y += BH; + dialog->s[1] = new Fl_Value_Slider(WB, y, BB, BH, "Smoothing"); + y += BH; dialog->s[1]->type(FL_HOR_SLIDER); dialog->s[1]->align(FL_ALIGN_RIGHT); dialog->s[1]->minimum(0); @@ -270,11 +298,11 @@ int genericBitmapFileDialog(const char *name, const char *title, int format) dialog->window->hotspot(dialog->window); } - if(format == FORMAT_JPEG){ + if(format == FORMAT_JPEG) { dialog->s[0]->activate(); dialog->s[1]->activate(); } - else{ + else { dialog->s[0]->deactivate(); dialog->s[1]->deactivate(); } @@ -289,24 +317,28 @@ int genericBitmapFileDialog(const char *name, const char *title, int format) dialog->v[1]->value(CTX::instance()->print.height); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_print_jpeg_quality(0, GMSH_SET | GMSH_GUI, (int)dialog->s[0]->value()); - opt_print_jpeg_smoothing(0, GMSH_SET | GMSH_GUI, (int)dialog->s[1]->value()); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_print_jpeg_quality(0, GMSH_SET | GMSH_GUI, + (int)dialog->s[0]->value()); + opt_print_jpeg_smoothing(0, GMSH_SET | GMSH_GUI, + (int)dialog->s[1]->value()); opt_print_text(0, GMSH_SET | GMSH_GUI, (int)dialog->b[0]->value()); - opt_print_background(0, GMSH_SET | GMSH_GUI, (int)dialog->b[1]->value()); - opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, (int)dialog->b[2]->value()); + opt_print_background(0, GMSH_SET | GMSH_GUI, + (int)dialog->b[1]->value()); + opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, + (int)dialog->b[2]->value()); opt_print_width(0, GMSH_SET | GMSH_GUI, (int)dialog->v[0]->value()); opt_print_height(0, GMSH_SET | GMSH_GUI, (int)dialog->v[1]->value()); CreateOutputFile(name, format); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -319,7 +351,7 @@ int genericBitmapFileDialog(const char *name, const char *title, int format) int pgfBitmapFileDialog(const char *name, const char *title, int format) { - struct _pgfBitmapFileDialog{ + struct _pgfBitmapFileDialog { Fl_Window *window; Fl_Value_Slider *s[2]; Fl_Check_Button *b[3]; @@ -328,28 +360,30 @@ int pgfBitmapFileDialog(const char *name, const char *title, int format) }; static _pgfBitmapFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _pgfBitmapFileDialog; int h = 3 * WB + 5 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Flat graphics"); y += BH; + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Flat graphics"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Export axis (for entire fig)"); y += BH; + dialog->b[1] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, + "Export axis (for entire fig)"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Horizontal colorbar"); y += BH; + dialog->b[2] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Horizontal colorbar"); + y += BH; dialog->b[2]->type(FL_TOGGLE_BUTTON); - dialog->v[0] = new Fl_Value_Input - (WB, y, BB / 2, BH); + dialog->v[0] = new Fl_Value_Input(WB, y, BB / 2, BH); dialog->v[0]->minimum(-1); dialog->v[0]->maximum(5000); dialog->v[0]->step(1); - dialog->v[1] = new Fl_Value_Input - (WB + BB / 2, y, BB - BB / 2, BH, "Dimensions"); y += BH; + dialog->v[1] = + new Fl_Value_Input(WB + BB / 2, y, BB - BB / 2, BH, "Dimensions"); + y += BH; dialog->v[1]->minimum(-1); dialog->v[1]->maximum(5000); dialog->v[1]->step(1); @@ -368,25 +402,30 @@ int pgfBitmapFileDialog(const char *name, const char *title, int format) dialog->v[1]->value(CTX::instance()->print.height); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { opt_print_text(0, GMSH_SET | GMSH_GUI, 0); // never print any text - opt_print_pgf_two_dim(0, GMSH_SET | GMSH_GUI, (int)dialog->b[0]->value()); - opt_print_background(0, GMSH_SET | GMSH_GUI, 0); // never print background - opt_print_pgf_export_axis(0, GMSH_SET | GMSH_GUI, (int)dialog->b[1]->value()); - opt_print_pgf_horiz_bar(0, GMSH_SET | GMSH_GUI, (int)dialog->b[2]->value()); - opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, 0); // never do compositing print + opt_print_pgf_two_dim(0, GMSH_SET | GMSH_GUI, + (int)dialog->b[0]->value()); + opt_print_background(0, GMSH_SET | GMSH_GUI, + 0); // never print background + opt_print_pgf_export_axis(0, GMSH_SET | GMSH_GUI, + (int)dialog->b[1]->value()); + opt_print_pgf_horiz_bar(0, GMSH_SET | GMSH_GUI, + (int)dialog->b[2]->value()); + opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, + 0); // never do compositing print opt_print_width(0, GMSH_SET | GMSH_GUI, (int)dialog->v[0]->value()); opt_print_height(0, GMSH_SET | GMSH_GUI, (int)dialog->v[1]->value()); CreateOutputFile(name, format); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -399,21 +438,22 @@ int pgfBitmapFileDialog(const char *name, const char *title, int format) int latexFileDialog(const char *name) { - struct _latexFileDialog{ + struct _latexFileDialog { Fl_Window *window; Fl_Check_Button *b; Fl_Button *ok, *cancel; }; static _latexFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _latexFileDialog; int h = 3 * WB + 2 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "LaTeX Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print strings as equations"); y += BH; + dialog->b = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print strings as equations"); + y += BH; dialog->b->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel"); @@ -424,18 +464,19 @@ int latexFileDialog(const char *name) dialog->b->value(CTX::instance()->print.texAsEquation); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_print_tex_as_equation(0, GMSH_SET | GMSH_GUI, (int)dialog->b->value()); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_print_tex_as_equation(0, GMSH_SET | GMSH_GUI, + (int)dialog->b->value()); CreateOutputFile(name, FORMAT_TEX); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -448,7 +489,7 @@ int latexFileDialog(const char *name) int mpegFileDialog(const char *name) { - struct _mpegFileDialog{ + struct _mpegFileDialog { Fl_Window *window; Fl_Round_Button *b[3]; Fl_Group *param; @@ -460,7 +501,7 @@ int mpegFileDialog(const char *name) }; static _mpegFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _mpegFileDialog; int h = 4 * WB + 11 * BH, w = 3 * BB + 4 * WB, y = WB; int ww = w - 2 * WB; @@ -469,14 +510,16 @@ int mpegFileDialog(const char *name) dialog->window->set_non_modal(); { Fl_Group *o = new Fl_Group(WB, y, ww, 3 * BH); - dialog->b[0] = new Fl_Round_Button - (WB, y, ww, BH, "Cycle through time steps"); y += BH; + dialog->b[0] = + new Fl_Round_Button(WB, y, ww, BH, "Cycle through time steps"); + y += BH; dialog->b[0]->type(FL_RADIO_BUTTON); - dialog->b[1] = new Fl_Round_Button - (WB, y, ww, BH, "Cycle through views"); y += BH; + dialog->b[1] = new Fl_Round_Button(WB, y, ww, BH, "Cycle through views"); + y += BH; dialog->b[1]->type(FL_RADIO_BUTTON); - dialog->b[2] = new Fl_Round_Button - (WB, y, ww, BH, "Loop over print parameter value"); y += BH; + dialog->b[2] = + new Fl_Round_Button(WB, y, ww, BH, "Loop over print parameter value"); + y += BH; dialog->b[2]->type(FL_RADIO_BUTTON); o->end(); } @@ -484,14 +527,14 @@ int mpegFileDialog(const char *name) int ww2 = (2 * BB + WB) / 4; dialog->param = new Fl_Group(WB, y, ww, 2 * BH); - dialog->p = new Fl_Input(WB, y, ww, BH); y += BH; + dialog->p = new Fl_Input(WB, y, ww, BH); + y += BH; dialog->p->align(FL_ALIGN_RIGHT); - dialog->v[2] = new Fl_Value_Input(WB, y, ww2, BH); dialog->v[3] = new Fl_Value_Input(WB + ww2, y, ww2, BH); - dialog->v[4] = new Fl_Value_Input(WB + 2 * ww2, y, 2 * BB + WB - 3 * ww2, BH, - "First / Last / Steps"); + dialog->v[4] = new Fl_Value_Input(WB + 2 * ww2, y, 2 * BB + WB - 3 * ww2, + BH, "First / Last / Steps"); dialog->v[4]->align(FL_ALIGN_RIGHT); dialog->v[4]->minimum(1); dialog->v[4]->maximum(500); @@ -501,31 +544,33 @@ int mpegFileDialog(const char *name) y += WB; - dialog->v[0] = new Fl_Value_Input - (WB, y, ww2, BH, "Frame duration (in seconds)"); y += BH; + dialog->v[0] = + new Fl_Value_Input(WB, y, ww2, BH, "Frame duration (in seconds)"); + y += BH; dialog->v[0]->minimum(1. / 30.); dialog->v[0]->maximum(2.); dialog->v[0]->step(1. / 30.); dialog->v[0]->precision(3); dialog->v[0]->align(FL_ALIGN_RIGHT); - dialog->v[1] = new Fl_Value_Input - (WB, y, ww2, BH, "Steps between frames"); y += BH; + dialog->v[1] = new Fl_Value_Input(WB, y, ww2, BH, "Steps between frames"); + y += BH; dialog->v[1]->minimum(1); dialog->v[1]->maximum(100); dialog->v[1]->step(1); dialog->v[1]->align(FL_ALIGN_RIGHT); - dialog->c[0] = new Fl_Check_Button - (WB, y, ww, BH, "Print background"); y += BH; + dialog->c[0] = new Fl_Check_Button(WB, y, ww, BH, "Print background"); + y += BH; dialog->c[0]->type(FL_TOGGLE_BUTTON); - dialog->c[1] = new Fl_Check_Button - (WB, y, ww, BH, "Composite all window tiles"); y += BH; + dialog->c[1] = + new Fl_Check_Button(WB, y, ww, BH, "Composite all window tiles"); + y += BH; dialog->c[1]->type(FL_TOGGLE_BUTTON); - dialog->c[2] = new Fl_Check_Button - (WB, y, ww, BH, "Delete temporary files"); y += BH; + dialog->c[2] = new Fl_Check_Button(WB, y, ww, BH, "Delete temporary files"); + y += BH; dialog->c[2]->type(FL_TOGGLE_BUTTON); dialog->buttons = new Fl_Group(WB, y + WB, ww, BH); @@ -558,39 +603,45 @@ int mpegFileDialog(const char *name) dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->b[0] || o == dialog->b[1] || o == dialog->b[2]) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->b[0] || o == dialog->b[1] || o == dialog->b[2]) { if(dialog->b[2]->value()) dialog->param->activate(); else dialog->param->deactivate(); } - if (o == dialog->ok || o == dialog->preview) { - opt_post_anim_cycle(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value() ? 2 : - dialog->b[1]->value() ? 1 : 0); + if(o == dialog->ok || o == dialog->preview) { + opt_post_anim_cycle( + 0, GMSH_SET | GMSH_GUI, + dialog->b[2]->value() ? 2 : dialog->b[1]->value() ? 1 : 0); opt_print_parameter_command(0, GMSH_SET | GMSH_GUI, dialog->p->value()); - opt_print_parameter_first(0, GMSH_SET | GMSH_GUI, dialog->v[2]->value()); + opt_print_parameter_first(0, GMSH_SET | GMSH_GUI, + dialog->v[2]->value()); opt_print_parameter_last(0, GMSH_SET | GMSH_GUI, dialog->v[3]->value()); - opt_print_parameter_steps(0, GMSH_SET | GMSH_GUI, dialog->v[4]->value()); + opt_print_parameter_steps(0, GMSH_SET | GMSH_GUI, + dialog->v[4]->value()); opt_post_anim_delay(0, GMSH_SET | GMSH_GUI, dialog->v[0]->value()); opt_post_anim_step(0, GMSH_SET | GMSH_GUI, (int)dialog->v[1]->value()); - opt_print_background(0, GMSH_SET | GMSH_GUI, (int)dialog->c[0]->value()); - opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, (int)dialog->c[1]->value()); - opt_print_delete_tmp_files(0, GMSH_SET | GMSH_GUI, (int)dialog->c[2]->value()); + opt_print_background(0, GMSH_SET | GMSH_GUI, + (int)dialog->c[0]->value()); + opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, + (int)dialog->c[1]->value()); + opt_print_delete_tmp_files(0, GMSH_SET | GMSH_GUI, + (int)dialog->c[2]->value()); int format = (o == dialog->preview) ? FORMAT_MPEG_PREVIEW : FORMAT_MPEG; dialog->buttons->deactivate(); CreateOutputFile(name, format, o == dialog->ok, true); dialog->buttons->activate(); - if(o == dialog->ok){ + if(o == dialog->ok) { dialog->window->hide(); return 1; } } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -603,34 +654,38 @@ int mpegFileDialog(const char *name) int gifFileDialog(const char *name) { - struct _gifFileDialog{ + struct _gifFileDialog { Fl_Window *window; Fl_Check_Button *b[7]; Fl_Button *ok, *cancel; }; static _gifFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _gifFileDialog; int h = 3 * WB + 8 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "GIF Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Dither"); y += BH; - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Interlace"); y += BH; - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Sort colormap"); y += BH; - dialog->b[3] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Transparent background"); y += BH; - dialog->b[4] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print text strings"); y += BH; - dialog->b[5] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print background"); y += BH; - dialog->b[6] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Composite all window tiles"); y += BH; - for(int i = 0; i < 7; i++){ + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Dither"); + y += BH; + dialog->b[1] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Interlace"); + y += BH; + dialog->b[2] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Sort colormap"); + y += BH; + dialog->b[3] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Transparent background"); + y += BH; + dialog->b[4] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print text strings"); + y += BH; + dialog->b[5] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print background"); + y += BH; + dialog->b[6] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Composite all window tiles"); + y += BH; + for(int i = 0; i < 7; i++) { dialog->b[i]->type(FL_TOGGLE_BUTTON); } dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); @@ -648,24 +703,26 @@ int gifFileDialog(const char *name) dialog->b[6]->value(CTX::instance()->print.compositeWindows); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { opt_print_gif_dither(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value()); opt_print_gif_interlace(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value()); opt_print_gif_sort(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value()); - opt_print_gif_transparent(0, GMSH_SET | GMSH_GUI, dialog->b[3]->value()); + opt_print_gif_transparent(0, GMSH_SET | GMSH_GUI, + dialog->b[3]->value()); opt_print_text(0, GMSH_SET | GMSH_GUI, dialog->b[4]->value()); opt_print_background(0, GMSH_SET | GMSH_GUI, dialog->b[5]->value()); - opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, dialog->b[6]->value()); + opt_print_composite_windows(0, GMSH_SET | GMSH_GUI, + dialog->b[6]->value()); CreateOutputFile(name, FORMAT_GIF); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -676,14 +733,15 @@ int gifFileDialog(const char *name) // Save ps/eps/pdf dialog -static void activate_gl2ps_choices(int format, int quality, Fl_Check_Button *b[5]) +static void activate_gl2ps_choices(int format, int quality, + Fl_Check_Button *b[5]) { #if defined(HAVE_LIBZ) b[0]->activate(); #else b[0]->deactivate(); #endif - switch(quality){ + switch(quality) { case 0: // raster b[1]->deactivate(); b[2]->deactivate(); @@ -711,7 +769,7 @@ static void activate_gl2ps_choices(int format, int quality, Fl_Check_Button *b[5 int gl2psFileDialog(const char *name, const char *title, int format) { - struct _gl2psFileDialog{ + struct _gl2psFileDialog { Fl_Window *window; Fl_Check_Button *b[6]; Fl_Choice *c; @@ -719,36 +777,40 @@ int gl2psFileDialog(const char *name, const char *title, int format) }; static _gl2psFileDialog *dialog = NULL; - static Fl_Menu_Item sortmenu[] = { - {"Raster image", 0, 0, 0}, - {"Vector simple sort", 0, 0, 0}, - {"Vector accurate sort", 0, 0, 0}, - {"Vector unsorted", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item sortmenu[] = {{"Raster image", 0, 0, 0}, + {"Vector simple sort", 0, 0, 0}, + {"Vector accurate sort", 0, 0, 0}, + {"Vector unsorted", 0, 0, 0}, + {0}}; - if(!dialog){ + if(!dialog) { dialog = new _gl2psFileDialog; int h = 3 * WB + 8 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c = new Fl_Choice(WB, y, BB + WB + BB / 2, BH, "Type"); y += BH; + dialog->c = new Fl_Choice(WB, y, BB + WB + BB / 2, BH, "Type"); + y += BH; dialog->c->menu(sortmenu); dialog->c->align(FL_ALIGN_RIGHT); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Compress"); y += BH; - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Remove hidden primitives"); y += BH; - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Optimize BSP tree"); y += BH; - dialog->b[3] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Use level 3 shading"); y += BH; - dialog->b[4] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print text strings"); y += BH; - dialog->b[5] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print background"); y += BH; - for(int i = 0; i < 6; i++){ + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Compress"); + y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Remove hidden primitives"); + y += BH; + dialog->b[2] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Optimize BSP tree"); + y += BH; + dialog->b[3] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Use level 3 shading"); + y += BH; + dialog->b[4] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print text strings"); + y += BH; + dialog->b[5] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print background"); + y += BH; + for(int i = 0; i < 6; i++) { dialog->b[i]->type(FL_TOGGLE_BUTTON); } dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); @@ -770,19 +832,20 @@ int gl2psFileDialog(const char *name, const char *title, int format) dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; - if (o == dialog->c){ + if(o == dialog->c) { activate_gl2ps_choices(format, dialog->c->value(), dialog->b); } - if (o == dialog->ok) { + if(o == dialog->ok) { opt_print_eps_quality(0, GMSH_SET | GMSH_GUI, dialog->c->value()); opt_print_eps_compress(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value()); - opt_print_eps_occlusion_culling(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value()); + opt_print_eps_occlusion_culling(0, GMSH_SET | GMSH_GUI, + dialog->b[1]->value()); opt_print_eps_best_root(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value()); opt_print_eps_ps3shading(0, GMSH_SET | GMSH_GUI, dialog->b[3]->value()); opt_print_text(0, GMSH_SET | GMSH_GUI, dialog->b[4]->value()); @@ -791,7 +854,7 @@ int gl2psFileDialog(const char *name, const char *title, int format) dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -804,25 +867,27 @@ int gl2psFileDialog(const char *name, const char *title, int format) int optionsFileDialog(const char *name) { - struct _optionsFileDialog{ + struct _optionsFileDialog { Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; static _optionsFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _optionsFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Save only modified options"); y += BH; + dialog->b[0] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save only modified options"); + y += BH; dialog->b[0]->value(1); dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Print help strings"); y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Print help strings"); + y += BH; dialog->b[1]->value(0); dialog->b[1]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); @@ -833,19 +898,20 @@ int optionsFileDialog(const char *name) dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { Msg::StatusBar(true, "Writing '%s'...", name); - PrintOptions(0, GMSH_FULLRC, dialog->b[0]->value(), dialog->b[1]->value(), name); + PrintOptions(0, GMSH_FULLRC, dialog->b[0]->value(), + dialog->b[1]->value(), name); Msg::StatusBar(true, "Done writing '%s'", name); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -858,24 +924,26 @@ int optionsFileDialog(const char *name) int geoFileDialog(const char *name) { - struct _geoFileDialog{ + struct _geoFileDialog { Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; }; static _geoFileDialog *dialog = NULL; - if(!dialog){ + if(!dialog) { dialog = new _geoFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "GEO Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Save physical group labels"); y += BH; + dialog->b[0] = + new Fl_Check_Button(WB, y, 2 * BB + WB, BH, "Save physical group labels"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BB + WB, BH, "Only save physical entities"); y += BH; + dialog->b[1] = new Fl_Check_Button(WB, y, 2 * BB + WB, BH, + "Only save physical entities"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BB, y + WB, BB, BH, "Cancel"); @@ -887,19 +955,21 @@ int geoFileDialog(const char *name) dialog->b[1]->value(CTX::instance()->print.geoOnlyPhysicals ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_print_geo_labels(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0); - opt_print_geo_only_physicals(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value() ? 1 : 0); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_print_geo_labels(0, GMSH_SET | GMSH_GUI, + dialog->b[0]->value() ? 1 : 0); + opt_print_geo_only_physicals(0, GMSH_SET | GMSH_GUI, + dialog->b[1]->value() ? 1 : 0); CreateOutputFile(name, FORMAT_GEO); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -910,7 +980,7 @@ int geoFileDialog(const char *name) int meshStatFileDialog(const char *name) { - struct _meshStatFileDialog{ + struct _meshStatFileDialog { Fl_Window *window; Fl_Check_Button *b[8]; Fl_Button *ok, *cancel; @@ -919,30 +989,37 @@ int meshStatFileDialog(const char *name) int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _meshStatFileDialog; int h = 3 * WB + 9 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "POS Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save all (ignore physical groups)"); y += BH; - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print elementary tags"); y += BH; - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print element numbers"); y += BH; - dialog->b[3] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print SICN quality measure"); y += BH; - dialog->b[4] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print SIGE quality measure"); y += BH; - dialog->b[5] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print Gamma quality measure"); y += BH; - dialog->b[6] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print Eta quality measure"); y += BH; - dialog->b[7] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Print Disto quality measure"); y += BH; - for(int i = 0; i < 6; i++) - dialog->b[i]->type(FL_TOGGLE_BUTTON); + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save all (ignore physical groups)"); + y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Print elementary tags"); + y += BH; + dialog->b[2] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Print element numbers"); + y += BH; + dialog->b[3] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Print SICN quality measure"); + y += BH; + dialog->b[4] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Print SIGE quality measure"); + y += BH; + dialog->b[5] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Print Gamma quality measure"); + y += BH; + dialog->b[6] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Print Eta quality measure"); + y += BH; + dialog->b[7] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Print Disto quality measure"); + y += BH; + for(int i = 0; i < 6; i++) dialog->b[i]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); dialog->window->end(); @@ -958,27 +1035,33 @@ int meshStatFileDialog(const char *name) dialog->b[6]->value(CTX::instance()->print.posEta ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0); - opt_print_pos_elementary(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value() ? 1 : 0); - opt_print_pos_element(0, GMSH_SET | GMSH_GUI, dialog->b[2]->value() ? 1 : 0); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, + dialog->b[0]->value() ? 1 : 0); + opt_print_pos_elementary(0, GMSH_SET | GMSH_GUI, + dialog->b[1]->value() ? 1 : 0); + opt_print_pos_element(0, GMSH_SET | GMSH_GUI, + dialog->b[2]->value() ? 1 : 0); opt_print_pos_SICN(0, GMSH_SET | GMSH_GUI, dialog->b[3]->value() ? 1 : 0); opt_print_pos_SIGE(0, GMSH_SET | GMSH_GUI, dialog->b[4]->value() ? 1 : 0); - opt_print_pos_gamma(0, GMSH_SET | GMSH_GUI, dialog->b[5]->value() ? 1 : 0); - opt_print_pos_eta(0, GMSH_SET | GMSH_GUI, dialog->b[6]->value() ? 1 : 0); - opt_print_pos_disto(0, GMSH_SET | GMSH_GUI, dialog->b[7]->value() ? 1 : 0); + opt_print_pos_gamma(0, GMSH_SET | GMSH_GUI, + dialog->b[5]->value() ? 1 : 0); + opt_print_pos_eta(0, GMSH_SET | GMSH_GUI, + dialog->b[6]->value() ? 1 : 0); + opt_print_pos_disto(0, GMSH_SET | GMSH_GUI, + dialog->b[7]->value() ? 1 : 0); CreateOutputFile(name, FORMAT_POS); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -988,7 +1071,7 @@ int meshStatFileDialog(const char *name) } // Save msh dialog -struct _mshFileDialog{ +struct _mshFileDialog { Fl_Window *window; Fl_Check_Button *b[4]; Fl_Choice *c; @@ -1007,32 +1090,36 @@ int mshFileDialog(const char *name) {"Version 3 Binary (Experimental)", 0, 0, 0}, {"Version 4 ASCII (Experimental)", 0, 0, 0}, {"Version 4 Binary (Experimental)", 0, 0, 0}, - {0} - }; + {0}}; int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _mshFileDialog; int h = 3 * WB + 6 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "MSH Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "Format"); y += BH; + dialog->c = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "Format"); + y += BH; dialog->c->menu(formatmenu); dialog->c->align(FL_ALIGN_RIGHT); dialog->c->callback((Fl_Callback *)format_cb, dialog); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save all (ignore physical groups)"); y += BH; + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save all (ignore physical groups)"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save parametric coordinates"); y += BH; + dialog->b[1] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save parametric coordinates"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); - dialog->b[2] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save one file per partition"); y += BH; + dialog->b[2] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save one file per partition"); + y += BH; dialog->b[2]->type(FL_TOGGLE_BUTTON); - dialog->b[3] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save partition topology file"); y += BH; + dialog->b[3] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save partition topology file"); + y += BH; dialog->b[3]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); @@ -1053,28 +1140,30 @@ int mshFileDialog(const char *name) dialog->b[1]->value(CTX::instance()->mesh.saveParametric ? 1 : 0); dialog->b[2]->value(CTX::instance()->mesh.partitionSplitMeshFiles ? 1 : 0); dialog->b[3]->value(CTX::instance()->mesh.partitionSaveTopologyFile ? 1 : 0); - if(GModel::current()->getNumPartitions() == 0) - { + if(GModel::current()->getNumPartitions() == 0) { dialog->b[2]->deactivate(); dialog->b[3]->deactivate(); } dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_mesh_msh_file_version - (0, GMSH_SET | GMSH_GUI, - (dialog->c->value() == 0) ? 1.0 : - (dialog->c->value() == 1 || dialog->c->value() == 2) ? 2.2 : - (dialog->c->value() == 3 || dialog->c->value() == 4) ? 3.0 : 4.0); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_mesh_msh_file_version( + 0, GMSH_SET | GMSH_GUI, + (dialog->c->value() == 0) ? + 1.0 : + (dialog->c->value() == 1 || dialog->c->value() == 2) ? + 2.2 : + (dialog->c->value() == 3 || dialog->c->value() == 4) ? 3.0 : 4.0); opt_mesh_binary(0, GMSH_SET | GMSH_GUI, - (dialog->c->value() == 2 || - dialog->c->value() == 4 || - dialog->c->value() == 6) ? 1 : 0); + (dialog->c->value() == 2 || dialog->c->value() == 4 || + dialog->c->value() == 6) ? + 1 : + 0); opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0); opt_mesh_save_parametric(0, GMSH_SET | GMSH_GUI, @@ -1087,7 +1176,7 @@ int mshFileDialog(const char *name) dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1098,15 +1187,15 @@ int mshFileDialog(const char *name) void format_cb(Fl_Widget *widget, void *data) { - _mshFileDialog *dialog = static_cast<_mshFileDialog*>(data); + _mshFileDialog *dialog = static_cast<_mshFileDialog *>(data); if((dialog->c->value() == 5 || dialog->c->value() == 6 || dialog->c->value() == 3 || dialog->c->value() == 4 || dialog->c->value() == 1 || dialog->c->value() == 2) && - GModel::current()->getNumPartitions() > 0){ + GModel::current()->getNumPartitions() > 0) { dialog->b[2]->activate(); dialog->b[3]->activate(); } - else{ + else { dialog->b[2]->deactivate(); dialog->b[3]->deactivate(); } @@ -1116,7 +1205,7 @@ void format_cb(Fl_Widget *widget, void *data) int unvinpFileDialog(const char *name, const char *title, int format) { - struct _unvFileDialog{ + struct _unvFileDialog { Fl_Window *window; Fl_Check_Button *b[2]; Fl_Button *ok, *cancel; @@ -1125,17 +1214,19 @@ int unvinpFileDialog(const char *name, const char *title, int format) int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _unvFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, title); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save all (ignore physical groups)"); y += BH; + dialog->b[0] = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save all (ignore physical groups)"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save groups of nodes"); y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Save groups of nodes"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); @@ -1147,20 +1238,21 @@ int unvinpFileDialog(const char *name, const char *title, int format) dialog->b[1]->value(CTX::instance()->mesh.saveGroupsOfNodes ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b[0]->value() ? 1 : 0); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, + dialog->b[0]->value() ? 1 : 0); opt_mesh_save_groups_of_nodes(0, GMSH_SET | GMSH_GUI, dialog->b[1]->value() ? 1 : 0); CreateOutputFile(name, format); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1173,7 +1265,7 @@ int unvinpFileDialog(const char *name, const char *title, int format) int keyFileDialog(const char *name, const char *title, int format) { - struct _keyFileDialog{ + struct _keyFileDialog { Fl_Window *window; Fl_Choice *c[3]; Fl_Check_Button *b[2]; @@ -1181,49 +1273,48 @@ int keyFileDialog(const char *name, const char *title, int format) }; static _keyFileDialog *dialog = NULL; - static Fl_Menu_Item beammenu[] = { - {"Physical groups", 0, 0, 0}, - {"Save all", 0, 0, 0}, - {"Ignore", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item beammenu[] = {{"Physical groups", 0, 0, 0}, + {"Save all", 0, 0, 0}, + {"Ignore", 0, 0, 0}, + {0}}; - static Fl_Menu_Item shellmenu[] = { - {"Physical groups", 0, 0, 0}, - {"Save all", 0, 0, 0}, - {"Ignore", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item shellmenu[] = {{"Physical groups", 0, 0, 0}, + {"Save all", 0, 0, 0}, + {"Ignore", 0, 0, 0}, + {0}}; - static Fl_Menu_Item solidmenu[] = { - {"Physical groups", 0, 0, 0}, - {"Save all", 0, 0, 0}, - {"Ignore", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item solidmenu[] = {{"Physical groups", 0, 0, 0}, + {"Save all", 0, 0, 0}, + {"Ignore", 0, 0, 0}, + {0}}; int BBB = BB + 16; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _keyFileDialog; int h = 3 * WB + 6 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, title); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Line"); y += BH; + dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Line"); + y += BH; dialog->c[0]->menu(beammenu); dialog->c[0]->align(FL_ALIGN_RIGHT); - dialog->c[1] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Surface"); y += BH; + dialog->c[1] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Surface"); + y += BH; dialog->c[1]->menu(shellmenu); dialog->c[1]->align(FL_ALIGN_RIGHT); - dialog->c[2] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Volume"); y += BH; + dialog->c[2] = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Volume"); + y += BH; dialog->c[2]->menu(solidmenu); dialog->c[2]->align(FL_ALIGN_RIGHT); - dialog->b[0] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save groups of elements"); y += BH; + dialog->b[0] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Save groups of elements"); + y += BH; dialog->b[0]->type(FL_TOGGLE_BUTTON); - dialog->b[1] = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save groups of nodes"); y += BH; + dialog->b[1] = + new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, "Save groups of nodes"); + y += BH; dialog->b[1]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); @@ -1231,34 +1322,37 @@ int keyFileDialog(const char *name, const char *title, int format) dialog->window->hotspot(dialog->window); } - dialog->c[0]->value((CTX::instance()->mesh.saveAll & 4) ? 1 : - (CTX::instance()->mesh.saveAll & 8) ? 2 : 0); - dialog->c[1]->value((CTX::instance()->mesh.saveAll & 16) ? 1 : - (CTX::instance()->mesh.saveAll & 32) ? 2 : 0); - dialog->c[2]->value((CTX::instance()->mesh.saveAll & 64) ? 1 : - (CTX::instance()->mesh.saveAll &128) ? 2 : 0); + dialog->c[0]->value((CTX::instance()->mesh.saveAll & 4) ? + 1 : + (CTX::instance()->mesh.saveAll & 8) ? 2 : 0); + dialog->c[1]->value((CTX::instance()->mesh.saveAll & 16) ? + 1 : + (CTX::instance()->mesh.saveAll & 32) ? 2 : 0); + dialog->c[2]->value((CTX::instance()->mesh.saveAll & 64) ? + 1 : + (CTX::instance()->mesh.saveAll & 128) ? 2 : 0); dialog->b[0]->value(CTX::instance()->mesh.saveGroupsOfNodes & 2 ? 1 : 0); dialog->b[1]->value(CTX::instance()->mesh.saveGroupsOfNodes & 1 ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, - dialog->c[0]->value()*4+ - dialog->c[1]->value()*16+ - dialog->c[2]->value()*64); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, + dialog->c[0]->value() * 4 + + dialog->c[1]->value() * 16 + + dialog->c[2]->value() * 64); opt_mesh_save_groups_of_nodes(0, GMSH_SET | GMSH_GUI, - (dialog->b[0]->value() ? 2 : 0)+ - (dialog->b[1]->value() ? 1 : 0)); + (dialog->b[0]->value() ? 2 : 0) + + (dialog->b[1]->value() ? 1 : 0)); CreateOutputFile(name, format); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1271,7 +1365,7 @@ int keyFileDialog(const char *name, const char *title, int format) int bdfFileDialog(const char *name) { - struct _bdfFileDialog{ + struct _bdfFileDialog { Fl_Window *window; Fl_Choice *c, *d; Fl_Check_Button *b; @@ -1279,36 +1373,35 @@ int bdfFileDialog(const char *name) }; static _bdfFileDialog *dialog = NULL; - static Fl_Menu_Item formatmenu[] = { - {"Free field", 0, 0, 0}, - {"Small field", 0, 0, 0}, - {"Long field", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item formatmenu[] = {{"Free field", 0, 0, 0}, + {"Small field", 0, 0, 0}, + {"Long field", 0, 0, 0}, + {0}}; - static Fl_Menu_Item tagmenu[] = { - {"Elementary entity", 0, 0, 0}, - {"Physical entity", 0, 0, 0}, - {"Partition", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item tagmenu[] = {{"Elementary entity", 0, 0, 0}, + {"Physical entity", 0, 0, 0}, + {"Partition", 0, 0, 0}, + {0}}; int BBB = BB + 16; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _bdfFileDialog; int h = 3 * WB + 4 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "BDF Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Format"); y += BH; + dialog->c = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Format"); + y += BH; dialog->c->menu(formatmenu); dialog->c->align(FL_ALIGN_RIGHT); - dialog->d = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Element tag"); y += BH; + dialog->d = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Element tag"); + y += BH; dialog->d->menu(tagmenu); dialog->d->align(FL_ALIGN_RIGHT); - dialog->b = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save all (ignore physical groups)"); y += BH; + dialog->b = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save all (ignore physical groups)"); + y += BH; dialog->b->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); @@ -1317,17 +1410,18 @@ int bdfFileDialog(const char *name) } dialog->c->value(CTX::instance()->mesh.bdfFieldFormat); - dialog->d->value((CTX::instance()->mesh.saveElementTagType == 3) ? 2 : - (CTX::instance()->mesh.saveElementTagType == 2) ? 1 : 0); + dialog->d->value((CTX::instance()->mesh.saveElementTagType == 3) ? + 2 : + (CTX::instance()->mesh.saveElementTagType == 2) ? 1 : 0); dialog->b->value(CTX::instance()->mesh.saveAll ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { opt_mesh_bdf_field_format(0, GMSH_SET | GMSH_GUI, dialog->c->value()); opt_mesh_save_element_tag_type(0, GMSH_SET | GMSH_GUI, dialog->d->value() + 1); @@ -1336,7 +1430,7 @@ int bdfFileDialog(const char *name) dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1350,7 +1444,7 @@ int bdfFileDialog(const char *name) int genericMeshFileDialog(const char *name, const char *title, int format, bool binary_support, bool element_tag_support) { - struct _genericMeshFileDialog{ + struct _genericMeshFileDialog { Fl_Window *window; Fl_Choice *c, *d; Fl_Check_Button *b; @@ -1359,34 +1453,32 @@ int genericMeshFileDialog(const char *name, const char *title, int format, static _genericMeshFileDialog *dialog = NULL; static Fl_Menu_Item formatmenu[] = { - {"ASCII", 0, 0, 0}, - {"Binary", 0, 0, 0}, - {0} - }; + {"ASCII", 0, 0, 0}, {"Binary", 0, 0, 0}, {0}}; - static Fl_Menu_Item tagmenu[] = { - {"Elementary entity", 0, 0, 0}, - {"Physical entity", 0, 0, 0}, - {"Partition", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item tagmenu[] = {{"Elementary entity", 0, 0, 0}, + {"Physical entity", 0, 0, 0}, + {"Partition", 0, 0, 0}, + {0}}; int BBB = BB + 16; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _genericMeshFileDialog; int h = 3 * WB + 4 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Format"); y += BH; + dialog->c = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Format"); + y += BH; dialog->c->menu(formatmenu); dialog->c->align(FL_ALIGN_RIGHT); - dialog->d = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Element tag"); y += BH; + dialog->d = new Fl_Choice(WB, y, BBB + BBB / 4, BH, "Element tag"); + y += BH; dialog->d->menu(tagmenu); dialog->d->align(FL_ALIGN_RIGHT); - dialog->b = new Fl_Check_Button - (WB, y, 2 * BBB + WB, BH, "Save all (ignore physical groups)"); y += BH; + dialog->b = new Fl_Check_Button(WB, y, 2 * BBB + WB, BH, + "Save all (ignore physical groups)"); + y += BH; dialog->b->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); @@ -1400,8 +1492,9 @@ int genericMeshFileDialog(const char *name, const char *title, int format, dialog->c->activate(); else dialog->c->deactivate(); - dialog->d->value((CTX::instance()->mesh.saveElementTagType == 3) ? 2 : - (CTX::instance()->mesh.saveElementTagType == 2) ? 1 : 0); + dialog->d->value((CTX::instance()->mesh.saveElementTagType == 3) ? + 2 : + (CTX::instance()->mesh.saveElementTagType == 2) ? 1 : 0); if(element_tag_support) dialog->d->activate(); else @@ -1409,12 +1502,12 @@ int genericMeshFileDialog(const char *name, const char *title, int format, dialog->b->value(CTX::instance()->mesh.saveAll ? 1 : 0); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { opt_mesh_binary(0, GMSH_SET | GMSH_GUI, dialog->c->value()); opt_mesh_save_element_tag_type(0, GMSH_SET | GMSH_GUI, dialog->d->value() + 1); @@ -1423,7 +1516,7 @@ int genericMeshFileDialog(const char *name, const char *title, int format, dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1434,33 +1527,33 @@ int genericMeshFileDialog(const char *name, const char *title, int format, // POS format post-processing export dialog -static void _saveViews(const std::string &name, int which, int format, bool canAppend) +static void _saveViews(const std::string &name, int which, int format, + bool canAppend) { - if(PView::list.empty()){ + if(PView::list.empty()) { Msg::Error("No views to save"); } - else if(which == 0){ + else if(which == 0) { int iview = FlGui::instance()->options->view.index; - if(iview < 0 || iview >= (int)PView::list.size()){ + if(iview < 0 || iview >= (int)PView::list.size()) { Msg::Info("No or invalid current view: saving View[0]"); iview = 0; } PView::list[iview]->write(name, format); } - else if(which == 1){ + else if(which == 1) { int numVisible = 0; for(unsigned int i = 0; i < PView::list.size(); i++) - if(PView::list[i]->getOptions()->visible) - numVisible++; - if(!numVisible){ + if(PView::list[i]->getOptions()->visible) numVisible++; + if(!numVisible) { Msg::Error("No visible view"); } - else{ + else { bool first = true; - for(unsigned int i = 0; i < PView::list.size(); i++){ - if(PView::list[i]->getOptions()->visible){ + for(unsigned int i = 0; i < PView::list.size(); i++) { + if(PView::list[i]->getOptions()->visible) { std::string fileName = name; - if(!canAppend && numVisible > 1){ + if(!canAppend && numVisible > 1) { std::ostringstream os; os << "_" << i; fileName += os.str(); @@ -1471,10 +1564,10 @@ static void _saveViews(const std::string &name, int which, int format, bool canA } } } - else{ - for(unsigned int i = 0; i < PView::list.size(); i++){ + else { + for(unsigned int i = 0; i < PView::list.size(); i++) { std::string fileName = name; - if(!canAppend && PView::list.size() > 1){ + if(!canAppend && PView::list.size() > 1) { std::ostringstream os; os << "_" << i; fileName += os.str(); @@ -1486,7 +1579,7 @@ static void _saveViews(const std::string &name, int which, int format, bool canA int posFileDialog(const char *name) { - struct _posFileDialog{ + struct _posFileDialog { Fl_Window *window; Fl_Choice *c[2]; Fl_Button *ok, *cancel; @@ -1494,31 +1587,27 @@ int posFileDialog(const char *name) static _posFileDialog *dialog = NULL; static Fl_Menu_Item viewmenu[] = { - {"Current", 0, 0, 0}, - {"Visible", 0, 0, 0}, - {"All", 0, 0, 0}, - {0} - }; - static Fl_Menu_Item formatmenu[] = { - {"Parsed", 0, 0, 0}, - {"Mesh-based", 0, 0, 0}, - {"Legacy ASCII", 0, 0, 0}, - {"Legacy Binary", 0, 0, 0}, - {0} - }; + {"Current", 0, 0, 0}, {"Visible", 0, 0, 0}, {"All", 0, 0, 0}, {0}}; + static Fl_Menu_Item formatmenu[] = {{"Parsed", 0, 0, 0}, + {"Mesh-based", 0, 0, 0}, + {"Legacy ASCII", 0, 0, 0}, + {"Legacy Binary", 0, 0, 0}, + {0}}; int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _posFileDialog; int h = 3 * WB + 3 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "POS Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); y += BH; + dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); + y += BH; dialog->c[0]->menu(viewmenu); dialog->c[0]->align(FL_ALIGN_RIGHT); - dialog->c[1] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "Format"); y += BH; + dialog->c[1] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "Format"); + y += BH; dialog->c[1]->menu(formatmenu); dialog->c[1]->align(FL_ALIGN_RIGHT); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); @@ -1529,14 +1618,14 @@ int posFileDialog(const char *name) dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { int format = 2; - switch(dialog->c[1]->value()){ + switch(dialog->c[1]->value()) { case 0: format = 2; break; case 1: format = 5; break; case 2: format = 0; break; @@ -1547,7 +1636,7 @@ int posFileDialog(const char *name) dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1556,64 +1645,64 @@ int posFileDialog(const char *name) return 0; } -static void _saveAdaptedViews(const std::string &name, int useDefaultName, int which, - bool isBinary, int adaptLev, double adaptErr, int npart, - bool canAppend) +static void _saveAdaptedViews(const std::string &name, int useDefaultName, + int which, bool isBinary, int adaptLev, + double adaptErr, int npart, bool canAppend) { - if(PView::list.empty()){ + if(PView::list.empty()) { Msg::Error("No views to save"); } - else if(which == 0){ + else if(which == 0) { int iview = FlGui::instance()->options->view.index; - if(iview < 0 || iview >= (int)PView::list.size()){ + if(iview < 0 || iview >= (int)PView::list.size()) { Msg::Info("No or invalid current view: saving View[0]"); iview = 0; } PView::list[iview]->writeAdapt(name, useDefaultName, isBinary, adaptLev, adaptErr, npart); } - else if(which == 1){ + else if(which == 1) { int numVisible = 0; for(unsigned int i = 0; i < PView::list.size(); i++) - if(PView::list[i]->getOptions()->visible) - numVisible++; - if(!numVisible){ - Msg::Error("No visible view"); - } - else{ - bool first = true; - for(unsigned int i = 0; i < PView::list.size(); i++){ - if(PView::list[i]->getOptions()->visible){ - std::string fileName = name; - if(!canAppend && numVisible > 1){ - std::ostringstream os; - os << "_" << i; - fileName += os.str(); - } - PView::list[i]->writeAdapt(fileName, useDefaultName, isBinary, adaptLev, adaptErr, - npart, first ? false : canAppend); - first = false; + if(PView::list[i]->getOptions()->visible) numVisible++; + if(!numVisible) { + Msg::Error("No visible view"); + } + else { + bool first = true; + for(unsigned int i = 0; i < PView::list.size(); i++) { + if(PView::list[i]->getOptions()->visible) { + std::string fileName = name; + if(!canAppend && numVisible > 1) { + std::ostringstream os; + os << "_" << i; + fileName += os.str(); } + PView::list[i]->writeAdapt(fileName, useDefaultName, isBinary, + adaptLev, adaptErr, npart, + first ? false : canAppend); + first = false; } } + } } - else{ - for(unsigned int i = 0; i < PView::list.size(); i++){ + else { + for(unsigned int i = 0; i < PView::list.size(); i++) { std::string fileName = name; - if(!canAppend && PView::list.size() > 1){ + if(!canAppend && PView::list.size() > 1) { std::ostringstream os; os << "_" << i; fileName += os.str(); } - PView::list[i]->writeAdapt(fileName, useDefaultName, isBinary, adaptLev, adaptErr, - npart, i ? canAppend : false); + PView::list[i]->writeAdapt(fileName, useDefaultName, isBinary, adaptLev, + adaptErr, npart, i ? canAppend : false); } } } int pvtuAdaptFileDialog(const char *name) { - struct _pvtuAdaptFileDialog{ + struct _pvtuAdaptFileDialog { Fl_Window *window; Fl_Choice *c[2]; Fl_Button *ok, *cancel, *push[2]; @@ -1623,34 +1712,29 @@ int pvtuAdaptFileDialog(const char *name) static _pvtuAdaptFileDialog *dialog = NULL; static Fl_Menu_Item viewmenu[] = { - {"Current", 0, 0, 0}, - {"Visible", 0, 0, 0}, - {"All", 0, 0, 0}, - {0} - }; + {"Current", 0, 0, 0}, {"Visible", 0, 0, 0}, {"All", 0, 0, 0}, {0}}; static Fl_Menu_Item formatmenu[] = { - {"Binary", 0, 0, 0}, - {"ASCII", 0, 0, 0}, - {0} - }; + {"Binary", 0, 0, 0}, {"ASCII", 0, 0, 0}, {0}}; int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _pvtuAdaptFileDialog; int h = 7 * BH + 3 * WB, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h, "Adaptive View Options"); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c[0] = new Fl_Choice(WB, y, BB, BH, "View(s)"); y += BH; + dialog->c[0] = new Fl_Choice(WB, y, BB, BH, "View(s)"); + y += BH; dialog->c[0]->menu(viewmenu); dialog->c[0]->align(FL_ALIGN_RIGHT); - dialog->c[1] = new Fl_Choice(WB, y, BB, BH, "Format"); y += BH; + dialog->c[1] = new Fl_Choice(WB, y, BB, BH, "Format"); + y += BH; dialog->c[1]->menu(formatmenu); dialog->c[1]->align(FL_ALIGN_RIGHT); - dialog->vi[0] = new Fl_Value_Input - (WB, y, BB, BH, "Recursion level"); y += BH; + dialog->vi[0] = new Fl_Value_Input(WB, y, BB, BH, "Recursion level"); + y += BH; dialog->vi[0]->align(FL_ALIGN_RIGHT); dialog->vi[0]->minimum(0); dialog->vi[0]->maximum(6); @@ -1658,8 +1742,8 @@ int pvtuAdaptFileDialog(const char *name) dialog->vi[0]->value(1); dialog->vi[0]->when(FL_WHEN_RELEASE); - dialog->vi[1] = new Fl_Value_Input - (WB, y, BB, BH, "Target error"); y += BH; + dialog->vi[1] = new Fl_Value_Input(WB, y, BB, BH, "Target error"); + y += BH; dialog->vi[1]->align(FL_ALIGN_RIGHT); dialog->vi[1]->minimum(-1.e-4); dialog->vi[1]->maximum(0.1); @@ -1667,8 +1751,8 @@ int pvtuAdaptFileDialog(const char *name) dialog->vi[1]->value(-1.e-4); dialog->vi[1]->when(FL_WHEN_RELEASE); - dialog->vi[2] = new Fl_Value_Input - (WB, y, BB, BH, "Number of parts"); y += BH; + dialog->vi[2] = new Fl_Value_Input(WB, y, BB, BH, "Number of parts"); + y += BH; dialog->vi[2]->align(FL_ALIGN_RIGHT); dialog->vi[2]->minimum(1); dialog->vi[2]->maximum(262144); @@ -1676,8 +1760,9 @@ int pvtuAdaptFileDialog(const char *name) dialog->vi[2]->value(4); dialog->vi[2]->when(FL_WHEN_RELEASE); - dialog->defautName = new Fl_Check_Button - (WB, y, w - 2 * WB, BH, "Use default filename"); y += BH; + dialog->defautName = + new Fl_Check_Button(WB, y, w - 2 * WB, BH, "Use default filename"); + y += BH; dialog->defautName->value(1); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); @@ -1688,16 +1773,16 @@ int pvtuAdaptFileDialog(const char *name) dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { bool isBinary = true; - switch(dialog->c[1]->value()){ - case 0: isBinary = true; break; - case 1: isBinary = false; break; + switch(dialog->c[1]->value()) { + case 0: isBinary = true; break; + case 1: isBinary = false; break; } // Only one view can currently be saved at a time in a pvtu file set, @@ -1709,14 +1794,15 @@ int pvtuAdaptFileDialog(const char *name) double adaptErr = dialog->vi[1]->value(); int npart = dialog->vi[2]->value(); int useDefaultName = dialog->defautName->value(); - bool canAppend = false; // Not yet implemented for VTK format here due to a tradeoff - // to limit memory consumption for high levels of adaptation + bool canAppend = + false; // Not yet implemented for VTK format here due to a tradeoff + // to limit memory consumption for high levels of adaptation _saveAdaptedViews(name, useDefaultName, dialog->c[0]->value(), isBinary, adaptLev, adaptErr, npart, canAppend); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1727,7 +1813,7 @@ int pvtuAdaptFileDialog(const char *name) int x3dViewFileDialog(const char *name, const char *title, int format) { - struct _viewFileDialog{ + struct _viewFileDialog { Fl_Window *window; Fl_Choice *c; Fl_Value_Input *input[2]; @@ -1737,36 +1823,39 @@ int x3dViewFileDialog(const char *name, const char *title, int format) static _viewFileDialog *dialog = NULL; static Fl_Menu_Item viewmenu[] = { - {"Current", 0, 0, 0}, - {"Visible", 0, 0, 0}, - {"All", 0, 0, 0}, - {0} - }; + {"Current", 0, 0, 0}, {"Visible", 0, 0, 0}, {"All", 0, 0, 0}, {0}}; int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _viewFileDialog; - int h = 6 * BH + 3 * WB, w = 2 * BBB + 3 * WB , y = WB; + int h = 6 * BH + 3 * WB, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); y += BH; + dialog->c = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); + y += BH; dialog->c->menu(viewmenu); dialog->c->align(FL_ALIGN_RIGHT); - dialog->e[0] = new Fl_Check_Button(WB, y, w - 2 * WB, BH, "Remove inner borders"); y += BH; + dialog->e[0] = + new Fl_Check_Button(WB, y, w - 2 * WB, BH, "Remove inner borders"); + y += BH; dialog->e[0]->type(FL_TOGGLE_BUTTON); - dialog->input[0] = new Fl_Value_Input(WB, y, BB, BH, "Log10(Precision)"); y += BH; + dialog->input[0] = new Fl_Value_Input(WB, y, BB, BH, "Log10(Precision)"); + y += BH; dialog->input[0]->align(FL_ALIGN_RIGHT); dialog->input[0]->minimum(-16); dialog->input[0]->maximum(16); dialog->input[0]->step(.25); - dialog->input[1] = new Fl_Value_Input(WB, y, BB, BH, "Transparency"); y += BH; + dialog->input[1] = new Fl_Value_Input(WB, y, BB, BH, "Transparency"); + y += BH; dialog->input[1]->align(FL_ALIGN_RIGHT); dialog->input[1]->minimum(0.); dialog->input[1]->maximum(1.); dialog->input[1]->step(0.05); - dialog->e[1] = new Fl_Check_Button(WB, y, w - 2 * WB, BH, "High compatibility (no scale)"); y += BH; + dialog->e[1] = new Fl_Check_Button(WB, y, w - 2 * WB, BH, + "High compatibility (no scale)"); + y += BH; dialog->e[1]->type(FL_TOGGLE_BUTTON); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); dialog->cancel = new Fl_Button(2 * WB + BBB, y + WB, BBB, BH, "Cancel"); @@ -1782,21 +1871,25 @@ int x3dViewFileDialog(const char *name, const char *title, int format) dialog->e[0]->value(opt_print_x3d_remove_inner_borders(0, GMSH_GET, 0)); dialog->e[1]->value(opt_print_x3d_compatibility(0, GMSH_GET, 0)); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { - opt_print_x3d_precision(0, GMSH_SET|GMSH_GUI, pow(10., dialog->input[0]->value())); - opt_print_x3d_transparency(0, GMSH_SET|GMSH_GUI, dialog->input[1]->value()); - opt_print_x3d_remove_inner_borders(0, GMSH_SET|GMSH_GUI, dialog->e[0]->value()); - opt_print_x3d_compatibility(0, GMSH_SET|GMSH_GUI, dialog->e[1]->value()); + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { + opt_print_x3d_precision(0, GMSH_SET | GMSH_GUI, + pow(10., dialog->input[0]->value())); + opt_print_x3d_transparency(0, GMSH_SET | GMSH_GUI, + dialog->input[1]->value()); + opt_print_x3d_remove_inner_borders(0, GMSH_SET | GMSH_GUI, + dialog->e[0]->value()); + opt_print_x3d_compatibility(0, GMSH_SET | GMSH_GUI, + dialog->e[1]->value()); _saveViews(name, dialog->c->value(), format, false); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1807,7 +1900,7 @@ int x3dViewFileDialog(const char *name, const char *title, int format) int genericViewFileDialog(const char *name, const char *title, int format) { - struct _viewFileDialog{ + struct _viewFileDialog { Fl_Window *window; Fl_Choice *c[1]; Fl_Button *ok, *cancel; @@ -1815,21 +1908,18 @@ int genericViewFileDialog(const char *name, const char *title, int format) static _viewFileDialog *dialog = NULL; static Fl_Menu_Item viewmenu[] = { - {"Current", 0, 0, 0}, - {"Visible", 0, 0, 0}, - {"All", 0, 0, 0}, - {0} - }; + {"Current", 0, 0, 0}, {"Visible", 0, 0, 0}, {"All", 0, 0, 0}, {0}}; int BBB = BB + 9; // labels too long - if(!dialog){ + if(!dialog) { dialog = new _viewFileDialog; int h = 3 * WB + 2 * BH, w = 2 * BBB + 3 * WB, y = WB; dialog->window = new Fl_Double_Window(w, h); dialog->window->box(GMSH_WINDOW_BOX); dialog->window->set_modal(); - dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); y += BH; + dialog->c[0] = new Fl_Choice(WB, y, BBB + BBB / 2, BH, "View(s)"); + y += BH; dialog->c[0]->menu(viewmenu); dialog->c[0]->align(FL_ALIGN_RIGHT); dialog->ok = new Fl_Return_Button(WB, y + WB, BBB, BH, "OK"); @@ -1841,17 +1931,17 @@ int genericViewFileDialog(const char *name, const char *title, int format) dialog->window->label(title); dialog->window->show(); - while(dialog->window->shown()){ + while(dialog->window->shown()) { Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == dialog->ok) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == dialog->ok) { _saveViews(name, dialog->c[0]->value(), format, false); dialog->window->hide(); return 1; } - if (o == dialog->window || o == dialog->cancel){ + if(o == dialog->window || o == dialog->cancel) { dialog->window->hide(); return 0; } @@ -1870,8 +1960,7 @@ void cgnsw_write_normals_cb(Fl_Widget *widget, void *data); void cgnsw_normal_source_cb(Fl_Widget *widget, void *data); // Pointers to required widgets -struct CGNSWriteDialog -{ +struct CGNSWriteDialog { Fl_Window *window; Fl_Choice *choiceZoneDef; Fl_Input *inputBaseName; @@ -1901,17 +1990,20 @@ struct CGNSWriteDialog roundButton1GCatFace->value(); CTX::instance()->cgnsOptions.writeBC = checkButtonWriteBC->value(); CTX::instance()->cgnsOptions.bocoLocation = roundButton1BCatFace->value(); - CTX::instance()->cgnsOptions.normalSource = (checkButtonWriteNormals->value()) ? - roundButton1NormalElem->value() + 1 : 0; + CTX::instance()->cgnsOptions.normalSource = + (checkButtonWriteNormals->value()) ? roundButton1NormalElem->value() + 1 : + 0; CTX::instance()->cgnsOptions.vectorDim = choiceVecDim->value() + 2; - CTX::instance()->cgnsOptions.writeUserDef = checkButtonUnknownUserDef->value(); + CTX::instance()->cgnsOptions.writeUserDef = + checkButtonUnknownUserDef->value(); } void read_all_options() { choiceZoneDef->value(CTX::instance()->mesh.zoneDefinition); inputBaseName->value(CTX::instance()->cgnsOptions.baseName.c_str()); inputZoneName->value(CTX::instance()->cgnsOptions.zoneName.c_str()); - inputInterfaceName->value(CTX::instance()->cgnsOptions.interfaceName.c_str()); + inputInterfaceName->value( + CTX::instance()->cgnsOptions.interfaceName.c_str()); inputPatchName->value(CTX::instance()->cgnsOptions.patchName.c_str()); checkButtonWriteBC->value(CTX::instance()->cgnsOptions.writeBC); checkButtonWriteNormals->value(CTX::instance()->cgnsOptions.normalSource); @@ -1919,24 +2011,28 @@ struct CGNSWriteDialog checkButtonUnknownUserDef->value(CTX::instance()->cgnsOptions.writeUserDef); // Call all callbacks to ensure consistent options - cgnsw_gc_location_cb - ((CTX::instance()->cgnsOptions.gridConnectivityLocation) ? - roundButton1GCatFace : roundButton0GCatVertex, this); + cgnsw_gc_location_cb( + (CTX::instance()->cgnsOptions.gridConnectivityLocation) ? + roundButton1GCatFace : + roundButton0GCatVertex, + this); // The order of the next 4 is important - cgnsw_normal_source_cb - ((CTX::instance()->cgnsOptions.normalSource == 2) ? - roundButton1NormalElem : roundButton0NormalGeo, this); + cgnsw_normal_source_cb((CTX::instance()->cgnsOptions.normalSource == 2) ? + roundButton1NormalElem : + roundButton0NormalGeo, + this); cgnsw_write_normals_cb(checkButtonWriteNormals, this); - cgnsw_bc_location_cb - ((CTX::instance()->cgnsOptions.bocoLocation) ? - roundButton1BCatFace : roundButton0BCatVertex, this); + cgnsw_bc_location_cb((CTX::instance()->cgnsOptions.bocoLocation) ? + roundButton1BCatFace : + roundButton0BCatVertex, + this); cgnsw_write_dummy_bc_cb(checkButtonWriteBC, this); } }; void cgnsw_gc_location_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); if(widget == dlg->roundButton0GCatVertex) { dlg->roundButton0GCatVertex->set(); dlg->roundButton1GCatFace->clear(); @@ -1949,7 +2045,7 @@ void cgnsw_gc_location_cb(Fl_Widget *widget, void *data) void cgnsw_write_dummy_bc_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); if(dlg->checkButtonWriteBC->value()) { dlg->roundButton0BCatVertex->activate(); // dlg->roundButton1BCatFace->activate(); //**Tmp @@ -1971,7 +2067,7 @@ void cgnsw_write_dummy_bc_cb(Fl_Widget *widget, void *data) void cgnsw_bc_location_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); if(widget == dlg->roundButton0BCatVertex) { dlg->roundButton0BCatVertex->set(); dlg->roundButton1BCatFace->clear(); @@ -1989,7 +2085,7 @@ void cgnsw_bc_location_cb(Fl_Widget *widget, void *data) void cgnsw_write_normals_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); if(dlg->checkButtonWriteNormals->value()) { if(dlg->roundButton0BCatVertex->value()) dlg->roundButton0NormalGeo->activate(); @@ -2003,7 +2099,7 @@ void cgnsw_write_normals_cb(Fl_Widget *widget, void *data) void cgnsw_normal_source_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); if(widget == dlg->roundButton0NormalGeo) { dlg->roundButton0NormalGeo->set(); dlg->roundButton1NormalElem->clear(); @@ -2016,14 +2112,14 @@ void cgnsw_normal_source_cb(Fl_Widget *widget, void *data) void cgnsw_defaults_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); CTX::instance()->cgnsOptions.setDefaults(); dlg->read_all_options(); } void cgnsw_write_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); // Write all options dlg->write_all_options(); @@ -2036,7 +2132,7 @@ void cgnsw_write_cb(Fl_Widget *widget, void *data) void cgnsw_cancel_cb(Fl_Widget *widget, void *data) { - CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog*>(data); + CGNSWriteDialog *dlg = static_cast<CGNSWriteDialog *>(data); dlg->window->hide(); dlg->status = 0; } @@ -2046,30 +2142,24 @@ int cgnsFileDialog(const char *filename) static CGNSWriteDialog dlg; dlg.filename = filename; - static Fl_Menu_Item zoneDefMenu[] = { - {"Single zone", 0, 0, 0}, - {"Partition", 0, 0, 0}, - {"Physical", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item zoneDefMenu[] = {{"Single zone", 0, 0, 0}, + {"Partition", 0, 0, 0}, + {"Physical", 0, 0, 0}, + {0}}; - static Fl_Menu_Item vectorDimMenu[] = { - {"2", 0, 0, 0}, - {"3", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item vectorDimMenu[] = {{"2", 0, 0, 0}, {"3", 0, 0, 0}, {0}}; + + const int RBH = 3 * FL_NORMAL_SIZE / 2; // radio button height + const int col1 = WB; // Start of left column + const int col2 = 2 * WB + 2 * BB; // Start of right column + const int hcol1 = 5 * WB + 2 * RBH + 3 * BH; + // Height of left column + const int hcol2 = 4 * WB + 4 * RBH + 2 * BH; + // Height of right column - const int RBH = 3 * FL_NORMAL_SIZE/2; // radio button height - const int col1 = WB; // Start of left column - const int col2 = 2*WB + 2*BB; // Start of right column - const int hcol1 = 5*WB + 2*RBH + 3*BH; - // Height of left column - const int hcol2 = 4*WB + 4*RBH + 2*BH; - // Height of right column - - const int h = 4 + 8*WB + 5*BH + std::max(hcol1, hcol2); - // Window height - const int w = 3*WB + 4*BB; // Window width + const int h = 4 + 8 * WB + 5 * BH + std::max(hcol1, hcol2); + // Window height + const int w = 3 * WB + 4 * BB; // Window width int y = WB; dlg.window = new Fl_Double_Window(w, h, "CGNS Options"); @@ -2085,7 +2175,7 @@ int cgnsFileDialog(const char *filename) // Box (line) [0] { - Fl_Box *const o = new Fl_Box(WB, y, w - 2*WB, 2); + Fl_Box *const o = new Fl_Box(WB, y, w - 2 * WB, 2); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); } @@ -2115,41 +2205,41 @@ int cgnsFileDialog(const char *filename) yl += BH; } { - Fl_Box *const o = new Fl_Box(col1, yl, 2*BB, 2*WB + 2*RBH); + Fl_Box *const o = new Fl_Box(col1, yl, 2 * BB, 2 * WB + 2 * RBH); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); yl += WB; } // Grid connectivity location { - const int GH = 2*RBH + 2*WB; - Fl_Group *g = new Fl_Group(col1, yl, 2*BB, GH); - dlg.roundButton0GCatVertex = new Fl_Round_Button(col1 + WB, yl, RBH, RBH, - "Vertex"); + const int GH = 2 * RBH + 2 * WB; + Fl_Group *g = new Fl_Group(col1, yl, 2 * BB, GH); + dlg.roundButton0GCatVertex = + new Fl_Round_Button(col1 + WB, yl, RBH, RBH, "Vertex"); dlg.roundButton0GCatVertex->callback((Fl_Callback *)cgnsw_gc_location_cb, &dlg); dlg.roundButton0GCatVertex->align(FL_ALIGN_RIGHT); yl += RBH; - dlg.roundButton1GCatFace = new Fl_Round_Button(col1 + WB, yl, RBH, RBH, - "Face"); + dlg.roundButton1GCatFace = + new Fl_Round_Button(col1 + WB, yl, RBH, RBH, "Face"); dlg.roundButton1GCatFace->callback((Fl_Callback *)cgnsw_gc_location_cb, &dlg); dlg.roundButton1GCatFace->align(FL_ALIGN_RIGHT); - dlg.roundButton1GCatFace->deactivate(); //**Tmp - yl += RBH + 2*WB; + dlg.roundButton1GCatFace->deactivate(); //**Tmp + yl += RBH + 2 * WB; g->end(); g->show(); } // 2D Vector Dim yl += WB; - dlg.choiceVecDim = new Fl_Choice(WB, yl, BB/2, BH, "Vector Dimension"); + dlg.choiceVecDim = new Fl_Choice(WB, yl, BB / 2, BH, "Vector Dimension"); dlg.choiceVecDim->menu(vectorDimMenu); dlg.choiceVecDim->align(FL_ALIGN_RIGHT); yl += BH; { - Fl_Box *const o = new Fl_Box(col1, yl, 0, BH, - "(only affects 2-D mesh output)"); + Fl_Box *const o = + new Fl_Box(col1, yl, 0, BH, "(only affects 2-D mesh output)"); o->align(FL_ALIGN_RIGHT); yl += BH + WB; } @@ -2159,14 +2249,14 @@ int cgnsFileDialog(const char *filename) int yr = y; // Write exterior BC - dlg.checkButtonWriteBC = new Fl_Check_Button(col2, yr, RBH, BH, - "Write dummy BC"); + dlg.checkButtonWriteBC = + new Fl_Check_Button(col2, yr, RBH, BH, "Write dummy BC"); dlg.checkButtonWriteBC->callback((Fl_Callback *)cgnsw_write_dummy_bc_cb, &dlg); dlg.checkButtonWriteBC->align(FL_ALIGN_RIGHT); yr += BH; { - Fl_Box *const o = new Fl_Box(col2, yr, 2*BB, BH + 4*RBH + 3*WB); + Fl_Box *const o = new Fl_Box(col2, yr, 2 * BB, BH + 4 * RBH + 3 * WB); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); yr += WB; @@ -2174,28 +2264,28 @@ int cgnsFileDialog(const char *filename) // BC location { - const int GH = 2*RBH + WB; - Fl_Group *g = new Fl_Group(col2, yr, 2*BB, GH); - dlg.roundButton0BCatVertex = new Fl_Round_Button(col2 + WB, yr, RBH, RBH, - "Vertex"); + const int GH = 2 * RBH + WB; + Fl_Group *g = new Fl_Group(col2, yr, 2 * BB, GH); + dlg.roundButton0BCatVertex = + new Fl_Round_Button(col2 + WB, yr, RBH, RBH, "Vertex"); dlg.roundButton0BCatVertex->callback((Fl_Callback *)cgnsw_bc_location_cb, &dlg); dlg.roundButton0BCatVertex->align(FL_ALIGN_RIGHT); yr += RBH; - dlg.roundButton1BCatFace = new Fl_Round_Button(col2 + WB, yr, RBH, RBH, - "Face"); + dlg.roundButton1BCatFace = + new Fl_Round_Button(col2 + WB, yr, RBH, RBH, "Face"); dlg.roundButton1BCatFace->callback((Fl_Callback *)cgnsw_bc_location_cb, &dlg); dlg.roundButton1BCatFace->align(FL_ALIGN_RIGHT); - dlg.roundButton1BCatFace->deactivate(); //**Tmp + dlg.roundButton1BCatFace->deactivate(); //**Tmp yr += RBH + WB; g->end(); g->show(); } // Write normals - dlg.checkButtonWriteNormals = new Fl_Check_Button(col2 + WB, yr, RBH, BH, - "Write normals"); + dlg.checkButtonWriteNormals = + new Fl_Check_Button(col2 + WB, yr, RBH, BH, "Write normals"); dlg.checkButtonWriteNormals->callback((Fl_Callback *)cgnsw_write_normals_cb, &dlg); dlg.checkButtonWriteNormals->align(FL_ALIGN_RIGHT); @@ -2203,53 +2293,52 @@ int cgnsFileDialog(const char *filename) // Normal source { - const int GH = 2*RBH + WB; - Fl_Group *g = new Fl_Group(col2, yr, 2*BB, GH); - dlg.roundButton0NormalGeo = new Fl_Round_Button(col2 + 2*WB, yr, RBH, RBH, - "From geometry"); + const int GH = 2 * RBH + WB; + Fl_Group *g = new Fl_Group(col2, yr, 2 * BB, GH); + dlg.roundButton0NormalGeo = + new Fl_Round_Button(col2 + 2 * WB, yr, RBH, RBH, "From geometry"); dlg.roundButton0NormalGeo->callback((Fl_Callback *)cgnsw_normal_source_cb, - &dlg); + &dlg); dlg.roundButton0NormalGeo->align(FL_ALIGN_RIGHT); yr += RBH; - dlg.roundButton1NormalElem = new Fl_Round_Button(col2 + 2*WB, yr, RBH, RBH, - "From elements"); + dlg.roundButton1NormalElem = + new Fl_Round_Button(col2 + 2 * WB, yr, RBH, RBH, "From elements"); dlg.roundButton1NormalElem->callback((Fl_Callback *)cgnsw_normal_source_cb, &dlg); dlg.roundButton1NormalElem->align(FL_ALIGN_RIGHT); - yr += RBH + 2*WB; + yr += RBH + 2 * WB; g->end(); g->show(); } y = std::max(yl, yr); // User defined - dlg.checkButtonUnknownUserDef = new Fl_Check_Button - (col1, y, RBH, BH, "Write user-defined elements for unsupported types"); + dlg.checkButtonUnknownUserDef = new Fl_Check_Button( + col1, y, RBH, BH, "Write user-defined elements for unsupported types"); dlg.checkButtonUnknownUserDef->align(FL_ALIGN_RIGHT); - dlg.checkButtonUnknownUserDef->deactivate(); //**Tmp + dlg.checkButtonUnknownUserDef->deactivate(); //**Tmp y += BH + WB; // Dialog termination group { - const int GH = 2 + BH + 2*WB; + const int GH = 2 + BH + 2 * WB; Fl_Group *g = new Fl_Group(0, y, w, GH); // Box (line) [0] { - Fl_Box *const o = new Fl_Box(WB, y, w - 2*WB, 2); + Fl_Box *const o = new Fl_Box(WB, y, w - 2 * WB, 2); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); } y += 2 + WB; // Defaults Button [1] { - Fl_Button *const o = new Fl_Button - (WB, y, BB, BH, "Defaults"); + Fl_Button *const o = new Fl_Button(WB, y, BB, BH, "Defaults"); o->callback((Fl_Callback *)cgnsw_defaults_cb, &dlg); } // Write Button [2] { - Fl_Return_Button *const o = new Fl_Return_Button(w - 2*(WB + BB), y, BB, - BH, "Write"); + Fl_Return_Button *const o = + new Fl_Return_Button(w - 2 * (WB + BB), y, BB, BH, "Write"); o->callback((Fl_Callback *)cgnsw_write_cb, &dlg); } // Cancel Button [3] @@ -2282,4 +2371,4 @@ int cgnsFileDialog(const char *filename) return 1; } -#endif // compiling CGNS write dialog +#endif // compiling CGNS write dialog diff --git a/Fltk/fileDialogs.h b/Fltk/fileDialogs.h index be46f20f177487ce5bcb8c1b75ddb2b88d682122..691f80a488dc7eb77c46280d60158322a566947e 100644 --- a/Fltk/fileDialogs.h +++ b/Fltk/fileDialogs.h @@ -15,8 +15,8 @@ typedef enum { FILE_CHOOSER_DIRECTORY } FILE_CHOOSER_TYPE; -int fileChooser(FILE_CHOOSER_TYPE type, const char *message, - const char *pat, const char *fname=NULL); +int fileChooser(FILE_CHOOSER_TYPE type, const char *message, const char *pat, + const char *fname = NULL); std::string fileChooserGetName(int num); int fileChooserGetFilter(); void fileChooserGetPosition(int *x, int *y); @@ -24,7 +24,8 @@ void fileChooserGetPosition(int *x, int *y); int mpegFileDialog(const char *filename); int gifFileDialog(const char *filename); int geoFileDialog(const char *filename); -int genericBitmapFileDialog(const char *filename, const char *title, int format); +int genericBitmapFileDialog(const char *filename, const char *title, + int format); int pgfBitmapFileDialog(const char *filename, const char *title, int format); int genericMeshFileDialog(const char *filename, const char *title, int format, bool binary_support, bool element_tag_support); diff --git a/Fltk/gamepadWindow.cpp b/Fltk/gamepadWindow.cpp index eb0ce832f16e2b9549127f6e8016c7c473fe8280..d4109290f520e3d0e94dd6fbec9c8926981e8f04 100644 --- a/Fltk/gamepadWindow.cpp +++ b/Fltk/gamepadWindow.cpp @@ -15,15 +15,15 @@ #include "Context.h" // handler (listen to gamepad or other names pipes -static void gamepadWindow_handler(void *data) +static void gamepadWindow_handler(void *data) { - if(CTX::instance()->gamepad && CTX::instance()->gamepad->active){ - gamepadWindow* gmpd_win = (gamepadWindow*)data; - GamePad* pad = CTX::instance()->gamepad; - for (int i=0; i<std::min(13,GP_BUTTONS);i++) + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { + gamepadWindow *gmpd_win = (gamepadWindow *)data; + GamePad *pad = CTX::instance()->gamepad; + for(int i = 0; i < std::min(13, GP_BUTTONS); i++) gmpd_win->gamepad.butt[i]->value(pad->button[i]); - for (int i=0; i<std::min(9,GP_AXES);i++) - gmpd_win->gamepad.axe[i]->value( pad->axe[i] ); + for(int i = 0; i < std::min(9, GP_AXES); i++) + gmpd_win->gamepad.axe[i]->value(pad->axe[i]); Fl::add_timeout(gmpd_win->frequency, gamepadWindow_handler, data); gmpd_win->gamepad.mapping[16]->value(pad->axe_map[1]); } @@ -31,12 +31,12 @@ static void gamepadWindow_handler(void *data) static void gamepad_update_cb(Fl_Widget *w) { - gamepadWindow* gmpd_win = FlGui::instance()->options->gmpdoption; - GamePad* pad = CTX::instance()->gamepad; - for (int i=0; i<std::min(8,GP_BUTTONS) ;i++) + gamepadWindow *gmpd_win = FlGui::instance()->options->gmpdoption; + GamePad *pad = CTX::instance()->gamepad; + for(int i = 0; i < std::min(8, GP_BUTTONS); i++) pad->button_map[i] = gmpd_win->gamepad.mapping[i]->value(); - for (int i=0; i<std::min(7,GP_AXES);i++) - pad->axe_map[i] = gmpd_win->gamepad.mapping[10+i]->value(); + for(int i = 0; i < std::min(7, GP_AXES); i++) + pad->axe_map[i] = gmpd_win->gamepad.mapping[10 + i]->value(); } gamepadWindow::gamepadWindow() @@ -49,89 +49,119 @@ gamepadWindow::gamepadWindow() int width = 34 * FL_NORMAL_SIZE + WB; int height = 15 * BH + 4 * WB; - int L = FL_NORMAL_SIZE; + int L = FL_NORMAL_SIZE; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false); win->box(GMSH_WINDOW_BOX); win->label("Gamepad Configuration Tool (in work)"); - Fl_Box *bt = new Fl_Box(FL_NO_BOX, L , L-.3*BH , IW, BH, "Gamepad buttons:"); - bt->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - - gamepad.butt[0] = new Fl_Check_Button(L , L+BH , BH, WB, "0" ); - gamepad.butt[1] = new Fl_Check_Button(L +1*BB*.35 , L+BH , BH, WB, "1" ); - gamepad.butt[2] = new Fl_Check_Button(L +2*BB*.35 , L+BH , BH, WB, "2" ); - gamepad.butt[3] = new Fl_Check_Button(L +3*BB*.35 , L+BH , BH, WB, "3" ); - gamepad.butt[4] = new Fl_Check_Button(L +4*BB*.35 , L+BH , BH, WB, "4" ); - gamepad.butt[5] = new Fl_Check_Button(L +5*BB*.35 , L+BH , BH, WB, "5" ); - gamepad.butt[6] = new Fl_Check_Button(L +6*BB*.35 , L+BH , BH, WB, "6" ); - gamepad.butt[7] = new Fl_Check_Button(L +7*BB*.35 , L+BH , BH, WB, "7" ); - gamepad.butt[8] = new Fl_Check_Button(L +8*BB*.35 , L+BH , BH, WB, "8" ); - gamepad.butt[9] = new Fl_Check_Button(L +9*BB*.35 , L+BH , BH, WB, "9" ); - gamepad.butt[10] = new Fl_Check_Button(L +10*BB*.35 , L+BH , BH, WB, "10" ); - gamepad.butt[11] = new Fl_Check_Button(L +11*BB*.35 , L+BH , BH, WB, "11" ); - gamepad.butt[12] = new Fl_Check_Button(L +12*BB*.35 , L+BH , BH, WB, "12" ); - for (int i=0; i<13;i++) gamepad.butt[i]->deactivate(); - - Fl_Box *bta = new Fl_Box(FL_NO_BOX, L , L+1.7*BH , IW, BH, "Gamepad axes:"); - bta->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - - gamepad.axe[0] = new Fl_Check_Button(L , L+3.*BH , BH, WB, "0" ); - gamepad.axe[1] = new Fl_Check_Button(L +1*BB*.4 , L+3.*BH , BH, WB, "1" ); - gamepad.axe[2] = new Fl_Check_Button(L +2*BB*.4 , L+3.*BH , BH, WB, "2" ); - gamepad.axe[3] = new Fl_Check_Button(L +3*BB*.4 , L+3.*BH , BH, WB, "3" ); - gamepad.axe[4] = new Fl_Check_Button(L +4*BB*.4 , L+3.*BH , BH, WB, "4" ); - gamepad.axe[5] = new Fl_Check_Button(L +5*BB*.4 , L+3.*BH , BH, WB, "5" ); - gamepad.axe[6] = new Fl_Check_Button(L +6*BB*.4 , L+3.*BH , BH, WB, "6" ); - gamepad.axe[7] = new Fl_Check_Button(L +7*BB*.4 , L+3.*BH , BH, WB, "7" ); - gamepad.axe[8] = new Fl_Check_Button(L +8*BB*.4 , L+3.*BH , BH, WB, "8" ); - for (int i=0; i<9;i++) gamepad.axe[i]->deactivate(); - - Fl_Box *btt1 = new Fl_Box(FL_NO_BOX, L , L+3.7*BH , IW, BH, "Preferences:"); - btt1->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - Fl_Box *btt2 = new Fl_Box(FL_NO_BOX, L , L+4.7*BH , IW, BH, "Action Axes:"); - btt2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - Fl_Box *btt3 = new Fl_Box(FL_NO_BOX, L +width/2+BH/2, L+4.7*BH , IW, BH, "Action buttons:"); - btt3->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - - GamePad* pad = CTX::instance()->gamepad; - - gamepad.mapping[0] = new Fl_Value_Input( L+width/2+BH/2, L+5.7*BH , IW/5,BH, "1:1"); - gamepad.mapping[1] = new Fl_Value_Input( L+width/2+BH/2, L+6.7*BH , IW/5,BH, "permute axes"); - gamepad.mapping[2] = new Fl_Value_Input( L+width/2+BH/2, L+7.7*BH , IW/5,BH, "reset/invers up axis"); - gamepad.mapping[3] = new Fl_Value_Input( L+width/2+BH/2, L+8.7*BH , IW/5,BH, "change nav-mode"); - gamepad.mapping[4] = new Fl_Value_Input( L+width/2+BH/2, L+9.7*BH, IW/5,BH, "(*) move head"); - gamepad.mapping[5] = new Fl_Value_Input( L+width/2+BH/2, L+10.7*BH, IW/5,BH, " "); - gamepad.mapping[6] = new Fl_Value_Input( L+width/2+BH/2, L+11.7*BH, IW/5,BH, "walk / swimm"); - gamepad.mapping[7] = new Fl_Value_Input( L+width/2+BH/2, L+12.7*BH, IW/5,BH, " "); - gamepad.mapping[8] = new Fl_Value_Input( L+width/2+BH/2, L+13.7*BH, IW/5,BH, "1:1 ; reset speed"); - - for (int i=0; i<9;i++) { + Fl_Box *bt = + new Fl_Box(FL_NO_BOX, L, L - .3 * BH, IW, BH, "Gamepad buttons:"); + bt->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + + gamepad.butt[0] = new Fl_Check_Button(L, L + BH, BH, WB, "0"); + gamepad.butt[1] = new Fl_Check_Button(L + 1 * BB * .35, L + BH, BH, WB, "1"); + gamepad.butt[2] = new Fl_Check_Button(L + 2 * BB * .35, L + BH, BH, WB, "2"); + gamepad.butt[3] = new Fl_Check_Button(L + 3 * BB * .35, L + BH, BH, WB, "3"); + gamepad.butt[4] = new Fl_Check_Button(L + 4 * BB * .35, L + BH, BH, WB, "4"); + gamepad.butt[5] = new Fl_Check_Button(L + 5 * BB * .35, L + BH, BH, WB, "5"); + gamepad.butt[6] = new Fl_Check_Button(L + 6 * BB * .35, L + BH, BH, WB, "6"); + gamepad.butt[7] = new Fl_Check_Button(L + 7 * BB * .35, L + BH, BH, WB, "7"); + gamepad.butt[8] = new Fl_Check_Button(L + 8 * BB * .35, L + BH, BH, WB, "8"); + gamepad.butt[9] = new Fl_Check_Button(L + 9 * BB * .35, L + BH, BH, WB, "9"); + gamepad.butt[10] = + new Fl_Check_Button(L + 10 * BB * .35, L + BH, BH, WB, "10"); + gamepad.butt[11] = + new Fl_Check_Button(L + 11 * BB * .35, L + BH, BH, WB, "11"); + gamepad.butt[12] = + new Fl_Check_Button(L + 12 * BB * .35, L + BH, BH, WB, "12"); + for(int i = 0; i < 13; i++) gamepad.butt[i]->deactivate(); + + Fl_Box *bta = new Fl_Box(FL_NO_BOX, L, L + 1.7 * BH, IW, BH, "Gamepad axes:"); + bta->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + + gamepad.axe[0] = new Fl_Check_Button(L, L + 3. * BH, BH, WB, "0"); + gamepad.axe[1] = + new Fl_Check_Button(L + 1 * BB * .4, L + 3. * BH, BH, WB, "1"); + gamepad.axe[2] = + new Fl_Check_Button(L + 2 * BB * .4, L + 3. * BH, BH, WB, "2"); + gamepad.axe[3] = + new Fl_Check_Button(L + 3 * BB * .4, L + 3. * BH, BH, WB, "3"); + gamepad.axe[4] = + new Fl_Check_Button(L + 4 * BB * .4, L + 3. * BH, BH, WB, "4"); + gamepad.axe[5] = + new Fl_Check_Button(L + 5 * BB * .4, L + 3. * BH, BH, WB, "5"); + gamepad.axe[6] = + new Fl_Check_Button(L + 6 * BB * .4, L + 3. * BH, BH, WB, "6"); + gamepad.axe[7] = + new Fl_Check_Button(L + 7 * BB * .4, L + 3. * BH, BH, WB, "7"); + gamepad.axe[8] = + new Fl_Check_Button(L + 8 * BB * .4, L + 3. * BH, BH, WB, "8"); + for(int i = 0; i < 9; i++) gamepad.axe[i]->deactivate(); + + Fl_Box *btt1 = new Fl_Box(FL_NO_BOX, L, L + 3.7 * BH, IW, BH, "Preferences:"); + btt1->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + Fl_Box *btt2 = new Fl_Box(FL_NO_BOX, L, L + 4.7 * BH, IW, BH, "Action Axes:"); + btt2->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + Fl_Box *btt3 = new Fl_Box(FL_NO_BOX, L + width / 2 + BH / 2, L + 4.7 * BH, IW, + BH, "Action buttons:"); + btt3->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + + GamePad *pad = CTX::instance()->gamepad; + + gamepad.mapping[0] = + new Fl_Value_Input(L + width / 2 + BH / 2, L + 5.7 * BH, IW / 5, BH, "1:1"); + gamepad.mapping[1] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 6.7 * BH, + IW / 5, BH, "permute axes"); + gamepad.mapping[2] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 7.7 * BH, + IW / 5, BH, "reset/invers up axis"); + gamepad.mapping[3] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 8.7 * BH, + IW / 5, BH, "change nav-mode"); + gamepad.mapping[4] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 9.7 * BH, + IW / 5, BH, "(*) move head"); + gamepad.mapping[5] = + new Fl_Value_Input(L + width / 2 + BH / 2, L + 10.7 * BH, IW / 5, BH, " "); + gamepad.mapping[6] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 11.7 * BH, + IW / 5, BH, "walk / swimm"); + gamepad.mapping[7] = + new Fl_Value_Input(L + width / 2 + BH / 2, L + 12.7 * BH, IW / 5, BH, " "); + gamepad.mapping[8] = new Fl_Value_Input(L + width / 2 + BH / 2, L + 13.7 * BH, + IW / 5, BH, "1:1 ; reset speed"); + + for(int i = 0; i < 9; i++) { gamepad.mapping[i]->align(FL_ALIGN_RIGHT); gamepad.mapping[i]->callback(gamepad_update_cb); gamepad.mapping[i]->value(pad->button_map[i]); - } - - gamepad.mapping[10] = new Fl_Value_Input( L, L+5.7*BH , IW/5, BH, "head right/left with button (*)"); - gamepad.mapping[11] = new Fl_Value_Input( L, L+6.7*BH , IW/5, BH, "head up/down with button (*)"); - gamepad.mapping[12] = new Fl_Value_Input( L, L+7.7*BH , IW/5, BH, "turn left/right"); - gamepad.mapping[13] = new Fl_Value_Input( L, L+8.7*BH, IW/5, BH, "for/backward or up/down "); - gamepad.mapping[14] = new Fl_Value_Input( L, L+9.7*BH, IW/5, BH, "move aside left/right"); - gamepad.mapping[15] = new Fl_Value_Input( L, L+10.7*BH, IW/5, BH, "move up/down"); - gamepad.mapping[16] = new Fl_Value_Input( L, L+11.7*BH , IW/5, BH, "speed up/slow down"); - - for (int i=0; i<7;i++) { - gamepad.mapping[10+i]->align(FL_ALIGN_RIGHT); - gamepad.mapping[10+i]->callback(gamepad_update_cb); - gamepad.mapping[10+i]->value(pad->axe_map[i]); + } + + gamepad.mapping[10] = new Fl_Value_Input(L, L + 5.7 * BH, IW / 5, BH, + "head right/left with button (*)"); + gamepad.mapping[11] = new Fl_Value_Input(L, L + 6.7 * BH, IW / 5, BH, + "head up/down with button (*)"); + gamepad.mapping[12] = + new Fl_Value_Input(L, L + 7.7 * BH, IW / 5, BH, "turn left/right"); + gamepad.mapping[13] = + new Fl_Value_Input(L, L + 8.7 * BH, IW / 5, BH, "for/backward or up/down "); + gamepad.mapping[14] = + new Fl_Value_Input(L, L + 9.7 * BH, IW / 5, BH, "move aside left/right"); + gamepad.mapping[15] = + new Fl_Value_Input(L, L + 10.7 * BH, IW / 5, BH, "move up/down"); + gamepad.mapping[16] = + new Fl_Value_Input(L, L + 11.7 * BH, IW / 5, BH, "speed up/slow down"); + + for(int i = 0; i < 7; i++) { + gamepad.mapping[10 + i]->align(FL_ALIGN_RIGHT); + gamepad.mapping[10 + i]->callback(gamepad_update_cb); + gamepad.mapping[10 + i]->value(pad->axe_map[i]); } // add external reader for gamepad events - if (CTX::instance()->gamepad && CTX::instance()->gamepad->active) { - Fl::add_timeout(frequency, gamepadWindow_handler, (void*)this); + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { + Fl::add_timeout(frequency, gamepadWindow_handler, (void *)this); } - win->position(CTX::instance()->optPosition[0], CTX::instance()->optPosition[1]); + win->position(CTX::instance()->optPosition[0], + CTX::instance()->optPosition[1]); win->end(); } diff --git a/Fltk/gamepadWindow.h b/Fltk/gamepadWindow.h index bae0ad78c9154aed6385b799c0b04d6f475187a2..42f5bc323d69f4e019a196c2fde12fee420811fd 100644 --- a/Fltk/gamepadWindow.h +++ b/Fltk/gamepadWindow.h @@ -12,14 +12,12 @@ #include <FL/Fl_Value_Input.H> #include <FL/Fl_Box.H> - extern Fl_Menu_Item menu_font_names[]; - // A small 2D widget to visualize the coordinates of a point on the unit // circle. class AxesPositionWidget : public Fl_Widget { - private: +private: double _x, _y; void draw() { @@ -34,8 +32,9 @@ class AxesPositionWidget : public Fl_Widget { int py = int(y1 + 0.5 * h1 * (1 - _y)); draw_box(FL_UP_BOX, px - 3, py - 3, 6, 6, FL_FOREGROUND_COLOR); } - public: - AxesPositionWidget(int x, int y, int w, const char *l=0) + +public: + AxesPositionWidget(int x, int y, int w, const char *l = 0) : Fl_Widget(x, y, w, w, l), _x(0.), _y(0.) { box(FL_FLAT_BOX); @@ -43,26 +42,23 @@ class AxesPositionWidget : public Fl_Widget { } void setValue(double x, double y) { - double norm = sqrt(x * x + y * y ); - if(norm){ - _x = x / norm; _y = y / norm; + double norm = sqrt(x * x + y * y); + if(norm) { + _x = x / norm; + _y = y / norm; } - else{ + else { _x = _y = 0.; } redraw(); } }; +class gamepadWindow { +public: + Fl_Window *win; - - - -class gamepadWindow{ - public: Fl_Window *win; - - struct{ - + struct { Fl_Check_Button *butt[21]; Fl_Check_Button *axe[21]; Fl_Check_Button *cont[21]; @@ -71,13 +67,10 @@ class gamepadWindow{ AxesPositionWidget *padR; AxesPositionWidget *Dpad; } gamepad; - - public: + +public: gamepadWindow(); double frequency; }; - - #endif - diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h index 1641c8736dbd8d2dcb35ac7998f05d08c9a27099..e44f02453405b486ec15a761af187da753d1df65 100644 --- a/Fltk/graphicWindow.h +++ b/Fltk/graphicWindow.h @@ -23,8 +23,8 @@ class openglWindow; class onelabGroup; class messageBrowser; -class graphicWindow{ - private: +class graphicWindow { +private: bool _autoScrollMessages; #if defined(__APPLE__) Fl_Sys_Menu_Bar *_sysbar; @@ -39,22 +39,24 @@ class graphicWindow{ Fl_Progress *_label; int _minWidth, _minHeight; std::vector<std::string> _messages; + +public: + std::vector<openglWindow *> gl; + public: - std::vector<openglWindow*> gl; - public: - graphicWindow(bool main=true, int numTiles=1, bool detachedMenu=false); + graphicWindow(bool main = true, int numTiles = 1, bool detachedMenu = false); ~graphicWindow(); - Fl_Window *getWindow(){ return _win; } - Fl_Window *getMenuWindow(){ return _menuwin; } - onelabGroup *getMenu(){ return _onelab; } - Fl_Progress *getProgress(){ return _label; } - Fl_Button *getSelectionButton(){ return _butt[9]; } - messageBrowser *getMessageBrowser(){ return _browser; } - std::vector<std::string> &getMessages(){ return _messages; } - int getMinWidth(){ return _minWidth; } - int getMinHeight(){ return _minHeight; } - void setAutoScroll(bool val){ _autoScrollMessages = val; } - bool getAutoScroll(){ return _autoScrollMessages; } + Fl_Window *getWindow() { return _win; } + Fl_Window *getMenuWindow() { return _menuwin; } + onelabGroup *getMenu() { return _onelab; } + Fl_Progress *getProgress() { return _label; } + Fl_Button *getSelectionButton() { return _butt[9]; } + messageBrowser *getMessageBrowser() { return _browser; } + std::vector<std::string> &getMessages() { return _messages; } + int getMinWidth() { return _minWidth; } + int getMinHeight() { return _minHeight; } + void setAutoScroll(bool val) { _autoScrollMessages = val; } + bool getAutoScroll() { return _autoScrollMessages; } void setTitle(const std::string &str); void setStereo(bool st); int getGlWidth(); @@ -72,7 +74,7 @@ public: void detachMenu(); void attachMenu(); void attachDetachMenu(); - bool isMenuDetached(){ return _menuwin ? true : false; } + bool isMenuDetached() { return _menuwin ? true : false; } bool split(openglWindow *g, char how); void setAnimButtons(int mode); void checkAnimButtons(); @@ -106,7 +108,7 @@ void mesh_3d_cb(Fl_Widget *w, void *data); void help_about_cb(Fl_Widget *w, void *data); void status_xyz1p_cb(Fl_Widget *w, void *data); void status_options_cb(Fl_Widget *w, void *data); -void status_play_manual(int time, int incr, bool redraw=true); +void status_play_manual(int time, int incr, bool redraw = true); void quick_access_cb(Fl_Widget *w, void *data); void show_hide_message_cb(Fl_Widget *w, void *data); void show_hide_menu_cb(Fl_Widget *w, void *data); diff --git a/Fltk/helpWindow.cpp b/Fltk/helpWindow.cpp index 1f2c701659e84cdd014a42e5f0b1ecb12515f5f5..70e11816b254d8fa328de031e12bc808a66c10f4 100644 --- a/Fltk/helpWindow.cpp +++ b/Fltk/helpWindow.cpp @@ -43,28 +43,27 @@ static const char *help_link(Fl_Widget *w, const char *uri) return 0; } -struct opt_data{ +struct opt_data { std::string category; int index; std::string name; }; -static void interactive_cb(Fl_Widget* w, void* data) +static void interactive_cb(Fl_Widget *w, void *data) { if(!data) return; - inputValueFloat *v = (inputValueFloat*)w; - opt_data *d = (opt_data*)data; + inputValueFloat *v = (inputValueFloat *)w; + opt_data *d = (opt_data *)data; double val = v->value(); - NumberOption(GMSH_SET|GMSH_GUI, d->category.c_str(), d->index, + NumberOption(GMSH_SET | GMSH_GUI, d->category.c_str(), d->index, d->name.c_str(), val); drawContext::global()->draw(); } double numberOrStringOptionChooser(const std::string &category, int index, const std::string &name, bool isNumber, - const std::string &title, - bool isInteractive, double minimum, - double maximum, double step) + const std::string &title, bool isInteractive, + double minimum, double maximum, double step) { double valn = 0.; std::string vals = ""; @@ -82,10 +81,10 @@ double numberOrStringOptionChooser(const std::string &category, int index, win->hotspot(win); inputValueFloat *number = 0; Fl_Input *string = 0; - if(isNumber){ + if(isNumber) { number = new inputValueFloat(WB, WB, width - 2 * WB, BH); number->value(valn); - if(isInteractive){ + if(isInteractive) { static opt_data d; d.category = category; d.index = index; @@ -93,61 +92,60 @@ double numberOrStringOptionChooser(const std::string &category, int index, number->minimum(minimum); number->maximum(maximum); number->step(step, 1); - number->callback(interactive_cb, (void*)&d); + number->callback(interactive_cb, (void *)&d); number->when(FL_WHEN_RELEASE); } } - else{ + else { string = new Fl_Input(WB, WB, width - 2 * WB, BH); string->value(vals.c_str()); } - Fl_Button *ok = new Fl_Return_Button - (width - nn * BB - nn * WB, 2 * WB + BH, BB, BH, "OK"); - Fl_Button *def = new Fl_Button - (width - (nn - 1) * BB - (nn - 1) * WB, 2 * WB + BH, BB, BH, "Default"); + Fl_Button *ok = + new Fl_Return_Button(width - nn * BB - nn * WB, 2 * WB + BH, BB, BH, "OK"); + Fl_Button *def = new Fl_Button(width - (nn - 1) * BB - (nn - 1) * WB, + 2 * WB + BH, BB, BH, "Default"); Fl_Button *cancel = 0; if(!isInteractive) - cancel = new Fl_Button - (width - BB - WB, 2 * WB + BH, BB, BH, "Cancel"); + cancel = new Fl_Button(width - BB - WB, 2 * WB + BH, BB, BH, "Cancel"); win->end(); win->show(); if(number) number->take_focus(); if(string) string->take_focus(); bool done = false; - while(win->shown()){ + while(win->shown()) { if(done) break; Fl::wait(); - for (;;) { - Fl_Widget* o = Fl::readqueue(); - if (!o) break; - if (o == win || o == cancel) { + for(;;) { + Fl_Widget *o = Fl::readqueue(); + if(!o) break; + if(o == win || o == cancel) { done = true; break; } - if(o == ok){ - if(isNumber){ + if(o == ok) { + if(isNumber) { valn = number->value(); - NumberOption(GMSH_SET|GMSH_GUI, category.c_str(), index, + NumberOption(GMSH_SET | GMSH_GUI, category.c_str(), index, name.c_str(), valn); } - else{ + else { vals = string->value(); - StringOption(GMSH_SET|GMSH_GUI, category.c_str(), index, + StringOption(GMSH_SET | GMSH_GUI, category.c_str(), index, name.c_str(), vals); } done = true; break; } - if(o == def){ - if(isNumber){ - NumberOption(GMSH_GET_DEFAULT, category.c_str(), index, - name.c_str(), valn); + if(o == def) { + if(isNumber) { + NumberOption(GMSH_GET_DEFAULT, category.c_str(), index, name.c_str(), + valn); number->value(valn); if(isInteractive) number->do_callback(); } - else{ - StringOption(GMSH_GET_DEFAULT, category.c_str(), index, - name.c_str(), vals); + else { + StringOption(GMSH_GET_DEFAULT, category.c_str(), index, name.c_str(), + vals); string->value(vals.c_str()); } break; @@ -156,7 +154,7 @@ double numberOrStringOptionChooser(const std::string &category, int index, } delete win; - if(isNumber){ + if(isNumber) { NumberOption(GMSH_GET, category.c_str(), index, name.c_str(), valn); return valn; } @@ -172,9 +170,10 @@ static void colorOptionChooser(const std::string &category, int index, uchar r = CTX::instance()->unpackRed(col); uchar g = CTX::instance()->unpackGreen(col); uchar b = CTX::instance()->unpackBlue(col); - if(fl_color_chooser("Color Chooser", r, g, b, 1)){ + if(fl_color_chooser("Color Chooser", r, g, b, 1)) { col = CTX::instance()->packColor(r, g, b, 255); - ColorOption(GMSH_SET|GMSH_GUI, category.c_str(), index, name.c_str(), col); + ColorOption(GMSH_SET | GMSH_GUI, category.c_str(), index, name.c_str(), + col); } } @@ -184,7 +183,7 @@ static void editOption(const std::string &type, const std::string &cat, std::string category = cat; int index = 0; std::string::size_type p1 = cat.find('['), p2 = cat.find(']'); - if(p1 != std::string::npos && p2 != std::string::npos){ + if(p1 != std::string::npos && p2 != std::string::npos) { category = cat.substr(0, p1); std::string num = cat.substr(p1 + 1, p2 - p1 - 1); index = atoi(num.c_str()); @@ -200,27 +199,29 @@ static void editOption(const std::string &type, const std::string &cat, static void browser_cb(Fl_Widget *w, void *data) { - if(Fl::event_clicks()){ + if(Fl::event_clicks()) { // edit value for(int i = 1; i <= FlGui::instance()->help->browser->size(); i++) { if(FlGui::instance()->help->browser->selected(i)) { const char *text = FlGui::instance()->help->browser->text(i); - const char *data = (const char*)FlGui::instance()->help->browser->data(i); - if(data){ + const char *data = + (const char *)FlGui::instance()->help->browser->data(i); + if(data) { std::string option(text), type(data), c1, c2; std::string::size_type p1 = std::string::npos, p2 = p1; p1 = option.find_first_of('.'); - if(p1 != std::string::npos){ + if(p1 != std::string::npos) { c1 = option.substr(0, p1); p2 = option.find_first_of(' ', p1); - if(p2 != std::string::npos) - c2 = option.substr(p1 + 1, p2 - p1 - 1); + if(p2 != std::string::npos) c2 = option.substr(p1 + 1, p2 - p1 - 1); } - if(type == "color"){ - if(c2.size() > 6) c2 = c2.substr(6); - else c2 = ""; + if(type == "color") { + if(c2.size() > 6) + c2 = c2.substr(6); + else + c2 = ""; } - if(c1.size() && c2.size()){ + if(c1.size() && c2.size()) { editOption(type, c1, c2); int top = FlGui::instance()->help->browser->topline(); help_options_cb(0, 0); @@ -233,7 +234,7 @@ static void browser_cb(Fl_Widget *w, void *data) } } } - else{ + else { // copy to clipboard std::string buff; for(int i = 1; i <= FlGui::instance()->help->browser->size(); i++) { @@ -266,19 +267,22 @@ void help_options_cb(Fl_Widget *w, void *data) int top = FlGui::instance()->help->browser->topline(); FlGui::instance()->help->browser->clear(); - for(unsigned int i = 0; i < s0.size(); i++){ + for(unsigned int i = 0; i < s0.size(); i++) { std::string::size_type sep = s0[i].rfind('\0'); void *d = 0; - if(sep != std::string::npos){ + if(sep != std::string::npos) { std::string tmp = s0[i].substr(sep + 1); - if(tmp == "number") d = (void*)"number"; - else if(tmp == "string") d = (void*)"string"; - else if(tmp == "color") d = (void*)"color"; + if(tmp == "number") + d = (void *)"number"; + else if(tmp == "string") + d = (void *)"string"; + else if(tmp == "color") + d = (void *)"color"; } - if(search.empty()){ + if(search.empty()) { FlGui::instance()->help->browser->add(s0[i].c_str(), d); } - else{ + else { std::string tmp(s0[i]); std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower); if(tmp.find(search) != std::string::npos) @@ -294,8 +298,9 @@ helpWindow::helpWindow() int width = 28 * FL_NORMAL_SIZE; int height = 19 * BH; - about = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "About Gmsh"); + about = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "About Gmsh"); about->box(GMSH_WINDOW_BOX); Fl_Help_View *o = new Fl_Help_View(0, 0, width, height); @@ -303,46 +308,47 @@ helpWindow::helpWindow() o->textsize(FL_NORMAL_SIZE); o->box(FL_FLAT_BOX); std::ostringstream sstream; - sstream << "<center><h3>Gmsh</h3><br>version " << GetGmshVersion() - << "<p>Copyright (C) 1997-2018" - << "<br>Christophe Geuzaine and Jean-Francois Remacle" - << "<p><a href=\"http://gmsh.info/doc/CREDITS.txt\">Credits</a> " - << "and <a href=\"http://gmsh.info/doc/LICENSE.txt\">licensing " - << "information</a>" - << "<p>Please send all questions and bug reports to the public mailing list " - << "<a href=\"mailto:gmsh@onelab.info\">gmsh@onelab.info</a></center>" - << "<ul>" - << "<li><i>Build OS:</i> " << GetGmshBuildOS() - << "<li><i>Build date:</i> " << GetGmshBuildDate() - << "<li><i>Build host:</i> " << GetGmshBuildHost() - << "<li><i>Build options:</i>" << GetGmshBuildOptions() - << "<li><i>FLTK version:</i> " - << FL_MAJOR_VERSION << "." << FL_MINOR_VERSION << "." << FL_PATCH_VERSION + sstream + << "<center><h3>Gmsh</h3><br>version " << GetGmshVersion() + << "<p>Copyright (C) 1997-2018" + << "<br>Christophe Geuzaine and Jean-Francois Remacle" + << "<p><a href=\"http://gmsh.info/doc/CREDITS.txt\">Credits</a> " + << "and <a href=\"http://gmsh.info/doc/LICENSE.txt\">licensing " + << "information</a>" + << "<p>Please send all questions and bug reports to the public mailing " + "list " + << "<a href=\"mailto:gmsh@onelab.info\">gmsh@onelab.info</a></center>" + << "<ul>" + << "<li><i>Build OS:</i> " << GetGmshBuildOS() + << "<li><i>Build date:</i> " << GetGmshBuildDate() + << "<li><i>Build host:</i> " << GetGmshBuildHost() + << "<li><i>Build options:</i>" << GetGmshBuildOptions() + << "<li><i>FLTK version:</i> " << FL_MAJOR_VERSION << "." + << FL_MINOR_VERSION << "." << FL_PATCH_VERSION #if defined(HAVE_PETSC) - << "<li><i>PETSc version:</i> " << PETSC_VERSION_MAJOR << "." - << PETSC_VERSION_MINOR << "." << PETSC_VERSION_SUBMINOR + << "<li><i>PETSc version:</i> " << PETSC_VERSION_MAJOR << "." + << PETSC_VERSION_MINOR << "." << PETSC_VERSION_SUBMINOR #if defined(PETSC_USE_COMPLEX) - << " (complex arithmetic)" + << " (complex arithmetic)" #else - << " (real arithmetic)" + << " (real arithmetic)" #endif #endif #if defined(HAVE_OCC) - << "<li><i>OCC version:</i> " << OCC_VERSION_MAJOR << "." - << OCC_VERSION_MINOR << "." << OCC_VERSION_MAINTENANCE + << "<li><i>OCC version:</i> " << OCC_VERSION_MAJOR << "." + << OCC_VERSION_MINOR << "." << OCC_VERSION_MAINTENANCE #endif #if defined(HAVE_MED) - << "<li><i>MED version:</i> " << MED_NUM_MAJEUR << "." - << MED_NUM_MINEUR << "." << MED_NUM_RELEASE + << "<li><i>MED version:</i> " << MED_NUM_MAJEUR << "." << MED_NUM_MINEUR + << "." << MED_NUM_RELEASE #endif - << "<li><i>Packaged by:</i> " << GetGmshPackager() - << "</ul>" - << "<center>Visit <a href=\"http://gmsh.info\">http://gmsh.info</a> " - << "for more information</center>"; + << "<li><i>Packaged by:</i> " << GetGmshPackager() << "</ul>" + << "<center>Visit <a href=\"http://gmsh.info\">http://gmsh.info</a> " + << "for more information</center>"; o->value(sstream.str().c_str()); o->link(help_link); - about->position(Fl::x() + Fl::w()/2 - width / 2, - Fl::y() + Fl::h()/2 - height / 2); + about->position(Fl::x() + Fl::w() / 2 - width / 2, + Fl::y() + Fl::h() / 2 - height / 2); about->end(); } @@ -350,9 +356,9 @@ helpWindow::helpWindow() int width = 40 * FL_NORMAL_SIZE; int height = 18 * BH; - basic = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, - "Keyboard and Mouse Usage"); + basic = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Keyboard and Mouse Usage"); basic->box(GMSH_WINDOW_BOX); Fl_Help_View *o = new Fl_Help_View(0, 0, width, height); @@ -364,9 +370,11 @@ helpWindow::helpWindow() s += "<h3>Keyboard Shortcuts</h3>"; s += "<table border=1>"; { - std::vector<std::pair<std::string, std::string> > s0 = GetShortcutsUsage(); + std::vector<std::pair<std::string, std::string> > s0 = + GetShortcutsUsage(); for(unsigned int i = 0; i < s0.size(); i++) - s += "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; + s += + "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; } s += "</table>"; @@ -375,21 +383,22 @@ helpWindow::helpWindow() { std::vector<std::pair<std::string, std::string> > s0 = GetMouseUsage(); for(unsigned int i = 0; i < s0.size(); i++) - s += "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; + s += + "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; } s += "</table>"; s += "For a 2 button mouse, Middle button = Shift+Left button.<p>"; s += "For a 1 button mouse, Middle button = Shift+Left button, " "Right button = Alt+Left button."; - s += "<h3>Command Line Switches</h3>"; s += "<table border=1>"; { std::vector<std::pair<std::string, std::string> > s0 = GetUsage(); for(unsigned int i = 0; i < s0.size(); i++) if(s0[i].first.size() && s0[i].second.size()) - s += "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + "</td></tr>"; + s += "<tr><td>" + s0[i].first + "</td><td>" + s0[i].second + + "</td></tr>"; else if(s0[i].first.size() && s0[i].second.empty()) s += "</table>" + s0[i].first + "<table border=1>"; } @@ -398,8 +407,8 @@ helpWindow::helpWindow() o->value(s.c_str()); basic->resizable(o); - basic->position(Fl::x() + Fl::w()/2 - width / 2, - Fl::y() + Fl::h()/2 - height / 2); + basic->position(Fl::x() + Fl::w() / 2 - width / 2, + Fl::y() + Fl::h() / 2 - height / 2); basic->end(); } @@ -407,35 +416,34 @@ helpWindow::helpWindow() int width = 40 * FL_NORMAL_SIZE; int height = 18 * BH; - options = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, - "Current Options and Workspace"); + options = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Current Options and Workspace"); options->box(GMSH_WINDOW_BOX); int BW = (width - 4 * WB) / 3; - modified = new Fl_Check_Button - (WB, WB, BW, BH, "Only show modified"); + modified = new Fl_Check_Button(WB, WB, BW, BH, "Only show modified"); modified->type(FL_TOGGLE_BUTTON); modified->callback(help_options_cb); modified->tooltip("Show only values different from defaults"); - showhelp = new Fl_Check_Button - (2 * WB + BW, WB, BW, BH, "Show help"); + showhelp = new Fl_Check_Button(2 * WB + BW, WB, BW, BH, "Show help"); showhelp->type(FL_TOGGLE_BUTTON); showhelp->callback(help_options_cb); showhelp->tooltip("Show help strings"); - Fl_Group* o = new Fl_Group(3 * WB + 2 * BW, WB, BW, BH); + Fl_Group *o = new Fl_Group(3 * WB + 2 * BW, WB, BW, BH); o->tooltip("Filter values"); o->box(FL_DOWN_BOX); o->color(FL_BACKGROUND2_COLOR); - search = new Fl_Input - (3 * WB + 2 * BW + BH, WB + 2, BW - BH - 2, BH - 4, "@gmsh_search"); + search = new Fl_Input(3 * WB + 2 * BW + BH, WB + 2, BW - BH - 2, BH - 4, + "@gmsh_search"); search->box(FL_FLAT_BOX); search->callback(help_options_cb); search->when(FL_WHEN_CHANGED); - //search->take_focus(); cannot call this here - it triggers show() on Linux in fltk 1.3.3 + // search->take_focus(); cannot call this here - it triggers show() on Linux + // in fltk 1.3.3 o->resizable(search); o->end(); @@ -446,24 +454,24 @@ helpWindow::helpWindow() browser->type(FL_MULTI_BROWSER); browser->callback(browser_cb); browser->tooltip("Double-click to edit value"); - browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars { - Fl_Group* g = new Fl_Group(0, height - BH - WB, width, BH); - Fl_Group* g2 = new Fl_Group(0, height - BH - WB, BB, BH); + Fl_Group *g = new Fl_Group(0, height - BH - WB, width, BH); + Fl_Group *g2 = new Fl_Group(0, height - BH - WB, BB, BH); g->resizable(g2); g2->end(); - Fl_Return_Button *o = new Fl_Return_Button - (width - BB - WB, height - BH - WB, BB, BH, "Update"); + Fl_Return_Button *o = new Fl_Return_Button( + width - BB - WB, height - BH - WB, BB, BH, "Update"); o->callback(help_options_cb); g->end(); } options->resizable(browser); - options->position(Fl::x() + Fl::w()/2 - width / 2, - Fl::y() + Fl::h()/2 - height / 2); + options->position(Fl::x() + Fl::w() / 2 - width / 2, + Fl::y() + Fl::h() / 2 - height / 2); options->size_range(width, height); options->end(); } - } diff --git a/Fltk/helpWindow.h b/Fltk/helpWindow.h index 9098d177f17287003cdd005666faef398788cd47..cbe84b3e4c074ae0a212b13f8e25e3a969c69ff1 100644 --- a/Fltk/helpWindow.h +++ b/Fltk/helpWindow.h @@ -9,21 +9,24 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Browser.H> -class helpWindow{ - public: +class helpWindow { +public: Fl_Window *about, *basic, *options; Fl_Check_Button *modified, *showhelp; Fl_Input *search; Fl_Browser *browser; - public: + +public: helpWindow(); }; void help_options_cb(Fl_Widget *w, void *data); double numberOrStringOptionChooser(const std::string &category, int index, - const std::string &name, bool isNumber=true, - const std::string &title="", - bool isInteractive=false, double minimum=0., - double maximum=0., double step=0.); + const std::string &name, + bool isNumber = true, + const std::string &title = "", + bool isInteractive = false, + double minimum = 0., double maximum = 0., + double step = 0.); #endif diff --git a/Fltk/highOrderToolsWindow.cpp b/Fltk/highOrderToolsWindow.cpp index a1d81c14c91b098c455d6554307aa6e59250f60d..d8b0e42115569eca2a6dced52bc68e65b9f2f984 100644 --- a/Fltk/highOrderToolsWindow.cpp +++ b/Fltk/highOrderToolsWindow.cpp @@ -31,7 +31,7 @@ #include "OptHomFastCurving.h" #endif -//static void change_completeness_cb(Fl_Widget *w, void *data) +// static void change_completeness_cb(Fl_Widget *w, void *data) //{ // highOrderToolsWindow *o = FlGui::instance()->highordertools; // bool onlyVisible = (bool)o->butt[1]->value(); @@ -58,7 +58,7 @@ static void highordertools_runp_cb(Fl_Widget *w, void *data) bool incomplete = (bool)o->butt[0]->value(); bool onlyVisible = (bool)o->butt[1]->value(); - if (order == 1) + if(order == 1) SetOrder1(GModel::current()); else SetOrderN(GModel::current(), order, linear, incomplete, onlyVisible); @@ -83,7 +83,7 @@ static void chooseopti_cb(Fl_Widget *w, void *data) const int algo = o->choice[2]->value(); switch(algo) { - case 0: { // Optimization + case 0: { // Optimization o->choice[0]->activate(); o->choice[3]->activate(); o->value[1]->activate(); @@ -93,7 +93,7 @@ static void chooseopti_cb(Fl_Widget *w, void *data) o->value[5]->activate(); o->value[7]->activate(); o->value[8]->activate(); - if (o->choice[3]->value() == 0) { + if(o->choice[3]->value() == 0) { o->value[9]->deactivate(); o->value[10]->deactivate(); o->value[11]->deactivate(); @@ -105,7 +105,7 @@ static void chooseopti_cb(Fl_Widget *w, void *data) } break; } - case 1: { // Elastic analogy + case 1: { // Elastic analogy o->choice[0]->deactivate(); o->choice[3]->deactivate(); o->value[1]->deactivate(); @@ -120,7 +120,7 @@ static void chooseopti_cb(Fl_Widget *w, void *data) o->value[11]->deactivate(); break; } - case 2: { // Fast curving + case 2: { // Fast curving o->choice[0]->deactivate(); o->choice[3]->deactivate(); o->value[1]->deactivate(); @@ -135,7 +135,7 @@ static void chooseopti_cb(Fl_Widget *w, void *data) o->value[11]->deactivate(); break; } - case 3: { // Fast curving 2 + case 3: { // Fast curving 2 o->choice[0]->deactivate(); o->choice[3]->deactivate(); o->value[1]->deactivate(); @@ -151,65 +151,63 @@ static void chooseopti_cb(Fl_Widget *w, void *data) break; } } - } static void chooseopti_strategy(Fl_Widget *w, void *data) { highOrderToolsWindow *o = FlGui::instance()->highordertools; - if (o->choice[3]->value() == 1) - for (int i=9;i<=11;i++) o->value[i]->activate(); + if(o->choice[3]->value() == 1) + for(int i = 9; i <= 11; i++) o->value[i]->activate(); else - for (int i=9;i<=11;i++) o->value[i]->deactivate(); + for(int i = 9; i <= 11; i++) o->value[i]->deactivate(); } static void highordertools_runopti_cb(Fl_Widget *w, void *data) { highOrderToolsWindow *o = FlGui::instance()->highordertools; - if(o->butt[3]->value()) - FlGui::instance()->graph[0]->showMessages(); + if(o->butt[3]->value()) FlGui::instance()->graph[0]->showMessages(); const int algo = o->choice[2]->value(); bool onlyVisible = (bool)o->butt[1]->value(); int NE = 0; - for (GModel::riter it = GModel::current()->firstRegion(); - it != GModel::current()->lastRegion(); ++it) { + for(GModel::riter it = GModel::current()->firstRegion(); + it != GModel::current()->lastRegion(); ++it) { NE += (*it)->getNumMeshElements(); } - int dim = GModel::current()->getDim() == 3 ? ( NE ? 3 : 2 ) : GModel::current()->getDim(); - + int dim = GModel::current()->getDim() == 3 ? (NE ? 3 : 2) : + GModel::current()->getDim(); #if defined(HAVE_OPTHOM) switch(algo) { - case 0: { // Optimization + case 0: { // Optimization OptHomParameters p; - p.nbLayers = (int) o->value[2]->value(); + p.nbLayers = (int)o->value[2]->value(); p.BARRIER_MIN = o->value[1]->value(); p.BARRIER_MAX = o->value[8]->value(); p.onlyVisible = onlyVisible; // change dim if no 3D elements are there p.dim = dim; - p.itMax = (int) o->value[3]->value(); - p.optPassMax = (int) o->value[4]->value(); + p.itMax = (int)o->value[3]->value(); + p.optPassMax = (int)o->value[4]->value(); p.weight = o->value[5]->value(); - p.distanceFactor = o->value[7]->value(); + p.distanceFactor = o->value[7]->value(); p.fixBndNodes = (!o->CAD) || (o->choice[0]->value() == 0); p.strategy = o->choice[3]->value(); p.maxAdaptBlob = o->value[9]->value(); - p.adaptBlobLayerFact = (int) o->value[10]->value(); + p.adaptBlobLayerFact = (int)o->value[10]->value(); p.adaptBlobDistFact = o->value[11]->value(); p.optPrimSurfMesh = false; // HighOrderMeshOptimizer(GModel::current(), p); HighOrderMeshOptimizerNew(GModel::current(), p); break; } - case 1: { // Elastic analogy + case 1: { // Elastic analogy ElasticAnalogy(GModel::current(), onlyVisible); break; } - case 2: { // Fast curving + case 2: { // Fast curving FastCurvingParameters p; p.onlyVisible = onlyVisible; p.dim = dim; @@ -218,11 +216,11 @@ static void highordertools_runopti_cb(Fl_Widget *w, void *data) HighOrderMeshFastCurving(GModel::current(), p); break; } - case 3: { // Fast curving 2 + case 3: { // Fast curving 2 FastCurvingParameters p; p.onlyVisible = onlyVisible; p.thickness = true; - if (dim == 3) { + if(dim == 3) { p.dim = 2; HighOrderMeshFastCurving(GModel::current(), p); } @@ -247,48 +245,49 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) int width = 3 * IW + 4 * WB; int height = 24 * BH; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "High order tools"); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "High order tools"); win->box(GMSH_WINDOW_BOX); int y = WB; int x = 2 * WB; box[0] = new Fl_Box(x, y, width - 4 * WB, BH); - box[0]->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); + box[0]->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); y += BH; - butt[1] = new Fl_Check_Button - (x, y, width - 4 * WB, BH, "Only apply high order tools to visible entities"); + butt[1] = + new Fl_Check_Button(x, y, width - 4 * WB, BH, + "Only apply high order tools to visible entities"); butt[1]->type(FL_TOGGLE_BUTTON); butt[1]->value(1); y += BH; - butt[3] = new Fl_Check_Button - (x, y, width - 4 * WB, BH, "Show detailed log messages"); + butt[3] = + new Fl_Check_Button(x, y, width - 4 * WB, BH, "Show detailed log messages"); butt[3]->type(FL_TOGGLE_BUTTON); butt[3]->value(0); { y += BH / 2; - Fl_Box* b = new Fl_Box(x, y + BH - WB, width - 4 * WB, 2); + Fl_Box *b = new Fl_Box(x, y + BH - WB, width - 4 * WB, 2); b->box(FL_ENGRAVED_FRAME); b->labeltype(FL_NO_LABEL); } { y += BH; - Fl_Box *b = new Fl_Box - (x - WB, y, width, BH, "1. Generation of high order nodes"); + Fl_Box *b = + new Fl_Box(x - WB, y, width, BH, "1. Generation of high order nodes"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); } y += BH; - value[0] = new Fl_Value_Input - (x, y, IW, BH, "Polynomial order"); + value[0] = new Fl_Value_Input(x, y, IW, BH, "Polynomial order"); value[0]->minimum(1); value[0]->maximum(10); value[0]->step(1); @@ -297,38 +296,37 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) y += BH; - butt[0] = new Fl_Check_Button - (x, y, width - 4 * WB, BH, "Generate incomplete elements"); + butt[0] = new Fl_Check_Button(x, y, width - 4 * WB, BH, + "Generate incomplete elements"); butt[0]->type(FL_TOGGLE_BUTTON); butt[0]->value(!complete); // AJ: This is bad a design. Add a proper Fl_Button to toggle between // completeness if needed. Plus: only 2d version implemented for now -// butt[0]->callback(change_completeness_cb); + // butt[0]->callback(change_completeness_cb); y += BH; - butt[2] = new Fl_Check_Button - (x, y, width - 4 * WB, BH, "Use CAD model to curve mesh"); + butt[2] = new Fl_Check_Button(x, y, width - 4 * WB, BH, + "Use CAD model to curve mesh"); butt[2]->type(FL_TOGGLE_BUTTON); butt[2]->value(1); y += BH; - push[0] = new Fl_Button - (width - BB - 2 * WB, y, BB, BH, "Generate"); + push[0] = new Fl_Button(width - BB - 2 * WB, y, BB, BH, "Generate"); push[0]->callback(highordertools_runp_cb); { y += BH / 2; - Fl_Box* b = new Fl_Box(x, y + BH - WB, width - 4 * WB, 2); + Fl_Box *b = new Fl_Box(x, y + BH - WB, width - 4 * WB, 2); b->box(FL_ENGRAVED_FRAME); b->labeltype(FL_NO_LABEL); } { y += BH; - Fl_Box *b = new Fl_Box - (x - WB, y, width, BH, "2. Regularization of high order elements"); + Fl_Box *b = new Fl_Box(x - WB, y, width, BH, + "2. Regularization of high order elements"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); } @@ -338,25 +336,22 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) {"Elastic Analogy", 0, 0, 0}, {"Fast Curving", 0, 0, 0}, {"Curve boundary layers (3D is experimental)", 0, 0, 0}, - {0} - }; - choice[2] = new Fl_Choice - (x, y, IW, BH, "Algorithm"); + {0}}; + choice[2] = new Fl_Choice(x, y, IW, BH, "Algorithm"); choice[2]->align(FL_ALIGN_RIGHT); choice[2]->menu(menu_method); choice[2]->callback(chooseopti_cb); y += BH; - value[1] = new Fl_Value_Input - (x, y, IW/2.0, BH); + value[1] = new Fl_Value_Input(x, y, IW / 2.0, BH); value[1]->minimum(0); value[1]->maximum(1); value[1]->step(.01); value[1]->align(FL_ALIGN_RIGHT); value[1]->value(CTX::instance()->mesh.hoThresholdMin); - value[8] = new Fl_Value_Input - (x+IW/2.0,y, IW/2.0, BH, "Target Jacobian range"); + value[8] = + new Fl_Value_Input(x + IW / 2.0, y, IW / 2.0, BH, "Target Jacobian range"); value[8]->minimum(1); value[8]->maximum(10); value[8]->step(.01); @@ -364,8 +359,7 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) value[8]->value(CTX::instance()->mesh.hoThresholdMax); y += BH; - value[2] = new Fl_Value_Input - (x, y, IW, BH, "Number of layers"); + value[2] = new Fl_Value_Input(x, y, IW, BH, "Number of layers"); value[2]->minimum(1); value[2]->maximum(20); value[2]->step(1); @@ -373,8 +367,7 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) value[2]->value(CTX::instance()->mesh.hoNLayers); y += BH; - value[7] = new Fl_Value_Input - (x, y, IW, BH, "Distance factor"); + value[7] = new Fl_Value_Input(x, y, IW, BH, "Distance factor"); value[7]->minimum(1); value[7]->maximum(20000); value[7]->step(1); @@ -383,24 +376,18 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) y += BH; static Fl_Menu_Item menu_objf[] = { - {"Fixed", 0, 0, 0}, - {"Free", 0, 0, 0}, - {0} - }; - choice[0] = new Fl_Choice - (x, y, IW, BH, "Boundary nodes"); + {"Fixed", 0, 0, 0}, {"Free", 0, 0, 0}, {0}}; + choice[0] = new Fl_Choice(x, y, IW, BH, "Boundary nodes"); choice[0]->menu(menu_objf); choice[0]->align(FL_ALIGN_RIGHT); y += BH; - value[5] = new Fl_Value_Input - (x, y, IW, BH, "Weight on node displacement"); + value[5] = new Fl_Value_Input(x, y, IW, BH, "Weight on node displacement"); value[5]->align(FL_ALIGN_RIGHT); value[5]->value(1.); y += BH; - value[3] = new Fl_Value_Input - (x, y, IW, BH, "Maximum number of iterations"); + value[3] = new Fl_Value_Input(x, y, IW, BH, "Maximum number of iterations"); value[3]->minimum(1); value[3]->maximum(10000); value[3]->step(10); @@ -408,31 +395,27 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) value[3]->value(300); y += BH; - value[4] = new Fl_Value_Input - (x, y, IW, BH, "Max. number of barrier updates"); + value[4] = new Fl_Value_Input(x, y, IW, BH, "Max. number of barrier updates"); value[4]->minimum(1); value[4]->maximum(100); value[4]->step(1); value[4]->align(FL_ALIGN_RIGHT); value[4]->value(50); - static Fl_Menu_Item menu_strategy[] = { - {"Disjoint strong", 0, 0, 0}, - {"Adaptive one-by-one", 0, 0, 0}, - {"Disjoint weak", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item menu_strategy[] = {{"Disjoint strong", 0, 0, 0}, + {"Adaptive one-by-one", 0, 0, 0}, + {"Disjoint weak", 0, 0, 0}, + {0}}; y += BH; - choice[3] = new Fl_Choice - (x, y, IW, BH, "Strategy"); + choice[3] = new Fl_Choice(x, y, IW, BH, "Strategy"); choice[3]->menu(menu_strategy); choice[3]->align(FL_ALIGN_RIGHT); choice[3]->callback(chooseopti_strategy); y += BH; - value[9] = new Fl_Value_Input - (x, y, IW, BH, "Max. number of patch adaptation iter."); + value[9] = + new Fl_Value_Input(x, y, IW, BH, "Max. number of patch adaptation iter."); value[9]->minimum(1); value[9]->maximum(100); value[9]->step(1); @@ -441,8 +424,7 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) value[9]->deactivate(); y += BH; - value[10] = new Fl_Value_Input - (x, y, IW, BH, "Num. layer adaptation factor"); + value[10] = new Fl_Value_Input(x, y, IW, BH, "Num. layer adaptation factor"); value[10]->align(FL_ALIGN_RIGHT); value[10]->minimum(1); value[10]->maximum(100); @@ -451,21 +433,20 @@ highOrderToolsWindow::highOrderToolsWindow(int deltaFontSize) value[10]->deactivate(); y += BH; - value[11] = new Fl_Value_Input - (x, y, IW, BH, "Distance adaptation factor"); + value[11] = new Fl_Value_Input(x, y, IW, BH, "Distance adaptation factor"); value[11]->align(FL_ALIGN_RIGHT); value[11]->minimum(1.); value[11]->maximum(100.); value[11]->value(2.); value[11]->deactivate(); - y += 1.5*BH; - push[1] = new Fl_Button - (width - BB - 2 * WB, y, BB, BH, "Regularize"); + y += 1.5 * BH; + push[1] = new Fl_Button(width - BB - 2 * WB, y, BB, BH, "Regularize"); push[1]->callback(highordertools_runopti_cb); // win->resizable(o); - win->position(CTX::instance()->hotPosition[0], CTX::instance()->hotPosition[1]); + win->position(CTX::instance()->hotPosition[0], + CTX::instance()->hotPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; } @@ -479,7 +460,7 @@ void highOrderToolsWindow::show(bool redrawOnly) else { value[0]->value(meshOrder); butt[0]->value(!complete); - if (CAD) { + if(CAD) { box[0]->label("CAD model is available"); choice[0]->value(1); } @@ -495,7 +476,7 @@ void highordertools_cb(Fl_Widget *w, void *data) { // get the visibility info from the model, and update the browser // accordingly - const char *str = (const char*)data; + const char *str = (const char *)data; if(str && !strcmp(str, "redraw_only")) FlGui::instance()->highordertools->show(true); else diff --git a/Fltk/highOrderToolsWindow.h b/Fltk/highOrderToolsWindow.h index 7e3a4e2bf4839efd03645f951e75d0fb745ac2bb..db91665972873ff51c1a220aac5ad85fea2fa401 100644 --- a/Fltk/highOrderToolsWindow.h +++ b/Fltk/highOrderToolsWindow.h @@ -16,8 +16,8 @@ #include <FL/Fl_Value_Input.H> #include <FL/Fl_Output.H> -class highOrderToolsWindow{ - public: +class highOrderToolsWindow { +public: bool CAD, complete; int meshOrder; Fl_Window *win; @@ -26,8 +26,9 @@ class highOrderToolsWindow{ Fl_Value_Input *value[20]; Fl_Choice *choice[20]; Fl_Button *push[20]; - public: - highOrderToolsWindow(int deltaFontSize=0); + +public: + highOrderToolsWindow(int deltaFontSize = 0); void show(bool redrawOnly); }; diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h index 7fb95f4af07139c71eef933cbacaff78ef89fdf2..b39e7b3a5daedf69897f76165bbf1b649f669ab6 100644 --- a/Fltk/inputRange.h +++ b/Fltk/inputRange.h @@ -19,7 +19,7 @@ #include <FL/fl_ask.H> class inputRange : public Fl_Group { - private: +private: inputValueFloat *_input; Fl_Toggle_Button *_loop_butt; Fl_Button *_range_butt, *_graph_butt; @@ -33,27 +33,27 @@ class inputRange : public Fl_Group { { std::ostringstream tmp; tmp.precision(12); - if(_choices.size()){ + if(_choices.size()) { // construct range string using choices - for(unsigned int i = 0; i < _choices.size(); i++){ + for(unsigned int i = 0; i < _choices.size(); i++) { if(i) tmp << ", "; tmp << _choices[i]; } - if(_choices.size() > 1){ + if(_choices.size() > 1) { _input->minimum(_choices[0]); _input->maximum(_choices[_choices.size() - 1]); _input->step(_choices[1] - _choices[0], 1); } _step = 0.; } - else{ + else { // construct range string from min/max/step - if(_min != -_max_number){ + if(_min != -_max_number) { tmp << _min; _input->minimum(_min); } tmp << " : "; - if(_max != _max_number){ + if(_max != _max_number) { tmp << _max; _input->maximum(_max); } @@ -64,20 +64,20 @@ class inputRange : public Fl_Group { } _range = tmp.str(); if(_range_butt->active()) - _range_tooltip = "Edit range ["; + _range_tooltip = "Edit range ["; else - _range_tooltip = "Range ["; + _range_tooltip = "Range ["; _range_tooltip += _range + "]"; _range_butt->tooltip(_range_tooltip.c_str()); } void _string2values() { std::string str = _range; - if(str.find_first_of(',') != std::string::npos){ + if(str.find_first_of(',') != std::string::npos) { // parse list of values std::string::size_type first = 0; _choices.clear(); - while(1){ + while(1) { std::string::size_type last = str.find_first_of(',', first); std::string val = str.substr(first, last - first); _choices.push_back(atof(val.c_str())); @@ -86,33 +86,32 @@ class inputRange : public Fl_Group { else first = last + 1; } - if(_choices.size() > 1){ + if(_choices.size() > 1) { _input->minimum(_choices[0]); _input->maximum(_choices[_choices.size() - 1]); _input->step(_choices[1] - _choices[0], 1); } _step = 0.; } - else{ + else { // parse min/max/step std::string min, max, step; std::string::size_type first = 0; std::string::size_type last = str.find_first_of(':', first); min = str.substr(first, last - first); - if(last != std::string::npos){ + if(last != std::string::npos) { first = last + 1; last = str.find_first_of(':', first); max = str.substr(first, last - first); - if(last != std::string::npos) - step = str.substr(last + 1, str.size()); + if(last != std::string::npos) step = str.substr(last + 1, str.size()); } - if(min.size()){ + if(min.size()) { _min = atof(min.c_str()); _input->minimum(_min); } else _min = -_max_number; - if(max.size()){ + if(max.size()) { _max = atof(max.c_str()); _input->maximum(_max); } @@ -128,9 +127,11 @@ class inputRange : public Fl_Group { } void _edit_range() { - const char *ret = fl_input("Edit range ([min : max], [min : max : step], or " - "[val1, val2, ...]):", _range.c_str()); - if(ret){ + const char *ret = + fl_input("Edit range ([min : max], [min : max : step], or " + "[val1, val2, ...]):", + _range.c_str()); + if(ret) { _range = ret; _string2values(); _values2string(); @@ -141,52 +142,51 @@ class inputRange : public Fl_Group { void _set_loop_value(const std::string &val) { _loop_val = val; - if(val == "1"){ + if(val == "1") { _loop_butt->label("1"); _loop_butt->selection_color(FL_GREEN); _loop_butt->value(1); } - else if(val == "2"){ + else if(val == "2") { _loop_butt->label("2"); _loop_butt->selection_color(FL_BLUE); _loop_butt->value(1); } - else if(val == "3"){ + else if(val == "3") { _loop_butt->label("3"); _loop_butt->selection_color(FL_RED); _loop_butt->value(1); } - else{ + else { _loop_butt->label("@-1gmsh_rotate"); _loop_butt->selection_color(_loop_butt->color()); _loop_butt->value(0); } _loop_butt->redraw(); } - void _set_graph_value(const std::string &val, bool update_menu=true) + void _set_graph_value(const std::string &val, bool update_menu = true) { _graph_val = val; _graph_val.resize(36, '0'); - if(update_menu){ - int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, - 13, 14, 15, 16, 19, 20, 21, 22, - 25, 26, 27, 28, 31, 32, 33, 34, - 37, 38, 39, 40, 43, 44, 45, 46, - 49, 50, 51, 52}; - for(int i = 0; i < 36; i++){ + if(update_menu) { + int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 16, + 19, 20, 21, 22, 25, 26, 27, 28, 31, 32, 33, 34, + 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; + for(int i = 0; i < 36; i++) { if(_graph_val[i] != '0') - ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].set(); + ((Fl_Menu_Item *)_graph_menu->menu())[index[i]].set(); else - ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].clear(); + ((Fl_Menu_Item *)_graph_menu->menu())[index[i]].clear(); } } bool yellow = false; - for(int i = 0; i < 36; i++) if(_graph_val[i] != '0') yellow = true; - if(yellow){ + for(int i = 0; i < 36; i++) + if(_graph_val[i] != '0') yellow = true; + if(yellow) { _graph_butt->value(1); _graph_butt->selection_color(FL_YELLOW); } - else{ + else { _graph_butt->value(0); _graph_butt->selection_color(_graph_butt->color()); } @@ -194,36 +194,38 @@ class inputRange : public Fl_Group { } static void _input_cb(Fl_Widget *w, void *data) { - inputRange *b = (inputRange*)data; + inputRange *b = (inputRange *)data; b->doCallbackOnValues(true); b->do_callback(); } static void _range_butt_cb(Fl_Widget *w, void *data) { - inputRange *b = (inputRange*)data; + inputRange *b = (inputRange *)data; b->_edit_range(); } static void _loop_butt_cb(Fl_Widget *w, void *data) { - inputRange *b = (inputRange*)data; - if(b->_loop_val == "1") b->_set_loop_value("2"); - else if(b->_loop_val == "2") b->_set_loop_value("3"); - else if(b->_loop_val == "3") b->_set_loop_value("0"); - else b->_set_loop_value("1"); + inputRange *b = (inputRange *)data; + if(b->_loop_val == "1") + b->_set_loop_value("2"); + else if(b->_loop_val == "2") + b->_set_loop_value("3"); + else if(b->_loop_val == "3") + b->_set_loop_value("0"); + else + b->_set_loop_value("1"); b->doCallbackOnValues(false); b->do_callback(); } static void _graph_menu_cb(Fl_Widget *w, void *data) { - inputRange *b = (inputRange*)data; + inputRange *b = (inputRange *)data; std::string v; v.resize(36, '0'); - int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, - 13, 14, 15, 16, 19, 20, 21, 22, - 25, 26, 27, 28, 31, 32, 33, 34, - 37, 38, 39, 40, 43, 44, 45, 46, - 49, 50, 51, 52}; - for(int i = 0; i < 36; i++){ + int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 16, + 19, 20, 21, 22, 25, 26, 27, 28, 31, 32, 33, 34, + 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; + for(int i = 0; i < 36; i++) { // 1=iso, 2=continuous, 3=discrete, 4=numeric v[i] = b->_graph_menu->menu()[index[i]].value() ? '3' : '0'; } @@ -233,27 +235,29 @@ class inputRange : public Fl_Group { } static void _graph_menu_reset_cb(Fl_Widget *w, void *data) { - inputRange *b = (inputRange*)data; + inputRange *b = (inputRange *)data; std::string v; v.resize(36, '0'); b->_set_graph_value(v.c_str()); b->doCallbackOnValues(false); b->do_callback(); } - public: - inputRange(int x, int y, int w, int h, double max_number, bool readOnlyRange=false, - const char *l=0) - : Fl_Group(x,y,w,h,l), _min(-max_number), _max(max_number), _step(1.), + +public: + inputRange(int x, int y, int w, int h, double max_number, + bool readOnlyRange = false, const char *l = 0) + : Fl_Group(x, y, w, h, l), _min(-max_number), _max(max_number), _step(1.), _max_number(max_number), _do_callback_on_values(true) { _graph_val.resize(36, '0'); - int dot_w = FL_NORMAL_SIZE - 2, loop_w = FL_NORMAL_SIZE + 6, graph_w = loop_w; + int dot_w = FL_NORMAL_SIZE - 2, loop_w = FL_NORMAL_SIZE + 6, + graph_w = loop_w; int input_w = w - dot_w - loop_w - graph_w; _input = new inputValueFloat(x, y, input_w, h); _input->callback(_input_cb, this); - _input->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE); + _input->when(FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE); _range_butt = new Fl_Button(x + input_w, y, dot_w, h, ":"); _range_butt->callback(_range_butt_cb, this); @@ -271,7 +275,8 @@ class inputRange : public Fl_Group { _graph_butt->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE); _graph_butt->tooltip("Draw range on X-Y graph(s)"); - _graph_menu = new Fl_Menu_Button(x + input_w + dot_w + loop_w, y, graph_w, h); + _graph_menu = + new Fl_Menu_Button(x + input_w + dot_w + loop_w, y, graph_w, h); _graph_menu->type(Fl_Menu_Button::POPUP123); _graph_menu->add("Top Left/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Top Left/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); @@ -283,12 +288,18 @@ class inputRange : public Fl_Group { _graph_menu->add("Top Right/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Bottom Left/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Bottom Left/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Left/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Left/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); + _graph_menu->add("Bottom Left/X ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Left/Y ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/X ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/Y ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/X ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/Y ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); _graph_menu->add("Top/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Top/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Top/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); @@ -314,29 +325,45 @@ class inputRange : public Fl_Group { end(); // close the group resizable(_input); } - bool doCallbackOnValues(){ return _do_callback_on_values; } - void doCallbackOnValues(bool val){ _do_callback_on_values = val; } + bool doCallbackOnValues() { return _do_callback_on_values; } + void doCallbackOnValues(bool val) { _do_callback_on_values = val; } double value() { return _input->value(); } void value(double val) { _input->value(val); } - void choices(const std::vector<double> &val) { _choices = val; _values2string(); } + void choices(const std::vector<double> &val) + { + _choices = val; + _values2string(); + } std::vector<double> choices() { return _choices; } - void minimum(double val) { _min = val; _values2string(); } + void minimum(double val) + { + _min = val; + _values2string(); + } double minimum() { return _min; } - void maximum(double val) { _max = val; _values2string(); } + void maximum(double val) + { + _max = val; + _values2string(); + } double maximum() { return _max; } - void step(double val) { _step = val; _values2string(); } + void step(double val) + { + _step = val; + _values2string(); + } double step() { return _step; } - void loop(const std::string &val){ _set_loop_value(val); } - std::string loop(){ return _loop_val; } - void graph(const std::string &val){ _set_graph_value(val); } - std::string graph(){ return _graph_val; } + void loop(const std::string &val) { _set_loop_value(val); } + std::string loop() { return _loop_val; } + void graph(const std::string &val) { _set_graph_value(val); } + std::string graph() { return _graph_val; } void color(int col) { _input->color(col); _input->textcolor(fl_contrast(FL_FOREGROUND_COLOR, col)); } - int color(){ return _input->color(); } - Fl_Value_Input *input(){ return _input; } + int color() { return _input->color(); } + Fl_Value_Input *input() { return _input; } }; #endif diff --git a/Fltk/inputValue.cpp b/Fltk/inputValue.cpp index 58a3ea0f814a6c3287f1db0ffc081f96e4e125a4..2e1ce8bf397d4012852f0ad00fe13f2e346fb421 100644 --- a/Fltk/inputValue.cpp +++ b/Fltk/inputValue.cpp @@ -8,19 +8,19 @@ #include <stdlib.h> #include <FL/math.h> -void inputValueFloat::new_input_cb(Fl_Widget*, void* v) +void inputValueFloat::new_input_cb(Fl_Widget *, void *v) { - inputValueFloat& t = *(inputValueFloat*)v; + inputValueFloat &t = *(inputValueFloat *)v; double nv = strtod(t.input.value(), 0); - if (nv != t.value() || t.when() & FL_WHEN_NOT_CHANGED) { + if(nv != t.value() || t.when() & FL_WHEN_NOT_CHANGED) { t.set_value(nv); t.set_changed(); - if (t.when()) t.do_callback(); + if(t.when()) t.do_callback(); } } -inputValueFloat::inputValueFloat(int x, int y, int w, int h, const char *l) : - inputValue(x, y, w, h, l) +inputValueFloat::inputValueFloat(int x, int y, int w, int h, const char *l) + : inputValue(x, y, w, h, l) { input.type(FL_FLOAT_INPUT); input.callback(new_input_cb, this); @@ -33,42 +33,43 @@ int inputValueFloat::handle(int event) int mx = Fl::event_x_root(); static int ix, drag; input.when(when()); - switch (event) { + switch(event) { case FL_PUSH: - if (!step()) goto DEFAULT; + if(!step()) goto DEFAULT; ix = mx; drag = Fl::event_button(); handle_push(); return 1; case FL_DRAG: - if (!step()) goto DEFAULT; - delta = mx-ix; - if (delta > 5) delta -= 5; - else if (delta < -5) delta += 5; - else delta = 0; - switch (drag) { - case 3: v = increment(previous_value(), delta*100); break; - case 2: v = increment(previous_value(), delta*10); break; - default:v = increment(previous_value(), delta); break; + if(!step()) goto DEFAULT; + delta = mx - ix; + if(delta > 5) + delta -= 5; + else if(delta < -5) + delta += 5; + else + delta = 0; + switch(drag) { + case 3: v = increment(previous_value(), delta * 100); break; + case 2: v = increment(previous_value(), delta * 10); break; + default: v = increment(previous_value(), delta); break; } v = round(v); - handle_drag(soft()?softclamp(v):clamp(v));; + handle_drag(soft() ? softclamp(v) : clamp(v)); + ; return 1; case FL_RELEASE: - if (!step()) goto DEFAULT; - if (value() != previous_value() || !Fl::event_is_click()) + if(!step()) goto DEFAULT; + if(value() != previous_value() || !Fl::event_is_click()) handle_release(); else { Fl_Widget_Tracker wp(&input); input.handle(FL_PUSH); - if (wp.exists()) - input.handle(FL_RELEASE); + if(wp.exists()) input.handle(FL_RELEASE); } return 1; - case FL_FOCUS: - return input.take_focus(); - case FL_SHORTCUT: - return input.handle(event); + case FL_FOCUS: return input.take_focus(); + case FL_SHORTCUT: return input.handle(event); default: DEFAULT: return input.handle(event); diff --git a/Fltk/inputValue.h b/Fltk/inputValue.h index 91ed868f25f927b59198d20ed5aa6a3c29021569..d019fa314bd8dbfc778cad46e17df39406acbf36 100644 --- a/Fltk/inputValue.h +++ b/Fltk/inputValue.h @@ -11,24 +11,24 @@ // same as FL_Value_Input, but prints values in engineering notation -class inputValue : public Fl_Value_Input -{ - public: - inputValue(int x, int y, int w, int h, const char *l=0) : - Fl_Value_Input(x, y, w, h, l) {} - virtual int format(char *buffer){ return sprintf(buffer, "%g", value()); } +class inputValue : public Fl_Value_Input { +public: + inputValue(int x, int y, int w, int h, const char *l = 0) + : Fl_Value_Input(x, y, w, h, l) + { + } + virtual int format(char *buffer) { return sprintf(buffer, "%g", value()); } }; - // same as inputValue, but forces the underlying FL_Value_Input to always accept // floats (whatever the step value) -class inputValueFloat : public inputValue -{ - private: - static void new_input_cb(Fl_Widget*,void*); - public: - inputValueFloat(int x, int y, int w, int h, const char *l=0); +class inputValueFloat : public inputValue { +private: + static void new_input_cb(Fl_Widget *, void *); + +public: + inputValueFloat(int x, int y, int w, int h, const char *l = 0); int handle(int event); }; diff --git a/Fltk/mainWindow.h b/Fltk/mainWindow.h index b1642d407f0c3a6628ddfe54ecb914f2612cf978..64ca2d9fe4cded925edfb8aa85e3a6b65be3698b 100644 --- a/Fltk/mainWindow.h +++ b/Fltk/mainWindow.h @@ -12,23 +12,23 @@ // Derive the main window from Fl_Window (it shows up faster that way) class mainWindow : public Fl_Window { - public: - mainWindow(int w, int h, bool nonModal, const char *l=0) +public: + mainWindow(int w, int h, bool nonModal, const char *l = 0) : Fl_Window(w, h, l) { if(nonModal) set_non_modal(); } virtual int handle(int event) { - switch (event) { + switch(event) { case FL_SHORTCUT: case FL_KEYBOARD: #if defined(__APPLE__) - if(Fl::test_shortcut(FL_META+'w')){ + if(Fl::test_shortcut(FL_META + 'w')) { #elif defined(WIN32) - if(Fl::test_shortcut(FL_ALT+FL_F+4)){ + if(Fl::test_shortcut(FL_ALT + FL_F + 4)) { #else - if(Fl::test_shortcut(FL_CTRL+'w')){ + if(Fl::test_shortcut(FL_CTRL + 'w')) { #endif if(fl_choice("Do you really want to quit?", "Cancel", "Quit", 0)) do_callback(); @@ -38,7 +38,7 @@ class mainWindow : public Fl_Window { } return Fl_Window::handle(event); } - virtual void resize(int X,int Y,int W,int H) + virtual void resize(int X, int Y, int W, int H) { Fl_Window::resize(X, Y, W, H); } diff --git a/Fltk/manipWindow.cpp b/Fltk/manipWindow.cpp index cec77242d37b92cc1df69941f111979ef7a310f8..b366cc7a99a2f908d8400f5b0af8a69298de5c80 100644 --- a/Fltk/manipWindow.cpp +++ b/Fltk/manipWindow.cpp @@ -13,14 +13,12 @@ #include "Options.h" #include "Context.h" -void manip_cb(Fl_Widget *w, void *data) -{ - FlGui::instance()->manip->show(); -} +void manip_cb(Fl_Widget *w, void *data) { FlGui::instance()->manip->show(); } static void manip_update_cb(Fl_Widget *w, void *data) { - drawContext *ctx = FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); + drawContext *ctx = + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); ctx->r[0] = FlGui::instance()->manip->value[0]->value(); ctx->r[1] = FlGui::instance()->manip->value[1]->value(); ctx->r[2] = FlGui::instance()->manip->value[2]->value(); @@ -41,8 +39,9 @@ manipWindow::manipWindow(int deltaFontSize) int width = 4 * BB + 2 * WB; int height = 5 * BH + 3 * WB; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Manipulator"); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Manipulator"); win->box(GMSH_WINDOW_BOX); Fl_Box *top[3], *left[3]; @@ -52,9 +51,9 @@ manipWindow::manipWindow(int deltaFontSize) left[0] = new Fl_Box(WB + 0 * BB, 1 * WB + 1 * BH, BB, BH, "Rotation"); left[1] = new Fl_Box(WB + 0 * BB, 1 * WB + 2 * BH, BB, BH, "Translation"); left[2] = new Fl_Box(WB + 0 * BB, 1 * WB + 3 * BH, BB, BH, "Scale"); - for(int i = 0; i < 3; i++){ - top[i]->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER); - left[i]->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER); + for(int i = 0; i < 3; i++) { + top[i]->align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER); + left[i]->align(FL_ALIGN_INSIDE | FL_ALIGN_CENTER); } value[0] = new Fl_Value_Input(WB + 1 * BB, 1 * WB + 1 * BH, BB, BH); @@ -67,13 +66,13 @@ manipWindow::manipWindow(int deltaFontSize) value[7] = new Fl_Value_Input(WB + 2 * BB, 1 * WB + 3 * BH, BB, BH); value[8] = new Fl_Value_Input(WB + 3 * BB, 1 * WB + 3 * BH, BB, BH); - for(int i = 0; i < 9; i++){ - if(i < 3){ + for(int i = 0; i < 9; i++) { + if(i < 3) { value[i]->minimum(0.); value[i]->maximum(360.); value[i]->step(1.); } - else if(i > 5){ + else if(i > 5) { value[i]->minimum(0.1); value[i]->maximum(100.); value[i]->step(0.1); @@ -83,12 +82,13 @@ manipWindow::manipWindow(int deltaFontSize) } { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Reset"); + Fl_Button *o = + new Fl_Button(width - BB - WB, height - BH - WB, BB, BH, "Reset"); o->callback(status_xyz1p_cb, (void *)"reset"); } - win->position(CTX::instance()->manipPosition[0], CTX::instance()->manipPosition[1]); + win->position(CTX::instance()->manipPosition[0], + CTX::instance()->manipPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -96,7 +96,7 @@ manipWindow::manipWindow(int deltaFontSize) void manipWindow::update(bool force) { - if(force || win->shown()){ + if(force || win->shown()) { double val1 = CTX::instance()->lc; double r0 = opt_general_rotation0(0, GMSH_GET, 0); @@ -118,16 +118,16 @@ void manipWindow::update(bool force) value[6]->value(s0); value[7]->value(s1); value[8]->value(s2); - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { value[i]->minimum(-360.); value[i]->maximum(360.); value[i]->step(1.); - value[i+3]->minimum(-val1); - value[i+3]->maximum(val1); - value[i+3]->step(val1 / 200., 1); - value[i+6]->minimum(0.01); - value[i+6]->maximum(100.); - value[i+6]->step(0.01); + value[i + 3]->minimum(-val1); + value[i + 3]->maximum(val1); + value[i + 3]->step(val1 / 200., 1); + value[i + 6]->minimum(0.01); + value[i + 6]->maximum(100.); + value[i + 6]->step(0.01); } } } diff --git a/Fltk/manipWindow.h b/Fltk/manipWindow.h index c443ddd1875afc46e95b14ae5d001c4a8bd6f316..f133c0ed3a372f4f11ede3345fcd93cd4ddd01e2 100644 --- a/Fltk/manipWindow.h +++ b/Fltk/manipWindow.h @@ -9,13 +9,14 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Value_Input.H> -class manipWindow{ - public: +class manipWindow { +public: Fl_Window *win; Fl_Value_Input *value[9]; - public: + +public: manipWindow(int deltaFontSize); - void update(bool force=false); + void update(bool force = false); void show(); }; diff --git a/Fltk/messageBrowser.h b/Fltk/messageBrowser.h index 2235829a62ab9334e61f85851744a6f7ed30977e..dbf771808a058119f4974ef78e6c146c6c0e5d78 100644 --- a/Fltk/messageBrowser.h +++ b/Fltk/messageBrowser.h @@ -9,16 +9,16 @@ #include "FlGui.h" #include <algorithm> -class messageBrowser : public Fl_Group{ - private: +class messageBrowser : public Fl_Group { +private: Fl_Browser *_browser; Fl_Group *_box; Fl_Check_Button *_autoscroll; Fl_Button *_clear, *_save; Fl_Input *_search; - public: - messageBrowser(int x, int y, int w, int h, const char *l=0) +public: + messageBrowser(int x, int y, int w, int h, const char *l = 0) : Fl_Group(x, y, w, h, l) { int bh = BH - 4; // button height @@ -29,11 +29,12 @@ class messageBrowser : public Fl_Group{ _box = new Fl_Group(x, y, w, bh + 2 * wb); _box->box(GMSH_SIMPLE_TOP_BOX); - Fl_Group* o = new Fl_Group(x + wb, y + wb, sw, bh); + Fl_Group *o = new Fl_Group(x + wb, y + wb, sw, bh); o->tooltip("Filter messages"); o->box(FL_THIN_DOWN_BOX); o->color(FL_BACKGROUND2_COLOR); - _search = new Fl_Input(x + wb + bh, y + wb + 2, sw - bh - 2, bh - 4, "@-1gmsh_search"); + _search = new Fl_Input(x + wb + bh, y + wb + 2, sw - bh - 2, bh - 4, + "@-1gmsh_search"); _search->box(FL_FLAT_BOX); _search->when(FL_WHEN_CHANGED); _search->textsize(FL_NORMAL_SIZE - 1); @@ -48,8 +49,8 @@ class messageBrowser : public Fl_Group{ _clear->labelsize(FL_NORMAL_SIZE - 1); _clear->box(FL_THIN_UP_BOX); - _autoscroll = new Fl_Check_Button - (x + sw + 2 * bb + 3 * WB, y + wb, 2 * bb, bh, "Autoscroll messages"); + _autoscroll = new Fl_Check_Button(x + sw + 2 * bb + 3 * WB, y + wb, 2 * bb, + bh, "Autoscroll messages"); _autoscroll->labelsize(FL_NORMAL_SIZE - 1); _autoscroll->type(FL_TOGGLE_BUTTON); _autoscroll->value(1); @@ -61,38 +62,41 @@ class messageBrowser : public Fl_Group{ _browser->box(GMSH_SIMPLE_TOP_BOX); _browser->textfont(FL_SCREEN); _browser->type(FL_MULTI_BROWSER); - _browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + _browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars _browser->end(); end(); resizable(_browser); } - void box(Fl_Boxtype new_box) { _browser->box(new_box);} + void box(Fl_Boxtype new_box) { _browser->box(new_box); } void textfont(Fl_Font font) { _browser->textfont(font); } - void textsize(Fl_Fontsize newSize){ _browser->textsize(newSize); } + void textsize(Fl_Fontsize newSize) { _browser->textsize(newSize); } Fl_Fontsize textsize() const { return _browser->textsize(); } - void callback(Fl_Callback* cb, void* p) { _browser->callback(cb, p);} - void search_callback(Fl_Callback* cb, void* p) { _search->callback(cb, p);} - void autoscroll_callback(Fl_Callback* cb, void* p) { _autoscroll->callback(cb, p);} - void save_callback(Fl_Callback* cb, void* p) { _save->callback(cb, p);} - void clear_callback(Fl_Callback* cb, void* p) { _clear->callback(cb, p);} + void callback(Fl_Callback *cb, void *p) { _browser->callback(cb, p); } + void search_callback(Fl_Callback *cb, void *p) { _search->callback(cb, p); } + void autoscroll_callback(Fl_Callback *cb, void *p) + { + _autoscroll->callback(cb, p); + } + void save_callback(Fl_Callback *cb, void *p) { _save->callback(cb, p); } + void clear_callback(Fl_Callback *cb, void *p) { _clear->callback(cb, p); } void bottomline(int line) { _browser->bottomline(line); } - int size(){ return _browser->size(); } - void add(const char* newtext) + int size() { return _browser->size(); } + void add(const char *newtext) { std::string search = _search->value(); - if(search.empty()){ + if(search.empty()) { _browser->add(newtext); } - else{ + else { std::transform(search.begin(), search.end(), search.begin(), ::tolower); std::string tmp(newtext); std::transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower); - if(tmp.find(search) != std::string::npos) - _browser->add(newtext); + if(tmp.find(search) != std::string::npos) _browser->add(newtext); } } - void clear(){ _browser->clear(); } - const char* text(int line) const { return _browser->text(line); } + void clear() { _browser->clear(); } + const char *text(int line) const { return _browser->text(line); } int selected(int line) const { return _browser->selected(line); } }; diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index 793f97d677854128b0a08dd8ba40d3154c744534..10b8c0a753484937025855da384b9a3605262c60 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -56,20 +56,21 @@ void solver_cb(Fl_Widget *w, void *data) if(!FlGui::instance()->onelab) return; int num = (intptr_t)data; - if(num >= 0){ + if(num >= 0) { std::string name = opt_solver_name(num, GMSH_GET, ""); std::string exe = opt_solver_executable(num, GMSH_GET, ""); std::string host = opt_solver_remote_login(num, GMSH_GET, ""); FlGui::instance()->onelab->addSolver(name, exe, host, num); } - else{ + else { FlGui::instance()->onelab->rebuildSolverList(); } - if(CTX::instance()->solver.autoLoadDatabase){ - std::vector<std::string> split = SplitFileName(GModel::current()->getFileName()); + if(CTX::instance()->solver.autoLoadDatabase) { + std::vector<std::string> split = + SplitFileName(GModel::current()->getFileName()); std::string db = split[0] + split[1] + ".db"; - if(!StatFile(db)){ + if(!StatFile(db)) { onelabUtils::loadDb(db); CTX::instance()->launchSolverAtStartup = -1; } @@ -77,15 +78,15 @@ void solver_cb(Fl_Widget *w, void *data) if(FlGui::instance()->onelab->isBusy()) FlGui::instance()->onelab->show(); - else{ - if(CTX::instance()->launchSolverAtStartup >= 0){ - onelab_cb(0, (void*)"reset"); + else { + if(CTX::instance()->launchSolverAtStartup >= 0) { + onelab_cb(0, (void *)"reset"); onelabUtils::setFirstComputationFlag(true); } else if(num >= 0) - onelab_cb(0, (void*)"check"); + onelab_cb(0, (void *)"check"); else - onelab_cb(0, (void*)"refresh"); + onelab_cb(0, (void *)"refresh"); FlGui::instance()->onelab->updateGearMenu(); } @@ -96,19 +97,19 @@ void onelab_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string action((const char*)data); + std::string action((const char *)data); - if(action == "refresh"){ + if(action == "refresh") { onelabUtils::updateGraphs(); FlGui::instance()->rebuildTree(true); return; } - if(action == "stop"){ + if(action == "stop") { FlGui::instance()->onelab->stop(true); FlGui::instance()->onelab->setButtonMode("", "kill"); for(onelab::server::citer it = onelab::server::instance()->firstClient(); - it != onelab::server::instance()->lastClient(); it++){ + it != onelab::server::instance()->lastClient(); it++) { onelab::string o((*it)->getName() + "/Action", "stop"); o.setVisible(false); o.setNeverChanged(true); @@ -117,7 +118,7 @@ void onelab_cb(Fl_Widget *w, void *data) return; } - if(action == "kill"){ + if(action == "kill") { FlGui::instance()->onelab->stop(true); for(onelab::server::citer it = onelab::server::instance()->firstClient(); it != onelab::server::instance()->lastClient(); it++) @@ -125,21 +126,21 @@ void onelab_cb(Fl_Widget *w, void *data) return; } - if(action == "save"){ + if(action == "save") { std::string fileName = "onelab.db"; // special handling for metamodels: add user defined tag, if any std::vector<onelab::string> ps; - onelab::server::instance()->get(ps,"0Metamodel/9Tag"); - if(ps.size() && ps[0].getValue().size()){ + onelab::server::instance()->get(ps, "0Metamodel/9Tag"); + if(ps.size() && ps[0].getValue().size()) { fileName.assign("onelab_" + ps[0].getValue() + ".db"); } // special handling for metamodels: save db in "restore" mode" double restoreMode = 0.; std::vector<onelab::number> pn; - onelab::server::instance()->get(pn,"0Metamodel/9Use restored solution"); - if(pn.size()){ + onelab::server::instance()->get(pn, "0Metamodel/9Use restored solution"); + if(pn.size()) { restoreMode = pn[0].getValue(); pn[0].setValue(2); // special value onelab::server::instance()->set(pn[0]); @@ -147,35 +148,35 @@ void onelab_cb(Fl_Widget *w, void *data) std::string db; db.assign(SplitFileName(GModel::current()->getFileName())[0] + fileName); - if(fileChooser(FILE_CHOOSER_CREATE, "Save", "*.db", db.c_str())){ - if(!restoreMode) - onelabUtils::archiveSolutionFiles(fileChooserGetName(1)); + if(fileChooser(FILE_CHOOSER_CREATE, "Save", "*.db", db.c_str())) { + if(!restoreMode) onelabUtils::archiveSolutionFiles(fileChooserGetName(1)); onelabUtils::saveDb(fileChooserGetName(1)); } // special handling for metamodels: switch back to normal "run" mode" - onelab::server::instance()->get(pn,"0Metamodel/9Use restored solution"); - if(pn.size()){ + onelab::server::instance()->get(pn, "0Metamodel/9Use restored solution"); + if(pn.size()) { pn[0].setValue(0); onelab::server::instance()->set(pn[0]); } action = "check"; - //return; + // return; } - if(FlGui::instance()->onelab->isBusy()){ + if(FlGui::instance()->onelab->isBusy()) { Msg::Info("I'm busy! Ask me that later..."); return; } - if(action == "load"){ - std::string db = SplitFileName(GModel::current()->getFileName())[0] + "onelab.db"; + if(action == "load") { + std::string db = + SplitFileName(GModel::current()->getFileName())[0] + "onelab.db"; if(fileChooser(FILE_CHOOSER_SINGLE, "Load", "*.db", db.c_str())) onelabUtils::loadDb(fileChooserGetName(1)); action = "check"; } - if(action == "reset"){ + if(action == "reset") { onelabUtils::resetDb(true); action = "check"; } @@ -186,25 +187,26 @@ void onelab_cb(Fl_Widget *w, void *data) if(action == "compute") onelabUtils::initializeLoops(); - do{ // enter loop + do { // enter loop - //run Gmsh client for non-python metamodels + // run Gmsh client for non-python metamodels if(onelabUtils::runGmshClient(action, CTX::instance()->solver.autoMesh)) drawContext::global()->draw(); - if(action == "compute") - FlGui::instance()->onelab->checkForErrors("Gmsh"); + if(action == "compute") FlGui::instance()->onelab->checkForErrors("Gmsh"); if(FlGui::instance()->onelab->stop()) break; // iterate over all other clients (there should normally only be one) for(onelab::server::citer it = onelab::server::instance()->firstClient(); - it != onelab::server::instance()->lastClient(); it++){ + it != onelab::server::instance()->lastClient(); it++) { onelab::client *c = *it; if(c->getName() == "Gmsh" || // local Gmsh client - c->getName() == "Listen" || // unknown client connecting through "-listen" - c->getName() == "GmshRemote" || // distant post-processing Gmsh client - c->getName().find("NoAutoRun") != std::string::npos) // client name contains "NoAutoRun" - continue; + c->getName() == + "Listen" || // unknown client connecting through "-listen" + c->getName() == "GmshRemote" || // distant post-processing Gmsh client + c->getName().find("NoAutoRun") != + std::string::npos) // client name contains "NoAutoRun" + continue; if(action != "initialize") onelabUtils::guessModelName(c); onelab::string o(c->getName() + "/Action", action); o.setVisible(false); @@ -213,9 +215,10 @@ void onelab_cb(Fl_Widget *w, void *data) // we should skip the computation here if no parameter has changed for the // solver: // - //if(action != "compute" || onelab::server::instance()->getChanged(c->getName())) - c->run(); - if(action == "compute"){ + // if(action != "compute" || + // onelab::server::instance()->getChanged(c->getName())) + c->run(); + if(action == "compute") { // after computing with this solver, mark the parameters as unchanged // for this solver onelab::server::instance()->setChanged(0, c->getName()); @@ -224,7 +227,7 @@ void onelab_cb(Fl_Widget *w, void *data) if(FlGui::instance()->onelab->stop()) break; } - if(action != "initialize"){ + if(action != "initialize") { onelabUtils::updateGraphs(); FlGui::instance()->rebuildTree(action == "compute"); } @@ -233,10 +236,12 @@ void onelab_cb(Fl_Widget *w, void *data) onelabUtils::incrementLoops()); if(action == "compute" && (CTX::instance()->solver.autoSaveDatabase || - CTX::instance()->solver.autoArchiveOutputFiles)){ - std::vector<std::string> split = SplitFileName(GModel::current()->getFileName()); + CTX::instance()->solver.autoArchiveOutputFiles)) { + std::vector<std::string> split = + SplitFileName(GModel::current()->getFileName()); std::string db = split[0] + split[1] + ".db"; - if(CTX::instance()->solver.autoArchiveOutputFiles) onelabUtils::archiveOutputFiles(db); + if(CTX::instance()->solver.autoArchiveOutputFiles) + onelabUtils::archiveOutputFiles(db); if(CTX::instance()->solver.autoSaveDatabase) onelabUtils::saveDb(db); } @@ -251,15 +256,15 @@ void onelab_cb(Fl_Widget *w, void *data) void onelab_option_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string what((const char*)data); - double val = ((Fl_Menu_*)w)->mvalue()->value() ? 1. : 0.; + std::string what((const char *)data); + double val = ((Fl_Menu_ *)w)->mvalue()->value() ? 1. : 0.; if(what == "save") CTX::instance()->solver.autoSaveDatabase = val; else if(what == "load") CTX::instance()->solver.autoLoadDatabase = val; else if(what == "archive") CTX::instance()->solver.autoArchiveOutputFiles = val; - else if(what == "check"){ + else if(what == "check") { CTX::instance()->solver.autoCheck = val; FlGui::instance()->onelab->setButtonVisibility(); } @@ -271,7 +276,7 @@ void onelab_option_cb(Fl_Widget *w, void *data) CTX::instance()->solver.autoShowViews = val ? 2 : 0; else if(what == "step") CTX::instance()->solver.autoShowLastStep = val; - else if(what == "invisible"){ + else if(what == "invisible") { CTX::instance()->solver.showInvisibleParameters = val; FlGui::instance()->onelab->rebuildTree(true); } @@ -279,7 +284,7 @@ void onelab_option_cb(Fl_Widget *w, void *data) static void onelab_choose_executable_cb(Fl_Widget *w, void *data) { - onelab::localNetworkClient *c = (onelab::localNetworkClient*)data; + onelab::localNetworkClient *c = (onelab::localNetworkClient *)data; std::string pattern = "*"; #if defined(WIN32) pattern += ".exe"; @@ -287,38 +292,41 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data) std::string exe = ""; - if(!w){ // we entered here automatically because no executable is given + if(!w) { // we entered here automatically because no executable is given // try to find an executable automatically (this is really useful for // beginners) std::string gmshPath = SplitFileName(CTX::instance()->exeFileName)[0]; - if(gmshPath.size()){ + if(gmshPath.size()) { std::string name = c->getName(); - for(unsigned int i = 0; i < name.size(); i++) - name[i] = tolower(name[i]); + for(unsigned int i = 0; i < name.size(); i++) name[i] = tolower(name[i]); std::string path1 = gmshPath + name; std::string path2 = gmshPath + "data/" + name; #if defined(WIN32) path1 += ".exe"; path2 += ".exe"; #endif - if(!StatFile(path1)) exe = path1; - else if(!StatFile(path2)) exe = path2; + if(!StatFile(path1)) + exe = path1; + else if(!StatFile(path2)) + exe = path2; if(exe.size()) Msg::Info("Automatically found %s executable: %s", c->getName().c_str(), exe.c_str()); } - if(exe.empty()){ + if(exe.empty()) { const char *o = fl_close; fl_close = "OK"; - fl_message("This appears to be the first time you are trying to run %s.\n\n" - "Please select the path to the executable.", c->getName().c_str()); + fl_message( + "This appears to be the first time you are trying to run %s.\n\n" + "Please select the path to the executable.", + c->getName().c_str()); fl_close = o; } } - if(exe.empty()){ + if(exe.empty()) { const char *old = 0; if(c->getExecutable().size()) old = c->getExecutable().c_str(); std::string title = "Choose location of " + c->getName() + " executable"; @@ -326,7 +334,7 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data) exe = fileChooserGetName(1); } - if(exe.size()){ + if(exe.size()) { c->setExecutable(exe); opt_solver_executable(c->getIndex(), GMSH_SET, exe); } @@ -334,10 +342,10 @@ static void onelab_choose_executable_cb(Fl_Widget *w, void *data) static void onelab_add_solver_cb(Fl_Widget *w, void *data) { - for(int i = 0; i < NUM_SOLVERS; i++){ - if(opt_solver_name(i, GMSH_GET, "").empty() || i == (NUM_SOLVERS - 1)){ + for(int i = 0; i < NUM_SOLVERS; i++) { + if(opt_solver_name(i, GMSH_GET, "").empty() || i == (NUM_SOLVERS - 1)) { const char *name = fl_input("Solver name:", ""); - if(name){ + if(name) { FlGui::instance()->onelab->addSolver(name, "", "", i); } return; @@ -345,13 +353,13 @@ static void onelab_add_solver_cb(Fl_Widget *w, void *data) } } -template<class T> +template <class T> static void setClosed(const std::string &path, std::vector<T> &ps, const std::string &value) { onelab::server::instance()->get(ps); - for(unsigned int i = 0; i < ps.size(); i++){ - if(ps[i].getPath() == path){ + for(unsigned int i = 0; i < ps.size(); i++) { + if(ps[i].getPath() == path) { ps[i].setAttribute("Closed", value); onelab::server::instance()->set(ps[i]); } @@ -381,12 +389,12 @@ static void setOpenedClosed(Fl_Tree_Item *item, int reason) std::vector<onelab::number> numbers; std::vector<onelab::string> strings; std::string path = FlGui::instance()->onelab->getPath(item); - switch(reason){ + switch(reason) { case FL_TREE_REASON_OPENED: FlGui::instance()->onelab->removeFromManuallyClosed(path); setClosed(path, numbers, "0"); setClosed(path, strings, "0"); - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(unsigned int i = 0; i < PView::list.size(); i++) { if(getViewPath(i) == path) PView::list[i]->getOptions()->closed = 0; } break; @@ -394,19 +402,18 @@ static void setOpenedClosed(Fl_Tree_Item *item, int reason) FlGui::instance()->onelab->insertInManuallyClosed(path); setClosed(path, numbers, "1"); setClosed(path, strings, "1"); - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(unsigned int i = 0; i < PView::list.size(); i++) { if(getViewPath(i) == path) PView::list[i]->getOptions()->closed = 1; } break; - default: - break; + default: break; } } static void onelab_tree_cb(Fl_Widget *w, void *data) { - Fl_Tree *tree = (Fl_Tree*)w; - Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); + Fl_Tree *tree = (Fl_Tree *)w; + Fl_Tree_Item *item = (Fl_Tree_Item *)tree->callback_item(); setOpenedClosed(item, tree->callback_reason()); } @@ -441,13 +448,13 @@ void onelabGroup::_computeWidths() #define gear_width 16 #define gear_height 16 static unsigned char gear_bits[] = { - 0x80, 0x01, 0x80, 0x01, 0x8c, 0x31, 0xfc, 0x3f, 0xf8, 0x1f, 0xf8, 0x1f, - 0x38, 0x1c, 0x3f, 0xfc, 0x3f, 0xfc, 0x38, 0x1c, 0xf8, 0x1f, 0xf8, 0x1f, - 0xfc, 0x3f, 0x8c, 0x31, 0x80, 0x01, 0x80, 0x01 }; + 0x80, 0x01, 0x80, 0x01, 0x8c, 0x31, 0xfc, 0x3f, 0xf8, 0x1f, 0xf8, + 0x1f, 0x38, 0x1c, 0x3f, 0xfc, 0x3f, 0xfc, 0x38, 0x1c, 0xf8, 0x1f, + 0xf8, 0x1f, 0xfc, 0x3f, 0x8c, 0x31, 0x80, 0x01, 0x80, 0x01}; #endif onelabGroup::onelabGroup(int x, int y, int w, int h, const char *l) - : Fl_Group(x,y,w,h,l), _stop(false), _enableTreeWidgetResize(false) + : Fl_Group(x, y, w, h, l), _stop(false), _enableTreeWidgetResize(false) { int col = FL_BACKGROUND2_COLOR; color(col); @@ -478,11 +485,13 @@ onelabGroup::onelabGroup(int x, int y, int w, int h, const char *l) int BB2 = BB / 2 + 4; - _butt[0] = new Fl_Button(x + w - 3 * WB - 3 * BB2, y + h - WB - BH, BB2, BH, "Check"); - _butt[0]->callback(onelab_cb, (void*)"check"); + _butt[0] = + new Fl_Button(x + w - 3 * WB - 3 * BB2, y + h - WB - BH, BB2, BH, "Check"); + _butt[0]->callback(onelab_cb, (void *)"check"); - _butt[1] = new Fl_Button(x + w - 2 * WB - 2 * BB2, y + h - WB - BH, BB2, BH, "Run"); - _butt[1]->callback(onelab_cb, (void*)"compute"); + _butt[1] = + new Fl_Button(x + w - 2 * WB - 2 * BB2, y + h - WB - BH, BB2, BH, "Run"); + _butt[1]->callback(onelab_cb, (void *)"compute"); _gear = new Fl_Menu_Button(x + w - WB - BB2, y + h - WB - BH, BB2, BH); #if defined(__APPLE__) @@ -491,33 +500,33 @@ onelabGroup::onelabGroup(int x, int y, int w, int h, const char *l) _gear->image(new Fl_Bitmap(gear_bits, gear_width, gear_height)); #endif _gear->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); - _gear->add("Reset database", 0, onelab_cb, (void*)"reset"); - _gear->add("Save database...", 0, onelab_cb, (void*)"save"); - _gear->add("_Load database...", 0, onelab_cb, (void*)"load"); + _gear->add("Reset database", 0, onelab_cb, (void *)"reset"); + _gear->add("Save database...", 0, onelab_cb, (void *)"save"); + _gear->add("_Load database...", 0, onelab_cb, (void *)"load"); _minWindowWidth = 3 * BB2 + 4 * WB; _minWindowHeight = 2 * BH + 3 * WB; _gearOptionsStart = _gear->menu()->size(); - _gear->add("Save database automatically", 0, onelab_option_cb, (void*)"save", - FL_MENU_TOGGLE); - _gear->add("Load database automatically", 0, onelab_option_cb, (void*)"load", - FL_MENU_TOGGLE); - _gear->add("Archive output files automatically", 0, onelab_option_cb, (void*)"archive", - FL_MENU_TOGGLE); - _gear->add("Check model after each change", 0, onelab_option_cb, (void*)"check", - FL_MENU_TOGGLE); - _gear->add("Remesh automatically", 0, onelab_option_cb, (void*)"mesh", + _gear->add("Save database automatically", 0, onelab_option_cb, (void *)"save", FL_MENU_TOGGLE); - _gear->add("Merge results automatically", 0, onelab_option_cb, (void*)"merge", + _gear->add("Load database automatically", 0, onelab_option_cb, (void *)"load", FL_MENU_TOGGLE); - _gear->add("Show new views", 0, onelab_option_cb, (void*)"show", + _gear->add("Archive output files automatically", 0, onelab_option_cb, + (void *)"archive", FL_MENU_TOGGLE); + _gear->add("Check model after each change", 0, onelab_option_cb, + (void *)"check", FL_MENU_TOGGLE); + _gear->add("Remesh automatically", 0, onelab_option_cb, (void *)"mesh", FL_MENU_TOGGLE); - _gear->add("Always show last step", 0, onelab_option_cb, (void*)"step", + _gear->add("Merge results automatically", 0, onelab_option_cb, + (void *)"merge", FL_MENU_TOGGLE); + _gear->add("Show new views", 0, onelab_option_cb, (void *)"show", FL_MENU_TOGGLE); - _gear->add("_Show hidden parameters", 0, onelab_option_cb, (void*)"invisible", + _gear->add("Always show last step", 0, onelab_option_cb, (void *)"step", FL_MENU_TOGGLE); + _gear->add("_Show hidden parameters", 0, onelab_option_cb, + (void *)"invisible", FL_MENU_TOGGLE); _gearOptionsEnd = _gear->menu()->size(); @@ -533,14 +542,13 @@ onelabGroup::onelabGroup(int x, int y, int w, int h, const char *l) static bool getFlColor(const std::string &str, Fl_Color &c) { - if(str == "1"){ + if(str == "1") { c = FL_YELLOW; return true; } int r, g, b; - if(str.size() && GetRGBForString(str.c_str(), r, g, b)){ - c = fl_color_cube(r * (FL_NUM_RED - 1) / 255, - g * (FL_NUM_GREEN - 1) / 255, + if(str.size() && GetRGBForString(str.c_str(), r, g, b)) { + c = fl_color_cube(r * (FL_NUM_RED - 1) / 255, g * (FL_NUM_GREEN - 1) / 255, b * (FL_NUM_BLUE - 1) / 255); return true; } @@ -548,29 +556,29 @@ static bool getFlColor(const std::string &str, Fl_Color &c) return false; } -template<class T> -static void autoCheck(const T &pold, const T &pnew, bool force=false) +template <class T> +static void autoCheck(const T &pold, const T &pnew, bool force = false) { - if(onelabUtils::getFirstComputationFlag()){ + if(onelabUtils::getFirstComputationFlag()) { if(pold.getValue() != pnew.getValue()) onelabUtils::setFirstComputationFlag(false); } - if((CTX::instance()->solver.autoCheck && pnew.getAttribute("AutoCheck") != "0") || - pnew.getAttribute("AutoCheck") == "1"){ + if((CTX::instance()->solver.autoCheck && + pnew.getAttribute("AutoCheck") != "0") || + pnew.getAttribute("AutoCheck") == "1") { if(force || pold.getValue() != pnew.getValue()) - onelab_cb(0, (void*)"check"); + onelab_cb(0, (void *)"check"); } } -template<class T> -void onelabGroup::_addParameter(T &p) +template <class T> void onelabGroup::_addParameter(T &p) { bool highlight = false; Fl_Color c; if(getFlColor(p.getAttribute("Highlight"), c)) highlight = true; Fl_Tree_Item *n = _tree->add(p.getName().c_str()); - if(!n){ + if(!n) { Msg::Debug("Could not add item '%s' in tree", p.getName().c_str()); return; } @@ -579,7 +587,8 @@ void onelabGroup::_addParameter(T &p) int ww = (int)(_baseWidth - (n->depth() + 1) * _indent); int hh = n->labelsize() + 4; Fl_Group *grp = new Fl_Group(1, 1, ww, hh); - Fl_Widget *widget = _addParameterWidget(p, ww * _widgetLabelRatio, hh, n, highlight, c); + Fl_Widget *widget = + _addParameterWidget(p, ww * _widgetLabelRatio, hh, n, highlight, c); grp->end(); if(!_enableTreeWidgetResize) grp->resizable(0); _treeWidgets.push_back(grp); @@ -592,10 +601,11 @@ void onelabGroup::_addParameter(T &p) _tree->end(); } -void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, void *data) +void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, + void *data) { Fl_Tree_Item *n = _tree->add(path.c_str()); - if(!n){ + if(!n) { Msg::Debug("Could not add item '%s' in tree", path.c_str()); return; } @@ -625,7 +635,7 @@ void onelabGroup::_addSolverMenu(int num) std::ostringstream path; path << "0Modules/Solver/Solver" << num; Fl_Tree_Item *n = _tree->add(path.str().c_str()); - if(!n){ + if(!n) { Msg::Debug("Could not add item '%s' in tree", path.str().c_str()); return; } @@ -646,7 +656,7 @@ void onelabGroup::_addViewMenu(int num) std::string path = getViewPathName(num); if(path.empty()) return; Fl_Tree_Item *n = _tree->add(path.c_str()); - if(!n){ + if(!n) { Msg::Debug("Could not add item '%s' in tree", path.c_str()); return; } @@ -668,9 +678,9 @@ viewButton *onelabGroup::getViewButton(int num) std::string path = getViewPathName(num); if(path.empty()) return 0; Fl_Tree_Item *n = _tree->find_item(path.c_str()); - if(n){ - Fl_Group *grp = (Fl_Group*)n->widget(); - return (viewButton*)grp->child(0); + if(n) { + Fl_Group *grp = (Fl_Group *)n->widget(); + return (viewButton *)grp->child(0); } return 0; } @@ -680,7 +690,7 @@ void onelabGroup::openCloseViewButton(int num) std::string path = getViewPathName(num); if(path.empty()) return; Fl_Tree_Item *n = _tree->find_item(path.c_str()); - if(n){ + if(n) { if(PView::list[num]->getOptions()->closed) n->parent()->close(); else @@ -691,23 +701,23 @@ void onelabGroup::openCloseViewButton(int num) static bool serverAction(const std::string &action) { - if(action == "ResetDatabase"){ // reset the onelab db + if(action == "ResetDatabase") { // reset the onelab db onelabUtils::resetDb(false); FlGui::instance()->rebuildTree(false); return true; } - else if(action == "Reset"){ // reset db + models except current one + else if(action == "Reset") { // reset db + models except current one onelabUtils::resetDb(false); - for(int i = PView::list.size() - 1; i >= 0; i--) - delete PView::list[i]; + for(int i = PView::list.size() - 1; i >= 0; i--) delete PView::list[i]; for(int i = GModel::list.size() - 1; i >= 0; i--) if(GModel::list[i] != GModel::current()) delete GModel::list[i]; FlGui::instance()->rebuildTree(false); return true; } - else if(!action.compare(0, 5, "Reset")){ // reset some variables - std::vector<std::string> what = onelab::parameter::split(action.substr(5), ','); - for(unsigned int i = 0; i < what.size(); i++){ + else if(!action.compare(0, 5, "Reset")) { // reset some variables + std::vector<std::string> what = + onelab::parameter::split(action.substr(5), ','); + for(unsigned int i = 0; i < what.size(); i++) { std::string var = onelab::parameter::trim(what[i]); Msg::Debug("Clearing variable '%s'", var.c_str()); onelab::server::instance()->clear(var); @@ -718,16 +728,14 @@ static bool serverAction(const std::string &action) return false; } -template <class T> -static void performServerAction(T &n) +template <class T> static void performServerAction(T &n) { std::string opt = n.getAttribute("ServerAction"); if(opt.empty()) return; serverAction(opt); } -template <class T> -static void setGmshOption(T &n) +template <class T> static void setGmshOption(T &n) { std::string opt = n.getAttribute("GmshOption"); if(opt.empty()) return; @@ -741,11 +749,11 @@ static void setGmshOption(T &n) static void onelab_number_check_button_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers, name); - if(numbers.size()){ - Fl_Check_Button *o = (Fl_Check_Button*)w; + if(numbers.size()) { + Fl_Check_Button *o = (Fl_Check_Button *)w; onelab::number old = numbers[0]; numbers[0].setValue(o->value()); setGmshOption(numbers[0]); @@ -758,14 +766,15 @@ static void onelab_number_check_button_cb(Fl_Widget *w, void *data) static void onelab_number_choice_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers, name); - if(numbers.size()){ - Fl_Choice *o = (Fl_Choice*)w; + if(numbers.size()) { + Fl_Choice *o = (Fl_Choice *)w; std::vector<double> choices = numbers[0].getChoices(); onelab::number old = numbers[0]; - if(o->value() < (int)choices.size()) numbers[0].setValue(choices[o->value()]); + if(o->value() < (int)choices.size()) + numbers[0].setValue(choices[o->value()]); setGmshOption(numbers[0]); performServerAction(numbers[0]); onelab::server::instance()->set(numbers[0]); @@ -776,13 +785,13 @@ static void onelab_number_choice_cb(Fl_Widget *w, void *data) static void onelab_number_input_range_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers, name); - if(numbers.size()){ - inputRange *o = (inputRange*)w; + if(numbers.size()) { + inputRange *o = (inputRange *)w; onelab::number old = numbers[0]; - if(o->doCallbackOnValues()){ + if(o->doCallbackOnValues()) { numbers[0].setValue(o->value()); numbers[0].setMin(o->minimum()); numbers[0].setMax(o->maximum()); @@ -803,11 +812,11 @@ static void onelab_number_input_range_cb(Fl_Widget *w, void *data) static void onelab_number_output_range_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers, name); - if(numbers.size()){ - outputRange *o = (outputRange*)w; + if(numbers.size()) { + outputRange *o = (outputRange *)w; numbers[0].setAttribute("Graph", o->graph()); onelab::server::instance()->set(numbers[0]); onelabUtils::updateGraphs(); @@ -815,19 +824,20 @@ static void onelab_number_output_range_cb(Fl_Widget *w, void *data) } Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, - Fl_Tree_Item *n, bool highlight, Fl_Color c) + Fl_Tree_Item *n, bool highlight, + Fl_Color c) { char *path = strdup(getPath(n).c_str()); _treeStrings.push_back(path); // enumeration (display choices as value labels, not numbers) if(p.getChoices().size() && - p.getChoices().size() == p.getValueLabels().size()){ + p.getChoices().size() == p.getValueLabels().size()) { Fl_Choice *but = new Fl_Choice(1, 1, ww, hh); std::vector<Fl_Menu_Item> menu; std::vector<double> choices = p.getChoices(); std::map<double, std::string> labels(p.getValueLabels()); - for(unsigned int i = 0; i < choices.size(); i++){ + for(unsigned int i = 0; i < choices.size(); i++) { char *str = strdup(labels[choices[i]].c_str()); _treeStrings.push_back(str); Fl_Menu_Item menuItem = {str, 0, 0, 0, 0}; @@ -837,29 +847,30 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, Fl_Menu_Item it = {0}; menu.push_back(it); but->copy(&menu[0]); - for(unsigned int i = 0; i < choices.size(); i++){ - if(p.getValue() == choices[i]){ + for(unsigned int i = 0; i < choices.size(); i++) { + if(p.getValue() == choices[i]) { but->value(i); break; } } - but->callback(onelab_number_choice_cb, (void*)path); + but->callback(onelab_number_choice_cb, (void *)path); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); if(p.getReadOnly()) but->deactivate(); return but; } // check box (boolean choice) - if(p.getChoices().size() == 2 && - p.getChoices()[0] == 0 && p.getChoices()[1] == 1){ + if(p.getChoices().size() == 2 && p.getChoices()[0] == 0 && + p.getChoices()[1] == 1) { n->labelsize(FL_NORMAL_SIZE + 2); - Fl_Check_Button *but = new Fl_Check_Button(1, 1, ww / _widgetLabelRatio, hh); + Fl_Check_Button *but = + new Fl_Check_Button(1, 1, ww / _widgetLabelRatio, hh); but->box(FL_FLAT_BOX); but->color(_tree->color()); but->value(p.getValue()); - but->callback(onelab_number_check_button_cb, (void*)path); + but->callback(onelab_number_check_button_cb, (void *)path); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); - if(highlight){ + if(highlight) { but->color(c); but->labelcolor(fl_contrast(FL_FOREGROUND_COLOR, c)); } @@ -868,9 +879,9 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, } // non-editable value - if(p.getReadOnly()){ + if(p.getReadOnly()) { outputRange *but = new outputRange(1, 1, ww, hh); - but->callback(onelab_number_output_range_cb, (void*)path); + but->callback(onelab_number_output_range_cb, (void *)path); but->value(p.getValue()); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); but->graph(p.getAttribute("Graph")); @@ -888,7 +899,7 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, but->choices(p.getChoices()); but->loop(p.getAttribute("Loop")); but->graph(p.getAttribute("Graph")); - but->callback(onelab_number_input_range_cb, (void*)path); + but->callback(onelab_number_input_range_cb, (void *)path); but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); if(highlight) but->color(c); @@ -898,15 +909,15 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, static void onelab_string_button_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::string> strings; onelab::server::instance()->get(strings, name); - if(strings.size()){ - if(strings[0].getAttribute("Macro") == "GmshParseString"){ + if(strings.size()) { + if(strings[0].getAttribute("Macro") == "GmshParseString") { // parse string directly ParseString(strings[0].getValue()); } - else{ + else { // merge file std::string tmp = FixRelativePath(GModel::current()->getFileName(), strings[0].getValue()); @@ -922,11 +933,11 @@ static void onelab_string_button_cb(Fl_Widget *w, void *data) static void onelab_string_input_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::string> strings; onelab::server::instance()->get(strings, name); - if(strings.size()){ - Fl_Input *o = (Fl_Input*)w; + if(strings.size()) { + Fl_Input *o = (Fl_Input *)w; onelab::string old = strings[0]; strings[0].setValue(o->value()); setGmshOption(strings[0]); @@ -939,24 +950,23 @@ static void onelab_string_input_cb(Fl_Widget *w, void *data) static void onelab_string_input_choice_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string name((char*)data); + std::string name((char *)data); std::vector<onelab::string> strings; onelab::server::instance()->get(strings, name); - if(strings.size()){ - Fl_Input_Choice *o = (Fl_Input_Choice*)w; + if(strings.size()) { + Fl_Input_Choice *o = (Fl_Input_Choice *)w; onelab::string old = strings[0]; strings[0].setValue(o->value()); std::string choices; - for(int i = 0; i < o->menubutton()->menu()->size(); i++){ - if(o->menubutton()->menu()[i].flags & FL_MENU_TOGGLE){ + for(int i = 0; i < o->menubutton()->menu()->size(); i++) { + if(o->menubutton()->menu()[i].flags & FL_MENU_TOGGLE) { if(o->menubutton()->menu()[i].flags & FL_MENU_VALUE) choices += "1"; else choices += "0"; } } - if(choices.size()) - strings[0].setAttribute("MultipleSelection", choices); + if(choices.size()) strings[0].setAttribute("MultipleSelection", choices); setGmshOption(strings[0]); performServerAction(strings[0]); onelab::server::instance()->set(strings[0]); @@ -966,8 +976,8 @@ static void onelab_string_input_choice_cb(Fl_Widget *w, void *data) static void onelab_input_choice_file_chooser_cb(Fl_Widget *w, void *data) { - Fl_Input_Choice *but = (Fl_Input_Choice*)w->parent(); - if(fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", but->value())){ + Fl_Input_Choice *but = (Fl_Input_Choice *)w->parent(); + if(fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", but->value())) { but->value(fileChooserGetName(1).c_str()); but->do_callback(); } @@ -975,7 +985,7 @@ static void onelab_input_choice_file_chooser_cb(Fl_Widget *w, void *data) static void onelab_input_choice_file_edit_cb(Fl_Widget *w, void *data) { - Fl_Input_Choice *but = (Fl_Input_Choice*)w->parent(); + Fl_Input_Choice *but = (Fl_Input_Choice *)w->parent(); std::string prog = FixWindowsPath(CTX::instance()->editor); std::string file = FixWindowsPath(but->value()); SystemCall(ReplaceSubString("%s", file, prog)); @@ -983,7 +993,7 @@ static void onelab_input_choice_file_edit_cb(Fl_Widget *w, void *data) static void onelab_input_choice_file_merge_cb(Fl_Widget *w, void *data) { - Fl_Input_Choice *but = (Fl_Input_Choice*)w->parent(); + Fl_Input_Choice *but = (Fl_Input_Choice *)w->parent(); std::string file = FixWindowsPath(but->value()); MergeFile(file); drawContext::global()->draw(); @@ -991,34 +1001,34 @@ static void onelab_input_choice_file_merge_cb(Fl_Widget *w, void *data) static void multiple_selection_menu_cb(Fl_Widget *w, void *data) { - Fl_Menu_Button *menu = (Fl_Menu_Button*)w; + Fl_Menu_Button *menu = (Fl_Menu_Button *)w; std::string val; - for (int i = 0; i < menu->size() - 1; i++) { + for(int i = 0; i < menu->size() - 1; i++) { const Fl_Menu_Item &item = menu->menu()[i]; - if(item.value() && item.label()){ + if(item.value() && item.label()) { if(val.size()) val += ", "; val += item.label(); } } - Fl_Input_Choice *but = (Fl_Input_Choice*)data; + Fl_Input_Choice *but = (Fl_Input_Choice *)data; but->value(val.c_str()); but->do_callback(); } static void multiple_selection_menu_all_cb(Fl_Widget *w, void *data) { - Fl_Input_Choice *but = (Fl_Input_Choice*)data; + Fl_Input_Choice *but = (Fl_Input_Choice *)data; Fl_Menu_Button *menu = but->menubutton(); std::string val; - for (int i = 0; i < menu->size() - 1; i++) { + for(int i = 0; i < menu->size() - 1; i++) { int mode = menu->mode(i); - if(mode & FL_MENU_TOGGLE){ + if(mode & FL_MENU_TOGGLE) { if(mode & FL_MENU_DIVIDER) menu->mode(i, FL_MENU_TOGGLE | FL_MENU_VALUE | FL_MENU_DIVIDER); else menu->mode(i, FL_MENU_TOGGLE | FL_MENU_VALUE); const Fl_Menu_Item &item = menu->menu()[i]; - if(item.label()){ + if(item.label()) { if(val.size()) val += ", "; val += item.label(); } @@ -1030,12 +1040,12 @@ static void multiple_selection_menu_all_cb(Fl_Widget *w, void *data) static void multiple_selection_menu_none_cb(Fl_Widget *w, void *data) { - Fl_Input_Choice *but = (Fl_Input_Choice*)data; + Fl_Input_Choice *but = (Fl_Input_Choice *)data; Fl_Menu_Button *menu = but->menubutton(); std::string val; - for (int i = 0; i < menu->size() - 1; i++) { + for(int i = 0; i < menu->size() - 1; i++) { int mode = menu->mode(i); - if(mode & FL_MENU_TOGGLE){ + if(mode & FL_MENU_TOGGLE) { if(mode & FL_MENU_DIVIDER) menu->mode(i, FL_MENU_TOGGLE | FL_MENU_DIVIDER); else @@ -1047,7 +1057,8 @@ static void multiple_selection_menu_none_cb(Fl_Widget *w, void *data) } Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, - Fl_Tree_Item *n, bool highlight, Fl_Color c) + Fl_Tree_Item *n, bool highlight, + Fl_Color c) { char *path = strdup(getPath(n).c_str()); _treeStrings.push_back(path); @@ -1055,14 +1066,14 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, // macro button if(p.getAttribute("Macro") == "Gmsh" || p.getAttribute("Macro") == "GmshMergeFile" || - p.getAttribute("Macro") == "GmshParseString"){ + p.getAttribute("Macro") == "GmshParseString") { Fl_Button *but = new Fl_Button(1, 1, ww / _widgetLabelRatio, hh); but->box(FL_FLAT_BOX); but->color(_tree->color()); but->selection_color(_tree->color()); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); - but->callback(onelab_string_button_cb, (void*)path); - if(highlight){ + but->callback(onelab_string_button_cb, (void *)path); + if(highlight) { but->color(c); but->labelcolor(fl_contrast(FL_FOREGROUND_COLOR, c)); } @@ -1070,11 +1081,11 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, } // non-editable value - if(p.getReadOnly() && p.getKind() != "file"){ + if(p.getReadOnly() && p.getKind() != "file") { Fl_Output *but = new Fl_Output(1, 1, ww, hh); but->value(p.getValue().c_str()); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); - if(highlight){ + if(highlight) { but->color(c); but->textcolor(fl_contrast(FL_FOREGROUND_COLOR, c)); } @@ -1082,13 +1093,13 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, } // simple string (no menu) - if(p.getChoices().empty() && p.getKind() != "file"){ + if(p.getChoices().empty() && p.getKind() != "file") { Fl_Input *but = new Fl_Input(1, 1, ww, hh); but->value(p.getValue().c_str()); - but->callback(onelab_string_input_cb, (void*)path); + but->callback(onelab_string_input_cb, (void *)path); but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); - if(highlight){ + if(highlight) { but->color(c); but->textcolor(fl_contrast(FL_FOREGROUND_COLOR, c)); } @@ -1101,7 +1112,7 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, if(multipleSelection.size()) but->menubutton()->callback(multiple_selection_menu_cb, but); std::vector<Fl_Menu_Item> menu; - for(unsigned int j = 0; j < p.getChoices().size(); j++){ + for(unsigned int j = 0; j < p.getChoices().size(); j++) { char *str = strdup(p.getChoices()[j].c_str()); _treeStrings.push_back(str); bool divider = ((p.getKind() == "file" || multipleSelection.size()) && @@ -1112,21 +1123,24 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, Fl_Menu_Item it = {str, 0, 0, 0, choice | (divider ? FL_MENU_DIVIDER : 0)}; menu.push_back(it); } - if(multipleSelection.size()){ + if(multipleSelection.size()) { Fl_Menu_Item it = {"Select All", 0, multiple_selection_menu_all_cb, but}; menu.push_back(it); Fl_Menu_Item it2 = {"Select None", 0, multiple_selection_menu_none_cb, but}; menu.push_back(it2); } - if(p.getKind() == "file"){ - if(!p.getReadOnly()){ - Fl_Menu_Item it = {"Choose File...", 0, onelab_input_choice_file_chooser_cb, (void*)n}; + if(p.getKind() == "file") { + if(!p.getReadOnly()) { + Fl_Menu_Item it = {"Choose File...", 0, + onelab_input_choice_file_chooser_cb, (void *)n}; menu.push_back(it); } - Fl_Menu_Item it2 = {"Edit Selected File...", 0, onelab_input_choice_file_edit_cb, (void*)n}; + Fl_Menu_Item it2 = {"Edit Selected File...", 0, + onelab_input_choice_file_edit_cb, (void *)n}; menu.push_back(it2); - if(GuessFileFormatFromFileName(p.getValue()) >= 0){ - Fl_Menu_Item it3 = {"Merge Selected File...", 0, onelab_input_choice_file_merge_cb, (void*)n}; + if(GuessFileFormatFromFileName(p.getValue()) >= 0) { + Fl_Menu_Item it3 = {"Merge Selected File...", 0, + onelab_input_choice_file_merge_cb, (void *)n}; menu.push_back(it3); } } @@ -1134,10 +1148,10 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, menu.push_back(it); but->menubutton()->copy(&menu[0]); but->value(p.getValue().c_str()); - but->callback(onelab_string_input_choice_cb, (void*)path); + but->callback(onelab_string_input_choice_cb, (void *)path); but->input()->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT | FL_ALIGN_CLIP); - if(highlight){ + if(highlight) { but->input()->color(c); but->input()->textcolor(fl_contrast(FL_FOREGROUND_COLOR, c)); } @@ -1147,12 +1161,11 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, static void view_group_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string group((char*)data); - while(group.size() && group[0] == '/') - group = group.substr(1); + std::string group((char *)data); + while(group.size() && group[0] == '/') group = group.substr(1); while(group.size() && group[group.size() - 1] == '/') group = group.substr(0, group.size() - 1); - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(unsigned int i = 0; i < PView::list.size(); i++) { PViewOptions *opt = PView::list[i]->getOptions(); if(opt->group.find(group) == 0) opt_view_visible(i, GMSH_SET | GMSH_GUI, !opt->visible); @@ -1163,38 +1176,42 @@ static void view_group_cb(Fl_Widget *w, void *data) static void highlight_physical_group_cb(Fl_Widget *w, void *data) { if(!data) return; - std::string group((char*)data); + std::string group((char *)data); if(group.empty()) return; GModel *m = GModel::current(); int dim = -1, num = -1; - if(group.find("Physical Point") != std::string::npos){ - dim = 0; num = atoi(group.substr(15).c_str()); + if(group.find("Physical Point") != std::string::npos) { + dim = 0; + num = atoi(group.substr(15).c_str()); } - else if(group.find("Physical Curve") != std::string::npos){ - dim = 1; num = atoi(group.substr(15).c_str()); + else if(group.find("Physical Curve") != std::string::npos) { + dim = 1; + num = atoi(group.substr(15).c_str()); } - else if(group.find("Physical Surface") != std::string::npos){ - dim = 2; num = atoi(group.substr(17).c_str()); + else if(group.find("Physical Surface") != std::string::npos) { + dim = 2; + num = atoi(group.substr(17).c_str()); } - else if(group.find("Physical Volume") != std::string::npos){ - dim = 3; num = atoi(group.substr(16).c_str()); + else if(group.find("Physical Volume") != std::string::npos) { + dim = 3; + num = atoi(group.substr(16).c_str()); } - else{ - for(dim = 3; dim >= 0; dim--){ + else { + for(dim = 3; dim >= 0; dim--) { num = m->getPhysicalNumber(dim, group); if(num > 0) break; } } if(dim < 0 || num < 0) return; // not found - std::map<int, std::vector<GEntity*> > groups; + std::map<int, std::vector<GEntity *> > groups; m->getPhysicalGroups(dim, groups); - std::vector<GEntity*> entities = groups[num]; + std::vector<GEntity *> entities = groups[num]; - for(unsigned int i = 0; i < entities.size(); i++){ + for(unsigned int i = 0; i < entities.size(); i++) { entities[i]->setVisibility(1); - if(!entities[i]->getSelection()){ + if(!entities[i]->getSelection()) { entities[i]->setSelection(2); } else @@ -1215,11 +1232,11 @@ void onelabGroup::rebuildTree(bool deleteWidgets) _tree->clear(); - if(CTX::instance()->guiColorScheme){ + if(CTX::instance()->guiColorScheme) { _tree->openicon(&open_pixmap_dark); _tree->closeicon(&close_pixmap_dark); } - else{ + else { _tree->openicon(&open_pixmap_light); _tree->closeicon(&close_pixmap_light); } @@ -1228,15 +1245,14 @@ void onelabGroup::rebuildTree(bool deleteWidgets) // hide all the widgets we have added in the tree to make sure they don't get // spurious events (until they are deleted) - for(unsigned int i = 0; i < _treeWidgets.size(); i++) - _treeWidgets[i]->hide(); + for(unsigned int i = 0; i < _treeWidgets.size(); i++) _treeWidgets[i]->hide(); // we don't delete widgets everytime the tree is rebuilt to minimize potential // race conditions (e.g. during heavy user interaction with autoCheck, with // risks to call handle() or focus() on deleted widgets) - std::vector<Fl_Widget*> delWidgets; - std::vector<char*> delStrings; - if(deleteWidgets){ + std::vector<Fl_Widget *> delWidgets; + std::vector<char *> delStrings; + if(deleteWidgets) { delWidgets = _treeWidgets; delStrings = _treeStrings; _treeWidgets.clear(); @@ -1247,26 +1263,28 @@ void onelabGroup::rebuildTree(bool deleteWidgets) std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers); - for(unsigned int i = 0; i < numbers.size(); i++){ + for(unsigned int i = 0; i < numbers.size(); i++) { if(numbers[i].getAttribute("Closed") == "1") closed.insert(numbers[i].getPath()); - if(!numbers[i].getVisible() && !CTX::instance()->solver.showInvisibleParameters) + if(!numbers[i].getVisible() && + !CTX::instance()->solver.showInvisibleParameters) continue; _addParameter(numbers[i]); } std::vector<onelab::string> strings; onelab::server::instance()->get(strings); - for(unsigned int i = 0; i < strings.size(); i++){ + for(unsigned int i = 0; i < strings.size(); i++) { if(strings[i].getAttribute("Closed") == "1") closed.insert(strings[i].getPath()); - if(!strings[i].getVisible() && !CTX::instance()->solver.showInvisibleParameters) + if(!strings[i].getVisible() && + !CTX::instance()->solver.showInvisibleParameters) continue; _addParameter(strings[i]); } - for(Fl_Tree_Item *n = _tree->first(); n; n = n->next()){ - if(n->has_children()){ + for(Fl_Tree_Item *n = _tree->first(); n; n = n->next()) { + if(n->has_children()) { int ww = (int)(_baseWidth - (n->depth() + 1) * _indent); int hh = n->labelsize() + 4; _tree->begin(); @@ -1280,16 +1298,16 @@ void onelabGroup::rebuildTree(bool deleteWidgets) but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); but->callback(onelab_subtree_cb, (void*)n); #else - if(getPath(n).find("0Modules/Post-processing") != std::string::npos){ + if(getPath(n).find("0Modules/Post-processing") != std::string::npos) { but = new Fl_Button(1, 1, ww, hh); but->box(FL_NO_BOX); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); but->tooltip("Toggle visibility of child views"); char *group = strdup(getPath(n).substr(24).c_str()); _treeStrings.push_back(group); - but->callback(view_group_cb, (void*)group); + but->callback(view_group_cb, (void *)group); } - else if(getPath(n).find("Physical group: ") != std::string::npos){ + else if(getPath(n).find("Physical group: ") != std::string::npos) { but = new Fl_Button(1, 1, ww, hh); but->box(FL_NO_BOX); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); @@ -1297,9 +1315,9 @@ void onelabGroup::rebuildTree(bool deleteWidgets) std::string::size_type pos = getPath(n).find("Physical group: "); char *group = strdup(getPath(n).substr(pos + 16).c_str()); _treeStrings.push_back(group); - but->callback(highlight_physical_group_cb, (void*)group); + but->callback(highlight_physical_group_cb, (void *)group); } - else{ + else { but = new Fl_Box(1, 1, ww, hh); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); } @@ -1312,7 +1330,8 @@ void onelabGroup::rebuildTree(bool deleteWidgets) } } - for(std::set<std::string>::iterator it = closed.begin(); it != closed.end(); it++){ + for(std::set<std::string>::iterator it = closed.begin(); it != closed.end(); + it++) { if(it->size()) _tree->close(it->c_str(), 0); } @@ -1322,13 +1341,12 @@ void onelabGroup::rebuildTree(bool deleteWidgets) FlGui::check(); // necessary e.g. on windows to avoid "ghosting" - if(deleteWidgets){ + if(deleteWidgets) { // this needs to be performed after FlGui::check() Msg::Debug("Deleting onelabGroup widgets (%d)", (int)_treeWidgets.size()); for(unsigned int i = 0; i < delWidgets.size(); i++) Fl::delete_widget(delWidgets[i]); - for(unsigned int i = 0; i < delStrings.size(); i++) - free(delStrings[i]); + for(unsigned int i = 0; i < delStrings.size(); i++) free(delStrings[i]); } #if 0 // test @@ -1341,7 +1359,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets) void onelabGroup::openTreeItem(const std::string &name) { Fl_Tree_Item *n = _tree->find_item(name.c_str()); - if(n && n->has_children()){ + if(n && n->has_children()) { n->open(); _tree->redraw(); } @@ -1349,13 +1367,13 @@ void onelabGroup::openTreeItem(const std::string &name) void onelabGroup::checkForErrors(const std::string &client) { - if(Msg::GetErrorCount() > 0 && !CTX::instance()->expertMode){ - std::string msg - (client + " reported an error: do you really want to continue?\n\n" - "(To disable this warning in the future, select `Enable expert mode'\n" - "in the option dialog.)"); - if(Msg::GetAnswer(msg.c_str(), 1, "Stop", "Continue") == 0) - _stop = true; + if(Msg::GetErrorCount() > 0 && !CTX::instance()->expertMode) { + std::string msg( + client + + " reported an error: do you really want to continue?\n\n" + "(To disable this warning in the future, select `Enable expert mode'\n" + "in the option dialog.)"); + if(Msg::GetAnswer(msg.c_str(), 1, "Stop", "Continue") == 0) _stop = true; } } @@ -1364,70 +1382,71 @@ void onelabGroup::setButtonVisibility() std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers); bool visible = false; - for(unsigned int i = 0; i < numbers.size(); i++){ - if(numbers[i].getVisible()){ + for(unsigned int i = 0; i < numbers.size(); i++) { + if(numbers[i].getVisible()) { visible = true; break; } } bool showRun = (onelab::server::instance()->getNumClients() > 1) || visible; - if(CTX::instance()->solver.autoCheck){ + if(CTX::instance()->solver.autoCheck) { _butt[0]->hide(); if(showRun) _butt[1]->show(); else _butt[1]->hide(); } - else if(showRun){ + else if(showRun) { _butt[0]->show(); _butt[1]->show(); } - else{ + else { _butt[0]->hide(); _butt[1]->hide(); } redraw(); } -void onelabGroup::setButtonMode(const std::string &butt0, const std::string &butt1) +void onelabGroup::setButtonMode(const std::string &butt0, + const std::string &butt1) { - if(butt0 == "check"){ + if(butt0 == "check") { _butt[0]->activate(); _butt[0]->label("Check"); - _butt[0]->callback(onelab_cb, (void*)"check"); + _butt[0]->callback(onelab_cb, (void *)"check"); } - else{ + else { _butt[0]->deactivate(); } - if(butt1 == "compute"){ + if(butt1 == "compute") { _butt[1]->activate(); _butt[1]->label("Run"); - _butt[1]->callback(onelab_cb, (void*)"compute"); + _butt[1]->callback(onelab_cb, (void *)"compute"); for(int i = 0; i < _gear->menu()->size(); i++) - ((Fl_Menu_Item*)_gear->menu())[i].activate(); + ((Fl_Menu_Item *)_gear->menu())[i].activate(); } - else if(butt1 == "stop"){ + else if(butt1 == "stop") { _butt[1]->activate(); _butt[1]->label("Stop"); - _butt[1]->callback(onelab_cb, (void*)"stop"); + _butt[1]->callback(onelab_cb, (void *)"stop"); for(int i = 0; i < _gear->menu()->size(); i++) if(i < _gearOptionsStart - 1 || i > _gearOptionsEnd - 2) - ((Fl_Menu_Item*)_gear->menu())[i].deactivate(); + ((Fl_Menu_Item *)_gear->menu())[i].deactivate(); } - else if(butt1 == "kill"){ + else if(butt1 == "kill") { _butt[1]->activate(); _butt[1]->label("Kill"); - _butt[1]->callback(onelab_cb, (void*)"kill"); + _butt[1]->callback(onelab_cb, (void *)"kill"); for(int i = 0; i < _gear->menu()->size(); i++) if(i < _gearOptionsStart - 1 || i > _gearOptionsEnd - 2) - ((Fl_Menu_Item*)_gear->menu())[i].deactivate(); + ((Fl_Menu_Item *)_gear->menu())[i].deactivate(); } - else{ + else { _butt[1]->deactivate(); for(int i = 0; i < _gear->menu()->size(); i++) if(i < _gearOptionsStart - 1 || i > _gearOptionsEnd - 2) - ((Fl_Menu_Item*)_gear->menu())[i].deactivate(); + ((Fl_Menu_Item *)_gear->menu())[i].deactivate(); } } @@ -1440,12 +1459,12 @@ bool onelabGroup::isBusy() std::string onelabGroup::getPath(Fl_Tree_Item *item) { - if(!item){ + if(!item) { Msg::Error("No item for path"); return ""; } char path[1024]; - if(_tree->item_pathname(path, sizeof(path), item)){ + if(_tree->item_pathname(path, sizeof(path), item)) { Msg::Error("Could not get path for item"); return ""; } @@ -1454,7 +1473,7 @@ std::string onelabGroup::getPath(Fl_Tree_Item *item) void onelabGroup::updateGearMenu() { - Fl_Menu_Item* menu = (Fl_Menu_Item*)_gear->menu(); + Fl_Menu_Item *menu = (Fl_Menu_Item *)_gear->menu(); int values[9] = {CTX::instance()->solver.autoSaveDatabase, CTX::instance()->solver.autoLoadDatabase, CTX::instance()->solver.autoArchiveOutputFiles, @@ -1464,7 +1483,7 @@ void onelabGroup::updateGearMenu() CTX::instance()->solver.autoShowViews, CTX::instance()->solver.autoShowLastStep, CTX::instance()->solver.showInvisibleParameters}; - for(int i = 0; i < 9; i++){ + for(int i = 0; i < 9; i++) { int idx = _gearOptionsStart - 1 + i; if(values[i]) menu[idx].set(); @@ -1478,23 +1497,23 @@ void onelabGroup::rebuildSolverList() updateGearMenu(); std::vector<std::string> names, exes, hosts; - for(int i = 0; i < NUM_SOLVERS; i++){ - if(opt_solver_name(i, GMSH_GET, "").size()){ + for(int i = 0; i < NUM_SOLVERS; i++) { + if(opt_solver_name(i, GMSH_GET, "").size()) { names.push_back(opt_solver_name(i, GMSH_GET, "")); exes.push_back(opt_solver_executable(i, GMSH_GET, "")); hosts.push_back(opt_solver_remote_login(i, GMSH_GET, "")); } } - for(unsigned int i = 0; i < NUM_SOLVERS; i++){ - if(i < names.size()){ - onelab::server::citer it = onelab::server::instance()->findClient(names[i]); - if(it != onelab::server::instance()->lastClient()) - (*it)->setIndex(i); + for(unsigned int i = 0; i < NUM_SOLVERS; i++) { + if(i < names.size()) { + onelab::server::citer it = + onelab::server::instance()->findClient(names[i]); + if(it != onelab::server::instance()->lastClient()) (*it)->setIndex(i); opt_solver_name(i, GMSH_SET, names[i]); opt_solver_executable(i, GMSH_SET, exes[i]); opt_solver_remote_login(i, GMSH_SET, hosts[i]); } - else{ + else { opt_solver_name(i, GMSH_SET, ""); opt_solver_executable(i, GMSH_SET, ""); opt_solver_remote_login(i, GMSH_SET, ""); @@ -1510,36 +1529,36 @@ static bool needToChooseExe(const std::string &exe) if(exe.empty()) return true; // exe is given with absolute path to non-existing file - if(exe[0] == '/' || exe[0] == '\\' || (exe.size() > 2 && exe[1] == ':')){ + if(exe[0] == '/' || exe[0] == '\\' || (exe.size() > 2 && exe[1] == ':')) { if(StatFile(exe)) return true; } return false; } -void onelabGroup::addSolver(const std::string &name, const std::string &executable, +void onelabGroup::addSolver(const std::string &name, + const std::string &executable, const std::string &remoteLogin, int index) { onelab::server::citer it = onelab::server::instance()->findClient(name); - if(it != onelab::server::instance()->lastClient()){ + if(it != onelab::server::instance()->lastClient()) { if(needToChooseExe(executable)) onelab_choose_executable_cb(0, (void *)(*it)); return; // solver already exists } // delete the other non-local clients so we keep only the new one - std::vector<onelab::client*> networkClients; + std::vector<onelab::client *> networkClients; for(onelab::server::citer it = onelab::server::instance()->firstClient(); it != onelab::server::instance()->lastClient(); it++) - if((*it)->isNetworkClient()) - networkClients.push_back(*it); - for(unsigned int i = 0; i < networkClients.size(); i++){ + if((*it)->isNetworkClient()) networkClients.push_back(*it); + for(unsigned int i = 0; i < networkClients.size(); i++) { delete networkClients[i]; } // create and register the new client - onelab::localNetworkClient *c = new gmshLocalNetworkClient(name, executable, - remoteLogin); + onelab::localNetworkClient *c = + new gmshLocalNetworkClient(name, executable, remoteLogin); c->setIndex(index); opt_solver_name(index, GMSH_SET, name); if(needToChooseExe(executable)) @@ -1551,5 +1570,5 @@ void onelabGroup::addSolver(const std::string &name, const std::string &executab FlGui::instance()->onelab->rebuildSolverList(); // initialize the client - onelab_cb(0, (void*)"initialize"); + onelab_cb(0, (void *)"initialize"); } diff --git a/Fltk/onelabGroup.h b/Fltk/onelabGroup.h index a6d005c144e7781e813846cc54b2673fd95620f3..09ea04282901307bd5f542e691b7ef5391920ab1 100644 --- a/Fltk/onelabGroup.h +++ b/Fltk/onelabGroup.h @@ -16,14 +16,14 @@ class viewButton; -class onelabGroup : public Fl_Group{ - private: +class onelabGroup : public Fl_Group { +private: Fl_Tree *_tree; Fl_Button *_butt[2]; Fl_Menu_Button *_gear; int _gearOptionsStart, _gearOptionsEnd; - std::vector<Fl_Widget*> _treeWidgets; - std::vector<char*> _treeStrings; + std::vector<Fl_Widget *> _treeWidgets; + std::vector<char *> _treeStrings; bool _stop; double _baseWidth, _indent; int _minWindowWidth, _minWindowHeight; @@ -41,19 +41,20 @@ class onelabGroup : public Fl_Group{ void _addViewMenu(int num); std::set<std::string> _getClosedGmshMenus(); void _addGmshMenus(); - public: - onelabGroup(int x, int y, int w, int h, const char *l=0); + +public: + onelabGroup(int x, int y, int w, int h, const char *l = 0); void updateGearMenu(); void rebuildSolverList(); void rebuildTree(bool deleteWidgets); - void enableTreeWidgetResize(bool value){ _enableTreeWidgetResize = value; } - void redrawTree(){ _tree->redraw(); } + void enableTreeWidgetResize(bool value) { _enableTreeWidgetResize = value; } + void redrawTree() { _tree->redraw(); } void openTreeItem(const std::string &name); void setButtonVisibility(); void setButtonMode(const std::string &butt0, const std::string &butt1); bool isBusy(); - int getMinWindowWidth(){ return _minWindowWidth; } - int getMinWindowHeight(){ return _minWindowHeight; } + int getMinWindowWidth() { return _minWindowWidth; } + int getMinWindowHeight() { return _minWindowHeight; } std::string getPath(Fl_Tree_Item *item); void insertInManuallyClosed(const std::string &path) { @@ -73,8 +74,8 @@ class onelabGroup : public Fl_Group{ const std::string &hostName, int index); void removeSolver(const std::string &name); void checkForErrors(const std::string &client); - bool stop(){ return _stop; } - void stop(bool val){ _stop = val; } + bool stop() { return _stop; } + void stop(bool val) { _stop = val; } }; void solver_cb(Fl_Widget *w, void *data); diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index be8285bd0256437836b0b01baf7a8be023eb14b3..f0c1fb52d8e280580f78c3a1eb969211082bffcd 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -29,22 +29,27 @@ // of gamepad) static void navigator_handler(void *data) { - openglWindow* gl_win = (openglWindow*)data; - if (CTX::instance()->gamepad && CTX::instance()->gamepad->active) { - if (gl_win->Nautilus ==0){ + openglWindow *gl_win = (openglWindow *)data; + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { + if(gl_win->Nautilus == 0) { gl_win->Nautilus = new Navigator(CTX::instance()->gamepad->frequency, gl_win->getDrawContext()); } gl_win->moveWithGamepad(); - Fl::add_timeout(CTX::instance()->gamepad->frequency, navigator_handler, data); + Fl::add_timeout(CTX::instance()->gamepad->frequency, navigator_handler, + data); } - else{ - if (gl_win->Nautilus){ delete gl_win->Nautilus; gl_win->Nautilus = 0; } + else { + if(gl_win->Nautilus) { + delete gl_win->Nautilus; + gl_win->Nautilus = 0; + } Fl::add_timeout(3., navigator_handler, data); } } -static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &click2) +static void lassoZoom(drawContext *ctx, mousePosition &click1, + mousePosition &click2) { if(click1.win[0] == click2.win[0] || click1.win[1] == click2.win[1]) return; @@ -64,8 +69,8 @@ static void lassoZoom(drawContext *ctx, mousePosition &click1, mousePosition &cl } openglWindow::openglWindow(int x, int y, int w, int h) - : Fl_Gl_Window(x, y, w, h, "gl"), _lock(false), _drawn(false), - _selection(ENT_NONE), _trySelection(0), Nautilus(0) + : Fl_Gl_Window(x, y, w, h, "gl"), _lock(false), _drawn(false), + _selection(ENT_NONE), _trySelection(0), Nautilus(0) { _ctx = new drawContext(this); @@ -78,7 +83,8 @@ openglWindow::openglWindow(int x, int y, int w, int h) endSelection = undoSelection = invertSelection = quitSelection = 0; changeSelection = 0; - if(CTX::instance()->gamepad) Fl::add_timeout(.5, navigator_handler, (void*)this); + if(CTX::instance()->gamepad) + Fl::add_timeout(.5, navigator_handler, (void *)this); } openglWindow::~openglWindow() @@ -89,26 +95,23 @@ openglWindow::~openglWindow() void openglWindow::_drawScreenMessage() { - if(screenMessage[0].empty() && screenMessage[1].empty()) - return; + if(screenMessage[0].empty() && screenMessage[1].empty()) return; - glColor4ubv((GLubyte *) & CTX::instance()->color.text); + glColor4ubv((GLubyte *)&CTX::instance()->color.text); drawContext::global()->setFont(CTX::instance()->glFontEnum, CTX::instance()->glFontSize); double h = drawContext::global()->getStringHeight(); - if(screenMessage[0].size()){ + if(screenMessage[0].size()) { const char *txt = screenMessage[0].c_str(); double w = drawContext::global()->getStringWidth(txt); - glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., - _ctx->viewport[3] - 1.2 * h); + glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., _ctx->viewport[3] - 1.2 * h); drawContext::global()->drawString(txt); } - if(screenMessage[1].size()){ + if(screenMessage[1].size()) { const char *txt = screenMessage[1].c_str(); double w = drawContext::global()->getStringWidth(txt); - glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., - _ctx->viewport[3] - 2.4 * h); + glRasterPos2d(_ctx->viewport[2] / 2. - w / 2., _ctx->viewport[3] - 2.4 * h); drawContext::global()->drawString(txt); } } @@ -118,7 +121,7 @@ void openglWindow::_drawBorder() if(!parent()) return; // draw thin border if the parent group has more than 2 opengl windows int numgl = 0; - for(int i = 0; i < parent()->children(); i++){ + for(int i = 0; i < parent()->children(); i++) { if(parent()->child(i)->label() && !strcmp(parent()->child(i)->label(), label())) numgl++; @@ -155,7 +158,7 @@ void openglWindow::draw() Msg::Debug("openglWindow::draw()"); - if(!context_valid()){ + if(!context_valid()) { _ctx->invalidateQuadricsAndDisplayLists(); } @@ -177,7 +180,7 @@ void openglWindow::draw() glColor3d(1., 1., 1.); glDisable(GL_DEPTH_TEST); glDrawBuffer(GL_FRONT_AND_BACK); - if(selectionMode && CTX::instance()->mouseSelection){ + if(selectionMode && CTX::instance()->mouseSelection) { glEnable(GL_LINE_STIPPLE); glLineStipple(1, 0x0F0F); } @@ -211,16 +214,17 @@ void openglWindow::draw() CTX::instance()->post.draw = 0; } - glClearColor - ((GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / 255.), - (GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / 255.), - (GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / 255.), - 0.0F); + glClearColor( + (GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / 255.), + (GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / + 255.), + (GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / 255.), + 0.0F); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); _ctx->draw3d(); - glColor4ubv((GLubyte *) & CTX::instance()->color.geom.highlight[0]); + glColor4ubv((GLubyte *)&CTX::instance()->color.geom.highlight[0]); float ps = CTX::instance()->geom.pointSize; if(_ctx->isHighResolution()) ps *= CTX::instance()->highResolutionPointSizeFactor; @@ -234,63 +238,70 @@ void openglWindow::draw() CTX::instance()->mesh.draw = 1; CTX::instance()->post.draw = 1; } - else{ + else { // draw the whole scene if(CTX::instance()->printing && !CTX::instance()->print.background) glClearColor(1.0F, 1.0F, 1.0F, 0.0F); else - glClearColor - ((GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / 255.), - (GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / 255.), - (GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / 255.), - 0.0F); + glClearColor( + (GLclampf)(CTX::instance()->unpackRed(CTX::instance()->color.bg) / + 255.), + (GLclampf)(CTX::instance()->unpackGreen(CTX::instance()->color.bg) / + 255.), + (GLclampf)(CTX::instance()->unpackBlue(CTX::instance()->color.bg) / + 255.), + 0.0F); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - if(CTX::instance()->camera && !CTX::instance()->stereo){ + if(CTX::instance()->camera && !CTX::instance()->stereo) { Camera *cam = &(_ctx->camera); - if (!cam->on) cam->init(); + if(!cam->on) cam->init(); cam->giveViewportDimension(_ctx->viewport[2], _ctx->viewport[3]); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glFrustum(cam->glFleft, cam->glFright, cam->glFbottom, - cam->glFtop, cam->glFnear, cam->glFfar*cam->Lc); + glFrustum(cam->glFleft, cam->glFright, cam->glFbottom, cam->glFtop, + cam->glFnear, cam->glFfar * cam->Lc); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDrawBuffer(GL_BACK); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - gluLookAt(cam->position.x,cam->position.y,cam->position.z, - cam->target.x,cam->target.y,cam->target.z, - cam->up.x,cam->up.y,cam->up.z); + gluLookAt(cam->position.x, cam->position.y, cam->position.z, + cam->target.x, cam->target.y, cam->target.z, cam->up.x, + cam->up.y, cam->up.z); _ctx->draw3d(); _ctx->draw2d(); - if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && Nautilus) + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && + Nautilus) Nautilus->drawIcons(); _drawScreenMessage(); _drawBorder(); } - else if(CTX::instance()->stereo){ + else if(CTX::instance()->stereo) { Camera *cam = &(_ctx->camera); - if(!cam->on ) cam->init(); + if(!cam->on) cam->init(); cam->giveViewportDimension(_ctx->viewport[2], _ctx->viewport[3]); XYZ eye = cam->eyesep / 2.0 * cam->right; // right eye glMatrixMode(GL_PROJECTION); glLoadIdentity(); - double left = - cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; - double right = cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; - double top = cam->wd2; - double bottom = - cam->wd2; - glFrustum(left, right, bottom, top, cam->glFnear, cam->glFfar*cam->Lc); + double left = + -cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; + double right = + cam->screenratio * cam->wd2 - 0.5 * cam->eyesep * cam->ndfl; + double top = cam->wd2; + double bottom = -cam->wd2; + glFrustum(left, right, bottom, top, cam->glFnear, cam->glFfar * cam->Lc); glMatrixMode(GL_MODELVIEW); glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - gluLookAt(cam->position.x+eye.x, cam->position.y+eye.y, cam->position.z+eye.z, - cam->target.x+eye.x, cam->target.y+eye.y, cam->target.z+eye.z, - cam->up.x, cam->up.y, cam->up.z); + gluLookAt(cam->position.x + eye.x, cam->position.y + eye.y, + cam->position.z + eye.z, cam->target.x + eye.x, + cam->target.y + eye.y, cam->target.z + eye.z, cam->up.x, + cam->up.y, cam->up.z); _ctx->draw3d(); _ctx->draw2d(); _drawScreenMessage(); @@ -298,25 +309,26 @@ void openglWindow::draw() // left eye glMatrixMode(GL_PROJECTION); glLoadIdentity(); - left = - cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; - right = cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; - top = cam->wd2; - bottom = - cam->wd2; - glFrustum(left, right, bottom, top, cam->glFnear, cam->glFfar*cam->Lc); + left = -cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; + right = cam->screenratio * cam->wd2 + 0.5 * cam->eyesep * cam->ndfl; + top = cam->wd2; + bottom = -cam->wd2; + glFrustum(left, right, bottom, top, cam->glFnear, cam->glFfar * cam->Lc); glMatrixMode(GL_MODELVIEW); glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); - gluLookAt(cam->position.x-eye.x, cam->position.y-eye.y, cam->position.z-eye.z, - cam->target.x-eye.x, cam->target.y-eye.y, cam->target.z-eye.z, - cam->up.x, cam->up.y, cam->up.z); + gluLookAt(cam->position.x - eye.x, cam->position.y - eye.y, + cam->position.z - eye.z, cam->target.x - eye.x, + cam->target.y - eye.y, cam->target.z - eye.z, cam->up.x, + cam->up.y, cam->up.z); _ctx->draw3d(); _ctx->draw2d(); _drawScreenMessage(); _drawBorder(); } - else{ + else { _ctx->draw3d(); _ctx->draw2d(); _drawScreenMessage(); @@ -329,7 +341,7 @@ void openglWindow::draw() openglWindow *openglWindow::_lastHandled = 0; -void openglWindow::_setLastHandled(openglWindow* w) +void openglWindow::_setLastHandled(openglWindow *w) { _lastHandled = w; FlGui::instance()->visibility->updatePerWindow(); @@ -337,58 +349,61 @@ void openglWindow::_setLastHandled(openglWindow* w) int openglWindow::handle(int event) { - switch (event) { - + switch(event) { case FL_FOCUS: // accept the focus when I'm asked if I want it - case FL_UNFOCUS: - return 1; + case FL_UNFOCUS: return 1; case FL_SHORTCUT: case FL_KEYBOARD: // override the default widget arrow-key-navigation - if(FlGui::instance()->testArrowShortcuts()) - return 1; + if(FlGui::instance()->testArrowShortcuts()) return 1; return Fl_Gl_Window::handle(event); case FL_PUSH: - if(Fl::event_clicks() == 1 && !selectionMode){ + if(Fl::event_clicks() == 1 && !selectionMode) { // double-click and not in selection mode - std::vector<GVertex*> vertices; - std::vector<GEdge*> edges; - std::vector<GFace*> faces; - std::vector<GRegion*> regions; - std::vector<MElement*> elements; + std::vector<GVertex *> vertices; + std::vector<GEdge *> edges; + std::vector<GFace *> faces; + std::vector<GRegion *> regions; + std::vector<MElement *> elements; std::vector<SPoint2> points; - std::vector<PView*> views; + std::vector<PView *> views; _select(ENT_ALL, false, false, true, Fl::event_x(), Fl::event_y(), 5, 5, vertices, edges, faces, regions, elements, points, views); - if(vertices.size() && CTX::instance()->geom.doubleClickedPointCommand.size()){ + if(vertices.size() && + CTX::instance()->geom.doubleClickedPointCommand.size()) { CTX::instance()->geom.doubleClickedEntityTag = vertices[0]->tag(); ParseString(CTX::instance()->geom.doubleClickedPointCommand, true); } - else if(edges.size() && CTX::instance()->geom.doubleClickedCurveCommand.size()){ + else if(edges.size() && + CTX::instance()->geom.doubleClickedCurveCommand.size()) { CTX::instance()->geom.doubleClickedEntityTag = edges[0]->tag(); ParseString(CTX::instance()->geom.doubleClickedCurveCommand, true); } - else if(faces.size() && CTX::instance()->geom.doubleClickedSurfaceCommand.size()){ + else if(faces.size() && + CTX::instance()->geom.doubleClickedSurfaceCommand.size()) { CTX::instance()->geom.doubleClickedEntityTag = faces[0]->tag(); ParseString(CTX::instance()->geom.doubleClickedSurfaceCommand, true); } - else if(regions.size() && CTX::instance()->geom.doubleClickedVolumeCommand.size()){ + else if(regions.size() && + CTX::instance()->geom.doubleClickedVolumeCommand.size()) { CTX::instance()->geom.doubleClickedEntityTag = regions[0]->tag(); ParseString(CTX::instance()->geom.doubleClickedVolumeCommand, true); } - else if(views.size() && views[0]->getOptions()->doubleClickedCommand.size()){ + else if(views.size() && + views[0]->getOptions()->doubleClickedCommand.size()) { CTX::instance()->post.doubleClickedView = views[0]->getIndex(); ParseString(views[0]->getOptions()->doubleClickedCommand, true); } - else if(points.size() && CTX::instance()->post.doubleClickedGraphPointCommand.size()){ + else if(points.size() && + CTX::instance()->post.doubleClickedGraphPointCommand.size()) { CTX::instance()->post.doubleClickedGraphPointX = points[0].x(); CTX::instance()->post.doubleClickedGraphPointY = points[0].y(); ParseString(CTX::instance()->post.doubleClickedGraphPointCommand, true); } - else{ // popup quick access menu - status_options_cb(0, (void*)"quick_access"); + else { // popup quick access menu + status_options_cb(0, (void *)"quick_access"); } Fl::event_clicks(-1); return 1; @@ -396,8 +411,8 @@ int openglWindow::handle(int event) _setLastHandled(this); take_focus(); // force keyboard focus when we click in the window _curr.set(_ctx, Fl::event_x(), Fl::event_y()); - if(Fl::event_button() == 1 && - !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)) { + if(Fl::event_button() == 1 && !Fl::event_state(FL_SHIFT) && + !Fl::event_state(FL_ALT)) { if(!lassoMode && Fl::event_state(FL_CTRL)) { lassoMode = true; _lassoXY[0] = _curr.win[0]; @@ -405,7 +420,7 @@ int openglWindow::handle(int event) } else if(lassoMode) { lassoMode = false; - if(selectionMode && CTX::instance()->mouseSelection){ + if(selectionMode && CTX::instance()->mouseSelection) { // will try to select multiple entities _trySelection = 2; _trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2; @@ -413,30 +428,30 @@ int openglWindow::handle(int event) _trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]); _trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]); } - else{ - if (CTX::instance()->camera){ - Camera * cam = &(_ctx->camera); - double dy = fabs(-_click.win[1] + _curr.win[1]); - double dx = fabs(-_click.win[0] + _curr.win[0]); - double factx = w() / fabs(dx); - double facty = h() / fabs(dy); - double fact = .8 * std::min(factx, facty); - double x_med = (_click.win[0] + _curr.win[0]) / 2.; - double y_med = (_click.win[1] + _curr.win[1]) / 2.; - double theta_x = .96 * cam->radians * (w() / 2 - x_med) * 2. / h(); - double theta_y = .96 * cam->radians * (h() / 2 - y_med) * 2. / h(); - cam->moveRight(theta_x); - cam->moveUp(theta_y); - _ctx->camera.zoom(fact); - _ctx->camera.update(); - redraw(); - } - else{ - lassoZoom(_ctx, _click, _curr); - } + else { + if(CTX::instance()->camera) { + Camera *cam = &(_ctx->camera); + double dy = fabs(-_click.win[1] + _curr.win[1]); + double dx = fabs(-_click.win[0] + _curr.win[0]); + double factx = w() / fabs(dx); + double facty = h() / fabs(dy); + double fact = .8 * std::min(factx, facty); + double x_med = (_click.win[0] + _curr.win[0]) / 2.; + double y_med = (_click.win[1] + _curr.win[1]) / 2.; + double theta_x = .96 * cam->radians * (w() / 2 - x_med) * 2. / h(); + double theta_y = .96 * cam->radians * (h() / 2 - y_med) * 2. / h(); + cam->moveRight(theta_x); + cam->moveUp(theta_y); + _ctx->camera.zoom(fact); + _ctx->camera.update(); + redraw(); + } + else { + lassoZoom(_ctx, _click, _curr); + } } } - else if(CTX::instance()->mouseSelection){ + else if(CTX::instance()->mouseSelection) { // will try to select clicked entity _trySelection = 1; _trySelectionXYWH[0] = (int)_curr.win[0]; @@ -449,13 +464,13 @@ int openglWindow::handle(int event) (Fl::event_button() == 1 && Fl::event_state(FL_SHIFT))) { if(!lassoMode && Fl::event_state(FL_CTRL)) { // make zoom isotropic - _ctx->s[1] = _ctx->s[0]; - _ctx->s[2] = _ctx->s[0]; - redraw(); + _ctx->s[1] = _ctx->s[0]; + _ctx->s[2] = _ctx->s[0]; + redraw(); } else if(lassoMode) { lassoMode = false; - if(selectionMode && CTX::instance()->mouseSelection){ + if(selectionMode && CTX::instance()->mouseSelection) { // will try to unselect multiple entities _trySelection = -2; _trySelectionXYWH[0] = (int)(_click.win[0] + _curr.win[0]) / 2; @@ -463,11 +478,11 @@ int openglWindow::handle(int event) _trySelectionXYWH[2] = (int)fabs(_click.win[0] - _curr.win[0]); _trySelectionXYWH[3] = (int)fabs(_click.win[1] - _curr.win[1]); } - else{ + else { lassoZoom(_ctx, _click, _curr); } } - else if(CTX::instance()->mouseSelection){ + else if(CTX::instance()->mouseSelection) { // will try to unselect clicked entity _trySelection = -1; _trySelectionXYWH[0] = (int)_curr.win[0]; @@ -506,25 +521,25 @@ int openglWindow::handle(int event) _prev.set(_ctx, Fl::event_x(), Fl::event_y()); return 1; - case FL_MOUSEWHEEL: - { - _prev.set(_ctx, Fl::event_x(), Fl::event_y()); - double dy = Fl::event_dy(); - double fact = (5. * CTX::instance()->zoomFactor * fabs(dy) + h()) / (double)h(); - if (CTX::instance()->camera){ - fact = ((dy > 0) ? fact : 1. / fact); - _ctx->camera.zoom(fact); - _ctx->camera.update(); - redraw(); - } - else{ - _ctx->s[0] *= ((dy > 0) ? fact : 1./fact); - _ctx->s[1] = _ctx->s[0]; - _ctx->s[2] = _ctx->s[0]; - _prev.recenter(_ctx); - redraw(); - } + case FL_MOUSEWHEEL: { + _prev.set(_ctx, Fl::event_x(), Fl::event_y()); + double dy = Fl::event_dy(); + double fact = + (5. * CTX::instance()->zoomFactor * fabs(dy) + h()) / (double)h(); + if(CTX::instance()->camera) { + fact = ((dy > 0) ? fact : 1. / fact); + _ctx->camera.zoom(fact); + _ctx->camera.update(); + redraw(); + } + else { + _ctx->s[0] *= ((dy > 0) ? fact : 1. / fact); + _ctx->s[1] = _ctx->s[0]; + _ctx->s[2] = _ctx->s[0]; + _prev.recenter(_ctx); + redraw(); } + } FlGui::instance()->manip->update(); return 1; @@ -545,62 +560,67 @@ int openglWindow::handle(int event) _trySelectionXYWH[2] = 5; _trySelectionXYWH[3] = 5; } - // (m1) and (!shift) and (!alt) => rotation - else if(Fl::event_button() == 1 && - !Fl::event_state(FL_SHIFT) && !Fl::event_state(FL_ALT)) { + // (m1) and (!shift) and (!alt) => rotation + else if(Fl::event_button() == 1 && !Fl::event_state(FL_SHIFT) && + !Fl::event_state(FL_ALT)) { if(CTX::instance()->useTrackball) - _ctx->addQuaternion((2. * _prev.win[0] - w()) / w(), - (h() - 2. * _prev.win[1]) / h(), - (2. * _curr.win[0] - w()) / w(), - (h() - 2. * _curr.win[1]) / h()); + _ctx->addQuaternion( + (2. * _prev.win[0] - w()) / w(), (h() - 2. * _prev.win[1]) / h(), + (2. * _curr.win[0] - w()) / w(), (h() - 2. * _curr.win[1]) / h()); else { - _ctx->r[1] += ((fabs(dx) > fabs(dy)) ? 180. * dx / (double)w() : 0.); - _ctx->r[0] += ((fabs(dx) > fabs(dy)) ? 0. : 180. * dy / (double)h()); + _ctx->r[1] += + ((fabs(dx) > fabs(dy)) ? 180. * dx / (double)w() : 0.); + _ctx->r[0] += + ((fabs(dx) > fabs(dy)) ? 0. : 180. * dy / (double)h()); } } - // m2 or (m1 and shift) => zoom (only move in y is used) - // but start point is the center of the homothety + // m2 or (m1 and shift) => zoom (only move in y is used) + // but start point is the center of the homothety else if(Fl::event_button() == 2 || (Fl::event_button() == 1 && Fl::event_state(FL_SHIFT))) { - // isotrop zoom in camera mode - if (CTX::instance()->camera){ - double dy= (int)_curr.win[1] - (int)_prev.win[1]; - double fact = (CTX::instance()->zoomFactor * fabs(dy) + (double)h()) / + // isotrop zoom in camera mode + if(CTX::instance()->camera) { + double dy = (int)_curr.win[1] - (int)_prev.win[1]; + double fact = + (CTX::instance()->zoomFactor * fabs(dy) + (double)h()) / (double)h(); - fact= ((dy > 0) ? fact : 1./fact); - _ctx->camera.zoom(fact); - _ctx->camera.update(); - redraw(); - } - else{ + fact = ((dy > 0) ? fact : 1. / fact); + _ctx->camera.zoom(fact); + _ctx->camera.update(); + redraw(); + } + else { // move in y greater than move in x - if(fabs(dy) > fabs(dx)) { - double fact = (CTX::instance()->zoomFactor * fabs(dy) + h()) / (double)h(); - _ctx->s[0] *= ((dy > 0) ? fact : 1./fact); - _ctx->s[1] = _ctx->s[0]; - _ctx->s[2] = _ctx->s[0]; - _click.recenter(_ctx); - } - else if(!CTX::instance()->useTrackball) - _ctx->r[2] += -180. * dx / (double)w(); - } + if(fabs(dy) > fabs(dx)) { + double fact = + (CTX::instance()->zoomFactor * fabs(dy) + h()) / (double)h(); + _ctx->s[0] *= ((dy > 0) ? fact : 1. / fact); + _ctx->s[1] = _ctx->s[0]; + _ctx->s[2] = _ctx->s[0]; + _click.recenter(_ctx); + } + else if(!CTX::instance()->useTrackball) + _ctx->r[2] += -180. * dx / (double)w(); + } } // other case => translation - else { - if (CTX::instance()->camera){ - Camera * cam= &(_ctx->camera); - double theta_x = cam->radians * (-(double)_prev.win[0] + - (double)_curr.win[0]) * 2. / h(); - double theta_y = cam->radians * (-(double)_prev.win[1] + - (double)_curr.win[1]) * 2. / h(); - cam->moveRight(theta_x); - cam->moveUp(theta_y); - } - else{ - _ctx->t[0] += (_curr.wnr[0] - _click.wnr[0]); - _ctx->t[1] += (_curr.wnr[1] - _click.wnr[1]); - _ctx->t[2] = 0.; - } + else { + if(CTX::instance()->camera) { + Camera *cam = &(_ctx->camera); + double theta_x = cam->radians * + (-(double)_prev.win[0] + (double)_curr.win[0]) * + 2. / h(); + double theta_y = cam->radians * + (-(double)_prev.win[1] + (double)_curr.win[1]) * + 2. / h(); + cam->moveRight(theta_x); + cam->moveUp(theta_y); + } + else { + _ctx->t[0] += (_curr.wnr[0] - _click.wnr[0]); + _ctx->t[1] += (_curr.wnr[1] - _click.wnr[1]); + _ctx->t[2] = 0.; + } } CTX::instance()->drawRotationCenter = 1; if(CTX::instance()->fastRedraw) { @@ -616,22 +636,24 @@ int openglWindow::handle(int event) case FL_MOVE: _curr.set(_ctx, Fl::event_x(), Fl::event_y()); - if(lassoMode){ + if(lassoMode) { redraw(); } - else if(addPointMode && !Fl::event_state(FL_SHIFT)){ + else if(addPointMode && !Fl::event_state(FL_SHIFT)) { cursor(FL_CURSOR_CROSS, FL_BLACK, FL_WHITE); // find line in real space corresponding to current cursor position double p[3], d[3]; _ctx->unproject(_curr.win[0], _curr.win[1], p, d); // find closest point to the center of gravity - double r[3] = {CTX::instance()->cg[0] - p[0], CTX::instance()->cg[1] - p[1], - CTX::instance()->cg[2] - p[2]}, t; + double r[3] = {CTX::instance()->cg[0] - p[0], + CTX::instance()->cg[1] - p[1], + CTX::instance()->cg[2] - p[2]}, + t; t = prosca(r, d); - for(int i = 0; i < 3; i++){ - if(!FlGui::instance()->elementaryContext->frozenPointCoord(i)){ + for(int i = 0; i < 3; i++) { + if(!FlGui::instance()->elementaryContext->frozenPointCoord(i)) { _point[i] = p[i] + t * d[i]; - if(CTX::instance()->geom.snap[i]){ + if(CTX::instance()->geom.snap[i]) { double d = _point[i] / CTX::instance()->geom.snap[i]; double f = floor(d); double c = ceil(d); @@ -643,19 +665,19 @@ int openglWindow::handle(int event) FlGui::instance()->elementaryContext->updatePoint(_point, addPointMode); redraw(); } - else{ // hover mode - if(_curr.win[0] != _prev.win[0] || _curr.win[1] != _prev.win[1]){ - std::vector<GVertex*> vertices; - std::vector<GEdge*> edges; - std::vector<GFace*> faces; - std::vector<GRegion*> regions; - std::vector<MElement*> elements; + else { // hover mode + if(_curr.win[0] != _prev.win[0] || _curr.win[1] != _prev.win[1]) { + std::vector<GVertex *> vertices; + std::vector<GEdge *> edges; + std::vector<GFace *> faces; + std::vector<GRegion *> regions; + std::vector<MElement *> elements; std::vector<SPoint2> points; - std::vector<PView*> views; + std::vector<PView *> views; bool res = _select(_selection, false, CTX::instance()->mouseHoverMeshes, - CTX::instance()->mouseHoverMeshes, - (int)_curr.win[0], (int)_curr.win[1], 5, 5, - vertices, edges, faces, regions, elements, points, views); + CTX::instance()->mouseHoverMeshes, (int)_curr.win[0], + (int)_curr.win[1], 5, 5, vertices, edges, faces, + regions, elements, points, views); if((_selection == ENT_ALL && res) || (_selection == ENT_POINT && vertices.size()) || (_selection == ENT_CURVE && edges.size()) || @@ -666,38 +688,38 @@ int openglWindow::handle(int event) cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE); std::string text, cmd; bool multiline = CTX::instance()->tooltips; - if(vertices.size()){ + if(vertices.size()) { text = vertices[0]->getInfoString(true, multiline); cmd = CTX::instance()->geom.doubleClickedPointCommand; } - else if(edges.size()){ + else if(edges.size()) { text = edges[0]->getInfoString(true, multiline); cmd = CTX::instance()->geom.doubleClickedCurveCommand; } - else if(faces.size()){ + else if(faces.size()) { text = faces[0]->getInfoString(true, multiline); cmd = CTX::instance()->geom.doubleClickedSurfaceCommand; } - else if(regions.size()){ + else if(regions.size()) { text = regions[0]->getInfoString(true, multiline); cmd = CTX::instance()->geom.doubleClickedVolumeCommand; } - else if(elements.size()){ + else if(elements.size()) { text = elements[0]->getInfoString(multiline); } - else if(points.size()){ + else if(points.size()) { char tmp[256]; sprintf(tmp, "Point (%g, %g)", points[0].x(), points[0].y()); text = tmp; cmd = CTX::instance()->post.doubleClickedGraphPointCommand; } - else if(views.size()){ + else if(views.size()) { char tmp[256]; sprintf(tmp, "View[%d]", views[0]->getIndex()); text = tmp; cmd = views[0]->getOptions()->doubleClickedCommand; } - if(cmd.size()){ + if(cmd.size()) { text += std::string(" - Double-click to execute\n\n"); std::replace(cmd.begin(), cmd.end(), '\r', ' '); text += cmd; @@ -711,16 +733,15 @@ int openglWindow::handle(int event) _prev.set(_ctx, Fl::event_x(), Fl::event_y()); return 1; - default: - return Fl_Gl_Window::handle(event); + default: return Fl_Gl_Window::handle(event); } } int openglWindow::pixel_w() { -#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) +#if(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) return Fl_Gl_Window::pixel_w(); -#elif (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) +#elif(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) return Fl_Gl_Window::pixel_w(); #else return w(); @@ -729,24 +750,21 @@ int openglWindow::pixel_w() int openglWindow::pixel_h() { -#if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) +#if(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 3) && (FL_PATCH_VERSION >= 4) return Fl_Gl_Window::pixel_h(); -#elif (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) +#elif(FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION >= 4) return Fl_Gl_Window::pixel_h(); #else return h(); #endif } -bool openglWindow::_select(int type, bool multiple, bool mesh, bool post, - int x, int y, int w, int h, - std::vector<GVertex*> &vertices, - std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, - std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, - std::vector<SPoint2> &points, - std::vector<PView*> &views) +bool openglWindow::_select( + int type, bool multiple, bool mesh, bool post, int x, int y, int w, int h, + std::vector<GVertex *> &vertices, std::vector<GEdge *> &edges, + std::vector<GFace *> &faces, std::vector<GRegion *> ®ions, + std::vector<MElement *> &elements, std::vector<SPoint2> &points, + std::vector<PView *> &views) { // same lock as in draw() to prevent firing up a GL_SELECT rendering pass // while a GL_RENDER pass is happening (due to the asynchronus nature of @@ -754,21 +772,19 @@ bool openglWindow::_select(int type, bool multiple, bool mesh, bool post, if(_lock) return false; _lock = true; make_current(); - bool ret = _ctx->select(type, multiple, mesh, post, x, y, w, h, - vertices, edges, faces, regions, elements, - points, views); + bool ret = _ctx->select(type, multiple, mesh, post, x, y, w, h, vertices, + edges, faces, regions, elements, points, views); _lock = false; return ret; } -char openglWindow::selectEntity(int type, - std::vector<GVertex*> &vertices, - std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, - std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, +char openglWindow::selectEntity(int type, std::vector<GVertex *> &vertices, + std::vector<GEdge *> &edges, + std::vector<GFace *> &faces, + std::vector<GRegion *> ®ions, + std::vector<MElement *> &elements, std::vector<SPoint2> &points, - std::vector<PView*> &views) + std::vector<PView *> &views) { // force keyboard focus in GL window take_focus(); @@ -818,14 +834,14 @@ char openglWindow::selectEntity(int type, bool add = (_trySelection > 0) ? true : false; bool multi = (abs(_trySelection) > 1) ? true : false; _trySelection = 0; - if(_selection == ENT_NONE){ // just report the mouse click + if(_selection == ENT_NONE) { // just report the mouse click selectionMode = false; return 'c'; } else if(_select(_selection, multi, true, false, _trySelectionXYWH[0], _trySelectionXYWH[1], _trySelectionXYWH[2], - _trySelectionXYWH[3], vertices, edges, faces, - regions, elements, points, views)){ + _trySelectionXYWH[3], vertices, edges, faces, regions, + elements, points, views)) { _selection = ENT_NONE; selectionMode = false; if(add) @@ -856,9 +872,9 @@ void openglWindow::drawTooltip(const std::string &text) void openglWindow::moveWithGamepad() { - if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && Nautilus){ + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active && Nautilus) { if(!(_ctx->camera.on)) _ctx->camera.init(); - if(_drawn && (_lastHandled == this || _lastHandled == 0)){ + if(_drawn && (_lastHandled == this || _lastHandled == 0)) { Nautilus->move(); this->flush(); } diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h index 00fba6d30a0cb6b0732056b1bd5e1d86c8311cfc..51817501e346d4b4f04df7cd7ebfc754c2886034 100644 --- a/Fltk/openglWindow.h +++ b/Fltk/openglWindow.h @@ -20,9 +20,9 @@ class GRegion; class MElement; class openglWindow : public Fl_Gl_Window { - private: +private: static openglWindow *_lastHandled; - static void _setLastHandled(openglWindow*); + static void _setLastHandled(openglWindow *); bool _lock; bool _drawn; mousePosition _click, _curr, _prev; @@ -32,42 +32,47 @@ class openglWindow : public Fl_Gl_Window { double _lassoXY[2]; void _drawScreenMessage(); void _drawBorder(); - bool _select(int type, bool multiple, bool mesh, bool post, int x, int y, int w, int h, - std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, std::vector<SPoint2> &points, - std::vector<PView*> &views); - protected: + bool _select(int type, bool multiple, bool mesh, bool post, int x, int y, + int w, int h, std::vector<GVertex *> &vertices, + std::vector<GEdge *> &edges, std::vector<GFace *> &faces, + std::vector<GRegion *> ®ions, + std::vector<MElement *> &elements, std::vector<SPoint2> &points, + std::vector<PView *> &views); + +protected: void draw(); int handle(int); - public: + +public: int pixel_w(); int pixel_h(); - time_t rawtime, prev_rawtime; + time_t rawtime, prev_rawtime; double response_frequency; int addPointMode; bool lassoMode, selectionMode; - int endSelection, undoSelection, invertSelection, quitSelection, changeSelection; + int endSelection, undoSelection, invertSelection, quitSelection, + changeSelection; std::string screenMessage[2]; openglWindow(int x, int y, int w, int h); ~openglWindow(); - drawContext *getDrawContext(){ return _ctx; } - char selectEntity(int type, - std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, std::vector<SPoint2> &points, - std::vector<PView*> &views); - static openglWindow *getLastHandled(){ return _lastHandled; } - static void setLastHandled(openglWindow *w){ _lastHandled = w; } + drawContext *getDrawContext() { return _ctx; } + char selectEntity(int type, std::vector<GVertex *> &vertices, + std::vector<GEdge *> &edges, std::vector<GFace *> &faces, + std::vector<GRegion *> ®ions, + std::vector<MElement *> &elements, + std::vector<SPoint2> &points, std::vector<PView *> &views); + static openglWindow *getLastHandled() { return _lastHandled; } + static void setLastHandled(openglWindow *w) { _lastHandled = w; } void drawTooltip(const std::string &text); double frequency; void moveWithGamepad(); Navigator *Nautilus; void setPoint(double x, double y, double z) { - _point[0] = x; _point[1] = y; _point[2] = z; + _point[0] = x; + _point[1] = y; + _point[2] = z; } - }; #endif diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 8dfa956c59f3ef3669b7cf0aedda163ba107e299..cb74186cf76d87760ee458ade11ff1051f26e28f 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -38,97 +38,78 @@ typedef unsigned long intptr_t; #include "StringUtils.h" #include "gmshLocalNetworkClient.h" -extern StringXColor GeneralOptions_Color[] ; -extern StringXColor GeometryOptions_Color[] ; -extern StringXColor MeshOptions_Color[] ; -extern StringXColor SolverOptions_Color[] ; -extern StringXColor PostProcessingOptions_Color[] ; -extern StringXColor ViewOptions_Color[] ; -extern StringXColor PrintOptions_Color[] ; +extern StringXColor GeneralOptions_Color[]; +extern StringXColor GeometryOptions_Color[]; +extern StringXColor MeshOptions_Color[]; +extern StringXColor SolverOptions_Color[]; +extern StringXColor PostProcessingOptions_Color[]; +extern StringXColor ViewOptions_Color[]; +extern StringXColor PrintOptions_Color[]; static Fl_Menu_Item menu_point_display[] = { - {"Color dot", 0, 0, 0}, - {"3D sphere", 0, 0, 0}, - {0} -}; - -static Fl_Menu_Item menu_point_display_post[] = { - {"Color dot", 0, 0, 0}, - {"3D sphere", 0, 0, 0}, - {"Scaled dot", 0, 0, 0}, - {"Scaled sphere", 0, 0, 0}, - {0} -}; + {"Color dot", 0, 0, 0}, {"3D sphere", 0, 0, 0}, {0}}; + +static Fl_Menu_Item menu_point_display_post[] = {{"Color dot", 0, 0, 0}, + {"3D sphere", 0, 0, 0}, + {"Scaled dot", 0, 0, 0}, + {"Scaled sphere", 0, 0, 0}, + {0}}; static Fl_Menu_Item menu_line_display[] = { - {"Color segment", 0, 0, 0}, - {"3D cylinder", 0, 0, 0}, - {0} -}; - -static Fl_Menu_Item menu_line_display_post[] = { - {"Color segment", 0, 0, 0}, - {"3D cylinder", 0, 0, 0}, - {"Tapered cylinder", 0, 0, 0}, - {0} -}; + {"Color segment", 0, 0, 0}, {"3D cylinder", 0, 0, 0}, {0}}; + +static Fl_Menu_Item menu_line_display_post[] = {{"Color segment", 0, 0, 0}, + {"3D cylinder", 0, 0, 0}, + {"Tapered cylinder", 0, 0, 0}, + {0}}; static Fl_Menu_Item menu_surface_display[] = { - {"Cross", 0, 0, 0}, - {"Wireframe", 0, 0, 0}, - {"Solid", 0, 0, 0}, - {0} -}; - -static Fl_Menu_Item menu_axes_mode[] = { - {"None", 0, 0, 0}, - {"Simple axes", 0, 0, 0}, - {"Box", 0, 0, 0}, - {"Full grid", 0, 0, 0}, - {"Open grid", 0, 0, 0}, - {"Ruler", 0, 0, 0}, - {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}, - {"Top", 0, 0, 0}, - {"Bottom", 0, 0, 0}, - {"Left", 0, 0, 0}, - {"Right", 0, 0, 0}, - {"Full", 0, 0, 0}, - {"Top third", 0, 0, 0}, - {"In model coordinates", 0, 0, 0}, - {0} -}; + {"Cross", 0, 0, 0}, {"Wireframe", 0, 0, 0}, {"Solid", 0, 0, 0}, {0}}; + +static Fl_Menu_Item menu_axes_mode[] = {{"None", 0, 0, 0}, + {"Simple axes", 0, 0, 0}, + {"Box", 0, 0, 0}, + {"Full grid", 0, 0, 0}, + {"Open grid", 0, 0, 0}, + {"Ruler", 0, 0, 0}, + {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}, + {"Top", 0, 0, 0}, + {"Bottom", 0, 0, 0}, + {"Left", 0, 0, 0}, + {"Right", 0, 0, 0}, + {"Full", 0, 0, 0}, + {"Top third", 0, 0, 0}, + {"In model coordinates", 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}, - {"Times-Italic", 0, 0, (void*)FL_TIMES_ITALIC}, - {"Times-BoldItalic", 0, 0, (void*)FL_TIMES_BOLD_ITALIC}, - {"Helvetica", 0, 0, (void*)FL_HELVETICA}, - {"Helvetica-Bold", 0, 0, (void*)FL_HELVETICA_BOLD}, - {"Helvetica-Oblique", 0, 0, (void*)FL_HELVETICA_ITALIC}, - {"Helvetica-BoldOblique", 0, 0, (void*)FL_HELVETICA_BOLD_ITALIC}, - {"Courier", 0, 0, (void*)FL_COURIER}, - {"Courier-Bold", 0, 0, (void*)FL_COURIER_BOLD}, - {"Courier-Oblique", 0, 0, (void*)FL_COURIER_ITALIC}, - {"Courier-BoldOblique", 0, 0, (void*)FL_COURIER_BOLD_ITALIC}, - {"Symbol", 0, 0, (void*)FL_SYMBOL}, - {"ZapfDingbats", 0, 0, (void*)FL_ZAPF_DINGBATS}, - {"Screen", 0, 0, (void*)FL_SCREEN}, - {0} -}; + {"Times-Roman", 0, 0, (void *)FL_TIMES}, + {"Times-Bold", 0, 0, (void *)FL_TIMES_BOLD}, + {"Times-Italic", 0, 0, (void *)FL_TIMES_ITALIC}, + {"Times-BoldItalic", 0, 0, (void *)FL_TIMES_BOLD_ITALIC}, + {"Helvetica", 0, 0, (void *)FL_HELVETICA}, + {"Helvetica-Bold", 0, 0, (void *)FL_HELVETICA_BOLD}, + {"Helvetica-Oblique", 0, 0, (void *)FL_HELVETICA_ITALIC}, + {"Helvetica-BoldOblique", 0, 0, (void *)FL_HELVETICA_BOLD_ITALIC}, + {"Courier", 0, 0, (void *)FL_COURIER}, + {"Courier-Bold", 0, 0, (void *)FL_COURIER_BOLD}, + {"Courier-Oblique", 0, 0, (void *)FL_COURIER_ITALIC}, + {"Courier-BoldOblique", 0, 0, (void *)FL_COURIER_BOLD_ITALIC}, + {"Symbol", 0, 0, (void *)FL_SYMBOL}, + {"ZapfDingbats", 0, 0, (void *)FL_ZAPF_DINGBATS}, + {"Screen", 0, 0, (void *)FL_SCREEN}, + {0}}; static void color_cb(Fl_Widget *w, void *data) { - unsigned int (*fct) (int, int, unsigned int); + unsigned int (*fct)(int, int, unsigned int); fct = (unsigned int (*)(int, int, unsigned int))data; uchar r = CTX::instance()->unpackRed(fct(0, GMSH_GET, 0)); uchar g = CTX::instance()->unpackGreen(fct(0, GMSH_GET, 0)); @@ -140,17 +121,17 @@ static void color_cb(Fl_Widget *w, void *data) static void view_color_cb(Fl_Widget *w, void *data) { - unsigned int (*fct) (int, int, unsigned int); + unsigned int (*fct)(int, int, unsigned int); fct = (unsigned int (*)(int, int, unsigned int))data; - uchar r = CTX::instance()->unpackRed - (fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); - uchar g = CTX::instance()->unpackGreen - (fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); - uchar b = CTX::instance()->unpackBlue - (fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); + uchar r = CTX::instance()->unpackRed( + fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); + uchar g = CTX::instance()->unpackGreen( + fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); + uchar b = CTX::instance()->unpackBlue( + fct(FlGui::instance()->options->view.index, GMSH_GET, 0)); if(fl_color_chooser("Color Chooser", r, g, b)) - fct(FlGui::instance()->options->view.index, - GMSH_SET | GMSH_GUI, CTX::instance()->packColor(r, g, b, 255)); + fct(FlGui::instance()->options->view.index, GMSH_SET | GMSH_GUI, + CTX::instance()->packColor(r, g, b, 255)); drawContext::global()->draw(); } @@ -168,13 +149,13 @@ void options_cb(Fl_Widget *w, void *data) static void options_browser_cb(Fl_Widget *w, void *data) { // allows multiple selections with the mouse - FlGui::instance()->options->showGroup(FlGui::instance()->options->browser->value(), - true, true); + FlGui::instance()->options->showGroup( + FlGui::instance()->options->browser->value(), true, true); } static void options_show_file_cb(Fl_Widget *w, void *data) { - std::string what((const char*)data); + std::string what((const char *)data); std::string file = CTX::instance()->homeDir; if(what == "session") file += CTX::instance()->sessionFileName; @@ -185,8 +166,9 @@ static void options_show_file_cb(Fl_Widget *w, void *data) void options_restore_defaults_cb(Fl_Widget *w, void *data) { - if(fl_choice("Do you really want to reset all options to their default values?", - "Cancel", "Restore", 0)){ + if(fl_choice( + "Do you really want to reset all options to their default values?", + "Cancel", "Restore", 0)) { UnlinkFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName); UnlinkFile(CTX::instance()->homeDir + CTX::instance()->optionsFileName); ReInitOptions(0); @@ -203,8 +185,8 @@ void general_options_cb(Fl_Widget *w, void *data) static void general_options_color_scheme_cb(Fl_Widget *w, void *data) { - opt_general_color_scheme - (0, GMSH_SET, FlGui::instance()->options->general.choice[3]->value()); + opt_general_color_scheme( + 0, GMSH_SET, FlGui::instance()->options->general.choice[3]->value()); drawContext::global()->draw(); } @@ -230,12 +212,12 @@ static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) pc = FlGui::instance()->selectedFaces[0]->bounds().center(); else if(FlGui::instance()->selectedRegions.size()) pc = FlGui::instance()->selectedRegions[0]->bounds().center(); - opt_general_rotation_center0(0, GMSH_SET|GMSH_GUI, pc.x()); - opt_general_rotation_center1(0, GMSH_SET|GMSH_GUI, pc.y()); - opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, pc.z()); + opt_general_rotation_center0(0, GMSH_SET | GMSH_GUI, pc.x()); + opt_general_rotation_center1(0, GMSH_SET | GMSH_GUI, pc.y()); + opt_general_rotation_center2(0, GMSH_SET | GMSH_GUI, pc.z()); drawContext *ctx = - FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); ctx->recenterForRotationCenterChange(pc); FlGui::instance()->manip->update(); } @@ -249,48 +231,46 @@ static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) static void general_options_ok_cb(Fl_Widget *w, void *data) { optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); static double lc = 0.; - if(lc != CTX::instance()->lc){ + if(lc != CTX::instance()->lc) { lc = CTX::instance()->lc; - for(int i = 2; i < 5; i++){ + for(int i = 2; i < 5; i++) { o->general.value[i]->minimum(-5 * CTX::instance()->lc); o->general.value[i]->maximum(5 * CTX::instance()->lc); } } - if(data){ - const char *name = (const char*)data; - if(!strcmp(name, "rotation_center_coord")){ + if(data) { + const char *name = (const char *)data; + if(!strcmp(name, "rotation_center_coord")) { CTX::instance()->drawRotationCenter = 1; - SPoint3 p(o->general.value[8]->value(), - o->general.value[9]->value(), + SPoint3 p(o->general.value[8]->value(), o->general.value[9]->value(), o->general.value[10]->value()); drawContext *ctx = - FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); ctx->recenterForRotationCenterChange(p); FlGui::instance()->manip->update(); } - else if(!strcmp(name, "rotation_center")){ + else if(!strcmp(name, "rotation_center")) { // pre-fill with cg for(int i = 0; i < 3; i++) o->general.value[8 + i]->value(CTX::instance()->cg[i]); - SPoint3 p(CTX::instance()->cg[0], - CTX::instance()->cg[1], + SPoint3 p(CTX::instance()->cg[0], CTX::instance()->cg[1], CTX::instance()->cg[2]); drawContext *ctx = - FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); ctx->recenterForRotationCenterChange(p); FlGui::instance()->manip->update(); } - else if(!strcmp(name, "light_value")){ + else if(!strcmp(name, "light_value")) { double x, y, z; x = o->general.value[2]->value(); y = o->general.value[3]->value(); z = o->general.value[4]->value(); o->general.sphere->setValue(x, y, z); } - else if(!strcmp(name, "light_sphere")){ + else if(!strcmp(name, "light_sphere")) { double x, y, z; o->general.sphere->getValue(x, y, z); o->general.value[2]->value(x); @@ -312,17 +292,20 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) double sessionrc = opt_general_session_save(0, GMSH_GET, 0); opt_general_session_save(0, GMSH_SET, o->general.butt[8]->value()); if(sessionrc && !opt_general_session_save(0, GMSH_GET, 0)) - PrintOptions(0, GMSH_SESSIONRC, 1, 1, - (CTX::instance()->homeDir + CTX::instance()->sessionFileName).c_str()); + PrintOptions( + 0, GMSH_SESSIONRC, 1, 1, + (CTX::instance()->homeDir + CTX::instance()->sessionFileName).c_str()); opt_general_options_save(0, GMSH_SET, o->general.butt[9]->value()); opt_general_expert_mode(0, GMSH_SET, o->general.butt[10]->value()); #if defined(HAVE_VISUDEV) opt_general_heavy_visualization(0, GMSH_SET, o->general.butt[22]->value()); #endif - if(opt_general_gui_color_scheme(0, GMSH_GET, 0) != o->general.butt[21]->value()){ + if(opt_general_gui_color_scheme(0, GMSH_GET, 0) != + o->general.butt[21]->value()) { opt_general_gui_color_scheme(0, GMSH_SET, o->general.butt[21]->value()); - opt_general_color_scheme(0, GMSH_SET|GMSH_GUI, o->general.butt[21]->value() ? 0. : 1.); + opt_general_color_scheme(0, GMSH_SET | GMSH_GUI, + o->general.butt[21]->value() ? 0. : 1.); } opt_general_tooltips(0, GMSH_SET, o->general.butt[13]->value()); @@ -346,7 +329,8 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) opt_general_rotation_center2(0, GMSH_SET, o->general.value[10]->value()); opt_general_quadric_subdivisions(0, GMSH_SET, o->general.value[11]->value()); opt_general_graphics_fontsize(0, GMSH_SET, o->general.value[12]->value()); - opt_general_graphics_fontsize_title(0, GMSH_SET, o->general.value[28]->value()); + opt_general_graphics_fontsize_title(0, GMSH_SET, + o->general.value[28]->value()); opt_general_clip_factor(0, GMSH_SET, o->general.value[14]->value()); opt_general_polygon_offset_factor(0, GMSH_SET, o->general.value[15]->value()); opt_general_polygon_offset_units(0, GMSH_SET, o->general.value[16]->value()); @@ -379,20 +363,21 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) opt_general_axes(0, GMSH_SET, o->general.choice[4]->value()); opt_general_background_gradient(0, GMSH_SET, o->general.choice[5]->value()); - if( (opt_general_gamepad(0, GMSH_GET, 0) != o->general.butt[19]->value() ) - || ( opt_general_camera_mode(0, GMSH_GET, 0) != o->general.butt[18]->value() )){ - if((opt_general_gamepad(0, GMSH_GET, 0) == 1 ) - && (o->general.butt[18]->value() == 0) ) { - o->general.butt[19]->value(0) ; + if((opt_general_gamepad(0, GMSH_GET, 0) != o->general.butt[19]->value()) || + (opt_general_camera_mode(0, GMSH_GET, 0) != + o->general.butt[18]->value())) { + if((opt_general_gamepad(0, GMSH_GET, 0) == 1) && + (o->general.butt[18]->value() == 0)) { + o->general.butt[19]->value(0); } - if((opt_general_camera_mode(0, GMSH_GET, 0) == 0 ) - && ( o->general.butt[19]->value() ==1) ) { + if((opt_general_camera_mode(0, GMSH_GET, 0) == 0) && + (o->general.butt[19]->value() == 1)) { o->general.butt[18]->value(1); } } - opt_general_gamepad(0, GMSH_SET, o->general.butt[19]->value() ); + opt_general_gamepad(0, GMSH_SET, o->general.butt[19]->value()); opt_general_camera_mode(0, GMSH_SET, o->general.butt[18]->value()); - o->activate((const char*)data); + o->activate((const char *)data); opt_general_eye_sep_ratio(0, GMSH_SET, o->general.value[29]->value()); opt_general_focallength_ratio(0, GMSH_SET, o->general.value[30]->value()); @@ -415,7 +400,7 @@ static void general_arrow_param_cb(Fl_Widget *w, void *data) double a = opt_general_arrow_head_radius(0, GMSH_GET, 0); double b = opt_general_arrow_stem_length(0, GMSH_GET, 0); double c = opt_general_arrow_stem_radius(0, GMSH_GET, 0); - while(arrowEditor("Arrow Editor", a, b, c)){ + while(arrowEditor("Arrow Editor", a, b, c)) { opt_general_arrow_head_radius(0, GMSH_SET, a); opt_general_arrow_stem_length(0, GMSH_SET, b); opt_general_arrow_stem_radius(0, GMSH_SET, c); @@ -431,7 +416,7 @@ void geometry_options_cb(Fl_Widget *w, void *data) static void geometry_options_ok_cb(Fl_Widget *w, void *data) { optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); opt_geometry_points(0, GMSH_SET, o->geo.butt[0]->value()); opt_geometry_curves(0, GMSH_SET, o->geo.butt[1]->value()); @@ -494,7 +479,7 @@ void mesh_options_cb(Fl_Widget *w, void *data) static void mesh_options_ok_cb(Fl_Widget *w, void *data) { optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); opt_mesh_lc_from_curvature(0, GMSH_SET, o->mesh.butt[1]->value()); opt_mesh_lc_from_points(0, GMSH_SET, o->mesh.butt[5]->value()); @@ -546,19 +531,27 @@ static void mesh_options_ok_cb(Fl_Widget *w, void *data) opt_mesh_point_type(0, GMSH_SET, o->mesh.choice[0]->value()); opt_mesh_algo2d(0, GMSH_SET, - (o->mesh.choice[2]->value() == 1) ? ALGO_2D_MESHADAPT : - (o->mesh.choice[2]->value() == 2) ? ALGO_2D_DELAUNAY : - (o->mesh.choice[2]->value() == 3) ? ALGO_2D_FRONTAL : - (o->mesh.choice[2]->value() == 4) ? ALGO_2D_FRONTAL_QUAD : - (o->mesh.choice[2]->value() == 5) ? ALGO_2D_PACK_PRLGRMS : - ALGO_2D_AUTO); + (o->mesh.choice[2]->value() == 1) ? + ALGO_2D_MESHADAPT : + (o->mesh.choice[2]->value() == 2) ? + ALGO_2D_DELAUNAY : + (o->mesh.choice[2]->value() == 3) ? + ALGO_2D_FRONTAL : + (o->mesh.choice[2]->value() == 4) ? + ALGO_2D_FRONTAL_QUAD : + (o->mesh.choice[2]->value() == 5) ? ALGO_2D_PACK_PRLGRMS : + ALGO_2D_AUTO); opt_mesh_algo3d(0, GMSH_SET, - (o->mesh.choice[3]->value() == 1) ? ALGO_3D_FRONTAL : - (o->mesh.choice[3]->value() == 2) ? ALGO_3D_FRONTAL_DEL : - (o->mesh.choice[3]->value() == 3) ? ALGO_3D_FRONTAL_HEX : - (o->mesh.choice[3]->value() == 4) ? ALGO_3D_MMG3D : - (o->mesh.choice[3]->value() == 5) ? ALGO_3D_RTREE : - ALGO_3D_DELAUNAY); + (o->mesh.choice[3]->value() == 1) ? + ALGO_3D_FRONTAL : + (o->mesh.choice[3]->value() == 2) ? + ALGO_3D_FRONTAL_DEL : + (o->mesh.choice[3]->value() == 3) ? + ALGO_3D_FRONTAL_HEX : + (o->mesh.choice[3]->value() == 4) ? + ALGO_3D_MMG3D : + (o->mesh.choice[3]->value() == 5) ? ALGO_3D_RTREE : + ALGO_3D_DELAUNAY); opt_mesh_algo_recombine(0, GMSH_SET, o->mesh.choice[1]->value()); opt_mesh_algo_subdivide(0, GMSH_SET, o->mesh.choice[5]->value()); opt_mesh_remesh_algo(0, GMSH_SET, o->mesh.choice[8]->value()); @@ -582,14 +575,15 @@ void solver_options_cb(Fl_Widget *w, void *data) static void solver_options_ok_cb(Fl_Widget *w, void *data) { optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); #if defined(HAVE_ONELAB) - int old_listen = (int)opt_solver_listen(0, GMSH_GET, o->solver.butt[0]->value()); + int old_listen = + (int)opt_solver_listen(0, GMSH_GET, o->solver.butt[0]->value()); opt_solver_listen(0, GMSH_SET, o->solver.butt[0]->value()); - if(!old_listen && o->solver.butt[0]->value()){ + if(!old_listen && o->solver.butt[0]->value()) { onelab::server::citer it = onelab::server::instance()->findClient("Listen"); - if(it == onelab::server::instance()->lastClient()){ + if(it == onelab::server::instance()->lastClient()) { onelab::localNetworkClient *c = new gmshLocalNetworkClient("Listen", ""); c->run(); } @@ -617,7 +611,7 @@ void post_options_cb(Fl_Widget *w, void *data) static void post_options_ok_cb(Fl_Widget *w, void *data) { optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); opt_post_anim_cycle(0, GMSH_SET, o->post.butt[0]->value()); opt_post_combine_remove_orig(0, GMSH_SET, o->post.butt[1]->value()); @@ -637,7 +631,7 @@ static void post_options_ok_cb(Fl_Widget *w, void *data) void view_options_cb(Fl_Widget *w, void *data) { int num = (intptr_t)data; - if(num < 0){ // automatic + if(num < 0) { // automatic int current = FlGui::instance()->options->view.index; if(current >= 0 && current < (int)PView::list.size()) num = current; @@ -650,12 +644,12 @@ void view_options_cb(Fl_Widget *w, void *data) static void view_options_timestep_cb(Fl_Widget *w, void *data) { - std::string str((const char*)data); + std::string str((const char *)data); for(int i = 0; i < (int)PView::list.size(); i++) { if(i == FlGui::instance()->options->view.index || FlGui::instance()->options->browser->selected(i + 6)) { if(str == "=") - opt_view_timestep(i, GMSH_SET, ((Fl_Value_Input *) w)->value()); + opt_view_timestep(i, GMSH_SET, ((Fl_Value_Input *)w)->value()); else if(str == "-") opt_view_timestep(i, GMSH_SET | GMSH_GUI, opt_view_timestep(i, GMSH_GET, 0) - 1); @@ -674,25 +668,28 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) if(current < 0) return; optionWindow *o = FlGui::instance()->options; - o->activate((const char*)data); + o->activate((const char *)data); - if(data){ - std::string str((const char*)data); - if(str == "range_min" || str == "range_max"){ + if(data) { + 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)) { + 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)); + 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)); + vmax = + std::max(vmax, data->getMax(step, true, opt->forceNumComponents, + opt->componentMap)); } } if(str == "range_min") @@ -719,13 +716,16 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) double external_view = opt_view_external_view(current, GMSH_GET, 0); double gen_raise_view = opt_view_gen_raise_view(current, GMSH_GET, 0); double show_time = opt_view_show_time(current, GMSH_GET, 0); - double force_num_components = opt_view_force_num_components(current, GMSH_GET, 0); + double force_num_components = + opt_view_force_num_components(current, GMSH_GET, 0); double center_glyphs = opt_view_center_glyphs(current, GMSH_GET, 0); double type = opt_view_type(current, GMSH_GET, 0); double saturate_values = opt_view_saturate_values(current, GMSH_GET, 0); - double max_recursion_level = opt_view_max_recursion_level(current, GMSH_GET, 0); - double adapt_vis_grid = opt_view_adapt_visualization_grid(current, GMSH_GET, 0); + double max_recursion_level = + opt_view_max_recursion_level(current, GMSH_GET, 0); + double adapt_vis_grid = + opt_view_adapt_visualization_grid(current, GMSH_GET, 0); double target_error = opt_view_target_error(current, GMSH_GET, 0); double show_element = opt_view_show_element(current, GMSH_GET, 0); double draw_skin_only = opt_view_draw_skin_only(current, GMSH_GET, 0); @@ -776,11 +776,13 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) double timestep = opt_view_timestep(current, GMSH_GET, 0); double arrow_size_min = opt_view_arrow_size_min(current, GMSH_GET, 0); double arrow_size_max = opt_view_arrow_size_max(current, GMSH_GET, 0); - double displacement_factor = opt_view_displacement_factor(current, GMSH_GET, 0); + double displacement_factor = + opt_view_displacement_factor(current, GMSH_GET, 0); double point_size = opt_view_point_size(current, GMSH_GET, 0); double line_width = opt_view_line_width(current, GMSH_GET, 0); double explode = opt_view_explode(current, GMSH_GET, 0); - double angle_smooth_normals = opt_view_angle_smooth_normals(current, GMSH_GET, 0); + double angle_smooth_normals = + opt_view_angle_smooth_normals(current, GMSH_GET, 0); double position0 = opt_view_position0(current, GMSH_GET, 0); double position1 = opt_view_position1(current, GMSH_GET, 0); double size0 = opt_view_size0(current, GMSH_GET, 0); @@ -826,44 +828,36 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) // view_choice val = o->view.choice[1]->value() + 1; - if(force || (val != scale_type)) - opt_view_scale_type(i, GMSH_SET, val); + if(force || (val != scale_type)) opt_view_scale_type(i, GMSH_SET, val); val = o->view.choice[0]->value() + 1; if(force || (val != intervals_type)) opt_view_intervals_type(i, GMSH_SET, val); val = o->view.choice[5]->value(); - if(force || (val != point_type)) - opt_view_point_type(i, GMSH_SET, val); + if(force || (val != point_type)) opt_view_point_type(i, GMSH_SET, val); val = o->view.choice[6]->value(); - if(force || (val != line_type)) - opt_view_line_type(i, GMSH_SET, val); + if(force || (val != line_type)) opt_view_line_type(i, GMSH_SET, val); val = o->view.choice[2]->value() + 1; - if(force || (val != vector_type)) - opt_view_vector_type(i, GMSH_SET, val); + if(force || (val != vector_type)) opt_view_vector_type(i, GMSH_SET, val); val = o->view.choice[3]->value() + 1; if(force || (val != glyph_location)) opt_view_glyph_location(i, GMSH_SET, val); val = o->view.choice[4]->value() + 1; - if(force || (val != tensor_type)) - opt_view_tensor_type(i, GMSH_SET, val); + if(force || (val != tensor_type)) opt_view_tensor_type(i, GMSH_SET, val); val = o->view.choice[7]->value() + 1; - if(force || (val != range_type)) - opt_view_range_type(i, GMSH_SET, val); + if(force || (val != range_type)) opt_view_range_type(i, GMSH_SET, val); val = o->view.choice[8]->value(); - if(force || (val != axes)) - opt_view_axes(i, GMSH_SET, val); + if(force || (val != axes)) opt_view_axes(i, GMSH_SET, val); val = o->view.choice[9]->value(); - if(force || (val != boundary)) - opt_view_boundary(i, GMSH_SET, val); + if(force || (val != boundary)) opt_view_boundary(i, GMSH_SET, val); val = o->view.choice[10]->value() - 1; if(force || (val != external_view)) @@ -874,17 +868,16 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_gen_raise_view(i, GMSH_SET, val); val = o->view.choice[12]->value(); - if(force || (val != show_time)) - opt_view_show_time(i, GMSH_SET, val); + if(force || (val != show_time)) opt_view_show_time(i, GMSH_SET, val); val = o->view.choice[13]->value() + 1; - if(force || (val != type)) - opt_view_type(i, GMSH_SET, val); + if(force || (val != type)) opt_view_type(i, GMSH_SET, val); - val = - (o->view.choice[14]->value() == 1) ? 1 : - (o->view.choice[14]->value() == 2) ? 3 : - (o->view.choice[14]->value() == 3) ? 9 : 0; + val = (o->view.choice[14]->value() == 1) ? + 1 : + (o->view.choice[14]->value() == 2) ? + 3 : + (o->view.choice[14]->value() == 3) ? 9 : 0; if(force || (val != force_num_components)) opt_view_force_num_components(i, GMSH_SET, val); @@ -915,12 +908,10 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_draw_skin_only(i, GMSH_SET, val); val = o->view.butt[4]->value(); - if(force || (val != show_scale)) - opt_view_show_scale(i, GMSH_SET, val); + if(force || (val != show_scale)) opt_view_show_scale(i, GMSH_SET, val); val = o->view.butt[3]->value(); - if(force || (val != mikado)) - opt_view_axes_mikado(i, GMSH_SET, val); + if(force || (val != mikado)) opt_view_axes_mikado(i, GMSH_SET, val); val = o->view.butt[25]->value(); if(force || (val != axes_auto_position)) @@ -931,12 +922,10 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_draw_strings(i, GMSH_SET, val); val = o->view.butt[11]->value(); - if(force || (val != light)) - opt_view_light(i, GMSH_SET, val); + if(force || (val != light)) opt_view_light(i, GMSH_SET, val); val = o->view.butt[8]->value(); - if(force || (val != light_lines)) - opt_view_light_lines(i, GMSH_SET, val); + if(force || (val != light_lines)) opt_view_light_lines(i, GMSH_SET, val); val = o->view.butt[9]->value(); if(force || (val != light_two_side)) @@ -959,12 +948,10 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_draw_tensors(i, GMSH_SET, val); val = o->view.menu[1]->menu()[0].value() ? 1 : 0; - if(force || (val != draw_points)) - opt_view_draw_points(i, GMSH_SET, val); + if(force || (val != draw_points)) opt_view_draw_points(i, GMSH_SET, val); val = o->view.menu[1]->menu()[1].value() ? 1 : 0; - if(force || (val != draw_lines)) - opt_view_draw_lines(i, GMSH_SET, val); + if(force || (val != draw_lines)) opt_view_draw_lines(i, GMSH_SET, val); val = o->view.menu[1]->menu()[2].value() ? 1 : 0; if(force || (val != draw_triangles)) @@ -983,8 +970,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_draw_hexahedra(i, GMSH_SET, val); val = o->view.menu[1]->menu()[6].value() ? 1 : 0; - if(force || (val != draw_prisms)) - opt_view_draw_prisms(i, GMSH_SET, val); + if(force || (val != draw_prisms)) opt_view_draw_prisms(i, GMSH_SET, val); val = o->view.menu[1]->menu()[7].value() ? 1 : 0; if(force || (val != draw_pyramids)) @@ -999,26 +985,21 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_fake_transparency(i, GMSH_SET, val); val = o->view.butt[26]->value(); - if(force || (val != use_stipple)) - opt_view_use_stipple(i, GMSH_SET, val); + if(force || (val != use_stipple)) opt_view_use_stipple(i, GMSH_SET, val); // view_values val = o->view.value[0]->value(); - if(force || (val != normals)) - opt_view_normals(i, GMSH_SET, val); + if(force || (val != normals)) opt_view_normals(i, GMSH_SET, val); val = o->view.value[1]->value(); - if(force || (val != tangents)) - opt_view_tangents(i, GMSH_SET, val); + if(force || (val != tangents)) opt_view_tangents(i, GMSH_SET, val); val = o->view.value[31]->value(); - if(force || (val != custom_min)) - opt_view_custom_min(i, GMSH_SET, val); + if(force || (val != custom_min)) opt_view_custom_min(i, GMSH_SET, val); val = o->view.value[32]->value(); - if(force || (val != custom_max)) - opt_view_custom_max(i, GMSH_SET, val); + if(force || (val != custom_max)) opt_view_custom_max(i, GMSH_SET, val); val = o->view.value[33]->value(); if(force || (val != max_recursion_level)) @@ -1029,76 +1010,59 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_target_error(i, GMSH_SET, val); val = o->view.value[30]->value(); - if(force || (val != nb_iso)) - opt_view_nb_iso(i, GMSH_SET, val); + if(force || (val != nb_iso)) opt_view_nb_iso(i, GMSH_SET, val); val = o->view.value[40]->value(); - if(force || (val != offset0)) - opt_view_offset0(i, GMSH_SET, val); + if(force || (val != offset0)) opt_view_offset0(i, GMSH_SET, val); val = o->view.value[41]->value(); - if(force || (val != offset1)) - opt_view_offset1(i, GMSH_SET, val); + if(force || (val != offset1)) opt_view_offset1(i, GMSH_SET, val); val = o->view.value[42]->value(); - if(force || (val != offset2)) - opt_view_offset2(i, GMSH_SET, val); + if(force || (val != offset2)) opt_view_offset2(i, GMSH_SET, val); val = o->view.value[51]->value(); - if(force || (val != transform00)) - opt_view_transform00(i, GMSH_SET, val); + if(force || (val != transform00)) opt_view_transform00(i, GMSH_SET, val); val = o->view.value[52]->value(); - if(force || (val != transform01)) - opt_view_transform01(i, GMSH_SET, val); + if(force || (val != transform01)) opt_view_transform01(i, GMSH_SET, val); val = o->view.value[53]->value(); - if(force || (val != transform02)) - opt_view_transform02(i, GMSH_SET, val); + if(force || (val != transform02)) opt_view_transform02(i, GMSH_SET, val); val = o->view.value[54]->value(); - if(force || (val != transform10)) - opt_view_transform10(i, GMSH_SET, val); + if(force || (val != transform10)) opt_view_transform10(i, GMSH_SET, val); val = o->view.value[55]->value(); - if(force || (val != transform11)) - opt_view_transform11(i, GMSH_SET, val); + if(force || (val != transform11)) opt_view_transform11(i, GMSH_SET, val); val = o->view.value[56]->value(); - if(force || (val != transform12)) - opt_view_transform12(i, GMSH_SET, val); + if(force || (val != transform12)) opt_view_transform12(i, GMSH_SET, val); val = o->view.value[57]->value(); - if(force || (val != transform20)) - opt_view_transform20(i, GMSH_SET, val); + if(force || (val != transform20)) opt_view_transform20(i, GMSH_SET, val); val = o->view.value[58]->value(); - if(force || (val != transform21)) - opt_view_transform21(i, GMSH_SET, val); + if(force || (val != transform21)) opt_view_transform21(i, GMSH_SET, val); val = o->view.value[59]->value(); - if(force || (val != transform22)) - opt_view_transform22(i, GMSH_SET, val); + if(force || (val != transform22)) opt_view_transform22(i, GMSH_SET, val); val = o->view.value[43]->value(); - if(force || (val != raise0)) - opt_view_raise0(i, GMSH_SET, val); + if(force || (val != raise0)) opt_view_raise0(i, GMSH_SET, val); val = o->view.value[44]->value(); - if(force || (val != raise1)) - opt_view_raise1(i, GMSH_SET, val); + if(force || (val != raise1)) opt_view_raise1(i, GMSH_SET, val); val = o->view.value[45]->value(); - if(force || (val != raise2)) - opt_view_raise2(i, GMSH_SET, val); + if(force || (val != raise2)) opt_view_raise2(i, GMSH_SET, val); val = o->view.value[46]->value(); if(force || (val != normal_raise)) opt_view_normal_raise(i, GMSH_SET, val); val = o->view.value[50]->value(); - if(force || (val != timestep)) - opt_view_timestep(i, GMSH_SET, val); + if(force || (val != timestep)) opt_view_timestep(i, GMSH_SET, val); val = o->view.value[64]->value(); if(force || (val != arrow_size_min)) @@ -1113,76 +1077,60 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_displacement_factor(i, GMSH_SET, val); val = o->view.value[61]->value(); - if(force || (val != point_size)) - opt_view_point_size(i, GMSH_SET, val); + if(force || (val != point_size)) opt_view_point_size(i, GMSH_SET, val); val = o->view.value[62]->value(); - if(force || (val != line_width)) - opt_view_line_width(i, GMSH_SET, val); + if(force || (val != line_width)) opt_view_line_width(i, GMSH_SET, val); val = o->view.value[12]->value(); - if(force || (val != explode)) - opt_view_explode(i, GMSH_SET, val); + if(force || (val != explode)) opt_view_explode(i, GMSH_SET, val); val = o->view.value[10]->value(); if(force || (val != angle_smooth_normals)) opt_view_angle_smooth_normals(i, GMSH_SET, val); val = o->view.value[20]->value(); - if(force || (val != position0)) - opt_view_position0(i, GMSH_SET, val); + if(force || (val != position0)) opt_view_position0(i, GMSH_SET, val); val = o->view.value[21]->value(); - if(force || (val != position1)) - opt_view_position1(i, GMSH_SET, val); + if(force || (val != position1)) opt_view_position1(i, GMSH_SET, val); val = o->view.value[22]->value(); - if(force || (val != size0)) - opt_view_size0(i, GMSH_SET, val); + if(force || (val != size0)) opt_view_size0(i, GMSH_SET, val); val = o->view.value[23]->value(); - if(force || (val != size1)) - opt_view_size1(i, GMSH_SET, val); + if(force || (val != size1)) opt_view_size1(i, GMSH_SET, val); val = o->view.value[13]->value(); - if(force || (val != axes_xmin)) - opt_view_axes_xmin(i, GMSH_SET, val); + if(force || (val != axes_xmin)) opt_view_axes_xmin(i, GMSH_SET, val); val = o->view.value[14]->value(); - if(force || (val != axes_ymin)) - opt_view_axes_ymin(i, GMSH_SET, val); + if(force || (val != axes_ymin)) opt_view_axes_ymin(i, GMSH_SET, val); val = o->view.value[15]->value(); - if(force || (val != axes_zmin)) - opt_view_axes_zmin(i, GMSH_SET, val); + if(force || (val != axes_zmin)) opt_view_axes_zmin(i, GMSH_SET, val); val = o->view.value[16]->value(); - if(force || (val != axes_xmax)) - opt_view_axes_xmax(i, GMSH_SET, val); + if(force || (val != axes_xmax)) opt_view_axes_xmax(i, GMSH_SET, val); val = o->view.value[17]->value(); - if(force || (val != axes_ymax)) - opt_view_axes_ymax(i, GMSH_SET, val); + if(force || (val != axes_ymax)) opt_view_axes_ymax(i, GMSH_SET, val); val = o->view.value[18]->value(); - if(force || (val != axes_zmax)) - opt_view_axes_zmax(i, GMSH_SET, val); + if(force || (val != axes_zmax)) opt_view_axes_zmax(i, GMSH_SET, val); val = o->view.value[2]->value(); if(force || (val != gen_raise_factor)) opt_view_gen_raise_factor(i, GMSH_SET, val); val = o->view.value[3]->value(); - if(force || (val != axes_tics0)) - opt_view_axes_tics0(i, GMSH_SET, val); + if(force || (val != axes_tics0)) opt_view_axes_tics0(i, GMSH_SET, val); val = o->view.value[4]->value(); - if(force || (val != axes_tics1)) - opt_view_axes_tics1(i, GMSH_SET, val); + if(force || (val != axes_tics1)) opt_view_axes_tics1(i, GMSH_SET, val); val = o->view.value[5]->value(); - if(force || (val != axes_tics2)) - opt_view_axes_tics2(i, GMSH_SET, val); + if(force || (val != axes_tics2)) opt_view_axes_tics2(i, GMSH_SET, val); val = o->view.value[70]->value(); if(force || (val != component_map0)) @@ -1229,32 +1177,26 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_component_map8(i, GMSH_SET, val); val = o->view.value[6]->value(); - if(force || (val != sampling)) - opt_view_sampling(i, GMSH_SET, val); + if(force || (val != sampling)) opt_view_sampling(i, GMSH_SET, val); // view_inputs std::string str; str = o->view.input[0]->value(); - if(force || (str != name)) - opt_view_name(i, GMSH_SET, str); + if(force || (str != name)) opt_view_name(i, GMSH_SET, str); str = o->view.input[1]->value(); - if(force || (str != format)) - opt_view_format(i, GMSH_SET, str); + if(force || (str != format)) opt_view_format(i, GMSH_SET, str); str = o->view.input[10]->value(); - if(force || (str != axes_label0)) - opt_view_axes_label0(i, GMSH_SET, str); + if(force || (str != axes_label0)) opt_view_axes_label0(i, GMSH_SET, str); str = o->view.input[11]->value(); - if(force || (str != axes_label1)) - opt_view_axes_label1(i, GMSH_SET, str); + if(force || (str != axes_label1)) opt_view_axes_label1(i, GMSH_SET, str); str = o->view.input[12]->value(); - if(force || (str != axes_label2)) - opt_view_axes_label2(i, GMSH_SET, str); + if(force || (str != axes_label2)) opt_view_axes_label2(i, GMSH_SET, str); str = o->view.input[7]->value(); if(force || (str != axes_format0)) @@ -1269,46 +1211,43 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) opt_view_axes_format2(i, GMSH_SET, str); str = o->view.input[4]->value(); - if(force || (str != gen_raise0)) - opt_view_gen_raise0(i, GMSH_SET, str); + if(force || (str != gen_raise0)) opt_view_gen_raise0(i, GMSH_SET, str); str = o->view.input[5]->value(); - if(force || (str != gen_raise1)) - opt_view_gen_raise1(i, GMSH_SET, str); + if(force || (str != gen_raise1)) opt_view_gen_raise1(i, GMSH_SET, str); str = o->view.input[6]->value(); - if(force || (str != gen_raise2)) - opt_view_gen_raise2(i, GMSH_SET, str); + if(force || (str != gen_raise2)) opt_view_gen_raise2(i, GMSH_SET, str); // colors (since the color buttons modify the values directly // through callbacks, we can use the opt_XXX routines directly) - if(force || (i != current)){ - opt_view_color_points - (i, GMSH_SET, opt_view_color_points(current, GMSH_GET, 0)); - opt_view_color_lines - (i, GMSH_SET, opt_view_color_lines(current, GMSH_GET, 0)); - opt_view_color_triangles - (i, GMSH_SET, opt_view_color_triangles(current, GMSH_GET, 0)); - opt_view_color_quadrangles - (i, GMSH_SET, opt_view_color_quadrangles(current, GMSH_GET, 0)); - opt_view_color_tetrahedra - (i, GMSH_SET, opt_view_color_tetrahedra(current, GMSH_GET, 0)); - opt_view_color_hexahedra - (i, GMSH_SET, opt_view_color_hexahedra(current, GMSH_GET, 0)); - opt_view_color_prisms - (i, GMSH_SET, opt_view_color_prisms(current, GMSH_GET, 0)); - opt_view_color_pyramids - (i, GMSH_SET, opt_view_color_pyramids(current, GMSH_GET, 0)); - opt_view_color_tangents - (i, GMSH_SET, opt_view_color_tangents(current, GMSH_GET, 0)); - opt_view_color_normals - (i, GMSH_SET, opt_view_color_normals(current, GMSH_GET, 0)); - opt_view_color_text2d - (i, GMSH_SET, opt_view_color_text2d(current, GMSH_GET, 0)); - opt_view_color_text3d - (i, GMSH_SET, opt_view_color_text3d(current, GMSH_GET, 0)); - opt_view_color_axes - (i, GMSH_SET, opt_view_color_axes(current, GMSH_GET, 0)); + if(force || (i != current)) { + opt_view_color_points(i, GMSH_SET, + opt_view_color_points(current, GMSH_GET, 0)); + opt_view_color_lines(i, GMSH_SET, + opt_view_color_lines(current, GMSH_GET, 0)); + opt_view_color_triangles( + i, GMSH_SET, opt_view_color_triangles(current, GMSH_GET, 0)); + opt_view_color_quadrangles( + i, GMSH_SET, opt_view_color_quadrangles(current, GMSH_GET, 0)); + opt_view_color_tetrahedra( + i, GMSH_SET, opt_view_color_tetrahedra(current, GMSH_GET, 0)); + opt_view_color_hexahedra( + i, GMSH_SET, opt_view_color_hexahedra(current, GMSH_GET, 0)); + opt_view_color_prisms(i, GMSH_SET, + opt_view_color_prisms(current, GMSH_GET, 0)); + opt_view_color_pyramids(i, GMSH_SET, + opt_view_color_pyramids(current, GMSH_GET, 0)); + opt_view_color_tangents(i, GMSH_SET, + opt_view_color_tangents(current, GMSH_GET, 0)); + opt_view_color_normals(i, GMSH_SET, + opt_view_color_normals(current, GMSH_GET, 0)); + opt_view_color_text2d(i, GMSH_SET, + opt_view_color_text2d(current, GMSH_GET, 0)); + opt_view_color_text3d(i, GMSH_SET, + opt_view_color_text3d(current, GMSH_GET, 0)); + opt_view_color_axes(i, GMSH_SET, + opt_view_color_axes(current, GMSH_GET, 0)); } // colorbar window @@ -1329,7 +1268,7 @@ static void view_options_ok_cb(Fl_Widget *w, void *data) static void view_options_max_recursion_cb(Fl_Widget *w, void *data) { - std::string str((const char*)data); + std::string str((const char *)data); int val = (int)FlGui::instance()->options->view.value[33]->value(); if(str == "-" && val > 0) FlGui::instance()->options->view.value[33]->value(val - 1); @@ -1346,8 +1285,8 @@ optionWindow::optionWindow(int deltaFontSize) int height = 12 * BH + 4 * WB; int L = 7 * FL_NORMAL_SIZE; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false); win->box(GMSH_WINDOW_BOX); win->label("Options - General"); @@ -1355,7 +1294,8 @@ optionWindow::optionWindow(int deltaFontSize) browser = new Fl_Multi_Browser(0, 0, L, height); browser->box(GMSH_SIMPLE_RIGHT_BOX); browser->has_scrollbar(Fl_Browser_::VERTICAL); - browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars browser->add("General"); browser->add("Geometry"); browser->add("Mesh"); @@ -1364,8 +1304,7 @@ optionWindow::optionWindow(int deltaFontSize) browser->callback(options_browser_cb); browser->value(1); - redraw = new Fl_Return_Button - (WB, height - BH - WB, L - WB, BH, "Redraw"); + redraw = new Fl_Return_Button(WB, height - BH - WB, L - WB, BH, "Redraw"); redraw->callback(redraw_cb); width -= L; @@ -1376,139 +1315,150 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); - general.butt[10] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable expert mode"); + general.butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, + BH, "Enable expert mode"); general.butt[10]->type(FL_TOGGLE_BUTTON); general.butt[10]->callback(general_options_ok_cb); - general.butt[21] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Use dark interface"); + general.butt[21] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, + BH, "Use dark interface"); general.butt[21]->type(FL_TOGGLE_BUTTON); general.butt[21]->callback(general_options_ok_cb); - general.butt[13] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Show tooltips"); + general.butt[13] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, + BH, "Show tooltips"); general.butt[13]->type(FL_TOGGLE_BUTTON); general.butt[13]->callback(general_options_ok_cb); - general.butt[6] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Show bounding boxes"); + general.butt[6] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Show bounding boxes"); general.butt[6]->tooltip("(Alt+b)"); general.butt[6]->type(FL_TOGGLE_BUTTON); general.butt[6]->callback(general_options_ok_cb); - general.butt[2] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, - "Draw simplified model during user interaction"); + general.butt[2] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Draw simplified model during user interaction"); general.butt[2]->tooltip("(Alt+f)"); general.butt[2]->type(FL_TOGGLE_BUTTON); - general.butt[2]->callback(general_options_ok_cb, (void*)"fast_redraw"); + general.butt[2]->callback(general_options_ok_cb, (void *)"fast_redraw"); - general.butt[11] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Enable mouse hover over meshes and views"); + general.butt[11] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Enable mouse hover over meshes and views"); general.butt[11]->type(FL_TOGGLE_BUTTON); general.butt[11]->callback(general_options_ok_cb); - general.butt[3] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Enable double buffering"); + general.butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, + "Enable double buffering"); general.butt[3]->type(FL_TOGGLE_BUTTON); general.butt[3]->callback(general_options_ok_cb); - general.butt[12] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Enable antialiasing"); + general.butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 8 * BH, BW, + BH, "Enable antialiasing"); general.butt[12]->type(FL_TOGGLE_BUTTON); general.butt[12]->callback(general_options_ok_cb); - general.butt[5] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 9 * BH, BW, BH, - "Use trackball rotation instead of Euler angles"); + general.butt[5] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 9 * BH, BW, BH, + "Use trackball rotation instead of Euler angles"); general.butt[5]->type(FL_TOGGLE_BUTTON); general.butt[5]->callback(general_options_ok_cb); - general.butt[15] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 10 * BH, BW, BH, "Rotate around pseudo center of mass"); + general.butt[15] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 10 * BH, BW, BH, + "Rotate around pseudo center of mass"); general.butt[15]->type(FL_TOGGLE_BUTTON); - general.butt[15]->callback(general_options_ok_cb, (void*)"rotation_center"); + general.butt[15]->callback(general_options_ok_cb, + (void *)"rotation_center"); - general.push[0] = new Fl_Button - (L + 2 * IW - 2 * WB, 2 * WB + 11 * BH, BB, BH, "Select"); + general.push[0] = + new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 11 * BH, BB, BH, "Select"); general.push[0]->callback(general_options_rotation_center_select_cb); - general.value[8] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 11 * BH, IW / 3, BH); - general.value[8]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); - general.value[9] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 11 * BH, IW / 3, BH); - general.value[9]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); - general.value[10] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 11 * BH, IW / 3, BH, "Rotation center"); + general.value[8] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 11 * BH, IW / 3, BH); + general.value[8]->callback(general_options_ok_cb, + (void *)"rotation_center_coord"); + general.value[9] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 11 * BH, IW / 3, BH); + general.value[9]->callback(general_options_ok_cb, + (void *)"rotation_center_coord"); + general.value[10] = + new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 11 * BH, IW / 3, + BH, "Rotation center"); general.value[10]->align(FL_ALIGN_RIGHT); - general.value[10]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); + general.value[10]->callback(general_options_ok_cb, + (void *)"rotation_center_coord"); o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Advanced"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Advanced"); - general.butt[7] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Print messages on terminal"); + general.butt[7] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Print messages on terminal"); general.butt[7]->type(FL_TOGGLE_BUTTON); general.butt[7]->callback(general_options_ok_cb); - general.value[5] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Message verbosity"); + general.value[5] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, + "Message verbosity"); general.value[5]->minimum(0); general.value[5]->maximum(10); general.value[5]->step(1); general.value[5]->align(FL_ALIGN_RIGHT); general.value[5]->callback(general_options_ok_cb); - general.input[1] = new Fl_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Text editor command"); + general.input[1] = new Fl_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, + "Text editor command"); general.input[1]->align(FL_ALIGN_RIGHT); general.input[1]->callback(general_options_ok_cb); - general.input[0] = new Fl_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Default file name"); + general.input[0] = + new Fl_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Default file name"); general.input[0]->align(FL_ALIGN_RIGHT); general.input[0]->callback(general_options_ok_cb); - general.butt[14] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Ask confirmation before overwriting files"); + general.butt[14] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Ask confirmation before overwriting files"); general.butt[14]->type(FL_TOGGLE_BUTTON); general.butt[14]->callback(general_options_ok_cb); - general.butt[8] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Save session information on exit"); + general.butt[8] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Save session information on exit"); general.butt[8]->type(FL_TOGGLE_BUTTON); general.butt[8]->callback(general_options_ok_cb); - Fl_Button *b0 = new Fl_Button - (L + width - 2 * WB - BW/3, 2 * WB + 6 * BH, BW/3, BH, "Show file path"); - b0->callback(options_show_file_cb, (void*)"session"); + Fl_Button *b0 = + new Fl_Button(L + width - 2 * WB - BW / 3, 2 * WB + 6 * BH, BW / 3, BH, + "Show file path"); + b0->callback(options_show_file_cb, (void *)"session"); - general.butt[9] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 7 * BH, BW/2-WB, BH, "Save options on exit"); + general.butt[9] = new Fl_Check_Button( + L + 2 * WB, 2 * WB + 7 * BH, BW / 2 - WB, BH, "Save options on exit"); general.butt[9]->type(FL_TOGGLE_BUTTON); general.butt[9]->callback(general_options_ok_cb); #if defined(HAVE_VISUDEV) - general.butt[22] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 8 * BH, BW/2-WB, BH, "Enable heavy visualization capabilities"); + general.butt[22] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 8 * BH, BW / 2 - WB, BH, + "Enable heavy visualization capabilities"); general.butt[22]->type(FL_TOGGLE_BUTTON); general.butt[22]->callback(general_options_ok_cb); #endif - Fl_Button *b1 = new Fl_Button - (L + width - 2 * WB - BW/3, 2 * WB + 7 * BH, BW/3, BH, "Show file path"); - b1->callback(options_show_file_cb, (void*)"option"); + Fl_Button *b1 = + new Fl_Button(L + width - 2 * WB - BW / 3, 2 * WB + 7 * BH, BW / 3, BH, + "Show file path"); + b1->callback(options_show_file_cb, (void *)"option"); - Fl_Button *b2 = new Fl_Button - (L + 2 * WB, 2 * WB + 10 * BH, BW, BH, "Restore all options to default settings"); + Fl_Button *b2 = new Fl_Button(L + 2 * WB, 2 * WB + 10 * BH, BW, BH, + "Restore all options to default settings"); b2->callback(options_restore_defaults_cb); if(CTX::instance()->guiColorScheme) b2->color(FL_DARK_RED); @@ -1518,106 +1468,108 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Axes"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Axes"); - general.choice[4] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axes mode"); + general.choice[4] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axes mode"); general.choice[4]->menu(menu_axes_mode); general.choice[4]->align(FL_ALIGN_RIGHT); general.choice[4]->tooltip("(Alt+a)"); - general.choice[4]->callback(general_options_ok_cb, (void*)"general_axes"); + general.choice[4]->callback(general_options_ok_cb, + (void *)"general_axes"); - general.butt[16] = new Fl_Check_Button - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 1 * BH, (int)(0.85*IW), BH, - "Mikado style"); + general.butt[16] = new Fl_Check_Button( + L + width - (int)(0.85 * IW) - 2 * WB, 2 * WB + 1 * BH, + (int)(0.85 * IW), BH, "Mikado style"); general.butt[16]->type(FL_TOGGLE_BUTTON); general.butt[16]->callback(general_options_ok_cb); - general.value[17] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW / 3, BH); + general.value[17] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW / 3, BH); general.value[17]->minimum(0.); general.value[17]->step(1); general.value[17]->maximum(100); general.value[17]->callback(general_options_ok_cb); - general.value[18] = new Fl_Value_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 2 * BH, IW / 3, BH); + general.value[18] = new Fl_Value_Input(L + 2 * WB + 1 * IW / 3, + 2 * WB + 2 * BH, IW / 3, BH); general.value[18]->minimum(0.); general.value[18]->step(1); general.value[18]->maximum(100); general.value[18]->callback(general_options_ok_cb); - general.value[19] = new Fl_Value_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 2 * BH, IW / 3, BH, "Axes tics"); + general.value[19] = new Fl_Value_Input( + L + 2 * WB + 2 * IW / 3, 2 * WB + 2 * BH, IW / 3, BH, "Axes tics"); general.value[19]->minimum(0.); general.value[19]->step(1); general.value[19]->maximum(100); general.value[19]->align(FL_ALIGN_RIGHT); general.value[19]->callback(general_options_ok_cb); - general.input[3] = new Fl_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW/3, BH); + general.input[3] = new Fl_Input(L + 2 * WB, 2 * WB + 3 * BH, IW / 3, BH); general.input[3]->callback(general_options_ok_cb); - general.input[4] = new Fl_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 3 * BH, IW/3, BH); + general.input[4] = + new Fl_Input(L + 2 * WB + 1 * IW / 3, 2 * WB + 3 * BH, IW / 3, BH); general.input[4]->callback(general_options_ok_cb); - general.input[5] = new Fl_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 3 * BH, IW/3, BH, "Axes format"); + general.input[5] = new Fl_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 3 * BH, + IW / 3, BH, "Axes format"); general.input[5]->align(FL_ALIGN_RIGHT); general.input[5]->callback(general_options_ok_cb); - general.input[6] = new Fl_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW/3, BH); + general.input[6] = new Fl_Input(L + 2 * WB, 2 * WB + 4 * BH, IW / 3, BH); general.input[6]->callback(general_options_ok_cb); - general.input[7] = new Fl_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 4 * BH, IW/3, BH); + general.input[7] = + new Fl_Input(L + 2 * WB + 1 * IW / 3, 2 * WB + 4 * BH, IW / 3, BH); general.input[7]->callback(general_options_ok_cb); - general.input[8] = new Fl_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 4 * BH, IW/3, BH, "Axes labels"); + general.input[8] = new Fl_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 4 * BH, + IW / 3, BH, "Axes labels"); general.input[8]->align(FL_ALIGN_RIGHT); general.input[8]->callback(general_options_ok_cb); - general.butt[0] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, - "Set position and size of axes automatically"); + general.butt[0] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Set position and size of axes automatically"); general.butt[0]->type(FL_TOGGLE_BUTTON); - general.butt[0]->callback(general_options_ok_cb, (void*)"general_axes_auto"); + general.butt[0]->callback(general_options_ok_cb, + (void *)"general_axes_auto"); - general.value[20] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW / 3, BH); + general.value[20] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW / 3, BH); general.value[20]->callback(general_options_ok_cb); - general.value[21] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 6 * BH, IW / 3, BH); + general.value[21] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 6 * BH, IW / 3, BH); general.value[21]->callback(general_options_ok_cb); - general.value[22] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 6 * BH, IW / 3, BH, "Axes minimum"); + general.value[22] = new Fl_Value_Input( + L + 2 * WB + 2 * IW / 3, 2 * WB + 6 * BH, IW / 3, BH, "Axes minimum"); general.value[22]->align(FL_ALIGN_RIGHT); general.value[22]->callback(general_options_ok_cb); - general.value[23] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 7 * BH, IW / 3, BH); + general.value[23] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW / 3, BH); general.value[23]->callback(general_options_ok_cb); - general.value[24] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 7 * BH, IW / 3, BH); + general.value[24] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 7 * BH, IW / 3, BH); general.value[24]->callback(general_options_ok_cb); - general.value[25] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 7 * BH, IW / 3, BH, "Axes maximum"); + general.value[25] = new Fl_Value_Input( + L + 2 * WB + 2 * IW / 3, 2 * WB + 7 * BH, IW / 3, BH, "Axes maximum"); general.value[25]->align(FL_ALIGN_RIGHT); general.value[25]->callback(general_options_ok_cb); - general.butt[1] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Show small axes"); + general.butt[1] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 8 * BH, BW, BH, + "Show small axes"); general.butt[1]->tooltip("(Alt+Shift+a)"); general.butt[1]->type(FL_TOGGLE_BUTTON); - general.butt[1]->callback(general_options_ok_cb, (void*)"general_small_axes"); + general.butt[1]->callback(general_options_ok_cb, + (void *)"general_small_axes"); - general.value[26] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 9 * BH, IW / 2, BH); + general.value[26] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 9 * BH, IW / 2, BH); general.value[26]->minimum(-2000); general.value[26]->maximum(2000); general.value[26]->step(1); general.value[26]->callback(general_options_ok_cb); - general.value[27] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 9 * BH, IW / 2, BH, "Small axes position"); + general.value[27] = + new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 9 * BH, IW / 2, BH, + "Small axes position"); general.value[27]->align(FL_ALIGN_RIGHT); general.value[27]->minimum(-2000); general.value[27]->maximum(2000); @@ -1627,104 +1579,99 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Aspect"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Aspect"); o->hide(); static Fl_Menu_Item menu_projection[] = { - {"Orthographic", 0, 0, 0}, - {"Perspective", 0, 0, 0}, - {0} - }; - general.choice[2] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Projection mode"); + {"Orthographic", 0, 0, 0}, {"Perspective", 0, 0, 0}, {0}}; + general.choice[2] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Projection mode"); general.choice[2]->menu(menu_projection); general.choice[2]->align(FL_ALIGN_RIGHT); general.choice[2]->tooltip("(Alt+o)"); general.choice[2]->callback(general_options_ok_cb); - general.value[14] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Z-clipping distance factor"); + general.value[14] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, + BH, "Z-clipping distance factor"); general.value[14]->minimum(0.1); general.value[14]->maximum(20.); general.value[14]->step(0.1); general.value[14]->align(FL_ALIGN_RIGHT); general.value[14]->callback(general_options_ok_cb); - general.value[15] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW/2, BH); + general.value[15] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW / 2, BH); general.value[15]->minimum(0.); general.value[15]->maximum(10.); general.value[15]->step(0.01); general.value[15]->align(FL_ALIGN_RIGHT); general.value[15]->callback(general_options_ok_cb); - general.value[16] = new Fl_Value_Input - (L + 2 * WB + IW/2, 2 * WB + 3 * BH, IW/2, BH, "Polygon offset factor/units"); + general.value[16] = + new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 3 * BH, IW / 2, BH, + "Polygon offset factor/units"); general.value[16]->minimum(0.); general.value[16]->maximum(10.); general.value[16]->step(0.01); general.value[16]->align(FL_ALIGN_RIGHT); general.value[16]->callback(general_options_ok_cb); - general.butt[4] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Always apply polygon offset"); + general.butt[4] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Always apply polygon offset"); general.butt[4]->type(FL_TOGGLE_BUTTON); general.butt[4]->callback(general_options_ok_cb); - general.value[11] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadric subdivisions"); + general.value[11] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, + BH, "Quadric subdivisions"); general.value[11]->minimum(3); general.value[11]->maximum(30); general.value[11]->step(1); general.value[11]->align(FL_ALIGN_RIGHT); general.value[11]->callback(general_options_ok_cb); - general.value[6] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Point size"); + general.value[6] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Point size"); general.value[6]->minimum(0.1); general.value[6]->maximum(50); general.value[6]->step(0.1); general.value[6]->align(FL_ALIGN_RIGHT); general.value[6]->callback(general_options_ok_cb); - general.value[7] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Line width"); + general.value[7] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Line width"); general.value[7]->minimum(0.1); general.value[7]->maximum(50); general.value[7]->step(0.1); general.value[7]->align(FL_ALIGN_RIGHT); general.value[7]->callback(general_options_ok_cb); - static Fl_Menu_Item menu_genvectype[] = { - {"Line", 0, 0, 0}, - {"Arrow", 0, 0, 0}, - {"Pyramid", 0, 0, 0}, - {"3D arrow", 0, 0, 0}, - {0} - }; - general.choice[0] = new Fl_Choice - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Vector display"); + static Fl_Menu_Item menu_genvectype[] = {{"Line", 0, 0, 0}, + {"Arrow", 0, 0, 0}, + {"Pyramid", 0, 0, 0}, + {"3D arrow", 0, 0, 0}, + {0}}; + general.choice[0] = + new Fl_Choice(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Vector display"); general.choice[0]->menu(menu_genvectype); general.choice[0]->align(FL_ALIGN_RIGHT); general.choice[0]->callback(general_options_ok_cb); - Fl_Button *b = new Fl_Button - (L + 2 * IW - 2 * WB, 2 * WB + 8 * BH, BB, BH, "Edit arrow"); + Fl_Button *b = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 8 * BH, BB, BH, + "Edit arrow"); b->callback(general_arrow_param_cb); - static Fl_Menu_Item menu_font_engine[] = { - {"Native", 0, 0, 0}, - {"Cairo", 0, 0, 0 + static Fl_Menu_Item menu_font_engine[] = {{"Native", 0, 0, 0}, + {"Cairo", 0, 0, 0 #if !defined(HAVE_CAIRO) - , FL_MENU_INACTIVE + , + FL_MENU_INACTIVE #endif - }, - {"StringTexture", 0, 0, 0}, - {0} - }; - general.choice[7] = new Fl_Choice - (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Font rendering engine"); + }, + {"StringTexture", 0, 0, 0}, + {0}}; + general.choice[7] = new Fl_Choice(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, + "Font rendering engine"); general.choice[7]->menu(menu_font_engine); general.choice[7]->align(FL_ALIGN_RIGHT); general.choice[7]->callback(general_options_ok_cb); @@ -1734,8 +1681,8 @@ optionWindow::optionWindow(int deltaFontSize) general.choice[1]->menu(menu_font_names); general.choice[1]->align(FL_ALIGN_RIGHT); general.choice[1]->callback(general_options_ok_cb); - general.value[12] = new Fl_Value_Input - (L + 2 * WB + w1, 2 * WB + 10 * BH, w2, BH, "Default font"); + general.value[12] = new Fl_Value_Input(L + 2 * WB + w1, 2 * WB + 10 * BH, + w2, BH, "Default font"); general.value[12]->minimum(5); general.value[12]->maximum(40); general.value[12]->step(1); @@ -1746,8 +1693,8 @@ optionWindow::optionWindow(int deltaFontSize) general.choice[6]->menu(menu_font_names); general.choice[6]->align(FL_ALIGN_RIGHT); general.choice[6]->callback(general_options_ok_cb); - general.value[28] = new Fl_Value_Input - (L + 2 * WB + w1, 2 * WB + 11 * BH, w2, BH, "Title font"); + general.value[28] = new Fl_Value_Input(L + 2 * WB + w1, 2 * WB + 11 * BH, + w2, BH, "Title font"); general.value[28]->minimum(5); general.value[28]->maximum(40); general.value[28]->step(1); @@ -1757,95 +1704,94 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Color"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Color"); o->hide(); - general.value[2] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW/3, BH); + general.value[2] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW / 3, BH); general.value[2]->minimum(-1.); general.value[2]->maximum(1.); general.value[2]->step(0.01); - general.value[2]->callback(general_options_ok_cb, (void*)"light_value"); + general.value[2]->callback(general_options_ok_cb, (void *)"light_value"); - general.value[3] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 1 * BH, IW/3, BH); + general.value[3] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 1 * BH, IW / 3, BH); general.value[3]->minimum(-1.); general.value[3]->maximum(1.); general.value[3]->step(0.01); - general.value[3]->callback(general_options_ok_cb, (void*)"light_value"); + general.value[3]->callback(general_options_ok_cb, (void *)"light_value"); - general.value[4] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 1 * BH, IW/3, BH, "Light position"); + general.value[4] = new Fl_Value_Input( + L + 2 * WB + 2 * IW / 3, 2 * WB + 1 * BH, IW / 3, BH, "Light position"); general.value[4]->minimum(-1.); general.value[4]->maximum(1.); general.value[4]->step(0.01); general.value[4]->align(FL_ALIGN_RIGHT); - general.value[4]->callback(general_options_ok_cb, (void*)"light_value"); + general.value[4]->callback(general_options_ok_cb, (void *)"light_value"); - general.value[13] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Light position divisor"); + general.value[13] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, + BH, "Light position divisor"); general.value[13]->minimum(0.); general.value[13]->maximum(1.); general.value[13]->step(0.01); general.value[13]->align(FL_ALIGN_RIGHT); general.value[13]->callback(general_options_ok_cb); - general.sphere = new spherePositionWidget - (L + width - 2 * BH - 2 * WB, 2 * WB + 1 * BH, 2 * BH); - general.sphere->callback(general_options_ok_cb, (void*)"light_sphere"); + general.sphere = new spherePositionWidget(L + width - 2 * BH - 2 * WB, + 2 * WB + 1 * BH, 2 * BH); + general.sphere->callback(general_options_ok_cb, (void *)"light_sphere"); - general.value[1] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW/2, BH); + general.value[1] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW / 2, BH); general.value[1]->minimum(0); general.value[1]->maximum(10); general.value[1]->step(0.1); general.value[1]->callback(general_options_ok_cb); - general.value[0] = new Fl_Value_Input - (L + 2 * WB + IW/2, 2 * WB + 3 * BH, IW/2, BH, "Material shininess/exponent"); + general.value[0] = + new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 3 * BH, IW / 2, BH, + "Material shininess/exponent"); general.value[0]->minimum(0); general.value[0]->maximum(128); general.value[0]->step(1); general.value[0]->align(FL_ALIGN_RIGHT); general.value[0]->callback(general_options_ok_cb); - static Fl_Menu_Item menu_color_scheme[] = { - {"Dark", 0, 0, 0}, - {"Light", 0, 0, 0}, - {"Grayscale", 0, 0, 0}, - {"Reverse", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item menu_color_scheme[] = {{"Dark", 0, 0, 0}, + {"Light", 0, 0, 0}, + {"Grayscale", 0, 0, 0}, + {"Reverse", 0, 0, 0}, + {0}}; - general.choice[3] = new Fl_Choice - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Predefined color scheme"); + general.choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, + "Predefined color scheme"); general.choice[3]->menu(menu_color_scheme); general.choice[3]->align(FL_ALIGN_RIGHT); general.choice[3]->tooltip("(Alt+c)"); general.choice[3]->callback(general_options_color_scheme_cb); - static Fl_Menu_Item menu_bg_grad[] = { - {"None", 0, 0, 0}, - {"Vertical", 0, 0, 0}, - {"Horizontal", 0, 0, 0}, - {"Radial", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item menu_bg_grad[] = {{"None", 0, 0, 0}, + {"Vertical", 0, 0, 0}, + {"Horizontal", 0, 0, 0}, + {"Radial", 0, 0, 0}, + {0}}; - general.choice[5] = new Fl_Choice - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Background gradient"); + general.choice[5] = new Fl_Choice(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "Background gradient"); general.choice[5]->menu(menu_bg_grad); general.choice[5]->align(FL_ALIGN_RIGHT); general.choice[5]->callback(general_options_ok_cb); - Fl_Scroll *s = new Fl_Scroll - (L + 2 * WB, 3 * WB + 6 * BH, IW + 20, height - 5 * WB - 6 * BH); + Fl_Scroll *s = new Fl_Scroll(L + 2 * WB, 3 * WB + 6 * BH, IW + 20, + height - 5 * WB - 6 * BH); int i = 0; while(GeneralOptions_Color[i].str) { - general.color[i] = new Fl_Button - (L + 2 * WB, 3 * WB + (6 + i) * BH, IW, BH, GeneralOptions_Color[i].str); - general.color[i]->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); - general.color[i]->callback(color_cb, (void *)GeneralOptions_Color[i].function); + general.color[i] = new Fl_Button(L + 2 * WB, 3 * WB + (6 + i) * BH, IW, + BH, GeneralOptions_Color[i].str); + general.color[i]->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | + FL_ALIGN_CLIP); + general.color[i]->callback(color_cb, + (void *)GeneralOptions_Color[i].function); i++; } s->end(); @@ -1853,24 +1799,26 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Camera"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Camera"); o->hide(); - general.butt[18] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable camera (experimental)"); + general.butt[18] = new Fl_Check_Button( + L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable camera (experimental)"); general.butt[18]->type(FL_TOGGLE_BUTTON); general.butt[18]->value(opt_general_camera_mode(0, GMSH_GET, 0)); - general.butt[18]->callback(general_options_ok_cb, (void*)"general_camera"); + general.butt[18]->callback(general_options_ok_cb, + (void *)"general_camera"); - general.butt[17] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Enable stereo rendering (experimental)"); + general.butt[17] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, + "Enable stereo rendering (experimental)"); general.butt[17]->type(FL_TOGGLE_BUTTON); general.butt[17]->value(opt_general_stereo_mode(0, GMSH_GET, 0)); general.butt[17]->callback(general_options_ok_cb); - general.value[29] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Eye separation ratio (%)"); + general.value[29] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, + BH, "Eye separation ratio (%)"); general.value[29]->minimum(0.1); general.value[29]->maximum(10.); general.value[29]->step(.1); @@ -1878,8 +1826,8 @@ optionWindow::optionWindow(int deltaFontSize) general.value[29]->align(FL_ALIGN_RIGHT); general.value[29]->callback(general_options_ok_cb); - general.value[30] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Focal length ratio (%)"); + general.value[30] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, + BH, "Focal length ratio (%)"); general.value[30]->minimum(0.1); general.value[30]->maximum(10.); general.value[30]->step(.1); @@ -1887,8 +1835,8 @@ optionWindow::optionWindow(int deltaFontSize) general.value[30]->align(FL_ALIGN_RIGHT); general.value[30]->callback(general_options_ok_cb); - general.value[31] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Camera Aperture (degrees)"); + general.value[31] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, + BH, "Camera Aperture (degrees)"); general.value[31]->minimum(10.); general.value[31]->maximum(120.); general.value[31]->step(1); @@ -1896,32 +1844,32 @@ optionWindow::optionWindow(int deltaFontSize) general.value[31]->align(FL_ALIGN_RIGHT); general.value[31]->callback(general_options_ok_cb); - general.butt[19] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 7 * BH, BW, BH , "Enable gamepad (experimental)"); + general.butt[19] = new Fl_Check_Button( + L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Enable gamepad (experimental)"); general.butt[19]->type(FL_TOGGLE_BUTTON); general.butt[19]->value(opt_general_gamepad(0, GMSH_GET, 0)); - general.butt[19]->callback(general_options_ok_cb,(void*)"general_camera"); + general.butt[19]->callback(general_options_ok_cb, + (void *)"general_camera"); - general.gamepadconfig = new Fl_Button - (L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Configure Gamepad"); + general.gamepadconfig = + new Fl_Button(L + 2 * WB, 2 * WB + 8 * BH, BW, BH, "Configure Gamepad"); general.gamepadconfig->callback(general_gmpdcf_cb); - - if( opt_general_camera_mode(0, GMSH_GET, 0) == 0 ){ - general.value[30]->deactivate(); - general.value[31]->deactivate(); + if(opt_general_camera_mode(0, GMSH_GET, 0) == 0) { + general.value[30]->deactivate(); + general.value[31]->deactivate(); } - if( opt_general_stereo_mode(0, GMSH_GET, 0) == 0 ) - general.value[29]->deactivate(); + if(opt_general_stereo_mode(0, GMSH_GET, 0) == 0) + general.value[29]->deactivate(); - if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { - general.gamepadconfig->activate(); - opt_general_camera_mode(0, GMSH_SET, 1); - general.butt[18]->value(opt_general_camera_mode(0, GMSH_GET, 0)); + if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) { + general.gamepadconfig->activate(); + opt_general_camera_mode(0, GMSH_SET, 1); + general.butt[18]->value(opt_general_camera_mode(0, GMSH_GET, 0)); } - else{ - general.gamepadconfig->deactivate(); + else { + general.gamepadconfig->deactivate(); } o->end(); } @@ -1936,50 +1884,52 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); o->hide(); - geo.value[2] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Geometry tolerance"); + geo.value[2] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, + "Geometry tolerance"); geo.value[2]->align(FL_ALIGN_RIGHT); geo.value[2]->callback(geometry_options_ok_cb); - geo.butt[8] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Remove duplicate entities in GEO model transforms"); + geo.butt[8] = new Fl_Check_Button( + L + 2 * WB, 2 * WB + 2 * BH, BW, BH, + "Remove duplicate entities in GEO model transforms"); geo.butt[8]->type(FL_TOGGLE_BUTTON); geo.butt[8]->callback(geometry_options_ok_cb); - Fl_Box* b = new Fl_Box(L + 2 * WB, 2 * WB + 3 * BH, BW, 2); + Fl_Box *b = new Fl_Box(L + 2 * WB, 2 * WB + 3 * BH, BW, 2); b->box(FL_ENGRAVED_FRAME); b->labeltype(FL_NO_LABEL); - Fl_Box *b2 = new Fl_Box - (FL_NO_BOX, L + 2 * WB, 2 * WB + 3 * BH + 1, IW, BH, "Open CASCADE model healing options (experimental):"); - b2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); + Fl_Box *b2 = + new Fl_Box(FL_NO_BOX, L + 2 * WB, 2 * WB + 3 * BH + 1, IW, BH, + "Open CASCADE model healing options (experimental):"); + b2->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); - geo.butt[16] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Remove degenerated edges and faces"); + geo.butt[16] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Remove degenerated edges and faces"); geo.butt[16]->type(FL_TOGGLE_BUTTON); geo.butt[16]->callback(geometry_options_ok_cb); - geo.butt[11] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Remove small edges"); + geo.butt[11] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Remove small edges"); geo.butt[11]->type(FL_TOGGLE_BUTTON); geo.butt[11]->callback(geometry_options_ok_cb); - geo.butt[12] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Remove small faces"); + geo.butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Remove small faces"); geo.butt[12]->type(FL_TOGGLE_BUTTON); geo.butt[12]->callback(geometry_options_ok_cb); - geo.butt[13] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Sew faces"); + geo.butt[13] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Sew faces"); geo.butt[13]->type(FL_TOGGLE_BUTTON); geo.butt[13]->callback(geometry_options_ok_cb); - geo.value[20] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Global model scaling"); + geo.value[20] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, + "Global model scaling"); geo.value[20]->align(FL_ALIGN_RIGHT); geo.value[20]->callback(geometry_options_ok_cb); @@ -1994,67 +1944,65 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Visibility"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Visibility"); - geo.butt[0] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW / 2 - WB, BH, "Points"); + geo.butt[0] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, + BW / 2 - WB, BH, "Points"); geo.butt[0]->tooltip("(Alt+p)"); geo.butt[0]->type(FL_TOGGLE_BUTTON); geo.butt[0]->callback(geometry_options_ok_cb); - geo.butt[1] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW / 2 - WB, BH, "Curves"); + geo.butt[1] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, + BW / 2 - WB, BH, "Curves"); geo.butt[1]->tooltip("(Alt+l)"); geo.butt[1]->type(FL_TOGGLE_BUTTON); geo.butt[1]->callback(geometry_options_ok_cb); - geo.butt[2] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW / 2 - WB, BH, "Surfaces"); + geo.butt[2] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, + BW / 2 - WB, BH, "Surfaces"); geo.butt[2]->tooltip("(Alt+s)"); geo.butt[2]->type(FL_TOGGLE_BUTTON); geo.butt[2]->callback(geometry_options_ok_cb); - geo.butt[3] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW / 2 - WB, BH, "Volumes"); + geo.butt[3] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, + BW / 2 - WB, BH, "Volumes"); geo.butt[3]->tooltip("(Alt+v)"); geo.butt[3]->type(FL_TOGGLE_BUTTON); geo.butt[3]->callback(geometry_options_ok_cb); - geo.butt[4] = new Fl_Check_Button - (L + width / 2, 2 * WB + 1 * BH, BW / 2 - WB, BH, "Point labels"); + geo.butt[4] = new Fl_Check_Button(L + width / 2, 2 * WB + 1 * BH, + BW / 2 - WB, BH, "Point labels"); geo.butt[4]->type(FL_TOGGLE_BUTTON); geo.butt[4]->callback(geometry_options_ok_cb); - geo.butt[5] = new Fl_Check_Button - (L + width / 2, 2 * WB + 2 * BH, BW / 2 - WB, BH, "Curve labels"); + geo.butt[5] = new Fl_Check_Button(L + width / 2, 2 * WB + 2 * BH, + BW / 2 - WB, BH, "Curve labels"); geo.butt[5]->type(FL_TOGGLE_BUTTON); geo.butt[5]->callback(geometry_options_ok_cb); - geo.butt[6] = new Fl_Check_Button - (L + width / 2, 2 * WB + 3 * BH, BW / 2 - WB, BH, "Surface labels"); + geo.butt[6] = new Fl_Check_Button(L + width / 2, 2 * WB + 3 * BH, + BW / 2 - WB, BH, "Surface labels"); geo.butt[6]->type(FL_TOGGLE_BUTTON); geo.butt[6]->callback(geometry_options_ok_cb); - geo.butt[7] = new Fl_Check_Button - (L + width / 2, 2 * WB + 4 * BH, BW / 2 - WB, BH, "Volume labels"); + geo.butt[7] = new Fl_Check_Button(L + width / 2, 2 * WB + 4 * BH, + BW / 2 - WB, BH, "Volume labels"); geo.butt[7]->type(FL_TOGGLE_BUTTON); geo.butt[7]->callback(geometry_options_ok_cb); - static Fl_Menu_Item menu_label_type[] = { - {"Description", 0, 0, 0}, - {"Elementary tags", 0, 0, 0}, - {"Physical tags", 0, 0, 0}, - {0} - }; - geo.choice[4] = new Fl_Choice - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Label type"); + static Fl_Menu_Item menu_label_type[] = {{"Description", 0, 0, 0}, + {"Elementary tags", 0, 0, 0}, + {"Physical tags", 0, 0, 0}, + {0}}; + geo.choice[4] = + new Fl_Choice(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Label type"); geo.choice[4]->menu(menu_label_type); geo.choice[4]->align(FL_ALIGN_RIGHT); geo.choice[4]->callback(geometry_options_ok_cb); - geo.value[0] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW / 2, BH); + geo.value[0] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW / 2, BH); geo.value[0]->minimum(0); geo.value[0]->maximum(500); geo.value[0]->step(1); @@ -2062,8 +2010,8 @@ optionWindow::optionWindow(int deltaFontSize) geo.value[0]->when(FL_WHEN_RELEASE); geo.value[0]->callback(geometry_options_ok_cb); - geo.value[1] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 6 * BH, IW / 2, BH, "Normals and tangents"); + geo.value[1] = new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 6 * BH, + IW / 2, BH, "Normals and tangents"); geo.value[1]->minimum(0); geo.value[1]->maximum(500); geo.value[1]->step(1); @@ -2074,50 +2022,44 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfo"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Transfo"); o->hide(); static Fl_Menu_Item menu_transform[] = { - {"None", 0, 0, 0}, - {"Scaling", 0, 0, 0}, - {0} - }; - geo.choice[3] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Main window transform"); + {"None", 0, 0, 0}, {"Scaling", 0, 0, 0}, {0}}; + geo.choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, + "Main window transform"); geo.choice[3]->menu(menu_transform); geo.choice[3]->align(FL_ALIGN_RIGHT); - geo.choice[3]->callback(geometry_options_ok_cb, (void*)"geo_transform"); + geo.choice[3]->callback(geometry_options_ok_cb, (void *)"geo_transform"); int ss = 2 * IW / 3 / 3 + 4; - geo.value[7] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 2 * BH, ss, BH); - geo.value[8] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 2 * BH, ss, BH); - geo.value[9] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 2 * BH, ss, BH, " X"); - geo.value[10] = new Fl_Value_Input - (L + 2 * WB + IW , 2 * WB + 2 * BH, 7*IW/10, BH); - - geo.value[11] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 3 * BH, ss, BH); - geo.value[12] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 3 * BH, ss, BH); - geo.value[13] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 3 * BH, ss, BH, " Y +"); - geo.value[14] = new Fl_Value_Input - (L + 2 * WB + IW , 2 * WB + 3 * BH, 7*IW/10, BH); - - geo.value[15] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 4 * BH, ss, BH); - geo.value[16] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 4 * BH, ss, BH); - geo.value[17] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 4 * BH, ss, BH, " Z"); - geo.value[18] = new Fl_Value_Input - (L + 2 * WB + IW , 2 * WB + 4 * BH, 7*IW/10, BH); - - for(int i = 7; i <= 18; i++){ + geo.value[7] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, ss, BH); + geo.value[8] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 2 * BH, ss, BH); + geo.value[9] = + new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 2 * BH, ss, BH, " X"); + geo.value[10] = + new Fl_Value_Input(L + 2 * WB + IW, 2 * WB + 2 * BH, 7 * IW / 10, BH); + + geo.value[11] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, ss, BH); + geo.value[12] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 3 * BH, ss, BH); + geo.value[13] = new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 3 * BH, + ss, BH, " Y +"); + geo.value[14] = + new Fl_Value_Input(L + 2 * WB + IW, 2 * WB + 3 * BH, 7 * IW / 10, BH); + + geo.value[15] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, ss, BH); + geo.value[16] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 4 * BH, ss, BH); + geo.value[17] = + new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 4 * BH, ss, BH, " Z"); + geo.value[18] = + new Fl_Value_Input(L + 2 * WB + IW, 2 * WB + 4 * BH, 7 * IW / 10, BH); + + for(int i = 7; i <= 18; i++) { geo.value[i]->minimum(-1.); geo.value[i]->maximum(1.); geo.value[i]->step(0.1); @@ -2129,64 +2071,64 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Aspect"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Aspect"); o->hide(); - geo.choice[0] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Point display"); + geo.choice[0] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Point display"); geo.choice[0]->menu(menu_point_display); geo.choice[0]->align(FL_ALIGN_RIGHT); geo.choice[0]->callback(geometry_options_ok_cb); - geo.value[3] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point size"); + geo.value[3] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point size"); geo.value[3]->minimum(0.1); geo.value[3]->maximum(50); geo.value[3]->step(0.1); geo.value[3]->align(FL_ALIGN_RIGHT); geo.value[3]->callback(geometry_options_ok_cb); - geo.value[5] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Selected point size"); + geo.value[5] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, + "Selected point size"); geo.value[5]->minimum(0.1); geo.value[5]->maximum(50); geo.value[5]->step(0.1); geo.value[5]->align(FL_ALIGN_RIGHT); geo.value[5]->callback(geometry_options_ok_cb); - geo.choice[1] = new Fl_Choice - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Curve display"); + geo.choice[1] = + new Fl_Choice(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Curve display"); geo.choice[1]->menu(menu_line_display); geo.choice[1]->align(FL_ALIGN_RIGHT); geo.choice[1]->callback(geometry_options_ok_cb); - geo.value[4] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Curve width"); + geo.value[4] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Curve width"); geo.value[4]->minimum(0.1); geo.value[4]->maximum(50); geo.value[4]->step(0.1); geo.value[4]->align(FL_ALIGN_RIGHT); geo.value[4]->callback(geometry_options_ok_cb); - geo.value[6] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Selected curve width"); + geo.value[6] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, + "Selected curve width"); geo.value[6]->minimum(0.1); geo.value[6]->maximum(50); geo.value[6]->step(0.1); geo.value[6]->align(FL_ALIGN_RIGHT); geo.value[6]->callback(geometry_options_ok_cb); - geo.value[19] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Curve subdivisions"); + geo.value[19] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, + "Curve subdivisions"); geo.value[19]->minimum(1); geo.value[19]->maximum(50); geo.value[19]->step(1); geo.value[19]->align(FL_ALIGN_RIGHT); geo.value[19]->callback(geometry_options_ok_cb); - geo.choice[2] = new Fl_Choice - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Surface display"); + geo.choice[2] = + new Fl_Choice(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Surface display"); geo.choice[2]->menu(menu_surface_display); geo.choice[2]->align(FL_ALIGN_RIGHT); geo.choice[2]->callback(geometry_options_ok_cb); @@ -2195,33 +2137,34 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Color"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Color"); o->hide(); - geo.butt[9] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable lighting"); + geo.butt[9] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Enable lighting"); geo.butt[9]->type(FL_TOGGLE_BUTTON); geo.butt[9]->tooltip("(Alt+w)"); geo.butt[9]->callback(geometry_options_ok_cb); - geo.butt[14] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Use two-side lighting"); + geo.butt[14] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, + "Use two-side lighting"); geo.butt[14]->type(FL_TOGGLE_BUTTON); geo.butt[14]->callback(geometry_options_ok_cb); - geo.butt[10] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Highlight orphan entities"); + geo.butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Highlight orphan entities"); geo.butt[10]->type(FL_TOGGLE_BUTTON); geo.butt[10]->callback(geometry_options_ok_cb); - Fl_Scroll *s = new Fl_Scroll - (L + 2 * WB, 2 * WB + 4 * BH, IW + 20, height - 4 * WB - 4 * BH); + Fl_Scroll *s = new Fl_Scroll(L + 2 * WB, 2 * WB + 4 * BH, IW + 20, + height - 4 * WB - 4 * BH); int i = 0; while(GeometryOptions_Color[i].str) { - geo.color[i] = new Fl_Button - (L + 2 * WB, 2 * WB + (4 + i) * BH, IW, BH, GeometryOptions_Color[i].str); - geo.color[i]->callback(color_cb, (void *)GeometryOptions_Color[i].function); + geo.color[i] = new Fl_Button(L + 2 * WB, 2 * WB + (4 + i) * BH, IW, BH, + GeometryOptions_Color[i].str); + geo.color[i]->callback(color_cb, + (void *)GeometryOptions_Color[i].function); i++; } s->end(); @@ -2238,8 +2181,8 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); o->hide(); static Fl_Menu_Item menu_2d_algo[] = { @@ -2249,8 +2192,7 @@ optionWindow::optionWindow(int deltaFontSize) {"Frontal", 0, 0, 0}, {"Delaunay for quads (experimental)", 0, 0, 0}, {"Packing of parallelograms (experimental)", 0, 0, 0}, - {0} - }; + {0}}; static Fl_Menu_Item menu_3d_algo[] = { {"Delaunay", 0, 0, 0}, {"Frontal", 0, 0, 0}, @@ -2258,109 +2200,99 @@ optionWindow::optionWindow(int deltaFontSize) {"Frontal Hex (experimental)", 0, 0, 0}, {"MMG3D (experimental)", 0, 0, 0}, {"R-tree (experimental)", 0, 0, 0}, - {0} - }; + {0}}; static Fl_Menu_Item menu_recombination_algo[] = { - {"Standard", 0, 0, 0}, - {"Blossom", 0, 0, 0}, - {0} - }; + {"Standard", 0, 0, 0}, {"Blossom", 0, 0, 0}, {0}}; static Fl_Menu_Item menu_subdivision_algo[] = { - {"None", 0, 0, 0}, - {"All Quads", 0, 0, 0}, - {"All Hexas", 0, 0, 0}, - {0} - }; + {"None", 0, 0, 0}, {"All Quads", 0, 0, 0}, {"All Hexas", 0, 0, 0}, {0}}; static Fl_Menu_Item menu_remeshing_algo[] = { {"No split", 0, 0, 0}, {"Automatic", 0, 0, 0}, {"Automatic only with Metis", 0, 0, 0}, - {0} - }; - static Fl_Menu_Item menu_remeshing_param[] = { - {"Harmonic", 0, 0, 0}, - {"Conformal", 0, 0, 0}, - {"Rbf Harmonic", 0, 0, 0}, - {0} - }; - - mesh.choice[2] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "2D algorithm"); + {0}}; + static Fl_Menu_Item menu_remeshing_param[] = {{"Harmonic", 0, 0, 0}, + {"Conformal", 0, 0, 0}, + {"Rbf Harmonic", 0, 0, 0}, + {0}}; + + mesh.choice[2] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "2D algorithm"); mesh.choice[2]->menu(menu_2d_algo); mesh.choice[2]->align(FL_ALIGN_RIGHT); mesh.choice[2]->callback(mesh_options_ok_cb); - mesh.choice[3] = new Fl_Choice - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "3D algorithm"); + mesh.choice[3] = + new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "3D algorithm"); mesh.choice[3]->menu(menu_3d_algo); mesh.choice[3]->align(FL_ALIGN_RIGHT); mesh.choice[3]->callback(mesh_options_ok_cb); - mesh.choice[1] = new Fl_Choice - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "2D recombination algorithm"); + mesh.choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, + "2D recombination algorithm"); mesh.choice[1]->menu(menu_recombination_algo); mesh.choice[1]->align(FL_ALIGN_RIGHT); mesh.choice[1]->callback(mesh_options_ok_cb); - mesh.butt[21] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Recombine all triangular meshes"); + mesh.butt[21] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Recombine all triangular meshes"); mesh.butt[21]->type(FL_TOGGLE_BUTTON); mesh.butt[21]->callback(mesh_options_ok_cb); - mesh.choice[5] = new Fl_Choice - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Subdivision algorithm"); + mesh.choice[5] = new Fl_Choice(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "Subdivision algorithm"); mesh.choice[5]->menu(menu_subdivision_algo); mesh.choice[5]->align(FL_ALIGN_RIGHT); mesh.choice[5]->callback(mesh_options_ok_cb); - mesh.choice[8] = new Fl_Choice - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Remeshing algorithm"); + mesh.choice[8] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, + "Remeshing algorithm"); mesh.choice[8]->menu(menu_remeshing_algo); mesh.choice[8]->align(FL_ALIGN_RIGHT); mesh.choice[8]->callback(mesh_options_ok_cb); - mesh.choice[9] = new Fl_Choice - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Remeshing parametrization"); + mesh.choice[9] = new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, + "Remeshing parametrization"); mesh.choice[9]->menu(menu_remeshing_param); mesh.choice[9]->align(FL_ALIGN_RIGHT); mesh.choice[9]->callback(mesh_options_ok_cb); - mesh.value[0] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Smoothing steps"); + mesh.value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, + "Smoothing steps"); mesh.value[0]->minimum(0); mesh.value[0]->maximum(100); mesh.value[0]->step(1); mesh.value[0]->align(FL_ALIGN_RIGHT); mesh.value[0]->callback(mesh_options_ok_cb); - mesh.value[2] = new inputValueFloat - (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Element size factor"); + mesh.value[2] = new inputValueFloat(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, + "Element size factor"); mesh.value[2]->minimum(0.001); mesh.value[2]->maximum(1000); mesh.value[2]->step(0.01); mesh.value[2]->align(FL_ALIGN_RIGHT); mesh.value[2]->callback(mesh_options_ok_cb); - mesh.value[25] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 10 * BH, IW/2, BH); + mesh.value[25] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW / 2, BH); mesh.value[25]->align(FL_ALIGN_RIGHT); mesh.value[25]->callback(mesh_options_ok_cb); - mesh.value[26] = new Fl_Value_Input - (L + 2 * WB + IW/2, 2 * WB + 10 * BH, IW/2, BH, "Min/Max element size"); + mesh.value[26] = new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 10 * BH, + IW / 2, BH, "Min/Max element size"); mesh.value[26]->align(FL_ALIGN_RIGHT); mesh.value[26]->callback(mesh_options_ok_cb); - mesh.value[3] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 11 * BH, IW / 3, BH, "Element order"); + mesh.value[3] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 11 * BH, IW / 3, + BH, "Element order"); mesh.value[3]->minimum(1); mesh.value[3]->maximum(2); mesh.value[3]->step(1); mesh.value[3]->align(FL_ALIGN_RIGHT); mesh.value[3]->callback(mesh_options_ok_cb); - mesh.butt[4] = new Fl_Check_Button - (L + 2 * WB + 1.25 * IW, 2 * WB + 11 * BH, BW, BH, "Use incomplete elements"); + mesh.butt[4] = + new Fl_Check_Button(L + 2 * WB + 1.25 * IW, 2 * WB + 11 * BH, BW, BH, + "Use incomplete elements"); mesh.butt[4]->type(FL_TOGGLE_BUTTON); mesh.butt[4]->callback(mesh_options_ok_cb); @@ -2368,45 +2300,50 @@ optionWindow::optionWindow(int deltaFontSize) } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Advanced"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Advanced"); o->hide(); - mesh.butt[5] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Compute element sizes using point values"); + mesh.butt[5] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Compute element sizes using point values"); mesh.butt[5]->type(FL_TOGGLE_BUTTON); mesh.butt[5]->callback(mesh_options_ok_cb); - mesh.butt[1] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Compute element sizes from curvature (experimental)" ); + mesh.butt[1] = new Fl_Check_Button( + L + 2 * WB, 2 * WB + 2 * BH, BW, BH, + "Compute element sizes from curvature (experimental)"); mesh.butt[1]->type(FL_TOGGLE_BUTTON); mesh.butt[1]->callback(mesh_options_ok_cb); - mesh.butt[16] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Extend element sizes from boundary"); + mesh.butt[16] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Extend element sizes from boundary"); mesh.butt[16]->type(FL_TOGGLE_BUTTON); mesh.butt[16]->callback(mesh_options_ok_cb); - mesh.butt[2] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Optimize quality of tetrahedra"); + mesh.butt[2] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Optimize quality of tetrahedra"); mesh.butt[2]->type(FL_TOGGLE_BUTTON); mesh.butt[2]->callback(mesh_options_ok_cb); - mesh.butt[24] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Optimize quality of tetrahedra with Netgen"); + mesh.butt[24] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Optimize quality of tetrahedra with Netgen"); mesh.butt[24]->type(FL_TOGGLE_BUTTON); #if !defined(HAVE_NETGEN) mesh.butt[24]->deactivate(); #endif mesh.butt[24]->callback(mesh_options_ok_cb); - mesh.butt[3] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Optimize high order meshes (experimental)"); + mesh.butt[3] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Optimize high order meshes (experimental)"); mesh.butt[3]->type(FL_TOGGLE_BUTTON); mesh.butt[3]->callback(mesh_options_ok_cb); - mesh.butt[22] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 7 * BH, BW, BH, "Recombine tets into hex-dom mesh (experimental)"); + mesh.butt[22] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 7 * BH, BW, BH, + "Recombine tets into hex-dom mesh (experimental)"); mesh.butt[22]->type(FL_TOGGLE_BUTTON); mesh.butt[22]->callback(mesh_options_ok_cb); @@ -2414,81 +2351,78 @@ optionWindow::optionWindow(int deltaFontSize) } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Visibility"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Visibility"); - mesh.butt[6] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW / 2 - WB, BH, "Nodes"); + mesh.butt[6] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, + BW / 2 - WB, BH, "Nodes"); mesh.butt[6]->tooltip("(Alt+Shift+p)"); mesh.butt[6]->type(FL_TOGGLE_BUTTON); mesh.butt[6]->callback(mesh_options_ok_cb); - mesh.butt[7] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW / 2 - WB, BH, "1D elements"); + mesh.butt[7] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, + BW / 2 - WB, BH, "1D elements"); mesh.butt[7]->tooltip("(Alt+Shift+l)"); mesh.butt[7]->type(FL_TOGGLE_BUTTON); mesh.butt[7]->callback(mesh_options_ok_cb); - mesh.butt[8] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW / 2 - WB, BH, "2D element edges"); + mesh.butt[8] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, + BW / 2 - WB, BH, "2D element edges"); mesh.butt[8]->tooltip("(Alt+Shift+s)"); mesh.butt[8]->type(FL_TOGGLE_BUTTON); mesh.butt[8]->callback(mesh_options_ok_cb); - mesh.butt[9] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW / 2 - WB, BH, "2D element faces"); + mesh.butt[9] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, + BW / 2 - WB, BH, "2D element faces"); mesh.butt[9]->tooltip("(Alt+Shift+d)"); mesh.butt[9]->type(FL_TOGGLE_BUTTON); mesh.butt[9]->callback(mesh_options_ok_cb); - mesh.butt[10] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW / 2 - WB, BH, "3D element edges"); + mesh.butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, + BW / 2 - WB, BH, "3D element edges"); mesh.butt[10]->tooltip("(Alt+Shift+v)"); mesh.butt[10]->type(FL_TOGGLE_BUTTON); mesh.butt[10]->callback(mesh_options_ok_cb); - mesh.butt[11] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW / 2 - WB, BH, "3D element faces"); + mesh.butt[11] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, + BW / 2 - WB, BH, "3D element faces"); mesh.butt[11]->tooltip("(Alt+Shift+b)"); mesh.butt[11]->type(FL_TOGGLE_BUTTON); mesh.butt[11]->callback(mesh_options_ok_cb); - mesh.butt[12] = new Fl_Check_Button - (L + width / 2, 2 * WB + 1 * BH, BW / 2 - WB, BH, "Node labels"); + mesh.butt[12] = new Fl_Check_Button(L + width / 2, 2 * WB + 1 * BH, + BW / 2 - WB, BH, "Node labels"); mesh.butt[12]->type(FL_TOGGLE_BUTTON); mesh.butt[12]->callback(mesh_options_ok_cb); - mesh.butt[13] = new Fl_Check_Button - (L + width / 2, 2 * WB + 2 * BH, BW / 2 - WB, BH, "1D element labels"); + mesh.butt[13] = new Fl_Check_Button(L + width / 2, 2 * WB + 2 * BH, + BW / 2 - WB, BH, "1D element labels"); mesh.butt[13]->type(FL_TOGGLE_BUTTON); mesh.butt[13]->callback(mesh_options_ok_cb); - mesh.butt[14] = new Fl_Check_Button - (L + width / 2, 2 * WB + 3 * BH, BW / 2 - WB, BH, "2D element labels"); + mesh.butt[14] = new Fl_Check_Button(L + width / 2, 2 * WB + 3 * BH, + BW / 2 - WB, BH, "2D element labels"); mesh.butt[14]->type(FL_TOGGLE_BUTTON); mesh.butt[14]->callback(mesh_options_ok_cb); - mesh.butt[15] = new Fl_Check_Button - (L + width / 2, 2 * WB + 4 * BH, BW / 2 - WB, BH, "3D element labels"); + mesh.butt[15] = new Fl_Check_Button(L + width / 2, 2 * WB + 4 * BH, + BW / 2 - WB, BH, "3D element labels"); mesh.butt[15]->type(FL_TOGGLE_BUTTON); mesh.butt[15]->callback(mesh_options_ok_cb); static Fl_Menu_Item menu_label_type[] = { - {"Number", 0, 0, 0}, - {"Elementary tag", 0, 0, 0}, - {"Physical tag", 0, 0, 0}, - {"Mesh partition", 0, 0, 0}, - {"Coordinates", 0, 0, 0}, - {0} - }; - mesh.choice[7] = new Fl_Choice - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Label type"); + {"Number", 0, 0, 0}, {"Elementary tag", 0, 0, 0}, + {"Physical tag", 0, 0, 0}, {"Mesh partition", 0, 0, 0}, + {"Coordinates", 0, 0, 0}, {0}}; + mesh.choice[7] = + new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Label type"); mesh.choice[7]->menu(menu_label_type); mesh.choice[7]->align(FL_ALIGN_RIGHT); mesh.choice[7]->callback(mesh_options_ok_cb); - mesh.value[12] = new Fl_Value_Input - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 7 * BH, IW / 3, BH, "Sampling"); + mesh.value[12] = + new Fl_Value_Input(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 7 * BH, IW / 3, BH, "Sampling"); mesh.value[12]->minimum(1); mesh.value[12]->maximum(100); mesh.value[12]->step(1); @@ -2497,23 +2431,22 @@ optionWindow::optionWindow(int deltaFontSize) mesh.value[12]->callback(mesh_options_ok_cb); static Fl_Menu_Item menu_mesh_element_types[] = { - {"Triangles", 0, 0, 0, FL_MENU_TOGGLE}, + {"Triangles", 0, 0, 0, FL_MENU_TOGGLE}, {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE}, - {"Tetrahedra", 0, 0, 0, FL_MENU_TOGGLE}, - {"Hexahedra", 0, 0, 0, FL_MENU_TOGGLE}, - {"Prisms", 0, 0, 0, FL_MENU_TOGGLE}, - {"Pyramids", 0, 0, 0, FL_MENU_TOGGLE}, - {"Trihedra", 0, 0, 0, FL_MENU_TOGGLE}, - {0} - }; - - mesh.menu = new Fl_Menu_Button - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Elements"); + {"Tetrahedra", 0, 0, 0, FL_MENU_TOGGLE}, + {"Hexahedra", 0, 0, 0, FL_MENU_TOGGLE}, + {"Prisms", 0, 0, 0, FL_MENU_TOGGLE}, + {"Pyramids", 0, 0, 0, FL_MENU_TOGGLE}, + {"Trihedra", 0, 0, 0, FL_MENU_TOGGLE}, + {0}}; + + mesh.menu = + new Fl_Menu_Button(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Elements"); mesh.menu->menu(menu_mesh_element_types); mesh.menu->callback(mesh_options_ok_cb); - mesh.value[4] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 9 * BH, IW / 4, BH); + mesh.value[4] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 9 * BH, IW / 4, BH); mesh.value[4]->minimum(0); mesh.value[4]->maximum(1); mesh.value[4]->step(0.01); @@ -2521,8 +2454,8 @@ optionWindow::optionWindow(int deltaFontSize) mesh.value[4]->when(FL_WHEN_RELEASE); mesh.value[4]->callback(mesh_options_ok_cb); - mesh.value[5] = new Fl_Value_Input - (L + 2 * WB + IW / 4, 2 * WB + 9 * BH, IW / 2 - IW / 4, BH); + mesh.value[5] = new Fl_Value_Input(L + 2 * WB + IW / 4, 2 * WB + 9 * BH, + IW / 2 - IW / 4, BH); mesh.value[5]->minimum(0); mesh.value[5]->maximum(1); mesh.value[5]->step(0.01); @@ -2530,33 +2463,31 @@ optionWindow::optionWindow(int deltaFontSize) mesh.value[5]->when(FL_WHEN_RELEASE); mesh.value[5]->callback(mesh_options_ok_cb); - static Fl_Menu_Item menu_quality_type[] = { - {"SICN", 0, 0, 0}, - {"SIGE", 0, 0, 0}, - {"Gamma", 0, 0, 0}, - {"Disto", 0, 0, 0}, - {0} - }; - mesh.choice[6] = new Fl_Choice - (L + 2 * WB + IW / 2, 2 * WB + 9 * BH, IW/2, BH, "Quality range"); + static Fl_Menu_Item menu_quality_type[] = {{"SICN", 0, 0, 0}, + {"SIGE", 0, 0, 0}, + {"Gamma", 0, 0, 0}, + {"Disto", 0, 0, 0}, + {0}}; + mesh.choice[6] = new Fl_Choice(L + 2 * WB + IW / 2, 2 * WB + 9 * BH, + IW / 2, BH, "Quality range"); mesh.choice[6]->menu(menu_quality_type); mesh.choice[6]->align(FL_ALIGN_RIGHT); mesh.choice[6]->callback(mesh_options_ok_cb); - mesh.value[6] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 10 * BH, IW / 2, BH); + mesh.value[6] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW / 2, BH); mesh.value[6]->align(FL_ALIGN_RIGHT); mesh.value[6]->when(FL_WHEN_RELEASE); mesh.value[6]->callback(mesh_options_ok_cb); - mesh.value[7] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 10 * BH, IW / 2, BH, "Size range"); + mesh.value[7] = new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 10 * BH, + IW / 2, BH, "Size range"); mesh.value[7]->align(FL_ALIGN_RIGHT); mesh.value[7]->when(FL_WHEN_RELEASE); mesh.value[7]->callback(mesh_options_ok_cb); - mesh.value[8] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 11 * BH, IW / 2, BH); + mesh.value[8] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 11 * BH, IW / 2, BH); mesh.value[8]->minimum(0); mesh.value[8]->maximum(500); mesh.value[8]->step(1); @@ -2564,8 +2495,8 @@ optionWindow::optionWindow(int deltaFontSize) mesh.value[8]->when(FL_WHEN_RELEASE); mesh.value[8]->callback(mesh_options_ok_cb); - mesh.value[13] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 11 * BH, IW / 2, BH, "Normals and tangents"); + mesh.value[13] = new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 11 * BH, + IW / 2, BH, "Normals and tangents"); mesh.value[13]->minimum(0); mesh.value[13]->maximum(200); mesh.value[13]->step(1.0); @@ -2576,12 +2507,12 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Aspect"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Aspect"); o->hide(); - mesh.value[9] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Element shrinking factor"); + mesh.value[9] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, + "Element shrinking factor"); mesh.value[9]->minimum(0); mesh.value[9]->maximum(1); mesh.value[9]->step(0.01); @@ -2589,30 +2520,30 @@ optionWindow::optionWindow(int deltaFontSize) mesh.value[9]->when(FL_WHEN_RELEASE); mesh.value[9]->callback(mesh_options_ok_cb); - mesh.choice[0] = new Fl_Choice - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point display"); + mesh.choice[0] = + new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point display"); mesh.choice[0]->menu(menu_point_display); mesh.choice[0]->align(FL_ALIGN_RIGHT); mesh.choice[0]->callback(mesh_options_ok_cb); - mesh.value[10] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Point size"); + mesh.value[10] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Point size"); mesh.value[10]->minimum(0.1); mesh.value[10]->maximum(50); mesh.value[10]->step(0.1); mesh.value[10]->align(FL_ALIGN_RIGHT); mesh.value[10]->callback(mesh_options_ok_cb); - mesh.value[11] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line width"); + mesh.value[11] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line width"); mesh.value[11]->minimum(0.1); mesh.value[11]->maximum(50); mesh.value[11]->step(0.1); mesh.value[11]->align(FL_ALIGN_RIGHT); mesh.value[11]->callback(mesh_options_ok_cb); - mesh.value[14] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "High-order element subdivisions"); + mesh.value[14] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "High-order element subdivisions"); mesh.value[14]->minimum(1); mesh.value[14]->maximum(10); mesh.value[14]->step(1); @@ -2623,40 +2554,39 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Color"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Color"); o->hide(); - mesh.butt[17] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable lighting"); + mesh.butt[17] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Enable lighting"); mesh.butt[17]->tooltip("(Alt+w)"); mesh.butt[17]->type(FL_TOGGLE_BUTTON); - mesh.butt[17]->callback(mesh_options_ok_cb, (void*)"mesh_light"); + mesh.butt[17]->callback(mesh_options_ok_cb, (void *)"mesh_light"); static Fl_Menu_Item menu_mesh_light_lines[] = { {"No", 0, 0, 0}, {"Surface", 0, 0, 0}, {"Volume and surface", 0, 0, 0}, - {0} - }; - mesh.choice[10] = new Fl_Choice - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Edge lighting"); + {0}}; + mesh.choice[10] = + new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Edge lighting"); mesh.choice[10]->menu(menu_mesh_light_lines); mesh.choice[10]->align(FL_ALIGN_RIGHT); mesh.choice[10]->callback(mesh_options_ok_cb); - mesh.butt[18] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Use two-side lighting"); + mesh.butt[18] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Use two-side lighting"); mesh.butt[18]->type(FL_TOGGLE_BUTTON); mesh.butt[18]->callback(mesh_options_ok_cb); - mesh.butt[19] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Smooth normals"); + mesh.butt[19] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Smooth normals"); mesh.butt[19]->type(FL_TOGGLE_BUTTON); mesh.butt[19]->callback(mesh_options_ok_cb); - mesh.value[18] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Smoothing threshold angle"); + mesh.value[18] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "Smoothing threshold angle"); mesh.value[18]->minimum(0.); mesh.value[18]->maximum(180.); mesh.value[18]->step(1.); @@ -2669,21 +2599,21 @@ optionWindow::optionWindow(int deltaFontSize) {"By elementary entity", 0, 0, 0}, {"By physical group", 0, 0, 0}, {"By mesh partition", 0, 0, 0}, - {0} - }; - mesh.choice[4] = new Fl_Choice - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Coloring mode"); + {0}}; + mesh.choice[4] = + new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Coloring mode"); mesh.choice[4]->menu(menu_mesh_color); mesh.choice[4]->align(FL_ALIGN_RIGHT); mesh.choice[4]->callback(mesh_options_ok_cb); - Fl_Scroll *s = new Fl_Scroll - (L + 2 * WB, 3 * WB + 7 * BH, IW + 20, height - 5 * WB - 7 * BH); + Fl_Scroll *s = new Fl_Scroll(L + 2 * WB, 3 * WB + 7 * BH, IW + 20, + height - 5 * WB - 7 * BH); int i = 0; while(MeshOptions_Color[i].str) { - mesh.color[i] = new Fl_Button - (L + 2 * WB, 3 * WB + (7 + i) * BH, IW, BH, MeshOptions_Color[i].str); - mesh.color[i]->callback(color_cb, (void *)MeshOptions_Color[i].function); + mesh.color[i] = new Fl_Button(L + 2 * WB, 3 * WB + (7 + i) * BH, IW, BH, + MeshOptions_Color[i].str); + mesh.color[i]->callback(color_cb, + (void *)MeshOptions_Color[i].function); i++; } s->end(); @@ -2701,32 +2631,32 @@ optionWindow::optionWindow(int deltaFontSize) Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); - solver.input[0] = new Fl_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Base socket name"); + solver.input[0] = + new Fl_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Base socket name"); solver.input[0]->align(FL_ALIGN_RIGHT); solver.input[0]->callback(solver_options_ok_cb); - solver.value[0] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Timeout (in seconds)"); + solver.value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, + BH, "Timeout (in seconds)"); solver.value[0]->align(FL_ALIGN_RIGHT); solver.value[0]->callback(solver_options_ok_cb); - solver.butt[0] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, - "Always listen to incoming connection requests"); + solver.butt[0] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Always listen to incoming connection requests"); solver.butt[0]->type(FL_TOGGLE_BUTTON); solver.butt[0]->callback(solver_options_ok_cb); - solver.input[1] = new Fl_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Python interpreter"); + solver.input[1] = new Fl_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, + "Python interpreter"); solver.input[1]->align(FL_ALIGN_RIGHT); solver.input[1]->callback(solver_options_ok_cb); - solver.input[2] = new Fl_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Octave interpreter"); + solver.input[2] = new Fl_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "Octave interpreter"); solver.input[2]->align(FL_ALIGN_RIGHT); solver.input[2]->callback(solver_options_ok_cb); @@ -2743,49 +2673,50 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); static Fl_Menu_Item menu_links[] = { {"Apply next changes to selected views", 0, 0, 0}, {"Force same options for selected views", 0, 0, 0}, - {0} - }; + {0}}; - post.choice[0] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "View links"); + post.choice[0] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "View links"); post.choice[0]->menu(menu_links); post.choice[0]->align(FL_ALIGN_RIGHT); post.choice[0]->callback(post_options_ok_cb); - post.value[0] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Frame duration (in seconds)"); + post.value[0] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, + "Frame duration (in seconds)"); post.value[0]->minimum(0); post.value[0]->maximum(10); post.value[0]->step(0.01); post.value[0]->align(FL_ALIGN_RIGHT); post.value[0]->callback(post_options_ok_cb); - post.value[1] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Animation increment step"); + post.value[1] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, + "Animation increment step"); post.value[1]->minimum(1); post.value[1]->maximum(100); post.value[1]->step(1); post.value[1]->align(FL_ALIGN_RIGHT); post.value[1]->callback(post_options_ok_cb); - post.butt[0] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Cycle through views instead of steps"); + post.butt[0] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Cycle through views instead of steps"); post.butt[0]->type(FL_TOGGLE_BUTTON); post.butt[0]->callback(post_options_ok_cb); - post.butt[1] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Remove original views after combination"); + post.butt[1] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Remove original views after combination"); post.butt[1]->type(FL_TOGGLE_BUTTON); post.butt[1]->callback(post_options_ok_cb); - post.butt[2] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Draw value scales horizontally"); + post.butt[2] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Draw value scales horizontally"); post.butt[2]->type(FL_TOGGLE_BUTTON); post.butt[2]->callback(post_options_ok_cb); @@ -2802,51 +2733,48 @@ optionWindow::optionWindow(int deltaFontSize) { Fl_Tabs *o = new Fl_Tabs(L + WB, WB, width - 2 * WB, height - 2 * WB); { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General"); - - static Fl_Menu_Item menu_plot_type[] = { - {"3D", 0, 0, 0}, - {"2D space", 0, 0, 0}, - {"2D time", 0, 0, 0}, - {"2D", 0, 0, 0}, - {0} - }; - view.choice[13] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Plot type"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "General"); + + static Fl_Menu_Item menu_plot_type[] = {{"3D", 0, 0, 0}, + {"2D space", 0, 0, 0}, + {"2D time", 0, 0, 0}, + {"2D", 0, 0, 0}, + {0}}; + view.choice[13] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Plot type"); view.choice[13]->menu(menu_plot_type); view.choice[13]->align(FL_ALIGN_RIGHT); view.choice[13]->callback(view_options_ok_cb); - view.input[0] = new Fl_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "View name"); + view.input[0] = + new Fl_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "View name"); view.input[0]->align(FL_ALIGN_RIGHT); view.input[0]->callback(view_options_ok_cb); int sw = (int)(1.5 * FL_NORMAL_SIZE); - view.push[3] = new Fl_Button - (L + 2 * WB, 2 * WB + 3 * BH, sw, BH, "-"); - view.push[3]->callback(view_options_timestep_cb, (void*)"-"); - view.push[4] = new Fl_Button - (L + 2 * WB + IW - sw, 2 * WB + 3 * BH, sw, BH, "+"); - view.push[4]->callback(view_options_timestep_cb, (void*)"+"); - view.value[50] = new Fl_Value_Input - (L + 2 * WB + sw, 2 * WB + 3 * BH, IW - 2 * sw, BH); - view.value[50]->callback(view_options_timestep_cb, (void*)"="); + view.push[3] = new Fl_Button(L + 2 * WB, 2 * WB + 3 * BH, sw, BH, "-"); + view.push[3]->callback(view_options_timestep_cb, (void *)"-"); + view.push[4] = + new Fl_Button(L + 2 * WB + IW - sw, 2 * WB + 3 * BH, sw, BH, "+"); + view.push[4]->callback(view_options_timestep_cb, (void *)"+"); + view.value[50] = + new Fl_Value_Input(L + 2 * WB + sw, 2 * WB + 3 * BH, IW - 2 * sw, BH); + view.value[50]->callback(view_options_timestep_cb, (void *)"="); view.value[50]->align(FL_ALIGN_RIGHT); view.value[50]->minimum(0); view.value[50]->maximum(0); view.value[50]->step(1); - view.label[0] = new Fl_Box - (L + 2 * WB + IW, 2 * WB + 3 * BH, width / 2, BH, "Step"); + view.label[0] = + new Fl_Box(L + 2 * WB + IW, 2 * WB + 3 * BH, width / 2, BH, "Step"); view.label[0]->box(FL_NO_BOX); view.label[0]->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); - view.range = new Fl_Group - (L + 2 * WB, 2 * WB + 4 * BH, width - 4 * WB, 8 * BH); + view.range = + new Fl_Group(L + 2 * WB, 2 * WB + 4 * BH, width - 4 * WB, 8 * BH); - view.value[30] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Intervals"); + view.value[30] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Intervals"); view.value[30]->align(FL_ALIGN_RIGHT); view.value[30]->minimum(1); view.value[30]->maximum(256); @@ -2854,102 +2782,91 @@ optionWindow::optionWindow(int deltaFontSize) view.value[30]->when(FL_WHEN_RELEASE); view.value[30]->callback(view_options_ok_cb); - view.input[1] = new Fl_Input - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 4 * BH, (int)(0.5*0.85*IW), BH, - "Format"); + view.input[1] = + new Fl_Input(L + width - (int)(0.85 * IW) - 2 * WB, 2 * WB + 4 * BH, + (int)(0.5 * 0.85 * IW), BH, "Format"); view.input[1]->align(FL_ALIGN_RIGHT); view.input[1]->callback(view_options_ok_cb); - static Fl_Menu_Item menu_iso[] = { - {"Iso-values", 0, 0, 0}, - {"Continuous map", 0, 0, 0}, - {"Filled iso-values", 0, 0, 0}, - {"Numeric values", 0, 0, 0}, - {0} - }; - view.choice[0] = new Fl_Choice - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Intervals type"); + static Fl_Menu_Item menu_iso[] = {{"Iso-values", 0, 0, 0}, + {"Continuous map", 0, 0, 0}, + {"Filled iso-values", 0, 0, 0}, + {"Numeric values", 0, 0, 0}, + {0}}; + view.choice[0] = + new Fl_Choice(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Intervals type"); view.choice[0]->menu(menu_iso); view.choice[0]->align(FL_ALIGN_RIGHT); view.choice[0]->tooltip("(Alt+t)"); view.choice[0]->callback(view_options_ok_cb); - static Fl_Menu_Item menu_scale[] = { - {"Linear", 0, 0, 0}, - {"Logarithmic", 0, 0, 0}, - {"Double logarithmic", 0, 0, 0}, - {0} - }; - view.choice[1] = new Fl_Choice - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 5 * BH, (int)(0.85*IW), BH); + static Fl_Menu_Item menu_scale[] = {{"Linear", 0, 0, 0}, + {"Logarithmic", 0, 0, 0}, + {"Double logarithmic", 0, 0, 0}, + {0}}; + view.choice[1] = new Fl_Choice(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 5 * BH, (int)(0.85 * IW), BH); view.choice[1]->menu(menu_scale); view.choice[1]->align(FL_ALIGN_RIGHT); view.choice[1]->callback(view_options_ok_cb); static Fl_Menu_Item menu_range[] = { - {"Default", 0, 0, 0}, - {"Custom", 0, 0, 0}, - {"Per step", 0, 0, 0}, - {0} - }; - view.choice[7] = new Fl_Choice - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Range mode"); + {"Default", 0, 0, 0}, {"Custom", 0, 0, 0}, {"Per step", 0, 0, 0}, {0}}; + view.choice[7] = + new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Range mode"); view.choice[7]->menu(menu_range); view.choice[7]->align(FL_ALIGN_RIGHT); view.choice[7]->tooltip("(Alt+r)"); - view.choice[7]->callback(view_options_ok_cb, (void*)"custom_range"); + view.choice[7]->callback(view_options_ok_cb, (void *)"custom_range"); - view.butt[38] = new Fl_Check_Button - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 6 * BH, (int)(0.85*IW), BH, - "Saturate"); + view.butt[38] = + new Fl_Check_Button(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 6 * BH, (int)(0.85 * IW), BH, "Saturate"); view.butt[38]->type(FL_TOGGLE_BUTTON); view.butt[38]->callback(view_options_ok_cb); int sw2 = (int)(2.5 * FL_NORMAL_SIZE); - view.push[1] = new Fl_Button - (L + 2 * WB, 2 * WB + 7 * BH, sw2, BH, "Min"); - view.push[1]->callback(view_options_ok_cb, (void*)"range_min"); - view.value[31] = new Fl_Value_Input - (L + 2 * WB + sw2, 2 * WB + 7 * BH, IW - sw2, BH, "Custom min"); + view.push[1] = new Fl_Button(L + 2 * WB, 2 * WB + 7 * BH, sw2, BH, "Min"); + view.push[1]->callback(view_options_ok_cb, (void *)"range_min"); + view.value[31] = new Fl_Value_Input(L + 2 * WB + sw2, 2 * WB + 7 * BH, + IW - sw2, BH, "Custom min"); view.value[31]->align(FL_ALIGN_RIGHT); view.value[31]->when(FL_WHEN_RELEASE); view.value[31]->callback(view_options_ok_cb); - view.push[2] = new Fl_Button - (L + 2 * WB, 2 * WB + 8 * BH, sw2, BH, "Max"); - view.push[2]->callback(view_options_ok_cb, (void*)"range_max"); - view.value[32] = new Fl_Value_Input - (L + 2 * WB + sw2, 2 * WB + 8 * BH, IW - sw2, BH, "Custom max"); + view.push[2] = new Fl_Button(L + 2 * WB, 2 * WB + 8 * BH, sw2, BH, "Max"); + view.push[2]->callback(view_options_ok_cb, (void *)"range_max"); + view.value[32] = new Fl_Value_Input(L + 2 * WB + sw2, 2 * WB + 8 * BH, + IW - sw2, BH, "Custom max"); view.value[32]->align(FL_ALIGN_RIGHT); view.value[32]->when(FL_WHEN_RELEASE); view.value[32]->callback(view_options_ok_cb); - view.butt[0] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 9 * BH, BW, BH, "Adapt visualization grid"); + view.butt[0] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 9 * BH, BW, BH, + "Adapt visualization grid"); view.butt[0]->type(FL_TOGGLE_BUTTON); - view.butt[0]->callback(view_options_ok_cb, (void*)"view_adaptive"); - - view.push[5] = new Fl_Button - (L + 2 * WB, 2 * WB + 10 * BH, sw, BH, "-"); - view.push[5]->callback(view_options_max_recursion_cb, (void*)"-"); - view.push[6] = new Fl_Button - (L + 2 * WB + IW - sw, 2 * WB + 10 * BH, sw, BH, "+"); - view.push[6]->callback(view_options_max_recursion_cb, (void*)"+"); - view.value[33] = new Fl_Value_Input - (L + 2 * WB + sw, 2 * WB + 10 * BH, IW - 2 * sw, BH); + view.butt[0]->callback(view_options_ok_cb, (void *)"view_adaptive"); + + view.push[5] = new Fl_Button(L + 2 * WB, 2 * WB + 10 * BH, sw, BH, "-"); + view.push[5]->callback(view_options_max_recursion_cb, (void *)"-"); + view.push[6] = + new Fl_Button(L + 2 * WB + IW - sw, 2 * WB + 10 * BH, sw, BH, "+"); + view.push[6]->callback(view_options_max_recursion_cb, (void *)"+"); + view.value[33] = + new Fl_Value_Input(L + 2 * WB + sw, 2 * WB + 10 * BH, IW - 2 * sw, BH); view.value[33]->align(FL_ALIGN_RIGHT); view.value[33]->minimum(0); view.value[33]->maximum(6); view.value[33]->step(1); view.value[33]->when(FL_WHEN_RELEASE); view.value[33]->callback(view_options_ok_cb); - view.label[1] = new Fl_Box - (L + 2 * WB + IW, 2 * WB + 10 * BH, width / 2, BH, "Maximum recursion level"); + view.label[1] = new Fl_Box(L + 2 * WB + IW, 2 * WB + 10 * BH, width / 2, + BH, "Maximum recursion level"); view.label[1]->box(FL_NO_BOX); view.label[1]->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); - view.value[34] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Target visualization error"); + view.value[34] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, + "Target visualization error"); view.value[34]->align(FL_ALIGN_RIGHT); view.value[34]->minimum(-1.e-4); view.value[34]->maximum(0.1); @@ -2962,120 +2879,123 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Axes"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Axes"); o->hide(); - view.choice[8] = new Fl_Choice - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axes mode"); + view.choice[8] = + new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Axes mode"); view.choice[8]->menu(menu_axes_mode); view.choice[8]->align(FL_ALIGN_RIGHT); view.choice[8]->tooltip("(Alt+a)"); - view.choice[8]->callback(view_options_ok_cb, (void*)"view_axes"); + view.choice[8]->callback(view_options_ok_cb, (void *)"view_axes"); - view.butt[3] = new Fl_Check_Button - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 1 * BH, (int)(0.85*IW), BH, - "Mikado style"); + view.butt[3] = new Fl_Check_Button(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 1 * BH, (int)(0.85 * IW), BH, + "Mikado style"); view.butt[3]->type(FL_TOGGLE_BUTTON); view.butt[3]->callback(view_options_ok_cb); - view.value[3] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 2 * BH, IW/3, BH); + view.value[3] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW / 3, BH); view.value[3]->minimum(0.); view.value[3]->step(1); view.value[3]->maximum(100); view.value[3]->callback(view_options_ok_cb); - view.value[4] = new Fl_Value_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 2 * BH, IW/3, BH); + view.value[4] = new Fl_Value_Input(L + 2 * WB + 1 * IW / 3, + 2 * WB + 2 * BH, IW / 3, BH); view.value[4]->minimum(0.); view.value[4]->step(1); view.value[4]->maximum(100); view.value[4]->callback(view_options_ok_cb); - view.value[5] = new Fl_Value_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 2 * BH, IW/3, BH, "Axes tics"); + view.value[5] = new Fl_Value_Input( + L + 2 * WB + 2 * IW / 3, 2 * WB + 2 * BH, IW / 3, BH, "Axes tics"); view.value[5]->minimum(0.); view.value[5]->step(1); view.value[5]->maximum(100); view.value[5]->align(FL_ALIGN_RIGHT); view.value[5]->callback(view_options_ok_cb); - view.input[7] = new Fl_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW/3, BH); + view.input[7] = new Fl_Input(L + 2 * WB, 2 * WB + 3 * BH, IW / 3, BH); view.input[7]->callback(view_options_ok_cb); - view.input[8] = new Fl_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 3 * BH, IW/3, BH); + view.input[8] = + new Fl_Input(L + 2 * WB + 1 * IW / 3, 2 * WB + 3 * BH, IW / 3, BH); view.input[8]->callback(view_options_ok_cb); - view.input[9] = new Fl_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 3 * BH, IW/3, BH, "Axes format"); + view.input[9] = new Fl_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 3 * BH, + IW / 3, BH, "Axes format"); view.input[9]->align(FL_ALIGN_RIGHT); view.input[9]->callback(view_options_ok_cb); - view.input[10] = new Fl_Input - (L + 2 * WB, 2 * WB + 4 * BH, IW/3, BH); + view.input[10] = new Fl_Input(L + 2 * WB, 2 * WB + 4 * BH, IW / 3, BH); view.input[10]->callback(view_options_ok_cb); - view.input[11] = new Fl_Input - (L + 2 * WB + 1*IW/3, 2 * WB + 4 * BH, IW/3, BH); + view.input[11] = + new Fl_Input(L + 2 * WB + 1 * IW / 3, 2 * WB + 4 * BH, IW / 3, BH); view.input[11]->callback(view_options_ok_cb); - view.input[12] = new Fl_Input - (L + 2 * WB + 2*IW/3, 2 * WB + 4 * BH, IW/3, BH, "Axes labels"); + view.input[12] = new Fl_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 4 * BH, + IW / 3, BH, "Axes labels"); view.input[12]->align(FL_ALIGN_RIGHT); view.input[12]->callback(view_options_ok_cb); - view.butt[25] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Position 3D axes automatically"); + view.butt[25] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Position 3D axes automatically"); view.butt[25]->type(FL_TOGGLE_BUTTON); - view.butt[25]->callback(view_options_ok_cb, (void*)"view_axes_auto_3d"); + view.butt[25]->callback(view_options_ok_cb, (void *)"view_axes_auto_3d"); - view.value[13] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 6 * BH, IW / 3, BH); + view.value[13] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 6 * BH, IW / 3, BH); view.value[13]->callback(view_options_ok_cb); - view.value[14] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 6 * BH, IW / 3, BH); + view.value[14] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 6 * BH, IW / 3, BH); view.value[14]->callback(view_options_ok_cb); - view.value[15] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 6 * BH, IW / 3, BH, "3D axes minimum"); + view.value[15] = + new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 6 * BH, IW / 3, BH, + "3D axes minimum"); view.value[15]->align(FL_ALIGN_RIGHT); view.value[15]->callback(view_options_ok_cb); - view.value[16] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 7 * BH, IW / 3, BH); + view.value[16] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW / 3, BH); view.value[16]->callback(view_options_ok_cb); - view.value[17] = new Fl_Value_Input - (L + 2 * WB + IW / 3, 2 * WB + 7 * BH, IW / 3, BH); + view.value[17] = + new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 7 * BH, IW / 3, BH); view.value[17]->callback(view_options_ok_cb); - view.value[18] = new Fl_Value_Input - (L + 2 * WB + 2 * IW / 3, 2 * WB + 7 * BH, IW / 3, BH, "3D axes maximum"); + view.value[18] = + new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 7 * BH, IW / 3, BH, + "3D axes maximum"); view.value[18]->align(FL_ALIGN_RIGHT); view.value[18]->callback(view_options_ok_cb); - view.choice[16] = new Fl_Choice - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "2D axes/value scale position"); + 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.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); + view.value[20] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 9 * BH, IW / 2, BH); view.value[20]->minimum(-2000); view.value[20]->maximum(2000); view.value[20]->step(0.5); view.value[20]->callback(view_options_ok_cb); - view.value[21] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 9 * BH, IW / 2, BH, "2D axes/value scale position"); + view.value[21] = + new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 9 * BH, IW / 2, BH, + "2D axes/value scale position"); view.value[21]->align(FL_ALIGN_RIGHT); view.value[21]->minimum(-2000); view.value[21]->maximum(2000); view.value[21]->step(0.5); view.value[21]->callback(view_options_ok_cb); - view.value[22] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 10 * BH, IW / 2, BH); + view.value[22] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW / 2, BH); view.value[22]->minimum(0); view.value[22]->maximum(2000); view.value[22]->step(0.5); view.value[22]->callback(view_options_ok_cb); - view.value[23] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 10 * BH, IW / 2, BH, "2D axes/value scale size"); + view.value[23] = + new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 10 * BH, IW / 2, BH, + "2D axes/value scale size"); view.value[23]->align(FL_ALIGN_RIGHT); view.value[23]->minimum(0); view.value[23]->maximum(2000); @@ -3085,69 +3005,66 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Visibility"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Visibility"); o->hide(); - view.butt[4] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Show value scale"); + view.butt[4] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Show value scale"); view.butt[4]->tooltip("(Alt+i)"); view.butt[4]->type(FL_TOGGLE_BUTTON); view.butt[4]->callback(view_options_ok_cb); - static Fl_Menu_Item time_display[] = { - {"None", 0, 0, 0}, - {"Time series", 0, 0, 0}, - {"Harmonic data", 0, 0, 0}, - {"Automatic", 0, 0, 0}, - {"Step data", 0, 0, 0}, - {"Multi-step data", 0, 0, 0}, - {"Real eigenvalues", 0, 0, 0}, - {"Complex eigenvalues", 0, 0, 0}, - {0} - }; - view.choice[12] = new Fl_Choice - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Time display"); + static Fl_Menu_Item time_display[] = {{"None", 0, 0, 0}, + {"Time series", 0, 0, 0}, + {"Harmonic data", 0, 0, 0}, + {"Automatic", 0, 0, 0}, + {"Step data", 0, 0, 0}, + {"Multi-step data", 0, 0, 0}, + {"Real eigenvalues", 0, 0, 0}, + {"Complex eigenvalues", 0, 0, 0}, + {0}}; + view.choice[12] = + new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Time display"); view.choice[12]->menu(time_display); view.choice[12]->align(FL_ALIGN_RIGHT); view.choice[12]->callback(view_options_ok_cb); - view.butt[5] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Show annotations"); + view.butt[5] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Show annotations"); view.butt[5]->tooltip("(Alt+n)"); view.butt[5]->type(FL_TOGGLE_BUTTON); view.butt[5]->callback(view_options_ok_cb); - view.butt[10] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Draw element outlines"); + view.butt[10] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Draw element outlines"); view.butt[10]->tooltip("(Alt+e)"); view.butt[10]->type(FL_TOGGLE_BUTTON); view.butt[10]->callback(view_options_ok_cb); - view.butt[2] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Draw only skin of 3D views"); + view.butt[2] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, + "Draw only skin of 3D views"); view.butt[2]->type(FL_TOGGLE_BUTTON); view.butt[2]->callback(view_options_ok_cb); static Fl_Menu_Item menu_view_element_types[] = { - {"Points", 0, 0, 0, FL_MENU_TOGGLE}, - {"Lines", 0, 0, 0, FL_MENU_TOGGLE}, - {"Triangles", 0, 0, 0, FL_MENU_TOGGLE}, + {"Points", 0, 0, 0, FL_MENU_TOGGLE}, + {"Lines", 0, 0, 0, FL_MENU_TOGGLE}, + {"Triangles", 0, 0, 0, FL_MENU_TOGGLE}, {"Quadrangles", 0, 0, 0, FL_MENU_TOGGLE}, - {"Tetrahedra", 0, 0, 0, FL_MENU_TOGGLE}, - {"Hexahedra", 0, 0, 0, FL_MENU_TOGGLE}, - {"Prisms", 0, 0, 0, FL_MENU_TOGGLE}, - {"Pyramids", 0, 0, 0, FL_MENU_TOGGLE}, - {0} - }; - - view.menu[1] = new Fl_Menu_Button - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Elements"); + {"Tetrahedra", 0, 0, 0, FL_MENU_TOGGLE}, + {"Hexahedra", 0, 0, 0, FL_MENU_TOGGLE}, + {"Prisms", 0, 0, 0, FL_MENU_TOGGLE}, + {"Pyramids", 0, 0, 0, FL_MENU_TOGGLE}, + {0}}; + + view.menu[1] = + new Fl_Menu_Button(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Elements"); view.menu[1]->menu(menu_view_element_types); view.menu[1]->callback(view_options_ok_cb); - view.value[6] = new Fl_Value_Input - (L + 3 * WB + IW, 2 * WB + 6 * BH, IW / 3, BH, "Sampling"); + view.value[6] = new Fl_Value_Input(L + 3 * WB + IW, 2 * WB + 6 * BH, + IW / 3, BH, "Sampling"); view.value[6]->minimum(1); view.value[6]->maximum(100); view.value[6]->step(1); @@ -3155,21 +3072,19 @@ optionWindow::optionWindow(int deltaFontSize) view.value[6]->when(FL_WHEN_RELEASE); view.value[6]->callback(view_options_ok_cb); - static Fl_Menu_Item menu_boundary[] = { - {"None", 0, 0, 0}, - {"Dimension - 1", 0, 0, 0}, - {"Dimension - 2", 0, 0, 0}, - {"Dimension - 3", 0, 0, 0}, - {0} - }; - view.choice[9] = new Fl_Choice - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Element boundary mode"); + static Fl_Menu_Item menu_boundary[] = {{"None", 0, 0, 0}, + {"Dimension - 1", 0, 0, 0}, + {"Dimension - 2", 0, 0, 0}, + {"Dimension - 3", 0, 0, 0}, + {0}}; + view.choice[9] = new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, + "Element boundary mode"); view.choice[9]->menu(menu_boundary); view.choice[9]->align(FL_ALIGN_RIGHT); view.choice[9]->callback(view_options_ok_cb); - view.value[0] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 8 * BH, IW / 2, BH); + view.value[0] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW / 2, BH); view.value[0]->minimum(0); view.value[0]->maximum(500); view.value[0]->step(1); @@ -3177,8 +3092,8 @@ optionWindow::optionWindow(int deltaFontSize) view.value[0]->when(FL_WHEN_RELEASE); view.value[0]->callback(view_options_ok_cb); - view.value[1] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 8 * BH, IW / 2, BH, "Normals and tangents"); + view.value[1] = new Fl_Value_Input(L + 2 * WB + IW / 2, 2 * WB + 8 * BH, + IW / 2, BH, "Normals and tangents"); view.value[1]->minimum(0); view.value[1]->maximum(500); view.value[1]->step(1); @@ -3190,11 +3105,10 @@ optionWindow::optionWindow(int deltaFontSize) {"Scalar", 0, 0, 0, FL_MENU_TOGGLE}, {"Vector", 0, 0, 0, FL_MENU_TOGGLE}, {"Tensor", 0, 0, 0, FL_MENU_TOGGLE}, - {0} - }; + {0}}; - view.menu[0] = new Fl_Menu_Button - (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Fields"); + view.menu[0] = + new Fl_Menu_Button(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Fields"); view.menu[0]->menu(menu_view_field_types); view.menu[0]->callback(view_options_ok_cb); @@ -3203,19 +3117,17 @@ optionWindow::optionWindow(int deltaFontSize) {"Force Scalar", 0, 0, 0}, {"Force Vector", 0, 0, 0}, {"Force Tensor", 0, 0, 0}, - {0} - }; - view.choice[14] = new Fl_Choice - (L + 2 * WB, 2 * WB + 10 * BH, IW, BH); + {0}}; + view.choice[14] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, IW, BH); view.choice[14]->menu(menu_force_field_type); view.choice[14]->align(FL_ALIGN_RIGHT); view.choice[14]->callback(view_options_ok_cb); - for(int i = 0; i < 9; i++){ + for(int i = 0; i < 9; i++) { int W = width - 5 * WB - IW; int w = W / 9; - view.value[70 + i] = new Fl_Value_Input - (L + 3 * WB + IW + i * w, 2 * WB + 10 * BH, w, BH); + view.value[70 + i] = + new Fl_Value_Input(L + 3 * WB + IW + i * w, 2 * WB + 10 * BH, w, BH); view.value[70 + i]->minimum(-1); view.value[70 + i]->maximum(9); view.value[70 + i]->step(1); @@ -3225,62 +3137,59 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfo"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Transfo"); o->hide(); - Fl_Box *b = new Fl_Box - (FL_NO_BOX, L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Coordinate transformation:"); - b->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); + Fl_Box *b = new Fl_Box(FL_NO_BOX, L + 2 * WB, 2 * WB + 1 * BH, IW, BH, + "Coordinate transformation:"); + b->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); int ss = 2 * IW / 3 / 3 + 4; - view.value[51] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 2 * BH, ss, BH); - view.value[52] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 2 * BH, ss, BH); - view.value[53] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 2 * BH, ss, BH, " X"); - view.value[40] = new inputValueFloat - (L + 2 * WB + IW , 2 * WB + 2 * BH, 7*IW/10, BH); - - view.value[54] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 3 * BH, ss, BH); - view.value[55] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 3 * BH, ss, BH); - view.value[56] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 3 * BH, ss, BH, " Y +"); - view.value[41] = new inputValueFloat - (L + 2 * WB + IW , 2 * WB + 3 * BH, 7*IW/10, BH); - - view.value[57] = new Fl_Value_Input - (L + 2 * WB , 2 * WB + 4 * BH, ss, BH); - view.value[58] = new Fl_Value_Input - (L + 2 * WB + ss , 2 * WB + 4 * BH, ss, BH); - view.value[59] = new Fl_Value_Input - (L + 2 * WB + 2*ss, 2 * WB + 4 * BH, ss, BH, " Z"); - view.value[42] = new inputValueFloat - (L + 2 * WB + IW , 2 * WB + 4 * BH, 7*IW/10, BH); - - Fl_Box *b2 = new Fl_Box - (FL_NO_BOX, L + 2 * WB + 2 * IW-3*WB, 2 * WB + 1 * BH, 7*IW/10, BH, "Raise:"); - b2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); - - view.value[43] = new inputValueFloat - (L + 2 * WB + 2 * IW-3*WB, 2 * WB + 2 * BH, 7*IW/10, BH); - view.value[44] = new inputValueFloat - (L + 2 * WB + 2 * IW-3*WB, 2 * WB + 3 * BH, 7*IW/10, BH); - view.value[45] = new inputValueFloat - (L + 2 * WB + 2 * IW-3*WB, 2 * WB + 4 * BH, 7*IW/10, BH); - - view.value[46] = new inputValueFloat - (L + 2 * WB, 2 * WB + 5 * BH, 3*ss, BH, "Normal raise"); - - for(int i = 40; i <= 46; i++){ + view.value[51] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, ss, BH); + view.value[52] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 2 * BH, ss, BH); + view.value[53] = + new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 2 * BH, ss, BH, " X"); + view.value[40] = + new inputValueFloat(L + 2 * WB + IW, 2 * WB + 2 * BH, 7 * IW / 10, BH); + + view.value[54] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, ss, BH); + view.value[55] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 3 * BH, ss, BH); + view.value[56] = new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 3 * BH, + ss, BH, " Y +"); + view.value[41] = + new inputValueFloat(L + 2 * WB + IW, 2 * WB + 3 * BH, 7 * IW / 10, BH); + + view.value[57] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, ss, BH); + view.value[58] = + new Fl_Value_Input(L + 2 * WB + ss, 2 * WB + 4 * BH, ss, BH); + view.value[59] = + new Fl_Value_Input(L + 2 * WB + 2 * ss, 2 * WB + 4 * BH, ss, BH, " Z"); + view.value[42] = + new inputValueFloat(L + 2 * WB + IW, 2 * WB + 4 * BH, 7 * IW / 10, BH); + + Fl_Box *b2 = new Fl_Box(FL_NO_BOX, L + 2 * WB + 2 * IW - 3 * WB, + 2 * WB + 1 * BH, 7 * IW / 10, BH, "Raise:"); + b2->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT); + + view.value[43] = new inputValueFloat(L + 2 * WB + 2 * IW - 3 * WB, + 2 * WB + 2 * BH, 7 * IW / 10, BH); + view.value[44] = new inputValueFloat(L + 2 * WB + 2 * IW - 3 * WB, + 2 * WB + 3 * BH, 7 * IW / 10, BH); + view.value[45] = new inputValueFloat(L + 2 * WB + 2 * IW - 3 * WB, + 2 * WB + 4 * BH, 7 * IW / 10, BH); + + view.value[46] = new inputValueFloat(L + 2 * WB, 2 * WB + 5 * BH, 3 * ss, + BH, "Normal raise"); + + for(int i = 40; i <= 46; i++) { view.value[i]->align(FL_ALIGN_RIGHT); view.value[i]->when(FL_WHEN_RELEASE); view.value[i]->callback(view_options_ok_cb); } - for(int i = 51; i <= 59; i++){ + for(int i = 51; i <= 59; i++) { view.value[i]->minimum(-1.); view.value[i]->maximum(1.); view.value[i]->step(0.1); @@ -3289,47 +3198,49 @@ optionWindow::optionWindow(int deltaFontSize) view.value[i]->callback(view_options_ok_cb); } - view.butt[6] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Use general transformation expressions"); + view.butt[6] = + new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Use general transformation expressions"); view.butt[6]->type(FL_TOGGLE_BUTTON); - view.butt[6]->callback(view_options_ok_cb, (void*)"view_general_transform"); + view.butt[6]->callback(view_options_ok_cb, + (void *)"view_general_transform"); - view.choice[11] = new Fl_Choice - (L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Data source"); + view.choice[11] = + new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Data source"); view.choice[11]->align(FL_ALIGN_RIGHT); view.choice[11]->add("Self"); view.choice[11]->callback(view_options_ok_cb); - view.value[2] = new inputValueFloat - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Factor"); + view.value[2] = + new inputValueFloat(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Factor"); view.value[2]->align(FL_ALIGN_RIGHT); view.value[2]->when(FL_WHEN_RELEASE); view.value[2]->callback(view_options_ok_cb); - view.input[4] = new Fl_Input - (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "X expression"); + view.input[4] = + new Fl_Input(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "X expression"); view.input[4]->align(FL_ALIGN_RIGHT); view.input[4]->callback(view_options_ok_cb); - view.input[5] = new Fl_Input - (L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Y expression"); + view.input[5] = + new Fl_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Y expression"); view.input[5]->align(FL_ALIGN_RIGHT); view.input[5]->callback(view_options_ok_cb); - view.input[6] = new Fl_Input - (L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Z expression"); + view.input[6] = + new Fl_Input(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Z expression"); view.input[6]->align(FL_ALIGN_RIGHT); view.input[6]->callback(view_options_ok_cb); o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Aspect"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Aspect"); o->hide(); - view.value[12] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Element shrinking factor"); + view.value[12] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, + "Element shrinking factor"); view.value[12]->minimum(0.); view.value[12]->step(0.01); view.value[12]->maximum(1.); @@ -3337,34 +3248,34 @@ optionWindow::optionWindow(int deltaFontSize) view.value[12]->when(FL_WHEN_RELEASE); view.value[12]->callback(view_options_ok_cb); - view.choice[5] = new Fl_Choice - (L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point display"); + view.choice[5] = + new Fl_Choice(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Point display"); view.choice[5]->menu(menu_point_display_post); view.choice[5]->align(FL_ALIGN_RIGHT); view.choice[5]->callback(view_options_ok_cb); - view.value[61] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Point size"); + view.value[61] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Point size"); view.value[61]->minimum(0.1); view.value[61]->maximum(50); view.value[61]->step(0.1); view.value[61]->align(FL_ALIGN_RIGHT); view.value[61]->callback(view_options_ok_cb); - view.choice[6] = new Fl_Choice - (L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line display"); + view.choice[6] = + new Fl_Choice(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line display"); view.choice[6]->menu(menu_line_display_post); view.choice[6]->align(FL_ALIGN_RIGHT); view.choice[6]->callback(view_options_ok_cb); - view.butt[26] = new Fl_Check_Button - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 4 * BH, (int)(0.85*IW), BH, - "Stipple in 2D"); + view.butt[26] = new Fl_Check_Button(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 4 * BH, (int)(0.85 * IW), BH, + "Stipple in 2D"); view.butt[26]->type(FL_TOGGLE_BUTTON); view.butt[26]->callback(view_options_ok_cb); - view.value[62] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Line width"); + view.value[62] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Line width"); view.value[62]->minimum(0.1); view.value[62]->maximum(50); view.value[62]->step(0.1); @@ -3372,38 +3283,36 @@ optionWindow::optionWindow(int deltaFontSize) view.value[62]->callback(view_options_ok_cb); { - static Fl_Menu_Item menu_vectype[] = { - {"Line", 0, 0, 0}, - {"Arrow", 0, 0, 0}, - {"Pyramid", 0, 0, 0}, - {"3D arrow", 0, 0, 0}, - {"Displacement", 0, 0, 0}, - {"Comet", 0, 0, 0}, - {0} - }; - view.choice[2] = new Fl_Choice - (L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Vector display"); + static Fl_Menu_Item menu_vectype[] = {{"Line", 0, 0, 0}, + {"Arrow", 0, 0, 0}, + {"Pyramid", 0, 0, 0}, + {"3D arrow", 0, 0, 0}, + {"Displacement", 0, 0, 0}, + {"Comet", 0, 0, 0}, + {0}}; + view.choice[2] = + new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Vector display"); view.choice[2]->menu(menu_vectype); view.choice[2]->align(FL_ALIGN_RIGHT); view.choice[2]->callback(view_options_ok_cb); - view.value[64] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 7 * BH, IW / 2, BH); + view.value[64] = + new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW / 2, BH); view.value[64]->minimum(0); view.value[64]->maximum(500); view.value[64]->step(1); view.value[64]->align(FL_ALIGN_RIGHT); view.value[64]->callback(view_options_ok_cb); - view.value[60] = new Fl_Value_Input - (L + 2 * WB + IW / 2, 2 * WB + 7 * BH, IW / 2, BH, "Arrow size"); + view.value[60] = new Fl_Value_Input( + L + 2 * WB + IW / 2, 2 * WB + 7 * BH, IW / 2, BH, "Arrow size"); view.value[60]->minimum(0); view.value[60]->maximum(500); view.value[60]->step(1); view.value[60]->align(FL_ALIGN_RIGHT); view.value[60]->callback(view_options_ok_cb); - view.value[63] = new inputValueFloat - (L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Displacement factor"); + view.value[63] = new inputValueFloat(L + 2 * WB, 2 * WB + 8 * BH, IW, + BH, "Displacement factor"); view.value[63]->minimum(0.); view.value[63]->maximum(1.); view.value[63]->step(0.01); @@ -3411,47 +3320,40 @@ optionWindow::optionWindow(int deltaFontSize) view.value[63]->when(FL_WHEN_RELEASE); view.value[63]->callback(view_options_ok_cb); - view.choice[10] = new Fl_Choice - (L + 2 * WB, 2 * WB + 9 * BH, IW, BH, "Data source for vector fields"); + view.choice[10] = new Fl_Choice(L + 2 * WB, 2 * WB + 9 * BH, IW, BH, + "Data source for vector fields"); view.choice[10]->align(FL_ALIGN_RIGHT); view.choice[10]->add("Self"); view.choice[10]->callback(view_options_ok_cb); } static Fl_Menu_Item menu_glyph_loc[] = { - {"Barycenter", 0, 0, 0}, - {"Node", 0, 0, 0}, - {0} - }; - view.choice[3] = new Fl_Choice - (L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Glyph location"); + {"Barycenter", 0, 0, 0}, {"Node", 0, 0, 0}, {0}}; + view.choice[3] = + new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Glyph location"); view.choice[3]->menu(menu_glyph_loc); view.choice[3]->align(FL_ALIGN_RIGHT); view.choice[3]->callback(view_options_ok_cb); - static Fl_Menu_Item menu_glyph_center[] = { - {"Left-aligned", 0, 0, 0}, - {"Centered", 0, 0, 0}, - {"Right-aligned", 0, 0, 0}, - {0} - }; - view.choice[15] = new Fl_Choice - (L + width - (int)(0.85*IW) - 2 * WB, 2 * WB + 10 * BH, (int)(0.85*IW), BH); + static Fl_Menu_Item menu_glyph_center[] = {{"Left-aligned", 0, 0, 0}, + {"Centered", 0, 0, 0}, + {"Right-aligned", 0, 0, 0}, + {0}}; + view.choice[15] = new Fl_Choice(L + width - (int)(0.85 * IW) - 2 * WB, + 2 * WB + 10 * BH, (int)(0.85 * IW), BH); view.choice[15]->menu(menu_glyph_center); view.choice[15]->callback(view_options_ok_cb); - static Fl_Menu_Item menu_tensor[] = { - {"Von-Mises", 0, 0, 0}, - {"Maximum eigen value", 0, 0, 0}, - {"Minimum eigen value", 0, 0, 0}, - {"Eigen vectors", 0, 0, 0}, - {"Ellipse (2d)", 0, 0, 0}, - {"Ellipsoid", 0, 0, 0}, - {"Frame", 0, 0, 0}, - {0} - }; - view.choice[4] = new Fl_Choice - (L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Tensor display"); + static Fl_Menu_Item menu_tensor[] = {{"Von-Mises", 0, 0, 0}, + {"Maximum eigen value", 0, 0, 0}, + {"Minimum eigen value", 0, 0, 0}, + {"Eigen vectors", 0, 0, 0}, + {"Ellipse (2d)", 0, 0, 0}, + {"Ellipsoid", 0, 0, 0}, + {"Frame", 0, 0, 0}, + {0}}; + view.choice[4] = + new Fl_Choice(L + 2 * WB, 2 * WB + 11 * BH, IW, BH, "Tensor display"); view.choice[4]->menu(menu_tensor); view.choice[4]->align(FL_ALIGN_RIGHT); view.choice[4]->callback(view_options_ok_cb); @@ -3459,33 +3361,33 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Color"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Color"); o->hide(); - view.butt[11] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Enable lighting"); + view.butt[11] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, + "Enable lighting"); view.butt[11]->tooltip("(Alt+w)"); view.butt[11]->type(FL_TOGGLE_BUTTON); - view.butt[11]->callback(view_options_ok_cb, (void*)"view_light"); + view.butt[11]->callback(view_options_ok_cb, (void *)"view_light"); - view.butt[8] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Enable lighting of lines"); + view.butt[8] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, + "Enable lighting of lines"); view.butt[8]->type(FL_TOGGLE_BUTTON); view.butt[8]->callback(view_options_ok_cb); - view.butt[9] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Use two-side lighting"); + view.butt[9] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, + "Use two-side lighting"); view.butt[9]->type(FL_TOGGLE_BUTTON); view.butt[9]->callback(view_options_ok_cb); - view.butt[12] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Smooth normals"); + view.butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, + "Smooth normals"); view.butt[12]->type(FL_TOGGLE_BUTTON); view.butt[12]->callback(view_options_ok_cb); - view.value[10] = new Fl_Value_Input - (L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Smoothing threshold angle"); + view.value[10] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, + "Smoothing threshold angle"); view.value[10]->minimum(0.); view.value[10]->step(1.); view.value[10]->maximum(180.); @@ -3493,18 +3395,19 @@ optionWindow::optionWindow(int deltaFontSize) view.value[10]->when(FL_WHEN_RELEASE); view.value[10]->callback(view_options_ok_cb); - view.butt[24] = new Fl_Check_Button - (L + 2 * WB, 2 * WB + 6 * BH, BW, BH, "Use fake transparency mode"); + view.butt[24] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 6 * BH, BW, BH, + "Use fake transparency mode"); view.butt[24]->type(FL_TOGGLE_BUTTON); view.butt[24]->callback(view_options_ok_cb); - Fl_Scroll *s = new Fl_Scroll - (L + 2 * WB, 3 * WB + 7 * BH, IW + 20, height - 5 * WB - 7 * BH); + Fl_Scroll *s = new Fl_Scroll(L + 2 * WB, 3 * WB + 7 * BH, IW + 20, + height - 5 * WB - 7 * BH); int i = 0; while(ViewOptions_Color[i].str) { - view.color[i] = new Fl_Button - (L + 2 * WB, 3 * WB + (7 + i) * BH, IW, BH, ViewOptions_Color[i].str); - view.color[i]->callback(view_color_cb, (void *)ViewOptions_Color[i].function); + view.color[i] = new Fl_Button(L + 2 * WB, 3 * WB + (7 + i) * BH, IW, BH, + ViewOptions_Color[i].str); + view.color[i]->callback(view_color_cb, + (void *)ViewOptions_Color[i].function); i++; } s->end(); @@ -3512,13 +3415,13 @@ optionWindow::optionWindow(int deltaFontSize) o->end(); } { - Fl_Group *o = new Fl_Group - (L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Map"); - //o->label("@-1gmsh_colormap"); + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, + height - 2 * WB - BH, "Map"); + // o->label("@-1gmsh_colormap"); o->hide(); - view.colorbar = new colorbarWindow - (L + 2 * WB, 2 * WB + BH, width - 4 * WB, height - 4 * WB - BH); + view.colorbar = new colorbarWindow(L + 2 * WB, 2 * WB + BH, + width - 4 * WB, height - 4 * WB - BH); view.colorbar->end(); view.colorbar->callback(view_options_ok_cb); @@ -3528,13 +3431,15 @@ optionWindow::optionWindow(int deltaFontSize) } view.group->end(); - win->position(CTX::instance()->optPosition[0], CTX::instance()->optPosition[1]); + win->position(CTX::instance()->optPosition[0], + CTX::instance()->optPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; } -void optionWindow::showGroup(int num, bool showWindow, bool allowMultipleSelections) +void optionWindow::showGroup(int num, bool showWindow, + bool allowMultipleSelections) { general.group->hide(); geo.group->hide(); @@ -3543,28 +3448,42 @@ void optionWindow::showGroup(int num, bool showWindow, bool allowMultipleSelecti post.group->hide(); view.group->hide(); - if(num > 5 && allowMultipleSelections){ + if(num > 5 && allowMultipleSelections) { for(int i = 1; i <= 5; i++) browser->select(i, 0); } - else{ + else { browser->deselect(); } browser->select(num, 1); - switch(num){ - case 0: case 1: win->label("Options - General"); general.group->show(); break; - case 2: win->label("Options - Geometry"); geo.group->show(); break; - case 3: win->label("Options - Mesh"); mesh.group->show(); break; - case 4: win->label("Options - Solver"); solver.group->show(); break; - case 5: win->label("Options - Post-pro"); post.group->show(); break; - default: - { - updateViewGroup(num - 6); - static char str[128]; - sprintf(str, "Options - View [%d]", num - 6); - win->label(str); - view.group->show(); - } + switch(num) { + case 0: + case 1: + win->label("Options - General"); + general.group->show(); + break; + case 2: + win->label("Options - Geometry"); + geo.group->show(); break; + case 3: + win->label("Options - Mesh"); + mesh.group->show(); + break; + case 4: + win->label("Options - Solver"); + solver.group->show(); + break; + case 5: + win->label("Options - Post-pro"); + post.group->show(); + break; + default: { + updateViewGroup(num - 6); + static char str[128]; + sprintf(str, "Options - View [%d]", num - 6); + win->label(str); + view.group->show(); + } break; } if(showWindow) win->show(); } @@ -3578,7 +3497,7 @@ void optionWindow::resetBrowser() browser->add("Mesh"); browser->add("Solver"); browser->add("Post-pro"); - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(unsigned int i = 0; i < PView::list.size(); i++) { char str[128]; sprintf(str, "View [%d]", i); browser->add(str); @@ -3599,7 +3518,7 @@ void optionWindow::resetExternalViewList() view.choice[10]->add(str, 0, NULL); view.choice[11]->add(str, 0, NULL); } - if(view.index >= 0 && view.index < (int)PView::list.size()){ + if(view.index >= 0 && view.index < (int)PView::list.size()) { opt_view_external_view(view.index, GMSH_GUI, 0); opt_view_gen_raise_view(view.index, GMSH_GUI, 0); } @@ -3630,13 +3549,13 @@ void optionWindow::updateViewGroup(int index) opt_view_max_recursion_level(index, GMSH_GUI, 0); opt_view_target_error(index, GMSH_GUI, 0); - if(data->getNumPoints() || data->getNumLines()){ - ((Fl_Menu_Item*)view.choice[13]->menu())[1].activate(); - ((Fl_Menu_Item*)view.choice[13]->menu())[2].activate(); + if(data->getNumPoints() || data->getNumLines()) { + ((Fl_Menu_Item *)view.choice[13]->menu())[1].activate(); + ((Fl_Menu_Item *)view.choice[13]->menu())[2].activate(); } else { - ((Fl_Menu_Item*)view.choice[13]->menu())[1].deactivate(); - ((Fl_Menu_Item*)view.choice[13]->menu())[2].deactivate(); + ((Fl_Menu_Item *)view.choice[13]->menu())[1].deactivate(); + ((Fl_Menu_Item *)view.choice[13]->menu())[2].deactivate(); } opt_view_auto_position(index, GMSH_GUI, 0); @@ -3663,7 +3582,7 @@ void optionWindow::updateViewGroup(int index) opt_view_axes_ymax(index, GMSH_GUI, 0); opt_view_axes_zmin(index, GMSH_GUI, 0); opt_view_axes_zmax(index, GMSH_GUI, 0); - for(int i = 13; i <= 18; i++){ + for(int i = 13; i <= 18; i++) { view.value[i]->step(CTX::instance()->lc / 200., 1); view.value[i]->minimum(-CTX::instance()->lc); view.value[i]->maximum(CTX::instance()->lc); @@ -3671,11 +3590,11 @@ void optionWindow::updateViewGroup(int index) if(data->getNumElements()) { view.range->activate(); - ((Fl_Menu_Item*)view.choice[13]->menu())[0].activate(); + ((Fl_Menu_Item *)view.choice[13]->menu())[0].activate(); } else { view.range->deactivate(); - ((Fl_Menu_Item*)view.choice[13]->menu())[0].deactivate(); + ((Fl_Menu_Item *)view.choice[13]->menu())[0].deactivate(); } opt_view_show_element(index, GMSH_GUI, 0); opt_view_draw_skin_only(index, GMSH_GUI, 0); @@ -3807,8 +3726,8 @@ void optionWindow::updateViewGroup(int index) opt_view_color_text3d(index, GMSH_GUI, 0); opt_view_color_axes(index, GMSH_GUI, 0); - view.colorbar->update(data->getName().c_str(), data->getMin(), - data->getMax(), &opt->colorTable, &v->getChanged()); + view.colorbar->update(data->getName().c_str(), data->getMin(), data->getMax(), + &opt->colorTable, &v->getChanged()); } void optionWindow::activate(const char *what) @@ -3817,21 +3736,20 @@ void optionWindow::activate(const char *what) // activate/deactivate parts of the option window depending on the // user's choices (or the option settings) - if(!strcmp(what, "fast_redraw")){ - if(general.butt[2]->value()){ + if(!strcmp(what, "fast_redraw")) { + if(general.butt[2]->value()) { browser->resize(browser->x(), browser->y(), browser->w(), win->h() - 2 * WB - BH); redraw->show(); win->redraw(); } - else{ - browser->resize(browser->x(), browser->y(), browser->w(), - win->h()); + else { + browser->resize(browser->x(), browser->y(), browser->w(), win->h()); redraw->hide(); win->redraw(); } } - else if(!strcmp(what, "rotation_center")){ + else if(!strcmp(what, "rotation_center")) { if(general.butt[15]->value()) { general.push[0]->deactivate(); general.value[8]->deactivate(); @@ -3845,8 +3763,8 @@ void optionWindow::activate(const char *what) general.value[10]->activate(); } } - else if(!strcmp(what, "general_axes")){ - if(general.choice[4]->value()){ + else if(!strcmp(what, "general_axes")) { + if(general.choice[4]->value()) { general.value[17]->activate(); general.value[18]->activate(); general.value[19]->activate(); @@ -3857,7 +3775,7 @@ void optionWindow::activate(const char *what) general.input[7]->activate(); general.input[8]->activate(); } - else{ + else { general.value[17]->deactivate(); general.value[18]->deactivate(); general.value[19]->deactivate(); @@ -3869,8 +3787,8 @@ void optionWindow::activate(const char *what) general.input[8]->deactivate(); } } - else if(!strcmp(what, "general_axes_auto")){ - if(general.butt[0]->value()){ + else if(!strcmp(what, "general_axes_auto")) { + if(general.butt[0]->value()) { general.value[20]->deactivate(); general.value[21]->deactivate(); general.value[22]->deactivate(); @@ -3878,7 +3796,7 @@ void optionWindow::activate(const char *what) general.value[24]->deactivate(); general.value[25]->deactivate(); } - else{ + else { general.value[20]->activate(); general.value[21]->activate(); general.value[22]->activate(); @@ -3887,55 +3805,52 @@ void optionWindow::activate(const char *what) general.value[25]->activate(); } } - else if(!strcmp(what, "general_small_axes")){ - if(general.butt[1]->value()){ + else if(!strcmp(what, "general_small_axes")) { + if(general.butt[1]->value()) { general.value[26]->activate(); general.value[27]->activate(); } - else{ + else { general.value[26]->deactivate(); general.value[27]->deactivate(); } } - else if(!strcmp(what, "general_camera")){ - if(general.butt[19]->value()){ + else if(!strcmp(what, "general_camera")) { + if(general.butt[19]->value()) { if(CTX::instance()->gamepad && CTX::instance()->gamepad->active) general.gamepadconfig->activate(); } - else{ + else { general.gamepadconfig->deactivate(); } - if(general.butt[17]->value()==0){ + if(general.butt[17]->value() == 0) { general.value[29]->deactivate(); } - else{ + else { general.value[29]->activate(); } - if(general.butt[18]->value()==0 ){ + if(general.butt[18]->value() == 0) { general.value[30]->deactivate(); general.value[31]->deactivate(); } - else{ + else { general.value[30]->activate(); general.value[31]->activate(); } - } - else if(!strcmp(what, "geo_transform")){ - if(geo.choice[3]->value() == 1){ - for(int i = 7; i <= 18; i++) - geo.value[i]->activate(); + else if(!strcmp(what, "geo_transform")) { + if(geo.choice[3]->value() == 1) { + for(int i = 7; i <= 18; i++) geo.value[i]->activate(); } - else{ - for(int i = 7; i <= 18; i++) - geo.value[i]->deactivate(); + else { + for(int i = 7; i <= 18; i++) geo.value[i]->deactivate(); } } - else if(!strcmp(what, "custom_range")){ - if(view.choice[7]->value() == 1){ + else if(!strcmp(what, "custom_range")) { + if(view.choice[7]->value() == 1) { view.value[31]->activate(); view.value[32]->activate(); view.push[1]->activate(); @@ -3950,15 +3865,15 @@ void optionWindow::activate(const char *what) view.butt[38]->deactivate(); } } - else if(!strcmp(what, "view_adaptive")){ - if(view.butt[0]->value()){ + else if(!strcmp(what, "view_adaptive")) { + if(view.butt[0]->value()) { view.push[5]->activate(); view.push[6]->activate(); view.value[33]->activate(); view.value[34]->activate(); view.label[1]->activate(); } - else{ + else { view.push[5]->deactivate(); view.push[6]->deactivate(); view.value[33]->deactivate(); @@ -3966,15 +3881,15 @@ void optionWindow::activate(const char *what) view.label[1]->deactivate(); } } - else if(!strcmp(what, "view_general_transform")){ - if(view.butt[6]->value()){ + else if(!strcmp(what, "view_general_transform")) { + if(view.butt[6]->value()) { view.choice[11]->activate(); view.value[2]->activate(); view.input[4]->activate(); view.input[5]->activate(); view.input[6]->activate(); } - else{ + else { view.choice[11]->deactivate(); view.value[2]->deactivate(); view.input[4]->deactivate(); @@ -3982,36 +3897,36 @@ void optionWindow::activate(const char *what) view.input[6]->deactivate(); } } - else if(!strcmp(what, "mesh_light")){ - if(mesh.butt[17]->value()){ + else if(!strcmp(what, "mesh_light")) { + if(mesh.butt[17]->value()) { mesh.butt[18]->activate(); mesh.butt[19]->activate(); mesh.choice[10]->activate(); mesh.value[18]->activate(); } - else{ + else { mesh.butt[18]->deactivate(); mesh.butt[19]->deactivate(); mesh.choice[10]->deactivate(); mesh.value[18]->deactivate(); } } - else if(!strcmp(what, "view_light")){ - if(view.butt[11]->value()){ + else if(!strcmp(what, "view_light")) { + if(view.butt[11]->value()) { view.butt[8]->activate(); view.butt[9]->activate(); view.butt[12]->activate(); view.value[10]->activate(); } - else{ + else { view.butt[8]->deactivate(); view.butt[9]->deactivate(); view.butt[12]->deactivate(); view.value[10]->deactivate(); } } - else if(!strcmp(what, "view_axes")){ - if(view.choice[8]->value()){ + else if(!strcmp(what, "view_axes")) { + if(view.choice[8]->value()) { view.value[3]->activate(); view.value[4]->activate(); view.value[5]->activate(); @@ -4022,7 +3937,7 @@ void optionWindow::activate(const char *what) view.input[11]->activate(); view.input[12]->activate(); } - else{ + else { view.value[3]->deactivate(); view.value[4]->deactivate(); view.value[5]->deactivate(); @@ -4034,8 +3949,8 @@ void optionWindow::activate(const char *what) view.input[12]->deactivate(); } } - else if(!strcmp(what, "view_axes_auto_3d")){ - if(view.butt[25]->value()){ + else if(!strcmp(what, "view_axes_auto_3d")) { + if(view.butt[25]->value()) { view.value[13]->deactivate(); view.value[14]->deactivate(); view.value[15]->deactivate(); @@ -4043,7 +3958,7 @@ void optionWindow::activate(const char *what) view.value[17]->deactivate(); view.value[18]->deactivate(); } - else{ + else { view.value[13]->activate(); view.value[14]->activate(); view.value[15]->activate(); @@ -4052,14 +3967,14 @@ void optionWindow::activate(const char *what) view.value[18]->activate(); } } - else if(!strcmp(what, "view_axes_auto_2d")){ - if(view.choice[16]->value() == 0 || view.choice[16]->value() == 12){ + else if(!strcmp(what, "view_axes_auto_2d")) { + if(view.choice[16]->value() == 0 || view.choice[16]->value() == 12) { view.value[20]->activate(); view.value[21]->activate(); view.value[22]->activate(); view.value[23]->activate(); } - else{ + else { view.value[20]->deactivate(); view.value[21]->deactivate(); view.value[22]->deactivate(); diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h index 02c1d2cadf7a2103070c6e8ff0b5e5e9555884bd..38c4bc6d2afd747397905de59366ae8dfd0133ea 100644 --- a/Fltk/optionWindow.h +++ b/Fltk/optionWindow.h @@ -25,13 +25,13 @@ #define NUM_FONTS 15 extern Fl_Menu_Item menu_font_names[]; -class optionWindow{ - public: +class optionWindow { +public: Fl_Window *win; Fl_Multi_Browser *browser; Fl_Return_Button *redraw; - struct{ + struct { Fl_Group *group; #if defined(HAVE_VISUDEV) Fl_Check_Button *butt[23]; @@ -46,14 +46,14 @@ class optionWindow{ Fl_Button *gamepadconfig; spherePositionWidget *sphere; } general; - struct{ + struct { Fl_Group *group; Fl_Check_Button *butt[20]; Fl_Value_Input *value[25]; Fl_Button *color[50]; Fl_Choice *choice[20]; } geo; - struct{ + struct { Fl_Group *group; Fl_Check_Button *butt[50]; Fl_Return_Button *retbutt[50]; @@ -63,19 +63,19 @@ class optionWindow{ Fl_Choice *choice[20]; Fl_Menu_Button *menu; } mesh; - struct{ + struct { Fl_Group *group; Fl_Check_Button *butt[20]; Fl_Value_Input *value[20]; Fl_Input *input[20]; } solver; - struct{ + struct { Fl_Group *group; Fl_Check_Button *butt[20]; Fl_Value_Input *value[20]; Fl_Choice *choice[20]; } post; - struct{ + struct { int index; Fl_Group *group, *range; Fl_Check_Button *butt[100]; @@ -90,11 +90,11 @@ class optionWindow{ Fl_Menu_Button *menu[2]; } view; - public: - optionWindow(int deltaFontSize=0); - gamepadWindow* gmpdoption ; - void showGroup(int num, bool showWindow=true, - bool allowMultipleSelections=false); +public: + optionWindow(int deltaFontSize = 0); + gamepadWindow *gmpdoption; + void showGroup(int num, bool showWindow = true, + bool allowMultipleSelections = false); void resetBrowser(); void resetExternalViewList(); void updateViewGroup(int index); diff --git a/Fltk/outputRange.h b/Fltk/outputRange.h index b3dfc2821a1feb0201fef406b3fe5e42e8c33492..315f52d24568d4b97d037ccf75a8de89bca46f77 100644 --- a/Fltk/outputRange.h +++ b/Fltk/outputRange.h @@ -16,35 +16,34 @@ #include <FL/Fl_Menu_Button.H> class outputRange : public Fl_Group { - private: +private: Fl_Output *_output; Fl_Button *_graph_butt; Fl_Menu_Button *_graph_menu; std::string _graph_val; - void _set_graph_value(const std::string &val, bool update_menu=true) + void _set_graph_value(const std::string &val, bool update_menu = true) { _graph_val = val; _graph_val.resize(36, '0'); - if(update_menu){ - int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, - 13, 14, 15, 16, 19, 20, 21, 22, - 25, 26, 27, 28, 31, 32, 33, 34, - 37, 38, 39, 40, 43, 44, 45, 46, - 49, 50, 51, 52}; - for(int i = 0; i < 36; i++){ + if(update_menu) { + int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 16, + 19, 20, 21, 22, 25, 26, 27, 28, 31, 32, 33, 34, + 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; + for(int i = 0; i < 36; i++) { if(_graph_val[i] != '0') - ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].set(); + ((Fl_Menu_Item *)_graph_menu->menu())[index[i]].set(); else - ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].clear(); + ((Fl_Menu_Item *)_graph_menu->menu())[index[i]].clear(); } } bool yellow = false; - for(int i = 0; i < 36; i++) if(_graph_val[i] != '0') yellow = true; - if(yellow){ + for(int i = 0; i < 36; i++) + if(_graph_val[i] != '0') yellow = true; + if(yellow) { _graph_butt->value(1); _graph_butt->selection_color(FL_YELLOW); } - else{ + else { _graph_butt->value(0); _graph_butt->selection_color(_graph_butt->color()); } @@ -52,15 +51,13 @@ class outputRange : public Fl_Group { } static void _graph_menu_cb(Fl_Widget *w, void *data) { - outputRange *b = (outputRange*)data; + outputRange *b = (outputRange *)data; std::string v; v.resize(36, '0'); - int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, - 13, 14, 15, 16, 19, 20, 21, 22, - 25, 26, 27, 28, 31, 32, 33, 34, - 37, 38, 39, 40, 43, 44, 45, 46, - 49, 50, 51, 52}; - for(int i = 0; i < 36; i++){ + int index[36] = {1, 2, 3, 4, 7, 8, 9, 10, 13, 14, 15, 16, + 19, 20, 21, 22, 25, 26, 27, 28, 31, 32, 33, 34, + 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; + for(int i = 0; i < 36; i++) { // 1=iso, 2=continuous, 3=discrete, 4=numeric v[i] = b->_graph_menu->menu()[index[i]].value() ? '3' : '0'; } @@ -69,15 +66,16 @@ class outputRange : public Fl_Group { } static void _graph_menu_reset_cb(Fl_Widget *w, void *data) { - outputRange *b = (outputRange*)data; + outputRange *b = (outputRange *)data; std::string v; v.resize(36, '0'); b->_set_graph_value(v.c_str()); b->do_callback(); } - public: - outputRange(int x, int y, int w, int h, const char *l=0) - : Fl_Group(x,y,w,h,l) + +public: + outputRange(int x, int y, int w, int h, const char *l = 0) + : Fl_Group(x, y, w, h, l) { _graph_val.resize(36, '0'); @@ -103,12 +101,18 @@ class outputRange : public Fl_Group { _graph_menu->add("Top Right/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Bottom Left/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Bottom Left/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Left/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Left/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); - _graph_menu->add("Bottom Right/Y ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); + _graph_menu->add("Bottom Left/X ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Left/Y ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/X ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/Y ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/X ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); + _graph_menu->add("Bottom Right/Y ' ", 0, _graph_menu_cb, this, + FL_MENU_TOGGLE); _graph_menu->add("Top/X ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Top/Y ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); _graph_menu->add("Top/X ' ", 0, _graph_menu_cb, this, FL_MENU_TOGGLE); @@ -140,8 +144,8 @@ class outputRange : public Fl_Group { sprintf(tmp, "%g", val); _output->value(tmp); } - void graph(const std::string &val){ _set_graph_value(val); } - std::string graph(){ return _graph_val; } + void graph(const std::string &val) { _set_graph_value(val); } + std::string graph() { return _graph_val; } void color(int col) { _output->color(col); diff --git a/Fltk/paletteWindow.h b/Fltk/paletteWindow.h index 4a0fc4fb256c68a11ef9188beaebbe916408e548..b5edd69fa6d27a9df97c751d2b533fe54803d10b 100644 --- a/Fltk/paletteWindow.h +++ b/Fltk/paletteWindow.h @@ -12,23 +12,23 @@ // Derive special windows from Fl_Double_Window to correctly process // the OS-specific shorcuts (Esc & Cmd-w on Mac, Alt+F4 on Windows) class paletteWindow : public Fl_Double_Window { - public: - paletteWindow(int w, int h, bool nonModal, const char *l=0) +public: + paletteWindow(int w, int h, bool nonModal, const char *l = 0) : Fl_Double_Window(w, h, l) { if(nonModal) set_non_modal(); } virtual int handle(int event) { - switch (event) { + switch(event) { case FL_SHORTCUT: case FL_KEYBOARD: #if defined(__APPLE__) - if(Fl::test_shortcut(FL_META+'w') || Fl::test_shortcut(FL_Escape)){ + if(Fl::test_shortcut(FL_META + 'w') || Fl::test_shortcut(FL_Escape)) { #elif defined(WIN32) - if(Fl::test_shortcut(FL_ALT+FL_F+4) || Fl::test_shortcut(FL_Escape)){ + if(Fl::test_shortcut(FL_ALT + FL_F + 4) || Fl::test_shortcut(FL_Escape)) { #else - if(Fl::test_shortcut(FL_CTRL+'w') || Fl::test_shortcut(FL_Escape)){ + if(Fl::test_shortcut(FL_CTRL + 'w') || Fl::test_shortcut(FL_Escape)) { #endif do_callback(); return 1; diff --git a/Fltk/partitionDialog.cpp b/Fltk/partitionDialog.cpp index 6f5b700332eb89e7044f105cebf4e793c8f152fd..5a12a17e8419430b289e9873ddb49b9c587a92e1 100644 --- a/Fltk/partitionDialog.cpp +++ b/Fltk/partitionDialog.cpp @@ -42,8 +42,7 @@ void partition_opt_booleans_cb(Fl_Widget *widget, void *data); void partition_select_groups_cb(Fl_Widget *widget, void *data); // Pointers to required widgets -struct PartitionDialog -{ +struct PartitionDialog { Fl_Window *window; // Group 0 Fl_Choice *choicePartitioner; @@ -68,7 +67,8 @@ struct PartitionDialog void write_all_options() { // Group 0 - CTX::instance()->mesh.numPartitions = static_cast<int>(inputNumPartition->value()); + CTX::instance()->mesh.numPartitions = + static_cast<int>(inputNumPartition->value()); CTX::instance()->mesh.partitionCreateGhostCells = setGhostCells->value(); CTX::instance()->mesh.partitionCreateTopology = setTopology->value(); CTX::instance()->mesh.partitionCreatePhysicals = setPhysical->value(); @@ -78,7 +78,8 @@ struct PartitionDialog // Group 2 CTX::instance()->mesh.metisEdgeMatching = choiceEdgeMatch->value() + 1; - CTX::instance()->mesh.metisRefinementAlgorithm = choiceRefineAlg->value() + 1; + CTX::instance()->mesh.metisRefinementAlgorithm = + choiceRefineAlg->value() + 1; CTX::instance()->mesh.partitionTriWeight = (int)inputTriWeight->value(); CTX::instance()->mesh.partitionQuaWeight = (int)inputQuaWeight->value(); @@ -86,7 +87,6 @@ struct PartitionDialog CTX::instance()->mesh.partitionPriWeight = (int)inputPriWeight->value(); CTX::instance()->mesh.partitionPyrWeight = (int)inputPyrWeight->value(); CTX::instance()->mesh.partitionHexWeight = (int)inputHexWeight->value(); - } void read_all_options() { @@ -118,35 +118,36 @@ struct PartitionDialog // Match several locations that provide a partition number void partition_opt_num_partitions_cb(Fl_Widget *widget, void *data) { - PartitionDialog *dlg = static_cast<PartitionDialog*>(data); + PartitionDialog *dlg = static_cast<PartitionDialog *>(data); unsigned val = 0; - if(widget == dlg->inputNumPartition){ + if(widget == dlg->inputNumPartition) { val = static_cast<unsigned>(dlg->inputNumPartition->value()); } - dlg->choiceMetisAlg->value((val <= 8) ? 0: 1); + dlg->choiceMetisAlg->value((val <= 8) ? 0 : 1); } void partition_defaults_cb(Fl_Widget *widget, void *data) { - PartitionDialog *dlg = static_cast<PartitionDialog*>(data); + PartitionDialog *dlg = static_cast<PartitionDialog *>(data); dlg->read_all_options(); partition_select_groups_cb(dlg->choicePartitioner, data); } void partition_partition_cb(Fl_Widget *widget, void *data) { - PartitionDialog *dlg = static_cast<PartitionDialog*>(data); + PartitionDialog *dlg = static_cast<PartitionDialog *>(data); // Write all options dlg->write_all_options(); // Partition the mesh - int ier = GModel::current()->partitionMesh(CTX::instance()->mesh.numPartitions); + int ier = + GModel::current()->partitionMesh(CTX::instance()->mesh.numPartitions); // Update the screen - if(!ier){ - opt_mesh_zone_definition(0, GMSH_SET, 2.); // Define zone by partition + if(!ier) { + opt_mesh_zone_definition(0, GMSH_SET, 2.); // Define zone by partition opt_mesh_color_carousel(0, GMSH_SET | GMSH_GUI, 3.); CTX::instance()->mesh.changed = ENT_ALL; FlGui::instance()->resetVisibility(); @@ -156,7 +157,7 @@ void partition_partition_cb(Fl_Widget *widget, void *data) void partition_cancel_cb(Fl_Widget *widget, void *data) { - PartitionDialog *dlg = static_cast<PartitionDialog*>(data); + PartitionDialog *dlg = static_cast<PartitionDialog *>(data); dlg->window->hide(); Fl::delete_widget(dlg->window); } @@ -164,12 +165,13 @@ void partition_cancel_cb(Fl_Widget *widget, void *data) // Select groups to display void partition_select_groups_cb(Fl_Widget *widget, void *data) { - PartitionDialog *dlg = static_cast<PartitionDialog*>(data); + PartitionDialog *dlg = static_cast<PartitionDialog *>(data); // If this callback was made by the "Advanced" toggle buttons, set the label - if(dlg->toggleButtonAdvMetis == widget){ - dlg->toggleButtonAdvMetis->label - ((dlg->toggleButtonAdvMetis->value()) ? "Advanced @-28->" : "Advanced @-22->"); + if(dlg->toggleButtonAdvMetis == widget) { + dlg->toggleButtonAdvMetis->label((dlg->toggleButtonAdvMetis->value()) ? + "Advanced @-28->" : + "Advanced @-22->"); } // Get the groups @@ -177,11 +179,11 @@ void partition_select_groups_cb(Fl_Widget *widget, void *data) int y = g[0]->h(); g[1]->show(); y += g[1]->h(); - if(dlg->toggleButtonAdvMetis->value()){ + if(dlg->toggleButtonAdvMetis->value()) { g[2]->show(); y += g[2]->h(); } - else{ + else { g[2]->hide(); } @@ -189,12 +191,12 @@ void partition_select_groups_cb(Fl_Widget *widget, void *data) { int yG = y; g[3]->position(g[3]->x(), yG); - Fl_Widget *o = static_cast<Fl_Group*>(g[3])->child(0); + Fl_Widget *o = static_cast<Fl_Group *>(g[3])->child(0); o->position(o->x(), yG); yG += WB + o->h(); - o = static_cast<Fl_Group*>(g[3])->child(1); + o = static_cast<Fl_Group *>(g[3])->child(1); o->position(o->x(), yG); - o = static_cast<Fl_Group*>(g[3])->child(2); + o = static_cast<Fl_Group *>(g[3])->child(2); o->position(o->x(), yG); yG += WB + o->h(); } @@ -208,44 +210,33 @@ void partition_dialog() { static PartitionDialog dlg; - static Fl_Menu_Item partitionTypeMenu[] = { - {"Metis", 0, 0, 0}, - {0} - }; + static Fl_Menu_Item partitionTypeMenu[] = {{"Metis", 0, 0, 0}, {0}}; static Fl_Menu_Item metisAlgMenu[] = { - {"Recursive", 0, 0, 0}, - {"K-way", 0, 0, 0}, - {0} - }; + {"Recursive", 0, 0, 0}, {"K-way", 0, 0, 0}, {0}}; static Fl_Menu_Item metisEdgeMatchingMenu[] = { - {"Random", 0, 0, 0}, - {"Sorted heavy-edge", 0, 0, 0}, - {0} - }; - - static Fl_Menu_Item metisRefineAlgMenu[] = { - {"FM-based cut", 0, 0, 0}, - {"Greedy", 0, 0, 0}, - {"Two-sided node FM", 0, 0, 0}, - {"One-sided node FM", 0, 0, 0}, - {0} - }; + {"Random", 0, 0, 0}, {"Sorted heavy-edge", 0, 0, 0}, {0}}; + + static Fl_Menu_Item metisRefineAlgMenu[] = {{"FM-based cut", 0, 0, 0}, + {"Greedy", 0, 0, 0}, + {"Two-sided node FM", 0, 0, 0}, + {"One-sided node FM", 0, 0, 0}, + {0}}; // This will be resized based on groups that are displayed const int h = 8 * WB + 5 * BH + 4; const int w = 3 * BB + IW + 3 * WB; // Window width int y = 0; - dlg.window = new paletteWindow - (w, h, CTX::instance()->nonModalWindows ? true : false, "Partition"); + dlg.window = new paletteWindow( + w, h, CTX::instance()->nonModalWindows ? true : false, "Partition"); dlg.window->box(GMSH_WINDOW_BOX); dlg.window->callback((Fl_Callback *)partition_cancel_cb, &dlg); // Main options group [0] { - const int GH = 3*BH + 2 + 5*WB; + const int GH = 3 * BH + 2 + 5 * WB; y += WB; Fl_Group *g = new Fl_Group(0, y, w, GH); // Partitioner @@ -261,8 +252,8 @@ void partition_dialog() } // Number of partitions { - Fl_Value_Input *const o = new Fl_Value_Input - (2*WB + 2*BB, y, IW, BH, "Number of\nPartitions"); + Fl_Value_Input *const o = + new Fl_Value_Input(2 * WB + 2 * BB, y, IW, BH, "Number of\nPartitions"); dlg.inputNumPartition = o; o->minimum(0); o->maximum(std::numeric_limits<unsigned short>::max()); @@ -273,24 +264,25 @@ void partition_dialog() y += BH + WB; // Booleans options { - Fl_Check_Button *const o = new Fl_Check_Button - (2*WB + 2*BB, y, 2*BB, BH, "Create ghost cells"); + Fl_Check_Button *const o = new Fl_Check_Button(2 * WB + 2 * BB, y, 2 * BB, + BH, "Create ghost cells"); dlg.setGhostCells = o; } { - Fl_Check_Button *const o = new Fl_Check_Button - (WB, y, 2*BB, BH, "Create partition topology"); + Fl_Check_Button *const o = + new Fl_Check_Button(WB, y, 2 * BB, BH, "Create partition topology"); dlg.setTopology = o; } y += BH + WB; { - Fl_Check_Button *const o = new Fl_Check_Button - (WB, y, 2*BB, BH, "Create physical groups"); + Fl_Check_Button *const o = + new Fl_Check_Button(WB, y, 2 * BB, BH, "Create physical groups"); dlg.setPhysical = o; } y += BH + WB; // Box (line) - { Fl_Box* o = new Fl_Box(WB, y, w - 2*WB, 2); + { + Fl_Box *o = new Fl_Box(WB, y, w - 2 * WB, 2); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); } @@ -307,15 +299,15 @@ void partition_dialog() Fl_Group *g = new Fl_Group(0, y, w, GH); // Algorithm { - Fl_Choice *const o = new Fl_Choice (WB, y, BB, BH, "Algorithm"); + Fl_Choice *const o = new Fl_Choice(WB, y, BB, BH, "Algorithm"); dlg.choiceMetisAlg = o; o->menu(metisAlgMenu); o->align(FL_ALIGN_RIGHT); } // Advanced Button { - Fl_Toggle_Button *const o = new Fl_Toggle_Button - (w - (WB + BB), y, BB, BH, "Advanced @-22->"); + Fl_Toggle_Button *const o = + new Fl_Toggle_Button(w - (WB + BB), y, BB, BH, "Advanced @-22->"); dlg.toggleButtonAdvMetis = o; o->callback((Fl_Callback *)partition_select_groups_cb, &dlg); } @@ -326,15 +318,15 @@ void partition_dialog() // Metis advanced option group [2] { - const int GH = 2 + WB + 3*(BH + WB) + 2; + const int GH = 2 + WB + 3 * (BH + WB) + 2; Fl_Group *g = new Fl_Group(0, y, w, GH); // Box (line) { - Fl_Box *const o = new Fl_Box(WB, y, w - 2*WB, 2); + Fl_Box *const o = new Fl_Box(WB, y, w - 2 * WB, 2); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); } - y += 2 + WB + 1; // +1 for multiline label + y += 2 + WB + 1; // +1 for multiline label // Edge matching algorithm { Fl_Choice *const o = new Fl_Choice(WB, y, BB, BH, "Edge matching"); @@ -344,8 +336,8 @@ void partition_dialog() } // Refinement algorithm { - Fl_Choice *const o = new Fl_Choice - (2*WB + 2*BB, y, BB, BH, "Refinement\nalgorithm"); + Fl_Choice *const o = + new Fl_Choice(2 * WB + 2 * BB, y, BB, BH, "Refinement\nalgorithm"); dlg.choiceRefineAlg = o; o->menu(metisRefineAlgMenu); o->align(FL_ALIGN_RIGHT); @@ -353,8 +345,8 @@ void partition_dialog() y += BH + WB + 1; // +1 for multiline label // element weights - line 1 { - Fl_Value_Input *const o = new Fl_Value_Input - (WB, y, 2*BB/3, BH, "Triangle"); + Fl_Value_Input *const o = + new Fl_Value_Input(WB, y, 2 * BB / 3, BH, "Triangle"); dlg.inputTriWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); @@ -362,8 +354,8 @@ void partition_dialog() o->align(FL_ALIGN_RIGHT); } { - Fl_Value_Input *const o = new Fl_Value_Input - (2*WB + (w/3-WB), y,2*BB/3, BH, "Tetrahedron"); + Fl_Value_Input *const o = new Fl_Value_Input( + 2 * WB + (w / 3 - WB), y, 2 * BB / 3, BH, "Tetrahedron"); dlg.inputTetWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); @@ -371,8 +363,8 @@ void partition_dialog() o->align(FL_ALIGN_RIGHT); } { - Fl_Value_Input *const o = new Fl_Value_Input - (3*WB + 2*(w/3-WB), y,2*BB/3, BH, "Prism"); + Fl_Value_Input *const o = new Fl_Value_Input(3 * WB + 2 * (w / 3 - WB), y, + 2 * BB / 3, BH, "Prism"); dlg.inputPriWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); @@ -382,8 +374,8 @@ void partition_dialog() y += 2 + WB + BH + 1; // element weights - line 2 { - Fl_Value_Input *const o = new Fl_Value_Input - (WB, y, 2*BB/3, BH, "Quadrangle"); + Fl_Value_Input *const o = + new Fl_Value_Input(WB, y, 2 * BB / 3, BH, "Quadrangle"); dlg.inputQuaWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); @@ -391,8 +383,8 @@ void partition_dialog() o->align(FL_ALIGN_RIGHT); } { - Fl_Value_Input *const o = new Fl_Value_Input - (2*WB + (w/3-WB), y,2*BB/3, BH, "Hexahedron"); + Fl_Value_Input *const o = new Fl_Value_Input( + 2 * WB + (w / 3 - WB), y, 2 * BB / 3, BH, "Hexahedron"); dlg.inputHexWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); @@ -400,40 +392,39 @@ void partition_dialog() o->align(FL_ALIGN_RIGHT); } { - Fl_Value_Input *const o = new Fl_Value_Input - (3*WB + 2*(w/3-WB), y,2*BB/3, BH, "Pyramid"); + Fl_Value_Input *const o = new Fl_Value_Input(3 * WB + 2 * (w / 3 - WB), y, + 2 * BB / 3, BH, "Pyramid"); dlg.inputPyrWeight = o; o->minimum(1); o->maximum(std::numeric_limits<int>::max()); o->step(1); o->align(FL_ALIGN_RIGHT); } - y += BH + WB + 1; // +1 for multiline label + y += BH + WB + 1; // +1 for multiline label g->end(); g->hide(); } // Dialog termination group [3] { - const int GH = 2 + BH + 2*WB; + const int GH = 2 + BH + 2 * WB; Fl_Group *g = new Fl_Group(0, y, w, GH); // Box (line) [0] { - Fl_Box *const o = new Fl_Box(WB, y, w - 2*WB, 2); + Fl_Box *const o = new Fl_Box(WB, y, w - 2 * WB, 2); o->box(FL_ENGRAVED_FRAME); o->labeltype(FL_NO_LABEL); } y += 2 + WB; // Defaults Button [1] { - Fl_Button *const o = new Fl_Button - (WB, y, BB, BH, "Defaults"); + Fl_Button *const o = new Fl_Button(WB, y, BB, BH, "Defaults"); o->callback((Fl_Callback *)partition_defaults_cb, &dlg); } // Partition Button [2] { - Fl_Return_Button *const o = new Fl_Return_Button - (w - (WB + BB), y, BB, BH, "Partition"); + Fl_Return_Button *const o = + new Fl_Return_Button(w - (WB + BB), y, BB, BH, "Partition"); o->callback((Fl_Callback *)partition_partition_cb, &dlg); } y += BH + WB; diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index 57d8620d86b0814e3b833f06b93f05a5881d5881..e4736e23e0ff06faa2517feef846ee4794b2c6c2 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -34,8 +34,8 @@ typedef unsigned long intptr_t; #include "OS.h" #define MAX_PLUGIN_OPTIONS 50 -class PluginDialogBox{ - public: +class PluginDialogBox { +public: Fl_Group *group; Fl_Value_Input *value[MAX_PLUGIN_OPTIONS]; Fl_Input *input[MAX_PLUGIN_OPTIONS]; @@ -48,15 +48,16 @@ void plugin_cb(Fl_Widget *w, void *data) static void plugin_input_value_cb(Fl_Widget *w, void *data) { - double (*f)(int, int, double) = (double (*)(int, int, double)) data; - Fl_Value_Input *input = (Fl_Value_Input*) w; + double (*f)(int, int, double) = (double (*)(int, int, double))data; + Fl_Value_Input *input = (Fl_Value_Input *)w; f(-1, 0, input->value()); } static void plugin_input_cb(Fl_Widget *w, void *data) { - std::string (*f)(int, int, std::string) = (std::string (*)(int, int, std::string)) data; - Fl_Input *input = (Fl_Input*) w; + std::string (*f)(int, int, std::string) = + (std::string(*)(int, int, std::string))data; + Fl_Input *input = (Fl_Input *)w; f(-1, 0, input->value()); } @@ -66,7 +67,7 @@ static void plugin_browser_cb(Fl_Widget *w, void *data) GMSH_Plugin *p = 0; for(int i = 1; i <= FlGui::instance()->plugins->browser->size(); i++) { if(FlGui::instance()->plugins->browser->selected(i)) { - p = (GMSH_Plugin*)FlGui::instance()->plugins->browser->data(i); + p = (GMSH_Plugin *)FlGui::instance()->plugins->browser->data(i); break; } } @@ -88,9 +89,10 @@ static void plugin_browser_cb(Fl_Widget *w, void *data) if(n > MAX_PLUGIN_OPTIONS) n = MAX_PLUGIN_OPTIONS; for(int i = 0; i < n; i++) { StringXNumber *sxn = p->getOption(i); - if(sxn->function){ - p->dialogBox->value[i]->callback(plugin_input_value_cb, (void*)sxn->function); - if(iView >= 0){ + if(sxn->function) { + p->dialogBox->value[i]->callback(plugin_input_value_cb, + (void *)sxn->function); + if(iView >= 0) { p->dialogBox->value[i]->step(sxn->function(iView, 1, 0.), 1); p->dialogBox->value[i]->minimum(sxn->function(iView, 2, 0.)); p->dialogBox->value[i]->maximum(sxn->function(iView, 3, 0.)); @@ -103,14 +105,15 @@ static void plugin_browser_cb(Fl_Widget *w, void *data) if(m > MAX_PLUGIN_OPTIONS) m = MAX_PLUGIN_OPTIONS; for(int i = 0; i < m; i++) { StringXString *sxs = p->getOptionStr(i); - if(sxs->function){ - p->dialogBox->input[i]->callback(plugin_input_cb, (void*)sxs->function); + if(sxs->function) { + p->dialogBox->input[i]->callback(plugin_input_cb, (void *)sxs->function); } } // hide all plugin groups except the selected one for(int i = 1; i <= FlGui::instance()->plugins->browser->size(); i++) - ((GMSH_Plugin*)FlGui::instance()->plugins->browser->data(i))->dialogBox->group->hide(); + ((GMSH_Plugin *)FlGui::instance()->plugins->browser->data(i)) + ->dialogBox->group->hide(); p->dialogBox->group->show(); } @@ -120,8 +123,8 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) std::string fileName; int oldIndex = -1; - if(view){ - for(int i = 0; i < p->getNbOptions(); i++){ + if(view) { + for(int i = 0; i < p->getNbOptions(); i++) { if(std::string(p->getOption(i)->str) == "View") { oldIndex = (int)(p->getOption(i)->def); p->getOption(i)->def = view->getIndex(); @@ -134,17 +137,17 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) fileName += ".opt"; FILE *fp = Fopen(fileName.c_str(), "a"); - if(!fp){ + if(!fp) { Msg::Error("Could not open file '%s'", fileName.c_str()); } - else{ + else { fprintf(fp, "%s", p->serialize().c_str()); fclose(fp); } - if(view && oldIndex != -1){ - for(int i = 0; i < p->getNbOptions(); i++){ - if(std::string(p->getOption(i)->str) == "View"){ + if(view && oldIndex != -1) { + for(int i = 0; i < p->getNbOptions(); i++) { + if(std::string(p->getOption(i)->str) == "View") { p->getOption(i)->def = oldIndex; } } @@ -153,7 +156,7 @@ static void add_scripting(GMSH_PostPlugin *p, PView *view) static void plugin_run_cb(Fl_Widget *w, void *data) { - GMSH_Plugin *p = (GMSH_Plugin*)data; + GMSH_Plugin *p = (GMSH_Plugin *)data; // get the values from the GUI int m = p->getNbOptionsStr(); @@ -169,41 +172,40 @@ static void plugin_run_cb(Fl_Widget *w, void *data) sxn->def = p->dialogBox->value[i]->value(); } - if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN){ - GMSH_PostPlugin *pp = (GMSH_PostPlugin*)p; + if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN) { + GMSH_PostPlugin *pp = (GMSH_PostPlugin *)p; // run on all selected views bool no_view_selected = true; for(int i = 1; i <= FlGui::instance()->plugins->view_browser->size(); i++) { if(FlGui::instance()->plugins->view_browser->selected(i)) { no_view_selected = false; - try{ - if(i - 1 >= 0 && i - 1 < (int)PView::list.size()){ + try { + if(i - 1 >= 0 && i - 1 < (int)PView::list.size()) { PView *view = PView::list[i - 1]; if(view->getData()->isRemote()) pp->executeRemote(view); - else{ + else { pp->execute(view); add_scripting(pp, view); } } - else{ + else { pp->execute(0); add_scripting(pp, 0); } - } - catch(GMSH_Plugin * err) { + } catch(GMSH_Plugin *err) { char tmp[256]; pp->catchErrorMessage(tmp); Msg::Warning("%s", tmp); } } } - if(no_view_selected){ + if(no_view_selected) { pp->execute(0); add_scripting(pp, 0); } } - else{ + else { p->run(); } @@ -212,8 +214,8 @@ static void plugin_run_cb(Fl_Widget *w, void *data) drawContext::global()->draw(); } -void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, - int width, int height) +void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, int width, + int height) { p->dialogBox = new PluginDialogBox; p->dialogBox->group = new Fl_Group(x, y, width, height); @@ -222,8 +224,8 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, title->labelfont(FL_BOLD); title->labelsize(FL_NORMAL_SIZE + 3); title->align(FL_ALIGN_INSIDE); - Fl_Box *help = new Fl_Box - (x, y + BH, width, BH + WB, strdup(p->getShortHelp().c_str())); + Fl_Box *help = + new Fl_Box(x, y + BH, width, BH + WB, strdup(p->getShortHelp().c_str())); help->align(FL_ALIGN_WRAP | FL_ALIGN_CLIP | FL_ALIGN_TOP | FL_ALIGN_INSIDE); int top = 2 * BH + WB; @@ -231,11 +233,11 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, { Fl_Tabs *o = new Fl_Tabs(x, y + top, width, height - top); { - Fl_Group *g = new Fl_Group - (x, y + top + BH, width, height - top - BH, "Options"); + Fl_Group *g = + new Fl_Group(x, y + top + BH, width, height - top - BH, "Options"); - Fl_Scroll *s = new Fl_Scroll - (x + WB, y + top + BH + WB, width - 2 * WB, height - top - 2 * BH - 3 * WB); + Fl_Scroll *s = new Fl_Scroll(x + WB, y + top + BH + WB, width - 2 * WB, + height - top - 2 * BH - 3 * WB); int m = p->getNbOptionsStr(); if(m > MAX_PLUGIN_OPTIONS) m = MAX_PLUGIN_OPTIONS; @@ -246,16 +248,16 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, int k = 0; for(int i = 0; i < m; i++) { StringXString *sxs = p->getOptionStr(i); - p->dialogBox->input[i] = new Fl_Input - (x + WB, y + top + (k + 1) * BH + WB, IW, BH, sxs->str); + p->dialogBox->input[i] = + new Fl_Input(x + WB, y + top + (k + 1) * BH + WB, IW, BH, sxs->str); p->dialogBox->input[i]->align(FL_ALIGN_RIGHT); p->dialogBox->input[i]->value(sxs->def.c_str()); k++; } for(int i = 0; i < n; i++) { StringXNumber *sxn = p->getOption(i); - p->dialogBox->value[i] = new Fl_Value_Input - (x + WB, y + top + (k + 1) * BH + WB, IW, BH, sxn->str); + p->dialogBox->value[i] = new Fl_Value_Input( + x + WB, y + top + (k + 1) * BH + WB, IW, BH, sxn->str); p->dialogBox->value[i]->align(FL_ALIGN_RIGHT); p->dialogBox->value[i]->value(sxn->def); k++; @@ -263,20 +265,21 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, s->end(); - Fl_Return_Button *run = new Fl_Return_Button - (x + width - BB - WB, y + height - BH - WB, BB, BH, "Run"); - run->callback(plugin_run_cb, (void*)p); + Fl_Return_Button *run = new Fl_Return_Button( + x + width - BB - WB, y + height - BH - WB, BB, BH, "Run"); + run->callback(plugin_run_cb, (void *)p); g->resizable(new Fl_Box(x + 2 * WB, y + top + 2 * BH, 1, 1)); g->end(); o->resizable(g); } { - Fl_Group *g = new Fl_Group - (x, y + top + BH, width, height - top - BH, "Help"); + Fl_Group *g = + new Fl_Group(x, y + top + BH, width, height - top - BH, "Help"); - Fl_Help_View *o = new Fl_Help_View - (x + WB, y + top + BH + WB, width - 2 * WB, height - top - 2 * BH - 3 * WB); + Fl_Help_View *o = + new Fl_Help_View(x + WB, y + top + BH + WB, width - 2 * WB, + height - top - 2 * BH - 3 * WB); std::string help = p->getHelp(); ConvertToHTML(help); help += std::string("<p><em>Author(s): ") + p->getAuthor() + "</em>"; @@ -302,29 +305,34 @@ pluginWindow::pluginWindow(int deltaFontSize) int height0 = 12 * BH + 4 * WB; int L1 = 13 * FL_NORMAL_SIZE, L2 = 6 * FL_NORMAL_SIZE; - int width = (CTX::instance()->pluginSize[0] < width0) ? width0 : - CTX::instance()->pluginSize[0]; - int height = (CTX::instance()->pluginSize[1] < height0) ? height0 : - CTX::instance()->pluginSize[1]; + int width = (CTX::instance()->pluginSize[0] < width0) ? + width0 : + CTX::instance()->pluginSize[0]; + int height = (CTX::instance()->pluginSize[1] < height0) ? + height0 : + CTX::instance()->pluginSize[1]; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Plugins"); + win = new paletteWindow( + width, height, CTX::instance()->nonModalWindows ? true : false, "Plugins"); win->box(GMSH_WINDOW_BOX); browser = new Fl_Hold_Browser(0, 0, L1, height); browser->callback(plugin_browser_cb); browser->box(GMSH_SIMPLE_RIGHT_BOX); browser->has_scrollbar(Fl_Browser_::VERTICAL); - browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars view_browser = new Fl_Multi_Browser(L1, 0, L2, height); view_browser->has_scrollbar(Fl_Browser_::VERTICAL); - view_browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + view_browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars view_browser->callback(plugin_browser_cb); view_browser->box(GMSH_SIMPLE_RIGHT_BOX); - for(std::map<std::string, GMSH_Plugin*>::iterator it = PluginManager:: - instance()->begin(); it != PluginManager::instance()->end(); ++it) { + for(std::map<std::string, GMSH_Plugin *>::iterator it = + PluginManager::instance()->begin(); + it != PluginManager::instance()->end(); ++it) { GMSH_Plugin *p = it->second; if(p->getType() == GMSH_Plugin::GMSH_POST_PLUGIN || p->getType() == GMSH_Plugin::GMSH_MESH_PLUGIN) { @@ -332,22 +340,24 @@ pluginWindow::pluginWindow(int deltaFontSize) _createDialogBox(p, L1 + L2 + WB, WB, width - L1 - L2 - 2 * WB, height - 2 * WB); // select first plugin by default - if(it == PluginManager::instance()->begin()){ + if(it == PluginManager::instance()->begin()) { browser->select(1); p->dialogBox->group->show(); } } } - record = new Fl_Check_Button - (L1 + L2 + 2 * WB, height - BH - 2 * WB, BB, BH, "Record"); + record = new Fl_Check_Button(L1 + L2 + 2 * WB, height - BH - 2 * WB, BB, BH, + "Record"); record->type(FL_TOGGLE_BUTTON); - record->tooltip("Append scripting command to file options when plugin is run"); + record->tooltip( + "Append scripting command to file options when plugin is run"); win->resizable(new Fl_Box(L1 + L2 + 2 * BH, height - 4 * BH, 10, 10)); win->size_range(width0, height0); - win->position(CTX::instance()->pluginPosition[0], CTX::instance()->pluginPosition[1]); + win->position(CTX::instance()->pluginPosition[0], + CTX::instance()->pluginPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -356,7 +366,7 @@ pluginWindow::pluginWindow(int deltaFontSize) void pluginWindow::show(int viewIndex) { resetViewBrowser(); - if(viewIndex >= 0 && viewIndex < (int)PView::list.size()){ + if(viewIndex >= 0 && viewIndex < (int)PView::list.size()) { view_browser->deselect(); view_browser->select(viewIndex + 1); plugin_browser_cb(NULL, NULL); @@ -368,7 +378,7 @@ void pluginWindow::resetViewBrowser() { // save selected state std::vector<int> state; - for(int i = 0; i < view_browser->size(); i++){ + for(int i = 0; i < view_browser->size(); i++) { if(view_browser->selected(i + 1)) state.push_back(1); else @@ -378,18 +388,17 @@ void pluginWindow::resetViewBrowser() char str[128]; view_browser->clear(); - if(PView::list.size()){ + if(PView::list.size()) { view_browser->activate(); for(unsigned int i = 0; i < PView::list.size(); i++) { sprintf(str, "View [%d]", i); view_browser->add(str); } - for(int i = 0; i < view_browser->size(); i++){ - if(i < (int)state.size() && state[i]) - view_browser->select(i + 1); + for(int i = 0; i < view_browser->size(); i++) { + if(i < (int)state.size() && state[i]) view_browser->select(i + 1); } } - else{ + else { view_browser->add("No Views"); view_browser->deactivate(); } diff --git a/Fltk/pluginWindow.h b/Fltk/pluginWindow.h index 48c48b752d150f0fff78e85200c12bb0aa7f8348..f2a7101272a25f1eaa776fb85e51e0f7b492828d 100644 --- a/Fltk/pluginWindow.h +++ b/Fltk/pluginWindow.h @@ -13,15 +13,16 @@ class GMSH_Plugin; -class pluginWindow{ - public: +class pluginWindow { +public: Fl_Window *win; Fl_Hold_Browser *browser; Fl_Multi_Browser *view_browser; Fl_Check_Button *record; void _createDialogBox(GMSH_Plugin *p, int x, int y, int width, int height); - public: - pluginWindow(int deltaFontSize=0); + +public: + pluginWindow(int deltaFontSize = 0); void show(int viewIndex); void resetViewBrowser(); }; diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index 5f0bab8fef3b2ffc13edc10717255f4d0b6319ea..78602d4f033361f75ee54081ea72a8b290a579c5 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -43,34 +43,40 @@ static fourierProjectionFace *createProjectionFaceFromName(const char *name) if(!strcmp(name, "plane")) f = new fourierProjectionFace(m, tag, new FM::PlaneProjectionSurface(tag)); else if(!strcmp(name, "trapezoid")) - f = new fourierProjectionFace(m, tag, new FM::TrapezoidProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, + new FM::TrapezoidProjectionSurface(tag)); else if(!strcmp(name, "sphere")) - f = new fourierProjectionFace(m, tag, new FM::SphericalProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, + new FM::SphericalProjectionSurface(tag)); else if(!strcmp(name, "paraboloid")) - f = new fourierProjectionFace(m, tag, new FM::ParaboloidProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, + new FM::ParaboloidProjectionSurface(tag)); else if(!strcmp(name, "cylinder")) - f = new fourierProjectionFace(m, tag, new FM::CylindricalProjectionSurface(tag)); + f = new fourierProjectionFace(m, tag, + new FM::CylindricalProjectionSurface(tag)); else if(!strcmp(name, "revolvedParabola")) - f = new fourierProjectionFace(m, tag, new FM::RevolvedParabolaProjectionSurface(tag)); + f = new fourierProjectionFace( + m, tag, new FM::RevolvedParabolaProjectionSurface(tag)); else if(!strcmp(name, "translatedParabola")) - f = new fourierProjectionFace(m, tag, new FM::TranslatedParabolaProjectionSurface(tag)); + f = new fourierProjectionFace( + m, tag, new FM::TranslatedParabolaProjectionSurface(tag)); else Msg::Error("Unknown projection face `%s'", name); - if(f){ + if(f) { f->setVisibility(false); m->add(f); } return f; } -static void project_point(FM::ProjectionSurface *ps, double x, double y, double z, - std::vector<double> &u, std::vector<double> &v, - std::vector<double> &dist, +static void project_point(FM::ProjectionSurface *ps, double x, double y, + double z, std::vector<double> &u, + std::vector<double> &v, std::vector<double> &dist, std::vector<std::complex<double> > &f) { double uu, vv, p[3], n[3]; ps->OrthoProjectionOnSurface(x, y, z, uu, vv); - if(uu >= 0. && uu <= 1. && vv >= 0. && vv <= 1.){ + if(uu >= 0. && uu <= 1. && vv >= 0. && vv <= 1.) { ps->F(uu, vv, p[0], p[1], p[2]); ps->GetUnitNormal(uu, vv, n[0], n[1], n[2]); double dx = x - p[0], dy = y - p[1], dz = z - p[2]; @@ -81,7 +87,8 @@ static void project_point(FM::ProjectionSurface *ps, double x, double y, double } } -static void getTangents(const SVector3 n, SVector3 &t1, SVector3 &t2, const double angle) +static void getTangents(const SVector3 n, SVector3 &t1, SVector3 &t2, + const double angle) { SVector3 ex(0., 0., 0.); if(n[0] == 0.) @@ -96,13 +103,13 @@ static void getTangents(const SVector3 n, SVector3 &t1, SVector3 &t2, const doub b.normalize(); double x = n[0], y = n[1], z = n[2]; double c = cos(angle * M_PI / 180.), s = sin(angle * M_PI / 180.); - double rot[3][3] = - {{x * x * (1-c) + c , x * y * (1-c) - z * s, x * z * (1-c) + y * s}, - {y * x * (1-c) + z * s, y * y * (1-c) + c , y * z * (1-c) - x * s}, - {x * z * (1-c) - y * s, y * z * (1-c) + x * s, z * z * (1-c) + c }}; - for(int i = 0; i < 3; i++){ + double rot[3][3] = { + {x * x * (1 - c) + c, x * y * (1 - c) - z * s, x * z * (1 - c) + y * s}, + {y * x * (1 - c) + z * s, y * y * (1 - c) + c, y * z * (1 - c) - x * s}, + {x * z * (1 - c) - y * s, y * z * (1 - c) + x * s, z * z * (1 - c) + c}}; + for(int i = 0; i < 3; i++) { t1[i] = t2[i] = 0.; - for(int j = 0; j < 3; j++){ + for(int j = 0; j < 3; j++) { t1[i] += rot[i][j] * a[j]; t2[i] += rot[i][j] * b[j]; } @@ -111,18 +118,17 @@ static void getTangents(const SVector3 n, SVector3 &t1, SVector3 &t2, const doub static void update_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; // get all parameters from GUI and modify projection surface accordingly projection *p = e->getCurrentProjection(); - if(p){ - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - ps->SetOrigin(p->parameters[0]->value(), - p->parameters[1]->value(), + if(p) { + FM::ProjectionSurface *ps = + (FM::ProjectionSurface *)p->face->getNativePtr(); + ps->SetOrigin(p->parameters[0]->value(), p->parameters[1]->value(), p->parameters[2]->value()); - SVector3 n(p->parameters[3]->value(), - p->parameters[4]->value(), + SVector3 n(p->parameters[3]->value(), p->parameters[4]->value(), p->parameters[5]->value()); if(!n.normalize()) n[2] = 1.; SVector3 t1, t2; @@ -130,10 +136,9 @@ static void update_cb(Fl_Widget *w, void *data) ps->SetE0(n[0], n[1], n[2]); ps->SetE1(t1[0], t1[1], t1[2]); ps->SetE2(t2[0], t2[1], t2[2]); - ps->SetScale(p->parameters[7]->value(), - p->parameters[8]->value(), + ps->SetScale(p->parameters[7]->value(), p->parameters[8]->value(), p->parameters[9]->value()); - for (int i = 0; i < ps->GetNumParameters(); i++) + for(int i = 0; i < ps->GetNumParameters(); i++) ps->SetParameter(i, p->parameters[i + 10]->value()); p->face->buildSTLTriangulation(); @@ -141,23 +146,24 @@ static void update_cb(Fl_Widget *w, void *data) // project selected points and elements and update u,v display std::vector<double> u, v, dist; std::vector<std::complex<double> > f; - std::vector<GEntity*> &ent(e->getEntities()); - for(unsigned int i = 0; i < ent.size(); i++){ - if(ent[i]->getSelection()){ - GVertex *gv = dynamic_cast<GVertex*>(ent[i]); + std::vector<GEntity *> &ent(e->getEntities()); + for(unsigned int i = 0; i < ent.size(); i++) { + if(ent[i]->getSelection()) { + GVertex *gv = dynamic_cast<GVertex *>(ent[i]); if(!gv) Msg::Error("Problem in point selection processing"); else project_point(ps, gv->x(), gv->y(), gv->z(), u, v, dist, f); } } - std::vector<MElement*> &ele(e->getElements()); - std::set<MVertex*> verts; + std::vector<MElement *> &ele(e->getElements()); + std::set<MVertex *> verts; for(unsigned int i = 0; i < ele.size(); i++) if(ele[i]->getVisibility() == 2) for(int j = 0; j < ele[i]->getNumVertices(); j++) verts.insert(ele[i]->getVertex(j)); - for(std::set<MVertex*>::iterator it = verts.begin(); it != verts.end(); it++) + for(std::set<MVertex *>::iterator it = verts.begin(); it != verts.end(); + it++) project_point(ps, (*it)->x(), (*it)->y(), (*it)->z(), u, v, dist, f); e->uv()->set(u, v, dist, f); } @@ -167,16 +173,16 @@ static void update_cb(Fl_Widget *w, void *data) static void browse_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; - std::vector<projection*> &projections(e->getProjections()); - for(unsigned int i = 0; i < projections.size(); i++){ + std::vector<projection *> &projections(e->getProjections()); + for(unsigned int i = 0; i < projections.size(); i++) { projections[i]->face->setVisibility(false); projections[i]->group->hide(); } projection *p = e->getCurrentProjection(); - if(p){ + if(p) { p->face->setVisibility(true); p->group->show(); } @@ -186,9 +192,9 @@ static void browse_cb(Fl_Widget *w, void *data) static void invert_normal_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ + if(p) { p->parameters[3]->value(-p->parameters[3]->value()); p->parameters[4]->value(-p->parameters[4]->value()); p->parameters[5]->value(-p->parameters[5]->value()); @@ -198,12 +204,12 @@ static void invert_normal_cb(Fl_Widget *w, void *data) static void translate(void *data, int axis, bool plus) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - SVector3 origin(p->parameters[0]->value(), - p->parameters[1]->value(), + if(p) { + FM::ProjectionSurface *ps = + (FM::ProjectionSurface *)p->face->getNativePtr(); + SVector3 origin(p->parameters[0]->value(), p->parameters[1]->value(), p->parameters[2]->value()); SVector3 vec; if(axis == 0) @@ -223,31 +229,49 @@ static void translate(void *data, int axis, bool plus) } } -static void translate_p0_cb(Fl_Widget *w, void *data){ translate(data, 0, true); } -static void translate_p1_cb(Fl_Widget *w, void *data){ translate(data, 1, true); } -static void translate_p2_cb(Fl_Widget *w, void *data){ translate(data, 2, true); } -static void translate_m0_cb(Fl_Widget *w, void *data){ translate(data, 0, false); } -static void translate_m1_cb(Fl_Widget *w, void *data){ translate(data, 1, false); } -static void translate_m2_cb(Fl_Widget *w, void *data){ translate(data, 2, false); } +static void translate_p0_cb(Fl_Widget *w, void *data) +{ + translate(data, 0, true); +} +static void translate_p1_cb(Fl_Widget *w, void *data) +{ + translate(data, 1, true); +} +static void translate_p2_cb(Fl_Widget *w, void *data) +{ + translate(data, 2, true); +} +static void translate_m0_cb(Fl_Widget *w, void *data) +{ + translate(data, 0, false); +} +static void translate_m1_cb(Fl_Widget *w, void *data) +{ + translate(data, 1, false); +} +static void translate_m2_cb(Fl_Widget *w, void *data) +{ + translate(data, 2, false); +} static void set_position_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ + if(p) { char ib = FlGui::instance()->selectEntity(ENT_ALL); - if(ib == 'l'){ - if(FlGui::instance()->selectedVertices.size()){ + if(ib == 'l') { + if(FlGui::instance()->selectedVertices.size()) { p->parameters[0]->value(FlGui::instance()->selectedVertices[0]->x()); p->parameters[1]->value(FlGui::instance()->selectedVertices[0]->y()); p->parameters[2]->value(FlGui::instance()->selectedVertices[0]->z()); } - else if(FlGui::instance()->selectedElements.size()){ + else if(FlGui::instance()->selectedElements.size()) { SPoint3 pc = FlGui::instance()->selectedElements[0]->barycenter(); p->parameters[0]->value(pc.x()); p->parameters[1]->value(pc.y()); p->parameters[2]->value(pc.z()); - if(FlGui::instance()->selectedElements[0]->getNumFaces()){ + if(FlGui::instance()->selectedElements[0]->getNumFaces()) { MFace f = FlGui::instance()->selectedElements[0]->getFace(0); SVector3 n = f.normal(); p->parameters[3]->value(n[0]); @@ -256,27 +280,36 @@ static void set_position_cb(Fl_Widget *w, void *data) } } } - ((Fl_Toggle_Button*)w)->value(0); + ((Fl_Toggle_Button *)w)->value(0); update_cb(0, data); } } static void select_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; int what = e->getSelectionMode(); const char *str; - switch(what){ - case ENT_ALL: CTX::instance()->pickElements = 1; str = "Elements"; break; - case ENT_POINT: CTX::instance()->pickElements = 0; str = "Points"; break; - case ENT_SURFACE: CTX::instance()->pickElements = 0; str = "Surfaces"; break; + switch(what) { + case ENT_ALL: + CTX::instance()->pickElements = 1; + str = "Elements"; + break; + case ENT_POINT: + CTX::instance()->pickElements = 0; + str = "Points"; + break; + case ENT_SURFACE: + CTX::instance()->pickElements = 0; + str = "Surfaces"; + break; default: return; } - std::vector<MElement*> &ele(e->getElements()); - std::vector<GEntity*> &ent(e->getEntities()); + std::vector<MElement *> &ele(e->getElements()); + std::vector<GEntity *> &ent(e->getEntities()); while(1) { CTX::instance()->mesh.changed = ENT_ALL; @@ -284,30 +317,35 @@ static void select_cb(Fl_Widget *w, void *data) if(ele.size() || ent.size()) Msg::StatusGl("Select %s\n[Press 'e' to end selection, 'u' to undo" - "last selection or 'q' to abort]", str); + "last selection or 'q' to abort]", + str); else Msg::StatusGl("Select %s\n" - "[Press 'e' to end selection or 'q' to abort]", str); + "[Press 'e' to end selection or 'q' to abort]", + str); char ib = FlGui::instance()->selectEntity(what); if(ib == 'l') { - if(CTX::instance()->pickElements){ - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++){ - if(FlGui::instance()->selectedElements[i]->getVisibility() != 2){ + if(CTX::instance()->pickElements) { + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) { + if(FlGui::instance()->selectedElements[i]->getVisibility() != 2) { FlGui::instance()->selectedElements[i]->setVisibility(2); ele.push_back(FlGui::instance()->selectedElements[i]); } } } - else{ - for(unsigned int i = 0; i < FlGui::instance()->selectedVertices.size(); i++){ - if(FlGui::instance()->selectedVertices[i]->getSelection() != 1){ + else { + for(unsigned int i = 0; i < FlGui::instance()->selectedVertices.size(); + i++) { + if(FlGui::instance()->selectedVertices[i]->getSelection() != 1) { FlGui::instance()->selectedVertices[i]->setSelection(1); ent.push_back(FlGui::instance()->selectedVertices[i]); } } - for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); i++){ - if(FlGui::instance()->selectedFaces[i]->getSelection() != 1){ + for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); + i++) { + if(FlGui::instance()->selectedFaces[i]->getSelection() != 1) { FlGui::instance()->selectedFaces[i]->setSelection(1); ent.push_back(FlGui::instance()->selectedFaces[i]); } @@ -315,26 +353,31 @@ static void select_cb(Fl_Widget *w, void *data) } } if(ib == 'r') { - if(CTX::instance()->pickElements){ - for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); i++) + if(CTX::instance()->pickElements) { + for(unsigned int i = 0; i < FlGui::instance()->selectedElements.size(); + i++) FlGui::instance()->selectedElements[i]->setVisibility(1); } - else{ - for(unsigned int i = 0; i < FlGui::instance()->selectedVertices.size(); i++) + else { + for(unsigned int i = 0; i < FlGui::instance()->selectedVertices.size(); + i++) FlGui::instance()->selectedVertices[i]->setSelection(0); - for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); i++) + for(unsigned int i = 0; i < FlGui::instance()->selectedFaces.size(); + i++) FlGui::instance()->selectedFaces[i]->setSelection(0); } } if(ib == 'u') { - if(CTX::instance()->pickElements){ - if(ele.size()){ - ele[ele.size() - 1]->setVisibility(1); ele.pop_back(); + if(CTX::instance()->pickElements) { + if(ele.size()) { + ele[ele.size() - 1]->setVisibility(1); + ele.pop_back(); } } - else{ - if(ent.size()){ - ent[ent.size() - 1]->setSelection(0); ent.pop_back(); + else { + if(ent.size()) { + ent[ent.size() - 1]->setSelection(0); + ent.pop_back(); } } } @@ -360,17 +403,18 @@ static void select_cb(Fl_Widget *w, void *data) static void filter_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ + if(p) { SBoundingBox3d bbox = GModel::current()->bounds(); double lc = norm(SVector3(bbox.max(), bbox.min())); double threshold = e->getThreshold() * lc; - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - std::vector<GEntity*> &ent(e->getEntities()); - for(unsigned int i = 0; i < ent.size(); i++){ - GVertex *gv = dynamic_cast<GVertex*>(ent[i]); - if(gv){ + FM::ProjectionSurface *ps = + (FM::ProjectionSurface *)p->face->getNativePtr(); + std::vector<GEntity *> &ent(e->getEntities()); + for(unsigned int i = 0; i < ent.size(); i++) { + GVertex *gv = dynamic_cast<GVertex *>(ent[i]); + if(gv) { double uu, vv, p[3]; ps->OrthoProjectionOnSurface(gv->x(), gv->y(), gv->z(), uu, vv); ps->F(uu, vv, p[0], p[1], p[2]); @@ -382,19 +426,19 @@ static void filter_cb(Fl_Widget *w, void *data) gv->setSelection(false); } } - std::vector<MElement*> &ele(e->getElements()); - for(unsigned int i = 0; i < ele.size(); i++){ + std::vector<MElement *> &ele(e->getElements()); + for(unsigned int i = 0; i < ele.size(); i++) { SPoint3 pc = ele[i]->barycenter(); double uu, vv, p[3]; ps->OrthoProjectionOnSurface(pc.x(), pc.y(), pc.z(), uu, vv); ps->F(uu, vv, p[0], p[1], p[2]); double dx = pc.x() - p[0], dy = pc.y() - p[1], dz = pc.z() - p[2]; if(uu >= 0. && uu <= 1. && vv >= 0. && vv < 1. && - sqrt(dx * dx + dy * dy + dz * dz) < threshold){ + sqrt(dx * dx + dy * dy + dz * dz) < threshold) { ele[i]->setVisibility(2); // keep only the elements oriented in the same direction as // the projection surface - if(e->getOrientation() && ele[i]->getNumFaces()){ + if(e->getOrientation() && ele[i]->getNumFaces()) { MFace f = ele[i]->getFace(0); SVector3 n = f.normal(), n2; ps->GetNormal(uu, vv, n2[0], n2[1], n2[2]); @@ -418,38 +462,38 @@ static void proj_hide_cb(Fl_Widget *w, void *data) static void save_selection_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; - if(fileChooser(FILE_CHOOSER_CREATE, "Save Selection", "*.{geo,msh}")){ + projectionEditor *e = (projectionEditor *)data; + if(fileChooser(FILE_CHOOSER_CREATE, "Save Selection", "*.{geo,msh}")) { FILE *fp = Fopen(fileChooserGetName(1).c_str(), "w"); - if(!fp){ + if(!fp) { Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } - std::vector<GEntity*> &ent(e->getEntities()); - for(unsigned int i = 0; i < ent.size(); i++){ - GVertex *gv = dynamic_cast<GVertex*>(ent[i]); + std::vector<GEntity *> &ent(e->getEntities()); + for(unsigned int i = 0; i < ent.size(); i++) { + GVertex *gv = dynamic_cast<GVertex *>(ent[i]); if(gv && gv->getSelection()) - fprintf(fp, "Point(%d) = {%.16g,%.16g,%.16g,1};\n", gv->tag(), - gv->x(), gv->y(), gv->z()); + fprintf(fp, "Point(%d) = {%.16g,%.16g,%.16g,1};\n", gv->tag(), gv->x(), + gv->y(), gv->z()); } - std::vector<MElement*> &ele(e->getElements()); - if(ele.size()){ + std::vector<MElement *> &ele(e->getElements()); + if(ele.size()) { int nelm = 0; - std::set<MVertex*> verts; - for(unsigned int i = 0; i < ele.size(); i++){ - if(ele[i]->getVisibility() == 2){ + std::set<MVertex *> verts; + for(unsigned int i = 0; i < ele.size(); i++) { + if(ele[i]->getVisibility() == 2) { nelm++; for(int j = 0; j < ele[i]->getNumVertices(); j++) verts.insert(ele[i]->getVertex(j)); } } fprintf(fp, "$NOD\n%d\n", (int)verts.size()); - for(std::set<MVertex*>::iterator it = verts.begin(); it != verts.end(); it++) + for(std::set<MVertex *>::iterator it = verts.begin(); it != verts.end(); + it++) (*it)->writeMSH(fp); fprintf(fp, "$ENDNOD\n$ELM\n%d\n", nelm); for(unsigned int i = 0; i < ele.size(); i++) - if(ele[i]->getVisibility() == 2) - ele[i]->writeMSH(fp, 1.0); + if(ele[i]->getVisibility() == 2) ele[i]->writeMSH(fp, 1.0); fprintf(fp, "$ENDELM\n"); } fclose(fp); @@ -458,34 +502,34 @@ static void save_selection_cb(Fl_Widget *w, void *data) static void load_projection_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; - if(fileChooser(FILE_CHOOSER_SINGLE, "Load Projection", "*.pro")){ + projectionEditor *e = (projectionEditor *)data; + if(fileChooser(FILE_CHOOSER_SINGLE, "Load Projection", "*.pro")) { FILE *fp = Fopen(fileChooserGetName(1).c_str(), "r"); - if(!fp){ + if(!fp) { Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } int num; - if(!fscanf(fp, "%d", &num)){ + if(!fscanf(fp, "%d", &num)) { Msg::Error("Bad projection file format"); fclose(fp); return; } - for(int proj = 0; proj < num; proj++){ + for(int proj = 0; proj < num; proj++) { char name[256], tag[256]; - if(!fscanf(fp, "%s", tag) || !fscanf(fp, "%s", name)){ + if(!fscanf(fp, "%s", tag) || !fscanf(fp, "%s", name)) { Msg::Error("Bad projection file format"); fclose(fp); return; } fourierProjectionFace *face = createProjectionFaceFromName(name); - if(face){ + if(face) { e->load(face, tag); projection *p = e->getLastProjection(); - if(p){ - for(unsigned int i = 0; i < p->parameters.size(); i++){ + if(p) { + for(unsigned int i = 0; i < p->parameters.size(); i++) { double val; - if(!fscanf(fp, "%lf", &val)){ + if(!fscanf(fp, "%lf", &val)) { Msg::Error("Missing paramater for projection `%s'", name); break; } @@ -501,18 +545,20 @@ static void load_projection_cb(Fl_Widget *w, void *data) static void save_projection_cb(Fl_Widget *w, void *data) { - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - if(fileChooser(FILE_CHOOSER_CREATE, "Save Projection", "*.pro")){ + if(p) { + FM::ProjectionSurface *ps = + (FM::ProjectionSurface *)p->face->getNativePtr(); + if(fileChooser(FILE_CHOOSER_CREATE, "Save Projection", "*.pro")) { std::string name = fileChooserGetName(1); FILE *fp = Fopen(name.c_str(), "w"); - if(!fp){ + if(!fp) { Msg::Error("Unable to open file `%s'", name.c_str()); return; } - fprintf(fp, "1\n%s\n%s\n", SplitFileName(name)[1].c_str(), ps->GetName().c_str()); + fprintf(fp, "1\n%s\n%s\n", SplitFileName(name)[1].c_str(), + ps->GetName().c_str()); for(unsigned int i = 0; i < p->parameters.size(); i++) fprintf(fp, "%.16g\n", p->parameters[i]->value()); fclose(fp); @@ -522,14 +568,14 @@ static void save_projection_cb(Fl_Widget *w, void *data) static void compute_cb(Fl_Widget *w, void *data) { - GModel* m = GModel::current(); + GModel *m = GModel::current(); - printf("ngroups = %d\n",m->getFMInternals()->current()->GetNumGroups()); + printf("ngroups = %d\n", m->getFMInternals()->current()->GetNumGroups()); - projectionEditor *e = (projectionEditor*)data; + projectionEditor *e = (projectionEditor *)data; projection *p = e->getCurrentProjection(); - if(p){ + if(p) { // get the projection data std::vector<double> u, v, dist; std::vector<std::complex<double> > f; @@ -539,7 +585,7 @@ static void compute_cb(Fl_Widget *w, void *data) int uModes = e->getMode(0); int vModes = e->getMode(1); - if((int)f.size() < uModes * vModes){ + if((int)f.size() < uModes * vModes) { Msg::Error("Number of points < uModes * vModes"); return; } @@ -551,71 +597,70 @@ static void compute_cb(Fl_Widget *w, void *data) int h2 = e->getHardEdge(2); int h3 = e->getHardEdge(3); - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)p->face->getNativePtr(); - if (e->getPatchType()) { + FM::ProjectionSurface *ps = + (FM::ProjectionSurface *)p->face->getNativePtr(); + if(e->getPatchType()) { // create the US-FFT/Windowing faces (with boundaries) - FM::Patch* patch = + FM::Patch *patch = new FM::WFPatch(0, ps->clone(), u, v, f, 3, uModes, vModes); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patch); - m->getFMInternals()->makeGFace(patch,m); - //makeGFace(patch); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patch); + m->getFMInternals()->makeGFace(patch, m); + // makeGFace(patch); } else { // create the Fourier faces (with boundaries) if(ps->IsUPeriodic()) { - FM::Patch* patchL = - new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, - uM, vM, h0, h1, h2, h3); + FM::Patch *patchL = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, + vModes, uM, vM, h0, h1, h2, h3); patchL->SetMinU(-0.35); patchL->SetMaxU(0.35); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patchL); - m->getFMInternals()->makeGFace(patchL,m); - //makeGFace(patchL); - FM::Patch* patchR = - new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, - uM, vM, h0, h1, h2, h3); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patchL); + m->getFMInternals()->makeGFace(patchL, m); + // makeGFace(patchL); + FM::Patch *patchR = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, + vModes, uM, vM, h0, h1, h2, h3); patchR->SetMinU(0.15); patchR->SetMaxU(0.85); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patchR); - m->getFMInternals()->makeGFace(patchR,m); - //makeGFace(patchR); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patchR); + m->getFMInternals()->makeGFace(patchR, m); + // makeGFace(patchR); } - else if (ps->IsVPeriodic()) { - FM::Patch* patchL = - new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, - uM, vM, h0, h1, h2, h3); + else if(ps->IsVPeriodic()) { + FM::Patch *patchL = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, + vModes, uM, vM, h0, h1, h2, h3); patchL->SetMinV(-0.35); patchL->SetMaxV(0.35); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patchL); - m->getFMInternals()->makeGFace(patchL,m); - //makeGFace(patchL); - FM::Patch* patchR = - new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, - uM, vM, h0, h1, h2, h3); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patchL); + m->getFMInternals()->makeGFace(patchL, m); + // makeGFace(patchL); + FM::Patch *patchR = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, + vModes, uM, vM, h0, h1, h2, h3); patchR->SetMinV(0.15); patchR->SetMaxV(0.85); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patchR); - m->getFMInternals()->makeGFace(patchR,m); - //makeGFace(patchR); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patchR); + m->getFMInternals()->makeGFace(patchR, m); + // makeGFace(patchR); } else { - FM::Patch* patch = - new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, - uM, vM, h0, h1, h2, h3); - m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()-> - AddPatch(patch); - m->getFMInternals()->makeGFace(patch,m); - //makeGFace(patch); + FM::Patch *patch = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, + vModes, uM, vM, h0, h1, h2, h3); + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->AddPatch( + patch); + m->getFMInternals()->makeGFace(patch, m); + // makeGFace(patch); } } } - printf("nPatches = %d\n",m->getFMInternals()->current()->GetGroup(0)-> - GetBlendGroup()->GetNumPatches()); + printf("nPatches = %d\n", m->getFMInternals() + ->current() + ->GetGroup(0) + ->GetBlendGroup() + ->GetNumPatches()); drawContext::global()->draw(); } @@ -626,12 +671,13 @@ static void delete_fourier(GFace *gf) GModel *m = GModel::current(); // don't actually delete the data so we can add `undo' later - std::list<GVertex*> vertices = gf->vertices(); - for(std::list<GVertex*>::iterator it = vertices.begin(); it != vertices.end(); it++) + std::list<GVertex *> vertices = gf->vertices(); + for(std::list<GVertex *>::iterator it = vertices.begin(); + it != vertices.end(); it++) m->remove(*it); - std::list<GEdge*> edges = gf->edges(); - for(std::list<GEdge*>::iterator it = edges.begin(); it != edges.end(); it++) + std::list<GEdge *> edges = gf->edges(); + for(std::list<GEdge *>::iterator it = edges.begin(); it != edges.end(); it++) m->remove(*it); m->remove(gf); @@ -641,66 +687,67 @@ static void blend_cb(Fl_Widget *w, void *data) { GModel *m = GModel::current(); - std::vector<GFace*> faces; - for (GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) - if ((*it)->getNativeType() == GEntity::FourierModel) - faces.push_back(*it); + std::vector<GFace *> faces; + for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) + if((*it)->getNativeType() == GEntity::FourierModel) faces.push_back(*it); m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->Blend(); - for (int i = 0; i < m->getFMInternals()->current()->GetGroup(0)-> - GetBlendGroup()->GetNumPatches(); i++) - m->getFMInternals()->makeGFace(m->getFMInternals()->current()-> - GetGroup(0)->GetBlendGroup()-> - GetPatch(i),m); - for (unsigned int i = 0; i < faces.size(); i++) { - //delete_fourier(faces[i]); + for(int i = 0; i < m->getFMInternals() + ->current() + ->GetGroup(0) + ->GetBlendGroup() + ->GetNumPatches(); + i++) + m->getFMInternals()->makeGFace( + m->getFMInternals()->current()->GetGroup(0)->GetBlendGroup()->GetPatch(i), + m); + for(unsigned int i = 0; i < faces.size(); i++) { + // delete_fourier(faces[i]); faces[i]->setVisibility(0, true); } } static void action_cb(Fl_Widget *w, void *data) { - std::string what((char*)data); - std::vector<GFace*> faces; + std::string what((char *)data); + std::vector<GFace *> faces; GModel *m = GModel::current(); - if(what == "delete_last" || what == "save_last"){ + if(what == "delete_last" || what == "save_last") { int id = -1; for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) if((*it)->getNativeType() == GEntity::FourierModel) id = std::max(id, (*it)->tag()); if(id > 0) faces.push_back(m->getFaceByTag(id)); } - else if(what == "delete_all" || what == "save_all"){ + else if(what == "delete_all" || what == "save_all") { for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) - if((*it)->getNativeType() == GEntity::FourierModel) - faces.push_back(*it); + if((*it)->getNativeType() == GEntity::FourierModel) faces.push_back(*it); } - else if(what == "delete_select" || what == "save_select"){ + else if(what == "delete_select" || what == "save_select") { Msg::StatusGl("Select Surface\n[Press 'e' to end selection 'q' to abort]"); char ib = FlGui::instance()->selectEntity(ENT_SURFACE); - if(ib == 'l') faces.insert(faces.end(), - FlGui::instance()->selectedFaces.begin(), - FlGui::instance()->selectedFaces.end()); + if(ib == 'l') + faces.insert(faces.end(), FlGui::instance()->selectedFaces.begin(), + FlGui::instance()->selectedFaces.end()); Msg::StatusGl(""); } - if(what[0] == 'd'){ - for(unsigned int i = 0; i < faces.size(); i++) - delete_fourier(faces[i]); + if(what[0] == 'd') { + for(unsigned int i = 0; i < faces.size(); i++) delete_fourier(faces[i]); } - else{ - if(fileChooser(FILE_CHOOSER_CREATE, "Save Fourier Model", "*.fm")){ + else { + if(fileChooser(FILE_CHOOSER_CREATE, "Save Fourier Model", "*.fm")) { FILE *fp = Fopen(fileChooserGetName(1).c_str(), "w"); - if(!fp){ + if(!fp) { Msg::Error("Unable to open file `%s'", fileChooserGetName(1).c_str()); return; } fprintf(fp, "%d\n", (int)faces.size()); - for(unsigned int i = 0; i < faces.size(); i++){ - fourierFace* ff = (fourierFace*)faces[i]; - ((FM::TopoFace*)ff->getNativePtr())->GetPatch()->Export(fp); + for(unsigned int i = 0; i < faces.size(); i++) { + fourierFace *ff = (fourierFace *)faces[i]; + ((FM::TopoFace *)ff->getNativePtr())->GetPatch()->Export(fp); } fclose(fp); } @@ -717,18 +764,19 @@ uvPlot::uvPlot(int x, int y, int w, int h, const char *l) } void uvPlot::set(std::vector<double> &u, std::vector<double> &v, - std::vector<double> &dist, std::vector<std::complex<double> > &f) + std::vector<double> &dist, + std::vector<std::complex<double> > &f) { _u = u; _v = v; _dist = dist; _f = f; - if(dist.empty()){ + if(dist.empty()) { _dmin = _dmax = 0.; } - else{ + else { _dmin = _dmax = dist[0]; - for(unsigned int i = 1; i < dist.size(); i++){ + for(unsigned int i = 1; i < dist.size(); i++) { _dmin = std::min(_dmin, dist[i]); _dmax = std::max(_dmax, dist[i]); } @@ -760,7 +808,7 @@ void uvPlot::draw() // projection surface int pw = w(); int ph = h() - (2 * FL_NORMAL_SIZE + 5); - for(unsigned int i = 0; i < _u.size(); i++){ + for(unsigned int i = 0; i < _u.size(); i++) { int x = (int)(_u[i] * pw); int y = (int)(_v[i] * ph); color(_dist[i]); @@ -768,7 +816,7 @@ void uvPlot::draw() } // draw color bar - for(int i = 0; i < w(); i++){ + for(int i = 0; i < w(); i++) { int index = (int)(i * (_colorTable.size - 1) / w()); unsigned int color = _colorTable.table[index]; int r = CTX::instance()->unpackRed(color); @@ -796,14 +844,14 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, { group = new Fl_Scroll(x, y, w, h); SBoundingBox3d bounds = GModel::current()->bounds(); - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)f->getNativePtr(); + FM::ProjectionSurface *ps = (FM::ProjectionSurface *)f->getNativePtr(); Fl_Toggle_Button *b = new Fl_Toggle_Button(x, y, bb, bh, "Set position"); b->callback(set_position_cb, e); { // origin is stored in parameters[0,1,2] SPoint3 pc = bounds.center(); - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { Fl_Value_Input *v = new Fl_Value_Input(x, y + (1 + i) * bh, bb, bh); parameters.push_back(v); v->maximum(bounds.max()[i] + 10. * CTX::instance()->lc); @@ -814,11 +862,11 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, } ps->SetOrigin(pc[0], pc[1], pc[2]); Fl_Repeat_Button *bm[3], *bp[3]; - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { new Fl_Box(x + w - bb / 3 - bb / 6, y + (1 + i) * bh, bb / 8, bh, (i == 0) ? "E0" : (i == 1) ? "E1" : "E2"); - bp[i] = new Fl_Repeat_Button(x + w - bb / 3, y + (1 + i) * bh, - bb / 8, bh / 2, "+"); + bp[i] = new Fl_Repeat_Button(x + w - bb / 3, y + (1 + i) * bh, bb / 8, + bh / 2, "+"); bm[i] = new Fl_Repeat_Button(x + w - bb / 3, y + (1 + i) * bh + bh / 2, bb / 8, bh / 2, "-"); } @@ -832,15 +880,26 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, { // normal is stored in parameters[3,4,5] Fl_Value_Input *v1 = new Fl_Value_Input(x, y + 4 * bh, bb / 3, bh); parameters.push_back(v1); - v1->maximum(1.); v1->minimum(-1.); v1->step(0.01); v1->value(0.); + v1->maximum(1.); + v1->minimum(-1.); + v1->step(0.01); + v1->value(0.); Fl_Value_Input *v2 = new Fl_Value_Input(x + bb / 3, y + 4 * bh, bb / 3, bh); parameters.push_back(v2); - v2->maximum(1.); v2->minimum(-1.); v2->step(0.01); v2->value(0.); - Fl_Value_Input *v3 = new Fl_Value_Input(x + 2 * bb / 3, y + 4 * bh, bb - 2 * bb / 3, bh); + v2->maximum(1.); + v2->minimum(-1.); + v2->step(0.01); + v2->value(0.); + Fl_Value_Input *v3 = + new Fl_Value_Input(x + 2 * bb / 3, y + 4 * bh, bb - 2 * bb / 3, bh); parameters.push_back(v3); - v3->maximum(1.); v3->minimum(-1.); v3->step(0.01); v3->value(1.); + v3->maximum(1.); + v3->minimum(-1.); + v3->step(0.01); + v3->value(1.); v3->label("Normal"); - Fl_Button *b = new Fl_Button(x + w - bb / 3, y + 4 * bh + bh / 4, bb / 8, bh / 2, "-"); + Fl_Button *b = + new Fl_Button(x + w - bb / 3, y + 4 * bh + bh / 4, bb / 8, bh / 2, "-"); b->callback(invert_normal_cb, e); b->tooltip("Invert normal"); } @@ -853,7 +912,7 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, parameters.push_back(v); } { // scale is stored in parameters[7,8,9] - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { Fl_Value_Input *v = new Fl_Value_Input(x, y + (6 + i) * bh, bb, bh); parameters.push_back(v); v->maximum(CTX::instance()->lc * 10.); @@ -865,7 +924,7 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, } // other parameters are stored in parameters[10,...] - for(int i = 0; i < ps->GetNumParameters(); i++){ + for(int i = 0; i < ps->GetNumParameters(); i++) { Fl_Value_Input *v = new Fl_Value_Input(x, y + (9 + i) * bh, bb, bh); v->maximum(10. * CTX::instance()->lc); v->minimum(-10. * CTX::instance()->lc); @@ -875,7 +934,7 @@ projection::projection(fourierProjectionFace *f, int x, int y, int w, int h, parameters.push_back(v); } - for(unsigned int i = 0; i < parameters.size(); i++){ + for(unsigned int i = 0; i < parameters.size(); i++) { parameters[i]->align(FL_ALIGN_RIGHT); parameters[i]->callback(update_cb, e); } @@ -890,37 +949,39 @@ projectionEditor::projectionEditor() // construct FM_Internals m->readFourier(); - printf("readerSize = %d\n",m->getFMInternals()->getSize()); - printf("currentSize = %d\n",m->getFMInternals()->current()->GetNumGroups()); + printf("readerSize = %d\n", m->getFMInternals()->getSize()); + printf("currentSize = %d\n", m->getFMInternals()->current()->GetNumGroups()); // construct GUI in terms of standard sizes const int width = (int)(3.75 * BB), height = 24 * BH; // create all widgets (we construct this once, we never deallocate!) - _window = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Reparameterize"); + _window = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Reparameterize"); new Fl_Box(WB, WB + BH / 2, BB / 2, BH, "Select:"); Fl_Group *o = new Fl_Group(WB, WB, 2 * BB, 3 * BH); _select[0] = new Fl_Round_Button(2 * WB + BB / 2, WB, BB, BH, "Points"); - _select[1] = new Fl_Round_Button(2 * WB + BB / 2, WB + BH, BB, BH, "Elements"); + _select[1] = + new Fl_Round_Button(2 * WB + BB / 2, WB + BH, BB, BH, "Elements"); if(m->getNumMeshElements()) _select[1]->value(1); else _select[0]->value(1); - for(int i = 0; i < 2; i++){ + for(int i = 0; i < 2; i++) { _select[i]->callback(select_cb, this); _select[i]->type(FL_RADIO_BUTTON); } o->end(); { - Fl_Toggle_Button *b1 = new Fl_Toggle_Button - (width - WB - 3 * BB / 2, WB, 3 * BB / 2, BH, "Hide unselected"); + Fl_Toggle_Button *b1 = new Fl_Toggle_Button( + width - WB - 3 * BB / 2, WB, 3 * BB / 2, BH, "Hide unselected"); b1->callback(proj_hide_cb); - Fl_Button *b2 = new Fl_Button - (width - WB - 3 * BB / 2, WB + BH, 3 * BB / 2, BH, "Save selection"); + Fl_Button *b2 = new Fl_Button(width - WB - 3 * BB / 2, WB + BH, 3 * BB / 2, + BH, "Save selection"); b2->callback(save_selection_cb, this); } @@ -939,7 +1000,8 @@ projectionEditor::projectionEditor() { Fl_Button *b1 = new Fl_Button(WB, 2 * WB + 8 * BH, brw / 2, BH, "Load"); b1->callback(load_projection_cb, this); - Fl_Button *b2 = new Fl_Button(WB + brw / 2, 2 * WB + 8 * BH, brw / 2, BH, "Save"); + Fl_Button *b2 = + new Fl_Button(WB + brw / 2, 2 * WB + 8 * BH, brw / 2, BH, "Save"); b2->callback(save_projection_cb, this); } @@ -947,14 +1009,12 @@ projectionEditor::projectionEditor() int uvw = width - 2 * WB - 2 * hard - 3 * WB; int uvh = height - 7 * WB - 14 * BH - 2 * hard; - _hardEdges[0] = new Fl_Toggle_Button(WB, 3 * WB + 9 * BH + hard, - hard, uvh); - _hardEdges[1] = new Fl_Toggle_Button(width - 4 * WB - hard, 3 * WB + 9 * BH + hard, - hard, uvh); - _hardEdges[2] = new Fl_Toggle_Button(WB + hard, 3 * WB + 9 * BH, - uvw, hard); - _hardEdges[3] = new Fl_Toggle_Button(WB + hard, height - 4 * WB - 5 * BH - hard, - uvw, hard); + _hardEdges[0] = new Fl_Toggle_Button(WB, 3 * WB + 9 * BH + hard, hard, uvh); + _hardEdges[1] = new Fl_Toggle_Button(width - 4 * WB - hard, + 3 * WB + 9 * BH + hard, hard, uvh); + _hardEdges[2] = new Fl_Toggle_Button(WB + hard, 3 * WB + 9 * BH, uvw, hard); + _hardEdges[3] = + new Fl_Toggle_Button(WB + hard, height - 4 * WB - 5 * BH - hard, uvw, hard); for(int i = 0; i < 4; i++) _hardEdges[i]->tooltip("Push to mark edge as `hard'"); @@ -968,36 +1028,35 @@ projectionEditor::projectionEditor() _slider->callback(filter_cb, this); _slider->tooltip("Filter selection by distance to projection surface"); - _orientation = new Fl_Toggle_Button(width - 3 * WB, height - 4 * WB - 5 * BH - hard, - 2 * WB, hard); + _orientation = new Fl_Toggle_Button( + width - 3 * WB, height - 4 * WB - 5 * BH - hard, 2 * WB, hard); _orientation->callback(filter_cb, this); _orientation->tooltip("Filter elements using orientation"); new Fl_Box(WB, height - 3 * WB - 5 * BH, BB, BH, "Patch Type:"); Fl_Group *oo = new Fl_Group(WB, height - 3 * WB - 5 * BH, 3 * BB, BH); - _pselect[0] = new Fl_Round_Button - (2 * WB + BB, height - 3 * WB - 5 * BH, BB, BH, "Continuation"); - _pselect[1] = new Fl_Round_Button - (3 * WB + 2 * BB, height - 3 * WB - 5 * BH, BB, BH, "Windowing"); + _pselect[0] = new Fl_Round_Button(2 * WB + BB, height - 3 * WB - 5 * BH, BB, + BH, "Continuation"); + _pselect[1] = new Fl_Round_Button(3 * WB + 2 * BB, height - 3 * WB - 5 * BH, + BB, BH, "Windowing"); - for(int i = 0; i < 2; i++) - _pselect[i]->type(FL_RADIO_BUTTON); + for(int i = 0; i < 2; i++) _pselect[i]->type(FL_RADIO_BUTTON); _pselect[0]->value(1); oo->end(); - _modes[0] = new Fl_Value_Input(WB, height - 3 * WB - 4 * BH, BB / 2, BH); + _modes[0] = new Fl_Value_Input(WB, height - 3 * WB - 4 * BH, BB / 2, BH); _modes[0]->tooltip("Number of Fourier modes along u"); - _modes[1] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 4 * BH, BB / 2, BH, - "Fourier modes"); + _modes[1] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 4 * BH, BB / 2, + BH, "Fourier modes"); _modes[1]->tooltip("Number of Fourier modes along v"); - _modes[2] = new Fl_Value_Input(WB, height - 3 * WB - 3 * BH, BB / 2, BH); + _modes[2] = new Fl_Value_Input(WB, height - 3 * WB - 3 * BH, BB / 2, BH); _modes[2]->tooltip("Number of Chebyshev modes along u"); - _modes[3] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 3 * BH, BB / 2, BH, - "Chebyshev modes"); + _modes[3] = new Fl_Value_Input(WB + BB / 2, height - 3 * WB - 3 * BH, BB / 2, + BH, "Chebyshev modes"); _modes[3]->tooltip("Number of Chebyshev modes along v"); - for(int i = 0; i < 4; i++){ + for(int i = 0; i < 4; i++) { _modes[i]->value(8); _modes[i]->maximum(128); _modes[i]->minimum(1); @@ -1006,46 +1065,45 @@ projectionEditor::projectionEditor() } { - Fl_Button *b = new Fl_Button(width - WB - BB, height - 3 * WB - 4 * BH, - BB, 2 * BH, "Generate\nPatch"); + Fl_Button *b = new Fl_Button(width - WB - BB, height - 3 * WB - 4 * BH, BB, + 2 * BH, "Generate\nPatch"); b->callback(compute_cb, this); } { int bb = (int)(0.37 * BB); new Fl_Box(WB, height - 2 * WB - 2 * BH, BB / 2, BH, "Delete:"); - Fl_Button *b1 = new Fl_Button(WB + BB / 2, height - 2 * WB - 2 * BH, - bb, BH, "last"); - b1->callback(action_cb, (void*)"delete_last"); - Fl_Button *b2 = new Fl_Button(WB + BB / 2 + bb, height - 2 * WB - 2 * BH, - bb, BH, "all"); - b2->callback(action_cb, (void*)"delete_all"); - Fl_Button *b3 = new Fl_Button(WB + BB / 2 + 2 * bb, height - 2 * WB - 2 * BH, - bb, BH, "sel."); - b3->callback(action_cb, (void*)"delete_select"); + Fl_Button *b1 = + new Fl_Button(WB + BB / 2, height - 2 * WB - 2 * BH, bb, BH, "last"); + b1->callback(action_cb, (void *)"delete_last"); + Fl_Button *b2 = + new Fl_Button(WB + BB / 2 + bb, height - 2 * WB - 2 * BH, bb, BH, "all"); + b2->callback(action_cb, (void *)"delete_all"); + Fl_Button *b3 = new Fl_Button(WB + BB / 2 + 2 * bb, + height - 2 * WB - 2 * BH, bb, BH, "sel."); + b3->callback(action_cb, (void *)"delete_select"); } { int bb = (int)(0.37 * BB); int s = width - WB - BB / 2 - 3 * bb; new Fl_Box(s, height - 2 * WB - 2 * BH, BB / 2, BH, "Save:"); - Fl_Button *b1 = new Fl_Button(s + BB / 2, height - 2 * WB - 2 * BH, - bb, BH, "last"); - b1->callback(action_cb, (void*)"save_last"); - Fl_Button *b2 = new Fl_Button(s + BB / 2 + bb, height - 2 * WB - 2 * BH, - bb, BH, "all"); - b2->callback(action_cb, (void*)"save_all"); + Fl_Button *b1 = + new Fl_Button(s + BB / 2, height - 2 * WB - 2 * BH, bb, BH, "last"); + b1->callback(action_cb, (void *)"save_last"); + Fl_Button *b2 = + new Fl_Button(s + BB / 2 + bb, height - 2 * WB - 2 * BH, bb, BH, "all"); + b2->callback(action_cb, (void *)"save_all"); Fl_Button *b3 = new Fl_Button(s + BB / 2 + 2 * bb, height - 2 * WB - 2 * BH, bb, BH, "sel."); - b3->callback(action_cb, (void*)"save_select"); + b3->callback(action_cb, (void *)"save_select"); } { - Fl_Button *b1 = new Fl_Button(WB, height - WB - BH, BB, BH, - "Blend"); + Fl_Button *b1 = new Fl_Button(WB, height - WB - BH, BB, BH, "Blend"); b1->callback(blend_cb, this); - //Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - WB - BH, BB, + // Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - WB - BH, BB, // BH, "Intersect"); } @@ -1057,10 +1115,11 @@ projectionEditor::projectionEditor() void projectionEditor::load(fourierProjectionFace *face, std::string tag) { - FM::ProjectionSurface *ps = (FM::ProjectionSurface*)face->getNativePtr(); + FM::ProjectionSurface *ps = (FM::ProjectionSurface *)face->getNativePtr(); _browser->add(tag.size() ? tag.c_str() : ps->GetName().c_str()); - projection *p = new projection(face, _paramWin[0], _paramWin[1], _paramWin[2], - _paramWin[3], _paramWin[4], _paramWin[5], this); + projection *p = + new projection(face, _paramWin[0], _paramWin[1], _paramWin[2], _paramWin[3], + _paramWin[4], _paramWin[5], this); _projections.push_back(p); _window->add(p->group); } @@ -1081,7 +1140,7 @@ int projectionEditor::getSelectionMode() int projectionEditor::getPatchType() { - if (_pselect[0]->value()) + if(_pselect[0]->value()) return 0; else return 1; @@ -1099,14 +1158,14 @@ projection *projectionEditor::getLastProjection() return _projections[_projections.size() - 1]; } -void mesh_parameterize_cb(Fl_Widget* w, void* data) +void mesh_parameterize_cb(Fl_Widget *w, void *data) { // display geometry surfaces opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); // create the (static) editor static projectionEditor *editor = 0; - if(!editor){ + if(!editor) { editor = new projectionEditor(); editor->load(createProjectionFaceFromName("plane")); editor->load(createProjectionFaceFromName("trapezoid")); @@ -1121,7 +1180,7 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data) #else -void mesh_parameterize_cb(Fl_Widget* w, void* data) +void mesh_parameterize_cb(Fl_Widget *w, void *data) { Msg::Error("You must compile FourierModel to reparameterize meshes"); } diff --git a/Fltk/projectionEditor.h b/Fltk/projectionEditor.h index 4d33c93c17fafc1758edada27639c467af369d62..9e6cad4bef937bebf12f53875f374598943d157b 100644 --- a/Fltk/projectionEditor.h +++ b/Fltk/projectionEditor.h @@ -24,38 +24,44 @@ #include "FM_WFPatch.h" class uvPlot : public Fl_Window { - private: +private: std::vector<double> _u, _v, _dist; std::vector<std::complex<double> > _f; // "signed" distance GmshColorTable _colorTable; double _dmin, _dmax; void color(double d); void draw(); - public: - uvPlot(int x, int y, int w, int h, const char *l=0); - void set(std::vector<double> &u, std::vector<double> &v, std::vector<double> &dist, - std::vector<std::complex<double> > &f); - void get(std::vector<double> &u, std::vector<double> &v, std::vector<double> &dist, - std::vector<std::complex<double> > &f) - { u = _u; v = _v; dist = _dist; f = _f; } + +public: + uvPlot(int x, int y, int w, int h, const char *l = 0); + void set(std::vector<double> &u, std::vector<double> &v, + std::vector<double> &dist, std::vector<std::complex<double> > &f); + void get(std::vector<double> &u, std::vector<double> &v, + std::vector<double> &dist, std::vector<std::complex<double> > &f) + { + u = _u; + v = _v; + dist = _dist; + f = _f; + } }; class projectionEditor; class projection { - public: +public: fourierProjectionFace *face; Fl_Group *group; - std::vector<Fl_Value_Input*> parameters; - projection(fourierProjectionFace *f, int x, int y, int w, int h, - int bb, int bh, projectionEditor *e); + std::vector<Fl_Value_Input *> parameters; + projection(fourierProjectionFace *f, int x, int y, int w, int h, int bb, + int bh, projectionEditor *e); }; class projectionEditor { - private: - std::vector<projection*> _projections; - std::vector<MElement*> _elements; - std::vector<GEntity*> _entities; +private: + std::vector<projection *> _projections; + std::vector<MElement *> _elements; + std::vector<GEntity *> _entities; Fl_Window *_window; Fl_Hold_Browser *_browser; int _paramWin[6]; @@ -64,26 +70,27 @@ class projectionEditor { Fl_Value_Input *_modes[4]; Fl_Toggle_Button *_hardEdges[4], *_orientation; Fl_Slider *_slider; - public: + +public: projectionEditor(); - void load(fourierProjectionFace *face, std::string tag=""); + void load(fourierProjectionFace *face, std::string tag = ""); void show(); uvPlot *uv() { return _uvPlot; } - std::vector<MElement*> &getElements() { return _elements; } - std::vector<GEntity*> &getEntities() { return _entities; } - std::vector<projection*> &getProjections() { return _projections; } + std::vector<MElement *> &getElements() { return _elements; } + std::vector<GEntity *> &getEntities() { return _entities; } + std::vector<projection *> &getProjections() { return _projections; } projection *getCurrentProjection(); projection *getLastProjection(); int getSelectionMode(); int getPatchType(); - int getMode(int i){ return (int)_modes[i]->value(); } - int getHardEdge(int i){ return (int)_hardEdges[i]->value(); } - int getOrientation(){ return (int)_orientation->value(); } - double getThreshold(){ return _slider->value(); } + int getMode(int i) { return (int)_modes[i]->value(); } + int getHardEdge(int i) { return (int)_hardEdges[i]->value(); } + int getOrientation() { return (int)_orientation->value(); } + double getThreshold() { return _slider->value(); } }; #endif -void mesh_parameterize_cb(Fl_Widget* w, void* data); +void mesh_parameterize_cb(Fl_Widget *w, void *data); #endif diff --git a/Fltk/solverButton.cpp b/Fltk/solverButton.cpp index ed336b4e424258010276990c9319681db0c976d8..0e81313a6e0fabccbc6afe84db2377ed1e4af341 100644 --- a/Fltk/solverButton.cpp +++ b/Fltk/solverButton.cpp @@ -19,7 +19,7 @@ typedef unsigned long intptr_t; static void solver_rename_cb(Fl_Widget *w, void *data) { - if(FlGui::instance()->onelab->isBusy()){ + if(FlGui::instance()->onelab->isBusy()) { Msg::Warning("Cannot rename client while solver is running"); return; } @@ -27,19 +27,18 @@ static void solver_rename_cb(Fl_Widget *w, void *data) int num = (intptr_t)data; std::string name = opt_solver_name(num, GMSH_GET, ""); const char *n = fl_input("Solver name:", name.c_str()); - if(n){ + if(n) { std::string exe = opt_solver_executable(num, GMSH_GET, ""); std::string host = opt_solver_remote_login(num, GMSH_GET, ""); // this will remove the old client if the new name is different FlGui::instance()->onelab->addSolver(n, exe, host, num); - onelab_cb(0, (void*)"reset"); + onelab_cb(0, (void *)"reset"); } } - static void solver_change_exe_cb(Fl_Widget *w, void *data) { - if(FlGui::instance()->onelab->isBusy()){ + if(FlGui::instance()->onelab->isBusy()) { Msg::Warning("Cannot change executable name while solver is running"); return; } @@ -53,22 +52,22 @@ static void solver_change_exe_cb(Fl_Widget *w, void *data) #if defined(WIN32) pattern += ".exe"; #endif - if(fileChooser(FILE_CHOOSER_SINGLE, title.c_str(), pattern.c_str(), old)){ + if(fileChooser(FILE_CHOOSER_SINGLE, title.c_str(), pattern.c_str(), old)) { exe = fileChooserGetName(1); - if(exe.size()){ + if(exe.size()) { // remove old client if it's already loaded onelab::server::citer it = onelab::server::instance()->findClient(name); if(it != onelab::server::instance()->lastClient()) delete *it; std::string host = opt_solver_remote_login(num, GMSH_GET, ""); FlGui::instance()->onelab->addSolver(name, exe, host, num); - onelab_cb(0, (void*)"reset"); + onelab_cb(0, (void *)"reset"); } } } static void solver_remove_cb(Fl_Widget *w, void *data) { - if(FlGui::instance()->onelab->isBusy()){ + if(FlGui::instance()->onelab->isBusy()) { Msg::Warning("Cannot remove client while solver is running"); return; } @@ -81,14 +80,14 @@ static void solver_remove_cb(Fl_Widget *w, void *data) opt_solver_remote_login(num, GMSH_SET, ""); onelab::server::citer it = onelab::server::instance()->findClient(name); - if(it != onelab::server::instance()->lastClient()){ + if(it != onelab::server::instance()->lastClient()) { delete *it; } FlGui::instance()->onelab->rebuildSolverList(); } solverButton::solverButton(int x, int y, int w, int h, int num, Fl_Color col) - : Fl_Group(x,y,w,h) + : Fl_Group(x, y, w, h) { int popw = FL_NORMAL_SIZE + 2; @@ -113,10 +112,13 @@ solverButton::solverButton(int x, int y, int w, int h, int num, Fl_Color col) _butt[1]->selection_color(col); _popup = new Fl_Menu_Button(x + w - popw, y, popw, h); _popup->type(Fl_Menu_Button::POPUP123); - _popup->add("Rename...", 0, (Fl_Callback *)solver_rename_cb, (void *)(intptr_t)num, 0); - _popup->add("Change Executable Location...", 0, (Fl_Callback *)solver_change_exe_cb, (void *)(intptr_t)num, + _popup->add("Rename...", 0, (Fl_Callback *)solver_rename_cb, + (void *)(intptr_t)num, 0); + _popup->add("Change Executable Location...", 0, + (Fl_Callback *)solver_change_exe_cb, (void *)(intptr_t)num, FL_MENU_DIVIDER); - _popup->add("Remove", 0, (Fl_Callback *)solver_remove_cb, (void *)(intptr_t)num, 0); + _popup->add("Remove", 0, (Fl_Callback *)solver_remove_cb, + (void *)(intptr_t)num, 0); end(); // close the group resizable(_butt[0]); diff --git a/Fltk/solverButton.h b/Fltk/solverButton.h index 397220ad5408d925c240bcc9543f5362bc6b5280..c42db59e882ca517c4f5dea1702541f7a0776eb0 100644 --- a/Fltk/solverButton.h +++ b/Fltk/solverButton.h @@ -13,14 +13,18 @@ #include <FL/Fl_Menu_Button.H> class solverButton : public Fl_Group { - private: +private: Fl_Button *_butt[2]; Fl_Menu_Button *_popup; char _tooltip[256]; - public: + +public: solverButton(int x, int y, int w, int h, int num, Fl_Color col); - void copy_label(const std::string &label){ _butt[0]->copy_label(label.c_str()); } - std::string label(){ return _butt[0]->label(); } + void copy_label(const std::string &label) + { + _butt[0]->copy_label(label.c_str()); + } + std::string label() { return _butt[0]->label(); } }; #endif diff --git a/Fltk/spherePositionWidget.h b/Fltk/spherePositionWidget.h index 0bdc056b8cb2a64871e6baf8aa938eaebe7371d3..5c07413fcbf0b8e23c8b68766fc76c7005691b1a 100644 --- a/Fltk/spherePositionWidget.h +++ b/Fltk/spherePositionWidget.h @@ -14,7 +14,7 @@ // A small 2D widget to set the coordinates of a point on the unit // sphere. class spherePositionWidget : public Fl_Widget { - private: +private: double _x, _y, _z; void draw() { @@ -31,50 +31,58 @@ class spherePositionWidget : public Fl_Widget { } int handle(int event) { - switch (event) { + switch(event) { case FL_PUSH: case FL_DRAG: - case FL_RELEASE: - { - int x1 = x() + 3; - int y1 = y() + 3; - int w1 = w() - 6; - int h1 = h() - 6; - double xx = (Fl::event_x() - x1) / (0.5 * w1) - 1.; - double yy = -((Fl::event_y() - y1) / (0.5 * h1) - 1.); - if(xx != _x || yy != _y) { - double norm = sqrt(xx * xx + yy * yy); - if(norm > 1.){ - xx /= norm; - yy /= norm; - norm = 1.; - } - _x = xx; _y = yy; _z = sqrt(1. - norm); - set_changed(); - redraw(); - do_callback(); + case FL_RELEASE: { + int x1 = x() + 3; + int y1 = y() + 3; + int w1 = w() - 6; + int h1 = h() - 6; + double xx = (Fl::event_x() - x1) / (0.5 * w1) - 1.; + double yy = -((Fl::event_y() - y1) / (0.5 * h1) - 1.); + if(xx != _x || yy != _y) { + double norm = sqrt(xx * xx + yy * yy); + if(norm > 1.) { + xx /= norm; + yy /= norm; + norm = 1.; } + _x = xx; + _y = yy; + _z = sqrt(1. - norm); + set_changed(); + redraw(); + do_callback(); } + } return 1; - default: - return 0; + default: return 0; } } - public: - spherePositionWidget(int x, int y, int w, const char *l=0) + +public: + spherePositionWidget(int x, int y, int w, const char *l = 0) : Fl_Widget(x, y, w, w, l), _x(0.), _y(0.), _z(0.) { box(FL_FLAT_BOX); align(FL_ALIGN_BOTTOM); } - void getValue(double &x, double &y, double &z) const { x = _x; y = _y; z = _z; } + void getValue(double &x, double &y, double &z) const + { + x = _x; + y = _y; + z = _z; + } void setValue(double x, double y, double z) { double norm = sqrt(x * x + y * y + z * z); - if(norm){ - _x = x / norm; _y = y / norm; _z = z / norm; + if(norm) { + _x = x / norm; + _y = y / norm; + _z = z / norm; } - else{ + else { _x = _y = _z = 0.; } redraw(); diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp index c27e3e0a084d7d0d5ab50dd30223e6d1e1c19a39..cead261a73424af61b7a9bc82eee87b88b07f2b6 100644 --- a/Fltk/statisticsWindow.cpp +++ b/Fltk/statisticsWindow.cpp @@ -18,9 +18,14 @@ #include "OS.h" #include "Field.h" -enum QM_HISTO {QMH_SICN_XY, QMH_SICN_3D, - QMH_GAMMA_XY, QMH_GAMMA_3D, - QMH_SIGE_XY, QMH_SIGE_3D}; +enum QM_HISTO { + QMH_SICN_XY, + QMH_SICN_3D, + QMH_GAMMA_XY, + QMH_GAMMA_3D, + QMH_SIGE_XY, + QMH_SIGE_3D +}; void statistics_cb(Fl_Widget *w, void *data) { @@ -34,50 +39,51 @@ static void statistics_update_cb(Fl_Widget *w, void *data) static void statistics_histogram_cb(Fl_Widget *w, void *data) { - QM_HISTO qmh = *(QM_HISTO*)data; + QM_HISTO qmh = *(QM_HISTO *)data; std::vector<double> x, y; - if (qmh == QMH_SICN_XY) { - for(int i = 0; i < 100; i++){ - x.push_back((double)(2*i-99) / 99); + if(qmh == QMH_SICN_XY) { + for(int i = 0; i < 100; i++) { + x.push_back((double)(2 * i - 99) / 99); y.push_back(FlGui::instance()->stats->quality[0][i]); } new PView("SICN", "# Elements", x, y); } - else if (qmh == QMH_GAMMA_XY) { - for(int i = 0; i < 100; i++){ + else if(qmh == QMH_GAMMA_XY) { + for(int i = 0; i < 100; i++) { x.push_back((double)i / 99); y.push_back(FlGui::instance()->stats->quality[1][i]); } new PView("Gamma", "# Elements", x, y); } - else if (qmh == QMH_SIGE_XY) { - for(int i = 0; i < 100; i++){ - x.push_back((double)(2*i-99) / 99); + else if(qmh == QMH_SIGE_XY) { + for(int i = 0; i < 100; i++) { + x.push_back((double)(2 * i - 99) / 99); y.push_back(FlGui::instance()->stats->quality[3][i]); } new PView("SIGE", "# Elements", x, y); } else { - std::vector<GEntity*> entities_; + std::vector<GEntity *> entities_; GModel::current()->getEntities(entities_); std::map<int, std::vector<double> > d; - for (unsigned int i = 0; i < entities_.size(); i++){ - if (entities_[i]->dim() < 2) continue; - for (unsigned int j = 0; j < entities_[i]->getNumMeshElements(); j++) { + for(unsigned int i = 0; i < entities_.size(); i++) { + if(entities_[i]->dim() < 2) continue; + for(unsigned int j = 0; j < entities_[i]->getNumMeshElements(); j++) { MElement *e = entities_[i]->getMeshElement(j); - if (qmh == QMH_SICN_3D) + if(qmh == QMH_SICN_3D) d[e->getNum()].push_back(e->minSICNShapeMeasure()); - else if (qmh == QMH_GAMMA_3D) + else if(qmh == QMH_GAMMA_3D) d[e->getNum()].push_back(e->gammaShapeMeasure()); - else if (qmh == QMH_SIGE_3D) + else if(qmh == QMH_SIGE_3D) d[e->getNum()].push_back(e->minSIGEShapeMeasure()); } } - std::string name = (qmh == QMH_SICN_3D) ? "SICN" : - (qmh == QMH_GAMMA_3D) ? "Gamma" : - (qmh == QMH_SIGE_3D) ? "SIGE" : ""; + std::string name = + (qmh == QMH_SICN_3D) ? + "SICN" : + (qmh == QMH_GAMMA_3D) ? "Gamma" : (qmh == QMH_SIGE_3D) ? "SIGE" : ""; new PView(name, "ElementData", GModel::current(), d); } @@ -93,79 +99,99 @@ statisticsWindow::statisticsWindow(int deltaFontSize) int width = 26 * FL_NORMAL_SIZE; int height = 5 * WB + 18 * BH; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Statistics"); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Statistics"); win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH); { - group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Geometry"); + group[0] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Geometry"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 1 * BH, IW, BH, "Points"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Curves"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Surfaces"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Volumes"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Physical groups"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Physical groups"); group[0]->end(); } { - group[1] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Mesh"); + group[1] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Mesh"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 1 * BH, IW, BH, "Nodes"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Points"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Lines"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Prisms"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Pyramids"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Trihedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Trihedra"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 11 * BH, IW, BH, "Time for 1D mesh"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 12 * BH, IW, BH, "Time for 2D mesh"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 13 * BH, IW, BH, "Time for 3D mesh"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 11 * BH, IW, BH, "Time for 1D mesh"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 12 * BH, IW, BH, "Time for 2D mesh"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 13 * BH, IW, BH, "Time for 3D mesh"); value[num] = new Fl_Output(2 * WB, 2 * WB + 14 * BH, IW, BH, "SICN"); - value[num]->tooltip("~ signed inverse condition number"); num++; + value[num]->tooltip("~ signed inverse condition number"); + num++; value[num] = new Fl_Output(2 * WB, 2 * WB + 15 * BH, IW, BH, "Gamma"); - value[num]->tooltip("~ inscribed_radius / circumscribed_radius (simplices)"); num++; + value[num]->tooltip( + "~ inscribed_radius / circumscribed_radius (simplices)"); + num++; value[num] = new Fl_Output(2 * WB, 2 * WB + 16 * BH, IW, BH, "SIGE"); - value[num]->tooltip("~ signed inverse error on gradient FE solution"); num++; + value[num]->tooltip("~ signed inverse error on gradient FE solution"); + num++; - for(int i = 0; i < 3; i++){ + for(int i = 0; i < 3; i++) { int ww = 3 * FL_NORMAL_SIZE; - new Fl_Box - (FL_NO_BOX, width - 3 * ww - 2 * WB, 2 * WB + (14 + i) * BH, ww, BH, "Plot"); - butt[2 * i] = new Fl_Button - (width - 2 * ww - 2 * WB, 2 * WB + (14 + i) * BH, ww, BH, "X-Y"); - butt[2 * i + 1] = new Fl_Button - (width - ww - 2 * WB, 2 * WB + (14 + i) * BH, ww, BH, "3D"); + new Fl_Box(FL_NO_BOX, width - 3 * ww - 2 * WB, 2 * WB + (14 + i) * BH, + ww, BH, "Plot"); + butt[2 * i] = new Fl_Button(width - 2 * ww - 2 * WB, + 2 * WB + (14 + i) * BH, ww, BH, "X-Y"); + butt[2 * i + 1] = new Fl_Button(width - ww - 2 * WB, + 2 * WB + (14 + i) * BH, ww, BH, "3D"); } - static const QM_HISTO qmh0 = QMH_SICN_XY, qmh1 = QMH_SICN_3D, qmh2 = QMH_GAMMA_XY, - qmh3 = QMH_GAMMA_3D, qmh4 = QMH_SIGE_XY, qmh5 = QMH_SIGE_3D; - butt[0]->callback(statistics_histogram_cb, (void*) &qmh0); - butt[1]->callback(statistics_histogram_cb, (void*) &qmh1); - butt[2]->callback(statistics_histogram_cb, (void*) &qmh2); - butt[3]->callback(statistics_histogram_cb, (void*) &qmh3); - butt[4]->callback(statistics_histogram_cb, (void*) &qmh4); - butt[5]->callback(statistics_histogram_cb, (void*) &qmh5); + static const QM_HISTO qmh0 = QMH_SICN_XY, qmh1 = QMH_SICN_3D, + qmh2 = QMH_GAMMA_XY, qmh3 = QMH_GAMMA_3D, + qmh4 = QMH_SIGE_XY, qmh5 = QMH_SIGE_3D; + butt[0]->callback(statistics_histogram_cb, (void *)&qmh0); + butt[1]->callback(statistics_histogram_cb, (void *)&qmh1); + butt[2]->callback(statistics_histogram_cb, (void *)&qmh2); + butt[3]->callback(statistics_histogram_cb, (void *)&qmh3); + butt[4]->callback(statistics_histogram_cb, (void *)&qmh4); + butt[5]->callback(statistics_histogram_cb, (void *)&qmh5); group[1]->end(); } { - group[2] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Post-processing"); + group[2] = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Post-processing"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 1 * BH, IW, BH, "Views"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 2 * BH, IW, BH, "Points"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 3 * BH, IW, BH, "Lines"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 4 * BH, IW, BH, "Triangles"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 5 * BH, IW, BH, "Quadrangles"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 6 * BH, IW, BH, "Tetrahedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 7 * BH, IW, BH, "Hexahedra"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 8 * BH, IW, BH, "Prisms"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 9 * BH, IW, BH, "Pyramids"); - value[num++] = new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Trihedra"); + value[num++] = + new Fl_Output(2 * WB, 2 * WB + 10 * BH, IW, BH, "Trihedra"); value[num++] = new Fl_Output(2 * WB, 2 * WB + 11 * BH, IW, BH, "Strings"); group[2]->end(); } @@ -181,12 +207,13 @@ statisticsWindow::statisticsWindow(int deltaFontSize) memUsage = new Fl_Box(WB, height - BH - WB, width / 2, BH, ""); memUsage->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); - Fl_Return_Button *o = new Fl_Return_Button - (width - BB - WB, height - BH - WB, BB, BH, "Update"); + Fl_Return_Button *o = + new Fl_Return_Button(width - BB - WB, height - BH - WB, BB, BH, "Update"); o->callback(statistics_update_cb); } - win->position(CTX::instance()->statPosition[0], CTX::instance()->statPosition[1]); + win->position(CTX::instance()->statPosition[0], + CTX::instance()->statPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -204,81 +231,143 @@ void statisticsWindow::compute(bool elementQuality) GetStatistics(s); // geom - sprintf(label[num], "%g", s[0]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[1]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[2]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[3]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[45]); value[num]->value(label[num]); num++; + sprintf(label[num], "%g", s[0]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[1]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[2]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[3]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[45]); + value[num]->value(label[num]); + num++; // mesh - sprintf(label[num], "%g", s[4]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[5]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[6]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[7]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[8]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[9]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[10]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[11]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[12]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[13]); value[num]->value(label[num]); num++; - - sprintf(label[num], "%g", s[14]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[15]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[16]); value[num]->value(label[num]); num++; - - if(!elementQuality){ + sprintf(label[num], "%g", s[4]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[5]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[6]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[7]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[8]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[9]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[10]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[11]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[12]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[13]); + value[num]->value(label[num]); + num++; + + sprintf(label[num], "%g", s[14]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[15]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[16]); + value[num]->value(label[num]); + num++; + + if(!elementQuality) { for(int i = 0; i < 6; i += 2) butt[i]->deactivate(); sprintf(label[num], "Press Update"); value[num]->deactivate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; sprintf(label[num], "Press Update"); value[num]->deactivate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; sprintf(label[num], "Press Update"); value[num]->deactivate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; } - else{ + else { for(int i = 0; i < 6; i += 2) butt[i]->activate(); sprintf(label[num], "%.4g (%.4g->%.4g)", s[18], s[19], s[20]); value[num]->activate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; sprintf(label[num], "%.4g (%.4g->%.4g)", s[21], s[22], s[23]); value[num]->activate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; sprintf(label[num], "%.4g (%.4g->%.4g)", s[24], s[25], s[26]); value[num]->activate(); - value[num]->value(label[num]); num++; + value[num]->value(label[num]); + num++; } // post - sprintf(label[num], "%g", s[27]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[28]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[29]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[30]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[31]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[32]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[33]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[34]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[35]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[36]); value[num]->value(label[num]); num++; - sprintf(label[num], "%g", s[37]); value[num]->value(label[num]); num++; + sprintf(label[num], "%g", s[27]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[28]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[29]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[30]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[31]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[32]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[33]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[34]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[35]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[36]); + value[num]->value(label[num]); + num++; + sprintf(label[num], "%g", s[37]); + value[num]->value(label[num]); + num++; static char mem[256]; long m = GetMemoryUsage(); - if(m){ - sprintf(mem, "Memory usage: %gMb", GetMemoryUsage()/1024./1024.); + if(m) { + sprintf(mem, "Memory usage: %gMb", GetMemoryUsage() / 1024. / 1024.); memUsage->label(mem); } } void statisticsWindow::show() { - if(!win->shown()) - compute(false); + if(!win->shown()) compute(false); - for(int i = 0; i < 3; i++) - group[i]->hide(); + for(int i = 0; i < 3; i++) group[i]->hide(); if(GModel::current()->getMeshStatus(true) > 0) group[1]->show(); diff --git a/Fltk/statisticsWindow.h b/Fltk/statisticsWindow.h index 3ca5476deb55b90f3e4a4889446f5af5d20b8de2..03c03dbffc595e47a6dfaa094077a37bf45280b8 100644 --- a/Fltk/statisticsWindow.h +++ b/Fltk/statisticsWindow.h @@ -11,15 +11,16 @@ #include <FL/Fl_Button.H> #include <FL/Fl_Group.H> -class statisticsWindow{ - public: +class statisticsWindow { +public: Fl_Window *win; Fl_Output *value[50]; Fl_Button *butt[8]; Fl_Group *group[3]; Fl_Box *memUsage; double quality[3][100]; - public: + +public: statisticsWindow(int deltaFontSize); void compute(bool elementQuality); void show(); diff --git a/Fltk/treeIcons.h b/Fltk/treeIcons.h index dffe531b5f4238eae3c0d4ae649b771e779529c5..07ed0646845049c4a403fd234127675cbd9d2ee4 100644 --- a/Fltk/treeIcons.h +++ b/Fltk/treeIcons.h @@ -8,82 +8,36 @@ #include <FL/Fl_Pixmap.H> -#define TREE_ICON_RIGHT(col)\ - "11 11 2 1",\ - ". c None",\ - col,\ - "...@.......",\ - "...@@......",\ - "...@@@.....",\ - "...@@@@....",\ - "...@@@@@...",\ - "...@@@@@@..",\ - "...@@@@@...",\ - "...@@@@....",\ - "...@@@.....",\ - "...@@......",\ - "...@......." - -#define TREE_ICON_DOWN(col)\ - "11 11 2 1",\ - ". c None",\ - col,\ - "...........",\ - "...........",\ - "...........",\ - "@@@@@@@@@@@",\ - ".@@@@@@@@@.",\ - "..@@@@@@@..",\ - "...@@@@@...",\ - "....@@@....",\ - ".....@.....",\ - "...........",\ - "..........." - -#define TREE_ICON_PLUS(col)\ - "11 11 3 1",\ - col,\ - "# c #323232",\ - "@ c #000000",\ - "###########",\ - "#.........#",\ - "#.........#",\ - "#....@....#",\ - "#....@....#",\ - "#..@@@@@..#",\ - "#....@....#",\ - "#....@....#",\ - "#.........#",\ - "#.........#",\ - "###########" - -#define TREE_ICON_MINUS(col)\ - "11 11 3 1",\ - col,\ - "# c #323232",\ - "@ c #000000",\ - "###########",\ - "#.........#",\ - "#.........#",\ - "#.........#",\ - "#.........#",\ - "#..@@@@@..#",\ - "#.........#",\ - "#.........#",\ - "#.........#",\ - "#.........#",\ - "###########" +#define TREE_ICON_RIGHT(col) \ + "11 11 2 1", ". c None", col, "...@.......", "...@@......", "...@@@.....", \ + "...@@@@....", "...@@@@@...", "...@@@@@@..", "...@@@@@...", "...@@@@....", \ + "...@@@.....", "...@@......", "...@......." + +#define TREE_ICON_DOWN(col) \ + "11 11 2 1", ". c None", col, "...........", "...........", "...........", \ + "@@@@@@@@@@@", ".@@@@@@@@@.", "..@@@@@@@..", "...@@@@@...", "....@@@....", \ + ".....@.....", "...........", "..........." + +#define TREE_ICON_PLUS(col) \ + "11 11 3 1", col, "# c #323232", "@ c #000000", "###########", \ + "#.........#", "#.........#", "#....@....#", "#....@....#", "#..@@@@@..#", \ + "#....@....#", "#....@....#", "#.........#", "#.........#", "###########" + +#define TREE_ICON_MINUS(col) \ + "11 11 3 1", col, "# c #323232", "@ c #000000", "###########", \ + "#.........#", "#.........#", "#.........#", "#.........#", "#..@@@@@..#", \ + "#.........#", "#.........#", "#.........#", "#.........#", "###########" #if defined(__APPLE__) -static const char * const open_xpm_light[] = {TREE_ICON_RIGHT("@ c #222222")}; -static const char * const close_xpm_light[] = {TREE_ICON_DOWN("@ c #222222")}; -static const char * const open_xpm_dark[] = {TREE_ICON_RIGHT("@ c #444444")}; -static const char * const close_xpm_dark[] = {TREE_ICON_DOWN("@ c #444444")}; +static const char *const open_xpm_light[] = {TREE_ICON_RIGHT("@ c #222222")}; +static const char *const close_xpm_light[] = {TREE_ICON_DOWN("@ c #222222")}; +static const char *const open_xpm_dark[] = {TREE_ICON_RIGHT("@ c #444444")}; +static const char *const close_xpm_dark[] = {TREE_ICON_DOWN("@ c #444444")}; #else -static const char * const open_xpm_light[] = {TREE_ICON_PLUS(". c #fefefe")}; -static const char * const close_xpm_light[] = {TREE_ICON_MINUS(". c #fefefe")}; -static const char * const open_xpm_dark[] = {TREE_ICON_PLUS(". c #bbbbbb")}; -static const char * const close_xpm_dark[] = {TREE_ICON_MINUS(". c #bbbbbb")}; +static const char *const open_xpm_light[] = {TREE_ICON_PLUS(". c #fefefe")}; +static const char *const close_xpm_light[] = {TREE_ICON_MINUS(". c #fefefe")}; +static const char *const open_xpm_dark[] = {TREE_ICON_PLUS(". c #bbbbbb")}; +static const char *const close_xpm_dark[] = {TREE_ICON_MINUS(". c #bbbbbb")}; #endif static Fl_Pixmap open_pixmap_light(open_xpm_light); diff --git a/Fltk/viewButton.cpp b/Fltk/viewButton.cpp index 86cd035a2507e1b73cf602d97787d50eee7a3b85..57953ff9b3a2ad3af529ab3276ca976fd3f7a51d 100644 --- a/Fltk/viewButton.cpp +++ b/Fltk/viewButton.cpp @@ -31,11 +31,13 @@ static void view_toggle_cb(Fl_Widget *w, void *data) { int num = (intptr_t)data; viewButton *but = FlGui::instance()->onelab->getViewButton(num); - if(but){ - if(Fl::event_state(FL_SHIFT)){ - for(unsigned int i = 0; i < PView::list.size(); i++){ - if((int)i != num) opt_view_visible(i, GMSH_SET | GMSH_GUI, 0); - else opt_view_visible(i, GMSH_SET | GMSH_GUI, 1); + if(but) { + if(Fl::event_state(FL_SHIFT)) { + for(unsigned int i = 0; i < PView::list.size(); i++) { + if((int)i != num) + opt_view_visible(i, GMSH_SET | GMSH_GUI, 0); + else + opt_view_visible(i, GMSH_SET | GMSH_GUI, 1); } } else @@ -46,11 +48,12 @@ static void view_toggle_cb(Fl_Widget *w, void *data) static void view_reload(int index) { - if(index >= 0 && index < (int)PView::list.size()){ + if(index >= 0 && index < (int)PView::list.size()) { PView *p = PView::list[index]; - if(StatFile(p->getData()->getFileName())){ - Msg::Error("File '%s' does not exist", p->getData()->getFileName().c_str()); + if(StatFile(p->getData()->getFileName())) { + Msg::Error("File '%s' does not exist", + p->getData()->getFileName().c_str()); return; } @@ -59,7 +62,7 @@ static void view_reload(int index) // FIXME: use fileIndex MergeFile(p->getData()->getFileName()); - if((int)PView::list.size() > n){ // we loaded a new view + if((int)PView::list.size() > n) { // we loaded a new view // delete old data and replace with new delete p->getData(); p->setData(PView::list.back()->getData()); @@ -83,16 +86,14 @@ static void view_reload_cb(Fl_Widget *w, void *data) static void view_reload_all_cb(Fl_Widget *w, void *data) { - for(unsigned int i = 0; i < PView::list.size(); i++) - view_reload(i); + for(unsigned int i = 0; i < PView::list.size(); i++) view_reload(i); drawContext::global()->draw(); } static void view_reload_visible_cb(Fl_Widget *w, void *data) { for(unsigned int i = 0; i < PView::list.size(); i++) - if(opt_view_visible(i, GMSH_GET, 0)) - view_reload(i); + if(opt_view_visible(i, GMSH_GET, 0)) view_reload(i); drawContext::global()->draw(); } @@ -116,23 +117,23 @@ static void view_remove_all_cb(Fl_Widget *w, void *data) { if(PView::list.empty()) return; int mode = (intptr_t)data; - if(mode == -1){ // remove all + if(mode == -1) { // remove all if(PView::list.empty()) return; while(PView::list.size()) delete PView::list[0]; } - else if(mode == -2){ // remove all visible + else if(mode == -2) { // remove all visible for(int i = PView::list.size() - 1; i >= 0; i--) if(opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; } - else if(mode == -3){ // remove all invisible + else if(mode == -3) { // remove all invisible for(int i = PView::list.size() - 1; i >= 0; i--) if(!opt_view_visible(i, GMSH_GET, 0)) delete PView::list[i]; } - else if(mode == -4){ // remove all empty + else if(mode == -4) { // remove all empty for(int i = PView::list.size() - 1; i >= 0; i--) if(PView::list[i]->getData()->empty()) delete PView::list[i]; } - else if(mode >=0 && mode < (int)PView::list.size()){ // remove by name + else if(mode >= 0 && mode < (int)PView::list.size()) { // remove by name std::string name = PView::list[mode]->getData()->getName(); for(int i = PView::list.size() - 1; i >= 0; i--) if(PView::list[i]->getData()->getName() == name) delete PView::list[i]; @@ -150,28 +151,25 @@ static void view_remove_cb(Fl_Widget *w, void *data) } #if defined(HAVE_NATIVE_FILE_CHOOSER) -# define TT "\t" -# define NN "\n" +#define TT "\t" +#define NN "\n" #else -# define TT " (" -# define NN ")\t" +#define TT " (" +#define NN ")\t" #endif static void view_save_cb(Fl_Widget *w, void *data) { static const char *formats = - "Gmsh Parsed" TT "*.pos" NN - "Gmsh Mesh-based" TT "*.pos" NN - "Gmsh Legacy ASCII" TT "*.pos" NN - "Gmsh Legacy Binary" TT "*.pos" NN - "MED" TT "*.rmed" NN - "STL Surface" TT "*.stl" NN - "Generic TXT" TT "*.txt" NN; + "Gmsh Parsed" TT "*.pos" NN "Gmsh Mesh-based" TT "*.pos" NN + "Gmsh Legacy ASCII" TT "*.pos" NN "Gmsh Legacy Binary" TT "*.pos" NN + "MED" TT "*.rmed" NN "STL Surface" TT "*.stl" NN "Generic TXT" TT + "*.txt" NN; PView *view = PView::list[(intptr_t)data]; - test: +test: if(fileChooser(FILE_CHOOSER_CREATE, "Export", formats, - view->getData()->getFileName().c_str())){ + view->getData()->getFileName().c_str())) { std::string name = fileChooserGetName(1); if(CTX::instance()->confirmOverwrite) { if(!StatFile(name)) @@ -180,7 +178,7 @@ static void view_save_cb(Fl_Widget *w, void *data) goto test; } int format = 0; - switch(fileChooserGetFilter()){ + switch(fileChooserGetFilter()) { case 0: format = 2; break; case 1: format = 5; break; case 2: format = 0; break; @@ -253,23 +251,25 @@ static void view_all_visible_cb(Fl_Widget *w, void *data) if(mode >= 0) name = PView::list[mode]->getData()->getName(); for(unsigned int i = 0; i < PView::list.size(); i++) opt_view_visible(i, GMSH_SET | GMSH_GUI, - (mode == -1) ? 1 : - (mode == -2) ? 0 : - (mode == -3) ? !opt_view_visible(i, GMSH_GET, 0) : - (name == PView::list[i]->getData()->getName()) ? 1 : - 0); + (mode == -1) ? + 1 : + (mode == -2) ? + 0 : + (mode == -3) ? + !opt_view_visible(i, GMSH_GET, 0) : + (name == PView::list[i]->getData()->getName()) ? 1 : 0); drawContext::global()->draw(); } static void view_applybgmesh_cb(Fl_Widget *w, void *data) { - int index = (intptr_t)data; + int index = (intptr_t)data; if(index >= 0 && index < (int)PView::list.size()) GModel::current()->getFields()->setBackgroundMesh(index); } viewButton::viewButton(int x, int y, int w, int h, int num, Fl_Color col) - : Fl_Group(x,y,w,h) + : Fl_Group(x, y, w, h) { int popw = FL_NORMAL_SIZE + 2; @@ -298,64 +298,69 @@ viewButton::viewButton(int x, int y, int w, int h, int num, Fl_Color col) _popup = new Fl_Menu_Button(x + w - popw, y, popw, h); _popup->type(Fl_Menu_Button::POPUP123); - _popup->add("Options", 'o', - (Fl_Callback *) view_options_cb, (void *)(intptr_t)num, 0); - _popup->add("_Plugins", 'p', - (Fl_Callback *) plugin_cb, (void *)(intptr_t)num, 0); - - _popup->add("Reload", 'r', - (Fl_Callback *) view_reload_cb, (void *)(intptr_t)num, 0); - _popup->add("Reload Views/All", 0, - (Fl_Callback *) view_reload_all_cb, (void *)(intptr_t)num, 0); - _popup->add("Reload Views/Visible", 0, - (Fl_Callback *) view_reload_visible_cb, (void *)(intptr_t)num, 0); - _popup->add("_Create Alias", 0, - (Fl_Callback *) view_alias_with_options_cb, (void *)(intptr_t)num, 0); - - _popup->add("Remove", FL_Delete, - (Fl_Callback *) view_remove_cb, (void *)(intptr_t)num, 0); - _popup->add("_Remove Views/All", 0, - (Fl_Callback *) view_remove_all_cb, (void *)-1, 0); - _popup->add("Remove Views/Visible", 0, - (Fl_Callback *) view_remove_all_cb, (void *)-2, 0); - _popup->add("Remove Views/Invisible", 0, - (Fl_Callback *) view_remove_all_cb, (void *)-3, 0); - _popup->add("Remove Views/Other", 0, - (Fl_Callback *) view_remove_other_cb, (void *)(intptr_t)num, 0); - _popup->add("Remove Views/Empty", 0, - (Fl_Callback *) view_remove_all_cb, (void *)-4, 0); + _popup->add("Options", 'o', (Fl_Callback *)view_options_cb, + (void *)(intptr_t)num, 0); + _popup->add("_Plugins", 'p', (Fl_Callback *)plugin_cb, (void *)(intptr_t)num, + 0); + + _popup->add("Reload", 'r', (Fl_Callback *)view_reload_cb, + (void *)(intptr_t)num, 0); + _popup->add("Reload Views/All", 0, (Fl_Callback *)view_reload_all_cb, + (void *)(intptr_t)num, 0); + _popup->add("Reload Views/Visible", 0, (Fl_Callback *)view_reload_visible_cb, + (void *)(intptr_t)num, 0); + _popup->add("_Create Alias", 0, (Fl_Callback *)view_alias_with_options_cb, + (void *)(intptr_t)num, 0); + + _popup->add("Remove", FL_Delete, (Fl_Callback *)view_remove_cb, + (void *)(intptr_t)num, 0); + _popup->add("_Remove Views/All", 0, (Fl_Callback *)view_remove_all_cb, + (void *)-1, 0); + _popup->add("Remove Views/Visible", 0, (Fl_Callback *)view_remove_all_cb, + (void *)-2, 0); + _popup->add("Remove Views/Invisible", 0, (Fl_Callback *)view_remove_all_cb, + (void *)-3, 0); + _popup->add("Remove Views/Other", 0, (Fl_Callback *)view_remove_other_cb, + (void *)(intptr_t)num, 0); + _popup->add("Remove Views/Empty", 0, (Fl_Callback *)view_remove_all_cb, + (void *)-4, 0); _popup->add("Remove Views/With Same Name", 0, - (Fl_Callback *) view_remove_all_cb, (void *)(intptr_t)num, 0); - - _popup->add("Sort By Name", 0, - (Fl_Callback *) view_sort_cb, (void *)0, 0); - _popup->add("Set Visibility/All On", 0, - (Fl_Callback *) view_all_visible_cb, (void *)-1, 0); - _popup->add("Set Visibility/All Off", 0, - (Fl_Callback *) view_all_visible_cb, (void *)-2, 0); - _popup->add("Set Visibility/Invert", 0, - (Fl_Callback *) view_all_visible_cb, (void *)-3, 0); + (Fl_Callback *)view_remove_all_cb, (void *)(intptr_t)num, 0); + + _popup->add("Sort By Name", 0, (Fl_Callback *)view_sort_cb, (void *)0, 0); + _popup->add("Set Visibility/All On", 0, (Fl_Callback *)view_all_visible_cb, + (void *)-1, 0); + _popup->add("Set Visibility/All Off", 0, (Fl_Callback *)view_all_visible_cb, + (void *)-2, 0); + _popup->add("Set Visibility/Invert", 0, (Fl_Callback *)view_all_visible_cb, + (void *)-3, 0); _popup->add("Set Visibility/Same Name On", 0, - (Fl_Callback *) view_all_visible_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_all_visible_cb, (void *)(intptr_t)num, 0); _popup->add("Combine Elements/From All Views", 0, - (Fl_Callback *) view_combine_space_all_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_space_all_cb, (void *)(intptr_t)num, + 0); _popup->add("Combine Elements/From Visible Views", 0, - (Fl_Callback *) view_combine_space_visible_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_space_visible_cb, + (void *)(intptr_t)num, 0); _popup->add("Combine Elements/From All Views With Same Name", 0, - (Fl_Callback *) view_combine_space_by_name_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_space_by_name_cb, + (void *)(intptr_t)num, 0); _popup->add("_Combine Time Steps/From All Views", 0, - (Fl_Callback *) view_combine_time_all_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_time_all_cb, (void *)(intptr_t)num, + 0); _popup->add("Combine Time Steps/From Visible Views", 0, - (Fl_Callback *) view_combine_time_visible_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_time_visible_cb, + (void *)(intptr_t)num, 0); _popup->add("Combine Time Steps/From All Views With Same Name", 0, - (Fl_Callback *) view_combine_time_by_name_cb, (void *)(intptr_t)num, 0); + (Fl_Callback *)view_combine_time_by_name_cb, + (void *)(intptr_t)num, 0); - _popup->add("Apply As Background Mesh", 0, - (Fl_Callback *) view_applybgmesh_cb, (void *)(intptr_t)num, 0); - _popup->add("Export...", 0, - (Fl_Callback *) view_save_cb, (void *)(intptr_t)num, 0); + _popup->add("Apply As Background Mesh", 0, (Fl_Callback *)view_applybgmesh_cb, + (void *)(intptr_t)num, 0); + _popup->add("Export...", 0, (Fl_Callback *)view_save_cb, + (void *)(intptr_t)num, 0); end(); // close the group resizable(_toggle); diff --git a/Fltk/viewButton.h b/Fltk/viewButton.h index c67e1518c7023a1148c877285c6fd3bc2338e85e..a2b7d04832b2eb226cfcf10bb616f98688c933a6 100644 --- a/Fltk/viewButton.h +++ b/Fltk/viewButton.h @@ -13,17 +13,21 @@ #include <FL/Fl_Menu_Button.H> class viewButton : public Fl_Group { - private: +private: Fl_Check_Button *_toggle; Fl_Button *_butt; Fl_Menu_Button *_popup; char _tooltip[256]; - public: + +public: viewButton(int x, int y, int w, int h, int num, Fl_Color col); double value() { return _toggle->value(); } void value(double val) { _toggle->value(val); } - void copy_label(const std::string &label){ _toggle->copy_label(label.c_str()); } - std::string label(){ return _toggle->label(); } + void copy_label(const std::string &label) + { + _toggle->copy_label(label.c_str()); + } + std::string label() { return _toggle->label(); } }; #endif diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index a455e7f43c1dc4a423fcc7b9ebf0eff3142aa775..e551d7e8ad5388c50cffa5875651beea77ad7a31 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -40,33 +40,37 @@ typedef unsigned long intptr_t; #endif class Vis { - private: +private: std::string _name; - public: + +public: Vis() {} Vis(std::string &name) : _name(name) {} - virtual ~Vis(){} + virtual ~Vis() {} virtual int getTag() const = 0; virtual int getDim() const { return -1; } virtual std::string getName() const { return _name; } virtual std::string getType() const = 0; virtual char getVisibility() const = 0; - virtual void setVisibility(char val, bool recursive=false, - bool allmodels=false) = 0; + virtual void setVisibility(char val, bool recursive = false, + bool allmodels = false) = 0; }; class VisModel : public Vis { - private: +private: GModel *_model; int _tag; - public: + +public: VisModel(GModel *model, int tag, std::string &name) - : Vis(name), _model(model), _tag(tag) {} - ~VisModel(){} + : Vis(name), _model(model), _tag(tag) + { + } + ~VisModel() {} int getTag() const { return _tag; } std::string getType() const { return "Model"; } char getVisibility() const { return _model->getVisibility(); } - void setVisibility(char val, bool recursive=false, bool allmodels=false) + void setVisibility(char val, bool recursive = false, bool allmodels = false) { _model->setVisibility(val); } @@ -74,11 +78,11 @@ class VisModel : public Vis { static void setVisibilityOnOtherModels(GEntity *ge, char val, bool recursive) { - for(unsigned int i = 0; i < GModel::list.size(); i++){ + for(unsigned int i = 0; i < GModel::list.size(); i++) { GModel *m2 = GModel::list[i]; - if(m2 != ge->model()){ + if(m2 != ge->model()) { GEntity *ge2 = 0; - switch(ge->dim()){ + switch(ge->dim()) { case 0: ge2 = m2->getVertexByTag(ge->tag()); break; case 1: ge2 = m2->getEdgeByTag(ge->tag()); break; case 2: ge2 = m2->getFaceByTag(ge->tag()); break; @@ -90,87 +94,88 @@ static void setVisibilityOnOtherModels(GEntity *ge, char val, bool recursive) } class VisElementary : public Vis { - private: +private: GEntity *_e; - public: + +public: VisElementary(GEntity *e, std::string &name) : Vis(name), _e(e) {} - ~VisElementary(){} + ~VisElementary() {} int getTag() const { return _e->tag(); } int getDim() const { return _e->dim(); } std::string getType() const { - if(_e->dim() == 0) return "Point"; - else if(_e->dim() == 1) return "Curve"; - else if(_e->dim() == 2) return "Surface"; - else return "Volume"; + if(_e->dim() == 0) + return "Point"; + else if(_e->dim() == 1) + return "Curve"; + else if(_e->dim() == 2) + return "Surface"; + else + return "Volume"; } char getVisibility() const { return _e->getVisibility(); } - void setVisibility(char val, bool recursive=false, bool allmodels=false) + void setVisibility(char val, bool recursive = false, bool allmodels = false) { _e->setVisibility(val, recursive); - if(allmodels) - setVisibilityOnOtherModels(_e, val, recursive); + if(allmodels) setVisibilityOnOtherModels(_e, val, recursive); } }; class VisPhysical : public Vis { - private: +private: int _tag, _dim; char _visible; - std::vector<GEntity*> _list; - public: - VisPhysical(int tag, int dim, const std::vector<GEntity *> &list, - std::string &name) - : Vis(name) - , _tag(tag) - , _dim(dim) - , _visible(1) - , _list(list) - { - } - ~VisPhysical() {} - int getTag() const { return _tag; } - int getDim() const { return _dim; } - std::string getType() const - { - if(_dim == 0) - return "Point"; - else if(_dim == 1) - return "Curve"; - else if(_dim == 2) - return "Surface"; - else - return "Volume"; + std::vector<GEntity *> _list; + +public: + VisPhysical(int tag, int dim, const std::vector<GEntity *> &list, + std::string &name) + : Vis(name), _tag(tag), _dim(dim), _visible(1), _list(list) + { + } + ~VisPhysical() {} + int getTag() const { return _tag; } + int getDim() const { return _dim; } + std::string getType() const + { + if(_dim == 0) + return "Point"; + else if(_dim == 1) + return "Curve"; + else if(_dim == 2) + return "Surface"; + else + return "Volume"; } char getVisibility() const { return _visible; } - void setVisibility(char val, bool recursive=false, bool allmodels=false) + void setVisibility(char val, bool recursive = false, bool allmodels = false) { _visible = val; - for(unsigned int i = 0; i < _list.size(); i++){ + for(unsigned int i = 0; i < _list.size(); i++) { _list[i]->setVisibility(val, recursive); - if(allmodels) - setVisibilityOnOtherModels(_list[i], val, recursive); + if(allmodels) setVisibilityOnOtherModels(_list[i], val, recursive); } } }; class VisPartition : public Vis { - private: +private: int _tag; char _visible; - public: + +public: VisPartition(int tag) : _tag(tag), _visible(1) {} - ~VisPartition(){} + ~VisPartition() {} int getTag() const { return _tag; } std::string getType() const { return "Partition"; } char getVisibility() const { return _visible; } - void setVisibility(char val, bool recursive=false, bool allmodels=false) + void setVisibility(char val, bool recursive = false, bool allmodels = false) { _visible = val; - for(unsigned int i = 0; i < GModel::list.size(); i++){ + for(unsigned int i = 0; i < GModel::list.size(); i++) { GModel *m = GModel::list[i]; - if(allmodels || m == GModel::current()){ - std::vector<GEntity*> entities; + if(allmodels || m == GModel::current()) { + std::vector<GEntity *> entities; m->getEntities(entities); for(unsigned int j = 0; j < entities.size(); j++) for(unsigned int k = 0; k < entities[j]->getNumMeshElements(); k++) @@ -182,13 +187,14 @@ class VisPartition : public Vis { }; class VisibilityList { // singleton - private: - std::vector<Vis*> _entities; +private: + std::vector<Vis *> _entities; int _sortMode; static VisibilityList *_instance; VisibilityList() : _sortMode(-1) {} - public : - enum VisibilityType{ + +public: + enum VisibilityType { Models = 1, ElementaryEntities = 2, PhysicalEntities = 3, @@ -200,18 +206,20 @@ class VisibilityList { // singleton return _instance; } class VisLessThan { - public: + public: bool operator()(const Vis *v1, const Vis *v2) const { - switch(instance()->getSortMode()){ - case 1: return v1->getDim() < v2->getDim() ? true : false; + switch(instance()->getSortMode()) { + case 1: return v1->getDim() < v2->getDim() ? true : false; case -1: return v1->getDim() > v2->getDim() ? true : false; - case 2: return v1->getTag() < v2->getTag() ? true : false; + case 2: return v1->getTag() < v2->getTag() ? true : false; case -2: return v1->getTag() > v2->getTag() ? true : false; - case 3: return strcmp(v1->getName().c_str(), v2->getName().c_str()) < 0 ? - true : false; - default: return strcmp(v1->getName().c_str(), v2->getName().c_str()) > 0 ? - true : false; + case 3: + return strcmp(v1->getName().c_str(), v2->getName().c_str()) < 0 ? true : + false; + default: + return strcmp(v1->getName().c_str(), v2->getName().c_str()) > 0 ? true : + false; } } }; @@ -220,46 +228,48 @@ class VisibilityList { // singleton { std::map<int, std::string> oldLabels; #if defined(HAVE_PARSER) - for(std::map<std::string, gmsh_yysymbol>::iterator it = gmsh_yysymbols.begin(); + for(std::map<std::string, gmsh_yysymbol>::iterator it = + gmsh_yysymbols.begin(); it != gmsh_yysymbols.end(); ++it) if(it->first.size()) for(unsigned int i = 0; i < it->second.value.size(); i++) - oldLabels[(int)it->second.value[i]] = std::string("(") + it->first + ")"; + oldLabels[(int)it->second.value[i]] = + std::string("(") + it->first + ")"; #endif - for(unsigned int i = 0; i < _entities.size(); i++) - delete _entities[i]; + for(unsigned int i = 0; i < _entities.size(); i++) delete _entities[i]; _entities.clear(); GModel *m = GModel::current(); - if(type == Models){ - for(unsigned int i = 0; i < GModel::list.size(); i++){ + if(type == Models) { + for(unsigned int i = 0; i < GModel::list.size(); i++) { std::string name = GModel::list[i]->getName(); if(GModel::list[i] == GModel::current()) name += " (Active)"; _entities.push_back(new VisModel(GModel::list[i], i, name)); } } - else if(type == ElementaryEntities){ - std::vector<GEntity*> entities; + else if(type == ElementaryEntities) { + std::vector<GEntity *> entities; m->getEntities(entities); - for(unsigned int i = 0; i < entities.size(); i++){ + for(unsigned int i = 0; i < entities.size(); i++) { GEntity *ge = entities[i]; std::string name = m->getElementaryName(ge->dim(), ge->tag()); if(name.empty()) name = oldLabels[ge->tag()]; _entities.push_back(new VisElementary(ge, name)); } } - else if(type == PhysicalEntities){ - std::map<int, std::vector<GEntity*> > groups[4]; + else if(type == PhysicalEntities) { + std::map<int, std::vector<GEntity *> > groups[4]; m->getPhysicalGroups(groups); - for(int i = 0; i < 4; i++){ - std::map<int, std::vector<GEntity*> >::const_iterator it = groups[i].begin(); - for(; it != groups[i].end(); ++it){ + for(int i = 0; i < 4; i++) { + std::map<int, std::vector<GEntity *> >::const_iterator it = + groups[i].begin(); + for(; it != groups[i].end(); ++it) { std::string name = m->getPhysicalName(i, it->first); if(name.empty()) name = oldLabels[it->first]; _entities.push_back(new VisPhysical(it->first, i, it->second, name)); } } } - else if(type == MeshPartitions){ + else if(type == MeshPartitions) { for(unsigned int part = 0; part < m->getNumPartitions(); part++) _entities.push_back(new VisPartition(part + 1)); } @@ -270,25 +280,26 @@ class VisibilityList { // singleton // get the number of entities in the list Vis *getEntity(int i) { return _entities[i]; } // get the visibility information for the nth entity in the list - char getVisibility(int n){ return _entities[n]->getVisibility(); } + char getVisibility(int n) { return _entities[n]->getVisibility(); } // set the visibility information for the nth entity in the list - void setVisibility(int n, char val, bool recursive=false, bool allmodels=false) + void setVisibility(int n, char val, bool recursive = false, + bool allmodels = false) { _entities[n]->setVisibility(val, recursive, allmodels); } // set all entities to be invisible - void setAllInvisible(VisibilityType type, bool allmodels=false) + void setAllInvisible(VisibilityType type, bool allmodels = false) { - if(type == Models){ + if(type == Models) { for(unsigned int i = 0; i < GModel::list.size(); i++) GModel::list[i]->setVisibility(0); } - else if(type == ElementaryEntities || type == PhysicalEntities){ + else if(type == ElementaryEntities || type == PhysicalEntities) { // elementary or physical mode: set all entities in the model invisible - for(unsigned int i = 0; i < GModel::list.size(); i++){ + for(unsigned int i = 0; i < GModel::list.size(); i++) { GModel *m = GModel::list[i]; - if(allmodels || m == GModel::current()){ - std::vector<GEntity*> entities; + if(allmodels || m == GModel::current()) { + std::vector<GEntity *> entities; m->getEntities(entities); for(unsigned int j = 0; j < entities.size(); j++) entities[j]->setVisibility(0); @@ -299,20 +310,19 @@ class VisibilityList { // singleton for(int i = 0; i < getNumEntities(); i++) setVisibility(i, 0); } // get the tag of the nth entity in the list - int getTag(int n){ return _entities[n]->getTag(); } + int getTag(int n) { return _entities[n]->getTag(); } // get the browser line for the nth entity in the list std::string getBrowserLine(int n) { std::ostringstream sstream; - sstream << "\t" << _entities[n]->getType() - << "\t" << _entities[n]->getTag() + sstream << "\t" << _entities[n]->getType() << "\t" << _entities[n]->getTag() << "\t" << _entities[n]->getName(); return sstream.str(); } // set the sort mode - void setSortMode(int mode){ _sortMode = (_sortMode != mode) ? mode : -mode; } + void setSortMode(int mode) { _sortMode = (_sortMode != mode) ? mode : -mode; } // get the sort mode - int getSortMode(){ return _sortMode; } + int getSortMode() { return _sortMode; } }; VisibilityList *VisibilityList::_instance = 0; @@ -322,17 +332,18 @@ static void _rebuild_list_browser() FlGui::instance()->visibility->browser->clear(); VisibilityList::VisibilityType type; - switch(FlGui::instance()->visibility->browser_type->value()){ + switch(FlGui::instance()->visibility->browser_type->value()) { case 0: type = VisibilityList::Models; break; case 2: type = VisibilityList::PhysicalEntities; break; case 3: type = VisibilityList::MeshPartitions; break; - case 1: default: type = VisibilityList::ElementaryEntities; break; + case 1: + default: type = VisibilityList::ElementaryEntities; break; } VisibilityList::instance()->update(type); - for(int i = 0; i < VisibilityList::instance()->getNumEntities(); i++){ - FlGui::instance()->visibility->browser->add - (VisibilityList::instance()->getBrowserLine(i).c_str()); + for(int i = 0; i < VisibilityList::instance()->getNumEntities(); i++) { + FlGui::instance()->visibility->browser->add( + VisibilityList::instance()->getBrowserLine(i).c_str()); if(VisibilityList::instance()->getVisibility(i)) FlGui::instance()->visibility->browser->select(i + 1); } @@ -342,16 +353,19 @@ static void visibility_browser_apply_cb(Fl_Widget *w, void *data) { // if the browser is not empty, get the selections made in the // browser and apply them into the model - if(VisibilityList::instance()->getNumEntities()){ + if(VisibilityList::instance()->getNumEntities()) { CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME); - bool recursive = FlGui::instance()->visibility->butt[0]->value() ? true : false; - bool allmodels = FlGui::instance()->visibility->butt[1]->value() ? true : false; + bool recursive = + FlGui::instance()->visibility->butt[0]->value() ? true : false; + bool allmodels = + FlGui::instance()->visibility->butt[1]->value() ? true : false; VisibilityList::VisibilityType type; - switch(FlGui::instance()->visibility->browser_type->value()){ + switch(FlGui::instance()->visibility->browser_type->value()) { case 0: type = VisibilityList::Models; break; case 2: type = VisibilityList::PhysicalEntities; break; case 3: type = VisibilityList::MeshPartitions; break; - case 1: default: type = VisibilityList::ElementaryEntities; break; + case 1: + default: type = VisibilityList::ElementaryEntities; break; } VisibilityList::instance()->setAllInvisible(type, allmodels); for(int i = 0; i < VisibilityList::instance()->getNumEntities(); i++) @@ -367,7 +381,7 @@ static void visibility_browser_apply_cb(Fl_Widget *w, void *data) static void visibility_sort_cb(Fl_Widget *w, void *data) { - const char *str = (const char*)data; + const char *str = (const char *)data; int val; if(!strcmp(str, "type")) val = 1; @@ -395,18 +409,18 @@ static void visibility_sort_cb(Fl_Widget *w, void *data) else FlGui::instance()->visibility->browser->deselect(); } - else if(val == -1){ // invert the selection + else if(val == -1) { // invert the selection int *state = new int[FlGui::instance()->visibility->browser->size()]; for(int i = 0; i < FlGui::instance()->visibility->browser->size(); i++) state[i] = FlGui::instance()->visibility->browser->selected(i + 1); FlGui::instance()->visibility->browser->deselect(); for(int i = 0; i < FlGui::instance()->visibility->browser->size(); i++) if(!state[i]) FlGui::instance()->visibility->browser->select(i + 1); - delete [] state; + delete[] state; } - else if(val == -2){ // create new parameter name for selection - for(int i = 0; i < FlGui::instance()->visibility->browser->size(); i++){ - if(FlGui::instance()->visibility->browser->selected(i + 1)){ + else if(val == -2) { // create new parameter name for selection + for(int i = 0; i < FlGui::instance()->visibility->browser->size(); i++) { + if(FlGui::instance()->visibility->browser->selected(i + 1)) { static char tmpstr[256]; sprintf(tmpstr, "%d", VisibilityList::instance()->getTag(i)); FlGui::instance()->elementaryContext->input[1]->value(tmpstr); @@ -418,39 +432,37 @@ static void visibility_sort_cb(Fl_Widget *w, void *data) } else { // set new sorting mode VisibilityList::instance()->setSortMode(val); - visibility_cb(NULL, (void*)"redraw_only"); + visibility_cb(NULL, (void *)"redraw_only"); } } -class listBrowser : public Fl_Browser{ +class listBrowser : public Fl_Browser { int handle(int event) { void *l = selection(); - switch(event){ + switch(event) { case FL_SHORTCUT: case FL_KEYBOARD: - if(Fl::test_shortcut(FL_CTRL+'a')){ - for(int i = 0; i < size(); i++) - select(i + 1); + if(Fl::test_shortcut(FL_CTRL + 'a')) { + for(int i = 0; i < size(); i++) select(i + 1); return 1; } - else if(Fl::test_shortcut(FL_Enter) || - Fl::test_shortcut(FL_KP_Enter)){ + else if(Fl::test_shortcut(FL_Enter) || Fl::test_shortcut(FL_KP_Enter)) { visibility_browser_apply_cb(NULL, NULL); Fl_Browser_::select(l); return 1; } - else if(Fl::test_shortcut(FL_Up)){ - if(l && (l = item_prev(l))){ + else if(Fl::test_shortcut(FL_Up)) { + if(l && (l = item_prev(l))) { select_only(l, 1); visibility_browser_apply_cb(NULL, NULL); Fl_Browser_::select(l); return 1; } } - else if(Fl::test_shortcut(FL_Down)){ - if(l && (l = item_next(l))){ + else if(Fl::test_shortcut(FL_Down)) { + if(l && (l = item_next(l))) { select_only(l, 1); visibility_browser_apply_cb(NULL, NULL); Fl_Browser_::select(l); @@ -460,9 +472,12 @@ class listBrowser : public Fl_Browser{ } return Fl_Browser::handle(event); } - public: - listBrowser(int x, int y, int w , int h, const char* c = 0) - : Fl_Browser(x, y, w, h, c){} + +public: + listBrowser(int x, int y, int w, int h, const char *c = 0) + : Fl_Browser(x, y, w, h, c) + { + } }; static void _add_vertex(GVertex *gv, Fl_Tree *tree, const std::string &path) @@ -472,7 +487,7 @@ static void _add_vertex(GVertex *gv, Fl_Tree *tree, const std::string &path) Fl_Tree_Item *n = tree->add(vertex.str().c_str()); if(!n) return; if(gv->getVisibility()) n->select(1); - n->user_data((void*)gv); + n->user_data((void *)gv); n->close(); } @@ -483,12 +498,10 @@ static void _add_edge(GEdge *ge, Fl_Tree *tree, const std::string &path) Fl_Tree_Item *n = tree->add(edge.str().c_str()); if(!n) return; if(ge->getVisibility()) n->select(1); - n->user_data((void*)ge); + n->user_data((void *)ge); n->close(); - if(ge->getBeginVertex()) - _add_vertex(ge->getBeginVertex(), tree, edge.str()); - if(ge->getEndVertex()) - _add_vertex(ge->getEndVertex(), tree, edge.str()); + if(ge->getBeginVertex()) _add_vertex(ge->getBeginVertex(), tree, edge.str()); + if(ge->getEndVertex()) _add_vertex(ge->getEndVertex(), tree, edge.str()); } static void _add_face(GFace *gf, Fl_Tree *tree, const std::string &path) @@ -498,10 +511,11 @@ static void _add_face(GFace *gf, Fl_Tree *tree, const std::string &path) Fl_Tree_Item *n = tree->add(face.str().c_str()); if(!n) return; if(gf->getVisibility()) n->select(1); - n->user_data((void*)gf); + n->user_data((void *)gf); n->close(); - std::vector<GEdge*> const& edges = gf->edges(); - for(std::vector<GEdge*>::const_iterator it = edges.begin(); it != edges.end(); it++) + std::vector<GEdge *> const &edges = gf->edges(); + for(std::vector<GEdge *>::const_iterator it = edges.begin(); + it != edges.end(); it++) _add_edge(*it, tree, face.str()); } @@ -512,10 +526,11 @@ static void _add_region(GRegion *gr, Fl_Tree *tree, const std::string &path) Fl_Tree_Item *n = tree->add(region.str().c_str()); if(!n) return; if(gr->getVisibility()) n->select(1); - n->user_data((void*)gr); + n->user_data((void *)gr); n->close(); - std::vector<GFace*> faces = gr->faces(); - for(std::vector<GFace*>::iterator it = faces.begin(); it != faces.end(); it++) + std::vector<GFace *> faces = gr->faces(); + for(std::vector<GFace *>::iterator it = faces.begin(); it != faces.end(); + it++) _add_face(*it, tree, region.str()); } @@ -531,51 +546,49 @@ static void _add_physical_group(int dim, int num, std::vector<GEntity *> &ge, Fl_Tree_Item *n; std::ostringstream group; group << path; - switch(dim){ + switch(dim) { case 3: group << "Physical Volume " << num << name << "/"; n = tree->add(group.str().c_str()); if(n) n->close(); for(unsigned int i = 0; i < ge.size(); i++) - _add_region((GRegion*)ge[i], tree, group.str()); + _add_region((GRegion *)ge[i], tree, group.str()); break; case 2: group << "Physical Surface " << num << name << "/"; n = tree->add(group.str().c_str()); if(n) n->close(); for(unsigned int i = 0; i < ge.size(); i++) - _add_face((GFace*)ge[i], tree, group.str()); + _add_face((GFace *)ge[i], tree, group.str()); break; case 1: group << "Physical Curve " << num << name << "/"; n = tree->add(group.str().c_str()); if(n) n->close(); for(unsigned int i = 0; i < ge.size(); i++) - _add_edge((GEdge*)ge[i], tree, group.str()); + _add_edge((GEdge *)ge[i], tree, group.str()); break; case 0: group << "Physical Point " << num << name << "/"; n = tree->add(group.str().c_str()); if(n) n->close(); for(unsigned int i = 0; i < ge.size(); i++) - _add_vertex((GVertex*)ge[i], tree, group.str()); - break; - default: + _add_vertex((GVertex *)ge[i], tree, group.str()); break; + default: break; } } static void _rebuild_tree_browser(bool force) { - if(!force){ + if(!force) { int numEnt = 0; - for(unsigned int i = 0; i < GModel::list.size(); i++){ - numEnt += GModel::list[i]->getNumRegions() + - GModel::list[i]->getNumFaces() + - GModel::list[i]->getNumEdges() + - GModel::list[i]->getNumVertices(); + for(unsigned int i = 0; i < GModel::list.size(); i++) { + numEnt += + GModel::list[i]->getNumRegions() + GModel::list[i]->getNumFaces() + + GModel::list[i]->getNumEdges() + GModel::list[i]->getNumVertices(); } - if(numEnt > 10000){ + if(numEnt > 10000) { FlGui::instance()->visibility->tree->hide(); FlGui::instance()->visibility->tree_create->show(); return; @@ -586,7 +599,7 @@ static void _rebuild_tree_browser(bool force) FlGui::instance()->visibility->tree->show(); FlGui::instance()->visibility->tree->clear(); - for(unsigned int i = 0; i < GModel::list.size(); i++){ + for(unsigned int i = 0; i < GModel::list.size(); i++) { GModel *m = GModel::list[i]; std::ostringstream model; model << "Model [" << i << "] <<" << m->getName() << ">>"; @@ -595,7 +608,7 @@ static void _rebuild_tree_browser(bool force) Fl_Tree_Item *n; n = FlGui::instance()->visibility->tree->add(model.str().c_str()); - if(n){ + if(n) { if(m->getVisibility()) n->select(1); n->close(); } @@ -616,18 +629,21 @@ static void _rebuild_tree_browser(bool force) n = FlGui::instance()->visibility->tree->add(physical.c_str()); if(n) n->close(); - std::map<int, std::vector<GEntity*> > groups[4]; + std::map<int, std::vector<GEntity *> > groups[4]; m->getPhysicalGroups(groups); std::map<int, std::string> oldLabels; #if defined(HAVE_PARSER) - for(std::map<std::string, gmsh_yysymbol>::iterator it = gmsh_yysymbols.begin(); + for(std::map<std::string, gmsh_yysymbol>::iterator it = + gmsh_yysymbols.begin(); it != gmsh_yysymbols.end(); ++it) if(it->first.size()) for(unsigned int i = 0; i < it->second.value.size(); i++) - oldLabels[(int)it->second.value[i]] = std::string("(") + it->first + ")"; + oldLabels[(int)it->second.value[i]] = + std::string("(") + it->first + ")"; #endif for(int i = 3; i >= 0; i--) - for(std::map<int, std::vector<GEntity*> >::iterator it = groups[i].begin(); + for(std::map<int, std::vector<GEntity *> >::iterator it = + groups[i].begin(); it != groups[i].end(); it++) _add_physical_group(i, it->first, it->second, oldLabels, FlGui::instance()->visibility->tree, physical); @@ -645,55 +661,57 @@ static void build_tree_cb(Fl_Widget *w, void *data) static void _recur_select(Fl_Tree_Item *n) { n->select(1); - for(int i = 0; i < n->children(); i++) - _recur_select(n->child(i)); + for(int i = 0; i < n->children(); i++) _recur_select(n->child(i)); } static void _recur_set_visible(Fl_Tree_Item *n) { - if(n->user_data() && n->is_selected()){ - GEntity *ge = (GEntity*)n->user_data(); - bool recursive = FlGui::instance()->visibility->butt[0]->value() ? true : false; + if(n->user_data() && n->is_selected()) { + GEntity *ge = (GEntity *)n->user_data(); + bool recursive = + FlGui::instance()->visibility->butt[0]->value() ? true : false; ge->setVisibility(1, recursive); // force this: if we ask to see an entity, let's assume that we // don't want the whole model to be invisible ge->model()->setVisibility(1); } - for(int i = 0; i < n->children(); i++) - _recur_set_visible(n->child(i)); + for(int i = 0; i < n->children(); i++) _recur_set_visible(n->child(i)); } static void _recur_update_selected(Fl_Tree_Item *n) { - if(n->user_data()){ - GEntity *ge = (GEntity*)n->user_data(); + if(n->user_data()) { + GEntity *ge = (GEntity *)n->user_data(); n->select(ge->getVisibility() ? 1 : 0); } - for(int i = 0; i < n->children(); i++) - _recur_update_selected(n->child(i)); + for(int i = 0; i < n->children(); i++) _recur_update_selected(n->child(i)); } static void visibility_tree_apply_cb(Fl_Widget *w, void *data) { CTX::instance()->mesh.changed |= (ENT_CURVE | ENT_SURFACE | ENT_VOLUME); - bool recursive = FlGui::instance()->visibility->butt[0]->value() ? true : false; + bool recursive = + FlGui::instance()->visibility->butt[0]->value() ? true : false; Fl_Tree_Item *root = FlGui::instance()->visibility->tree->root(); - for(int i = 0; i < root->children(); i++){ + for(int i = 0; i < root->children(); i++) { GModel *m = GModel::list[i]; Fl_Tree_Item *n = root->child(i); // treat special levels separately - if(recursive){ - if(root->is_selected() || n->is_selected()){ // if root or model is selected + if(recursive) { + if(root->is_selected() || + n->is_selected()) { // if root or model is selected _recur_select(n); } - else{ - for(int j = 0; j < n->children(); j++){ + else { + for(int j = 0; j < n->children(); j++) { if(n->child(j)->is_selected()) // if elementary/physical is selected _recur_select(n->child(j)); - else if(j == 1){ - for(int k = 0; k < n->child(j)->children(); k++){ - if(n->child(j)->child(k)->is_selected()) // if physical ent is selected + else if(j == 1) { + for(int k = 0; k < n->child(j)->children(); k++) { + if(n->child(j) + ->child(k) + ->is_selected()) // if physical ent is selected _recur_select(n->child(j)->child(k)); } } @@ -701,7 +719,7 @@ static void visibility_tree_apply_cb(Fl_Widget *w, void *data) } } // set all entities as invisible - std::vector<GEntity*> entities; + std::vector<GEntity *> entities; m->getEntities(entities); for(unsigned int j = 0; j < entities.size(); j++) entities[j]->setVisibility(0); @@ -714,29 +732,32 @@ static void visibility_tree_apply_cb(Fl_Widget *w, void *data) drawContext::global()->draw(); } -class treeBrowser : public Fl_Tree{ +class treeBrowser : public Fl_Tree { int handle(int event) { - switch(event){ + switch(event) { case FL_SHORTCUT: case FL_KEYBOARD: - if(Fl::test_shortcut(FL_Enter) || Fl::test_shortcut(FL_KP_Enter)){ + if(Fl::test_shortcut(FL_Enter) || Fl::test_shortcut(FL_KP_Enter)) { visibility_tree_apply_cb(NULL, NULL); return 1; } } return Fl_Tree::handle(event); } - public: - treeBrowser(int x, int y, int w , int h, const char* c = 0) - : Fl_Tree(x, y, w, h, c){} + +public: + treeBrowser(int x, int y, int w, int h, const char *c = 0) + : Fl_Tree(x, y, w, h, c) + { + } }; void visibility_cb(Fl_Widget *w, void *data) { // get the visibility info from the model, and update the browser // accordingly - const char *str = (const char*)data; + const char *str = (const char *)data; if(str && !strcmp(str, "redraw_only")) FlGui::instance()->visibility->show(true); else @@ -755,43 +776,43 @@ static void visibility_save_cb(Fl_Widget *w, void *data) std::vector<int> state[4][2]; GModel *m = GModel::current(); for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); it++) - (*it)->getVisibility() ? - state[0][1].push_back((*it)->tag()) : state[0][0].push_back((*it)->tag()); + (*it)->getVisibility() ? state[0][1].push_back((*it)->tag()) : + state[0][0].push_back((*it)->tag()); for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++) - (*it)->getVisibility() ? - state[1][1].push_back((*it)->tag()) : state[1][0].push_back((*it)->tag()); + (*it)->getVisibility() ? state[1][1].push_back((*it)->tag()) : + state[1][0].push_back((*it)->tag()); for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) - (*it)->getVisibility() ? - state[2][1].push_back((*it)->tag()) : state[2][0].push_back((*it)->tag()); + (*it)->getVisibility() ? state[2][1].push_back((*it)->tag()) : + state[2][0].push_back((*it)->tag()); for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); it++) - (*it)->getVisibility() ? - state[3][1].push_back((*it)->tag()) : state[3][0].push_back((*it)->tag()); + (*it)->getVisibility() ? state[3][1].push_back((*it)->tag()) : + state[3][0].push_back((*it)->tag()); char tmp[256]; const char *labels[4] = {"Point", "Curve", "Surface", "Volume"}; std::string str; int mode; int on = 0, off = 0; - for(int i = 0; i < 4; i++){ + for(int i = 0; i < 4; i++) { on += state[i][1].size(); off += state[i][0].size(); } - if(on > off){ + if(on > off) { add_infile("Show \"*\";", GModel::current()->getFileName()); if(!off) return; str += "Hide {\n"; mode = 0; } - else{ + else { add_infile("Hide \"*\";", GModel::current()->getFileName()); if(!on) return; str += "Show {\n"; mode = 1; } - for(int i = 0; i < 4; i++){ - if(state[i][mode].size()){ + for(int i = 0; i < 4; i++) { + if(state[i][mode].size()) { str += labels[i]; str += "{"; - for(unsigned int j = 0; j < state[i][mode].size(); j++){ + for(unsigned int j = 0; j < state[i][mode].size(); j++) { if(j) str += ","; sprintf(tmp, "%d", state[i][mode][j]); str += tmp; @@ -804,29 +825,29 @@ static void visibility_save_cb(Fl_Widget *w, void *data) Msg::StatusBar(true, "Done appending visibility info"); } -static void _set_visibility_by_number(int what, int num, char val, bool recursive, - bool allmodels) +static void _set_visibility_by_number(int what, int num, char val, + bool recursive, bool allmodels) { bool all = (num < 0) ? true : false; - for(unsigned int mod = 0; mod < GModel::list.size(); mod++){ + for(unsigned int mod = 0; mod < GModel::list.size(); mod++) { GModel *m = GModel::list[mod]; - if(allmodels || m == GModel::current()){ - std::vector<GEntity*> entities; + if(allmodels || m == GModel::current()) { + std::vector<GEntity *> entities; m->getEntities(entities); - switch(what){ + switch(what) { case 0: // nodes - for(unsigned int i = 0; i < entities.size(); i++){ - for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++){ + for(unsigned int i = 0; i < entities.size(); i++) { + for(unsigned int j = 0; j < entities[i]->mesh_vertices.size(); j++) { MVertex *v = entities[i]->mesh_vertices[j]; if(all || v->getNum() == num) v->setVisibility(val); } } break; case 1: // elements - for(unsigned int i = 0; i < entities.size(); i++){ - for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++){ + for(unsigned int i = 0; i < entities.size(); i++) { + for(unsigned int j = 0; j < entities[i]->getNumMeshElements(); j++) { MElement *e = entities[i]->getMeshElement(j); if(all || e->getNum() == num) e->setVisibility(val); } @@ -851,25 +872,25 @@ static void _set_visibility_by_number(int what, int num, char val, bool recursiv case 6: // physical point for(GModel::viter it = m->firstVertex(); it != m->lastVertex(); it++) for(unsigned int i = 0; i < (*it)->physicals.size(); i++) - if (all || std::abs((*it)->physicals[i]) == num) + if(all || std::abs((*it)->physicals[i]) == num) (*it)->setVisibility(val, recursive); break; case 7: // physical line for(GModel::eiter it = m->firstEdge(); it != m->lastEdge(); it++) for(unsigned int i = 0; i < (*it)->physicals.size(); i++) - if (all || std::abs((*it)->physicals[i]) == num) + if(all || std::abs((*it)->physicals[i]) == num) (*it)->setVisibility(val, recursive); break; case 8: // physical surface for(GModel::fiter it = m->firstFace(); it != m->lastFace(); it++) for(unsigned int i = 0; i < (*it)->physicals.size(); i++) - if (all || std::abs((*it)->physicals[i]) == num) + if(all || std::abs((*it)->physicals[i]) == num) (*it)->setVisibility(val, recursive); break; case 9: // physical volume for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); it++) for(unsigned int i = 0; i < (*it)->physicals.size(); i++) - if (all || std::abs((*it)->physicals[i]) == num) + if(all || std::abs((*it)->physicals[i]) == num) (*it)->setVisibility(val, recursive); break; } @@ -878,16 +899,18 @@ static void _set_visibility_by_number(int what, int num, char val, bool recursiv } static void _apply_visibility(char mode, bool physical, - std::vector<GVertex*> &vertices, - std::vector<GEdge*> &edges, - std::vector<GFace*> &faces, - std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements) + std::vector<GVertex *> &vertices, + std::vector<GEdge *> &edges, + std::vector<GFace *> &faces, + std::vector<GRegion *> ®ions, + std::vector<MElement *> &elements) { - bool recursive = FlGui::instance()->visibility->butt[0]->value() ? true : false; - bool allmodels = FlGui::instance()->visibility->butt[1]->value() ? true : false; + bool recursive = + FlGui::instance()->visibility->butt[0]->value() ? true : false; + bool allmodels = + FlGui::instance()->visibility->butt[1]->value() ? true : false; - if(mode == 1){ // when showing a single entity, first hide everything + if(mode == 1) { // when showing a single entity, first hide everything if(CTX::instance()->pickElements) _set_visibility_by_number(1, -1, 0, false, allmodels); else @@ -897,12 +920,12 @@ static void _apply_visibility(char mode, bool physical, if(mode == 2) mode = 1; - if(CTX::instance()->pickElements){ + if(CTX::instance()->pickElements) { for(unsigned int i = 0; i < elements.size(); i++) elements[i]->setVisibility(mode); } - else{ - for(unsigned int i = 0; i < vertices.size(); i++){ + else { + for(unsigned int i = 0; i < vertices.size(); i++) { if(!physical) vertices[i]->setVisibility(mode, recursive); else @@ -910,23 +933,23 @@ static void _apply_visibility(char mode, bool physical, _set_visibility_by_number(6, vertices[i]->physicals[j], mode, recursive, allmodels); } - for(unsigned int i = 0; i < edges.size(); i++){ + for(unsigned int i = 0; i < edges.size(); i++) { if(!physical) edges[i]->setVisibility(mode, recursive); else for(unsigned int j = 0; j < edges[i]->physicals.size(); j++) - _set_visibility_by_number(7, edges[i]->physicals[j], mode, - recursive, allmodels); + _set_visibility_by_number(7, edges[i]->physicals[j], mode, recursive, + allmodels); } - for(unsigned int i = 0; i < faces.size(); i++){ + for(unsigned int i = 0; i < faces.size(); i++) { if(!physical) faces[i]->setVisibility(mode, recursive); else for(unsigned int j = 0; j < faces[i]->physicals.size(); j++) - _set_visibility_by_number(8, faces[i]->physicals[j], mode, - recursive, allmodels); + _set_visibility_by_number(8, faces[i]->physicals[j], mode, recursive, + allmodels); } - for(unsigned int i = 0; i < regions.size(); i++){ + for(unsigned int i = 0; i < regions.size(); i++) { if(!physical) regions[i]->setVisibility(mode, recursive); else @@ -936,7 +959,7 @@ static void _apply_visibility(char mode, bool physical, } } int pos = FlGui::instance()->visibility->browser->position(); - visibility_cb(NULL, (void*)"redraw_only"); + visibility_cb(NULL, (void *)"redraw_only"); FlGui::instance()->visibility->browser->position(pos); } @@ -950,98 +973,101 @@ static void visibility_number_cb(Fl_Widget *w, void *data) // volumes int what = (intptr_t)data; char val; - if(what >= 100){ // show + if(what >= 100) { // show val = 1; what -= 100; } - else{ // hide + else { // hide val = 0; } const char *str = FlGui::instance()->visibility->input[what]->value(); int num = (!strcmp(str, "all") || !strcmp(str, "*")) ? -1 : atoi(str); - bool recursive = FlGui::instance()->visibility->butt[0]->value() ? true : false; - bool allmodels = FlGui::instance()->visibility->butt[1]->value() ? true : false; + bool recursive = + FlGui::instance()->visibility->butt[0]->value() ? true : false; + bool allmodels = + FlGui::instance()->visibility->butt[1]->value() ? true : false; _set_visibility_by_number(what, num, val, recursive, allmodels); int pos = FlGui::instance()->visibility->browser->position(); - visibility_cb(NULL, (void*)"redraw_only"); + visibility_cb(NULL, (void *)"redraw_only"); FlGui::instance()->visibility->browser->position(pos); drawContext::global()->draw(); } static void visibility_interactive_cb(Fl_Widget *w, void *data) { - std::string str((const char*)data); + std::string str((const char *)data); int what; char mode; // 0 for hide, 1 for show, 2 for undo bool physical = (str.find("physical") != std::string::npos); - if(str == "elements to hide"){ + if(str == "elements to hide") { CTX::instance()->pickElements = 1; what = ENT_ALL; mode = 0; } - else if(str == "points to hide" || str == "physical points to hide"){ + else if(str == "points to hide" || str == "physical points to hide") { CTX::instance()->pickElements = 0; what = ENT_POINT; mode = 0; opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "curves to hide" || str == "physical curves to hide"){ + else if(str == "curves to hide" || str == "physical curves to hide") { CTX::instance()->pickElements = 0; what = ENT_CURVE; mode = 0; opt_geometry_curves(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "surfaces to hide" || str == "physical surfaces to hide"){ + else if(str == "surfaces to hide" || str == "physical surfaces to hide") { CTX::instance()->pickElements = 0; what = ENT_SURFACE; mode = 0; if(GModel::current()->getMeshStatus() < 2) opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "volumes to hide" || str == "physical volumes to hide"){ + else if(str == "volumes to hide" || str == "physical volumes to hide") { CTX::instance()->pickElements = 0; what = ENT_VOLUME; mode = 0; if(GModel::current()->getMeshStatus() < 3) opt_geometry_volumes(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "elements to show"){ + else if(str == "elements to show") { CTX::instance()->pickElements = 1; what = ENT_ALL; mode = 1; } - else if(str == "points to show" || str == "physical points to show"){ + else if(str == "points to show" || str == "physical points to show") { CTX::instance()->pickElements = 0; what = ENT_POINT; mode = 1; opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "curves to show" || str == "physical curves to show"){ + else if(str == "curves to show" || str == "physical curves to show") { CTX::instance()->pickElements = 0; what = ENT_CURVE; mode = 1; opt_geometry_curves(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "surfaces to show" || str == "physical surfaces to show"){ + else if(str == "surfaces to show" || str == "physical surfaces to show") { CTX::instance()->pickElements = 0; what = ENT_SURFACE; mode = 1; if(GModel::current()->getMeshStatus() < 2) opt_geometry_surfaces(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "volumes to show" || str == "physical volumes to show"){ + else if(str == "volumes to show" || str == "physical volumes to show") { CTX::instance()->pickElements = 0; what = ENT_VOLUME; mode = 1; if(GModel::current()->getMeshStatus() < 3) opt_geometry_volumes(0, GMSH_SET | GMSH_GUI, 1); } - else if(str == "show all"){ - bool allmodels = FlGui::instance()->visibility->butt[1]->value() ? true : false; + else if(str == "show all") { + bool allmodels = + FlGui::instance()->visibility->butt[1]->value() ? true : false; for(int i = 1; i <= 5; i++) // elements, points, curves, surfaces, volumes _set_visibility_by_number(i, -1, 1, false, allmodels); CTX::instance()->mesh.changed = ENT_ALL; @@ -1051,18 +1077,17 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) else return; - std::vector<GVertex*> vertices; - std::vector<GEdge*> edges; - std::vector<GFace*> faces; - std::vector<GRegion*> regions; - std::vector<MElement*> elements; + std::vector<GVertex *> vertices; + std::vector<GEdge *> edges; + std::vector<GFace *> faces; + std::vector<GRegion *> regions; + std::vector<MElement *> elements; while(1) { - if(what == ENT_ALL) - CTX::instance()->mesh.changed = ENT_ALL; + if(what == ENT_ALL) CTX::instance()->mesh.changed = ENT_ALL; drawContext::global()->draw(); - Msg::StatusGl("Select %s\n[Press %s'q' to abort]", - str.c_str(), mode ? "" : "'u' to undo or "); + Msg::StatusGl("Select %s\n[Press %s'q' to abort]", str.c_str(), + mode ? "" : "'u' to undo or "); char ib = FlGui::instance()->selectEntity(what); if(ib == 'l') { @@ -1072,12 +1097,13 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) faces = FlGui::instance()->selectedFaces; regions = FlGui::instance()->selectedRegions; elements = FlGui::instance()->selectedElements; - _apply_visibility(mode, physical, vertices, edges, faces, regions, elements); + _apply_visibility(mode, physical, vertices, edges, faces, regions, + elements); } - if(ib == 'u' && !mode){ // undo only in hide mode + if(ib == 'u' && !mode) { // undo only in hide mode _apply_visibility(2, physical, vertices, edges, faces, regions, elements); } - if(ib == 'q'){ + if(ib == 'q') { break; } } @@ -1090,26 +1116,32 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data) static void visibility_per_window_cb(Fl_Widget *w, void *data) { - std::string what = (const char*)data; - if(what == "item"){ - drawContext *ctx = FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); + std::string what = (const char *)data; + if(what == "item") { + drawContext *ctx = + FlGui::instance()->getCurrentOpenglWindow()->getDrawContext(); for(unsigned int i = 0; - i < (unsigned int)FlGui::instance()->visibility->per_window->size(); i++){ - if(i < GModel::list.size()){ + i < (unsigned int)FlGui::instance()->visibility->per_window->size(); + i++) { + if(i < GModel::list.size()) { GModel *m = GModel::list[i]; - if(FlGui::instance()->visibility->per_window->selected(i + 1)) ctx->show(m); - else ctx->hide(m); + if(FlGui::instance()->visibility->per_window->selected(i + 1)) + ctx->show(m); + else + ctx->hide(m); } - else if(i < GModel::list.size() + PView::list.size()){ + else if(i < GModel::list.size() + PView::list.size()) { PView *v = PView::list[i - GModel::list.size()]; - if(FlGui::instance()->visibility->per_window->selected(i + 1)) ctx->show(v); - else ctx->hide(v); + if(FlGui::instance()->visibility->per_window->selected(i + 1)) + ctx->show(v); + else + ctx->hide(v); } } } - else if(what == "reset_all"){ - for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++){ - for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++){ + else if(what == "reset_all") { + for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++) { + for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++) { drawContext *ctx = FlGui::instance()->graph[i]->gl[j]->getDrawContext(); ctx->showAll(); } @@ -1131,50 +1163,49 @@ visibilityWindow::visibilityWindow(int deltaFontSize) int height = 18 * BH; int brw = width - 4 * WB; - win = new paletteWindow - (width, height, CTX::instance()->nonModalWindows ? true : false, "Visibility"); + win = new paletteWindow(width, height, + CTX::instance()->nonModalWindows ? true : false, + "Visibility"); win->box(GMSH_WINDOW_BOX); - Fl_Tabs *o = new Fl_Tabs - (WB, WB, width - 2 * WB, height - 3 * WB - BH); + Fl_Tabs *o = new Fl_Tabs(WB, WB, width - 2 * WB, height - 3 * WB - BH); { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "List browser"); + Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "List browser"); { - Fl_Group *gg = new Fl_Group - (2 * WB, WB + BH, cols[0] + cols[1] + cols[2] + cols[3] / 2, BH); + Fl_Group *gg = new Fl_Group( + 2 * WB, WB + BH, cols[0] + cols[1] + cols[2] + cols[3] / 2, BH); gg->resizable(NULL); - Fl_Button *o0 = new Fl_Button - (2 * WB, 2 * WB + BH, cols[0], BH/2, "*"); + Fl_Button *o0 = new Fl_Button(2 * WB, 2 * WB + BH, cols[0], BH / 2, "*"); o0->box(FL_THIN_UP_BOX); o0->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); o0->tooltip("Select/unselect all"); o0->callback(visibility_sort_cb, (void *)"*"); - Fl_Button *o1 = new Fl_Button - (2 * WB, 2 * WB + BH + BH/2, cols[0], BH - BH/2, "-"); + Fl_Button *o1 = + new Fl_Button(2 * WB, 2 * WB + BH + BH / 2, cols[0], BH - BH / 2, "-"); o1->box(FL_THIN_UP_BOX); o1->tooltip("Invert selection"); o1->callback(visibility_sort_cb, (void *)"-"); - Fl_Button *o2 = new Fl_Button - (2 * WB + cols[0], 2 * WB + BH, cols[1], BH, "Type"); + Fl_Button *o2 = + new Fl_Button(2 * WB + cols[0], 2 * WB + BH, cols[1], BH, "Type"); o2->box(FL_THIN_UP_BOX); o2->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); o2->tooltip("Sort by type"); o2->callback(visibility_sort_cb, (void *)"type"); - Fl_Button *o3 = new Fl_Button - (2 * WB + cols[0] + cols[1], 2 * WB + BH, cols[2], BH, "Number"); + Fl_Button *o3 = new Fl_Button(2 * WB + cols[0] + cols[1], 2 * WB + BH, + cols[2], BH, "Number"); o3->box(FL_THIN_UP_BOX); o3->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); o3->tooltip("Sort by number"); o3->callback(visibility_sort_cb, (void *)"number"); - Fl_Button *o4 = new Fl_Button - (2 * WB + cols[0] + cols[1] + cols[2], 2 * WB + BH, cols[3], BH, "Name"); + Fl_Button *o4 = new Fl_Button(2 * WB + cols[0] + cols[1] + cols[2], + 2 * WB + BH, cols[3], BH, "Name"); o4->box(FL_THIN_UP_BOX); o4->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); o4->tooltip("Sort by name"); @@ -1182,92 +1213,92 @@ visibilityWindow::visibilityWindow(int deltaFontSize) gg->end(); - Fl_Button *o5 = new Fl_Button - (width - 5 * WB, 2 * WB + BH, 3 * WB, BH, "+"); + Fl_Button *o5 = + new Fl_Button(width - 5 * WB, 2 * WB + BH, 3 * WB, BH, "+"); o5->box(FL_THIN_UP_BOX); o5->tooltip("Add parameter name for first selected item"); o5->callback(visibility_sort_cb, (void *)"+"); - } { - Fl_Group *gg = new Fl_Group - (2 * WB, 2 * WB + 2 * BH, brw, height - 6 * WB - 4 * BH); + Fl_Group *gg = + new Fl_Group(2 * WB, 2 * WB + 2 * BH, brw, height - 6 * WB - 4 * BH); - browser = new listBrowser - (2 * WB, 2 * WB + 2 * BH, brw, height - 6 * WB - 4 * BH); + browser = + new listBrowser(2 * WB, 2 * WB + 2 * BH, brw, height - 6 * WB - 4 * BH); browser->type(FL_MULTI_BROWSER); browser->textsize(FL_NORMAL_SIZE - 1); browser->column_widths(cols); - browser->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + browser->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars gg->end(); Fl_Group::current()->resizable(gg); } static Fl_Menu_Item browser_type_table[] = { - {"Models", 0, (Fl_Callback *) visibility_cb}, - {"Elementary entities", 0, (Fl_Callback *) visibility_cb}, - {"Physical groups", 0, (Fl_Callback *) visibility_cb}, - {"Mesh partitions", 0, (Fl_Callback *) visibility_cb}, - {0} - }; - browser_type = new Fl_Choice - (2 * WB, height - 2 * BH - 3 * WB, (width - 3 * WB) / 2, BH); + {"Models", 0, (Fl_Callback *)visibility_cb}, + {"Elementary entities", 0, (Fl_Callback *)visibility_cb}, + {"Physical groups", 0, (Fl_Callback *)visibility_cb}, + {"Mesh partitions", 0, (Fl_Callback *)visibility_cb}, + {0}}; + browser_type = + new Fl_Choice(2 * WB, height - 2 * BH - 3 * WB, (width - 3 * WB) / 2, BH); browser_type->menu(browser_type_table); browser_type->value(2); // physicals - Fl_Return_Button *b1 = new Fl_Return_Button - (width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Apply"); + Fl_Return_Button *b1 = new Fl_Return_Button( + width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Apply"); b1->callback(visibility_browser_apply_cb); g->end(); Fl_Group::current()->resizable(g); } { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Tree browser"); + Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Tree browser"); tree = new treeBrowser(2 * WB, 2 * WB + BH, brw, height - 6 * WB - 3 * BH); tree->labelsize(FL_NORMAL_SIZE - 1); tree->selectmode(FL_TREE_SELECT_MULTI); tree->connectorstyle(FL_TREE_CONNECTOR_SOLID); - tree->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + tree->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars tree->hide(); - tree_create = new Fl_Button - (2 * WB, 2 * WB + BH, brw, height - 6 * WB - 3 * BH, - "The model contains more than ten thousand entities,\n" - "which might slow down the tree browser.\n\n" - "Create tree browser anyway?"); + tree_create = + new Fl_Button(2 * WB, 2 * WB + BH, brw, height - 6 * WB - 3 * BH, + "The model contains more than ten thousand entities,\n" + "which might slow down the tree browser.\n\n" + "Create tree browser anyway?"); tree_create->callback(build_tree_cb); - Fl_Return_Button *b1 = new Fl_Return_Button - (width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Apply"); + Fl_Return_Button *b1 = new Fl_Return_Button( + width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Apply"); b1->callback(visibility_tree_apply_cb); g->resizable(tree); g->end(); } { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Numeric"); + Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Numeric"); g->resizable(NULL); int yy = 2 * WB + BH; - for(int i = 0; i < 10; i++){ - if(i == 0){ + for(int i = 0; i < 10; i++) { + if(i == 0) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Mesh:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); yy += BH; } - else if(i == 2){ + else if(i == 2) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Elementary entities:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); yy += BH; } - else if(i == 6){ + else if(i == 6) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Physical groups:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); @@ -1278,9 +1309,10 @@ visibilityWindow::visibilityWindow(int deltaFontSize) input[i]->value("*"); Fl_Button *o1 = new Fl_Button(width / 2 + WB / 2, yy, CC, BH, "Show"); - o1->callback(visibility_number_cb, (void *)(100+(intptr_t)i)); + o1->callback(visibility_number_cb, (void *)(100 + (intptr_t)i)); - Fl_Button *o2 = new Fl_Button(width / 2 + WB / 2 + CC + WB, yy, CC, BH, "Hide"); + Fl_Button *o2 = + new Fl_Button(width / 2 + WB / 2 + CC + WB, yy, CC, BH, "Hide"); o2->callback(visibility_number_cb, (void *)(intptr_t)i); yy += BH; } @@ -1318,28 +1350,28 @@ visibilityWindow::visibilityWindow(int deltaFontSize) g->end(); } { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Interactive"); + Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Interactive"); g->resizable(NULL); - Fl_Button* bb[20]; - int ll = width/2 - BH - WB - IW; - int ll2 = ll + IW + WB + 2*BH + WB; + Fl_Button *bb[20]; + int ll = width / 2 - BH - WB - IW; + int ll2 = ll + IW + WB + 2 * BH + WB; int yy = 2 * WB + BH; - for(int i = 0; i < 9; i++){ - if(i == 0){ + for(int i = 0; i < 9; i++) { + if(i == 0) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Mesh:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); yy += BH; } - else if(i == 1){ + else if(i == 1) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Elementary entities:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); yy += BH; } - else if(i == 5){ + else if(i == 5) { Fl_Box *b = new Fl_Box(2 * WB, yy, IW, BH, "Physical groups:"); b->labelfont(FL_BOLD); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); @@ -1370,40 +1402,49 @@ visibilityWindow::visibilityWindow(int deltaFontSize) bb[9]->label("Show volumes"); bb[9]->callback(visibility_interactive_cb, (void *)"volumes to show"); bb[10]->label("Hide points"); - bb[10]->callback(visibility_interactive_cb, (void *)"physical points to hide"); + bb[10]->callback(visibility_interactive_cb, + (void *)"physical points to hide"); bb[11]->label("Show points"); - bb[11]->callback(visibility_interactive_cb, (void *)"physical points to show"); + bb[11]->callback(visibility_interactive_cb, + (void *)"physical points to show"); bb[12]->label("Hide curves"); - bb[12]->callback(visibility_interactive_cb, (void *)"physical curves to hide"); + bb[12]->callback(visibility_interactive_cb, + (void *)"physical curves to hide"); bb[13]->label("Show curves"); - bb[13]->callback(visibility_interactive_cb, (void *)"physical curves to show"); + bb[13]->callback(visibility_interactive_cb, + (void *)"physical curves to show"); bb[14]->label("Hide surfaces"); - bb[14]->callback(visibility_interactive_cb, (void *)"physical surfaces to hide"); + bb[14]->callback(visibility_interactive_cb, + (void *)"physical surfaces to hide"); bb[15]->label("Show surfaces"); - bb[15]->callback(visibility_interactive_cb, (void *)"physical surfaces to show"); + bb[15]->callback(visibility_interactive_cb, + (void *)"physical surfaces to show"); bb[16]->label("Hide volumes"); - bb[16]->callback(visibility_interactive_cb, (void *)"physical volumes to hide"); + bb[16]->callback(visibility_interactive_cb, + (void *)"physical volumes to hide"); bb[17]->label("Show volumes"); - bb[17]->callback(visibility_interactive_cb, (void *)"physical volumes to show"); + bb[17]->callback(visibility_interactive_cb, + (void *)"physical volumes to show"); - bb[18] = new Fl_Button - (ll + IW + WB, 2 * WB + 2 * BH, 2 * BH, 11 * BH, "Show\nAll"); + bb[18] = new Fl_Button(ll + IW + WB, 2 * WB + 2 * BH, 2 * BH, 11 * BH, + "Show\nAll"); bb[18]->callback(visibility_interactive_cb, (void *)"show all"); g->end(); } { - Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Per window"); + Fl_Group *g = new Fl_Group(WB, WB + BH, width - 2 * WB, + height - 3 * WB - 2 * BH, "Per window"); - per_window = new Fl_Multi_Browser - (2 * WB, 2 * WB + BH, brw, height - 6 * WB - 3 * BH); - per_window->callback(visibility_per_window_cb, (void*)"item"); - per_window->scrollbar_size(std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars + per_window = + new Fl_Multi_Browser(2 * WB, 2 * WB + BH, brw, height - 6 * WB - 3 * BH); + per_window->callback(visibility_per_window_cb, (void *)"item"); + per_window->scrollbar_size( + std::max(10, FL_NORMAL_SIZE - 2)); // thinner scrollbars - Fl_Button *b1 = new Fl_Button - (width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Reset all"); - b1->callback(visibility_per_window_cb, (void*)"reset_all"); + Fl_Button *b1 = new Fl_Button( + width - 1 * CC - 2 * WB, height - 2 * BH - 3 * WB, CC, BH, "Reset all"); + b1->callback(visibility_per_window_cb, (void *)"reset_all"); g->resizable(per_window); g->end(); @@ -1417,31 +1458,32 @@ visibilityWindow::visibilityWindow(int deltaFontSize) int aw = (int)(3.5 * FL_NORMAL_SIZE); int ww = (width - 5 * WB - aw) / 4; - Fl_Group *g = new Fl_Group(WB, height - BH - WB, width - 2 * WB - 2 * ww, BH); + Fl_Group *g = + new Fl_Group(WB, height - BH - WB, width - 2 * WB - 2 * ww, BH); g->resizable(NULL); Fl_Box *b = new Fl_Box(WB, height - BH - WB, aw, BH, "Apply"); b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); - butt[0] = new Fl_Check_Button - (WB + aw + WB, height - BH - WB, ww, BH, "recursively"); + butt[0] = new Fl_Check_Button(WB + aw + WB, height - BH - WB, ww, BH, + "recursively"); butt[0]->type(FL_TOGGLE_BUTTON); butt[0]->value(1); - butt[1] = new Fl_Check_Button - (WB + aw + WB + ww, height - BH - WB, ww + WB, BH, "to all models"); + butt[1] = new Fl_Check_Button(WB + aw + WB + ww, height - BH - WB, ww + WB, + BH, "to all models"); butt[1]->type(FL_TOGGLE_BUTTON); butt[1]->value(1); g->end(); - Fl_Button *o1 = new Fl_Button - (width - 2 * ww - WB, height - BH - WB, 2 * ww, BH, "Save current visibility"); + Fl_Button *o1 = new Fl_Button(width - 2 * ww - WB, height - BH - WB, 2 * ww, + BH, "Save current visibility"); o1->callback(visibility_save_cb); - } - win->position(CTX::instance()->visPosition[0], CTX::instance()->visPosition[1]); + win->position(CTX::instance()->visPosition[0], + CTX::instance()->visPosition[1]); win->end(); FL_NORMAL_SIZE += deltaFontSize; @@ -1466,23 +1508,21 @@ void visibilityWindow::updatePerWindow(bool force) per_window->clear(); int line = 1; - for(unsigned int i = 0; i < GModel::list.size(); i++){ + for(unsigned int i = 0; i < GModel::list.size(); i++) { GModel *m = GModel::list[i]; std::ostringstream sstream; sstream << "Model [" << i << "] <<" << m->getName() << ">>"; per_window->add(sstream.str().c_str()); - if(ctx->isVisible(m)) - per_window->select(line, 1); + if(ctx->isVisible(m)) per_window->select(line, 1); line++; } - for(unsigned int i = 0; i < PView::list.size(); i++){ + for(unsigned int i = 0; i < PView::list.size(); i++) { PView *v = PView::list[i]; std::ostringstream sstream; sstream << "View [" << i << "] <<" << v->getData()->getName() << ">>"; per_window->add(sstream.str().c_str()); - if(ctx->isVisible(v)) - per_window->select(line, 1); + if(ctx->isVisible(v)) per_window->select(line, 1); line++; } } diff --git a/Fltk/visibilityWindow.h b/Fltk/visibilityWindow.h index b4efac88426fd05065fb05bfebbec27f3796d34c..62442545da8e66c8a9a51494ae0fb2760645411d 100644 --- a/Fltk/visibilityWindow.h +++ b/Fltk/visibilityWindow.h @@ -15,8 +15,8 @@ #include <FL/Fl_Input.H> #include <FL/Fl_Tree.H> -class visibilityWindow{ - public: +class visibilityWindow { +public: Fl_Window *win; Fl_Choice *browser_type; Fl_Browser *browser; @@ -26,10 +26,11 @@ class visibilityWindow{ Fl_Check_Button *butt[2]; Fl_Button *push[2]; Fl_Input *input[10]; - public: - visibilityWindow(int deltaFontSize=0); + +public: + visibilityWindow(int deltaFontSize = 0); void show(bool redrawOnly); - void updatePerWindow(bool force=false); + void updatePerWindow(bool force = false); }; void visibility_cb(Fl_Widget *w, void *data);