|
OpenTTD Source
13.0-beta1
|
#include "stdafx.h"#include "gui.h"#include "window_gui.h"#include "window_func.h"#include "viewport_func.h"#include "command_func.h"#include "vehicle_gui.h"#include "rail_gui.h"#include "road.h"#include "road_gui.h"#include "date_func.h"#include "vehicle_func.h"#include "sound_func.h"#include "terraform_gui.h"#include "strings_func.h"#include "company_func.h"#include "company_gui.h"#include "vehicle_base.h"#include "cheat_func.h"#include "transparency_gui.h"#include "screenshot.h"#include "signs_func.h"#include "fios.h"#include "console_gui.h"#include "news_gui.h"#include "ai/ai_gui.hpp"#include "tilehighlight_func.h"#include "smallmap_gui.h"#include "graph_gui.h"#include "textbuf_gui.h"#include "linkgraph/linkgraph_gui.h"#include "newgrf_debug.h"#include "hotkeys.h"#include "engine_base.h"#include "highscore.h"#include "game/game.hpp"#include "goal_base.h"#include "story_base.h"#include "toolbar_gui.h"#include "framerate_type.h"#include "guitimer_func.h"#include "screenshot_gui.h"#include "misc_cmd.h"#include "widgets/toolbar_widget.h"#include "network/network.h"#include "network/network_gui.h"#include "network/network_func.h"#include "safeguards.h"Go to the source code of this file.
Data Structures | |
| class | DropDownListCheckedItem |
| Drop down list entry for showing a checked/unchecked toggle item. More... | |
| class | DropDownListCompanyItem |
| Drop down list entry for showing a company entry, with companies 'blob'. More... | |
| class | NWidgetToolbarContainer |
| Full blown container to make it behave exactly as we want :) More... | |
| class | NWidgetMainToolbarContainer |
| Container for the 'normal' main toolbar. More... | |
| class | NWidgetScenarioToolbarContainer |
| Container for the scenario editor's toolbar. More... | |
| struct | MainToolbarWindow |
| Main toolbar. More... | |
| struct | ScenarioEditorToolbarWindow |
Typedefs | |
| typedef CallBackFunction | MenuClickedProc(int index) |
| typedef CallBackFunction | ToolbarButtonProc(Window *w) |
Enumerations | |
| enum | ToolbarMode { TB_NORMAL, TB_UPPER, TB_LOWER } |
| Toobar modes. | |
| enum | CallBackFunction { CBF_NONE, CBF_PLACE_SIGN, CBF_PLACE_LANDINFO } |
| Callback functions. | |
| enum | OptionMenuEntries { OME_GAMEOPTIONS, OME_SETTINGS, OME_SCRIPT_SETTINGS, OME_NEWGRFSETTINGS, OME_TRANSPARENCIES, OME_SHOW_TOWNNAMES, OME_SHOW_STATIONNAMES, OME_SHOW_WAYPOINTNAMES, OME_SHOW_SIGNS, OME_SHOW_COMPETITOR_SIGNS, OME_FULL_ANIMATION, OME_FULL_DETAILS, OME_TRANSPARENTBUILDINGS, OME_SHOW_STATIONSIGNS } |
| Game Option button menu entries. | |
| enum | SaveLoadEditorMenuEntries { SLEME_SAVE_SCENARIO = 0, SLEME_LOAD_SCENARIO, SLEME_SAVE_HEIGHTMAP, SLEME_LOAD_HEIGHTMAP, SLEME_EXIT_TOINTRO, SLEME_EXIT_GAME = 6, SLEME_MENUCOUNT } |
| SaveLoad entries in scenario editor mode. | |
| enum | SaveLoadNormalMenuEntries { SLNME_SAVE_GAME = 0, SLNME_LOAD_GAME, SLNME_EXIT_TOINTRO, SLNME_EXIT_GAME = 4, SLNME_MENUCOUNT } |
| SaveLoad entries in normal game mode. | |
| enum | MapMenuEntries { MME_SHOW_SMALLMAP = 0, MME_SHOW_EXTRAVIEWPORTS, MME_SHOW_LINKGRAPH, MME_SHOW_SIGNLISTS, MME_SHOW_TOWNDIRECTORY, MME_SHOW_INDUSTRYDIRECTORY } |
| enum | MainToolbarEditorHotkeys { MTEHK_PAUSE, MTEHK_FASTFORWARD, MTEHK_SETTINGS, MTEHK_SAVEGAME, MTEHK_GENLAND, MTEHK_GENTOWN, MTEHK_GENINDUSTRY, MTEHK_BUILD_ROAD, MTEHK_BUILD_TRAM, MTEHK_BUILD_DOCKS, MTEHK_BUILD_TREES, MTEHK_SIGN, MTEHK_MUSIC, MTEHK_LANDINFO, MTEHK_SMALL_SCREENSHOT, MTEHK_ZOOMEDIN_SCREENSHOT, MTEHK_DEFAULTZOOM_SCREENSHOT, MTEHK_GIANT_SCREENSHOT, MTEHK_ZOOM_IN, MTEHK_ZOOM_OUT, MTEHK_TERRAFORM, MTEHK_SMALLMAP, MTEHK_EXTRA_VIEWPORT } |
Functions | |
| static void | PopupMainToolbMenu (Window *w, int widget, DropDownList &&list, int def) |
| Pop up a generic text only menu. More... | |
| static void | PopupMainToolbMenu (Window *w, int widget, StringID string, int count) |
| Pop up a generic text only menu. More... | |
| static void | PopupMainCompanyToolbMenu (Window *w, int widget, int grey=0) |
| Pop up a generic company list menu. More... | |
| static CallBackFunction | SelectSignTool () |
| static CallBackFunction | ToolbarPauseClick (Window *w) |
| static CallBackFunction | ToolbarFastForwardClick (Window *w) |
| Toggle fast forward mode. More... | |
| static CallBackFunction | ToolbarOptionsClick (Window *w) |
| Handle click on Options button in toolbar. More... | |
| static CallBackFunction | MenuClickSettings (int index) |
| Handle click on one of the entries in the Options button menu. More... | |
| static CallBackFunction | ToolbarSaveClick (Window *w) |
| Handle click on Save button in toolbar in normal game mode. More... | |
| static CallBackFunction | ToolbarScenSaveOrLoad (Window *w) |
| Handle click on SaveLoad button in toolbar in the scenario editor. More... | |
| static CallBackFunction | MenuClickSaveLoad (int index=0) |
| Handle click on one of the entries in the SaveLoad menu. More... | |
| static CallBackFunction | ToolbarMapClick (Window *w) |
| static CallBackFunction | ToolbarScenMapTownDir (Window *w) |
| static CallBackFunction | MenuClickMap (int index) |
| Handle click on one of the entries in the Map menu. More... | |
| static CallBackFunction | ToolbarTownClick (Window *w) |
| static CallBackFunction | MenuClickTown (int index) |
| Handle click on one of the entries in the Town menu. More... | |
| static CallBackFunction | ToolbarSubsidiesClick (Window *w) |
| static CallBackFunction | MenuClickSubsidies (int index) |
| Handle click on the entry in the Subsidies menu. More... | |
| static CallBackFunction | ToolbarStationsClick (Window *w) |
| static CallBackFunction | MenuClickStations (int index) |
| Handle click on the entry in the Stations menu. More... | |
| static CallBackFunction | ToolbarFinancesClick (Window *w) |
| static CallBackFunction | MenuClickFinances (int index) |
| Handle click on the entry in the finances overview menu. More... | |
| static CallBackFunction | ToolbarCompaniesClick (Window *w) |
| static CallBackFunction | MenuClickCompany (int index) |
| Handle click on the entry in the Company menu. More... | |
| static CallBackFunction | ToolbarStoryClick (Window *w) |
| static CallBackFunction | MenuClickStory (int index) |
| Handle click on the entry in the Story menu. More... | |
| static CallBackFunction | ToolbarGoalClick (Window *w) |
| static CallBackFunction | MenuClickGoal (int index) |
| Handle click on the entry in the Goal menu. More... | |
| static CallBackFunction | ToolbarGraphsClick (Window *w) |
| static CallBackFunction | MenuClickGraphs (int index) |
| Handle click on the entry in the Graphs menu. More... | |
| static CallBackFunction | ToolbarLeagueClick (Window *w) |
| static CallBackFunction | MenuClickLeague (int index) |
| Handle click on the entry in the CompanyLeague menu. More... | |
| static CallBackFunction | ToolbarIndustryClick (Window *w) |
| static CallBackFunction | MenuClickIndustry (int index) |
| Handle click on the entry in the Industry menu. More... | |
| static void | ToolbarVehicleClick (Window *w, VehicleType veh) |
| static CallBackFunction | ToolbarTrainClick (Window *w) |
| static CallBackFunction | MenuClickShowTrains (int index) |
| Handle click on the entry in the Train menu. More... | |
| static CallBackFunction | ToolbarRoadClick (Window *w) |
| static CallBackFunction | MenuClickShowRoad (int index) |
| Handle click on the entry in the Road Vehicles menu. More... | |
| static CallBackFunction | ToolbarShipClick (Window *w) |
| static CallBackFunction | MenuClickShowShips (int index) |
| Handle click on the entry in the Ships menu. More... | |
| static CallBackFunction | ToolbarAirClick (Window *w) |
| static CallBackFunction | MenuClickShowAir (int index) |
| Handle click on the entry in the Aircraft menu. More... | |
| static CallBackFunction | ToolbarZoomInClick (Window *w) |
| static CallBackFunction | ToolbarZoomOutClick (Window *w) |
| static CallBackFunction | ToolbarBuildRailClick (Window *w) |
| static CallBackFunction | MenuClickBuildRail (int index) |
| Handle click on the entry in the Build Rail menu. More... | |
| static CallBackFunction | ToolbarBuildRoadClick (Window *w) |
| static CallBackFunction | MenuClickBuildRoad (int index) |
| Handle click on the entry in the Build Road menu. More... | |
| static CallBackFunction | ToolbarBuildTramClick (Window *w) |
| static CallBackFunction | MenuClickBuildTram (int index) |
| Handle click on the entry in the Build Tram menu. More... | |
| static CallBackFunction | ToolbarBuildWaterClick (Window *w) |
| static CallBackFunction | MenuClickBuildWater (int index) |
| Handle click on the entry in the Build Waterways menu. More... | |
| static CallBackFunction | ToolbarBuildAirClick (Window *w) |
| static CallBackFunction | MenuClickBuildAir (int index) |
| Handle click on the entry in the Build Air menu. More... | |
| static CallBackFunction | ToolbarForestClick (Window *w) |
| static CallBackFunction | MenuClickForest (int index) |
| Handle click on the entry in the landscaping menu. More... | |
| static CallBackFunction | ToolbarMusicClick (Window *w) |
| static CallBackFunction | MenuClickMusicWindow (int index) |
| Handle click on the entry in the Music menu. More... | |
| static CallBackFunction | ToolbarNewspaperClick (Window *w) |
| static CallBackFunction | MenuClickNewspaper (int index) |
| Handle click on the entry in the Newspaper menu. More... | |
| static CallBackFunction | PlaceLandBlockInfo () |
| static CallBackFunction | ToolbarHelpClick (Window *w) |
| void | ToggleBoundingBoxes () |
| Toggle drawing of sprites' bounding boxes. More... | |
| void | ToggleDirtyBlocks () |
| Toggle drawing of the dirty blocks. More... | |
| void | SetStartingYear (Year year) |
| Set the starting year for a scenario. More... | |
| static CallBackFunction | MenuClickHelp (int index) |
| Choose the proper callback function for the main toolbar's help menu. More... | |
| static CallBackFunction | ToolbarSwitchClick (Window *w) |
| static CallBackFunction | ToolbarScenDatePanel (Window *w) |
| Called when clicking at the date panel of the scenario editor toolbar. | |
| static CallBackFunction | ToolbarScenDateBackward (Window *w) |
| static CallBackFunction | ToolbarScenDateForward (Window *w) |
| static CallBackFunction | ToolbarScenGenLand (Window *w) |
| static CallBackFunction | ToolbarScenGenTown (Window *w) |
| static CallBackFunction | ToolbarScenGenIndustry (Window *w) |
| static CallBackFunction | ToolbarScenBuildRoadClick (Window *w) |
| static CallBackFunction | ToolbarScenBuildRoad (int index) |
| Handle click on the entry in the Build Road menu. More... | |
| static CallBackFunction | ToolbarScenBuildTramClick (Window *w) |
| static CallBackFunction | ToolbarScenBuildTram (int index) |
| Handle click on the entry in the Build Tram menu. More... | |
| static CallBackFunction | ToolbarScenBuildDocks (Window *w) |
| static CallBackFunction | ToolbarScenPlantTrees (Window *w) |
| static CallBackFunction | ToolbarScenPlaceSign (Window *w) |
| static CallBackFunction | ToolbarBtn_NULL (Window *w) |
| static NWidgetBase * | MakeMainToolbar (int *biggest_index) |
| static NWidgetBase * | MakeScenarioToolbar (int *biggest_index) |
| void | AllocateToolbar () |
| Allocate the toolbar. | |
Variables | |
| uint | _toolbar_width = 0 |
| Width of the toolbar, shared by statusbar. | |
| RailType | _last_built_railtype |
| RoadType | _last_built_roadtype |
| RoadType | _last_built_tramtype |
| static CallBackFunction | _last_started_action = CBF_NONE |
| Last started user action. | |
| static const int | CTMN_CLIENT_LIST = -1 |
| Enum for the Company Toolbar's network related buttons. More... | |
| static const int | CTMN_SPECTATE = -2 |
| Become spectator. | |
| static const int | CTMN_SPECTATOR = -3 |
| Show a company window as spectator. | |
| static ToolbarMode | _toolbar_mode |
| static MenuClickedProc *const | _menu_clicked_procs [] |
| static ToolbarButtonProc *const | _toolbar_button_procs [] |
| const uint16 | _maintoolbar_pause_keys [] = {WKC_F1, WKC_PAUSE, 0} |
| const uint16 | _maintoolbar_zoomin_keys [] = {WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5, 0} |
| const uint16 | _maintoolbar_zoomout_keys [] = {WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6, 0} |
| const uint16 | _maintoolbar_smallmap_keys [] = {WKC_F4, 'M', 0} |
| static Hotkey | maintoolbar_hotkeys [] |
| static const NWidgetPart | _nested_toolbar_normal_widgets [] |
| static WindowDesc | _toolb_normal_desc (WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS, _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets), &MainToolbarWindow::hotkeys) |
| static MenuClickedProc *const | _scen_toolbar_dropdown_procs [] |
| static ToolbarButtonProc *const | _scen_toolbar_button_procs [] |
| static Hotkey | scenedit_maintoolbar_hotkeys [] |
| static const NWidgetPart | _nested_toolb_scen_inner_widgets [] |
| static const NWidgetPart | _nested_toolb_scen_widgets [] |
| static WindowDesc | _toolb_scen_desc (WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS, _nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets), &ScenarioEditorToolbarWindow::hotkeys) |
Code related to the (main) toolbar.
Definition in file toolbar_gui.cpp.
|
static |
Sprites to use for the different toolbar buttons
Definition at line 2158 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Build Air menu.
| index | Unused. |
Definition at line 964 of file toolbar_gui.cpp.
References ShowBuildAirToolbar().
|
static |
Handle click on the entry in the Build Rail menu.
| index | RailType to show the build toolbar for. |
Definition at line 873 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Build Road menu.
| index | RoadType to show the build toolbar for. |
Definition at line 895 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Build Tram menu.
| index | RoadType to show the build toolbar for. |
Definition at line 917 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Build Waterways menu.
| index | Unused. |
Definition at line 941 of file toolbar_gui.cpp.
References ShowBuildDocksToolbar().
|
static |
Handle click on the entry in the Company menu.
| index | Menu entry to handle. |
Definition at line 604 of file toolbar_gui.cpp.
References _networking, and CTMN_CLIENT_LIST.
|
static |
Handle click on the entry in the finances overview menu.
| index | CompanyID to show finances for. |
Definition at line 584 of file toolbar_gui.cpp.
References ShowCompanyFinances().
|
static |
Handle click on the entry in the landscaping menu.
| index | Menu entry clicked. |
Definition at line 989 of file toolbar_gui.cpp.
References ShowTerraformToolbar().
|
static |
Handle click on the entry in the Goal menu.
| index | CompanyID to show story book for |
Definition at line 660 of file toolbar_gui.cpp.
References CTMN_SPECTATOR, INVALID_COMPANY, and ShowGoalsList().
|
static |
Handle click on the entry in the Graphs menu.
| index | Graph to show. |
Definition at line 680 of file toolbar_gui.cpp.
|
static |
Choose the proper callback function for the main toolbar's help menu.
| index | The menu index which was selected. |
Definition at line 1114 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Industry menu.
| index | Menu entry number. |
Definition at line 735 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the CompanyLeague menu.
| index | Menu entry number. |
Definition at line 710 of file toolbar_gui.cpp.
|
static |
Handle click on one of the entries in the Map menu.
| index | Index being clicked. |
Definition at line 490 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Music menu.
| index | Unused. |
Definition at line 1013 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Newspaper menu.
| index | Menu entry clicked. |
Definition at line 1033 of file toolbar_gui.cpp.
References DeleteAllMessages(), ShowLastNewsMessage(), and ShowMessageHistory().
|
static |
Handle click on one of the entries in the SaveLoad menu.
| index | Index being clicked. |
Definition at line 428 of file toolbar_gui.cpp.
|
static |
Handle click on one of the entries in the Options button menu.
| index | Index being clicked. |
Definition at line 348 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Aircraft menu.
| index | CompanyID to show aircraft list for. |
Definition at line 830 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Road Vehicles menu.
| index | CompanyID to show road vehicles list for. |
Definition at line 790 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Ships menu.
| index | CompanyID to show ship list for. |
Definition at line 810 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Train menu.
| index | CompanyID to show train list for. |
Definition at line 770 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Stations menu.
| index | CompanyID to show station list for |
Definition at line 564 of file toolbar_gui.cpp.
References ShowCompanyStations().
|
static |
Handle click on the entry in the Story menu.
| index | CompanyID to show story book for |
Definition at line 640 of file toolbar_gui.cpp.
References CTMN_SPECTATOR, INVALID_COMPANY, and ShowStoryBook().
|
static |
Handle click on the entry in the Subsidies menu.
| index | Unused. |
Definition at line 542 of file toolbar_gui.cpp.
|
static |
Handle click on one of the entries in the Town menu.
| index | Index being clicked. |
Definition at line 517 of file toolbar_gui.cpp.
|
static |
Pop up a generic company list menu.
| w | The toolbar window. |
| widget | The button widget id. |
| grey | A bitbask of which items to mark as disabled. |
Definition at line 217 of file toolbar_gui.cpp.
References _local_company, _networking, COMPANY_FIRST, COMPANY_SPECTATOR, CTMN_CLIENT_LIST, CTMN_SPECTATE, CTMN_SPECTATOR, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MAX_COMPANIES, PopupMainToolbMenu(), WID_TN_COMPANIES, WID_TN_GOAL, and WID_TN_STORY.
|
static |
Pop up a generic text only menu.
| w | Toolbar |
| widget | Toolbar button |
| list | List of items |
| def | Default item |
Definition at line 184 of file toolbar_gui.cpp.
References _settings_client, SoundSettings::click_beep, ShowDropDownList(), and ClientSettings::sound.
Referenced by PopupMainCompanyToolbMenu(), PopupMainToolbMenu(), ToolbarSaveClick(), and ToolbarScenSaveOrLoad().
Pop up a generic text only menu.
| w | Toolbar |
| widget | Toolbar button |
| string | String for the first item in the menu |
| count | Number of items in the menu |
Definition at line 197 of file toolbar_gui.cpp.
References PopupMainToolbMenu().
| void SetStartingYear | ( | Year | year | ) |
Set the starting year for a scenario.
| year | New starting year. |
Definition at line 1100 of file toolbar_gui.cpp.
References _date, _settings_game, Clamp(), ConvertYMDToDate(), GameSettings::game_creation, LinkGraphSchedule::instance, MAX_YEAR, MIN_YEAR, SetDate(), LinkGraphSchedule::ShiftDates(), and GameCreationSettings::starting_year.
Referenced by ScenarioEditorToolbarWindow::OnQueryTextFinished().
| void ToggleBoundingBoxes | ( | ) |
Toggle drawing of sprites' bounding boxes.
Function is found here and not in viewport.cpp in order to avoid importing the settings structs to there.
Definition at line 1069 of file toolbar_gui.cpp.
| void ToggleDirtyBlocks | ( | ) |
Toggle drawing of the dirty blocks.
Function is found here and not in viewport.cpp in order to avoid importing the settings structs to there.
Definition at line 1086 of file toolbar_gui.cpp.
|
static |
Toggle fast forward mode.
| w | Unused. |
Definition at line 281 of file toolbar_gui.cpp.
|
static |
Handle click on Options button in toolbar.
| w | parent window the shown Drop down list is attached to. |
Definition at line 315 of file toolbar_gui.cpp.
|
static |
Handle click on Save button in toolbar in normal game mode.
| w | parent window the shown save dialogue is attached to. |
Definition at line 404 of file toolbar_gui.cpp.
References PopupMainToolbMenu(), and WID_TN_SAVE.
|
static |
Handle click on the entry in the Build Road menu.
| index | RoadType to show the build toolbar for. |
Definition at line 1223 of file toolbar_gui.cpp.
|
static |
Handle click on the entry in the Build Tram menu.
| index | RoadType to show the build toolbar for. |
Definition at line 1243 of file toolbar_gui.cpp.
|
static |
Handle click on SaveLoad button in toolbar in the scenario editor.
| w | parent window the shown save dialogue is attached to. |
Definition at line 416 of file toolbar_gui.cpp.
References PopupMainToolbMenu(), and WID_TE_SAVE.
|
static |
Definition at line 2567 of file toolbar_gui.cpp.
|
static |
Definition at line 2216 of file toolbar_gui.cpp.
|
static |
Definition at line 2257 of file toolbar_gui.cpp.
|
static |
Definition at line 2231 of file toolbar_gui.cpp.
|
static |
Enum for the Company Toolbar's network related buttons.
Show the client list
Definition at line 207 of file toolbar_gui.cpp.
Referenced by MenuClickCompany(), and PopupMainCompanyToolbMenu().
|
static |
Definition at line 2499 of file toolbar_gui.cpp.