Skip to content

Commit

Permalink
Added option for setting governor range min and max to be used in gtk…
Browse files Browse the repository at this point in the history
…3-client.

See patch #6352

[[originally from svn r30539]]
  • Loading branch information
cazfi committed Nov 11, 2015
1 parent c5f83a9 commit 5c31635
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
7 changes: 5 additions & 2 deletions client/gui-gtk-3.0/cma_fe.c
Expand Up @@ -33,6 +33,7 @@
#include "client_main.h"
#include "cma_fec.h"
#include "messagewin_g.h"
#include "options.h"

/* client/gtk-3.0 */
#include "cityrep.h"
Expand Down Expand Up @@ -207,7 +208,7 @@ static void cell_data_func(GtkTreeViewColumn *col, GtkCellRenderer *cell,
}

/**************************************************************************
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)
{
Expand Down Expand Up @@ -351,7 +352,9 @@ struct cma_dialog *create_cma_dialog(struct city *pcity, bool tiny)

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_options.gui_gtk3_governor_range_min,
gui_options.gui_gtk3_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);
Expand Down
16 changes: 16 additions & 0 deletions client/options.c
Expand Up @@ -231,6 +231,8 @@ struct client_options gui_options = {
.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",
Expand Down Expand Up @@ -2590,6 +2592,20 @@ static struct client_option client_options[] = {
"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 "
Expand Down
12 changes: 11 additions & 1 deletion client/options.h
Expand Up @@ -244,7 +244,9 @@ struct client_options
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];
Expand Down Expand Up @@ -474,6 +476,14 @@ extern int messages_where[]; /* OR-ed MW_ values [E_COUNT] */
#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
Expand Down

0 comments on commit 5c31635

Please sign in to comment.