Merge branch 'master' into jgrpp

# Conflicts:
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/gfx_func.h
#	src/group_gui.cpp
#	src/industry_gui.cpp
#	src/misc_gui.cpp
#	src/news_gui.cpp
#	src/settings_gui.cpp
#	src/ship_gui.cpp
#	src/smallmap_gui.cpp
#	src/station_gui.cpp
#	src/subsidy_gui.cpp
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_gui.cpp
#	src/vehicle_gui.cpp
#	src/viewport.cpp
#	src/widget.cpp
#	src/widgets/dropdown.cpp
#	src/window.cpp
This commit is contained in:
Jonathan G Rennison
2023-12-17 01:16:40 +00:00
69 changed files with 525 additions and 543 deletions

View File

@@ -1490,7 +1490,7 @@ void SettingEntry::DrawSetting(GameSettings *settings_ptr, int left, int right,
DrawArrowButtons(buttons_left, button_y, COLOUR_YELLOW, state,
editable && value != (sd->flags & SF_GUI_0_IS_SPECIAL ? 0 : sd->min), editable && (uint32)value != sd->max);
}
this->DrawSettingString(text_left, text_right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, highlight, value);
this->DrawSettingString(text_left, text_right, y + (SETTING_HEIGHT - GetCharacterHeight(FS_NORMAL)) / 2, highlight, value);
}
void SettingEntry::DrawSettingString(uint left, uint right, int y, bool highlight, int32 value) const
@@ -1502,7 +1502,7 @@ void SettingEntry::DrawSettingString(uint left, uint right, int y, bool highligh
const Dimension warning_dimensions = GetSpriteSize(SPR_WARNING_SIGN);
if ((int)warning_dimensions.height <= SETTING_HEIGHT) {
DrawSprite(SPR_WARNING_SIGN, 0, (_current_text_dir == TD_RTL) ? edge - warning_dimensions.width - 5 : edge + 5,
y + (((int)FONT_HEIGHT_NORMAL - (int)warning_dimensions.height) / 2));
y + (((int)GetCharacterHeight(FS_NORMAL) - (int)warning_dimensions.height) / 2));
}
}
}
@@ -1867,7 +1867,7 @@ void SettingsPage::DrawSetting(GameSettings *, int left, int right, int y, bool)
{
bool rtl = _current_text_dir == TD_RTL;
DrawSprite((this->folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2);
DrawString(rtl ? left : left + _circle_size.width + WidgetDimensions::scaled.hsep_normal, rtl ? right - _circle_size.width - WidgetDimensions::scaled.hsep_normal : right, y + (SETTING_HEIGHT - FONT_HEIGHT_NORMAL) / 2, this->title, TC_ORANGE);
DrawString(rtl ? left : left + _circle_size.width + WidgetDimensions::scaled.hsep_normal, rtl ? right - _circle_size.width - WidgetDimensions::scaled.hsep_normal : right, y + (SETTING_HEIGHT - GetCharacterHeight(FS_NORMAL)) / 2, this->title, TC_ORANGE);
}
/** Construct settings tree */
@@ -2567,7 +2567,7 @@ struct GameSettingsWindow : Window {
{
switch (widget) {
case WID_GS_OPTIONSPANEL:
resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + WidgetDimensions::scaled.vsep_normal;
resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal;
resize->width = 1;
size->height = 5 * resize->height + WidgetDimensions::scaled.framerect.Vertical();
@@ -2583,7 +2583,7 @@ struct GameSettingsWindow : Window {
SetDParam(0, setting_types[i]);
size->width = std::max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width + padding.width);
}
size->height = 2 * FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal +
size->height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal +
std::max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width));
break;
}
@@ -2627,7 +2627,7 @@ struct GameSettingsWindow : Window {
/* Draw the 'some search results are hidden' notice. */
if (this->warn_missing != WHR_NONE) {
SetDParam(0, _game_settings_restrict_dropdown[this->filter.min_cat]);
DrawStringMultiLine(panel.WithHeight(this->warn_lines * FONT_HEIGHT_NORMAL), warn_str, TC_FROMSTRING, SA_CENTER);
DrawStringMultiLine(panel.WithHeight(this->warn_lines * GetCharacterHeight(FS_NORMAL)), warn_str, TC_FROMSTRING, SA_CENTER);
}
}
@@ -2698,17 +2698,17 @@ struct GameSettingsWindow : Window {
default: NOT_REACHED();
}
DrawString(tr, STR_CONFIG_SETTING_TYPE);
tr.top += FONT_HEIGHT_NORMAL;
tr.top += GetCharacterHeight(FS_NORMAL);
std::unique_ptr<SettingEntry::SetValueDParamsTempData> tempdata;
this->last_clicked->SetValueDParams(0, sd->def, tempdata);
DrawString(tr, STR_CONFIG_SETTING_DEFAULT_VALUE);
tr.top += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal;
tr.top += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
if (sd->flags & SF_GUI_ADVISE_DEFAULT) {
const Dimension warning_dimensions = GetSpriteSize(SPR_WARNING_SIGN);
const int step_height = std::max<int>(warning_dimensions.height, FONT_HEIGHT_NORMAL);
const int text_offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2;
const int step_height = std::max<int>(warning_dimensions.height, GetCharacterHeight(FS_NORMAL));
const int text_offset_y = (step_height - GetCharacterHeight(FS_NORMAL)) / 2;
const int warning_offset_y = (step_height - warning_dimensions.height) / 2;
const bool rtl = _current_text_dir == TD_RTL;