Add UI setting for whether programmable signals shown in UI (default off)

Add setting subcategory for advanced signal features
This commit is contained in:
Jonathan G Rennison
2017-09-04 19:27:39 +01:00
parent 5199e19213
commit aa138baec9
7 changed files with 56 additions and 5 deletions

View File

@@ -1316,6 +1316,8 @@ STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Show restricted
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Show electric signals with routing restriction programs using the default signal graphics with a blue signal post, instead of using any NewGRF signal graphics. This is to make it easier to visually distinguish restricted signals. STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Show electric signals with routing restriction programs using the default signal graphics with a blue signal post, instead of using any NewGRF signal graphics. This is to make it easier to visually distinguish restricted signals.
STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES :Show advanced routing restriction features: {STRING2} STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES :Show advanced routing restriction features: {STRING2}
STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT :Show advanced routing restriction features. When disabled, some advanced features are not shown in the UI, but are still available to all players. STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT :Show advanced routing restriction features. When disabled, some advanced features are not shown in the UI, but are still available to all players.
STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES :Show programmable signal feature: {STRING2}
STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES_HELPTEXT :Show programmable signal feature. When disabled, the buttons to build and configure programmable signals are not shown in the UI, but are still available to all players.
STR_CONFIG_SETTING_LANDSCAPE :Landscape: {STRING2} STR_CONFIG_SETTING_LANDSCAPE :Landscape: {STRING2}
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though
@@ -1821,6 +1823,7 @@ STR_CONFIG_SETTING_INTERFACE_CONSTRUCTION :{ORANGE}Constru
STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS :{ORANGE}Departure boards STR_CONFIG_SETTING_INTERFACE_DEPARTUREBOARDS :{ORANGE}Departure boards
STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Wall clock STR_CONFIG_SETTING_INTERFACE_WALLCLOCK :{ORANGE}Wall clock
STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Timetables STR_CONFIG_SETTING_INTERFACE_TIMETABLE :{ORANGE}Timetables
STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS :{ORANGE}Signals (advanced)
STR_CONFIG_SETTING_ADVISORS :{ORANGE}News / Advisors STR_CONFIG_SETTING_ADVISORS :{ORANGE}News / Advisors
STR_CONFIG_SETTING_COMPANY :{ORANGE}Company STR_CONFIG_SETTING_COMPANY :{ORANGE}Company
STR_CONFIG_SETTING_ACCOUNTING :{ORANGE}Accounting STR_CONFIG_SETTING_ACCOUNTING :{ORANGE}Accounting

View File

@@ -1604,6 +1604,7 @@ struct BuildSignalWindow : public PickerWindowBase {
private: private:
Dimension sig_sprite_size; ///< Maximum size of signal GUI sprites. Dimension sig_sprite_size; ///< Maximum size of signal GUI sprites.
int sig_sprite_bottom_offset; ///< Maximum extent of signal GUI sprite from reference point towards bottom. int sig_sprite_bottom_offset; ///< Maximum extent of signal GUI sprite from reference point towards bottom.
bool progsig_ui_shown; ///< Whether programmable signal UI is shown
/** /**
* Draw dynamic a signal-sprite in a button in the signal GUI * Draw dynamic a signal-sprite in a button in the signal GUI
@@ -1627,10 +1628,19 @@ private:
y + this->IsWidgetLowered(widget_index)); y + this->IsWidgetLowered(widget_index));
} }
void SetProgsigUiShown() {
this->progsig_ui_shown = _settings_client.gui.show_progsig_ui;
this->GetWidget<NWidgetStacked>(WID_BS_SEMAPHORE_PROG_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : SZSP_NONE);
this->GetWidget<NWidgetStacked>(WID_BS_ELECTRIC_PROG_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : SZSP_NONE);
this->GetWidget<NWidgetStacked>(WID_BS_PROGRAM_SEL)->SetDisplayedPlane(_settings_client.gui.show_progsig_ui ? 0 : 1);
}
public: public:
BuildSignalWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) BuildSignalWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
{ {
this->InitNested(TRANSPORT_RAIL); this->CreateNestedTree();
this->SetProgsigUiShown();
this->FinishInitNested(TRANSPORT_RAIL);
this->OnInvalidateData(); this->OnInvalidateData();
} }
@@ -1799,6 +1809,11 @@ public:
this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1); this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1);
this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20); this->SetWidgetDisabledState(WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20);
if (this->progsig_ui_shown != _settings_client.gui.show_progsig_ui) {
this->SetProgsigUiShown();
this->ReInit();
}
} }
}; };
@@ -1814,7 +1829,9 @@ static const NWidgetPart _nested_signal_builder_widgets[] = {
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_SEMAPHORE_PROG_SEL),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PROG_TOOLTIP), EndContainer(), SetFill(1, 1),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_SEMAPHORE_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_CONVERT), SetDataTip(SPR_IMG_SIGNAL_CONVERT, STR_BUILD_SIGNAL_CONVERT_TOOLTIP), SetFill(1, 1), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_CONVERT), SetDataTip(SPR_IMG_SIGNAL_CONVERT, STR_BUILD_SIGNAL_CONVERT_TOOLTIP), SetFill(1, 1),
@@ -1825,7 +1842,9 @@ static const NWidgetPart _nested_signal_builder_widgets[] = {
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_ENTRY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_EXIT), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_EXIT_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_COMBO), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_ELECTRIC_PROG_SEL),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PROG_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PROG), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PROG_TOOLTIP), EndContainer(), SetFill(1, 1),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1),
@@ -1838,7 +1857,10 @@ static const NWidgetPart _nested_signal_builder_widgets[] = {
EndContainer(), EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0),
EndContainer(), EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BS_PROGRAM_SEL),
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_PROGRAM), SetDataTip(SPR_IMG_SETTINGS, STR_PROGRAM_SIGNAL_TOOLTIP), SetFill(1, 1), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_BS_PROGRAM), SetDataTip(SPR_IMG_SETTINGS, STR_PROGRAM_SIGNAL_TOOLTIP), SetFill(1, 1),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), EndContainer(), SetFill(1, 1),
EndContainer(),
EndContainer(), EndContainer(),
EndContainer(), EndContainer(),
}; };

View File

@@ -1062,6 +1062,13 @@ static bool DragSignalsDensityChanged(int32)
return true; return true;
} }
static bool ProgrammableSignalsShownChanged(int32)
{
InvalidateWindowData(WC_BUILD_SIGNAL, 0);
return true;
}
static bool TownFoundingChanged(int32 p1) static bool TownFoundingChanged(int32 p1)
{ {
if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) { if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) {

View File

@@ -1592,6 +1592,12 @@ static SettingsContainer &GetSettingsTree()
timetable->Add(new SettingEntry("gui.timetable_arrival_departure")); timetable->Add(new SettingEntry("gui.timetable_arrival_departure"));
} }
SettingsPage *advsig = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_ADV_SIGNALS));
{
advsig->Add(new SettingEntry("gui.show_progsig_ui"));
advsig->Add(new SettingEntry("gui.show_adv_tracerestrict_features"));
}
interface->Add(new SettingEntry("gui.autosave")); interface->Add(new SettingEntry("gui.autosave"));
interface->Add(new SettingEntry("gui.toolbar_pos")); interface->Add(new SettingEntry("gui.toolbar_pos"));
interface->Add(new SettingEntry("gui.statusbar_pos")); interface->Add(new SettingEntry("gui.statusbar_pos"));
@@ -1602,7 +1608,6 @@ static SettingsContainer &GetSettingsTree()
interface->Add(new SettingEntry("gui.show_train_weight_ratios_in_details")); interface->Add(new SettingEntry("gui.show_train_weight_ratios_in_details"));
interface->Add(new SettingEntry("gui.show_vehicle_group_in_details")); interface->Add(new SettingEntry("gui.show_vehicle_group_in_details"));
interface->Add(new SettingEntry("gui.show_vehicle_list_company_colour")); interface->Add(new SettingEntry("gui.show_vehicle_list_company_colour"));
interface->Add(new SettingEntry("gui.show_adv_tracerestrict_features"));
} }
SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS)); SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS));

View File

@@ -173,6 +173,7 @@ struct GUISettings {
bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget
bool show_restricted_signal_default; ///< Show restricted electric signals using the default sprite bool show_restricted_signal_default; ///< Show restricted electric signals using the default sprite
bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI
bool show_progsig_ui; ///< Show programmable signals feature in UI
uint8 osk_activation; ///< Mouse gesture to trigger the OSK. uint8 osk_activation; ///< Mouse gesture to trigger the OSK.
bool show_vehicle_route_steps; ///< when a window related to a specific vehicle is focused, show route steps bool show_vehicle_route_steps; ///< when a window related to a specific vehicle is focused, show route steps
bool show_vehicle_list_company_colour; ///< show the company colour of vehicles which have an owner different to the owner of the vehicle list bool show_vehicle_list_company_colour; ///< show the company colour of vehicles which have an owner different to the owner of the vehicle list

View File

@@ -24,6 +24,7 @@ static bool RoadVehAccelerationModelChanged(int32 p1);
static bool TrainSlopeSteepnessChanged(int32 p1); static bool TrainSlopeSteepnessChanged(int32 p1);
static bool RoadVehSlopeSteepnessChanged(int32 p1); static bool RoadVehSlopeSteepnessChanged(int32 p1);
static bool DragSignalsDensityChanged(int32); static bool DragSignalsDensityChanged(int32);
static bool ProgrammableSignalsShownChanged(int32);
static bool TownFoundingChanged(int32 p1); static bool TownFoundingChanged(int32 p1);
static bool DifficultyNoiseChange(int32 i); static bool DifficultyNoiseChange(int32 i);
static bool MaxNoAIsChange(int32 i); static bool MaxNoAIsChange(int32 i);
@@ -4112,6 +4113,15 @@ strhelp = STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT
proc = RedrawScreen proc = RedrawScreen
cat = SC_EXPERT cat = SC_EXPERT
[SDTC_BOOL]
var = gui.show_progsig_ui
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false
str = STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES
strhelp = STR_CONFIG_SETTING_SHOW_PROGSIG_FEATURES_HELPTEXT
proc = ProgrammableSignalsShownChanged
cat = SC_ADVANCED
[SDTC_BOOL] [SDTC_BOOL]
var = gui.enable_single_veh_shared_order_gui var = gui.enable_single_veh_shared_order_gui
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC

View File

@@ -99,6 +99,9 @@ enum BuildSignalWidgets {
WID_BS_DRAG_SIGNALS_DENSITY_LABEL, ///< The current signal density. WID_BS_DRAG_SIGNALS_DENSITY_LABEL, ///< The current signal density.
WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, ///< Decrease the signal density. WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, ///< Decrease the signal density.
WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, ///< Increase the signal density. WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, ///< Increase the signal density.
WID_BS_SEMAPHORE_PROG_SEL, ///< NWID_SELECTION for WID_BS_SEMAPHORE_PROG
WID_BS_ELECTRIC_PROG_SEL, ///< NWID_SELECTION for WID_BS_ELECTRIC_PROG
WID_BS_PROGRAM_SEL, ///< NWID_SELECTION for WID_BS_PROGRAM
}; };
/** Widgets of the #BuildRailDepotWindow class. */ /** Widgets of the #BuildRailDepotWindow class. */