2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 #include <intuition/intuition.h>
9 #include <intuition/intuitionbase.h>
10 #include <intuition/screens.h>
11 #include <graphics/clip.h>
12 #include <graphics/rastport.h>
13 #include <proto/exec.h>
14 #include <proto/dos.h>
15 #include <proto/graphics.h>
16 #include <proto/alib.h>
21 #define ARG_TEMPLATE "FAST=F/S,NUMBERS=N/S"
27 static struct Screen
*scr
;
28 static struct Window
*win
;
29 static struct Layer
*lay
;
30 static struct RDArgs
*MyArgs
;
31 static IPTR Args
[NUM_ARGS
];
33 static jmp_buf exit_buf
;
35 static void Cleanup(char *msg
)
41 Printf("crlist: %s\n",msg
);
47 if (MyArgs
) FreeArgs(MyArgs
);
50 longjmp(exit_buf
, rc
);
53 static void GetArguments(void)
55 if (!(MyArgs
= ReadArgs(ARG_TEMPLATE
,Args
,0)))
57 Fault(IoErr(),0,s
,255);
62 static void Action(void)
64 extern struct IntuitionBase
*IntuitionBase
;
67 WORD x
, y
, i
, count
= 0;
69 PutStr("Activate the window whose cliprects you want to see.\n");
70 PutStr("You have 3 seconds of time!\n\n");
74 win
= IntuitionBase
->ActiveWindow
;
76 if (!win
) Cleanup("No active window!");
80 if (!(rp
= CloneRastPort(&scr
->RastPort
)))
82 Cleanup("Can´t clone screen rastport!");
91 Printf("#%04ld (%4ld,%4ld) - (%4ld, %4ld) Size: %4ld x %4ld %s%s\n",
97 cr
->bounds
.MaxX
- cr
->bounds
.MinX
+ 1,
98 cr
->bounds
.MaxY
- cr
->bounds
.MinY
+ 1,
99 (cr
->lobs
? "HIDDEN " : ""),
100 (cr
->BitMap
? "BITMAP ": ""));
102 for(i
= 0; i
< (Args
[ARG_FAST
] ? 1 : 8);i
++)
104 SetAPen(rp
,1 + (i
& 1));
105 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MinY
,cr
->bounds
.MaxX
,cr
->bounds
.MinY
);
106 RectFill(rp
,cr
->bounds
.MaxX
,cr
->bounds
.MinY
,cr
->bounds
.MaxX
,cr
->bounds
.MaxY
);
107 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MaxY
,cr
->bounds
.MaxX
,cr
->bounds
.MaxY
);
108 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MinY
,cr
->bounds
.MinX
,cr
->bounds
.MaxY
);
110 if (!Args
[ARG_FAST
]) Delay(10);
113 if (Args
[ARG_NUMBERS
])
115 __sprintf(s
,"%d",count
);
116 i
= TextLength(rp
,s
,strlen(s
));
118 x
= (cr
->bounds
.MinX
+ cr
->bounds
.MaxX
- i
) / 2;
119 y
= (cr
->bounds
.MinY
+ cr
->bounds
.MaxY
- rp
->TxHeight
) / 2;
124 } else if (x
>= scr
->Width
- i
)
126 x
= scr
->Width
- i
- 1;
132 } else if (y
>= scr
->Height
- rp
->TxHeight
)
134 y
= scr
->Height
- rp
->TxHeight
- 1;
140 Move(rp
,x
+ 1, y
+ 1 + rp
->TxBaseline
);
144 Move(rp
,x
, y
+ rp
->TxBaseline
);
157 if ((rc
= setjmp(exit_buf
)) != 0)