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>
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
];
34 static void Cleanup(char *msg
)
40 Printf("crlist: %s\n",msg
);
46 if (MyArgs
) FreeArgs(MyArgs
);
50 static void GetArguments(void)
52 if (!(MyArgs
= ReadArgs(ARG_TEMPLATE
,Args
,0)))
54 Fault(IoErr(),0,s
,255);
59 static void Action(void)
61 extern struct IntuitionBase
*IntuitionBase
;
64 WORD x
, y
, i
, count
= 0;
66 puts("Activate the window whose cliprects you want to see.\n");
67 puts("You have 3 seconds of time!\n\n");
71 win
= IntuitionBase
->ActiveWindow
;
73 if (!win
) Cleanup("No active window!");
77 if (!(rp
= CloneRastPort(&scr
->RastPort
)))
79 Cleanup("Can´t clone screen rastport!");
88 Printf("#%04ld (%4ld,%4ld) - (%4ld, %4ld) Size: %4ld x %4ld %s%s\n",
94 cr
->bounds
.MaxX
- cr
->bounds
.MinX
+ 1,
95 cr
->bounds
.MaxY
- cr
->bounds
.MinY
+ 1,
96 (cr
->lobs
? "HIDDEN " : ""),
97 (cr
->BitMap
? "BITMAP ": ""));
99 for(i
= 0; i
< (Args
[ARG_FAST
] ? 1 : 8);i
++)
101 SetAPen(rp
,1 + (i
& 1));
102 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MinY
,cr
->bounds
.MaxX
,cr
->bounds
.MinY
);
103 RectFill(rp
,cr
->bounds
.MaxX
,cr
->bounds
.MinY
,cr
->bounds
.MaxX
,cr
->bounds
.MaxY
);
104 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MaxY
,cr
->bounds
.MaxX
,cr
->bounds
.MaxY
);
105 RectFill(rp
,cr
->bounds
.MinX
,cr
->bounds
.MinY
,cr
->bounds
.MinX
,cr
->bounds
.MaxY
);
107 if (!Args
[ARG_FAST
]) Delay(10);
110 if (Args
[ARG_NUMBERS
])
112 sprintf(s
,"%d",count
);
113 i
= TextLength(rp
,s
,strlen(s
));
115 x
= (cr
->bounds
.MinX
+ cr
->bounds
.MaxX
- i
) / 2;
116 y
= (cr
->bounds
.MinY
+ cr
->bounds
.MaxY
- rp
->TxHeight
) / 2;
121 } else if (x
>= scr
->Width
- i
)
123 x
= scr
->Width
- i
- 1;
129 } else if (y
>= scr
->Height
- rp
->TxHeight
)
131 y
= scr
->Height
- rp
->TxHeight
- 1;
137 Move(rp
,x
+ 1, y
+ 1 + rp
->TxBaseline
);
141 Move(rp
,x
, y
+ rp
->TxBaseline
);