summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gfx.cpp2
-rw-r--r--src/gfx_func.h2
-rw-r--r--src/lang/english.txt7
-rw-r--r--src/newgrf.cpp5
-rw-r--r--src/settings.cpp6
-rw-r--r--src/settings_gui.cpp27
-rw-r--r--src/table/misc_settings.ini9
-rw-r--r--src/table/settings.ini2
-rw-r--r--src/widgets/settings_widget.h1
-rw-r--r--src/window.cpp3
-rw-r--r--src/zoom_type.h3
11 files changed, 60 insertions, 7 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index f6d9e0b98..cd14fdcfd 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -56,6 +56,8 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode,
static ReusableBuffer<uint8> _cursor_backup;
+ZoomLevelByte _gui_zoom; ///< GUI Zoom level
+
/**
* The rect for repaint.
*
diff --git a/src/gfx_func.h b/src/gfx_func.h
index 6576dee4f..7363443a6 100644
--- a/src/gfx_func.h
+++ b/src/gfx_func.h
@@ -71,6 +71,8 @@ extern Dimension _resolutions[32];
extern Dimension _cur_resolution;
extern Palette _cur_palette; ///< Current palette
+extern ZoomLevelByte _gui_zoom;
+
void HandleKeypress(uint keycode, WChar key);
void HandleTextInput(const char *str, bool marked = false, const char *caret = NULL, const char *insert_location = NULL, const char *replacement_end = NULL);
void HandleCtrlChanged();
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 2dc164726..0191ea9e6 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -984,6 +984,13 @@ STR_GAME_OPTIONS_RESOLUTION :{BLACK}Screen r
STR_GAME_OPTIONS_RESOLUTION_TOOLTIP :{BLACK}Select the screen resolution to use
STR_GAME_OPTIONS_RESOLUTION_OTHER :other
+STR_GAME_OPTIONS_GUI_ZOOM_FRAME :{BLACK}Interface size
+STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_TOOLTIP :{BLACK}Select the interface element size to use
+
+STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_NORMAL :Normal
+STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_2X_ZOOM :Double size
+STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM :Quad size
+
STR_GAME_OPTIONS_BASE_GRF :{BLACK}Base graphics set
STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}Select the base graphics set to use
STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} missing/corrupted file{P "" s}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 14e7dd57a..04e7a1ec2 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -9092,8 +9092,6 @@ static void FinalisePriceBaseMultipliers()
}
}
-void InitDepotWindowBlockSizes();
-
extern void InitGRFTownGeneratorNames();
/** Finish loading NewGRFs and execute needed post-processing */
@@ -9122,9 +9120,6 @@ static void AfterLoadGRFs()
/* Set the actually used Canal properties */
FinaliseCanals();
- /* Set the block size in the depot windows based on vehicle sprite sizes */
- InitDepotWindowBlockSizes();
-
/* Add all new houses to the house array. */
FinaliseHouseArray();
diff --git a/src/settings.cpp b/src/settings.cpp
index 5cbdce9d9..58b2000d1 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1066,6 +1066,12 @@ static bool InvalidateVehTimetableWindow(int32 p1)
static bool ZoomMinMaxChanged(int32 p1)
{
extern void ConstrainAllViewportsZoom();
+ if (_settings_client.gui.zoom_min > _gui_zoom) {
+ /* Restrict GUI zoom if it is no longer available. */
+ _gui_zoom = _settings_client.gui.zoom_min;
+ UpdateCursorSize();
+ ReInitAllWindows();
+ }
ConstrainAllViewportsZoom();
GfxClearSpriteCache();
return true;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 127e5da33..03dc618b9 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -57,6 +57,13 @@ static const StringID _autosave_dropdown[] = {
INVALID_STRING_ID,
};
+static const StringID _gui_zoom_dropdown[] = {
+ STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_NORMAL,
+ STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_2X_ZOOM,
+ STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_4X_ZOOM,
+ INVALID_STRING_ID,
+};
+
int _nb_orig_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1; ///< Number of original town names.
static StringID *_grf_names = NULL; ///< Pointer to town names defined by NewGRFs.
static int _nb_grf_names = 0; ///< Number of town names defined by NewGRFs.
@@ -279,6 +286,16 @@ struct GameOptionsWindow : Window {
}
break;
+ case WID_GO_GUI_ZOOM_DROPDOWN: {
+ list = new DropDownList();
+ *selected_index = ZOOM_LVL_OUT_4X - _gui_zoom;
+ const StringID *items = _gui_zoom_dropdown;
+ for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
+ *list->Append() = new DropDownListStringItem(*items, i, _settings_client.gui.zoom_min > ZOOM_LVL_OUT_4X - i);
+ }
+ break;
+ }
+
case WID_GO_BASE_GRF_DROPDOWN:
list = BuiltSetDropDownList<BaseGraphics>(selected_index);
break;
@@ -307,6 +324,7 @@ struct GameOptionsWindow : Window {
case WID_GO_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break;
case WID_GO_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break;
case WID_GO_RESOLUTION_DROPDOWN: SetDParam(0, GetCurRes() == _num_resolutions ? STR_GAME_OPTIONS_RESOLUTION_OTHER : SPECSTR_RESOLUTION_START + GetCurRes()); break;
+ case WID_GO_GUI_ZOOM_DROPDOWN: SetDParam(0, _gui_zoom_dropdown[ZOOM_LVL_OUT_4X - _gui_zoom]); break;
case WID_GO_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); break;
case WID_GO_BASE_GRF_STATUS: SetDParam(0, BaseGraphics::GetUsedSet()->GetNumInvalid()); break;
case WID_GO_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break;
@@ -509,6 +527,12 @@ struct GameOptionsWindow : Window {
}
break;
+ case WID_GO_GUI_ZOOM_DROPDOWN:
+ _gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
+ UpdateCursorSize();
+ ReInitAllWindows();
+ break;
+
case WID_GO_BASE_GRF_DROPDOWN:
this->SetMediaSet<BaseGraphics>(index);
break;
@@ -568,6 +592,9 @@ static const NWidgetPart _nested_game_options_widgets[] = {
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_FULLSCREEN_BUTTON), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_FULLSCREEN_TOOLTIP),
EndContainer(),
EndContainer(),
+ NWidget(WWT_FRAME, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_GUI_ZOOM_FRAME, STR_NULL),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_GUI_ZOOM_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_BLACK_STRING, STR_GAME_OPTIONS_GUI_ZOOM_DROPDOWN_TOOLTIP), SetFill(1, 0),
+ EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL), SetPIP(0, 6, 0),
diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini
index 474c9b981..52ca2d16e 100644
--- a/src/table/misc_settings.ini
+++ b/src/table/misc_settings.ini
@@ -299,5 +299,14 @@ min = 0
max = UINT32_MAX
cat = SC_EXPERT
+[SDTG_VAR]
+name = ""gui_zoom""
+type = SLE_UINT8
+var = _gui_zoom
+def = ZOOM_LVL_OUT_4X
+min = ZOOM_LVL_MIN
+max = ZOOM_LVL_OUT_4X
+cat = SC_BASIC
+
[SDTG_END]
diff --git a/src/table/settings.ini b/src/table/settings.ini
index ad59eb30a..7a4c6dc34 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -2688,7 +2688,7 @@ flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_MULTISTRING
def = ZOOM_LVL_MIN
min = ZOOM_LVL_MIN
-max = ZOOM_LVL_GUI
+max = ZOOM_LVL_OUT_4X
str = STR_CONFIG_SETTING_ZOOM_MIN
strhelp = STR_CONFIG_SETTING_ZOOM_MIN_HELPTEXT
strval = STR_CONFIG_SETTING_ZOOM_LVL_MIN
diff --git a/src/widgets/settings_widget.h b/src/widgets/settings_widget.h
index a9015b1ee..661f788cd 100644
--- a/src/widgets/settings_widget.h
+++ b/src/widgets/settings_widget.h
@@ -23,6 +23,7 @@ enum GameOptionsWidgets {
WID_GO_LANG_DROPDOWN, ///< Language dropdown.
WID_GO_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution.
WID_GO_FULLSCREEN_BUTTON, ///< Toggle fullscreen.
+ WID_GO_GUI_ZOOM_DROPDOWN, ///< Dropdown for the GUI zoom level.
WID_GO_BASE_GRF_DROPDOWN, ///< Use to select a base GRF.
WID_GO_BASE_GRF_STATUS, ///< Info about missing files etc.
WID_GO_BASE_GRF_TEXTFILE, ///< Open base GRF readme, changelog (+1) or license (+2).
diff --git a/src/window.cpp b/src/window.cpp
index 3b6b08df1..398ddf670 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -3264,6 +3264,9 @@ void ReInitAllWindows()
NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
NWidgetScrollbar::InvalidateDimensionCache();
+ extern void InitDepotWindowBlockSizes();
+ InitDepotWindowBlockSizes();
+
Window *w;
FOR_ALL_WINDOWS_FROM_BACK(w) {
w->ReInit();
diff --git a/src/zoom_type.h b/src/zoom_type.h
index 37ffc153c..ec80eaf3b 100644
--- a/src/zoom_type.h
+++ b/src/zoom_type.h
@@ -33,7 +33,6 @@ enum ZoomLevel {
/* Here we define in which zoom viewports are */
ZOOM_LVL_VIEWPORT = ZOOM_LVL_OUT_4X, ///< Default zoom level for viewports.
- ZOOM_LVL_GUI = ZOOM_LVL_OUT_4X, ///< Default zoom level for GUI sprites.
ZOOM_LVL_NEWS = ZOOM_LVL_OUT_4X, ///< Default zoom level for the news messages.
ZOOM_LVL_INDUSTRY = ZOOM_LVL_OUT_8X, ///< Default zoom level for the industry view.
ZOOM_LVL_TOWN = ZOOM_LVL_OUT_8X, ///< Default zoom level for the town view.
@@ -53,4 +52,6 @@ DECLARE_POSTFIX_INCREMENT(ZoomLevel)
/** Type for storing the zoom level in a byte. */
typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
+#define ZOOM_LVL_GUI (_gui_zoom)
+
#endif /* ZOOM_TYPE_H */