From 5c394d3d796b3c164b0bcaee9103b18029e8b569 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 29 Dec 2008 14:56:24 +0000
Subject: [PATCH] better fontsize management

---
 Fltk/GUI.cpp                  | 39 +++++++++++++++--------------------
 Fltk/GUI.h                    |  9 ++++----
 Fltk/aboutWindow.cpp          |  5 ++---
 Fltk/aboutWindow.h            |  4 +---
 Fltk/classificationEditor.cpp |  1 -
 Fltk/clippingWindow.cpp       | 21 +++++++++----------
 Fltk/clippingWindow.h         |  4 +---
 Fltk/colorbarWindow.cpp       |  2 +-
 Fltk/contextWindow.cpp        | 10 ++++-----
 Fltk/contextWindow.h          |  8 ++-----
 Fltk/extraDialogs.cpp         |  3 ---
 Fltk/fieldWindow.cpp          |  4 ++--
 Fltk/fieldWindow.h            |  4 +---
 Fltk/fileDialogs.cpp          | 22 +-------------------
 Fltk/graphicWindow.cpp        | 10 ++++-----
 Fltk/graphicWindow.h          |  2 +-
 Fltk/manipWindow.cpp          |  3 +--
 Fltk/manipWindow.h            |  4 +---
 Fltk/menuWindow.cpp           |  6 +++---
 Fltk/menuWindow.h             |  3 +--
 Fltk/messageWindow.cpp        |  5 ++---
 Fltk/messageWindow.h          |  4 +---
 Fltk/optionWindow.cpp         | 17 ++++++++++-----
 Fltk/optionWindow.h           |  4 +---
 Fltk/partitionDialog.cpp      |  2 --
 Fltk/pluginWindow.cpp         |  4 ++--
 Fltk/pluginWindow.h           |  4 +---
 Fltk/projectionEditor.cpp     |  5 ++---
 Fltk/solverWindow.cpp         |  3 +--
 Fltk/solverWindow.h           |  4 +---
 Fltk/statisticsWindow.cpp     |  7 +++----
 Fltk/statisticsWindow.h       |  4 +---
 Fltk/visibilityWindow.cpp     |  3 +--
 Fltk/visibilityWindow.h       |  4 +---
 34 files changed, 87 insertions(+), 147 deletions(-)

diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 6ed5a1d8a2..ea09bb26a8 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -56,18 +56,13 @@ GUI::GUI(int argc, char **argv)
   // add global shortcuts
   Fl::add_handler(globalShortcut);
 
-  // store fontsize now: we don't want any subsequent change
-  // (e.g. when doing a 'restore options') to be taken into account
-  // in the dynamic GUI features
-  _fontsize = GetFontSize();
-
   // set default font size
-  FL_NORMAL_SIZE = _fontsize;
+  FL_NORMAL_SIZE = GetFontSize();
 
   // handle themes and tooltip font size
   if(strlen(CTX.gui_theme))
     Fl::scheme(CTX.gui_theme);
-  Fl_Tooltip::size(_fontsize);
+  Fl_Tooltip::size(FL_NORMAL_SIZE);
 
   // register image formats not in core fltk library (jpeg/png)
   fl_register_images();
@@ -84,8 +79,8 @@ GUI::GUI(int argc, char **argv)
   // all the windows are contructed (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
-  menu = new menuWindow(_fontsize);
-  graph.push_back(new graphicWindow(_fontsize));
+  menu = new menuWindow();
+  graph.push_back(new graphicWindow());
 
 #if defined(WIN32)
   graph[0]->win->icon
@@ -126,7 +121,7 @@ GUI::GUI(int argc, char **argv)
 
   // create additional graphic windows
   for(int i = 1; i < CTX.num_windows; i++){
-    graph.push_back(new graphicWindow(_fontsize));
+    graph.push_back(new graphicWindow());
     //double mat[3][3] = {10,0,0,0,1,0,0,0,1};
     //drawTransform *tr = new drawTransformScaled(mat);
     //graph.back()->gl->getDrawContext()->setTransform(tr);
@@ -134,19 +129,19 @@ GUI::GUI(int argc, char **argv)
     graph.back()->win->show();
   }
 
-  options = new optionWindow(_fontsize);
-  fields = new fieldWindow(_fontsize);
-  plugins = new pluginWindow(_fontsize);
-  stats = new statisticsWindow(_fontsize);
-  visibility = new visibilityWindow(_fontsize);
-  clipping = new clippingWindow(_fontsize);
-  messages = new messageWindow(_fontsize);
-  manip = new manipWindow(_fontsize);
-  geoContext = new geometryContextWindow(_fontsize);
-  meshContext = new meshContextWindow(_fontsize);
-  about = new aboutWindow(_fontsize);
+  options = new optionWindow();
+  fields = new fieldWindow();
+  plugins = new pluginWindow();
+  stats = new statisticsWindow();
+  visibility = new visibilityWindow();
+  clipping = new clippingWindow();
+  messages = new messageWindow();
+  manip = new manipWindow();
+  geoContext = new geometryContextWindow();
+  meshContext = new meshContextWindow();
+  about = new aboutWindow();
   for(int i = 0; i < MAX_NUM_SOLVERS; i++)
-    solver.push_back(new solverWindow(i, _fontsize));
+    solver.push_back(new solverWindow(i));
 
   // init solver plugin stuff
   callForSolverPlugin(-1);
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index abc9c737b3..8764a6dd57 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -12,10 +12,10 @@
 #define GMSH_WINDOW_BOX FL_FLAT_BOX
 #define NB_BUTT_SCROLL 25
 #define NB_HISTORY_MAX 1000
-#define IW (10 * _fontsize)    // input field width
-#define BB (7 * _fontsize)     // width of a button with internal label
-#define BH (2 * _fontsize + 1) // button height
-#define WB (7)                 // window border
+#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 (7)                      // window border
 
 class graphicWindow;
 class menuWindow;
@@ -40,7 +40,6 @@ class MElement;
 
 class GUI{
  private:
-  int _fontsize;
   static GUI *_instance;
  public:
   std::vector<GVertex*> selectedVertices;
diff --git a/Fltk/aboutWindow.cpp b/Fltk/aboutWindow.cpp
index 306354dbe7..2c5c011e02 100644
--- a/Fltk/aboutWindow.cpp
+++ b/Fltk/aboutWindow.cpp
@@ -32,11 +32,10 @@ static void help_credits_cb(Fl_Widget *w, void *data)
   SystemCall(cmd);
 }
 
-aboutWindow::aboutWindow(int fontsize)
-  : _fontsize(fontsize)
+aboutWindow::aboutWindow()
 {
   char buffer[1024];
-  int width = 28 * _fontsize;
+  int width = 28 * FL_NORMAL_SIZE;
   int height = 15 * BH + BH/2;
 
   win = new dialogWindow(width, height, CTX.non_modal_windows, "About Gmsh");
diff --git a/Fltk/aboutWindow.h b/Fltk/aboutWindow.h
index 394c09cff9..05fadd66ff 100644
--- a/Fltk/aboutWindow.h
+++ b/Fltk/aboutWindow.h
@@ -12,12 +12,10 @@
 #include <FL/Fl_Group.H>
 
 class aboutWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
  public:
-  aboutWindow(int fontsize);
+  aboutWindow();
 };
 
 #endif
diff --git a/Fltk/classificationEditor.cpp b/Fltk/classificationEditor.cpp
index d77904329e..52561dfce8 100644
--- a/Fltk/classificationEditor.cpp
+++ b/Fltk/classificationEditor.cpp
@@ -537,7 +537,6 @@ classificationEditor::classificationEditor()
   opt_mesh_line_width(0, GMSH_SET | GMSH_GUI, 1.5);
 
   // construct GUI in terms of standard sizes
-  int _fontsize = GetFontSize();
   const int width = (int)(3.5 * BB), height = 10 * BH;
 
   _window = new dialogWindow(width, height, CTX.non_modal_windows, "Classify");
diff --git a/Fltk/clippingWindow.cpp b/Fltk/clippingWindow.cpp
index 1715d70ba2..6dae0a98dd 100644
--- a/Fltk/clippingWindow.cpp
+++ b/Fltk/clippingWindow.cpp
@@ -145,8 +145,7 @@ static void clip_reset_cb(Fl_Widget *w, void *data)
   Draw();
 }
 
-clippingWindow::clippingWindow(int fontsize) 
-  : _fontsize(fontsize)
+clippingWindow::clippingWindow()
 {
   static Fl_Menu_Item plane_number[] = {
     {"Plane 0", 0, 0},
@@ -158,9 +157,9 @@ clippingWindow::clippingWindow(int fontsize)
     {0}
   };
 
-  int width = 26 * _fontsize;
+  int width = 26 * FL_NORMAL_SIZE;
   int height = 10 * BH + 5 * WB;
-  int L = 7 * _fontsize;
+  int L = 7 * FL_NORMAL_SIZE;
 
   win = new dialogWindow(width, height, CTX.non_modal_windows, "Clipping");
   win->box(GMSH_WINDOW_BOX);
@@ -174,25 +173,25 @@ clippingWindow::clippingWindow(int fontsize)
     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 * _fontsize;
+    int BW = width - L - 4 * WB - 4 * FL_NORMAL_SIZE;
 
     choice = new Fl_Choice(L + 2 * WB, 2 * WB + 1 * BH, BW, BH);
     choice->menu(plane_number);
     choice->callback(clip_num_cb);
 
     Fl_Button *invert = new Fl_Button
-      (L + 2 * WB, 2 * WB + 2 * BH, _fontsize, 4 * BH, "-");
+      (L + 2 * WB, 2 * WB + 2 * BH, FL_NORMAL_SIZE, 4 * BH, "-");
     invert->callback(clip_invert_cb);
     invert->tooltip("Invert orientation");
     
     value[0] = new Fl_Value_Input
-      (L + 2 * WB + _fontsize, 2 * WB + 2 * BH, BW - _fontsize, BH, "A");
+      (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 2 * BH, BW - FL_NORMAL_SIZE, BH, "A");
     value[1] = new Fl_Value_Input
-      (L + 2 * WB + _fontsize, 2 * WB + 3 * BH, BW - _fontsize, BH, "B");
+      (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 3 * BH, BW - FL_NORMAL_SIZE, BH, "B");
     value[2] = new Fl_Value_Input
-      (L + 2 * WB + _fontsize, 2 * WB + 4 * BH, BW - _fontsize, BH, "C");
+      (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 4 * BH, BW - FL_NORMAL_SIZE, BH, "C");
     value[3] = new Fl_Value_Input
-      (L + 2 * WB + _fontsize, 2 * WB + 5 * BH, BW - _fontsize, BH, "D");
+      (L + 2 * WB + FL_NORMAL_SIZE, 2 * WB + 5 * BH, BW - FL_NORMAL_SIZE, BH, "D");
     for(int i = 0; i < 4; i++){
       value[i]->align(FL_ALIGN_RIGHT);
       value[i]->callback(clip_update_cb);
@@ -206,7 +205,7 @@ clippingWindow::clippingWindow(int fontsize)
     group[1]->hide();
 
     int w2 = (width - L - 4 * WB) / 2;
-    int BW = w2 - 2 * _fontsize;
+    int BW = w2 - 2 * FL_NORMAL_SIZE;
     value[4] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Cx");
     value[5] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Cy");
     value[6] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Cz");
diff --git a/Fltk/clippingWindow.h b/Fltk/clippingWindow.h
index c3ced1dba1..ab82ae2cb3 100644
--- a/Fltk/clippingWindow.h
+++ b/Fltk/clippingWindow.h
@@ -14,8 +14,6 @@
 #include <FL/Fl_Group.H>
 
 class clippingWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Choice *choice;
@@ -24,7 +22,7 @@ class clippingWindow{
   Fl_Check_Button *butt[3];
   Fl_Group *group[2];
  public:
-  clippingWindow(int fontsize);
+  clippingWindow();
   void resetBrowser();
   void show();
 };
diff --git a/Fltk/colorbarWindow.cpp b/Fltk/colorbarWindow.cpp
index be5522c306..c88d693503 100644
--- a/Fltk/colorbarWindow.cpp
+++ b/Fltk/colorbarWindow.cpp
@@ -28,7 +28,7 @@ colorbarWindow::colorbarWindow(int x, int y, int w, int h, const char *l)
   ct = NULL;
   label = NULL;
   help_flag = 1;
-  font_height = GetFontSize() - 1; // use slightly smaller font
+  font_height = FL_NORMAL_SIZE - 1; // use slightly smaller font
   marker_height = font_height;
   wedge_height = marker_height;
   marker_pos = 0;
diff --git a/Fltk/contextWindow.cpp b/Fltk/contextWindow.cpp
index 928cda38c1..6d7f00a727 100644
--- a/Fltk/contextWindow.cpp
+++ b/Fltk/contextWindow.cpp
@@ -43,10 +43,9 @@ static void con_geometry_snap_cb(Fl_Widget *w, void *data)
   CTX.geom.snap[2] = GUI::instance()->geoContext->value[2]->value();
 }
 
-geometryContextWindow::geometryContextWindow(int fontsize)
-  : _fontsize(fontsize)
+geometryContextWindow::geometryContextWindow()
 {
-  int width = 31 * _fontsize;
+  int width = 31 * FL_NORMAL_SIZE;
   int height = 5 * WB + 9 * BH;
 
   win = new dialogWindow
@@ -206,8 +205,7 @@ void geometryContextWindow::show(int pane)
   win->show();
 }
 
-meshContextWindow::meshContextWindow(int fontsize)
-  : _fontsize(fontsize)
+meshContextWindow::meshContextWindow()
 {
   static Fl_Menu menu_transfinite_dir[] = {
     {"Left", 0, 0, 0},
@@ -216,7 +214,7 @@ meshContextWindow::meshContextWindow(int fontsize)
     {0}
   };
 
-  int width = 29 * _fontsize;
+  int width = 29 * FL_NORMAL_SIZE;
   int height = 5 * WB + 5 * BH;
 
   win = new dialogWindow
diff --git a/Fltk/contextWindow.h b/Fltk/contextWindow.h
index ff7ac307cd..2137e8edec 100644
--- a/Fltk/contextWindow.h
+++ b/Fltk/contextWindow.h
@@ -13,28 +13,24 @@
 #include <FL/Fl_Group.H>
 
 class geometryContextWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Input *input[30];
   Fl_Value_Input *value[10];
   Fl_Group *group[10];
  public:
-  geometryContextWindow(int fontsize);
+  geometryContextWindow();
   void show(int pane);
 };
 
 class meshContextWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Input *input[20];
   Fl_Choice *choice[20];
   Fl_Group *group[10];
  public:
-  meshContextWindow(int fontsize);
+  meshContextWindow();
   void show(int pane);
 };
 
diff --git a/Fltk/extraDialogs.cpp b/Fltk/extraDialogs.cpp
index 59c468c764..ab03c839a4 100644
--- a/Fltk/extraDialogs.cpp
+++ b/Fltk/extraDialogs.cpp
@@ -38,8 +38,6 @@ int arrow_editor(const char *title, double &a, double &b, double &c)
   };
   static _editor *editor = NULL;
 
-  int _fontsize = GetFontSize();
-
   if(!editor){
     editor = new _editor;
     editor->window = new dialogWindow
@@ -160,7 +158,6 @@ int model_chooser()
   };
   static _menu *menu = NULL;
 
-  int _fontsize = GetFontSize();
   const int WW = 200;
 
   if(!menu){
diff --git a/Fltk/fieldWindow.cpp b/Fltk/fieldWindow.cpp
index 8c0a3a68c9..6a769ae82d 100644
--- a/Fltk/fieldWindow.cpp
+++ b/Fltk/fieldWindow.cpp
@@ -119,9 +119,9 @@ static void field_select_node_cb(Fl_Widget *w, void *data)
   Draw();  
 }
 
-fieldWindow::fieldWindow(int fontsize) : _fontsize(fontsize)
+fieldWindow::fieldWindow()
 {
-  int width0 = 34 * _fontsize + WB;
+  int width0 = 34 * FL_NORMAL_SIZE + WB;
   int height0 = 13 * BH + 5 * WB;
   int width = (CTX.field_size[0] < width0) ? width0 : CTX.field_size[0];
   int height = (CTX.field_size[1] < height0) ? height0 : CTX.field_size[1];
diff --git a/Fltk/fieldWindow.h b/Fltk/fieldWindow.h
index c356592397..c93f3a72db 100644
--- a/Fltk/fieldWindow.h
+++ b/Fltk/fieldWindow.h
@@ -21,8 +21,6 @@
 class Field;
 
 class fieldWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Hold_Browser *browser;
@@ -36,7 +34,7 @@ class fieldWindow{
   Fl_Button *delete_btn;
   int selected_id;
  public:
-  fieldWindow(int fontsize);
+  fieldWindow();
   void loadFieldViewList();
   void loadFieldList();
   void saveFieldOptions();
diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp
index 92b7da69f2..9a1542babc 100644
--- a/Fltk/fileDialogs.cpp
+++ b/Fltk/fileDialogs.cpp
@@ -136,7 +136,6 @@ int generic_bitmap_dialog(const char *name, const char *title, int format)
     Fl_Button *ok, *cancel;
   };
   static _generic_bitmap_dialog *dialog = NULL;
-  int _fontsize = GetFontSize();
 
   if(!dialog){
     dialog = new _generic_bitmap_dialog;
@@ -189,8 +188,6 @@ int latex_dialog(const char *name)
   };
   static _latex_dialog *dialog = NULL;
   
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _latex_dialog;
     int h = 3 * WB + 2 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -242,8 +239,6 @@ int jpeg_dialog(const char *name)
   };
   static _jpeg_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _jpeg_dialog;
     int h = 3 * WB + 4 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -310,8 +305,6 @@ int gif_dialog(const char *name)
   };
   static _gif_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _gif_dialog;
     int h = 3 * WB + 6 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -425,8 +418,6 @@ int gl2ps_dialog(const char *name, const char *title, int format)
     {0}
   };
 
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _gl2ps_dialog;
     int h = 3 * WB + 8 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -512,8 +503,6 @@ int options_dialog(const char *name)
   };
   static _options_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _options_dialog;
     int h = 3 * WB + 3 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -567,8 +556,6 @@ int geo_dialog(const char *name)
   };
   static _geo_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
-
   if(!dialog){
     dialog = new _geo_dialog;
     int h = 3 * WB + 2 * BH, w = 2 * BB + 3 * WB, y = WB;
@@ -617,7 +604,6 @@ int pos_dialog(const char *name)
   };
   static _pos_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
   int BBB = BB + 9; // labels too long
 
   if(!dialog){
@@ -703,7 +689,6 @@ int msh_dialog(const char *name)
     {0}
   };
 
-  int _fontsize = GetFontSize();
   int BBB = BB + 9; // labels too long
 
   if(!dialog){
@@ -769,7 +754,6 @@ int unv_dialog(const char *name)
   };
   static _unv_dialog *dialog = NULL;
 
-  int _fontsize = GetFontSize();
   int BBB = BB + 9; // labels too long
 
   if(!dialog){
@@ -836,7 +820,6 @@ int bdf_dialog(const char *name)
     {0}
   };
 
-  int _fontsize = GetFontSize();
   int BBB = BB + 9; // labels too long
 
   if(!dialog){
@@ -902,7 +885,6 @@ int generic_mesh_dialog(const char *name, const char *title, int format,
     {0}
   };
 
-  int _fontsize = GetFontSize();
   int BBB = BB + 9; // labels too long
 
   if(!dialog){
@@ -1153,9 +1135,7 @@ int cgns_write_dialog(const char *filename)
     {0}
   };
 
-  int _fontsize = GetFontSize();
-
-  const int RBH = 3*GetFontSize()/2;    // radio button height
+  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;
diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp
index 587c5193f2..671f10a6c5 100644
--- a/Fltk/graphicWindow.cpp
+++ b/Fltk/graphicWindow.cpp
@@ -278,7 +278,7 @@ static void status_stepforward_cb(Fl_Widget *w, void *data)
   status_play_manual(!CTX.post.anim_cycle, 1);
 }
 
-graphicWindow::graphicWindow(int fontsize)
+graphicWindow::graphicWindow()
 {
   static bool first = true;
   if(first){
@@ -293,8 +293,8 @@ graphicWindow::graphicWindow(int fontsize)
     first = false;
   }
   
-  int sh = 2 * fontsize - 4; // status bar height
-  int sw = fontsize + 3; // status button width
+  int sh = 2 * FL_NORMAL_SIZE - 4; // status bar height
+  int sw = FL_NORMAL_SIZE + 3; // status button width
   int width = CTX.tmp_viewport[2] - CTX.tmp_viewport[0];
   int glheight = CTX.tmp_viewport[3] - CTX.tmp_viewport[1];
   int height = glheight + sh;
@@ -336,8 +336,8 @@ graphicWindow::graphicWindow(int fontsize)
   butt[4]->callback(status_xyz1p_cb, (void *)"r");
   butt[4]->tooltip("Rotate +90 or -90 degrees");
   
-  butt[3] = new Fl_Button(x, glheight + 2, 2 * fontsize, sht, "1:1");
-  x += 2 * fontsize;
+  butt[3] = new Fl_Button(x, glheight + 2, 2 * FL_NORMAL_SIZE, sht, "1:1");
+  x += 2 * FL_NORMAL_SIZE;
   butt[3]->callback(status_xyz1p_cb, (void *)"1:1");
   butt[3]->tooltip("Set unit scale");
   
diff --git a/Fltk/graphicWindow.h b/Fltk/graphicWindow.h
index fd58d5de9c..fe50991f5b 100644
--- a/Fltk/graphicWindow.h
+++ b/Fltk/graphicWindow.h
@@ -18,7 +18,7 @@ class graphicWindow{
   Fl_Button *butt[12];
   Fl_Box *label[2];
  public:
-  graphicWindow(int fontsize);
+  graphicWindow();
   void setAnimButtons(int mode);
   void checkAnimButtons();
 };
diff --git a/Fltk/manipWindow.cpp b/Fltk/manipWindow.cpp
index 30c0bc9590..8109877540 100644
--- a/Fltk/manipWindow.cpp
+++ b/Fltk/manipWindow.cpp
@@ -36,8 +36,7 @@ static void manip_update_cb(Fl_Widget *w, void *data)
   Draw();
 }
 
-manipWindow::manipWindow(int fontsize)
-  : _fontsize(fontsize)
+manipWindow::manipWindow()
 {
 
   int width = 4 * BB + 2 * WB;
diff --git a/Fltk/manipWindow.h b/Fltk/manipWindow.h
index d04f9c7350..c1ceb3ef9b 100644
--- a/Fltk/manipWindow.h
+++ b/Fltk/manipWindow.h
@@ -10,13 +10,11 @@
 #include <FL/Fl_Value_Input.H>
 
 class manipWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Value_Input *value[9];
  public:
-  manipWindow(int fontsize);
+  manipWindow();
   void update(bool force=false);
   void show();
 };
diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp
index 844690da7f..9bd86a912f 100644
--- a/Fltk/menuWindow.cpp
+++ b/Fltk/menuWindow.cpp
@@ -2400,9 +2400,9 @@ contextItem menu_post[] = {
   {0} 
 };
 
-menuWindow::menuWindow(int fontsize) : _fontsize(fontsize)
+menuWindow::menuWindow()
 {
-  int width = 14 * fontsize;
+  int width = 14 * FL_NORMAL_SIZE;
 
   // this is the initial height: no dynamic button is shown
 #if defined(__APPLE__)
@@ -2585,7 +2585,7 @@ void menuWindow::setContext(contextItem *menu_asked, int flag)
   label.clear();
 
   int width = win->w();
-  int popw = 4 * _fontsize + 3;
+  int popw = 4 * FL_NORMAL_SIZE + 3;
 
   // construct the dynamic menu
   int nb = 0;
diff --git a/Fltk/menuWindow.h b/Fltk/menuWindow.h
index 1f0ee37f32..4ca0722af9 100644
--- a/Fltk/menuWindow.h
+++ b/Fltk/menuWindow.h
@@ -55,7 +55,6 @@ extern contextItem menu_post[];
 class menuWindow{
  private:
   int _MH;
-  int _fontsize;
  public:
   Fl_Window *win;
 #if defined(__APPLE__)
@@ -72,7 +71,7 @@ class menuWindow{
   std::vector<popupButton*> popup2;
   std::vector<char*> label;
  public:
-  menuWindow(int fontsize);
+  menuWindow();
   void setContext(contextItem *menu_asked, int flag);
 };
 
diff --git a/Fltk/messageWindow.cpp b/Fltk/messageWindow.cpp
index 09d5c93df1..d24bd5eae4 100644
--- a/Fltk/messageWindow.cpp
+++ b/Fltk/messageWindow.cpp
@@ -65,8 +65,7 @@ static void message_save_cb(Fl_Widget *w, void *data)
   }
 }
 
-messageWindow::messageWindow(int fontsize)
-  : _fontsize(fontsize)
+messageWindow::messageWindow()
 {
   int width = CTX.msg_size[0];
   int height = CTX.msg_size[1];
@@ -78,7 +77,7 @@ messageWindow::messageWindow(int fontsize)
   browser = new Fl_Browser(0, 0, width, height - 2 * WB - BH);
   browser->box(FL_FLAT_BOX);
   browser->textfont(FL_COURIER);
-  browser->textsize(_fontsize - 1);
+  browser->textsize(FL_NORMAL_SIZE - 1);
   browser->type(FL_MULTI_BROWSER);
   browser->callback(message_copy_cb);
 
diff --git a/Fltk/messageWindow.h b/Fltk/messageWindow.h
index 46dd78ec4c..20faf8df18 100644
--- a/Fltk/messageWindow.h
+++ b/Fltk/messageWindow.h
@@ -11,14 +11,12 @@
 #include <FL/Fl_Check_Button.H>
 
 class messageWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Browser *browser;
   Fl_Check_Button *butt;
  public:
-  messageWindow(int fontsize);
+  messageWindow();
   void show(bool redrawOnly=false);
   void add(const char *msg);
   void save(const char *filename);
diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp
index a39c3f021d..0957436422 100644
--- a/Fltk/optionWindow.cpp
+++ b/Fltk/optionWindow.cpp
@@ -1155,11 +1155,16 @@ static void view_options_max_recursion_cb(Fl_Widget *w, void *data)
   view_options_ok_cb(0, 0);
 }
 
-optionWindow::optionWindow(int fontsize) : _fontsize(fontsize)
+optionWindow::optionWindow()
 {
-  int width = 34 * _fontsize + WB;
+  // we should maybe use deltaFontSize==2 on all "palette" windows to
+  // make them smaller
+  int deltaFontSize = 0;
+  FL_NORMAL_SIZE -= deltaFontSize;
+
+  int width = 34 * FL_NORMAL_SIZE + WB;
   int height = 13 * BH + 5 * WB;
-  int L = 7 * _fontsize;
+  int L = 7 * FL_NORMAL_SIZE;
 
   win = new dialogWindow(width, height, CTX.non_modal_windows);
   win->box(GMSH_WINDOW_BOX);
@@ -2415,7 +2420,7 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize)
       view.input[0]->align(FL_ALIGN_RIGHT);
       view.input[0]->callback(view_options_ok_cb);
 
-      int sw = (int)(1.5 * _fontsize);
+      int sw = (int)(1.5 * FL_NORMAL_SIZE);
       view.push[3] = new Fl_Repeat_Button
         (L + 2 * WB, 2 * WB + 3 * BH, sw, BH, "-");
       view.push[3]->callback(view_options_timestep_cb, (void*)"-");
@@ -2497,7 +2502,7 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize)
       view.butt[38]->type(FL_TOGGLE_BUTTON);
       view.butt[38]->callback(view_options_ok_cb);
 
-      int sw2 = (int)(2.5 * _fontsize);
+      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");
@@ -3083,6 +3088,8 @@ optionWindow::optionWindow(int fontsize) : _fontsize(fontsize)
 
   win->position(CTX.opt_position[0], CTX.opt_position[1]);
   win->end();
+
+  FL_NORMAL_SIZE += deltaFontSize;
 }
 
 void optionWindow::showGroup(int num, bool showWindow)
diff --git a/Fltk/optionWindow.h b/Fltk/optionWindow.h
index d66706dee0..3a2a8f9c8f 100644
--- a/Fltk/optionWindow.h
+++ b/Fltk/optionWindow.h
@@ -25,8 +25,6 @@
 extern Fl_Menu_Item menu_font_names[];
 
 class optionWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Hold_Browser *browser;
@@ -86,7 +84,7 @@ class optionWindow{
   } view;
 
  public:
-  optionWindow(int fontsize);
+  optionWindow();
   void showGroup(int num, bool showWindow=true);
   void resetBrowser();
   void resetExternalViewList();
diff --git a/Fltk/partitionDialog.cpp b/Fltk/partitionDialog.cpp
index a45593756b..8bea759f9d 100644
--- a/Fltk/partitionDialog.cpp
+++ b/Fltk/partitionDialog.cpp
@@ -464,8 +464,6 @@ void partition_dialog()
     {0}
   };
 
-  int _fontsize = GetFontSize();
-
   const int h = 6 * WB + 3 * BH + 4;    // This will be resized based on groups
                                         // that are displayed
   const int w = 3 * BB + IW + 3 * WB;   // Window width
diff --git a/Fltk/pluginWindow.cpp b/Fltk/pluginWindow.cpp
index 1b0ae51f2c..2a71d23ae6 100644
--- a/Fltk/pluginWindow.cpp
+++ b/Fltk/pluginWindow.cpp
@@ -152,9 +152,9 @@ static void plugin_cancel_cb(Fl_Widget *w, void *data)
   Draw();
 }
 
-pluginWindow::pluginWindow(int fontsize) : _fontsize(fontsize)
+pluginWindow::pluginWindow()
 {
-  int width0 = 34 * _fontsize + WB;
+  int width0 = 34 * FL_NORMAL_SIZE + WB;
   int height0 = 13 * BH + 5 * WB;
 
   int width = (CTX.plugin_size[0] < width0) ? width0 : CTX.plugin_size[0];
diff --git a/Fltk/pluginWindow.h b/Fltk/pluginWindow.h
index a4069a0995..91c9e5136a 100644
--- a/Fltk/pluginWindow.h
+++ b/Fltk/pluginWindow.h
@@ -24,15 +24,13 @@ struct PluginDialogBox{
 };
 
 class pluginWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Hold_Browser *browser;
   Fl_Multi_Browser *view_browser;
   Fl_Return_Button *run;
  public:
-  pluginWindow(int fontsize);
+  pluginWindow();
   void show(int viewIndex);
   void createDialogBox(GMSH_Plugin *p, int x, int y, int width, int height);
   void resetViewBrowser();
diff --git a/Fltk/projectionEditor.cpp b/Fltk/projectionEditor.cpp
index bc9745b09b..dd2a809b79 100644
--- a/Fltk/projectionEditor.cpp
+++ b/Fltk/projectionEditor.cpp
@@ -762,7 +762,7 @@ void uvPlot::draw()
   // draw points in u,v space, colored by their distance to the
   // projection surface
   int pw = w();
-  int ph = h() - (2 * GetFontSize() + 5);
+  int ph = h() - (2 * FL_NORMAL_SIZE + 5);
   for(unsigned int i = 0; i < _u.size(); i++){
     int x = (int)(_u[i] * pw);
     int y = (int)(_v[i] * ph);
@@ -783,7 +783,7 @@ void uvPlot::draw()
 
   // draw labels
   fl_color(FL_BLACK);
-  fl_font(FL_HELVETICA, GetFontSize());
+  fl_font(FL_HELVETICA, FL_NORMAL_SIZE);
   static char min[256], max[256], pts[256];
   sprintf(min, "%g", _dmin);
   sprintf(max, "%g", _dmax);
@@ -897,7 +897,6 @@ projectionEditor::projectionEditor()
   printf("currentSize = %d\n",m->getFMInternals()->current()->GetNumGroups());
 
   // construct GUI in terms of standard sizes
-  int _fontsize = GetFontSize();
   const int width = (int)(3.75 * BB), height = 25 * BH;
   
   // create all widgets (we construct this once, we never deallocate!)
diff --git a/Fltk/solverWindow.cpp b/Fltk/solverWindow.cpp
index ead36f2791..44b4e2f537 100644
--- a/Fltk/solverWindow.cpp
+++ b/Fltk/solverWindow.cpp
@@ -185,8 +185,7 @@ static void solver_choose_executable_cb(Fl_Widget *w, void *data)
   }
 }
 
-solverWindow::solverWindow(int solverIndex, int fontsize)
-  : _fontsize(fontsize)
+solverWindow::solverWindow(int solverIndex)
 {
   for(int i = 0; i < MAX_NUM_SOLVER_OPTIONS; i++)
     if(strlen(SINFO[solverIndex].option_name[i]))
diff --git a/Fltk/solverWindow.h b/Fltk/solverWindow.h
index f5a3b66f13..d2701762e0 100644
--- a/Fltk/solverWindow.h
+++ b/Fltk/solverWindow.h
@@ -13,8 +13,6 @@
 #include <FL/Fl_Button.H>
 
 class solverWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Input *input[50];
@@ -22,7 +20,7 @@ class solverWindow{
   Fl_Check_Button *butt[10];
   Fl_Button *command[10];
  public:
-  solverWindow(int solverIndex, int fontsize);
+  solverWindow(int solverIndex);
 };
 
 void solver_cb(Fl_Widget *w, void *data);
diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp
index d419fb1151..3a4483b972 100644
--- a/Fltk/statisticsWindow.cpp
+++ b/Fltk/statisticsWindow.cpp
@@ -76,11 +76,10 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
   Draw();
 }
 
-statisticsWindow::statisticsWindow(int fontsize)
-  : _fontsize(fontsize)
+statisticsWindow::statisticsWindow()
 {
   int i, num = 0;
-  int width = 26 * _fontsize;
+  int width = 26 * FL_NORMAL_SIZE;
   int height = 5 * WB + 18 * BH;
 
   win = new dialogWindow(width, height, CTX.non_modal_windows, "Statistics");
@@ -124,7 +123,7 @@ statisticsWindow::statisticsWindow(int fontsize)
       value[num]->tooltip("~ min (J0/J, J/J0)"); num++;
 
       for(int i = 0; i < 4; i++){
-        int ww = 3 * _fontsize;
+        int ww = 3 * FL_NORMAL_SIZE;
         new Fl_Box
           (FL_NO_BOX, width - 3 * ww - 2 * WB, 2 * WB + (13 + i) * BH, ww, BH, "Plot:");
         butt[2 * i] = new Fl_Button
diff --git a/Fltk/statisticsWindow.h b/Fltk/statisticsWindow.h
index ff1a571506..0f52f13811 100644
--- a/Fltk/statisticsWindow.h
+++ b/Fltk/statisticsWindow.h
@@ -12,8 +12,6 @@
 #include <FL/Fl_Group.H>
 
 class statisticsWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Output *value[50];
@@ -21,7 +19,7 @@ class statisticsWindow{
   Fl_Group *group[3];
   double quality[4][100];
  public:
-  statisticsWindow(int fontsize);
+  statisticsWindow();
   void compute(bool elementQuality);
   void show();
 };
diff --git a/Fltk/visibilityWindow.cpp b/Fltk/visibilityWindow.cpp
index 90434da13b..00445ab9e9 100644
--- a/Fltk/visibilityWindow.cpp
+++ b/Fltk/visibilityWindow.cpp
@@ -1045,8 +1045,7 @@ static void visibility_interactive_cb(Fl_Widget *w, void *data)
   Msg::StatusBar(3, false, "");
 }
 
-visibilityWindow::visibilityWindow(int fontsize) 
-  : _fontsize(fontsize)
+visibilityWindow::visibilityWindow()
 {
   static int cols[5] = {15, 95, 95, 180, 0};
   int width = cols[0] + cols[1] + cols[2] + cols[3] + 6 * WB;
diff --git a/Fltk/visibilityWindow.h b/Fltk/visibilityWindow.h
index 366cf23df6..10e220c28f 100644
--- a/Fltk/visibilityWindow.h
+++ b/Fltk/visibilityWindow.h
@@ -19,8 +19,6 @@
 #endif
 
 class visibilityWindow{
- private:
-  int _fontsize;
  public:
   Fl_Window *win;
   Fl_Choice *browser_type;
@@ -33,7 +31,7 @@ class visibilityWindow{
   Fl_Button *push[2];
   Fl_Input *input[10];
  public:
-  visibilityWindow(int fontsize);
+  visibilityWindow();
   void show(bool redrawOnly);
 };
 
-- 
GitLab