Changeset - r20325:7a8caf009bab
[Not reviewed]
master
0 2 0
frosch - 11 years ago 2013-06-08 16:54:19
frosch@openttd.org
(svn r25335) -Change: Revisit the map menu in scenario editor: Remove linkgraph legend, add industry list.
2 files changed with 41 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -280,202 +280,202 @@ STR_SORT_BY_FACILITY                    
 
STR_SORT_BY_WAITING                                             :Waiting cargo value
 
STR_SORT_BY_RATING_MAX                                          :Highest cargo rating
 
STR_SORT_BY_RATING_MIN                                          :Lowest cargo rating
 
STR_SORT_BY_ENGINE_ID                                           :EngineID (classic sort)
 
STR_SORT_BY_COST                                                :Cost
 
STR_SORT_BY_POWER                                               :Power
 
STR_SORT_BY_TRACTIVE_EFFORT                                     :Tractive effort
 
STR_SORT_BY_INTRO_DATE                                          :Introduction Date
 
STR_SORT_BY_RUNNING_COST                                        :Running Cost
 
STR_SORT_BY_POWER_VS_RUNNING_COST                               :Power/Running Cost
 
STR_SORT_BY_CARGO_CAPACITY                                      :Cargo Capacity
 
STR_SORT_BY_RANGE                                               :Range
 
STR_SORT_BY_POPULATION                                          :Population
 
STR_SORT_BY_RATING                                              :Rating
 

	
 
# Tooltips for the main toolbar
 
STR_TOOLBAR_TOOLTIP_PAUSE_GAME                                  :{BLACK}Pause game
 
STR_TOOLBAR_TOOLTIP_FORWARD                                     :{BLACK}Fast forward the game
 
STR_TOOLBAR_TOOLTIP_OPTIONS                                     :{BLACK}Options
 
STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME                      :{BLACK}Save game, abandon game, exit
 
STR_TOOLBAR_TOOLTIP_DISPLAY_MAP                                 :{BLACK}Display map, extra viewport or list of signs
 
STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY                      :{BLACK}Display town directory
 
STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES                           :{BLACK}Display subsidies
 
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS            :{BLACK}Display list of company's stations
 
STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES                    :{BLACK}Display company finances information
 
STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL                     :{BLACK}Display general company information
 
STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS                              :{BLACK}Display graphs
 
STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE                      :{BLACK}Display company league table
 
STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW                    :{BLACK}Fund construction of new industry or list all industries
 
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS              :{BLACK}Display list of company's trains. Ctrl+Click toggles opening the group/vehicle list
 
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES       :{BLACK}Display list of company's road vehicles. Ctrl+Click toggles opening the group/vehicle list
 
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS               :{BLACK}Display list of company's ships. Ctrl+Click toggles opening the group/vehicle list
 
STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_AIRCRAFT            :{BLACK}Display list of company's aircraft. Ctrl+Click toggles opening the group/vehicle list
 
STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN                            :{BLACK}Zoom the view in
 
STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_OUT                           :{BLACK}Zoom the view out
 
STR_TOOLBAR_TOOLTIP_BUILD_RAILROAD_TRACK                        :{BLACK}Build railway track
 
STR_TOOLBAR_TOOLTIP_BUILD_ROADS                                 :{BLACK}Build roads
 
STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS                            :{BLACK}Build ship docks
 
STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS                              :{BLACK}Build airports
 
STR_TOOLBAR_TOOLTIP_LANDSCAPING                                 :{BLACK}Open the landscaping toolbar to raise/lower land, plant trees, etc.
 
STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW                     :{BLACK}Show sound/music window
 
STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS                      :{BLACK}Show last message/news report, show message options
 
STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION                      :{BLACK}Land area information, console, script debug, screenshots, about OpenTTD
 
STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR                              :{BLACK}Switch toolbars
 

	
 
# Extra tooltips for the scenario editor toolbar
 
STR_SCENEDIT_TOOLBAR_TOOLTIP_SAVE_SCENARIO_LOAD_SCENARIO        :{BLACK}Save scenario, load scenario, abandon scenario editor, exit
 
STR_SCENEDIT_TOOLBAR_OPENTTD                                    :{YELLOW}OpenTTD
 
STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR                            :{YELLOW}Scenario Editor
 
STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD    :{BLACK}Move the starting date backward 1 year
 
STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD     :{BLACK}Move the starting date forward 1 year
 
STR_SCENEDIT_TOOLBAR_TOOLTIP_SET_DATE                           :{BLACK}Click to enter the starting year
 
STR_SCENEDIT_TOOLBAR_TOOLTIP_DISPLAY_MAP_TOWN_DIRECTORY         :{BLACK}Display map, town directory
 
STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION                       :{BLACK}Landscape generation
 
STR_SCENEDIT_TOOLBAR_TOWN_GENERATION                            :{BLACK}Town generation
 
STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION                        :{BLACK}Industry generation
 
STR_SCENEDIT_TOOLBAR_ROAD_CONSTRUCTION                          :{BLACK}Road construction
 
STR_SCENEDIT_TOOLBAR_PLANT_TREES                                :{BLACK}Plant trees. Shift toggles building/showing cost estimate
 
STR_SCENEDIT_TOOLBAR_PLACE_SIGN                                 :{BLACK}Place sign
 
STR_SCENEDIT_TOOLBAR_PLACE_OBJECT                               :{BLACK}Place object. Shift toggles building/showing cost estimate
 

	
 
############ range for SE file menu starts
 
STR_SCENEDIT_FILE_MENU_SAVE_SCENARIO                            :Save scenario
 
STR_SCENEDIT_FILE_MENU_LOAD_SCENARIO                            :Load scenario
 
STR_SCENEDIT_FILE_MENU_SAVE_HEIGHTMAP                           :Save heightmap
 
STR_SCENEDIT_FILE_MENU_LOAD_HEIGHTMAP                           :Load heightmap
 
STR_SCENEDIT_FILE_MENU_QUIT_EDITOR                              :Abandon scenario editor
 
STR_SCENEDIT_FILE_MENU_SEPARATOR                                :
 
STR_SCENEDIT_FILE_MENU_QUIT                                     :Exit
 
############ range for SE file menu starts
 

	
 
############ range for settings menu starts
 
STR_SETTINGS_MENU_GAME_OPTIONS                                  :Game options
 
STR_SETTINGS_MENU_CONFIG_SETTINGS                               :Advanced settings
 
STR_SETTINGS_MENU_SCRIPT_SETTINGS                               :AI/Game script settings
 
STR_SETTINGS_MENU_NEWGRF_SETTINGS                               :NewGRF settings
 
STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS                          :Transparency options
 
STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED                          :Town names displayed
 
STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED                       :Station names displayed
 
STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED                           :Waypoint names displayed
 
STR_SETTINGS_MENU_SIGNS_DISPLAYED                               :Signs displayed
 
STR_SETTINGS_MENU_SHOW_COMPETITOR_SIGNS                         :Competitor signs and names displayed
 
STR_SETTINGS_MENU_FULL_ANIMATION                                :Full animation
 
STR_SETTINGS_MENU_FULL_DETAIL                                   :Full detail
 
STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS                         :Transparent buildings
 
STR_SETTINGS_MENU_TRANSPARENT_SIGNS                             :Transparent signs
 
############ range ends here
 

	
 
############ range for file menu starts
 
STR_FILE_MENU_SAVE_GAME                                         :Save game
 
STR_FILE_MENU_LOAD_GAME                                         :Load game
 
STR_FILE_MENU_QUIT_GAME                                         :Abandon game
 
STR_FILE_MENU_SEPARATOR                                         :
 
STR_FILE_MENU_EXIT                                              :Exit
 
############ range ends here
 

	
 
############ range for map menu starts
 
# map menu
 
STR_MAP_MENU_MAP_OF_WORLD                                       :Map of world
 
STR_MAP_MENU_EXTRA_VIEW_PORT                                    :Extra viewport
 
STR_MAP_MENU_LINGRAPH_LEGEND                                    :Cargo Flow Legend
 
STR_MAP_MENU_SIGN_LIST                                          :Sign list
 
############ range for town menu starts, yet the town directory is shown in the map menu in the scenario editor
 

	
 
############ range for town menu starts
 
STR_TOWN_MENU_TOWN_DIRECTORY                                    :Town directory
 
############ end of the 'Display map' dropdown
 
STR_TOWN_MENU_FOUND_TOWN                                        :Found town
 
############ end of the 'Town' dropdown
 
############ range ends here
 

	
 
############ range for subsidies menu starts
 
STR_SUBSIDIES_MENU_SUBSIDIES                                    :Subsidies
 
############ range ends here
 

	
 
############ range for graph menu starts
 
STR_GRAPH_MENU_OPERATING_PROFIT_GRAPH                           :Operating profit graph
 
STR_GRAPH_MENU_INCOME_GRAPH                                     :Income graph
 
STR_GRAPH_MENU_DELIVERED_CARGO_GRAPH                            :Delivered cargo graph
 
STR_GRAPH_MENU_PERFORMANCE_HISTORY_GRAPH                        :Performance history graph
 
STR_GRAPH_MENU_COMPANY_VALUE_GRAPH                              :Company value graph
 
STR_GRAPH_MENU_CARGO_PAYMENT_RATES                              :Cargo payment rates
 
############ range ends here
 

	
 
############ range for company league menu starts
 
STR_GRAPH_MENU_GOAL                                             :Current goals
 
STR_GRAPH_MENU_COMPANY_LEAGUE_TABLE                             :Company league table
 
STR_GRAPH_MENU_DETAILED_PERFORMANCE_RATING                      :Detailed performance rating
 
STR_GRAPH_MENU_HIGHSCORE                                        :Highscore table
 
############ range ends here
 

	
 
############ range for industry menu starts
 
STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY                            :Industry directory
 
STR_INDUSTRY_MENU_INDUSTRY_CHAIN                                :Industry chains
 
STR_INDUSTRY_MENU_FUND_NEW_INDUSTRY                             :Fund new industry
 
############ range ends here
 

	
 
############ range for railway construction menu starts
 
STR_RAIL_MENU_RAILROAD_CONSTRUCTION                             :Railway construction
 
STR_RAIL_MENU_ELRAIL_CONSTRUCTION                               :Electrified railway construction
 
STR_RAIL_MENU_MONORAIL_CONSTRUCTION                             :Monorail construction
 
STR_RAIL_MENU_MAGLEV_CONSTRUCTION                               :Maglev construction
 
############ range ends here
 

	
 
############ range for road construction menu starts
 
STR_ROAD_MENU_ROAD_CONSTRUCTION                                 :Road construction
 
STR_ROAD_MENU_TRAM_CONSTRUCTION                                 :Tramway construction
 
############ range ends here
 

	
 
############ range for waterways construction menu starts
 
STR_WATERWAYS_MENU_WATERWAYS_CONSTRUCTION                       :Waterways construction
 
############ range ends here
 

	
 
############ range for airport construction menu starts
 
STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION                          :Airport construction
 
############ range ends here
 

	
 
############ range for landscaping menu starts
 
STR_LANDSCAPING_MENU_LANDSCAPING                                :Landscaping
 
STR_LANDSCAPING_MENU_PLANT_TREES                                :Plant trees
 
STR_LANDSCAPING_MENU_PLACE_SIGN                                 :Place sign
 
############ range ends here
 

	
 
############ range for music menu starts
 
STR_TOOLBAR_SOUND_MUSIC                                         :Sound/music
 
############ range ends here
 

	
 
############ range for message menu starts
 
STR_NEWS_MENU_LAST_MESSAGE_NEWS_REPORT                          :Last message/news report
 
STR_NEWS_MENU_MESSAGE_HISTORY_MENU                              :Message history
 
############ range ends here
 

	
 
############ range for about menu starts
 
STR_ABOUT_MENU_LAND_BLOCK_INFO                                  :Land area information
 
STR_ABOUT_MENU_SEPARATOR                                        :
 
STR_ABOUT_MENU_TOGGLE_CONSOLE                                   :Toggle console
 
STR_ABOUT_MENU_AI_DEBUG                                         :AI/Game script debug
 
STR_ABOUT_MENU_SCREENSHOT                                       :Screenshot
 
STR_ABOUT_MENU_ZOOMIN_SCREENSHOT                                :Fully zoomed in screenshot
 
STR_ABOUT_MENU_DEFAULTZOOM_SCREENSHOT                           :Default zoom screenshot
 
STR_ABOUT_MENU_GIANT_SCREENSHOT                                 :Whole map screenshot
 
STR_ABOUT_MENU_ABOUT_OPENTTD                                    :About 'OpenTTD'
 
STR_ABOUT_MENU_SPRITE_ALIGNER                                   :Sprite aligner
 
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES                            :Toggle bounding boxes
 
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS                              :Toggle colouring of dirty blocks
 
############ range ends here
 

	
 
############ range for days starts (also used for the place in the highscore window)
 
STR_ORDINAL_NUMBER_1ST                                          :1st
 
STR_ORDINAL_NUMBER_2ND                                          :2nd
 
STR_ORDINAL_NUMBER_3RD                                          :3rd
 
STR_ORDINAL_NUMBER_4TH                                          :4th
 
STR_ORDINAL_NUMBER_5TH                                          :5th
 
STR_ORDINAL_NUMBER_6TH                                          :6th
 
STR_ORDINAL_NUMBER_7TH                                          :7th
 
STR_ORDINAL_NUMBER_8TH                                          :8th
 
STR_ORDINAL_NUMBER_9TH                                          :9th
 
STR_ORDINAL_NUMBER_10TH                                         :10th
 
STR_ORDINAL_NUMBER_11TH                                         :11th
 
STR_ORDINAL_NUMBER_12TH                                         :12th
 
STR_ORDINAL_NUMBER_13TH                                         :13th
 
STR_ORDINAL_NUMBER_14TH                                         :14th
 
STR_ORDINAL_NUMBER_15TH                                         :15th
 
STR_ORDINAL_NUMBER_16TH                                         :16th
 
STR_ORDINAL_NUMBER_17TH                                         :17th
 
STR_ORDINAL_NUMBER_18TH                                         :18th
src/toolbar_gui.cpp
Show inline comments
 
@@ -68,235 +68,251 @@ enum ToolbarMode {
 
enum CallBackFunction {
 
	CBF_NONE,
 
	CBF_PLACE_SIGN,
 
	CBF_PLACE_LANDINFO,
 
};
 

	
 
/**
 
 * Drop down list entry for showing a checked/unchecked toggle item.
 
 */
 
class DropDownListCheckedItem : public DropDownListStringItem {
 
	uint checkmark_width;
 
public:
 
	bool checked;
 

	
 
	DropDownListCheckedItem(StringID string, int result, bool masked, bool checked) : DropDownListStringItem(string, result, masked), checked(checked)
 
	{
 
		this->checkmark_width = GetStringBoundingBox(STR_JUST_CHECKMARK).width + 3;
 
	}
 

	
 
	virtual ~DropDownListCheckedItem() {}
 

	
 
	uint Width() const
 
	{
 
		return DropDownListStringItem::Width() + this->checkmark_width;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	{
 
		bool rtl = _current_text_dir == TD_RTL;
 
		if (this->checked) {
 
			DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_JUST_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
 
		}
 
		DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : this->checkmark_width), right - WD_FRAMERECT_RIGHT - (rtl ? this->checkmark_width : 0), top, this->String(), sel ? TC_WHITE : TC_BLACK);
 
	}
 
};
 

	
 
/**
 
 * Drop down list entry for showing a company entry, with companies 'blob'.
 
 */
 
class DropDownListCompanyItem : public DropDownListItem {
 
	Dimension icon_size;
 
public:
 
	bool greyed;
 

	
 
	DropDownListCompanyItem(int result, bool masked, bool greyed) : DropDownListItem(result, masked), greyed(greyed)
 
	{
 
		this->icon_size = GetSpriteSize(SPR_COMPANY_ICON);
 
	}
 

	
 
	virtual ~DropDownListCompanyItem() {}
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	uint Width() const
 
	{
 
		CompanyID company = (CompanyID)this->result;
 
		SetDParam(0, company);
 
		SetDParam(1, company);
 
		return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_size.width + 3;
 
	}
 

	
 
	uint Height(uint width) const
 
	{
 
		return max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL);
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	{
 
		CompanyID company = (CompanyID)this->result;
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* It's possible the company is deleted while the dropdown is open */
 
		if (!Company::IsValidID(company)) return;
 

	
 
		int icon_offset = (bottom - top - icon_size.height) / 2;
 
		int text_offset = (bottom - top - FONT_HEIGHT_NORMAL) / 2;
 

	
 
		DrawCompanyIcon(company, rtl ? right - this->icon_size.width - WD_FRAMERECT_RIGHT : left + WD_FRAMERECT_LEFT, top + icon_offset);
 

	
 
		SetDParam(0, company);
 
		SetDParam(1, company);
 
		TextColour col;
 
		if (this->greyed) {
 
			col = (sel ? TC_SILVER : TC_GREY) | TC_NO_SHADE;
 
		} else {
 
			col = sel ? TC_WHITE : TC_BLACK;
 
		}
 
		DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : 3 + this->icon_size.width), right - WD_FRAMERECT_RIGHT - (rtl ? 3 + this->icon_size.width : 0), top + text_offset, STR_COMPANY_NAME_COMPANY_NUM, col);
 
	}
 
};
 

	
 
/**
 
 * Pop up a generic text only menu.
 
 * @param w Toolbar
 
 * @param widget Toolbar button
 
 * @param list List of items
 
 * @param def Default item
 
 */
 
static void PopupMainToolbMenu(Window *w, int widget, DropDownList *list, int def)
 
{
 
	ShowDropDownList(w, list, def, widget, 0, true, true);
 
	if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
}
 

	
 
/**
 
 * Pop up a generic text only menu.
 
 * @param w Toolbar
 
 * @param widget Toolbar button
 
 * @param string String for the first item in the menu
 
 * @param count Number of items in the menu
 
 * @param skip Hide first \a skip items in the menu
 
 */
 
static void PopupMainToolbMenu(Window *w, int widget, StringID string, int count, int skip = 0)
 
{
 
	DropDownList *list = new DropDownList();
 
	for (int i = skip; i < count; i++) {
 
		list->push_back(new DropDownListStringItem(string + i, i, false));
 
	}
 
	ShowDropDownList(w, list, skip, widget, 140, true, true);
 
	if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
	PopupMainToolbMenu(w, widget, list, skip);
 
}
 

	
 
/** Enum for the Company Toolbar's network related buttons */
 
static const int CTMN_CLIENT_LIST = -1; ///< Show the client list
 
static const int CTMN_NEW_COMPANY = -2; ///< Create a new company
 
static const int CTMN_SPECTATE    = -3; ///< Become spectator
 

	
 
/**
 
 * Pop up a generic company list menu.
 
 */
 
static void PopupMainCompanyToolbMenu(Window *w, int widget, int grey = 0)
 
{
 
	DropDownList *list = new DropDownList();
 

	
 
#ifdef ENABLE_NETWORK
 
	if (widget == WID_TN_COMPANIES && _networking) {
 
		/* Add the client list button for the companies menu */
 
		list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, CTMN_CLIENT_LIST, false));
 

	
 
		if (_local_company == COMPANY_SPECTATOR) {
 
			list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_NEW_COMPANY, CTMN_NEW_COMPANY, NetworkMaxCompaniesReached()));
 
		} else {
 
			list->push_back(new DropDownListStringItem(STR_NETWORK_COMPANY_LIST_SPECTATE, CTMN_SPECTATE, NetworkMaxSpectatorsReached()));
 
		}
 
	}
 
#endif /* ENABLE_NETWORK */
 

	
 
	for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
 
		if (!Company::IsValidID(c)) continue;
 
		list->push_back(new DropDownListCompanyItem(c, false, HasBit(grey, c)));
 
	}
 

	
 
	ShowDropDownList(w, list, _local_company == COMPANY_SPECTATOR ? CTMN_CLIENT_LIST : (int)_local_company, widget, 240, true, true);
 
	if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
	PopupMainToolbMenu(w, widget, list, _local_company == COMPANY_SPECTATOR ? CTMN_CLIENT_LIST : (int)_local_company);
 
}
 

	
 

	
 
static ToolbarMode _toolbar_mode;
 

	
 
static CallBackFunction SelectSignTool()
 
{
 
	if (_cursor.sprite == SPR_CURSOR_SIGN) {
 
		ResetObjectToPlace();
 
		return CBF_NONE;
 
	} else {
 
		SetObjectToPlace(SPR_CURSOR_SIGN, PAL_NONE, HT_RECT, WC_MAIN_TOOLBAR, 0);
 
		return CBF_PLACE_SIGN;
 
	}
 
}
 

	
 
/* --- Pausing --- */
 

	
 
static CallBackFunction ToolbarPauseClick(Window *w)
 
{
 
	if (_networking && !_network_server) return CBF_NONE; // only server can pause the game
 

	
 
	if (DoCommandP(0, PM_PAUSED_NORMAL, _pause_mode == PM_UNPAUSED, CMD_PAUSE)) {
 
		if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP);
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Toggle fast forward mode.
 
 *
 
 * @param w Unused.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction ToolbarFastForwardClick(Window *w)
 
{
 
	_fast_forward ^= true;
 
	if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Game Option button menu entries.
 
 */
 
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,
 
};
 

	
 
/**
 
 * Handle click on Options button in toolbar.
 
 *
 
 * @param w parent window the shown Drop down list is attached to.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction ToolbarOptionsClick(Window *w)
 
{
 
	DropDownList *list = new DropDownList();
 
	list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_GAME_OPTIONS,             OME_GAMEOPTIONS, false));
 
	list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_CONFIG_SETTINGS,          OME_SETTINGS, false));
 
	/* Changes to the per-AI settings don't get send from the server to the clients. Clients get
 
	 * the settings once they join but never update it. As such don't show the window at all
 
	 * to network clients. */
 
	if (!_networking || _network_server) list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_SCRIPT_SETTINGS, OME_SCRIPT_SETTINGS, false));
 
	list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_NEWGRF_SETTINGS,          OME_NEWGRFSETTINGS, false));
 
	list->push_back(new DropDownListStringItem(STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS,     OME_TRANSPARENCIES, false));
 
	list->push_back(new DropDownListItem(-1, false));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED,    OME_SHOW_TOWNNAMES, false, HasBit(_display_opt, DO_SHOW_TOWN_NAMES)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED, OME_SHOW_STATIONNAMES, false, HasBit(_display_opt, DO_SHOW_STATION_NAMES)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED,     OME_SHOW_WAYPOINTNAMES, false, HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_SIGNS_DISPLAYED,         OME_SHOW_SIGNS, false, HasBit(_display_opt, DO_SHOW_SIGNS)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_SHOW_COMPETITOR_SIGNS,   OME_SHOW_COMPETITOR_SIGNS, false, HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_ANIMATION,          OME_FULL_ANIMATION, false, HasBit(_display_opt, DO_FULL_ANIMATION)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_FULL_DETAIL,             OME_FULL_DETAILS, false, HasBit(_display_opt, DO_FULL_DETAIL)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_BUILDINGS,   OME_TRANSPARENTBUILDINGS, false, IsTransparencySet(TO_HOUSES)));
 
	list->push_back(new DropDownListCheckedItem(STR_SETTINGS_MENU_TRANSPARENT_SIGNS,       OME_SHOW_STATIONSIGNS, false, IsTransparencySet(TO_SIGNS)));
 

	
 
	ShowDropDownList(w, list, 0, WID_TN_SETTINGS, 140, true, true);
 
	if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on one of the entries in the Options button menu.
 
@@ -320,223 +336,234 @@ static CallBackFunction MenuClickSetting
 
		case OME_SHOW_COMPETITOR_SIGNS:
 
			ToggleBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS);
 
			InvalidateWindowClassesData(WC_SIGN_LIST, -1);
 
			break;
 
		case OME_FULL_ANIMATION:       ToggleBit(_display_opt, DO_FULL_ANIMATION);      break;
 
		case OME_FULL_DETAILS:         ToggleBit(_display_opt, DO_FULL_DETAIL);         break;
 
		case OME_TRANSPARENTBUILDINGS: ToggleTransparency(TO_HOUSES);                   break;
 
		case OME_SHOW_STATIONSIGNS:    ToggleTransparency(TO_SIGNS);                    break;
 
	}
 
	MarkWholeScreenDirty();
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * SaveLoad entries in scenario editor mode.
 
 */
 
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 normal game mode.
 
 */
 
enum SaveLoadNormalMenuEntries {
 
	SLNME_SAVE_GAME   = 0,
 
	SLNME_LOAD_GAME,
 
	SLNME_EXIT_TOINTRO,
 
	SLNME_EXIT_GAME = 4,
 
	SLNME_MENUCOUNT,
 
};
 

	
 
/**
 
 * Handle click on Save button in toolbar in normal game mode.
 
 *
 
 * @param w parent window the shown save dialogue is attached to.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction ToolbarSaveClick(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TN_SAVE, STR_FILE_MENU_SAVE_GAME, SLNME_MENUCOUNT);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on SaveLoad button in toolbar in the scenario editor.
 
 *
 
 * @param w parent window the shown save dialogue is attached to.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction ToolbarScenSaveOrLoad(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TE_SAVE, STR_SCENEDIT_FILE_MENU_SAVE_SCENARIO, SLEME_MENUCOUNT);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on one of the entries in the SaveLoad menu.
 
 *
 
 * @param index Index being clicked.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickSaveLoad(int index = 0)
 
{
 
	if (_game_mode == GM_EDITOR) {
 
		switch (index) {
 
			case SLEME_SAVE_SCENARIO:  ShowSaveLoadDialog(SLD_SAVE_SCENARIO);  break;
 
			case SLEME_LOAD_SCENARIO:  ShowSaveLoadDialog(SLD_LOAD_SCENARIO);  break;
 
			case SLEME_SAVE_HEIGHTMAP: ShowSaveLoadDialog(SLD_SAVE_HEIGHTMAP); break;
 
			case SLEME_LOAD_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
 
			case SLEME_EXIT_TOINTRO:   AskExitToGameMenu();                    break;
 
			case SLEME_EXIT_GAME:      HandleExitGameRequest();                break;
 
		}
 
	} else {
 
		switch (index) {
 
			case SLNME_SAVE_GAME:      ShowSaveLoadDialog(SLD_SAVE_GAME); break;
 
			case SLNME_LOAD_GAME:      ShowSaveLoadDialog(SLD_LOAD_GAME); break;
 
			case SLNME_EXIT_TOINTRO:   AskExitToGameMenu();               break;
 
			case SLNME_EXIT_GAME:      HandleExitGameRequest();           break;
 
		}
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/* --- Map button menu --- */
 

	
 
enum MapMenuEntries {
 
	MME_SHOW_SMALLMAP        = 0,
 
	MME_SHOW_EXTRAVIEWPORTS,
 
	MME_SHOW_LINKGRAPH,
 
	MME_SHOW_SIGNLISTS,
 
	MME_SHOW_TOWNDIRECTORY,    ///< This entry is only used in Editor mode
 
	MME_MENUCOUNT_NORMAL     = 4,
 
	MME_MENUCOUNT_EDITOR     = 5,
 
	MME_SHOW_TOWNDIRECTORY,
 
	MME_SHOW_INDUSTRYDIRECTORY,
 
};
 

	
 
static CallBackFunction ToolbarMapClick(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TN_SMALL_MAP, STR_MAP_MENU_MAP_OF_WORLD, MME_MENUCOUNT_NORMAL);
 
	DropDownList *list = new DropDownList();
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD,            MME_SHOW_SMALLMAP,          false));
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT,         MME_SHOW_EXTRAVIEWPORTS,    false));
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_LINGRAPH_LEGEND,         MME_SHOW_LINKGRAPH,         false));
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST,               MME_SHOW_SIGNLISTS,         false));
 
	PopupMainToolbMenu(w, WID_TN_SMALL_MAP, list, 0);
 
	return CBF_NONE;
 
}
 

	
 
static CallBackFunction ToolbarScenMapTownDir(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TE_SMALL_MAP, STR_MAP_MENU_MAP_OF_WORLD, MME_MENUCOUNT_EDITOR);
 
	DropDownList *list = new DropDownList();
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_MAP_OF_WORLD,            MME_SHOW_SMALLMAP,          false));
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_EXTRA_VIEW_PORT,         MME_SHOW_EXTRAVIEWPORTS,    false));
 
	list->push_back(new DropDownListStringItem(STR_MAP_MENU_SIGN_LIST,               MME_SHOW_SIGNLISTS,         false));
 
	list->push_back(new DropDownListStringItem(STR_TOWN_MENU_TOWN_DIRECTORY,         MME_SHOW_TOWNDIRECTORY,     false));
 
	list->push_back(new DropDownListStringItem(STR_INDUSTRY_MENU_INDUSTRY_DIRECTORY, MME_SHOW_INDUSTRYDIRECTORY, false));
 
	PopupMainToolbMenu(w, WID_TE_SMALL_MAP, list, 0);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on one of the entries in the Map menu.
 
 *
 
 * @param index Index being clicked.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickMap(int index)
 
{
 
	switch (index) {
 
		case MME_SHOW_SMALLMAP:       ShowSmallMap();            break;
 
		case MME_SHOW_EXTRAVIEWPORTS: ShowExtraViewPortWindow(); break;
 
		case MME_SHOW_LINKGRAPH:      ShowLinkGraphLegend();     break;
 
		case MME_SHOW_SIGNLISTS:      ShowSignList();            break;
 
		case MME_SHOW_TOWNDIRECTORY:  if (_game_mode == GM_EDITOR) ShowTownDirectory(); break;
 
		case MME_SHOW_TOWNDIRECTORY:  ShowTownDirectory();       break;
 
		case MME_SHOW_INDUSTRYDIRECTORY: ShowIndustryDirectory(); break;
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/* --- Town button menu --- */
 

	
 
static CallBackFunction ToolbarTownClick(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TN_TOWNS, STR_TOWN_MENU_TOWN_DIRECTORY, (_settings_game.economy.found_town == TF_FORBIDDEN) ? 1 : 2);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on one of the entries in the Town menu.
 
 *
 
 * @param index Index being clicked.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickTown(int index)
 
{
 
	switch (index) {
 
		case 0: ShowTownDirectory(); break;
 
		case 1: // setting could be changed when the dropdown was open
 
			if (_settings_game.economy.found_town != TF_FORBIDDEN) ShowFoundTownWindow();
 
			break;
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/* --- Subidies button menu --- */
 

	
 
static CallBackFunction ToolbarSubsidiesClick(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TN_SUBSIDIES, STR_SUBSIDIES_MENU_SUBSIDIES, 1);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on the entry in the Subsidies menu.
 
 *
 
 * @param index Unused.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickSubsidies(int index)
 
{
 
	switch (index) {
 
		case 0: ShowSubsidiesList(); break;
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/* --- Stations button menu --- */
 

	
 
static CallBackFunction ToolbarStationsClick(Window *w)
 
{
 
	PopupMainCompanyToolbMenu(w, WID_TN_STATIONS);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on the entry in the Stations menu
 
 *
 
 * @param index CompanyID to show station list for
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickStations(int index)
 
{
 
	ShowCompanyStations((CompanyID)index);
 
	return CBF_NONE;
 
}
 

	
 
/* --- Finances button menu --- */
 

	
 
static CallBackFunction ToolbarFinancesClick(Window *w)
 
{
 
	PopupMainCompanyToolbMenu(w, WID_TN_FINANCES);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on the entry in the finances overview menu.
 
 *
 
 * @param index CompanyID to show finances for.
 
 * @return #CBF_NONE
 
 */
 
static CallBackFunction MenuClickFinances(int index)
 
{
 
	ShowCompanyFinances((CompanyID)index);
 
	return CBF_NONE;
 
}
 

	
 
/* --- Company's button menu --- */
 

	
 
static CallBackFunction ToolbarCompaniesClick(Window *w)
 
{
 
	PopupMainCompanyToolbMenu(w, WID_TN_COMPANIES);
0 comments (0 inline, 0 general)