Changeset - r20382:ecce2523226d
[Not reviewed]
master
0 4 0
frosch - 11 years ago 2013-06-11 18:36:26
frosch@openttd.org
(svn r25395) -Fix [FS#5596]: The size of station construction windows could oscillate when resizing the window moved the mouse into the window.
4 files changed with 16 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -388,14 +388,16 @@ public:
 

	
 
			/* strings such as 'Size' and 'Coverage Area' */
 
			top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
 
			top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
 
		}
 

	
 
		/* Resize background if the text is not equally long as the window. */
 
		if (top > bottom || (top < bottom && panel_nwi->current_y > panel_nwi->smallest_y)) {
 
		/* 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) {
 
			ResizeWindow(this, 0, top - bottom);
 
		}
 
	}
 

	
 
	void SelectOtherAirport(int airport_index)
 
	{
src/dock_gui.cpp
Show inline comments
 
@@ -419,14 +419,16 @@ public:
 
		int top = this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->pos_y + this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->current_y + WD_PAR_VSEP_NORMAL;
 
		NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(BDSW_BACKGROUND);
 
		int right  = back_nwi->pos_x + back_nwi->current_x;
 
		int bottom = back_nwi->pos_y + back_nwi->current_y;
 
		top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
 
		top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
 
		/* Resize background if the text is not equally long as the window. */
 
		if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) {
 
		/* 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) {
 
			ResizeWindow(this, 0, top - bottom);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
src/rail_gui.cpp
Show inline comments
 
@@ -1009,14 +1009,16 @@ public:
 
		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 the coverage text space if the text is not equally long as the window. */
 
		if (top != bottom) {
 
		/* 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)
src/road_gui.cpp
Show inline comments
 
@@ -969,14 +969,16 @@ struct BuildRoadStationWindow : public P
 
		int top = this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->pos_y + this->GetWidget<NWidgetBase>(WID_BROS_LT_ON)->current_y + WD_PAR_VSEP_NORMAL;
 
		NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(WID_BROS_BACKGROUND);
 
		int right = back_nwi->pos_x +  back_nwi->current_x;
 
		int bottom = back_nwi->pos_y +  back_nwi->current_y;
 
		top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL;
 
		top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL;
 
		/* Resize background if the text is not equally long as the window. */
 
		if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) {
 
		/* 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) {
 
			ResizeWindow(this, 0, top - bottom);
 
		}
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
0 comments (0 inline, 0 general)