diff options
author | rubidium <rubidium@openttd.org> | 2009-11-28 14:30:00 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-28 14:30:00 +0000 |
commit | 6a367fda8a7f8e563310f7254d612dbb0010d919 (patch) | |
tree | b4ce5effc9523320c78bde57d6ab55eefd2c2f16 /src/window.cpp | |
parent | a825349bf108aa99b6080c3bceb35e8b3c75cc97 (diff) | |
download | openttd-6a367fda8a7f8e563310f7254d612dbb0010d919.tar.xz |
(svn r18320) -Codechange: make the terraform and transparency window not use absolute location but manually calculate based on toolbar size etc.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/window.cpp b/src/window.cpp index a5a057cfc..28f6fddf5 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1052,6 +1052,20 @@ restart: } /** + * Computer the position of the top-left corner of a window to be opened right + * under the toolbar. + * @param window_width the width of the window to get the position for + * @return Coordinate of the top-left corner of the new window. + */ +Point GetToolbarAlignedWindowPosition(int window_width) +{ + const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); + assert(w != NULL); + Point pt = { _dynlang.text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height }; + return pt; +} + +/** * Compute the position of the top-left corner of a new window that is opened. * * By default position a child window at an offset of 10/10 of its parent. @@ -1071,7 +1085,7 @@ restart: static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) { Point pt; - Window *w; + const Window *w; int16 default_width = max(desc->default_width, sm_width); int16 default_height = max(desc->default_height, sm_height); |