4 Original GPL release version 4.12
5 Copyright 1993-2000 Jonathan Potter
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 All users of Directory Opus 4 (including versions distributed
22 under the GPL) are entitled to upgrade to the latest version of
23 Directory Opus version 5 at a reduced price. Please see
24 http://www.gpsoft.com.au for more information.
26 The release of Directory Opus 4 under the GPL in NO WAY affects
27 the existing commercial status of Directory Opus 5.
32 #include <dopus/dopusbase.h>
35 extern __chip UWORD pdb_cycletop
[];
36 extern __chip UWORD pdb_cyclebot
[];
37 extern __chip UWORD pdb_check
[];
39 struct Image
* __regargs
get_image_data(struct DOpusRemember
**key
,int width
,int height
,int depth
,struct BitMap
*bm
,struct RastPort
*rp
)
47 if (!(image
=DoAllocRemember(key
,sizeof(struct Image
),MEMF_CLEAR
)) ||
48 !(data
=DoAllocRemember(key
,words
*2*height
*depth
,MEMF_CHIP
|MEMF_CLEAR
)))
51 InitBitMap(bm
,depth
,width
,height
);
52 for (a
=0;a
<depth
;a
++) bm
->Planes
[a
]=(PLANEPTR
)&data
[words
*height
*a
];
59 image
->ImageData
=data
;
60 image
->PlanePick
=(1<<depth
)-1;
65 __inline void drawline(rp,x1,y1,x2,y2)
73 #define drawline(rp,x1,y1,x2,y2) Move(rp,x1,y1);Draw(rp,x2,y2)
75 void __saveds
Do3DBox(register struct RastPort
*rp
__asm("a0"),register int x
__asm("d0"),register int y
__asm("d1"),register int w
__asm("d2"),register int h
__asm("d3"),register int tp
__asm("d4"),register int bp
__asm("d5"))
77 //D(bug("Do3DBox()\n"));
80 drawline(rp
,x
-2,y
-1,x
+w
,y
-1);
81 drawline(rp
,x
-2,y
-1,x
-2,y
+h
);
82 drawline(rp
,x
-1,y
-1,x
-1,y
+h
-1);
86 drawline(rp
,x
-1,y
+h
,x
+w
+1,y
+h
);
89 drawline(rp
,x
+w
,y
+h
,x
+w
,y
);
92 void __saveds
Do3DStringBox(register struct RastPort
*rp
__asm("a0"),register int x
__asm("d0"),register int y
__asm("d1"),register int w
__asm("d2"),register int h
__asm("d3"),register int tp
__asm("d4"),register int bp
__asm("d5"))
94 //D(bug("Do3DStringBox()\n"));
95 Do3DBox(rp
,x
-2,y
-1,w
+4,h
+2,tp
,bp
);
99 drawline(rp
,x
-2,y
-1,x
+w
+1,y
-1);
100 drawline(rp
,x
-2,y
-1,x
-2,y
+h
+1);
101 drawline(rp
,x
-1,y
-1,x
-1,y
+h
-1);
105 drawline(rp
,x
-1,y
+h
,x
+w
+1,y
+h
);
108 drawline(rp
,x
+w
,y
+h
,x
+w
,y
);
111 void __saveds
Do3DCycleBox(register struct RastPort
*rp
__asm("a0"),register int x
__asm("d0"),register int y
__asm("d1"),register int w
__asm("d2"),register int h
__asm("d3"),register int tp
__asm("d4"),register int bp
__asm("d5"))
115 //D(bug("Do3DCycleBox(%lx,%lx)\n",pdb_cycletop,pdb_cyclebot));
116 Do3DBox(rp
,x
,y
,w
,h
,tp
,bp
);
118 old_drmd
= GetDrMd(rp
);
123 if (/*DOpusBase->*/pdb_cycletop
)
125 BltTemplate(/*DOpusBase->*/pdb_cycletop
,0,2,rp
,x
+4,y
+1,11,6);
127 if (/*DOpusBase->*/pdb_cyclebot
)
129 BltTemplate(/*DOpusBase->*/pdb_cyclebot
,0,2,rp
,x
+4,y
+1+h
-12+7,11,2);
132 drawline(rp
,x
+4,y
+7,x
+4,/*y+7+*/y
+1+h
-12+7/*-12*/);
133 drawline(rp
,x
+5,y
+7,x
+5,/*y+7+*/y
+1+h
-12+7/*-12*/);
134 drawline(rp
,x
+18,y
+1,x
+18,y
+h
-2);
138 drawline(rp
,x
+19,y
+1,x
+19,y
+h
-2);
140 SetDrMd(rp
,old_drmd
);
143 void __saveds
DrawCheckMark(register struct RastPort
*rp
__asm("a0"),register int x
__asm("d0"),register int y
__asm("d1"),register int clear
__asm("d2"))
146 UBYTE old_drmd
= GetDrMd(rp
);
148 D(bug("DrawCheckMark(%lx)\n",pdb_check
));
153 old_apen
= GetAPen(rp
);
154 SetAPen(rp
,GetBPen(rp
));
156 if (/*DOpusBase->*/pdb_check
)
158 BltTemplate(/*DOpusBase->*/pdb_check
,0,2,rp
,x
,y
,13,7);
162 SetAPen(rp
,old_apen
);
164 SetDrMd(rp
,old_drmd
);
167 void __saveds
DoDoArrow(register struct RastPort
*p
__asm("a0"), register int x
__asm("d0"), register int y
__asm("d1"), register int w
__asm("d2"), register int h
__asm("d3"), register int fg
__asm("d4"), register int bg
__asm("d5"), register int d
__asm("d6"))
169 int x1
,y1
,x2
,y2
,x3
,y3
,x4
,y4
,xb
;
173 RectFill(p
,x
,y
,xb
-1,y
+h
-1);
212 drawline(p
,x1
,y1
,x3
,y3
);
213 drawline(p
,x2
,y2
,x4
,y4
);
216 void __saveds
DoDrawRadioButton(register struct RastPort
*rp
__asm("a0"), register int x
__asm("d0"), register int y
__asm("d1"), register int w
__asm("d2"), register int h
__asm("d3"), register int hi
__asm("d4"), register int lo
__asm("d5"))
219 drawline(rp
,x
,y
-1,x
+w
-3,y
-1);
220 drawline(rp
,x
-1,y
,x
,y
);
221 drawline(rp
,x
-2,y
+1,x
-2,y
+h
-4);
222 drawline(rp
,x
-1,y
+1,x
-1,y
+h
-4);
223 drawline(rp
,x
-1,y
+h
-3,x
,y
+h
-3);
225 drawline(rp
,x
,y
+h
-2,x
+w
-3,y
+h
-2);
226 drawline(rp
,x
+w
-3,y
+h
-3,x
+w
-2,y
+h
-3);
227 drawline(rp
,x
+w
-1,y
+h
-4,x
+w
-1,y
+1);
228 drawline(rp
,x
+w
-2,y
+h
-4,x
+w
-2,y
+1);
229 drawline(rp
,x
+w
-3,y
,x
+w
-2,y
);
232 __saveds
struct Image
*DoGetButtonImage(register int w
__asm("d0"), register int h
__asm("d1"), register int fg
__asm("d2"), register int bg
__asm("d3"), register int fpen
__asm("d4"), register int bpen
__asm("d5"), register struct DOpusRemember
**key
__asm("a0"))
244 for (a
=0;a
<8;a
++) if (b
&(1<<a
)) depth
=a
+1;
246 if (!(image
=get_image_data(key
,w
,h
,depth
,&tbm
,&trp
))) return(NULL
);
249 RectFill(&trp
,0,0,w
-1,h
-1);
250 DoDrawRadioButton(&trp
,2,1,w
-4,h
,(fpen
!=bpen
)?bg
:fg
,(fpen
!=bpen
)?fg
:bg
);
251 if (w
>10 && h
>4 && fpen
!=bpen
) {
253 RectFill(&trp
,4,2,w
-7,h
-3);
255 WritePixel(&trp
,4,2);
256 WritePixel(&trp
,4,h
-3);
257 WritePixel(&trp
,w
-7,2);
258 WritePixel(&trp
,w
-7,h
-3);
266 __saveds
struct Image
*DoGetCheckImage(register UBYTE fg
__asm("d0"), register UBYTE bg
__asm("d1"), register int pen
__asm("d2"), register struct DOpusRemember
**key
__asm("a0"))
273 D(bug("DoGetCheckImage: fg = %ld, bg = %ld\n",fg
,bg
));
276 for (a
=0;a
<8;a
++) if (b
&(1<<a
)) depth
=a
+1;
278 if (!(image
=get_image_data(key
,13,7,depth
,&tbm
,&trp
))) return(NULL
);
282 RectFill(&trp
,0,0,12,6);
285 BltTemplate(/*(char *)DOpusBase->*/pdb_check
,0,2,&trp
,0,0,13,7);
293 void __saveds
DoDo3DFrame(register struct RastPort
*rp
__asm("a0"), register int x
__asm("d0"), register int y
__asm("d1"), register int w
__asm("d2"), register int h
__asm("d3"), register char *title
__asm("a1"), register int hi
__asm("d4"), register int lo
__asm("d5"))
298 of
=rp
->FgPen
; ob
=rp
->BgPen
;
299 Do3DBox(rp
,x
+2,y
+1,w
-4,h
-2,lo
,hi
);
300 Do3DBox(rp
,x
+4,y
+2,w
-8,h
-4,hi
,lo
);
301 SetAPen(rp
,of
); SetBPen(rp
,ob
);
304 x
+=((w
-(l
=(TextLength(rp
,title
,a
))))/2);
307 x
-rp
->Font
->tf_XSize
/2,y
+2-rp
->Font
->tf_Baseline
,
308 x
+l
+rp
->Font
->tf_XSize
/2,y
+2-rp
->Font
->tf_Baseline
+rp
->Font
->tf_YSize
);
310 Move(rp
,x
,y
+2); Text(rp
,title
,a
);
314 extern UWORD __chip glass_image1
[];
315 extern UWORD __chip glass_image2
[];
317 void __saveds
DoDoGlassImage(register struct RastPort
*rp
__asm("a0"), register struct Gadget
*gadget
__asm("a1"), register int shine
__asm("d0"), register int shadow
__asm("d1"), register int type
__asm("d2"))
322 om
=rp
->DrawMode
; op
=rp
->FgPen
;
326 x
=gadget
->LeftEdge
+((gadget
->Width
-16)/2);
327 y
=gadget
->TopEdge
+((gadget
->Height
-8)/2);
330 BltTemplate((char *)glass_image2
,0,2,rp
,x
,y
,16,8);
332 BltTemplate((char *)glass_image1
,0,2,rp
,x
,y
,16,8);