=== modified file 'src/window.cpp' --- src/window.cpp 2008-05-10 12:45:29 +0000 +++ src/window.cpp 2008-05-10 12:52:19 +0000 @@ -681,19 +681,16 @@ * This function is called the constructors. * See descriptions for those functions for usage * Only addition here is window_number, which is the window_number being assigned to the new window - * @param x offset in pixels from the left of the screen - * @param y offset in pixels from the top of the screen + * @param pd Position and size of the new window * @param min_width minimum width in pixels of the window * @param min_height minimum height in pixels of the window - * @param def_width default width in pixels of the window - * @param def_height default height in pixels of the window * @param *proc see WindowProc function to call when any messages/updates happen to the window * @param cls see WindowClass class of the window, used for identification and grouping * @param *widget see Widget pointer to the window layout and various elements * @param window_number number being assigned to the new window * @param data the data to be given during the WE_CREATE message * @return Window pointer of the newly created window */ -void Window::Initialize(int x, int y, int min_width, int min_height, int def_width, int def_height, +void Window::Initialize(const PointDimension &pd, int min_width, int min_height, WindowProc *proc, WindowClass cls, const Widget *widget, int window_number, void *data) { /* We have run out of windows, close one and use that as the place for our new one */ @@ -707,8 +704,8 @@ this->window_class = cls; this->flags4 = WF_WHITE_BORDER_MASK; // just opened windows have a white border this->caption_color = 0xFF; - this->left = x; - this->top = y; + this->left = pd.x; + this->top = pd.y; this->width = min_width; this->height = min_height; this->wndproc = proc; @@ -751,7 +748,7 @@ * but this way the GUIs can be made a little more dynamic; * one can use the same spec for multiple windows and those * can then determine the real minimum size of the window. */ - if (this->width != def_width || this->height != def_height) { + if (this->width != pd.width || this->height != pd.height) { /* Think about the overlapping toolbars when determining the minimum window size */ int free_height = _screen.height; const Window *wt = FindWindowById(WC_STATUS_BAR, 0); @@ -759,8 +756,8 @@ wt = FindWindowById(WC_MAIN_TOOLBAR, 0); if (wt != NULL) free_height -= wt->height; - int enlarge_x = max(min(def_width - this->width, _screen.width - this->width), 0); - int enlarge_y = max(min(def_height - this->height, free_height - this->height), 0); + int enlarge_x = max(min(pd.width - this->width, _screen.width - this->width), 0); + int enlarge_y = max(min(pd.height - this->height, free_height - this->height), 0); /* X and Y has to go by step.. calculate it. * The cast to int is necessary else x/y are implicitly casted to @@ -785,7 +782,7 @@ if (nx + this->width > _screen.width) nx -= (nx + this->width - _screen.width); const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - ny = max(ny, (wt == NULL || this == wt || y == 0) ? 0 : wt->height); + ny = max(ny, (wt == NULL || this == wt || pd.y == 0) ? 0 : wt->height); nx = max(nx, 0); if (this->viewport != NULL) { @@ -814,7 +811,8 @@ */ Window::Window(int x, int y, int width, int height, WindowProc *proc, WindowClass cls, const Widget *widget, void *data) { - this->Initialize(x, y, width, height, width, height, proc, cls, widget, 0, data); + PointDimension pd = { x, y, width, height }; + this->Initialize(pd, width, height, proc, cls, widget, 0, data); } @@ -1015,7 +1013,7 @@ Window::Window(const WindowDesc *desc, void *data, WindowNumber window_number) { PointDimension pd = LocalGetWindowPlacement(desc, window_number); - this->Initialize(pd.x, pd.y, desc->minimum_width, desc->minimum_height, desc->default_width, desc->default_height, desc->proc, desc->cls, desc->widgets, window_number, data); + this->Initialize(pd, desc->minimum_width, desc->minimum_height, desc->proc, desc->cls, desc->widgets, window_number, data); this->desc_flags = desc->flags; } === modified file 'src/window_gui.h' --- src/window_gui.h 2008-05-10 11:36:57 +0000 +++ src/window_gui.h 2008-05-10 12:50:10 +0000 @@ -291,7 +291,7 @@ WindowProc *wndproc; ///< Event handler function for the window. Do not use directly, call HandleWindowEvent() instead. protected: - void Initialize(int x, int y, int min_width, int min_height, int def_width, int def_height, + void Initialize(const PointDimension &pd, int min_width, int min_height, WindowProc *proc, WindowClass cls, const Widget *widget, int window_number, void *data); public: