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 a32bd1eb46
commit fa5cca22a4
5 changed files with 27 additions and 10 deletions

View File

@ -3699,6 +3699,8 @@ STR_6624 :Tile Inspector: Sort elements
STR_6625 :Invalid colour
STR_6626 :Animation is backwards
STR_6627 :Track speed too high!
STR_6628 :Align toolbar buttons horizontally centred
STR_6629 :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

@ -166,6 +166,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,
@ -334,15 +335,19 @@ 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
// TODO: string ids -- aka "I don't want to do a full recompile on account of StringIds.h"
MakeWidget({ 10, TOOLBAR_GROUP_START + 14}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, 6628, 6629 ),
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
};
@ -1550,6 +1555,12 @@ static Widget *window_options_page_widgets[] = {
ConfigSaveDefault();
Invalidate();
break;
case WIDX_TOOLBAR_BUTTONS_CENTRED:
gConfigInterface.ToolbarButtonsCentred ^= 1;
ConfigSaveDefault();
Invalidate();
WindowInvalidateByClass(WindowClass::TopToolbar);
break;
case WIDX_TOOLBAR_SHOW_FINANCES:
gConfigInterface.ToolbarShowFinances ^= 1;
ConfigSaveDefault();
@ -1655,6 +1666,7 @@ static Widget *window_options_page_widgets[] = {
SetCheckboxValue(WIDX_TRAP_CURSOR, gConfigGeneral.TrapCursor);
SetCheckboxValue(WIDX_INVERT_DRAG, gConfigGeneral.InvertViewportDrag);
SetCheckboxValue(WIDX_ZOOM_TO_CURSOR, gConfigGeneral.ZoomToCursor);
SetCheckboxValue(WIDX_TOOLBAR_BUTTONS_CENTRED, gConfigInterface.ToolbarButtonsCentred);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_FINANCES, gConfigInterface.ToolbarShowFinances);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_RESEARCH, gConfigInterface.ToolbarShowResearch);
SetCheckboxValue(WIDX_TOOLBAR_SHOW_CHEATS, gConfigInterface.ToolbarShowCheats);

View File

@ -3215,7 +3215,7 @@ namespace OpenRCT2::Ui::Windows
ApplyMapRotation();
ApplyFootpathPressed();
if (false)
if (!gConfigInterface.ToolbarButtonsCentred)
AlignButtonsLeftRight();
else
AlignButtonsCentre();

View File

@ -327,6 +327,7 @@ namespace Config
if (reader->ReadSection("interface"))
{
auto model = &gConfigInterface;
model->ToolbarButtonsCentred = reader->GetBoolean("toolbar_buttons_centred", true);
model->ToolbarShowFinances = reader->GetBoolean("toolbar_show_finances", true);
model->ToolbarShowResearch = reader->GetBoolean("toolbar_show_research", true);
model->ToolbarShowCheats = reader->GetBoolean("toolbar_show_cheats", false);
@ -349,6 +350,7 @@ namespace Config
{
auto model = &gConfigInterface;
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

@ -121,6 +121,7 @@ struct GeneralConfiguration
struct InterfaceConfiguration
{
bool ToolbarButtonsCentred;
bool ToolbarShowFinances;
bool ToolbarShowResearch;
bool ToolbarShowCheats;