change: Remove min_button setting
This commit is contained in:
@@ -229,16 +229,6 @@ static inline int Center(int top, int height, uint size = FONT_HEIGHT_NORMAL)
|
|||||||
return top + (height - size) / 2;
|
return top + (height - size) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns fint/button size, rescaled to current screen resolution from the base Android resolution, which is 854x480
|
|
||||||
* @param value The value to rescale
|
|
||||||
* @return Rescaled value, using lesser of the curret screen coordinates
|
|
||||||
*/
|
|
||||||
static inline int RescaleFrom854x480(int value)
|
|
||||||
{
|
|
||||||
return std::min(value * _cur_resolution.width / 854, value * _cur_resolution.height / 480);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern DrawPixelInfo *_cur_dpi;
|
extern DrawPixelInfo *_cur_dpi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,8 +53,6 @@
|
|||||||
#include <SDL_android.h>
|
#include <SDL_android.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum { MIN_BUTTON_SIZE = 10, MAX_BUTTON_SIZE = 100 };
|
|
||||||
|
|
||||||
static const StringID _autosave_dropdown[] = {
|
static const StringID _autosave_dropdown[] = {
|
||||||
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
|
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF,
|
||||||
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
|
STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_1_MONTH,
|
||||||
@@ -278,16 +276,6 @@ struct GameOptionsWindow : Window {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GO_BUTTON_SIZE_DROPDOWN: // Dropdowns for size of all GUI elements and fonts
|
|
||||||
list = DropDownList();
|
|
||||||
*selected_index = _settings_client.gui.min_button;
|
|
||||||
for (uint i = MIN_BUTTON_SIZE; i <= MAX_BUTTON_SIZE; i++) {
|
|
||||||
DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
|
|
||||||
item->SetParam(0, i);
|
|
||||||
list.emplace_back(item);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WID_GO_BASE_GRF_DROPDOWN:
|
case WID_GO_BASE_GRF_DROPDOWN:
|
||||||
list = BuildSetDropDownList<BaseGraphics>(selected_index, (_game_mode == GM_MENU));
|
list = BuildSetDropDownList<BaseGraphics>(selected_index, (_game_mode == GM_MENU));
|
||||||
break;
|
break;
|
||||||
@@ -310,7 +298,6 @@ struct GameOptionsWindow : Window {
|
|||||||
case WID_GO_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break;
|
case WID_GO_CURRENCY_DROPDOWN: SetDParam(0, _currency_specs[this->opt->locale.currency].name); break;
|
||||||
case WID_GO_AUTOSAVE_DROPDOWN: SetDParam(0, _autosave_dropdown[_settings_client.gui.autosave]); break;
|
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_LANG_DROPDOWN: SetDParamStr(0, _current_language->own_name); break;
|
||||||
case WID_GO_BUTTON_SIZE_DROPDOWN: SetDParam(0, _settings_client.gui.min_button); break;
|
|
||||||
case WID_GO_BASE_GRF_DROPDOWN: SetDParamStr(0, BaseGraphics::GetUsedSet()->name); 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_GRF_STATUS: SetDParam(0, BaseGraphics::GetUsedSet()->GetNumInvalid()); break;
|
||||||
case WID_GO_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break;
|
case WID_GO_BASE_SFX_DROPDOWN: SetDParamStr(0, BaseSounds::GetUsedSet()->name); break;
|
||||||
@@ -466,13 +453,6 @@ struct GameOptionsWindow : Window {
|
|||||||
this->SetWidgetLoweredState(WID_GO_WINDOWS_TITLEBARS, _settings_client.gui.windows_titlebars);
|
this->SetWidgetLoweredState(WID_GO_WINDOWS_TITLEBARS, _settings_client.gui.windows_titlebars);
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
|
|
||||||
if (_settings_client.gui.min_button == 48 && _settings_client.gui.windows_titlebars) {
|
|
||||||
_settings_client.gui.min_button = 40;
|
|
||||||
}
|
|
||||||
if (_settings_client.gui.min_button == 40 && !_settings_client.gui.windows_titlebars) {
|
|
||||||
_settings_client.gui.min_button = 48;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReInitAllWindows(false);
|
ReInitAllWindows(false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -642,10 +622,6 @@ struct GameOptionsWindow : Window {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_GO_BUTTON_SIZE_DROPDOWN: // Setup screenshot format dropdown
|
|
||||||
_settings_client.gui.min_button = index;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WID_GO_REFRESH_RATE_DROPDOWN: {
|
case WID_GO_REFRESH_RATE_DROPDOWN: {
|
||||||
_settings_client.gui.refresh_rate = *std::next(_refresh_rates.begin(), index);
|
_settings_client.gui.refresh_rate = *std::next(_refresh_rates.begin(), index);
|
||||||
if (_settings_client.gui.refresh_rate > 60) {
|
if (_settings_client.gui.refresh_rate > 60) {
|
||||||
@@ -732,7 +708,6 @@ static const NWidgetPart _nested_game_options_widgets[] = {
|
|||||||
NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0),
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0),
|
||||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_GUI_SCALE_AUTO), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_SCALE_AUTO_TOOLTIP),
|
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GO_GUI_SCALE_AUTO), SetMinimalSize(21, 9), SetDataTip(STR_EMPTY, STR_GAME_OPTIONS_GUI_SCALE_AUTO_TOOLTIP),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GO_BUTTON_SIZE_DROPDOWN), SetMinimalSize(150, 12), SetDataTip(STR_JUST_INT, STR_CONFIG_SETTING_BUTTON_SIZE_TOOLTIP), SetFill(1, 0),
|
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_GUI_SCALE_BEVELS, STR_NULL),
|
NWidget(WWT_TEXT, COLOUR_GREY), SetMinimalSize(0, 12), SetDataTip(STR_GAME_OPTIONS_GUI_SCALE_BEVELS, STR_NULL),
|
||||||
NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0),
|
NWidget(NWID_SPACER), SetMinimalSize(1, 0), SetFill(1, 0),
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ struct GUISettings {
|
|||||||
bool windows_titlebars; ///< show or hide titlebars for all windows to increase scrren space
|
bool windows_titlebars; ///< show or hide titlebars for all windows to increase scrren space
|
||||||
bool draw_mouse_cursor; ///< draw mouse cursor, touchscreen does not generally need a mouse cursor, but mouse cursor shows currently selected build tool
|
bool draw_mouse_cursor; ///< draw mouse cursor, touchscreen does not generally need a mouse cursor, but mouse cursor shows currently selected build tool
|
||||||
bool windows_decorations; ///< draw ornament on all window edges
|
bool windows_decorations; ///< draw ornament on all window edges
|
||||||
uint min_button; ///< min size of most button widgets
|
|
||||||
bool show_finances; ///< show finances at end of year
|
bool show_finances; ///< show finances at end of year
|
||||||
bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames
|
bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames
|
||||||
bool new_nonstop; ///< ttdpatch compatible nonstop handling
|
bool new_nonstop; ///< ttdpatch compatible nonstop handling
|
||||||
|
|||||||
@@ -265,15 +265,6 @@ name = ""mono_aa""
|
|||||||
var = _fcsettings.mono.aa
|
var = _fcsettings.mono.aa
|
||||||
def = true
|
def = true
|
||||||
|
|
||||||
[SDTG_VAR]
|
|
||||||
name = ""min_button_size""
|
|
||||||
type = SLE_UINT
|
|
||||||
var = _settings_client.gui.min_button
|
|
||||||
def = 48
|
|
||||||
min = 0
|
|
||||||
max = 100
|
|
||||||
cat = SC_EXPERT
|
|
||||||
|
|
||||||
[SDTG_VAR]
|
[SDTG_VAR]
|
||||||
name = ""sprite_cache_size_px""
|
name = ""sprite_cache_size_px""
|
||||||
type = SLE_UINT
|
type = SLE_UINT
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
|
extern int _gui_scale;
|
||||||
|
|
||||||
/** Distances used in drawing widgets. */
|
/** Distances used in drawing widgets. */
|
||||||
enum WidgetDrawDistances {
|
enum WidgetDrawDistances {
|
||||||
/* WWT_IMGBTN(_2) */
|
/* WWT_IMGBTN(_2) */
|
||||||
@@ -1152,14 +1154,13 @@ void NWidgetResizeBase::SetMinimalSizeForSizingType()
|
|||||||
min_size = 0;
|
min_size = 0;
|
||||||
break;
|
break;
|
||||||
case NWST_BUTTON:
|
case NWST_BUTTON:
|
||||||
min_size = _settings_client.gui.min_button;
|
min_size = GetMinButtonSize();
|
||||||
break;
|
break;
|
||||||
case NWST_VIEWPORT:
|
case NWST_VIEWPORT:
|
||||||
min_size = 3 * _settings_client.gui.min_button;
|
min_size = (5 * _gui_scale) / 2;
|
||||||
break;
|
break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
min_size = RescaleFrom854x480(min_size);
|
|
||||||
|
|
||||||
this->min_x = std::max(this->min_x, min_size);
|
this->min_x = std::max(this->min_x, min_size);
|
||||||
this->min_y = std::max(this->min_y, min_size);
|
this->min_y = std::max(this->min_y, min_size);
|
||||||
@@ -3693,8 +3694,7 @@ NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int wid
|
|||||||
*/
|
*/
|
||||||
uint GetMinButtonSize(uint min_1)
|
uint GetMinButtonSize(uint min_1)
|
||||||
{
|
{
|
||||||
uint min_sizing = _settings_client.gui.min_button;
|
uint min_sizing = _gui_scale / 4;
|
||||||
min_sizing = RescaleFrom854x480(min_sizing);
|
|
||||||
|
|
||||||
return std::max(min_sizing, min_1);
|
return std::max(min_sizing, min_1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2959,7 +2959,7 @@ static void HandleAutoscroll()
|
|||||||
|
|
||||||
int x = _cursor.pos.x;
|
int x = _cursor.pos.x;
|
||||||
int y = _cursor.pos.y;
|
int y = _cursor.pos.y;
|
||||||
int border = RescaleFrom854x480(_settings_client.gui.min_button);
|
int border = GetMinButtonSize();
|
||||||
Window *w = FindWindowFromPt(x, y);
|
Window *w = FindWindowFromPt(x, y);
|
||||||
if (w == nullptr || w->flags & WF_DISABLE_VP_SCROLL) return;
|
if (w == nullptr || w->flags & WF_DISABLE_VP_SCROLL) return;
|
||||||
if (_settings_client.gui.auto_scrolling != VA_EVERY_VIEWPORT && w->window_class != WC_MAIN_WINDOW) return;
|
if (_settings_client.gui.auto_scrolling != VA_EVERY_VIEWPORT && w->window_class != WC_MAIN_WINDOW) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user