From 76a6474efd36b4de623a44cf7ffff9bb9fc5a4d5 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 6 Jan 2009 18:29:54 +0000 Subject: [PATCH] removed "Cancel" buttons from palette windows --- Fltk/clippingWindow.cpp | 9 +--- Fltk/contextWindow.cpp | 38 ++++++----------- Fltk/fieldWindow.cpp | 12 ++++-- Fltk/fieldWindow.h | 2 +- Fltk/manipWindow.cpp | 7 +--- Fltk/menuWindow.cpp | 4 +- Fltk/messageWindow.cpp | 13 ++---- Fltk/optionWindow.cpp | 39 +++++++---------- Fltk/partitionDialog.cpp | 9 +--- Fltk/pluginWindow.cpp | 88 +++++++++++++++++++-------------------- Fltk/pluginWindow.h | 12 ------ Fltk/projectionEditor.cpp | 60 +++++++++++--------------- Fltk/solverWindow.cpp | 45 ++++++++++---------- Fltk/statisticsWindow.cpp | 6 +-- Fltk/visibilityWindow.cpp | 11 ++--- 15 files changed, 143 insertions(+), 212 deletions(-) diff --git a/Fltk/clippingWindow.cpp b/Fltk/clippingWindow.cpp index 9d0c969dc2..618684e0fe 100644 --- a/Fltk/clippingWindow.cpp +++ b/Fltk/clippingWindow.cpp @@ -239,19 +239,14 @@ clippingWindow::clippingWindow(int deltaFontSize) { Fl_Return_Button *o = new Fl_Return_Button - (width - 3 * BB - 3 * WB, height - BH - WB, BB, BH, "Redraw"); + (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Redraw"); o->callback(redraw_cb); } { Fl_Button *o = new Fl_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Reset"); + (width - BB - WB, height - BH - WB, BB, BH, "Reset"); o->callback(clip_reset_cb); } - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } win->position(CTX.clip_position[0], CTX.clip_position[1]); win->end(); diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp index 19f030a663..8967d15497 100644 --- a/Fltk/contextWindow.cpp +++ b/Fltk/contextWindow.cpp @@ -49,17 +49,17 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) FL_NORMAL_SIZE -= deltaFontSize; int width = 31 * FL_NORMAL_SIZE; - int height = 5 * WB + 9 * BH; + int height = 4 * WB + 8 * BH; win = new dialogWindow (width, height, CTX.non_modal_windows, "Contextual Geometry Definitions"); 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 - 2 * WB); // 0: Parameter { group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Parameter"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - 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"); @@ -77,7 +77,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) // 1: Point { group[1] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Point"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Point"); input[2] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X coordinate"); input[2]->value("0"); input[3] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y coordinate"); @@ -107,7 +107,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) // 2: Translation { group[2] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Translation"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Translation"); input[6] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "X component"); input[6]->value("0"); input[7] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "Y component"); @@ -122,7 +122,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) // 3: Rotation { group[3] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Rotation"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Rotation"); input[9] = new Fl_Input (2 * WB, 2 * WB + 1 * BH, IW, BH, "X coordinate of an axis point"); input[9]->value("0"); @@ -152,7 +152,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) // 4: Scale { group[4] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Scale"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Scale"); input[16] = new Fl_Input (2 * WB, 2 * WB + 1 * BH, IW, BH, "X component of direction"); input[16]->value("0"); @@ -173,7 +173,7 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) // 5: Symmetry { group[5] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Symmetry"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Symmetry"); input[20] = new Fl_Input(2 * WB, 2 * WB + 1 * BH, IW, BH, "A"); input[20]->value("1"); input[21] = new Fl_Input(2 * WB, 2 * WB + 2 * BH, IW, BH, "B"); @@ -190,12 +190,6 @@ geometryContextWindow::geometryContextWindow(int deltaFontSize) o->end(); } - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } - win->position(CTX.ctx_position[0], CTX.ctx_position[1]); win->end(); @@ -222,17 +216,17 @@ meshContextWindow::meshContextWindow(int deltaFontSize) }; int width = 29 * FL_NORMAL_SIZE; - int height = 5 * WB + 5 * BH; + int height = 4 * WB + 4 * BH; win = new dialogWindow (width, height, CTX.non_modal_windows, "Contextual Mesh Definitions"); 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 - 2 * WB); // 0: Characteristic length { group[0] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Characteristic Length"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Characteristic Length"); 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); @@ -241,7 +235,7 @@ meshContextWindow::meshContextWindow(int deltaFontSize) // 1: Transfinite line { group[1] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Transfinite Line"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Transfinite Line"); 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"); @@ -263,7 +257,7 @@ meshContextWindow::meshContextWindow(int deltaFontSize) // 2: Transfinite surface { group[2] = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Transfinite Surface"); + (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"); @@ -275,12 +269,6 @@ meshContextWindow::meshContextWindow(int deltaFontSize) o->end(); } - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } - win->position(CTX.ctx_position[0], CTX.ctx_position[1]); win->end(); diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp index 3fadaa0e30..d6649088f0 100644 --- a/Fltk/fieldWindow.cpp +++ b/Fltk/fieldWindow.cpp @@ -122,11 +122,15 @@ 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" + "- or -\n\nSelect a field in the browser"); + empty_message->align(FL_ALIGN_CENTER); + editor_group = new Fl_Group(x, y, w, h); - + title = new Fl_Box(x, y, w, BH, "field_name"); title->labelfont(FL_BOLD); - title->labelsize(18); + title->labelsize(FL_NORMAL_SIZE + 3); y += BH + WB; h -= BH + WB; @@ -178,7 +182,7 @@ fieldWindow::fieldWindow(int deltaFontSize) : _deltaFontSize(deltaFontSize) void fieldWindow::loadFieldViewList() { put_on_view_btn->clear(); - put_on_view_btn->add("Create new View"); + put_on_view_btn->add("Create new view"); put_on_view_btn->activate(); for(unsigned int i = 0; i < PView::list.size(); i++) { std::ostringstream s; @@ -314,6 +318,7 @@ void fieldWindow::editField(Field *f) if(f == NULL){ selected_id = -1; editor_group->hide(); + empty_message->show(); loadFieldList(); return; } @@ -321,6 +326,7 @@ void fieldWindow::editField(Field *f) FL_NORMAL_SIZE -= _deltaFontSize; selected_id = f->id; + empty_message->hide(); editor_group->show(); editor_group->user_data(f); title->label(f->get_name()); diff --git a/Fltk/fieldWindow.h b/Fltk/fieldWindow.h index 05a0548fb1..d5224f290f 100644 --- a/Fltk/fieldWindow.h +++ b/Fltk/fieldWindow.h @@ -29,7 +29,7 @@ class fieldWindow{ std::list<Fl_Widget*> options_widget; Fl_Scroll *options_scroll; Fl_Group *editor_group; - Fl_Box *title; + Fl_Box *title, *empty_message; Fl_Check_Button *background_btn; Fl_Menu_Button *put_on_view_btn; Fl_Browser *help_display; diff --git a/Fltk/manipWindow.cpp b/Fltk/manipWindow.cpp index 10ef89af97..6cdd388fca 100644 --- a/Fltk/manipWindow.cpp +++ b/Fltk/manipWindow.cpp @@ -85,14 +85,9 @@ manipWindow::manipWindow(int deltaFontSize) { Fl_Return_Button *o = new Fl_Return_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Reset"); + (width - BB - WB, height - BH - WB, BB, BH, "Reset"); o->callback(status_xyz1p_cb, (void *)"reset"); } - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } win->position(CTX.manip_position[0], CTX.manip_position[1]); win->end(); diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index 342b39f2ae..333a317181 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -2143,7 +2143,8 @@ static Fl_Menu_Item bar_table[] = { {0}, {"&Rename...", FL_CTRL+'r', (Fl_Callback *)file_rename_cb, 0}, {"Save &As...", FL_CTRL+'s', (Fl_Callback *)file_save_as_cb, 0}, - {"Sa&ve Mesh", FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)mesh_save_cb, 0, FL_MENU_DIVIDER}, + {"Sa&ve Mesh", FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)mesh_save_cb, 0}, + {"Save Default Options", 0, (Fl_Callback *)options_save_cb, 0, FL_MENU_DIVIDER}, {"&Quit", FL_CTRL+'q', (Fl_Callback *)file_quit_cb, 0}, {0}, {"&Tools", 0, 0, 0, FL_SUBMENU}, @@ -2186,6 +2187,7 @@ static Fl_Menu_Item sysbar_table[] = { {"Rename...", FL_META+'r', (Fl_Callback *)file_rename_cb, 0}, {"Save As...", FL_META+'s', (Fl_Callback *)file_save_as_cb, 0}, {"Save Mesh", FL_META+FL_SHIFT+'s', (Fl_Callback *)mesh_save_cb, 0}, + {"Save Default Options", 0, (Fl_Callback *)options_save_cb, 0}, {0}, {"Tools", 0, 0, 0, FL_SUBMENU}, {"Options...", FL_META+FL_SHIFT+'n', (Fl_Callback *)options_cb, 0}, diff --git a/Fltk/messageWindow.cpp b/Fltk/messageWindow.cpp index 303a220511..45f50ef380 100644 --- a/Fltk/messageWindow.cpp +++ b/Fltk/messageWindow.cpp @@ -85,28 +85,23 @@ messageWindow::messageWindow(int deltaFontSize) { butt = new Fl_Check_Button - (width - 4 * BB - 4 * WB, height - BH - WB, BB, BH, "Auto scroll"); + (width - 3 * BB - 3 * WB, height - BH - WB, BB, BH, "Auto scroll"); butt->type(FL_TOGGLE_BUTTON); butt->callback(message_auto_scroll_cb); } { Fl_Return_Button *o = new Fl_Return_Button - (width - 3 * BB - 3 * WB, height - BH - WB, BB, BH, "Clear"); + (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Clear"); o->callback(message_clear_cb); } { Fl_Button *o = new Fl_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Save"); + (width - BB - WB, height - BH - WB, BB, BH, "Save"); o->callback(message_save_cb); } - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } win->resizable(new Fl_Box(1, 1, 4, 4)); - win->size_range(WB + 100 + 3 * BB + 4 * WB, 100); + win->size_range(WB + 100 + 2 * BB + 3 * WB, 100); win->position(CTX.msg_position[0], CTX.msg_position[1]); win->end(); diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 3007fac27d..505bddd899 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -1145,33 +1145,15 @@ optionWindow::optionWindow(int deltaFontSize) FL_NORMAL_SIZE -= deltaFontSize; int width = 34 * FL_NORMAL_SIZE + WB; - int height = 13 * BH + 5 * WB; + int height = 12 * BH + 4 * WB; int L = 7 * FL_NORMAL_SIZE; win = new dialogWindow(width, height, CTX.non_modal_windows); win->box(GMSH_WINDOW_BOX); win->label("Options - General"); - // Buttons - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } - { - Fl_Button *o = new Fl_Button - ((int)(width - 2.5 * BB - 2 * WB), height - BH - WB, (int)(1.5 * BB), BH, - "Save as defaults"); - o->callback(options_save_cb); - } - { - redraw = new Fl_Return_Button - ((int)(width - 3.5 * BB - 3 * WB), height - BH - WB, BB, BH, "Redraw"); - redraw->callback(redraw_cb); - } - // Selection browser - browser = new Fl_Hold_Browser(WB, WB, L - WB, height - 3 * WB - BH); + browser = new Fl_Hold_Browser(WB, WB, L - WB, height - 2 * WB); browser->has_scrollbar(Fl_Browser_::VERTICAL); browser->add("General"); browser->add("Geometry"); @@ -1181,9 +1163,12 @@ 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->callback(redraw_cb); + width -= L; int BW = width - 4 * WB; - height -= WB + BH; // General options general.group = new Fl_Group(L, 0, width, height, "General Options"); @@ -3339,10 +3324,18 @@ 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(general.butt[2]->value()){ + browser->resize(browser->x(), browser->y(), browser->w(), + win->h() - 3 * WB - BH); redraw->show(); - else + win->redraw(); + } + else{ + browser->resize(browser->x(), browser->y(), browser->w(), + win->h() - 2 * WB); redraw->hide(); + win->redraw(); + } } else if(!strcmp(what, "rotation_center")){ if(general.butt[15]->value()) { diff --git a/Fltk/partitionDialog.cpp b/Fltk/partitionDialog.cpp index 854b32bf62..6a2fcb0144 100644 --- a/Fltk/partitionDialog.cpp +++ b/Fltk/partitionDialog.cpp @@ -387,8 +387,6 @@ void partition_select_groups_cb(Fl_Widget *widget, void *data) o->position(o->x(), yG); o = static_cast<Fl_Group*>(g[5])->child(2); o->position(o->x(), yG); - o = static_cast<Fl_Group*>(g[5])->child(3); - o->position(o->x(), yG); yG += WB + o->h(); } y += g[5]->h(); @@ -758,14 +756,9 @@ void partition_dialog() // Partition Button [2] { Fl_Return_Button *const o = new Fl_Return_Button - (w - 2*(WB + BB), y, BB, BH, "Partition"); + (w - (WB + BB), y, BB, BH, "Partition"); o->callback((Fl_Callback *)partition_partition_cb, &dlg); } - // Cancel Button [3] - { - Fl_Button *const o = new Fl_Button(w - (WB + BB), y, BB, BH, "Cancel"); - o->callback((Fl_Callback *)partition_cancel_cb, &dlg); - } y += BH + WB; g->end(); g->show(); diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp index a5bd75f3c7..6d85898bd4 100644 --- a/Fltk/pluginWindow.cpp +++ b/Fltk/pluginWindow.cpp @@ -4,6 +4,10 @@ // bugs and problems to <gmsh@geuz.org>. #include <vector> +#include <FL/Fl_Return_Button.H> +#include <FL/Fl_Group.H> +#include <FL/Fl_Value_Input.H> +#include <FL/Fl_Input.H> #include <FL/Fl_Box.H> #include <FL/Fl_Tabs.H> #include <FL/Fl_Scroll.H> @@ -18,6 +22,13 @@ extern Context_T CTX; +#define MAX_PLUGIN_OPTIONS 50 +struct PluginDialogBox{ + Fl_Group *group; + Fl_Value_Input *value[MAX_PLUGIN_OPTIONS]; + Fl_Input *input[MAX_PLUGIN_OPTIONS]; +}; + void plugin_cb(Fl_Widget *w, void *data) { GUI::instance()->plugins->show((int)(long)data); @@ -93,29 +104,20 @@ static void plugin_browser_cb(Fl_Widget *w, void *data) static void plugin_run_cb(Fl_Widget *w, void *data) { - // get selected plugin - GMSH_Post_Plugin *p = 0; - for(int i = 1; i <= GUI::instance()->plugins->browser->size(); i++) { - if(GUI::instance()->plugins->browser->selected(i)) { - p = (GMSH_Post_Plugin*)GUI::instance()->plugins->browser->data(i); - break; - } - } - if(!p) return; + GMSH_Post_Plugin *p = (GMSH_Post_Plugin*)data; - if(p->dialogBox) { // get the values from the GUI - int m = p->getNbOptionsStr(); - int n = p->getNbOptions(); - if(m > MAX_PLUGIN_OPTIONS) m = MAX_PLUGIN_OPTIONS; - if(n > MAX_PLUGIN_OPTIONS) n = MAX_PLUGIN_OPTIONS; - for(int i = 0; i < m; i++) { - StringXString *sxs = p->getOptionStr(i); - sxs->def = p->dialogBox->input[i]->value(); - } - for(int i = 0; i < n; i++) { - StringXNumber *sxn = p->getOption(i); - sxn->def = p->dialogBox->value[i]->value(); - } + // get the values from the GUI + int m = p->getNbOptionsStr(); + int n = p->getNbOptions(); + if(m > MAX_PLUGIN_OPTIONS) m = MAX_PLUGIN_OPTIONS; + if(n > MAX_PLUGIN_OPTIONS) n = MAX_PLUGIN_OPTIONS; + for(int i = 0; i < m; i++) { + StringXString *sxs = p->getOptionStr(i); + sxs->def = p->dialogBox->input[i]->value(); + } + for(int i = 0; i < n; i++) { + StringXNumber *sxn = p->getOption(i); + sxn->def = p->dialogBox->value[i]->value(); } // run on all selected views @@ -136,9 +138,7 @@ static void plugin_run_cb(Fl_Widget *w, void *data) } } } - if(no_view_selected){ - p->execute(0); - } + if(no_view_selected) p->execute(0); GUI::instance()->updateViews(); CTX.post.plugin_draw_function = NULL; @@ -161,10 +161,10 @@ void pluginWindow::_createDialogBox(GMSH_Plugin *p, int x, int y, { Fl_Tabs *o = new Fl_Tabs(x, y, width, height); { - Fl_Group *g = new Fl_Group - (x, y + BH, width, height - BH, "Options"); + Fl_Group *g = new Fl_Group(x, y + BH, width, height - BH, "Options"); + Fl_Scroll *s = new Fl_Scroll - (x + WB, y + WB + BH, width - 2 * WB, height - BH - 2 * WB); + (x + WB, y + WB + BH, width - 2 * WB, height - 2 * BH - 3 * WB); int m = p->getNbOptionsStr(); if(m > MAX_PLUGIN_OPTIONS) m = MAX_PLUGIN_OPTIONS; @@ -191,11 +191,18 @@ 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); + + g->resizable(new Fl_Box(x + WB, y + 2 * BH, WB, WB)); g->end(); - o->resizable(g); // to avoid ugly resizing of tab labels + + o->resizable(g); } { - Fl_Group *g = new Fl_Group(x, y + BH, width, height - BH, "About"); + Fl_Group *g = new Fl_Group(x, y + BH, width, height - BH, "Help"); Fl_Browser *o = new Fl_Browser (x + WB, y + WB + BH, width - 2 * WB, height - 2 * WB - BH); @@ -227,7 +234,7 @@ pluginWindow::pluginWindow(int deltaFontSize) FL_NORMAL_SIZE -= deltaFontSize; int width0 = 34 * FL_NORMAL_SIZE + WB; - int height0 = 13 * BH + 5 * WB; + int height0 = 12 * BH + 4 * WB; int width = (CTX.plugin_size[0] < width0) ? width0 : CTX.plugin_size[0]; int height = (CTX.plugin_size[1] < height0) ? height0 : CTX.plugin_size[1]; @@ -235,22 +242,11 @@ pluginWindow::pluginWindow(int deltaFontSize) win = new dialogWindow(width, height, CTX.non_modal_windows, "Plugins"); win->box(GMSH_WINDOW_BOX); - { - Fl_Button *o = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(plugin_cancel_cb); - } - { - run = new Fl_Return_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Run"); - run->callback(plugin_run_cb); - } - int L1 = (int)(0.3 * width), L2 = (int)(0.6 * L1); - browser = new Fl_Hold_Browser(WB, WB, L1, height - 3 * WB - BH); + browser = new Fl_Hold_Browser(WB, WB, L1, height - 2 * WB); browser->callback(plugin_browser_cb); - view_browser = new Fl_Multi_Browser(WB + L1, WB, L2, height - 3 * WB - BH); + view_browser = new Fl_Multi_Browser(WB + L1, WB, L2, height - 2 * WB); view_browser->has_scrollbar(Fl_Browser_::VERTICAL); view_browser->callback(plugin_browser_cb); @@ -262,7 +258,7 @@ pluginWindow::pluginWindow(int deltaFontSize) p->getName(name); browser->add(name, p); _createDialogBox(p, 2 * WB + L1 + L2, WB, width - L1 - L2 - 3 * WB, - height - 3 * WB - BH); + height - 2 * WB); // select first plugin by default if(it == GMSH_PluginManager::instance()->begin()){ browser->select(1); @@ -271,7 +267,7 @@ pluginWindow::pluginWindow(int deltaFontSize) } } - Fl_Box *resize_box = new Fl_Box(3*WB + L1+L2, WB, WB, height - 3 * WB - BH); + Fl_Box *resize_box = new Fl_Box(3*WB + L1+L2, WB, WB, height - 2 * WB); win->resizable(resize_box); win->size_range(width0, height0); diff --git a/Fltk/pluginWindow.h b/Fltk/pluginWindow.h index 4e138c5682..54e894714b 100644 --- a/Fltk/pluginWindow.h +++ b/Fltk/pluginWindow.h @@ -9,26 +9,14 @@ #include <FL/Fl_Window.H> #include <FL/Fl_Hold_Browser.H> #include <FL/Fl_Multi_Browser.H> -#include <FL/Fl_Return_Button.H> -#include <FL/Fl_Group.H> -#include <FL/Fl_Value_Input.H> -#include <FL/Fl_Input.H> class GMSH_Plugin; -#define MAX_PLUGIN_OPTIONS 50 -struct PluginDialogBox{ - Fl_Group *group; - Fl_Value_Input *value[MAX_PLUGIN_OPTIONS]; - Fl_Input *input[MAX_PLUGIN_OPTIONS]; -}; - class pluginWindow{ public: Fl_Window *win; Fl_Hold_Browser *browser; Fl_Multi_Browser *view_browser; - Fl_Return_Button *run; void _createDialogBox(GMSH_Plugin *p, int x, int y, int width, int height); public: pluginWindow(int deltaFontSize=0); diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp index dd2a809b79..470c4f860b 100644 --- a/Fltk/projectionEditor.cpp +++ b/Fltk/projectionEditor.cpp @@ -407,11 +407,6 @@ static void filter_cb(Fl_Widget *w, void *data) update_cb(0, data); } -static void close_cb(Fl_Widget *w, void *data) -{ - if(data) ((Fl_Window *) data)->hide(); -} - static void proj_hide_cb(Fl_Widget *w, void *data) { CTX.hide_unselected = !CTX.hide_unselected; @@ -897,7 +892,7 @@ projectionEditor::projectionEditor() printf("currentSize = %d\n",m->getFMInternals()->current()->GetNumGroups()); // construct GUI in terms of standard sizes - const int width = (int)(3.75 * BB), height = 25 * BH; + const int width = (int)(3.75 * BB), height = 24 * BH; // create all widgets (we construct this once, we never deallocate!) _window = new dialogWindow(width, height, CTX.non_modal_windows, "Reparameterize"); @@ -947,7 +942,7 @@ projectionEditor::projectionEditor() int hard = 8; int uvw = width - 2 * WB - 2 * hard - 3 * WB; - int uvh = height - 8 * WB - 15 * BH - 2 * hard; + int uvh = height - 7 * WB - 14 * BH - 2 * hard; _hardEdges[0] = new Fl_Toggle_Button(WB, 3 * WB + 9 * BH + hard, hard, uvh); @@ -955,7 +950,7 @@ projectionEditor::projectionEditor() 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 - 5 * WB - 6 * BH - 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'"); @@ -970,17 +965,17 @@ 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 - 5 * WB - 6 * BH - 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 - 4 * WB - 6 * BH, BB, BH, "Patch Type:"); - Fl_Group *oo = new Fl_Group( WB, height - 4 * WB - 6 * BH, 3 * BB, BH); - _pselect[0] = new Fl_Round_Button(2 * WB + BB, height - 4 * WB - 6 * BH, - BB, BH, "Continuation"); - _pselect[1] = new Fl_Round_Button(3 * WB + 2 * BB, height - 4 * WB - - 6 * BH, BB, BH, "Windowing"); + 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"); for(int i = 0; i < 2; i++) _pselect[i]->type(FL_RADIO_BUTTON); @@ -989,14 +984,14 @@ projectionEditor::projectionEditor() oo->end(); - _modes[0] = new Fl_Value_Input(WB, height - 4 * WB - 5 * 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 - 4 * WB - 5 * BH, BB / 2, BH, + _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 - 4 * WB - 4 * 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 - 4 * WB - 4 * BH, BB / 2, BH, + _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++){ @@ -1008,21 +1003,21 @@ projectionEditor::projectionEditor() } { - Fl_Button *b = new Fl_Button(width - WB - BB, height - 4 * WB - 5 * BH, + 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 - 3 * WB - 3 * BH, BB / 2, BH, "Delete:"); - Fl_Button *b1 = new Fl_Button(WB + BB / 2, height - 3 * WB - 3 * BH, + 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 - 3 * WB - 3 * BH, + 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 - 3 * WB - 3 * BH, + 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"); } @@ -1030,36 +1025,31 @@ projectionEditor::projectionEditor() { int bb = (int)(0.37 * BB); int s = width - WB - BB / 2 - 3 * bb; - new Fl_Box(s, height - 3 * WB - 3 * BH, BB / 2, BH, "Save:"); - Fl_Button *b1 = new Fl_Button(s + BB / 2, height - 3 * WB - 3 * BH, + 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 - 3 * WB - 3 * BH, + 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 - 3 * WB - 3 * BH, + 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"); } { - Fl_Button *b1 = new Fl_Button(WB, height - 2 * WB - 2 * BH, BB, BH, + 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 - 2 * WB - 2 * BH, BB, + Fl_Button *b2 = new Fl_Button(2 * WB + BB, height - WB - BH, BB, BH, "Intersect"); } - Fl_Button *b = new Fl_Button(width - WB - BB, height - WB - BH, BB, BH, "Cancel"); - b->callback(close_cb, _window); - _window->end(); _window->hotspot(_window); _window->resizable(_uvPlot); _window->size_range(width, (int)(0.85 * height)); - - // create } void projectionEditor::load(fourierProjectionFace *face, std::string tag) diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp index eddb0e6e71..46fb66deda 100644 --- a/Fltk/solverWindow.cpp +++ b/Fltk/solverWindow.cpp @@ -197,7 +197,7 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) int LL = 2 * IW; int width = LL + BB + BB / 3 + 4 * WB; - int height = (8 + SINFO[solverIndex].nboptions) * BH + 6 * WB; + int height = (7 + SINFO[solverIndex].nboptions) * BH + 5 * WB; int BBS = (width - 8 * WB) / 5; win = new dialogWindow @@ -205,21 +205,21 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) win->box(GMSH_WINDOW_BOX); { Fl_Tabs *o = new Fl_Tabs - (WB, WB, width - 2 * WB, height - 3 * WB - 1 * BH); + (WB, WB, width - 2 * WB, height - 2 * WB); { Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "Controls"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Controls"); + Fl_Button *b2 = new Fl_Button + (2 * WB, 2 * WB + 1 * BH, BB / 2, BH, "Save"); + b2->callback(options_save_cb); input[2] = new Fl_Input - (2 * WB, 2 * WB + 1 * BH, LL, BH, "Solver"); + (2 * WB + BB / 2, 2 * WB + 1 * BH, LL - BB / 2, BH, "Solver"); input[2]->callback(solver_ok_cb, (void *)solverIndex); Fl_Button *b1 = new Fl_Button (width - 2 * WB - BBS, 2 * WB + 1 * BH, BBS, BH, "Choose"); b1->callback(solver_choose_executable_cb, (void *)solverIndex); - Fl_Button *b2 = new Fl_Button - (width - 2 * WB - BBS, 2 * WB + 2 * BH, BBS, BH, "Save"); - b2->callback(options_save_cb); int ww = (LL - WB) / 2; butt[2] = new Fl_Check_Button @@ -234,16 +234,15 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) butt[i]->callback(solver_ok_cb, (void *)solverIndex); } + Fl_Button *b4 = new Fl_Button + (2 * WB, 2 * WB + 4 * BH, BB / 2, BH, "Edit"); + b4->callback(solver_file_edit_cb, (void *)solverIndex); input[0] = new Fl_Input (2 * WB + BB / 2, 2 * WB + 4 * BH, LL - BB / 2, BH, "Input"); Fl_Button *b3 = new Fl_Button (width - 2 * WB - BBS, 2 * WB + 4 * BH, BBS, BH, "Choose"); b3->callback(solver_file_open_cb, (void *)solverIndex); - Fl_Button *b4 = new Fl_Button - (2 * WB, 2 * WB + 4 * BH, BB / 2, BH, "Edit"); - b4->callback(solver_file_edit_cb, (void *)solverIndex); - input[1] = new Fl_Input (2 * WB, 2 * WB + 5 * BH, LL, BH, "Mesh"); Fl_Button *b5 = new Fl_Button @@ -261,7 +260,7 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) } static int arg[MAX_NUM_SOLVERS][5][2]; - for(int i = 0; i < 5; i++) { + for(int i = 0; i < 4; i++) { if(strlen(SINFO[solverIndex].button_name[i])) { arg[solverIndex][i][0] = solverIndex; arg[solverIndex][i][1] = i; @@ -272,15 +271,22 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) (solver_command_cb, (void *)arg[solverIndex][i]); } } - + + { + Fl_Button *b = new Fl_Button + (width - 2 * WB - BBS, 3 * WB + (6 + SINFO[solverIndex].nboptions) * BH, + BBS, BH, "Kill"); + b->callback(solver_kill_cb, (void *)solverIndex); + } + g->end(); } { Fl_Group *g = new Fl_Group - (WB, WB + BH, width - 2 * WB, height - 3 * WB - 2 * BH, "About"); + (WB, WB + BH, width - 2 * WB, height - 2 * WB, "About"); Fl_Browser *o = new Fl_Browser - (2 * WB, 2 * WB + 1 * BH, width - 4 * WB, height - 5 * WB - 2 * BH); + (2 * WB, 2 * WB + 1 * BH, width - 4 * WB, height - 4 * WB - BH); o->add(" "); add_multiline_in_browser(o, "@c@b@.", SINFO[solverIndex].name, false); o->add(" "); @@ -291,15 +297,6 @@ solverWindow::solverWindow(int solverIndex, int deltaFontSize) o->end(); } - { - Fl_Button *b1 = new Fl_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Kill solver"); - b1->callback(solver_kill_cb, (void *)solverIndex); - Fl_Button *b2 = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - b2->callback(hide_cb, (void*)win); - } - win->position(CTX.solver_position[0], CTX.solver_position[1]); win->end(); diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp index 7ea9cb4f07..0236ce247c 100644 --- a/Fltk/statisticsWindow.cpp +++ b/Fltk/statisticsWindow.cpp @@ -169,13 +169,9 @@ statisticsWindow::statisticsWindow(int deltaFontSize) { Fl_Return_Button *o = new Fl_Return_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Update"); + (width - BB - WB, height - BH - WB, BB, BH, "Update"); o->callback(statistics_update_cb); } - { - Fl_Button *o = new Fl_Button(width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o->callback(hide_cb, (void *)win); - } win->position(CTX.stat_position[0], CTX.stat_position[1]); win->end(); diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp index d65261e7c9..4baea1de23 100644 --- a/Fltk/visibilityWindow.cpp +++ b/Fltk/visibilityWindow.cpp @@ -1042,7 +1042,7 @@ visibilityWindow::visibilityWindow(int deltaFontSize) { FL_NORMAL_SIZE -= deltaFontSize; - static int cols[5] = {15, 95, 95, 180, 0}; + static int cols[5] = {2 * WB, BB, BB, 2 * BB, 0}; int width = cols[0] + cols[1] + cols[2] + cols[3] + 6 * WB; int height = 18 * BH; int brw = width - 4 * WB; @@ -1301,18 +1301,15 @@ visibilityWindow::visibilityWindow(int deltaFontSize) win->size_range(width, 15 * BH + 5 * WB, width); { + int ww = (width - 3 * WB) / 2; butt[0] = new Fl_Check_Button - (WB, height - BH - WB, (width - 3 * WB) / 2, BH, "Set visibility recursively"); + (WB, height - BH - WB, ww, BH, "Set visibility recursively"); butt[0]->type(FL_TOGGLE_BUTTON); butt[0]->value(1); Fl_Button *o1 = new Fl_Button - (width - 2 * BB - 2 * WB, height - BH - WB, BB, BH, "Save"); + (width - ww - WB, height - BH - WB, ww, BH, "Save current visibility"); o1->callback(visibility_save_cb); - - Fl_Button *o2 = new Fl_Button - (width - BB - WB, height - BH - WB, BB, BH, "Cancel"); - o2->callback(hide_cb, (void *)win); } win->position(CTX.vis_position[0], CTX.vis_position[1]); -- GitLab