diff options
author | alberth <alberth@openttd.org> | 2009-11-07 17:24:04 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-11-07 17:24:04 +0000 |
commit | 0bc03c25f48b6abce53cb43d71b31334d3f5bf35 (patch) | |
tree | 3a2fb874963ceb2b4499ed863b014b7692a124e0 /src/misc_gui.cpp | |
parent | b500170ac2e286b1fe5a6c8529f1f963cd05ecdf (diff) | |
download | openttd-0bc03c25f48b6abce53cb43d71b31334d3f5bf35.tar.xz |
(svn r17997) -Codechange: Introduce functions for querying top and bottom of the main view.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r-- | src/misc_gui.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index aad9ecbf8..eea17b11e 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -588,13 +588,11 @@ public: return pt; } - /* Find the screen part between the main toolbar at the top, and the statusbar at the bottom. + /* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom. * Add a fixed distance 20 to make it less cluttered. */ - const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = ((w != NULL) ? w->top + w->height : 0) + 20; - w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = ((w != NULL) ? w->top : _screen.height) - 20; + int scr_top = GetMainViewTop() + 20; + int scr_bot = GetMainViewBottom() - 20; Point pt = RemapCoords2(this->position.x, this->position.y); const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; @@ -805,13 +803,11 @@ struct TooltipsWindow : public Window virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) { - /* Find the screen part between the main toolbar at the top, and the statusbar at the bottom. + /* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom. * Add a fixed distance 2 so the tooltip floats free from both bars. */ - const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = ((w != NULL) ? w->top + w->height : 0) + 2; - w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = ((w != NULL) ? w->top : _screen.height) - 2; + int scr_top = GetMainViewTop() + 2; + int scr_bot = GetMainViewBottom() - 2; Point pt; |