Add a config setting to toggle toolbar mode

This commit is contained in:
Aaron van Geffen 2024-05-08 21:19:57 +02:00
parent 6e607bbb37
commit e423575411
7 changed files with 30 additions and 10 deletions

View File

@ -3700,6 +3700,8 @@ STR_6625 :Invalid colour
STR_6626 :Animation is backwards
STR_6627 :Track speed too high!
STR_6628 :Can only be placed on path edges!
STR_6629 :Align toolbar buttons horizontally centred
STR_6630 :This setting will align toolbar the buttons horizontally in the centre of the screen. The traditional way of aligning them is to in left and right corner.
#############
# Scenarios #

View File

@ -1,5 +1,6 @@
0.4.12 (in development)
------------------------------------------------------------------------
- Feature: [#622] Add option to align the top toolbar buttons horizontally centred (off by default).
- Feature: [#21714] [Plugin] Costume assignment is now tailored to each staff type.
- Feature: [#21913] [Plugin] Allow precise and safe control of peep animations.
- Improved: [#21981] Rendering performance of the map window has been improved considerably.

View File

@ -169,6 +169,7 @@ enum WindowOptionsWidgetIdx {
WIDX_THEMES_DROPDOWN,
WIDX_THEMES_BUTTON,
WIDX_TOOLBAR_BUTTONS_GROUP,
WIDX_TOOLBAR_BUTTONS_CENTRED,
WIDX_TOOLBAR_BUTTONS_SHOW_FOR_LABEL,
WIDX_TOOLBAR_SHOW_FINANCES,
WIDX_TOOLBAR_SHOW_RESEARCH,
@ -337,15 +338,18 @@ static Widget window_options_controls_and_interface_widgets[] = {
MakeWidget({155, THEMES_GROUP_START + 30}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_THEMES_BUTTON, STR_EDIT_THEMES_BUTTON_TIP), // Themes button
#undef THEMES_GROUP_START
#define TOOLBAR_GROUP_START 215
MakeWidget({ 5, TOOLBAR_GROUP_START + 0}, {300, 92}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group
MakeWidget({ 10, TOOLBAR_GROUP_START + 14}, {280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_SHOW_TOOLBAR_BUTTONS_FOR ),
MakeWidget({ 24, TOOLBAR_GROUP_START + 31}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR, STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances
MakeWidget({ 24, TOOLBAR_GROUP_START + 46}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_BUTTON_ON_TOOLBAR, STR_RESEARCH_BUTTON_ON_TOOLBAR_TIP ), // Research
MakeWidget({155, TOOLBAR_GROUP_START + 31}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHEATS_BUTTON_ON_TOOLBAR, STR_CHEATS_BUTTON_ON_TOOLBAR_TIP ), // Cheats
MakeWidget({155, TOOLBAR_GROUP_START + 46}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR, STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR_TIP), // Recent messages
MakeWidget({ 24, TOOLBAR_GROUP_START + 61}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute
MakeWidget({155, TOOLBAR_GROUP_START + 61}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat
MakeWidget({ 24, TOOLBAR_GROUP_START + 76}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom
MakeWidget({ 5, TOOLBAR_GROUP_START + 0}, {300,107}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group
MakeWidget({ 10, TOOLBAR_GROUP_START + 14}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED, STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED_TIP),
MakeWidget({ 10, TOOLBAR_GROUP_START + 31}, {280, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_SHOW_TOOLBAR_BUTTONS_FOR ),
MakeWidget({ 24, TOOLBAR_GROUP_START + 46}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR, STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances
MakeWidget({ 24, TOOLBAR_GROUP_START + 61}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_BUTTON_ON_TOOLBAR, STR_RESEARCH_BUTTON_ON_TOOLBAR_TIP ), // Research
MakeWidget({155, TOOLBAR_GROUP_START + 46}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHEATS_BUTTON_ON_TOOLBAR, STR_CHEATS_BUTTON_ON_TOOLBAR_TIP ), // Cheats
MakeWidget({155, TOOLBAR_GROUP_START + 61}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR, STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR_TIP), // Recent messages
MakeWidget({ 24, TOOLBAR_GROUP_START + 76}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute
MakeWidget({155, TOOLBAR_GROUP_START + 76}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat
MakeWidget({ 24, TOOLBAR_GROUP_START + 91}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom
kWidgetsEnd,
#undef TOOLBAR_GROUP_START
};
@ -1557,6 +1561,12 @@ static Widget *window_options_page_widgets[] = {
Config::Save();
Invalidate();
break;
case WIDX_TOOLBAR_BUTTONS_CENTRED:
Config::Get().interface.ToolbarButtonsCentred ^= 1;
Config::Save();
Invalidate();
WindowInvalidateByClass(WindowClass::TopToolbar);
break;
case WIDX_TOOLBAR_SHOW_FINANCES:
Config::Get().interface.ToolbarShowFinances ^= 1;
Config::Save();
@ -1662,6 +1672,7 @@ static Widget *window_options_page_widgets[] = {
SetCheckboxValue(WIDX_TRAP_CURSOR, Config::Get().general.TrapCursor);
SetCheckboxValue(WIDX_INVERT_DRAG, Config::Get().general.InvertViewportDrag);
SetCheckboxValue(WIDX_ZOOM_TO_CURSOR, Config::Get().general.ZoomToCursor);
SetCheckboxValue(WIDX_TOOLBAR_BUTTONS_CENTRED, Config::Get().interface.ToolbarButtonsCentred);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, Config::Get().interface.ToolbarShowFinances);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, Config::Get().interface.ToolbarShowResearch);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, Config::Get().interface.ToolbarShowCheats);

View File

@ -3216,7 +3216,7 @@ namespace OpenRCT2::Ui::Windows
ApplyMapRotation();
ApplyFootpathPressed();
if (false)
if (!Config::Get().interface.ToolbarButtonsCentred)
AlignButtonsLeftRight();
else
AlignButtonsCentre();

View File

@ -335,6 +335,7 @@ namespace OpenRCT2::Config
if (reader->ReadSection("interface"))
{
auto model = &_config.interface;
model->ToolbarButtonsCentred = reader->GetBoolean("toolbar_buttons_centred", false);
model->ToolbarShowFinances = reader->GetBoolean("toolbar_show_finances", true);
model->ToolbarShowResearch = reader->GetBoolean("toolbar_show_research", true);
model->ToolbarShowCheats = reader->GetBoolean("toolbar_show_cheats", false);
@ -357,6 +358,7 @@ namespace OpenRCT2::Config
{
auto model = &_config.interface;
writer->WriteSection("interface");
writer->WriteBoolean("toolbar_buttons_centred", model->ToolbarButtonsCentred);
writer->WriteBoolean("toolbar_show_finances", model->ToolbarShowFinances);
writer->WriteBoolean("toolbar_show_research", model->ToolbarShowResearch);
writer->WriteBoolean("toolbar_show_cheats", model->ToolbarShowCheats);

View File

@ -119,6 +119,7 @@ namespace OpenRCT2::Config
struct Interface
{
bool ToolbarButtonsCentred;
bool ToolbarShowFinances;
bool ToolbarShowResearch;
bool ToolbarShowCheats;

View File

@ -3856,6 +3856,9 @@ enum : uint16_t
STR_CAN_ONLY_BE_PLACED_ON_PATH_EDGES = 6628,
STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED = 6629,
STR_OPTIONS_TOOLBAR_BUTTONS_CENTRED_TIP = 6630,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
};