|
@@ -36,27 +36,27 @@ enum SmallMapWindowWidgets {
|
|
|
SM_WIDGET_MAP, ///< Panel containing the smallmap.
|
|
|
SM_WIDGET_LEGEND, ///< Bottom panel to display smallmap legends.
|
|
|
SM_WIDGET_ZOOM_IN, ///< Button to zoom in one step.
|
|
|
SM_WIDGET_ZOOM_OUT, ///< Button to zoom out one step.
|
|
|
SM_WIDGET_CONTOUR, ///< Button to select the contour view (height map).
|
|
|
SM_WIDGET_VEHICLES, ///< Button to select the vehicles view.
|
|
|
SM_WIDGET_INDUSTRIES, ///< Button to select the industries view.
|
|
|
SM_WIDGET_ROUTES, ///< Button to select the routes view.
|
|
|
SM_WIDGET_VEGETATION, ///< Button to select the vegetation view.
|
|
|
SM_WIDGET_OWNERS, ///< Button to select the owners view.
|
|
|
SM_WIDGET_CENTERMAP, ///< Button to move smallmap center to main window center.
|
|
|
SM_WIDGET_TOGGLETOWNNAME, ///< Toggle button to display town names.
|
|
|
SM_WIDGET_SELECTINDUSTRIES, ///< Selection widget for the buttons at the industry mode.
|
|
|
SM_WIDGET_ENABLEINDUSTRIES, ///< Button to enable display of all industries.
|
|
|
SM_WIDGET_DISABLEINDUSTRIES, ///< Button to disable display of all industries.
|
|
|
SM_WIDGET_SELECT_BUTTONS, ///< Selection widget for the buttons present in some smallmap modes.
|
|
|
SM_WIDGET_ENABLE_ALL, ///< Button to enable display of all legend entries.
|
|
|
SM_WIDGET_DISABLE_ALL, ///< Button to disable display of all legend entries.
|
|
|
SM_WIDGET_SHOW_HEIGHT, ///< Show heightmap toggle button.
|
|
|
};
|
|
|
|
|
|
static int _smallmap_industry_count; ///< Number of used industries
|
|
|
static int _smallmap_company_count; ///< Number of entries in the owner legend.
|
|
|
|
|
|
static const int NUM_NO_COMPANY_ENTRIES = 4; ///< Number of entries in the owner legend that are not companies.
|
|
|
|
|
|
/** Macro for ordinary entry of LegendAndColour */
|
|
|
#define MK(a, b) {a, b, {INVALID_INDUSTRYTYPE}, true, false, false}
|
|
|
|
|
|
/** Macro for a height legend entry with configurable colour. */
|
|
@@ -1033,25 +1033,25 @@ public:
|
|
|
uint min_number_of_columns; ///< Minimal number of columns in legends.
|
|
|
|
|
|
SmallMapWindow(const WindowDesc *desc, int window_number) : Window(), refresh(FORCE_REFRESH_PERIOD)
|
|
|
{
|
|
|
this->InitNested(desc, window_number);
|
|
|
this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR);
|
|
|
|
|
|
_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_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
|
|
|
this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECT_BUTTONS)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
|
|
|
|
|
|
this->SetupWidgetData();
|
|
|
|
|
|
this->SetZoomLevel(ZLC_INITIALIZE, NULL);
|
|
|
this->SmallMapCenterOnCurrentPos();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Compute minimal required width of the legends.
|
|
|
* @return Minimally needed width for displaying the smallmap legends in pixels.
|
|
|
*/
|
|
|
inline uint GetMinLegendWidth() const
|
|
@@ -1203,25 +1203,25 @@ public:
|
|
|
|
|
|
/**
|
|
|
* Select a new map type.
|
|
|
* @param map_type New map type.
|
|
|
*/
|
|
|
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_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
|
|
|
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)
|
|
|
{
|
|
|
/* User clicked something, notify the industry chain window to stop sending newly selected industries. */
|
|
|
InvalidateWindowClassesData(WC_INDUSTRY_CARGOES, NUM_INDUSTRYTYPES);
|
|
|
|
|
|
switch (widget) {
|
|
@@ -1355,32 +1355,32 @@ public:
|
|
|
for (int i = NUM_NO_COMPANY_ENTRIES; i != _smallmap_company_count; i++) {
|
|
|
_legend_land_owners[i].show_on_map = true;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
_legend_land_owners[company_pos].show_on_map = !_legend_land_owners[company_pos].show_on_map;
|
|
|
}
|
|
|
}
|
|
|
this->SetDirty();
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case SM_WIDGET_ENABLEINDUSTRIES: // Enable all industries
|
|
|
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;
|
|
|
}
|
|
|
this->SetDirty();
|
|
|
break;
|
|
|
|
|
|
case SM_WIDGET_DISABLEINDUSTRIES: // Disable all industries
|
|
|
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;
|
|
|
}
|
|
|
this->SetDirty();
|
|
|
break;
|
|
|
|
|
|
case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap.
|
|
|
_smallmap_industry_show_heightmap = !_smallmap_industry_show_heightmap;
|
|
|
this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap);
|
|
|
this->SetDirty();
|
|
|
break;
|
|
|
}
|
|
@@ -1637,28 +1637,28 @@ static NWidgetBase *SmallMapDisplay(int
|
|
|
static const NWidgetPart _nested_smallmap_widgets[] = {
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
|
|
|
NWidget(WWT_CAPTION, COLOUR_BROWN, SM_WIDGET_CAPTION), SetDataTip(STR_SMALLMAP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
|
|
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
|
|
|
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
|
|
|
EndContainer(),
|
|
|
NWidgetFunction(SmallMapDisplay), // Smallmap display and legend bar + image buttons.
|
|
|
/* Bottom button row and resize box. */
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
NWidget(WWT_PANEL, COLOUR_BROWN),
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECTINDUSTRIES),
|
|
|
NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECT_BUTTONS),
|
|
|
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLEINDUSTRIES), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_SMALLMAP_TOOLTIP_ENABLE_ALL),
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLEINDUSTRIES), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_SMALLMAP_TOOLTIP_DISABLE_ALL),
|
|
|
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_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(),
|
|
|
EndContainer(),
|
|
|
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
|
|
|
EndContainer(),
|
|
|
};
|
|
|
|
|
|
static const WindowDesc _smallmap_desc(
|