diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index ac75fb89cdec748f166681f5098d86f0114e147e..20167e25cef77bd767c725ea7a023aa5f87fcf43 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.57 2006-11-27 22:22:09 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.58 2007-06-12 07:04:08 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -45,7 +45,7 @@ Colorbar_Window::Colorbar_Window(int x, int y, int w, int h, const char *l) ct = NULL; label = NULL; help_flag = 1; - font_height = CTX.fontsize; + font_height = GetFontSize(); marker_height = font_height; wedge_height = marker_height; marker_pos = 0; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 02e7ef2ffb3cc4fd001d10841a9ef9638acb224d..dfc60a826e6444ee2618cb0d3a65bba6037614d1 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.622 2007-06-06 07:27:35 geuzaine Exp $ +// $Id: GUI.cpp,v 1.623 2007-06-12 07:04:08 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -452,6 +452,22 @@ int GetFontAlign(char *alignstr) return 0; } +int GetFontSize() +{ + if(CTX.fontsize > 0){ + return CTX.fontsize; + } + else{ + int x, y, w, h; + Fl::screen_xywh(x, y, w, h); + if(w <= 860) return 11; + else if(w <= 1024) return 12; + else if(w <= 1440) return 13; + else if(w <= 1600) return 14; + else return 15; + } +} + // Definition of global shortcuts int GUI::global_shortcuts(int event) @@ -855,18 +871,7 @@ GUI::GUI(int argc, char **argv) // 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 (set_context, plugin, etc.) - if(CTX.fontsize > 0){ - fontsize = CTX.fontsize; - } - else{ - int x, y, w, h; - Fl::screen_xywh(x, y, w, h); - if(w <= 860) fontsize = 11; - else if(w <= 1024) fontsize = 12; - else if(w <= 1440) fontsize = 13; - else if(w <= 1600) fontsize = 14; - else fontsize = 15; - } + fontsize = GetFontSize(); // set default font size FL_NORMAL_SIZE = fontsize; diff --git a/Fltk/GUI.h b/Fltk/GUI.h index e0507a0059ff109bc1e5fb910058a2587d45f08e..0d2ec1619ab76c056252a6f6c26579bff2f04b61 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -332,6 +332,7 @@ int GetFontIndex(char *fontname); int GetFontEnum(int index); char *GetFontName(int index); int GetFontAlign(char *alignstr); +int GetFontSize(); #endif diff --git a/Fltk/GUI_Extras.cpp b/Fltk/GUI_Extras.cpp index 34ba903bea904e63ae258d0120c65691d21eeec2..b6c202c0ffc252e4869bf25dd137ee0408b357de 100644 --- a/Fltk/GUI_Extras.cpp +++ b/Fltk/GUI_Extras.cpp @@ -1,4 +1,4 @@ -// $Id: GUI_Extras.cpp,v 1.34 2007-05-13 10:37:02 geuzaine Exp $ +// $Id: GUI_Extras.cpp,v 1.35 2007-06-12 07:04:08 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -23,14 +23,13 @@ #include "GmshUI.h" #include "GmshDefines.h" #include "File_Picker.h" -#include "Shortcut_Window.h" #include "CreateFile.h" #include "Options.h" #include "Context.h" #include "Draw.h" +#include "GUI.h" +#include "Shortcut_Window.h" -#include <FL/Fl_Button.H> -#include <FL/Fl_Return_Button.H> #include <FL/Fl_Value_Slider.H> #include <FL/Fl_Menu_Window.H> #include <errno.h> @@ -121,8 +120,8 @@ int arrow_editor(char *title, double &a, double &b, double &c) }; static _editor *editor = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!editor){ @@ -229,8 +228,8 @@ int generic_bitmap_dialog(char *name, char *title, int format) }; static _generic_bitmap_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -284,8 +283,8 @@ int jpeg_dialog(char *name) }; static _jpeg_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -353,8 +352,8 @@ int gif_dialog(char *name) }; static _gif_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -465,8 +464,8 @@ int gl2ps_dialog(char *name, char *title, int format) {0} }; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -548,8 +547,8 @@ int options_dialog(char *name) }; static _options_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -603,8 +602,8 @@ int geo_dialog(char *name) }; static _geo_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -656,8 +655,8 @@ int generic_mesh_dialog(char *name, char *title, int format) }; static _generic_mesh_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -718,8 +717,8 @@ int msh_dialog(char *name) {0} }; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -780,8 +779,8 @@ int unv_dialog(char *name) }; static _unv_dialog *dialog = NULL; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -845,8 +844,8 @@ int bdf_dialog(char *name) {0} }; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ @@ -910,8 +909,8 @@ int stl_dialog(char *name) {0} }; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize + 9; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize() + 9; const int WB = 7; if(!dialog){ diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp index 53354f939e8df3fefd68fc6071a2e0a05063a224..9706436b5de81f1a24426ab671e42f513b3854f3 100644 --- a/Fltk/GUI_Projection.cpp +++ b/Fltk/GUI_Projection.cpp @@ -5,11 +5,8 @@ #include "Draw.h" #include "Options.h" #include "Context.h" - +#include "GUI.h" #include "Shortcut_Window.h" -#include <FL/Fl_Button.H> -#include <FL/Fl_Return_Button.H> -#include <FL/Fl_Value_Input.H> extern GModel *GMODEL; extern Context_T CTX; @@ -23,8 +20,8 @@ int projection_editor(char *title, projectionFace *p) }; static _editor *editor = 0; - const int BH = 2 * CTX.fontsize + 1; - const int BB = 7 * CTX.fontsize; + const int BH = 2 * GetFontSize() + 1; + const int BB = 7 * GetFontSize(); const int WB = 7; SBoundingBox3d bounds = GMODEL->bounds();