add some more debug. bump versions of components being adapted for 64bit support.
[AROS.git] / rom / intuition / zipwindow.c
blobd29a79b5fedc38cb1507409f1548e2a623f4ee18
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include "inputhandler_actions.h"
10 struct ZipWindowActionMsg
12 struct IntuiActionMsg msg;
13 struct Window *window;
16 static VOID int_zipwindow(struct ZipWindowActionMsg *msg,
17 struct IntuitionBase *IntuitionBase);
19 /*****************************************************************************
21 NAME */
22 #include <intuition/intuition.h>
23 #include <proto/intuition.h>
25 AROS_LH1(void, ZipWindow,
27 /* SYNOPSIS */
28 AROS_LHA(struct Window *, window, A0),
30 /* LOCATION */
31 struct IntuitionBase *, IntuitionBase, 84, Intuition)
33 /* FUNCTION
34 "Zip" (move and resize) a window to the coordinates and dimensions
35 the window had at the last call of ZipWindow(), or invoked via the
36 zoom-gadget.
38 INPUTS
39 window - Which window
41 RESULT
42 None.
44 NOTES
45 This call is deferred. Wait() for IDCMP_CHANGEWINDOW if your
46 program depends on the new size.
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 ChangeWindowBox(), MoveWindow(), SizeWindow()
55 INTERNALS
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct ZipWindowActionMsg msg;
63 DEBUG_ZIPWINDOW(dprintf("ZipWindow(Window 0x%lx)\n",window));
65 SANITY_CHECK(window)
67 msg.window = window;
69 DoASyncAction((APTR)int_zipwindow, &msg.msg, sizeof(msg), IntuitionBase);
70 // DoSyncAction((APTR)int_zipwindow, &msg.msg, IntuitionBase);
72 AROS_LIBFUNC_EXIT
74 } /* ZipWindow */
77 static VOID int_zipwindow(struct ZipWindowActionMsg *msg,
78 struct IntuitionBase *IntuitionBase)
80 struct Window *window = msg->window;
81 struct IntWindow *w = (struct IntWindow *)window;
82 LONG NewLeftEdge, NewTopEdge, NewWidth, NewHeight;
84 if (!ResourceExisting(window, RESOURCE_WINDOW, IntuitionBase)) return;
86 NewLeftEdge = window->LeftEdge;
87 if (w->ZipLeftEdge != ~0)
89 NewLeftEdge = w->ZipLeftEdge;
90 #ifdef __MORPHOS__
91 w->ZipLeftEdge = w->window.LeftEdge;
92 #else
93 w->ZipLeftEdge = w->window.RelLeftEdge;
94 #endif
97 NewTopEdge = window->TopEdge;
98 if (w->ZipTopEdge != ~0)
100 NewTopEdge = w->ZipTopEdge;
101 #ifdef __MORPHOS__
102 w->ZipTopEdge = w->window.TopEdge;
103 #else
104 w->ZipTopEdge = w->window.RelTopEdge;
105 # endif
108 NewWidth = window->Width;
109 if (w->ZipWidth != ~0)
111 NewWidth = w->ZipWidth;
112 if (window->Flags & WFLG_SIZEGADGET)
114 if (NewWidth < (ULONG)window->MinWidth) NewWidth = window->MinWidth;
115 if (NewWidth > (ULONG)window->MaxWidth) NewWidth = window->MaxWidth;
117 w->ZipWidth = w->window.Width;
120 NewHeight = window->Height;
121 if (w->ZipHeight != ~0)
123 NewHeight = w->ZipHeight;
124 if (window->Flags & WFLG_SIZEGADGET)
126 if (NewHeight < (ULONG)window->MinHeight) NewHeight = window->MinHeight;
127 if (NewHeight > (ULONG)window->MaxHeight) NewHeight = window->MaxHeight;
129 w->ZipHeight = w->window.Height;
132 DoMoveSizeWindow(window, NewLeftEdge, NewTopEdge, NewWidth, NewHeight, TRUE, IntuitionBase);
134 if (window->Flags & WFLG_ZOOMED)
135 AROS_ATOMIC_AND(window->Flags, ~WFLG_ZOOMED);
136 else
137 AROS_ATOMIC_OR(window->Flags, WFLG_ZOOMED);