From 02b11e886752f6c1b2553e195089a194cc4151b2 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 6 Jun 2007 07:27:35 +0000
Subject: [PATCH] by default, choose GUI fontsize automatically (so that we use
 larger fonts by default on all these new fancy displays with huge
 resolutions)

---
 Common/DefaultOptions.h |  4 ++--
 Fltk/GUI.cpp            | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 2ba1282ff6..fa910342e2 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -563,8 +563,8 @@ StringXNumber GeneralOptions_Number[] = {
     "Horizontal position (in pixels) of the upper left corner of the file chooser windows" }, 
   { F|S, "FileChooserPositionY" , opt_general_file_chooser_position1 , 200. ,
     "Vertical position (in pixels) of the upper left corner of the file chooser windows" }, 
-  { F|O, "FontSize" , opt_general_fontsize , 13. , 
-    "Size of the font in the user interface" },
+  { F|O, "FontSize" , opt_general_fontsize , -1. , 
+    "Size of the font in the user interface (-1=automatic)" },
 
   { F|O, "GraphicsFontSize" , opt_general_graphics_fontsize , 16. ,
     "Size of the font in the graphic window" }, 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 9279a894c2..02e7ef2ffb 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.621 2007-05-25 21:58:11 geuzaine Exp $
+// $Id: GUI.cpp,v 1.622 2007-06-06 07:27:35 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -855,7 +855,18 @@ 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.)
-  fontsize = CTX.fontsize;
+  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;
+  }
 
   // set default font size
   FL_NORMAL_SIZE = fontsize;
-- 
GitLab