Changeset - r4650:9c69a2b23c16
[Not reviewed]
master
0 1 0
bjarni - 18 years ago 2006-09-27 13:53:59
bjarni@openttd.org
(svn r6526) -Codechange: [depot window] the train only widgets are now resized depending on the size of other widgets
This will ensure that say the horizontal scrollbar is as wide as the matrix even if only the matrix is altered in size
This is meant to make it easier to add more widgets without coding a lot of vehicle type specific stuff (you should still check all windows though)
1 file changed with 20 insertions and 2 deletions:
0 comments (0 inline, 0 general)
depot_gui.c
Show inline comments
 
@@ -82,7 +82,10 @@ static const byte widget_moves[] = {
 
 * Keep the widget numbers in sync with the enum or really bad stuff will happen!!! */
 

	
 
/* When adding widgets, place them as you would place them for the ship depot and define how you want it to move in widget_moves[]
 
 * If you want a widget for one window only, set it to be hidden in ShowDepotWindow() for the windows where you don't want it */
 
 * If you want a widget for one window only, set it to be hidden in ShowDepotWindow() for the windows where you don't want it
 
 * NOTE: the train only widgets are moved/resized in ShowDepotWindow() so they follow certain other widgets if they are moved to ensure that they stick together.
 
 *    Changing the size of those here will not have an effect at all. It should be done in ShowDepotWindow()
 
 */
 
static const Widget _depot_widgets[] = {
 
	{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,            STR_018B_CLOSE_WINDOW},            // DEPOT_WIDGET_CLOSEBOX
 
	{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   292,     0,    13, 0x0,                 STR_018C_WINDOW_TITLE_DRAG_THIS},  // DEPOT_WIDGET_CAPTION
 
@@ -759,7 +762,6 @@ void ShowDepotWindow(TileIndex tile, byt
 
				w->hscroll.cap = 10 * 29;
 
				w->resize.step_width = 1;
 
				w->resize.step_height = 14;
 
				w->widget[DEPOT_WIDGET_MATRIX].bottom -= 12; // Make room for the horizontal scrollbar
 
				break;
 

	
 
			case VEH_Road:
 
@@ -812,6 +814,22 @@ void ShowDepotWindow(TileIndex tile, byt
 
				if (widget_moves[i] & WIDGET_DEPOT_MOVE_BOTTOM) w->widget[i].bottom += vertical;
 
			}
 
		}
 

	
 
		if (type == VEH_Train) {
 
			/* Now we move the train only widgets so they are placed correctly
 
			 * Doing it here will ensure that they move if the widget they are placed on top of/aligned to are moved */
 

	
 
			/* DEPOT_WIDGET_H_SCROLL is placed in the lowest part of DEPOT_WIDGET_MATRIX */
 
			w->widget[DEPOT_WIDGET_H_SCROLL].left = w->widget[DEPOT_WIDGET_MATRIX].left;
 
			w->widget[DEPOT_WIDGET_H_SCROLL].right = w->widget[DEPOT_WIDGET_MATRIX].right;
 
			w->widget[DEPOT_WIDGET_H_SCROLL].bottom = w->widget[DEPOT_WIDGET_MATRIX].bottom;
 
			w->widget[DEPOT_WIDGET_H_SCROLL].top = w->widget[DEPOT_WIDGET_MATRIX].bottom - 11;
 
			w->widget[DEPOT_WIDGET_MATRIX].bottom -= 12;
 

	
 
			/* DEPOT_WIDGET_SELL_ALL is under DEPOT_WIDGET_SELL. They got the same left and right and height is controlled in ResizeDepotButtons() */
 
			w->widget[DEPOT_WIDGET_SELL_ALL].left = w->widget[DEPOT_WIDGET_SELL].left;
 
			w->widget[DEPOT_WIDGET_SELL_ALL].right = w->widget[DEPOT_WIDGET_SELL].right;
 
		}
 
		ResizeDepotButtons(w);
 
	}
 
}
0 comments (0 inline, 0 general)