Merge branch 'master' into jgrpp
# Conflicts: # src/widgets/dropdown.cpp # src/widgets/dropdown_type.h
This commit is contained in:
@@ -642,9 +642,14 @@ public:
|
||||
return this->result >= COLOUR_END ? STR_COLOUR_DEFAULT : _colour_dropdown[this->result];
|
||||
}
|
||||
|
||||
uint Width() const override
|
||||
{
|
||||
return ScaleGUITrad(28) + WidgetDimensions::scaled.hsep_normal + GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
|
||||
}
|
||||
|
||||
uint Height(uint width) const override
|
||||
{
|
||||
return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2);
|
||||
return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal);
|
||||
}
|
||||
|
||||
bool Selectable() const override
|
||||
|
@@ -319,7 +319,7 @@ struct GSConfigWindow : public Window {
|
||||
list.emplace_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
||||
}
|
||||
}
|
||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||
|
@@ -3118,7 +3118,7 @@ struct IndustryCargoesWindow : public Window {
|
||||
add_item(STR_INDUSTRY_CARGOES_PRODUCERS, ILM_IN);
|
||||
add_item(STR_INDUSTRY_CARGOES_CUSTOMERS, ILM_OUT);
|
||||
int selected = (this->IsWidgetLowered(WID_IC_NOTIFY)) ? (int)_link_mode : -1;
|
||||
ShowDropDownList(this, std::move(list), selected, WID_IC_NOTIFY, 0, true);
|
||||
ShowDropDownList(this, std::move(list), selected, WID_IC_NOTIFY);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3129,7 +3129,7 @@ struct IndustryCargoesWindow : public Window {
|
||||
}
|
||||
if (!lst.empty()) {
|
||||
int selected = (this->ind_cargo >= NUM_INDUSTRYTYPES) ? (int)(this->ind_cargo - NUM_INDUSTRYTYPES) : -1;
|
||||
ShowDropDownList(this, std::move(lst), selected, WID_IC_CARGO_DROPDOWN, 0, true);
|
||||
ShowDropDownList(this, std::move(lst), selected, WID_IC_CARGO_DROPDOWN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3143,7 +3143,7 @@ struct IndustryCargoesWindow : public Window {
|
||||
}
|
||||
if (!lst.empty()) {
|
||||
int selected = (this->ind_cargo < NUM_INDUSTRYTYPES) ? (int)this->ind_cargo : -1;
|
||||
ShowDropDownList(this, std::move(lst), selected, WID_IC_IND_DROPDOWN, 0, true);
|
||||
ShowDropDownList(this, std::move(lst), selected, WID_IC_IND_DROPDOWN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -195,6 +195,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA} miles/t
|
||||
STR_UNITS_VELOCITY_METRIC :{COMMA} km/t
|
||||
STR_UNITS_VELOCITY_SI :{COMMA} m/s
|
||||
STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}felter/dag
|
||||
STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}knob
|
||||
|
||||
STR_UNITS_POWER_IMPERIAL :{COMMA}hk
|
||||
STR_UNITS_POWER_METRIC :{COMMA}hk
|
||||
@@ -343,9 +344,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Åbn ord
|
||||
###length 31
|
||||
STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Sæt spillet på pause
|
||||
STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Kør spillet hurtigere
|
||||
STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Valg
|
||||
STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Valgmuligheder og indstillinger
|
||||
STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Gem spillet, forlad spillet, afslut
|
||||
STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Vis kortet
|
||||
STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Vis kort, ekstra viewport eller liste over skilte
|
||||
STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Vis byoversigten
|
||||
STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Vis tilskudsordninger
|
||||
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Vis liste over selskabets stationer
|
||||
@@ -369,8 +370,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Byg havn
|
||||
STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Byg lufthavne
|
||||
STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Åbn landskabsværktøjslinjen for at hæve/sænke terræn, plante træer, osv.
|
||||
STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Vis lyd-/musikvindue
|
||||
STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Vis seneste besked/nyhedsrapport, vis beskedvalg
|
||||
STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Information om landområde, konsol, debug af script, skærmbillede, om OpenTTD
|
||||
STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Vis sidste besked/nyhedsrapport, beskedhistorik eller slet alle beskeder
|
||||
STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Landområde information, konsol, script debug, skærmbilleder, om OpenTTD
|
||||
STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Skift værktøjslinier
|
||||
|
||||
# Extra tooltips for the scenario editor toolbar
|
||||
@@ -863,7 +864,7 @@ STR_NEWS_BEGIN_OF_RECESSION :{BIG_FONT}{BLAC
|
||||
STR_NEWS_END_OF_RECESSION :{BIG_FONT}{BLACK}Økonomisk krise overvundet!{}{}Stigning i forbrug giver industrien selvtilliden tilbage, produktionen øges!
|
||||
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL :{BIG_FONT}{BLACK}{INDUSTRY} øger produktionen!
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_COAL :{BIG_FONT}{BLACK}Ny kulåre fundet tæt på {INDUSTRY}!{}Produktionen forventes fordoblet!
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_COAL :{BIG_FONT}{BLACK}Ny kulmine fundet tæt på {INDUSTRY}!{}Produktionen forventes fordoblet!
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_OIL :{BIG_FONT}{BLACK}Nye oliereserver fundet tæt ved {INDUSTRY}!{}Produktionen forventes fordoblet!
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM :{BIG_FONT}{BLACK}Forbedrede landbrugsmetoder ved {INDUSTRY} gør at produktionen forventes fordoblet!
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_SMOOTH :{BIG_FONT}{BLACK}{STRING}produktionen på {INDUSTRY} vokser med {COMMA}%!
|
||||
@@ -872,7 +873,7 @@ STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM :{BIG_FONT}{BLAC
|
||||
STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_SMOOTH :{BIG_FONT}{BLACK}{STRING}produktionen på {INDUSTRY} sænkes med {COMMA}%!
|
||||
|
||||
###length VEHICLE_TYPES
|
||||
STR_NEWS_TRAIN_IS_WAITING :{WHITE}{VEHICLE} afventer i remisen
|
||||
STR_NEWS_TRAIN_IS_WAITING :{WHITE}{VEHICLE} afventer i depotet
|
||||
STR_NEWS_ROAD_VEHICLE_IS_WAITING :{WHITE}{VEHICLE} venter på værkstedet
|
||||
STR_NEWS_SHIP_IS_WAITING :{WHITE}{VEHICLE} venter i skibsdokken
|
||||
STR_NEWS_AIRCRAFT_IS_WAITING :{WHITE}{VEHICLE} venter i hangaren
|
||||
@@ -883,7 +884,7 @@ STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS :{WHITE}{VEHICLE
|
||||
STR_NEWS_VEHICLE_HAS_VOID_ORDER :{WHITE}{VEHICLE} har en ugyldig ordre
|
||||
STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY :{WHITE}{VEHICLE} har dublerede ordrer
|
||||
STR_NEWS_VEHICLE_HAS_INVALID_ENTRY :{WHITE}{VEHICLE} har en ugyldig station i sine ordrer
|
||||
STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY :{WHITE}{VEHICLE} har i sine ordrer en lufthavn, hvis bane er for kort
|
||||
STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY :{WHITE}{VEHICLE} har en lufthavn i sine ordrer, hvis bane er for kort
|
||||
|
||||
STR_NEWS_VEHICLE_IS_GETTING_OLD :{WHITE}{VEHICLE} er gammel
|
||||
STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD :{WHITE}{VEHICLE} er meget gammel
|
||||
@@ -1808,7 +1809,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Hvis aktiveret,
|
||||
|
||||
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Mindste selskabsalder for aktiehandel: {STRING}
|
||||
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Indstil mindste alder på selskaber, før andre kan købe og sælge aktier i dem.
|
||||
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} år{P "" s}
|
||||
###setting-zero-is-special
|
||||
STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Intet minimum
|
||||
|
||||
STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Procentdel af deloverskud som skal betales i hovedsystemer: {STRING}
|
||||
STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Procentdel af indkomst givet til de mellemliggende dele i hovedsystemer, giver mere kontrol over indkomst
|
||||
@@ -1953,12 +1956,14 @@ STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Mætning af kor
|
||||
STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Der er ofte flere veje mellem to givne stationer. Cargodist vil mætte den korteste vej først, så bruge den næstkorteste vej indtil den er mættet, osv.. Mætning bestemmes af en vurdering af kapacitet og planlagt brug. Når den har mættet alle veje, og hvis der stadig er efterspørgsel tilbage, vil den overbelaste alle veje, og foretrække vejene med høj kapacitet. Det meste af tiden vil algoritmen dog ikke vurdere kapaciteten nøjagtigt. Denne indstilling giver dig mulighed for at bestemme op til hvilken procentdel en kortere vej skal være mættet i første omgang før den næste, længere vej vælges. Sæt denne indstilling til mindre end 100% for at undgå overfyldte stationer i tilfælde af overvurderet kapacitet.
|
||||
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Hastighedsenheder: {STRING}
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Hastighedsenheder (nautisk): {STRING}
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Når en hastighed er vist i brugergrænsefladen, så vis dem i de valgte enheder
|
||||
###length 5
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperisk (mph)
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metrisk (km/t)
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s)
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Spil-enheder (felter/dag)
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Knob
|
||||
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Køretøjskraftenheder: {STRING}
|
||||
STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Når et køretøjs kraft er vist i brugergrænsefladen, så vis dem i de valgte enheder
|
||||
@@ -2526,7 +2531,7 @@ STR_CONTENT_OPEN_URL_TOOLTIP :{BLACK}Besøg h
|
||||
STR_CONTENT_DOWNLOAD_CAPTION :{BLACK}Download
|
||||
STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK}Download det valgte indhold
|
||||
STR_CONTENT_TOTAL_DOWNLOAD_SIZE :{SILVER}Total størrelse af download: {WHITE}{BYTES}
|
||||
STR_CONTENT_DETAIL_TITLE :{SILVER}INDHOLDSINFO
|
||||
STR_CONTENT_DETAIL_TITLE :{SILVER}INDHOLDS INFORMATION
|
||||
|
||||
###length 5
|
||||
STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED :{SILVER}Du har ikke valgt denne til download
|
||||
@@ -3199,7 +3204,7 @@ STR_MAPGEN_BORDER_FREEFORM :{BLACK}Fri udfo
|
||||
STR_MAPGEN_BORDER_WATER :{BLACK}Vand
|
||||
STR_MAPGEN_BORDER_RANDOM :{BLACK}Tilfældige
|
||||
STR_MAPGEN_BORDER_RANDOMIZE :{BLACK}Tilfældige
|
||||
STR_MAPGEN_BORDER_MANUAL :{BLACK}Manuelle
|
||||
STR_MAPGEN_BORDER_MANUAL :{BLACK}Manuel
|
||||
|
||||
STR_MAPGEN_HEIGHTMAP_ROTATION :{BLACK}Højdekortets rotation:
|
||||
STR_MAPGEN_HEIGHTMAP_NAME :{BLACK}Højdekortets navn:
|
||||
@@ -3986,8 +3991,8 @@ STR_QUERY_RENAME_AIRCRAFT_TYPE_CAPTION :{WHITE}Ømdøb
|
||||
# Depot window
|
||||
STR_DEPOT_CAPTION :{WHITE}{DEPOT}
|
||||
|
||||
STR_DEPOT_RENAME_TOOLTIP :{BLACK}Ændere depotets navn
|
||||
STR_DEPOT_RENAME_DEPOT_CAPTION :Omdøb depot
|
||||
STR_DEPOT_RENAME_TOOLTIP :{BLACK}Skift navn på depot
|
||||
STR_DEPOT_RENAME_DEPOT_CAPTION :Omdøb værksted
|
||||
|
||||
STR_DEPOT_NO_ENGINE :{BLACK}-
|
||||
STR_DEPOT_VEHICLE_TOOLTIP :{BLACK}{ENGINE}{STRING}
|
||||
@@ -4585,6 +4590,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}AI`er de
|
||||
STR_AI_CONFIG_HUMAN_PLAYER :Menneskelig spiller
|
||||
STR_AI_CONFIG_RANDOM_AI :Tilfældig computerspiller
|
||||
STR_AI_CONFIG_NONE :(ingen)
|
||||
STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM}
|
||||
STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maksimalt antal modstandere: {ORANGE}{COMMA}
|
||||
|
||||
STR_AI_CONFIG_MOVE_UP :{BLACK}Flyt op
|
||||
@@ -4598,7 +4604,7 @@ STR_AI_CONFIG_AI :{SILVER}AI'er
|
||||
|
||||
STR_AI_CONFIG_CHANGE_AI :{BLACK}Vælg AI
|
||||
STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Vælg Spilscript
|
||||
STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Indlæs et andet script
|
||||
STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Indlæs et andet script. Ctrl+klik for at vise alle tilgængelige versioner
|
||||
STR_AI_CONFIG_CONFIGURE :{BLACK}Konfigurer computerspiller
|
||||
STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Konfigurer parametre for script'et
|
||||
|
||||
|
@@ -583,7 +583,7 @@ struct MusicTrackSelectionWindow : public Window {
|
||||
|
||||
case WID_MTS_MUSICSET: {
|
||||
int selected = 0;
|
||||
ShowDropDownList(this, BuildMusicSetDropDownList(&selected), selected, widget, 0, true, false);
|
||||
ShowDropDownList(this, BuildMusicSetDropDownList(&selected), selected, widget);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -1585,7 +1585,7 @@ private:
|
||||
wi_rect.bottom = pt.y;
|
||||
|
||||
w->dd_client_id = client_id;
|
||||
ShowDropDownListAt(w, std::move(list), -1, WID_CL_MATRIX, wi_rect, COLOUR_GREY, true, true);
|
||||
ShowDropDownListAt(w, std::move(list), -1, WID_CL_MATRIX, wi_rect, COLOUR_GREY, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1607,7 +1607,7 @@ private:
|
||||
wi_rect.bottom = pt.y;
|
||||
|
||||
w->dd_company_id = company_id;
|
||||
ShowDropDownListAt(w, std::move(list), -1, WID_CL_MATRIX, wi_rect, COLOUR_GREY, true, true);
|
||||
ShowDropDownListAt(w, std::move(list), -1, WID_CL_MATRIX, wi_rect, COLOUR_GREY, true);
|
||||
}
|
||||
/**
|
||||
* Chat button on a Client is clicked.
|
||||
|
@@ -382,7 +382,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
list.emplace_back(new DropDownListCharStringItem(GetGRFStringFromGRFText(par_info->value_names.Find(i)->second), i, false));
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
||||
}
|
||||
}
|
||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||
|
@@ -2676,7 +2676,7 @@ public:
|
||||
add_colour(COLOUR_ORANGE);
|
||||
add_colour(COLOUR_PINK);
|
||||
}
|
||||
ShowDropDownList(this, std::move(list), 0x100 + order->GetColour(), widget, 0, true, false, DDSF_LOST_FOCUS);
|
||||
ShowDropDownList(this, std::move(list), 0x100 + order->GetColour(), widget, 0, true, DDSF_LOST_FOCUS);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2779,7 +2779,7 @@ public:
|
||||
const Order *order = this->vehicle->GetOrder(this->OrderGetSel());
|
||||
TraceRestrictSlotID value = order->GetXData();
|
||||
DropDownList list = GetSlotDropDownList(this->vehicle->owner, value, selected, this->vehicle->type, order->GetConditionVariable() == OCV_SLOT_OCCUPANCY);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_SLOT, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_SLOT, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2787,19 +2787,19 @@ public:
|
||||
int selected;
|
||||
TraceRestrictCounterID value = GB(this->vehicle->GetOrder(this->OrderGetSel())->GetXData(), 16, 16);
|
||||
DropDownList list = GetCounterDropDownList(this->vehicle->owner, value, selected);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_COUNTER, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_COUNTER, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_O_COND_TIME_DATE: {
|
||||
ShowDropDownMenu(this, _order_time_date_dropdown, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionValue(),
|
||||
WID_O_COND_TIME_DATE, _settings_game.game_time.time_in_minutes ? 0 : 7, 0, UINT_MAX);
|
||||
WID_O_COND_TIME_DATE, _settings_game.game_time.time_in_minutes ? 0 : 7, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_O_COND_TIMETABLE: {
|
||||
ShowDropDownMenu(this, _order_timetable_dropdown, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionValue(),
|
||||
WID_O_COND_TIMETABLE, 0, 0, UINT_MAX);
|
||||
WID_O_COND_TIMETABLE, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2814,13 +2814,13 @@ public:
|
||||
item->SetParam(0, i + 1);
|
||||
list.emplace_back(item);
|
||||
}
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_SCHED_SELECT, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_COND_SCHED_SELECT, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_O_COND_SCHED_TEST: {
|
||||
ShowDropDownMenu(this, _order_dispatch_slot_dropdown, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionValue() / 2,
|
||||
WID_O_COND_SCHED_TEST, 0, 0, UINT_MAX);
|
||||
WID_O_COND_SCHED_TEST, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2892,7 +2892,7 @@ public:
|
||||
list.emplace_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_COMPARATOR_DISPATCH_SLOT_IS_LAST, 0x102, false));
|
||||
list.emplace_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_COMPARATOR_DISPATCH_SLOT_IS_NOT_LAST, 0x103, false));
|
||||
int selected = 0x100 + ((o->GetConditionValue() % 2) * 2) + ((o->GetConditionComparator() == OCC_IS_FALSE) ? 1 : 0);
|
||||
ShowDropDownList(this, std::move(list), selected, WID_O_COND_COMPARATOR, 0, true);
|
||||
ShowDropDownList(this, std::move(list), selected, WID_O_COND_COMPARATOR, 0);
|
||||
break;
|
||||
}
|
||||
uint mask;
|
||||
@@ -2971,7 +2971,7 @@ public:
|
||||
int selected;
|
||||
TraceRestrictSlotID value = this->vehicle->GetOrder(this->OrderGetSel())->GetDestination();
|
||||
DropDownList list = GetSlotDropDownList(this->vehicle->owner, value, selected, this->vehicle->type, false);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_RELEASE_SLOT, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_RELEASE_SLOT, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2981,7 +2981,7 @@ public:
|
||||
list.emplace_back(new DropDownListStringItem(STR_TRACE_RESTRICT_COUNTER_DECREASE, 1, false));
|
||||
list.emplace_back(new DropDownListStringItem(STR_TRACE_RESTRICT_COUNTER_SET, 2, false));
|
||||
int selected = this->vehicle->GetOrder(this->OrderGetSel())->GetCounterOperation();
|
||||
ShowDropDownList(this, std::move(list), selected, WID_O_COUNTER_OP, 0, true);
|
||||
ShowDropDownList(this, std::move(list), selected, WID_O_COUNTER_OP, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2989,7 +2989,7 @@ public:
|
||||
int selected;
|
||||
TraceRestrictCounterID value = this->vehicle->GetOrder(this->OrderGetSel())->GetDestination();
|
||||
DropDownList list = GetCounterDropDownList(this->vehicle->owner, value, selected);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_CHANGE_COUNTER, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, WID_O_CHANGE_COUNTER, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -368,7 +368,7 @@ public:
|
||||
|
||||
int selected;
|
||||
DropDownList list = GetSlotDropDownList(this->GetOwner(), sc->slot_id, selected, VEH_TRAIN, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, PROGRAM_WIDGET_COND_SLOT, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, PROGRAM_WIDGET_COND_SLOT);
|
||||
} break;
|
||||
|
||||
case PROGRAM_WIDGET_COND_COUNTER: {
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
|
||||
int selected;
|
||||
DropDownList list = GetCounterDropDownList(this->GetOwner(), sc->ctr_id, selected);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, PROGRAM_WIDGET_COND_COUNTER, 0, true);
|
||||
if (!list.empty()) ShowDropDownList(this, std::move(list), selected, PROGRAM_WIDGET_COND_COUNTER);
|
||||
} break;
|
||||
|
||||
case PROGRAM_WIDGET_COND_SET_SIGNAL: {
|
||||
|
@@ -486,7 +486,7 @@ struct ScriptSettingsWindow : public Window {
|
||||
list.emplace_back(new DropDownListCharStringItem(config_item.labels->Find(i)->second, i, false));
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE, true);
|
||||
ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE);
|
||||
}
|
||||
}
|
||||
} else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) {
|
||||
|
@@ -2745,7 +2745,7 @@ struct GameSettingsWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
ShowDropDownListAt(this, std::move(list), value, -1, wi_rect, COLOUR_ORANGE, true);
|
||||
ShowDropDownListAt(this, std::move(list), value, -1, wi_rect, COLOUR_ORANGE);
|
||||
}
|
||||
}
|
||||
this->SetDirty();
|
||||
|
@@ -1059,7 +1059,7 @@ struct TimetableWindow : GeneralVehicleWindow {
|
||||
list.emplace_back(new DropDownListStringItem(STR_TIMETABLE_LEAVE_EARLY, OLT_LEAVE_EARLY, leave_type_disabled));
|
||||
list.emplace_back(new DropDownListStringItem(STR_TIMETABLE_LEAVE_EARLY_FULL_ANY, OLT_LEAVE_EARLY_FULL_ANY, leave_type_disabled || !order->IsType(OT_GOTO_STATION)));
|
||||
list.emplace_back(new DropDownListStringItem(STR_TIMETABLE_LEAVE_EARLY_FULL_ALL, OLT_LEAVE_EARLY_FULL_ALL, leave_type_disabled || !order->IsType(OT_GOTO_STATION)));
|
||||
ShowDropDownList(this, std::move(list), order != nullptr ? order->GetLeaveType() : -1, WID_VT_EXTRA, 0, true);
|
||||
ShowDropDownList(this, std::move(list), order != nullptr ? order->GetLeaveType() : -1, WID_VT_EXTRA);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -196,7 +196,7 @@ DropDownListItem *MakeCompanyDropDownListItem(CompanyID cid)
|
||||
*/
|
||||
static void PopupMainToolbMenu(Window *w, int widget, DropDownList &&list, int def)
|
||||
{
|
||||
ShowDropDownList(w, std::move(list), def, widget, 0, true, true);
|
||||
ShowDropDownList(w, std::move(list), def, widget, 0, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ static CallBackFunction ToolbarOptionsClick(Window *w)
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS)));
|
||||
list.emplace_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_MONEY_TEXT_EFFECTS, OME_SHOW_MONEYTEXT, false, HasBit(_extra_display_opt, XDO_SHOW_MONEY_TEXT_EFFECTS)));
|
||||
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_SETTINGS, 140, true, true);
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_SETTINGS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -735,7 +735,7 @@ static CallBackFunction ToolbarGraphsClick(Window *w)
|
||||
|
||||
if (_toolbar_mode != TB_NORMAL) AddDropDownLeagueTableOptions(list);
|
||||
|
||||
ShowDropDownList(w, std::move(list), GRMN_OPERATING_PROFIT_GRAPH, WID_TN_GRAPHS, 140, true, true);
|
||||
ShowDropDownList(w, std::move(list), GRMN_OPERATING_PROFIT_GRAPH, WID_TN_GRAPHS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
|
||||
return CBF_NONE;
|
||||
@@ -748,7 +748,7 @@ static CallBackFunction ToolbarLeagueClick(Window *w)
|
||||
AddDropDownLeagueTableOptions(list);
|
||||
|
||||
int selected = list[0]->result;
|
||||
ShowDropDownList(w, std::move(list), selected, WID_TN_LEAGUE, 140, true, true);
|
||||
ShowDropDownList(w, std::move(list), selected, WID_TN_LEAGUE, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
|
||||
return CBF_NONE;
|
||||
@@ -925,7 +925,7 @@ static CallBackFunction ToolbarZoomOutClick(Window *w)
|
||||
|
||||
static CallBackFunction ToolbarBuildRailClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRailTypeDropDownList(), _last_built_railtype, WID_TN_RAILS, 140, true, true);
|
||||
ShowDropDownList(w, GetRailTypeDropDownList(), _last_built_railtype, WID_TN_RAILS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -947,7 +947,7 @@ static CallBackFunction MenuClickBuildRail(int index)
|
||||
|
||||
static CallBackFunction ToolbarBuildRoadClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TN_ROADS, 140, true, true);
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TN_ROADS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -969,7 +969,7 @@ static CallBackFunction MenuClickBuildRoad(int index)
|
||||
|
||||
static CallBackFunction ToolbarBuildTramClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TN_TRAMS, 140, true, true);
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TN_TRAMS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -993,7 +993,7 @@ static CallBackFunction ToolbarBuildWaterClick(Window *w)
|
||||
{
|
||||
DropDownList list;
|
||||
list.emplace_back(new DropDownListIconItem(SPR_IMG_BUILD_CANAL, PAL_NONE, STR_WATERWAYS_MENU_WATERWAYS_CONSTRUCTION, 0, false));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_WATER, 140, true, true);
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_WATER, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ static CallBackFunction ToolbarBuildAirClick(Window *w)
|
||||
{
|
||||
DropDownList list;
|
||||
list.emplace_back(new DropDownListIconItem(SPR_IMG_AIRPORT, PAL_NONE, STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION, 0, false));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_AIR, 140, true, true);
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_AIR, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -1041,7 +1041,7 @@ static CallBackFunction ToolbarForestClick(Window *w)
|
||||
list.emplace_back(new DropDownListIconItem(SPR_IMG_LANDSCAPING, PAL_NONE, STR_LANDSCAPING_MENU_LANDSCAPING, 0, false));
|
||||
list.emplace_back(new DropDownListIconItem(SPR_IMG_PLANTTREES, PAL_NONE, STR_LANDSCAPING_MENU_PLANT_TREES, 1, false));
|
||||
list.emplace_back(new DropDownListIconItem(SPR_IMG_SIGN, PAL_NONE, STR_LANDSCAPING_MENU_PLACE_SIGN, 2, false));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_LANDSCAPE, 100, true, true);
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_LANDSCAPE, 100, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@ static CallBackFunction ToolbarScenGenIndustry(Window *w)
|
||||
|
||||
static CallBackFunction ToolbarScenBuildRoadClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TE_ROADS, 140, true, true);
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TE_ROADS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
@@ -1298,7 +1298,7 @@ static CallBackFunction ToolbarScenBuildRoad(int index)
|
||||
|
||||
static CallBackFunction ToolbarScenBuildTramClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TE_TRAMS, 140, true, true);
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TE_TRAMS, 140, true);
|
||||
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
@@ -1529,6 +1529,20 @@ static inline bool RoadTypesAllowHouseHere(TileIndex t)
|
||||
return !allow;
|
||||
}
|
||||
|
||||
/** Test if town can grow road onto a specific tile.
|
||||
* @param town Town that is building.
|
||||
* @param tile Tile to build upon.
|
||||
* @return true iff the tile's road type don't prevent extending the road.
|
||||
*/
|
||||
static bool TownCanGrowRoad(const Town *town, TileIndex tile)
|
||||
{
|
||||
if (!IsTileType(tile, MP_ROAD)) return true;
|
||||
|
||||
/* Allow extending on roadtypes which can be built by town, or if the road type matches the type the town will build. */
|
||||
RoadType rt = GetRoadTypeRoad(tile);
|
||||
return HasBit(GetRoadTypeInfo(rt)->flags, ROTF_TOWN_BUILD) || GetTownRoadType() == rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grows the given town.
|
||||
* There are at the moment 3 possible way's for
|
||||
@@ -1636,6 +1650,8 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
|
||||
}
|
||||
|
||||
} else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) {
|
||||
if (!TownCanGrowRoad(t1, tile)) return;
|
||||
|
||||
/* Continue building on a partial road.
|
||||
* Should be always OK, so we only generate
|
||||
* the fitting RoadBits */
|
||||
@@ -1777,6 +1793,8 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TownCanGrowRoad(t1, tile)) return;
|
||||
|
||||
_grow_town_result = GROWTH_SEARCH_STOPPED;
|
||||
}
|
||||
|
||||
|
@@ -1882,7 +1882,7 @@ public:
|
||||
hidden |= _program_signal_mode_hide_mask;
|
||||
}
|
||||
|
||||
this->ShowDropDownListWithValue(&_program_insert, 0, true, TR_WIDGET_INSERT, disabled, hidden, 0);
|
||||
this->ShowDropDownListWithValue(&_program_insert, 0, true, TR_WIDGET_INSERT, disabled, hidden);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1937,7 +1937,7 @@ public:
|
||||
if (!ElseInsertionDryRun(true)) disabled |= _condflags_dropdown_else_hide_mask;
|
||||
if (!ElseIfInsertionDryRun(true)) disabled |= _condflags_dropdown_else_if_hide_mask;
|
||||
|
||||
this->ShowDropDownListWithValue(&_condflags_dropdown, type, false, TR_WIDGET_CONDFLAGS, disabled, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_condflags_dropdown, type, false, TR_WIDGET_CONDFLAGS, disabled, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1953,7 +1953,7 @@ public:
|
||||
dlist.emplace_back(new DropDownListStringItem(item.str, item.type, false));
|
||||
}
|
||||
}
|
||||
ShowDropDownList(this, std::move(dlist), type, widget, 0, true);
|
||||
ShowDropDownList(this, std::move(dlist), type, widget, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1962,20 +1962,20 @@ public:
|
||||
TraceRestrictItem item = this->GetSelected();
|
||||
const TraceRestrictDropDownListSet *list_set = GetCondOpDropDownListSet(GetTraceRestrictTypeProperties(item));
|
||||
if (list_set) {
|
||||
this->ShowDropDownListWithValue(list_set, GetTraceRestrictCondOp(item), false, TR_WIDGET_COMPARATOR, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(list_set, GetTraceRestrictCondOp(item), false, TR_WIDGET_COMPARATOR, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TR_WIDGET_SLOT_OP: {
|
||||
TraceRestrictItem item = this->GetSelected();
|
||||
this->ShowDropDownListWithValue(&_slot_op_cond_ops, GetTraceRestrictCondOp(item), false, TR_WIDGET_SLOT_OP, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_slot_op_cond_ops, GetTraceRestrictCondOp(item), false, TR_WIDGET_SLOT_OP, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case TR_WIDGET_COUNTER_OP: {
|
||||
TraceRestrictItem item = this->GetSelected();
|
||||
this->ShowDropDownListWithValue(&_counter_op_cond_ops, GetTraceRestrictCondOp(item), false, TR_WIDGET_COUNTER_OP, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_counter_op_cond_ops, GetTraceRestrictCondOp(item), false, TR_WIDGET_COUNTER_OP, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2012,37 +2012,37 @@ public:
|
||||
TraceRestrictItem item = this->GetSelected();
|
||||
switch (GetTraceRestrictTypeProperties(item).value_type) {
|
||||
case TRVT_DENY:
|
||||
this->ShowDropDownListWithValue(&_deny_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_deny_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_CARGO_ID:
|
||||
this->ShowDropDownListWithValue(GetSortedCargoTypeDropDownListSet(), GetTraceRestrictValue(item), true, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0); // current cargo is permitted to not be in list
|
||||
this->ShowDropDownListWithValue(GetSortedCargoTypeDropDownListSet(), GetTraceRestrictValue(item), true, TR_WIDGET_VALUE_DROPDOWN, 0, 0); // current cargo is permitted to not be in list
|
||||
break;
|
||||
|
||||
case TRVT_DIRECTION:
|
||||
this->ShowDropDownListWithValue(&_direction_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_direction_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_PF_PENALTY:
|
||||
this->ShowDropDownListWithValue(&_pf_penalty_dropdown, GetPathfinderPenaltyDropdownIndex(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_pf_penalty_dropdown, GetPathfinderPenaltyDropdownIndex(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_RESERVE_THROUGH:
|
||||
this->ShowDropDownListWithValue(&_reserve_through_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_reserve_through_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_LONG_RESERVE:
|
||||
this->ShowDropDownListWithValue(&_long_reserve_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_long_reserve_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_WAIT_AT_PBS:
|
||||
this->ShowDropDownListWithValue(&_wait_at_pbs_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_wait_at_pbs_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_GROUP_INDEX: {
|
||||
int selected;
|
||||
DropDownList dlist = GetGroupDropDownList(this->GetOwner(), GetTraceRestrictValue(item), selected);
|
||||
ShowDropDownList(this, std::move(dlist), selected, TR_WIDGET_VALUE_DROPDOWN, 0, true);
|
||||
ShowDropDownList(this, std::move(dlist), selected, TR_WIDGET_VALUE_DROPDOWN, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2058,35 +2058,35 @@ public:
|
||||
}
|
||||
|
||||
case TRVT_TRAIN_STATUS:
|
||||
this->ShowDropDownListWithValue(&_train_status_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_train_status_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_REVERSE:
|
||||
this->ShowDropDownListWithValue(&_reverse_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_reverse_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_NEWS_CONTROL:
|
||||
this->ShowDropDownListWithValue(&_news_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_news_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_ENGINE_CLASS:
|
||||
this->ShowDropDownListWithValue(&_engine_class_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_engine_class_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_PF_PENALTY_CONTROL:
|
||||
this->ShowDropDownListWithValue(&_pf_penalty_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_pf_penalty_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);;
|
||||
break;
|
||||
|
||||
case TRVT_SPEED_ADAPTATION_CONTROL:
|
||||
this->ShowDropDownListWithValue(&_speed_adaptation_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_speed_adaptation_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_SIGNAL_MODE_CONTROL:
|
||||
this->ShowDropDownListWithValue(&_signal_mode_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_signal_mode_control_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
case TRVT_ORDER_TARGET_DIAGDIR:
|
||||
this->ShowDropDownListWithValue(&_diagdir_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_diagdir_value, GetTraceRestrictValue(item), false, TR_WIDGET_VALUE_DROPDOWN, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2113,12 +2113,12 @@ public:
|
||||
}
|
||||
|
||||
case TRVT_TIME_DATE_INT: {
|
||||
this->ShowDropDownListWithValue(&_time_date_value, GetTraceRestrictValue(item), false, TR_WIDGET_LEFT_AUX_DROPDOWN, _settings_game.game_time.time_in_minutes ? 0 : 7, 0, UINT_MAX);
|
||||
this->ShowDropDownListWithValue(&_time_date_value, GetTraceRestrictValue(item), false, TR_WIDGET_LEFT_AUX_DROPDOWN, _settings_game.game_time.time_in_minutes ? 0 : 7, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case TRVT_ORDER_TARGET_DIAGDIR: {
|
||||
this->ShowDropDownListWithValue(&_target_direction_aux_value, GetTraceRestrictAuxField(item), false, TR_WIDGET_LEFT_AUX_DROPDOWN, 0, 0, 0);
|
||||
this->ShowDropDownListWithValue(&_target_direction_aux_value, GetTraceRestrictAuxField(item), false, TR_WIDGET_LEFT_AUX_DROPDOWN, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3276,12 +3276,12 @@ private:
|
||||
* This asserts if @p value is not in @p list_set, and @p missing_ok is false
|
||||
*/
|
||||
void ShowDropDownListWithValue(const TraceRestrictDropDownListSet *list_set, uint value, bool missing_ok,
|
||||
int button, uint32 disabled_mask, uint32 hidden_mask, uint width)
|
||||
int button, uint32 disabled_mask, uint32 hidden_mask)
|
||||
{
|
||||
this->drop_down_list_mapping[button] = list_set;
|
||||
int selected = GetDropDownListIndexByValue(list_set, value, missing_ok);
|
||||
if (button == TR_WIDGET_VALUE_DROPDOWN) this->value_drop_down_is_company = false;
|
||||
ShowDropDownMenu(this, list_set->string_array, selected, button, disabled_mask, hidden_mask, width);
|
||||
ShowDropDownMenu(this, list_set->string_array, selected, button, disabled_mask, hidden_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3303,7 +3303,7 @@ private:
|
||||
assert(button == TR_WIDGET_VALUE_DROPDOWN);
|
||||
this->value_drop_down_is_company = true;
|
||||
|
||||
ShowDropDownList(this, std::move(list), value, button, 0, true, false);
|
||||
ShowDropDownList(this, std::move(list), value, button, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1375,7 +1375,7 @@ struct RefitWindow : public Window {
|
||||
offset++;
|
||||
}
|
||||
|
||||
ShowDropDownList(this, std::move(dlist), selected, WID_VR_VEHICLE_DROPDOWN, 0, true);
|
||||
ShowDropDownList(this, std::move(dlist), selected, WID_VR_VEHICLE_DROPDOWN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3992,7 +3992,7 @@ public:
|
||||
list.emplace_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_name[v->type], DEPOT_DONT_CANCEL, flags == ODATFB_HALT));
|
||||
list.emplace_back(new DropDownListStringItem(BaseVehicleListWindow::vehicle_depot_sell_name[v->type], DEPOT_SELL | DEPOT_DONT_CANCEL, flags == (ODATFB_HALT | ODATFB_SELL)));
|
||||
list.emplace_back(new DropDownListStringItem(STR_VEHICLE_LIST_CANCEL_DEPOT_SERVICE, DEPOT_CANCEL, false));
|
||||
ShowDropDownList(this, std::move(list), -1, widget, 0, true);
|
||||
ShowDropDownList(this, std::move(list), -1, widget);
|
||||
} else {
|
||||
this->HandleButtonClick(WID_VV_GOTO_DEPOT);
|
||||
DoCommandP(v->tile, v->index | (_ctrl_pressed ? DEPOT_SERVICE : 0U), 0, GetCmdSendToDepot(v));
|
||||
|
@@ -140,6 +140,11 @@ public:
|
||||
this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y;
|
||||
}
|
||||
|
||||
bool OnRightClick(Point pt, int widget) override
|
||||
{
|
||||
return widget == WID_EV_VIEWPORT;
|
||||
}
|
||||
|
||||
void OnMouseWheel(int wheel) override
|
||||
{
|
||||
if (_ctrl_pressed) {
|
||||
|
@@ -33,9 +33,7 @@ void DropDownListItem::Draw(const Rect &r, bool sel, Colours bg_colour) const
|
||||
|
||||
uint DropDownListStringItem::Width() const
|
||||
{
|
||||
char buffer[512];
|
||||
GetString(buffer, this->String(), lastof(buffer));
|
||||
return GetStringBoundingBox(buffer).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
|
||||
return GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
|
||||
}
|
||||
|
||||
void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours bg_colour) const
|
||||
@@ -378,12 +376,10 @@ struct DropdownWindow : Window {
|
||||
* @param button The widget which is passed to Window::OnDropdownSelect and OnDropdownClose.
|
||||
* Unless you override those functions, this should be then widget index of the dropdown button.
|
||||
* @param wi_rect Coord of the parent drop down button, used to position the dropdown menu.
|
||||
* @param auto_width The width is determined by the widest item in the list,
|
||||
* in this case only one of \a left or \a right is used (depending on text direction).
|
||||
* @param instant_close Set to true if releasing mouse button should close the
|
||||
* list regardless of where the cursor is.
|
||||
*/
|
||||
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width, bool instant_close, DropDownSyncFocus sync_parent_focus)
|
||||
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool instant_close, DropDownSyncFocus sync_parent_focus)
|
||||
{
|
||||
DeleteWindowById(WC_DROPDOWN_MENU, 0);
|
||||
|
||||
@@ -393,7 +389,7 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button
|
||||
/* The preferred width equals the calling widget */
|
||||
uint width = wi_rect.Width();
|
||||
|
||||
/* Longest item in the list, if auto_width is enabled */
|
||||
/* Longest item in the list */
|
||||
uint max_item_width = 0;
|
||||
|
||||
/* Total height of list */
|
||||
@@ -401,10 +397,10 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button
|
||||
|
||||
for (const auto &item : list) {
|
||||
height += item->Height(width);
|
||||
if (auto_width) max_item_width = std::max(max_item_width, item->Width());
|
||||
max_item_width = std::max(max_item_width, item->Width());
|
||||
}
|
||||
|
||||
if (auto_width) max_item_width += WidgetDimensions::scaled.fullbevel.Horizontal();
|
||||
max_item_width += WidgetDimensions::scaled.fullbevel.Horizontal();
|
||||
|
||||
/* Scrollbar needed? */
|
||||
bool scroll = false;
|
||||
@@ -448,7 +444,7 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button
|
||||
}
|
||||
}
|
||||
|
||||
if (auto_width) width = std::max(width, max_item_width);
|
||||
width = std::max(width, max_item_width);
|
||||
|
||||
Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - (int)width : wi_rect.left), top};
|
||||
Dimension dw_size = {width, height};
|
||||
@@ -467,12 +463,11 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button
|
||||
* @param selected The initially selected list item.
|
||||
* @param button The widget within the parent window that is used to determine
|
||||
* the list's location.
|
||||
* @param width Override the width determined by the selected widget.
|
||||
* @param auto_width Maximum width is determined by the widest item in the list.
|
||||
* @param width Override the minimum width determined by the selected widget and list contents.
|
||||
* @param instant_close Set to true if releasing mouse button should close the
|
||||
* list regardless of where the cursor is.
|
||||
*/
|
||||
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close, DropDownSyncFocus sync_parent_focus)
|
||||
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool instant_close, DropDownSyncFocus sync_parent_focus)
|
||||
{
|
||||
/* Our parent's button widget is used to determine where to place the drop
|
||||
* down list window. */
|
||||
@@ -495,7 +490,7 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button,
|
||||
}
|
||||
}
|
||||
|
||||
ShowDropDownListAt(w, std::move(list), selected, button, wi_rect, wi_colour, auto_width, instant_close, sync_parent_focus);
|
||||
ShowDropDownListAt(w, std::move(list), selected, button, wi_rect, wi_colour, instant_close, sync_parent_focus);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -507,7 +502,7 @@ void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button,
|
||||
* @param button Button widget number of the parent window \a w that wants the dropdown menu.
|
||||
* @param disabled_mask Bitmask for disabled items (items with their bit set are displayed, but not selectable in the dropdown list).
|
||||
* @param hidden_mask Bitmask for hidden items (items with their bit set are not copied to the dropdown list).
|
||||
* @param width Width of the dropdown menu. If \c 0, use the width of parent widget \a button. If \c UINT_MAX, use the width of parent widget \a button, and use auto_width.
|
||||
* @param width Minimum width of the dropdown menu.
|
||||
*/
|
||||
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width, DropDownSyncFocus sync_parent_focus)
|
||||
{
|
||||
@@ -519,13 +514,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
|
||||
}
|
||||
}
|
||||
|
||||
bool auto_width = false;
|
||||
if (width == UINT_MAX) {
|
||||
width = 0;
|
||||
auto_width = true;
|
||||
}
|
||||
|
||||
if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width, auto_width, false, sync_parent_focus);
|
||||
if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width, false, sync_parent_focus);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -107,8 +107,8 @@ public:
|
||||
*/
|
||||
typedef std::vector<std::unique_ptr<const DropDownListItem>> DropDownList;
|
||||
|
||||
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width = false, bool instant_close = false, DropDownSyncFocus sync_parent_focus = DDSF_NONE);
|
||||
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool instant_close = false, DropDownSyncFocus sync_parent_focus = DDSF_NONE);
|
||||
|
||||
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width = 0, bool auto_width = false, bool instant_close = false, DropDownSyncFocus sync_parent_focus = DDSF_NONE);
|
||||
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width = 0, bool instant_close = false, DropDownSyncFocus sync_parent_focus = DDSF_NONE);
|
||||
|
||||
#endif /* WIDGETS_DROPDOWN_TYPE_H */
|
||||
|
Reference in New Issue
Block a user