Author: cazfi
Date: Wed Nov 11 17:30:39 2015
New Revision: 30538

URL: http://svn.gna.org/viewcvs/freeciv?rev=30538&view=rev
Log:
Added option for setting governor range min and max to be used in gtk3-client.

See patch #6352

Modified:
    trunk/client/gui-gtk-3.0/cma_fe.c
    trunk/client/options.c
    trunk/client/options.h

Modified: trunk/client/gui-gtk-3.0/cma_fe.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/cma_fe.c?rev=30538&r1=30537&r2=30538&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/cma_fe.c   (original)
+++ trunk/client/gui-gtk-3.0/cma_fe.c   Wed Nov 11 17:30:39 2015
@@ -33,10 +33,12 @@
 #include "client_main.h"
 #include "cma_fec.h"
 #include "messagewin_g.h"
+#include "options.h"
 
 /* client/gtk-3.0 */
 #include "cityrep.h"
 #include "dialogs.h"
+#include "gui_main.h"
 #include "gui_stuff.h"
 #include "helpdlg.h"
 #include "inputdlg.h"
@@ -207,7 +209,7 @@
 }
 
 /**************************************************************************
- instantiates a new struct for each city_dialog window that is open.
+  Instantiates a new struct for each city_dialog window that is open.
 **************************************************************************/
 struct cma_dialog *create_cma_dialog(struct city *pcity, bool tiny)
 {
@@ -351,7 +353,9 @@
 
     pdialog->minimal_surplus[i] = hscale =
         gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, NULL);
-    gtk_range_set_range(GTK_RANGE(hscale), -20, 20);
+    gtk_range_set_range(GTK_RANGE(hscale),
+                        GUI_GTK_OPTION(governor_range_min),
+                        GUI_GTK_OPTION(governor_range_max));
     gtk_range_set_increments(GTK_RANGE(hscale), 1, 1);
     pango_layout_get_pixel_size(gtk_scale_get_layout(GTK_SCALE(hscale)),
                                 &layout_width, NULL);

Modified: trunk/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=30538&r1=30537&r2=30538&view=diff
==============================================================================
--- trunk/client/options.c      (original)
+++ trunk/client/options.c      Wed Nov 11 17:30:39 2015
@@ -231,6 +231,8 @@
   .gui_gtk3_citydlg_xsize = GUI_GTK3_CITYDLG_DEFAULT_XSIZE,
   .gui_gtk3_citydlg_ysize = GUI_GTK3_CITYDLG_DEFAULT_YSIZE,
   .gui_gtk3_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET,
+  .gui_gtk3_governor_range_min = -20,
+  .gui_gtk3_governor_range_max = 20,
   .gui_gtk3_font_city_label = "Monospace 8",
   .gui_gtk3_font_notify_label = "Monospace Bold 9",
   .gui_gtk3_font_spaceship_label = "Monospace 8",
@@ -2593,6 +2595,20 @@
                      "current ruleset is used."), COC_INTERFACE, GUI_GTK3,
                   GUI_POPUP_TECH_HELP_RULESET,
                   gui_popup_tech_help_name, NULL),
+  GEN_INT_OPTION(gui_gtk3_governor_range_min,
+                 N_("Minimum surplus for a governor"),
+                 N_("The lower limit of the range for requesting surpluses "
+                    "from the governor."),
+                 COC_INTERFACE, GUI_GTK3, GUI_GTK3_GOV_RANGE_MIN_DEFAULT,
+                 GUI_GTK3_GOV_RANGE_MIN_MIN, GUI_GTK3_GOV_RANGE_MIN_MAX,
+                 NULL),
+  GEN_INT_OPTION(gui_gtk3_governor_range_max,
+                 N_("Maximum surplus for a governor"),
+                 N_("The higher limit of the range for requesting surpluses "
+                    "from the governor."),
+                 COC_INTERFACE, GUI_GTK3, GUI_GTK3_GOV_RANGE_MAX_DEFAULT,
+                 GUI_GTK3_GOV_RANGE_MAX_MIN, GUI_GTK3_GOV_RANGE_MAX_MAX,
+                 NULL),
   GEN_FONT_OPTION(gui_gtk3_font_city_label, "city_label",
                   N_("City Label"),
                   N_("This font is used to display the city labels on city "

Modified: trunk/client/options.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.h?rev=30538&r1=30537&r2=30538&view=diff
==============================================================================
--- trunk/client/options.h      (original)
+++ trunk/client/options.h      Wed Nov 11 17:30:39 2015
@@ -244,7 +244,9 @@
   bool gui_gtk3_chatline_autocompletion;
   int gui_gtk3_citydlg_xsize;
   int gui_gtk3_citydlg_ysize;
-  int  gui_gtk3_popup_tech_help;
+  int gui_gtk3_popup_tech_help;
+  int gui_gtk3_governor_range_min;
+  int gui_gtk3_governor_range_max;
   char gui_gtk3_font_city_label[512];
   char gui_gtk3_font_notify_label[512];
   char gui_gtk3_font_spaceship_label[512];
@@ -478,6 +480,14 @@
 #define GUI_GTK3_CITYDLG_MIN_YSIZE      128
 #define GUI_GTK3_CITYDLG_MAX_YSIZE      4096
 
+#define GUI_GTK3_GOV_RANGE_MIN_DEFAULT  -20
+#define GUI_GTK3_GOV_RANGE_MIN_MIN      -100
+#define GUI_GTK3_GOV_RANGE_MIN_MAX      0
+
+#define GUI_GTK3_GOV_RANGE_MAX_DEFAULT  20
+#define GUI_GTK3_GOV_RANGE_MAX_MIN      0
+#define GUI_GTK3_GOV_RANGE_MAX_MAX      100
+
 #define GUI_DEFAULT_MAPIMG_FILENAME     "freeciv"
 
 #ifdef __cplusplus


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to