1
0
Fork 0

Change: Remove extra close buttons from some windows. (#14124)

All windows have an X button to close it, so remove the redundant close buttons.
pull/14257/head
Peter Nelson 2025-05-12 14:54:44 +01:00 committed by GitHub
parent a62081d79e
commit d9247fa1a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 7 additions and 57 deletions

View File

@ -3522,15 +3522,12 @@ STR_SAVE_PRESET_CAPTION :{WHITE}Save pre
STR_SAVE_PRESET_LIST_TOOLTIP :{BLACK}List of available presets, select one to copy it to the save name below
STR_SAVE_PRESET_TITLE :{BLACK}Enter a name for the preset
STR_SAVE_PRESET_EDITBOX_TOOLTIP :{BLACK}Currently selected name for the preset to save
STR_SAVE_PRESET_CANCEL :{BLACK}Cancel
STR_SAVE_PRESET_CANCEL_TOOLTIP :{BLACK}Don't change the preset
STR_SAVE_PRESET_SAVE :{BLACK}Save
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Save the preset to the current selected name
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Change base graphics parameters
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Change NewGRF parameters
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Close
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Reset
STR_NEWGRF_PARAMETERS_RESET_TOOLTIP :{BLACK}Set all parameters to their default value
STR_NEWGRF_PARAMETERS_DEFAULT_NAME :Parameter {NUM}
@ -4891,8 +4888,6 @@ STR_AI_LIST_URL :{LTBLUE}URL: {O
STR_AI_LIST_ACCEPT :{BLACK}Accept
STR_AI_LIST_ACCEPT_TOOLTIP :{BLACK}Select highlighted script
STR_AI_LIST_CANCEL :{BLACK}Cancel
STR_AI_LIST_CANCEL_TOOLTIP :{BLACK}Don't change the script
STR_SCREENSHOT_CAPTION :{WHITE}Take a screenshot
STR_SCREENSHOT_SCREENSHOT :{BLACK}Normal screenshot
@ -4905,7 +4900,6 @@ STR_SCREENSHOT_MINIMAP_SCREENSHOT :{BLACK}Minimap
# Script Parameters
STR_AI_SETTINGS_CAPTION_AI :{WHITE}AI Parameters
STR_AI_SETTINGS_CAPTION_GAMESCRIPT :{WHITE}Game Script Parameters
STR_AI_SETTINGS_CLOSE :{BLACK}Close
STR_AI_SETTINGS_RESET :{BLACK}Reset
STR_AI_SETTINGS_SETTING :{RAW_STRING}: {ORANGE}{STRING1}

View File

@ -831,10 +831,6 @@ public:
this->InvalidateData();
break;
case WID_NCL_CANCEL:
this->Close();
break;
case WID_NCL_OPEN_URL:
if (this->selected != nullptr) {
OpenBrowser(this->selected->url);
@ -985,8 +981,6 @@ public:
for (TextfileType tft = TFT_CONTENT_BEGIN; tft < TFT_CONTENT_END; tft++) {
this->SetWidgetDisabledState(WID_NCL_TEXTFILE + tft, this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE || !this->selected->GetTextfile(tft).has_value());
}
this->GetWidget<NWidgetCore>(WID_NCL_CANCEL)->SetString(this->filesize_sum == 0 ? STR_AI_SETTINGS_CLOSE : STR_AI_LIST_CANCEL);
}
};
@ -1079,12 +1073,8 @@ static constexpr NWidgetPart _nested_network_content_list_widgets[] = {
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_SEARCH_EXTERNAL), SetResize(1, 0), SetFill(1, 0),
SetStringTip(STR_CONTENT_SEARCH_EXTERNAL, STR_CONTENT_SEARCH_EXTERNAL_TOOLTIP),
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_CANCEL), SetResize(1, 0), SetFill(1, 0),
SetStringTip(STR_BUTTON_CANCEL),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_DOWNLOAD), SetResize(1, 0), SetFill(1, 0),
SetStringTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCL_DOWNLOAD), SetResize(1, 0), SetFill(1, 0),
SetStringTip(STR_CONTENT_DOWNLOAD_CAPTION, STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP),
EndContainer(),
EndContainer(),
/* Resize button. */

View File

@ -671,10 +671,6 @@ public:
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_NG_CANCEL: // Cancel button
CloseWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
break;
case WID_NG_NAME: // Sort by name
case WID_NG_CLIENTS: // Sort by connected clients
case WID_NG_MAPSIZE: // Sort by map size
@ -926,7 +922,6 @@ static constexpr NWidgetPart _nested_network_game_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_SEARCH_LAN), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN, STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_ADD), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_START), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_CANCEL), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_BUTTON_CANCEL),
EndContainer(),
EndContainer(),
/* Resize button. */

View File

@ -429,10 +429,6 @@ struct NewGRFParametersWindow : public Window {
this->InvalidateData();
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
break;
case WID_NP_ACCEPT:
this->Close();
break;
}
}
@ -525,9 +521,8 @@ static constexpr NWidgetPart _nested_newgrf_parameter_widgets[] = {
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_NP_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_NEWGRF_PARAMETERS_CLOSE),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_NP_RESET), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_NEWGRF_PARAMETERS_RESET, STR_NEWGRF_PARAMETERS_RESET_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_NP_RESET), SetStringTip(STR_NEWGRF_PARAMETERS_RESET, STR_NEWGRF_PARAMETERS_RESET_TOOLTIP),
NWidget(WWT_PANEL, COLOUR_MAUVE), SetResize(1, 0), SetFill(1, 0),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
EndContainer(),
@ -1996,7 +1991,6 @@ static constexpr NWidgetPart _nested_save_preset_widgets[] = {
SetStringTip(STR_SAVE_PRESET_TITLE, STR_SAVE_PRESET_EDITBOX_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SVP_CANCEL), SetStringTip(STR_SAVE_PRESET_CANCEL, STR_SAVE_PRESET_CANCEL_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SVP_SAVE), SetStringTip(STR_SAVE_PRESET_SAVE, STR_SAVE_PRESET_SAVE_TOOLTIP), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
@ -2035,7 +2029,6 @@ struct SavePresetWindow : public Window {
this->querystrings[WID_SVP_EDITBOX] = &this->presetname_editbox;
this->presetname_editbox.ok_button = WID_SVP_SAVE;
this->presetname_editbox.cancel_button = WID_SVP_CANCEL;
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_SVP_SCROLLBAR);
@ -2105,10 +2098,6 @@ struct SavePresetWindow : public Window {
break;
}
case WID_SVP_CANCEL:
this->Close();
break;
case WID_SVP_SAVE: {
Window *w = FindWindowById(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE);
if (w != nullptr) {

View File

@ -214,10 +214,6 @@ struct ScriptListWindow : public Window {
this->Close();
break;
}
case WID_SCRL_CANCEL:
this->Close();
break;
}
}
@ -261,10 +257,7 @@ static constexpr NWidgetPart _nested_script_list_widgets[] = {
NWidget(WWT_PANEL, COLOUR_MAUVE, WID_SCRL_INFO_BG), SetMinimalTextLines(8, WidgetDimensions::unscaled.framerect.Vertical() + WidgetDimensions::unscaled.vsep_normal * 3), SetResize(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRL_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRL_CANCEL), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_AI_LIST_CANCEL, STR_AI_LIST_CANCEL_TOOLTIP),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRL_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_AI_LIST_ACCEPT, STR_AI_LIST_ACCEPT_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
EndContainer(),
};
@ -483,10 +476,6 @@ struct ScriptSettingsWindow : public Window {
break;
}
case WID_SCRS_ACCEPT:
this->Close();
break;
case WID_SCRS_RESET:
this->script_config->ResetEditableSettings(_game_mode == GM_MENU || ((this->slot != OWNER_DEITY) && !Company::IsValidID(this->slot)));
this->SetDirty();
@ -577,9 +566,8 @@ static constexpr NWidgetPart _nested_script_settings_widgets[] = {
NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_SCRS_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRS_ACCEPT), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_AI_SETTINGS_CLOSE),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRS_RESET), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_AI_SETTINGS_RESET),
NWidget(WWT_PUSHTXTBTN, COLOUR_MAUVE, WID_SCRS_RESET), SetStringTip(STR_AI_SETTINGS_RESET),
NWidget(WWT_PANEL, COLOUR_MAUVE), SetResize(1, 0), SetFill(1, 0),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
EndContainer(),

View File

@ -40,7 +40,6 @@ enum NetworkContentListWidgets : WidgetID {
WID_NCL_SELECT_UPDATE, ///< 'Select updates' button.
WID_NCL_UNSELECT, ///< 'Unselect all' button.
WID_NCL_OPEN_URL, ///< 'Open url' button.
WID_NCL_CANCEL, ///< 'Cancel' button.
WID_NCL_DOWNLOAD, ///< 'Download' button.
WID_NCL_SEL_ALL_UPDATE, ///< #NWID_SELECTION widget for select all/update buttons..

View File

@ -45,7 +45,6 @@ enum NetworkGameWidgets : WidgetID {
WID_NG_SEARCH_LAN, ///< 'Search LAN server' button.
WID_NG_ADD, ///< 'Add server' button.
WID_NG_START, ///< 'Start server' button.
WID_NG_CANCEL, ///< 'Cancel' button.
};
/** Widgets of the #NetworkStartServerWindow class. */

View File

@ -23,7 +23,6 @@ enum NewGRFParametersWidgets : WidgetID {
WID_NP_NUMPAR_TEXT, ///< Text description.
WID_NP_BACKGROUND, ///< Panel to draw the settings on.
WID_NP_SCROLLBAR, ///< Scrollbar to scroll through all settings.
WID_NP_ACCEPT, ///< Accept button.
WID_NP_RESET, ///< Reset button.
WID_NP_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions.
WID_NP_DESCRIPTION, ///< Multi-line description of a parameter.
@ -67,7 +66,6 @@ enum SavePresetWidgets : WidgetID {
WID_SVP_PRESET_LIST, ///< List with available preset names.
WID_SVP_SCROLLBAR, ///< Scrollbar for the list available preset names.
WID_SVP_EDITBOX, ///< Edit box for changing the preset name.
WID_SVP_CANCEL, ///< Button to cancel saving the preset.
WID_SVP_SAVE, ///< Button to save the preset.
};

View File

@ -19,7 +19,6 @@ enum ScriptListWidgets : WidgetID {
WID_SCRL_SCROLLBAR, ///< Scrollbar next to the Script list.
WID_SCRL_INFO_BG, ///< Panel to draw some Script information on.
WID_SCRL_ACCEPT, ///< Accept button.
WID_SCRL_CANCEL, ///< Cancel button.
};
/** Widgets of the #ScriptSettingsWindow class. */
@ -27,7 +26,6 @@ enum ScriptSettingsWidgets : WidgetID {
WID_SCRS_CAPTION, ///< Caption of the window.
WID_SCRS_BACKGROUND, ///< Panel to draw the settings on.
WID_SCRS_SCROLLBAR, ///< Scrollbar to scroll through all settings.
WID_SCRS_ACCEPT, ///< Accept button.
WID_SCRS_RESET, ///< Reset button.
WID_SCRS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value.