disable debug
[AROS.git] / rom / intuition / screenposition.c
blob6692fa9481ffe9c5d3d39bc8bcc127bb2950e2ca
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 <proto/graphics.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/intuition.h>
16 AROS_LH6(void, ScreenPosition,
18 /* SYNOPSIS */
19 AROS_LHA(struct Screen *, screen, A0),
20 AROS_LHA(ULONG , flags, D0),
21 AROS_LHA(LONG , x1, D1),
22 AROS_LHA(LONG , y1, D2),
23 AROS_LHA(LONG , x2, D3),
24 AROS_LHA(LONG , y2, D4),
26 /* LOCATION */
27 struct IntuitionBase *, IntuitionBase, 132, Intuition)
29 /* FUNCTION
30 Move a screen to the specified position or by the specified
31 increment. Resolution is always the screen resolution.
32 If this move would be out of bounds, the move is clipped at
33 these boundaries. The real new position can be obtained from
34 LeftEdge and TopEdge of the screen's structure.
36 INPUTS
37 screen - Move this screen
38 flags - One of SPOS_RELATIVE, SPOS_ABSOLUTE or SPOS_MAKEVISIBLE
39 Use SPOS_FORCEDRAG to override non-movable screens ie. screens
40 opened with {SA_Draggable,FLASE} attribute.
42 SPOS_RELATIVE (or NULL) moves the screen by a delta of x1,y1.
44 SPOS_ABSOLUTE moves the screen to the specified position x1,y1.
46 SPOS_MAKEVISIBLE moves an oversized scrolling screen to make
47 the rectangle (x1,y1),(x2,y2) visible
48 x1,y1 - Absolute (SPOS_ABSOLUTE) or relative (SPOS_RELATIVE) coordinate
49 to move screen, or upper-left corner of rectangle
50 (SPOS_MAKEVISIBLE)
51 x2,y2 - Ignored with SPOS_ABSOLUTE and SPOS_RELATIVE.
52 Lower-right corner of rectangle with SPOS_MAKEVISIBLE.
54 RESULT
55 None.
57 NOTES
58 SPOS_FORCEDRAG should only be used by the owner of the screen.
60 EXAMPLE
62 BUGS
64 SEE ALSO
65 MoveScreen(), RethinkDisplay()
67 INTERNALS
69 *****************************************************************************/
71 AROS_LIBFUNC_INIT
73 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
75 if ((flags & SPOS_FORCEDRAG) || (GetPrivScreen(screen)->SpecialFlags & SF_Draggable)) {
77 /* First we update the viewport, then attempt to scroll. The bitmap may refuse to scroll
78 too far, in this case offsets in the ViewPort will be adjusted to reflect the real situation.
79 TODO: check if additional bounding has to be implemented. Graphics driver could for example let
80 to scroll the bitmap completely out of the display. */
81 if (flags & SPOS_ABSOLUTE) {
82 D(bug("[ScreenPosition] Absolute position: (%d, %d)\n", x1, y1));
83 screen->ViewPort.DxOffset = x1;
84 screen->ViewPort.DyOffset = y1;
85 } else {
86 D(bug("[ScreenPosition] Relative position: (%d, %d)\n", x1, y1));
87 screen->ViewPort.DxOffset = screen->LeftEdge + x1;
88 screen->ViewPort.DyOffset = screen->TopEdge + y1;
90 D(bug("[ScreenPosition] Scroll to: (%d, %d)\n",screen->ViewPort.DxOffset, screen->ViewPort.DyOffset));
91 ScrollVPort(&screen->ViewPort);
93 /* Bring back the actual resulting values to our screen structure */
94 D(bug("[ScreenPosition] Scroll result: (%d, %d)\n",screen->ViewPort.DxOffset, screen->ViewPort.DyOffset));
95 screen->LeftEdge = screen->ViewPort.DxOffset;
96 screen->TopEdge = screen->ViewPort.DyOffset;
99 AROS_LIBFUNC_EXIT
100 } /* ScreenPosition */