Changeset - r16977:45c7a592cb4d
[Not reviewed]
master
0 2 0
terkhen - 14 years ago 2011-01-04 21:01:29
terkhen@openttd.org
(svn r21723) -Add: Enable/Disable all buttons to the owner view of the smallmap.
2 files changed with 38 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -704,12 +704,14 @@ STR_SMALLMAP_TOWN                       
 
STR_SMALLMAP_DISABLE_ALL                                        :{BLACK}Disable all
 
STR_SMALLMAP_ENABLE_ALL                                         :{BLACK}Enable all
 
STR_SMALLMAP_SHOW_HEIGHT                                        :{BLACK}Show height
 
STR_SMALLMAP_TOOLTIP_DISABLE_ALL_INDUSTRIES                     :{BLACK}Display no industries on the map
 
STR_SMALLMAP_TOOLTIP_ENABLE_ALL_INDUSTRIES                      :{BLACK}Display all industries on the map
 
STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT                                :{BLACK}Toggle display of heightmap
 
STR_SMALLMAP_TOOLTIP_DISABLE_ALL_COMPANIES                      :{BLACK}Display no company property on the map
 
STR_SMALLMAP_TOOLTIP_ENABLE_ALL_COMPANIES                       :{BLACK}Display all company property on the map
 

	
 
# Status bar messages
 
STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS                            :{BLACK}Show last message or news report
 
STR_STATUSBAR_COMPANY_NAME                                      :{SILVER}- -  {COMPANY}  - -
 
STR_STATUSBAR_PAUSED                                            :{YELLOW}*  *  PAUSED  *  *
 
STR_STATUSBAR_AUTOSAVE                                          :{RED}AUTOSAVE
src/smallmap_gui.cpp
Show inline comments
 
@@ -1010,26 +1010,42 @@ class SmallMapWindow : public Window {
 
	/**
 
	 * Function to set up widgets depending on the information being shown on the smallmap.
 
	 */
 
	void SetupWidgetData()
 
	{
 
		StringID legend_tooltip;
 
		StringID enable_all_tooltip;
 
		StringID disable_all_tooltip;
 
		int plane;
 
		switch (this->map_type) {
 
			case SMT_INDUSTRY:
 
				legend_tooltip = STR_SMALLMAP_TOOLTIP_INDUSTRY_SELECTION;
 
				enable_all_tooltip = STR_SMALLMAP_TOOLTIP_ENABLE_ALL_INDUSTRIES;
 
				disable_all_tooltip = STR_SMALLMAP_TOOLTIP_DISABLE_ALL_INDUSTRIES;
 
				plane = 0;
 
				break;
 

	
 
			case SMT_OWNER:
 
				legend_tooltip = STR_SMALLMAP_TOOLTIP_COMPANY_SELECTION;
 
				enable_all_tooltip = STR_SMALLMAP_TOOLTIP_ENABLE_ALL_COMPANIES;
 
				disable_all_tooltip = STR_SMALLMAP_TOOLTIP_DISABLE_ALL_COMPANIES;
 
				plane = 0;
 
				break;
 

	
 
			default:
 
				legend_tooltip = STR_NULL;
 
				enable_all_tooltip = STR_NULL;
 
				disable_all_tooltip = STR_NULL;
 
				plane = 1;
 
				break;
 
		}
 

	
 
		this->GetWidget<NWidgetCore>(SM_WIDGET_LEGEND)->SetDataTip(STR_NULL, legend_tooltip);
 
		this->GetWidget<NWidgetCore>(SM_WIDGET_ENABLE_ALL)->SetDataTip(STR_SMALLMAP_ENABLE_ALL, enable_all_tooltip);
 
		this->GetWidget<NWidgetCore>(SM_WIDGET_DISABLE_ALL)->SetDataTip(STR_SMALLMAP_DISABLE_ALL, disable_all_tooltip);
 
		this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECT_BUTTONS)->SetDisplayedPlane(plane);
 
	}
 

	
 
public:
 
	uint min_number_of_columns;    ///< Minimal number of columns in legends.
 

	
 
	SmallMapWindow(const WindowDesc *desc, int window_number) : Window(), refresh(FORCE_REFRESH_PERIOD)
 
@@ -1039,13 +1055,12 @@ public:
 

	
 
		_smallmap_industry_show_heightmap = false;
 
		BuildLandLegend();
 
		this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap);
 

	
 
		this->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns);
 
		this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECT_BUTTONS)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
 

	
 
		this->SetupWidgetData();
 

	
 
		this->SetZoomLevel(ZLC_INITIALIZE, NULL);
 
		this->SmallMapCenterOnCurrentPos();
 
	}
 
@@ -1208,15 +1223,12 @@ public:
 
	void SwitchMapType(SmallMapType map_type)
 
	{
 
		this->RaiseWidget(this->map_type + SM_WIDGET_CONTOUR);
 
		this->map_type = map_type;
 
		this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR);
 

	
 
		/* Hide Enable all/Disable all buttons if is not industry type small map */
 
		this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECT_BUTTONS)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
 

	
 
		this->SetupWidgetData();
 

	
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
@@ -1361,22 +1373,34 @@ public:
 
						}
 
					}
 
					this->SetDirty();
 
				}
 
				break;
 

	
 
			case SM_WIDGET_ENABLE_ALL: // Enable all industries
 
				for (int i = 0; i != _smallmap_industry_count; i++) {
 
					_legend_from_industries[i].show_on_map = true;
 
			case SM_WIDGET_ENABLE_ALL:
 
				if (this->map_type == SMT_INDUSTRY) {
 
					for (int i = 0; i != _smallmap_industry_count; i++) {
 
						_legend_from_industries[i].show_on_map = true;
 
					}
 
				} else if (this->map_type == SMT_OWNER) {
 
					for (int i = NUM_NO_COMPANY_ENTRIES; i != _smallmap_company_count; i++) {
 
						_legend_land_owners[i].show_on_map = true;
 
					}
 
				}
 
				this->SetDirty();
 
				break;
 

	
 
			case SM_WIDGET_DISABLE_ALL: // Disable all industries
 
				for (int i = 0; i != _smallmap_industry_count; i++) {
 
					_legend_from_industries[i].show_on_map = false;
 
			case SM_WIDGET_DISABLE_ALL:
 
				if (this->map_type == SMT_INDUSTRY) {
 
					for (int i = 0; i != _smallmap_industry_count; i++) {
 
						_legend_from_industries[i].show_on_map = false;
 
					}
 
				} else {
 
					for (int i = NUM_NO_COMPANY_ENTRIES; i != _smallmap_company_count; i++) {
 
						_legend_land_owners[i].show_on_map = false;
 
					}
 
				}
 
				this->SetDirty();
 
				break;
 

	
 
			case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap.
 
				_smallmap_industry_show_heightmap = !_smallmap_industry_show_heightmap;
 
@@ -1645,14 +1669,14 @@ static const NWidgetPart _nested_smallma
 
	/* Bottom button row and resize box. */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_PANEL, COLOUR_BROWN),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECT_BUTTONS),
 
					NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLE_ALL), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_SMALLMAP_TOOLTIP_ENABLE_ALL_INDUSTRIES),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLE_ALL), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_SMALLMAP_TOOLTIP_DISABLE_ALL_INDUSTRIES),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLE_ALL), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_NULL),
 
						NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLE_ALL), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_NULL),
 
						NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_SHOW_HEIGHT), SetDataTip(STR_SMALLMAP_SHOW_HEIGHT, STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT),
 
					EndContainer(),
 
					NWidget(NWID_SPACER), SetFill(1, 1),
 
				EndContainer(),
 
				NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			EndContainer(),
0 comments (0 inline, 0 general)