alsa.audio: limit the supported frequencies to common set
[AROS.git] / workbench / libs / asl / eraserclass.c
blob038e719a343be8404840ed1814eda7bc29b58d4b
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <proto/alib.h>
10 #include <proto/exec.h>
11 #include <proto/utility.h>
12 #include <proto/intuition.h>
13 #include <proto/graphics.h>
14 #include <proto/layers.h>
16 #include <exec/memory.h>
17 #include <intuition/screens.h>
18 #include <intuition/cghooks.h>
19 #include <intuition/imageclass.h>
20 #include <intuition/gadgetclass.h>
21 #include <graphics/gfx.h>
23 #include <string.h>
25 #include "asl_intern.h"
26 #include "layout.h"
28 #define SDEBUG 0
29 #define DEBUG 0
31 #include <aros/debug.h>
34 #ifdef __MORPHOS__
35 #ifndef NewRectRegion
36 #define NewRectRegion(_MinX,_MinY,_MaxX,_MaxY) \
37 ({ struct Region *_region; \
38 if ((_region = NewRegion())) \
39 { struct Rectangle _rect; \
40 _rect.MinX = _MinX; \
41 _rect.MinY = _MinY; \
42 _rect.MaxX = _MaxX; \
43 _rect.MaxY = _MaxY; \
44 if (!OrRectRegion(_region, &_rect)) { DisposeRegion(_region); _region = NULL; } \
45 } \
46 _region; \
48 #endif
49 #endif
52 #define CLASS_ASLBASE ((struct AslBase_intern *)cl->cl_UserData)
53 #define HOOK_ASLBASE ((struct AslBase_intern *)hook->h_Data)
55 #define AslBase CLASS_ASLBASE
57 /********************** ASL ERASER CLASS **************************************************/
59 IPTR AslEraser__OM_NEW(Class * cl, Object * o, struct opSet * msg)
61 struct Gadget *g = (struct Gadget *)DoSuperMethodA(cl, o, (Msg)msg);
63 if (g)
65 g->Flags |= GFLG_RELSPECIAL;
67 g->LeftEdge = 20000;
68 g->TopEdge = 20000;
69 g->Width = 1;
70 g->Height = 1;
72 } /* if (g) */
74 return (IPTR)g;
77 /***********************************************************************************/
79 IPTR AslEraser__GM_HITTEST(Class *cl, Object *o, struct gpHitTest *msg)
81 return 0;
85 /***********************************************************************************/
87 IPTR AslEraser__GM_RENDER(Class *cl, Object *o, struct gpRender *msg)
89 WORD x, y, w, h, x2, y2;
91 if (msg->gpr_Redraw == GREDRAW_REDRAW)
93 struct Window *win = msg->gpr_GInfo->gi_Window;
94 struct RastPort *rp = msg->gpr_RPort;
95 struct Region *clip;
97 if ((clip = NewRectRegion(win->BorderLeft,
98 win->BorderTop,
99 win->Width - 1 - win->BorderRight,
100 win->Height - 1 - win->BorderBottom)))
102 struct Gadget *g = win->FirstGadget;
103 struct RegionRectangle *rr;
105 while(g)
107 struct Rectangle rect;
109 getgadgetbounds(g, msg->gpr_GInfo, &x, &y, &w, &h);
111 rect.MinX = x;
112 rect.MinY = y;
113 rect.MaxX = x + w - 1;
114 rect.MaxY = y + h - 1;
116 ClearRectRegion(clip, &rect);
118 g = g->NextGadget;
122 SetABPenDrMd(rp, msg->gpr_GInfo->gi_DrInfo->dri_Pens[BACKGROUNDPEN], 0, JAM2);
123 rr = clip->RegionRectangle;
124 while(rr)
126 x = clip->bounds.MinX + rr->bounds.MinX;
127 y = clip->bounds.MinY + rr->bounds.MinY;
128 x2 = clip->bounds.MinX + rr->bounds.MaxX;
129 y2 = clip->bounds.MinY + rr->bounds.MaxY;
131 RectFill(rp, x, y, x2, y2);
133 rr = rr->Next;
136 DisposeRegion(clip);
140 } /* if (msg->gpr_Redraw == GREDRAW_REDRAW) */
142 return 0;
145 /***********************************************************************************/