diff options
author | frosch <frosch@openttd.org> | 2013-05-26 19:24:37 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-05-26 19:24:37 +0000 |
commit | 8c4714ad9099308691059f0a7a3cd6bbd33ce538 (patch) | |
tree | fd9e200b41664a8b401a6873fd71f31ccdc5d1f8 | |
parent | b6d76c4d4cc3c8b00993aa6d035e79ffa133985e (diff) | |
download | openttd-8c4714ad9099308691059f0a7a3cd6bbd33ce538.tar.xz |
(svn r25289) -Codechange: Store width of statusbar and main toolbar directly in the WindowDesc.
-rw-r--r-- | src/statusbar_gui.cpp | 2 | ||||
-rw-r--r-- | src/statusbar_gui.h | 2 | ||||
-rw-r--r-- | src/toolbar_gui.cpp | 8 | ||||
-rw-r--r-- | src/toolbar_gui.h | 2 | ||||
-rw-r--r-- | src/window.cpp | 4 |
5 files changed, 4 insertions, 14 deletions
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 67c664da8..9e24d781d 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -251,8 +251,6 @@ bool IsNewsTickerShown() return w != NULL && w->ticker_scroll < StatusBarWindow::TICKER_STOP; } -int16 *_preferred_statusbar_size = &_main_status_desc.default_width; ///< Pointer to the default size for the status toolbar. - /** * Show our status bar. */ diff --git a/src/statusbar_gui.h b/src/statusbar_gui.h index b55a88c83..574a75c73 100644 --- a/src/statusbar_gui.h +++ b/src/statusbar_gui.h @@ -25,6 +25,4 @@ enum StatusBarInvalidate { bool IsNewsTickerShown(); void ShowStatusBar(); -extern int16 *_preferred_statusbar_size; - #endif /* STATUSBAR_GUI_H */ diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 0d3bffc0d..70326b682 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1203,8 +1203,6 @@ static MenuClickedProc * const _menu_clicked_procs[] = { MenuClickHelp, // 26 }; -int16 *_preferred_toolbar_size = NULL; ///< Pointer to the default size for the main toolbar. - /** Full blown container to make it behave exactly as we want :) */ class NWidgetToolbarContainer : public NWidgetContainer { bool visible[WID_TN_END]; ///< The visible headers @@ -1256,7 +1254,7 @@ public: child_wid->current_x = child_wid->smallest_x; } } - *_preferred_toolbar_size = nbuttons * this->smallest_x; + w->window_desc->default_width = nbuttons * this->smallest_x; } void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) @@ -1428,7 +1426,7 @@ class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer { assert(i < lengthof(this->panel_widths)); this->panel_widths[i++] = child_wid->current_x; - *_preferred_toolbar_size += child_wid->current_x; + w->window_desc->default_width += child_wid->current_x; } } @@ -2111,10 +2109,8 @@ void AllocateToolbar() _last_built_roadtype = ROADTYPE_ROAD; if (_game_mode == GM_EDITOR) { - _preferred_toolbar_size = &_toolb_scen_desc.default_width; new ScenarioEditorToolbarWindow(&_toolb_scen_desc); } else { - _preferred_toolbar_size = &_toolb_normal_desc.default_width; new MainToolbarWindow(&_toolb_normal_desc); } } diff --git a/src/toolbar_gui.h b/src/toolbar_gui.h index 1d5390048..d3eba5b27 100644 --- a/src/toolbar_gui.h +++ b/src/toolbar_gui.h @@ -16,6 +16,4 @@ void AllocateToolbar(); void ToggleBoundingBoxes(); void ToggleDirtyBlocks(); -extern int16 *_preferred_toolbar_size; - #endif /* TOOLBAR_GUI_H */ diff --git a/src/window.cpp b/src/window.cpp index 8b429ef9f..8e6a05028 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3126,7 +3126,7 @@ void RelocateAllWindows(int neww, int newh) continue; case WC_MAIN_TOOLBAR: - ResizeWindow(w, min(neww, *_preferred_toolbar_size) - w->width, 0, false); + ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false); top = w->top; left = PositionMainToolbar(w); // changes toolbar orientation @@ -3138,7 +3138,7 @@ void RelocateAllWindows(int neww, int newh) break; case WC_STATUS_BAR: - ResizeWindow(w, min(neww, *_preferred_statusbar_size) - w->width, 0, false); + ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false); top = newh - w->height; left = PositionStatusbar(w); |