Shade rail station selection window

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Shade rail station selection window

Post by andythenorth »

With UI zoom, rail station selection window obscures most of the screen on my viewport, making construction hard.

This patch adds the shade widget to that window.
Hard to build stations eh?
Hard to build stations eh?
shade_rail_station_selection.png (346.23 KiB) Viewed 1432 times

Code: Select all

diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 3a903fb..6763c6a 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1028,21 +1028,23 @@ public:
 
 		this->DrawWidgets();
 
-		/* 'Accepts' and 'Supplies' texts. */
-		NWidgetBase *cov = this->GetWidget<NWidgetBase>(WID_BRAS_COVERAGE_TEXTS);
-		int top = cov->pos_y + WD_PAR_VSEP_NORMAL;
-		int left = cov->pos_x + WD_FRAMERECT_LEFT;
-		int right = cov->pos_x + cov->current_x - WD_FRAMERECT_RIGHT;
-		int bottom = cov->pos_y + cov->current_y;
-		top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
-		top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
-		/* Resize background if the window is too small.
-		 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
-		 * (This is the case, if making the window bigger moves the mouse into the window.) */
-		if (top > bottom) {
-			this->coverage_height += top - bottom;
-			this->ReInit();
-		}
+        if (!this->IsShaded()) {
+            /* 'Accepts' and 'Supplies' texts. */
+            NWidgetBase *cov = this->GetWidget<NWidgetBase>(WID_BRAS_COVERAGE_TEXTS);
+            int top = cov->pos_y + WD_PAR_VSEP_NORMAL;
+            int left = cov->pos_x + WD_FRAMERECT_LEFT;
+            int right = cov->pos_x + cov->current_x - WD_FRAMERECT_RIGHT;
+            int bottom = cov->pos_y + cov->current_y;
+            top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
+            top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
+            /* Resize background if the window is too small.
+             * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
+             * (This is the case, if making the window bigger moves the mouse into the window.) */
+            if (top > bottom) {
+                this->coverage_height += top - bottom;
+                this->ReInit();
+            }
+        }
 	}
 
 	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
@@ -1377,6 +1379,7 @@ static const NWidgetPart _nested_station_builder_widgets[] = {
 	NWidget(NWID_HORIZONTAL),
 		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_RAIL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+		NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
 		NWidget(NWID_SELECTION, INVALID_COLOUR, WID_BRAS_SHOW_NEWST_DEFSIZE),
 			NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
 		EndContainer(),
User avatar
kamnet
Moderator
Moderator
Posts: 8585
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Shade rail station selection window

Post by kamnet »

This really should just go straight into trunk and get backported to the next OpenTTD 1.6.x update.
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Shade rail station selection window

Post by Eddi »

features will never get backported to the last release.
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Shade rail station selection window

Post by adf88 »

kamnet wrote:This really should just go straight into trunk
No, it shouldn't. The station picker should be made an independent window. It was done for object picker, see r27346 and r27438.
andythenorth wrote:

Code: Select all

diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp...
It's a bad way of publishing patches (turns tabs into spaces). Upload a diff next time!
:] don't worry, be happy and checkout my patches
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google Adsense [Bot] and 24 guests