Changeset - r24648:785f19c9ce86
[Not reviewed]
master
0 3 0
frosch - 3 years ago 2020-12-27 22:25:43
frosch@openttd.org
Add: a go-to-location button to the LandInfo window.
3 files changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2627,12 +2627,13 @@ STR_INDUSTRY_CARGOES_SELECT_CARGO       
 
STR_INDUSTRY_CARGOES_SELECT_CARGO_TOOLTIP                       :{BLACK}Select the cargo you want to display
 
STR_INDUSTRY_CARGOES_SELECT_INDUSTRY                            :{BLACK}Select industry
 
STR_INDUSTRY_CARGOES_SELECT_INDUSTRY_TOOLTIP                    :{BLACK}Select the industry you want to display
 

	
 
# Land area window
 
STR_LAND_AREA_INFORMATION_CAPTION                               :{WHITE}Land Area Information
 
STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP                      :{BLACK}Centre the main view on tile location. Ctrl+Click opens a new viewport on tile location
 
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A                     :{BLACK}Cost to clear: {LTBLUE}N/A
 
STR_LAND_AREA_INFORMATION_COST_TO_CLEAR                         :{BLACK}Cost to clear: {RED}{CURRENCY_LONG}
 
STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED                  :{BLACK}Revenue when cleared: {LTBLUE}{CURRENCY_LONG}
 
STR_LAND_AREA_INFORMATION_OWNER_N_A                             :N/A
 
STR_LAND_AREA_INFORMATION_OWNER                                 :{BLACK}Owner: {LTBLUE}{STRING1}
 
STR_LAND_AREA_INFORMATION_ROAD_OWNER                            :{BLACK}Road owner: {LTBLUE}{STRING1}
src/misc_gui.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
#include "window_func.h"
 
#include "querystring_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "newgrf_debug.h"
 
#include "zoom_func.h"
 
#include "guitimer_func.h"
 
#include "viewport_func.h"
 
#include "rev.h"
 

	
 
#include "widgets/misc_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
@@ -43,12 +44,13 @@ enum OskActivation {
 

	
 

	
 
static const NWidgetPart _nested_land_info_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_LI_LOCATION), SetMinimalSize(12, 14), SetDataTip(SPR_GOTO_LOCATION, STR_LAND_AREA_INFORMATION_LOCATION_TOOLTIP),
 
		NWidget(WWT_DEBUGBOX, COLOUR_GREY),
 
	EndContainer(),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(),
 
};
 

	
 
static WindowDesc _land_info_desc(
 
@@ -358,12 +360,25 @@ public:
 

	
 
	void ShowNewGRFInspectWindow() const override
 
	{
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), this->tile);
 
	}
 

	
 
	void OnClick(Point pt, int widget, int click_count) override
 
	{
 
		switch (widget) {
 
			case WID_LI_LOCATION:
 
				if (_ctrl_pressed) {
 
					ShowExtraViewportWindow(this->tile);
 
				} else {
 
					ScrollMainWindowToTile(this->tile);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
 
	 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
 
	 */
 
	void OnInvalidateData(int data = 0, bool gui_scope = true) override
src/widgets/misc_widget.h
Show inline comments
 
@@ -9,12 +9,13 @@
 

	
 
#ifndef WIDGETS_MISC_WIDGET_H
 
#define WIDGETS_MISC_WIDGET_H
 

	
 
/** Widgets of the #LandInfoWindow class. */
 
enum LandInfoWidgets {
 
	WID_LI_LOCATION, ///< Scroll to location.
 
	WID_LI_BACKGROUND, ///< Background of the window.
 
};
 

	
 
/** Widgets of the #TooltipsWindow class. */
 
enum ToolTipsWidgets {
 
	WID_TT_BACKGROUND, ///< Background of the window.
0 comments (0 inline, 0 general)