alsa.audio: limit the supported frequencies to common set
[AROS.git] / workbench / libs / popupmenu / pmgraph.c
blob6de6ea4de312ef0e0052218baf2d0173b8fc5936
1 //
2 // PopupMenu
3 // ©1996-2000 Henrik Isaksson
4 //
5 // Graphic rendering routines
6 //
8 #include "pmpriv.h"
11 // Generic PM_Window graphics
14 void PM_DrawBg(struct PM_Window *pw, int x, int y, int xb, int yb)
16 int xa = x, ya = y;
18 if(pw->bg.BgArray) {
19 WritePixelArray(pw->bg.BgArray, x, y,
20 pw->Width*3, pw->RPort, xa, ya,
21 xb-xa, yb-ya, RECTFMT_RGB);
23 } else {
24 SetAPen(pw->RPort, BGPEN(pw->p));
25 SetDrMd(pw->RPort, JAM1);
26 RectFill(pw->RPort, xa, ya, xb, yb);
30 void PM_RectFill(struct PM_Window *pw, int xa, int ya, int xb, int yb)
32 SetDrMd(pw->RPort, JAM1);
33 RectFill(pw->RPort, xa, ya, xb, yb);
36 void PM_Move(struct PM_Window *pw, int x, int y)
38 Move(pw->RPort, x, y);
41 void PM_Pixel(struct PM_Window *pw, int x, int y)
43 WritePixel(pw->RPort, x, y);
46 void PM_Draw(struct PM_Window *pw, int x, int y)
48 Draw(pw->RPort, x, y);
51 void PM_DrawImage(struct PM_Window *pw, struct Image *img, int x, int y, struct DrawInfo *dri, ULONG state)
53 DrawImageState(pw->RPort, img, x, y, state, dri);
57 // Ghost an item
60 void PM_Ghost(struct PM_Window *w, int x, int y, int xb, int yb, int pen)
62 static UWORD ghostpat[] = { 0x2222, 0x8888 };
64 SetAPen(w->RPort, pen);
65 SetAfPt(w->RPort, ghostpat, 1);
66 PM_RectFill(w, x, y, xb, yb);
67 SetAfPt(w->RPort, NULL, 0);
71 // Render a ColourBox
74 void ColourBox(struct PM_Window *w, int xa, int ya, int xb, int yb, int pen, int shine, int shade, BOOL selected)
76 if(selected) {
77 PM_DrawBox(w, xa, ya, xb, yb, shade, shine);
78 } else {
79 PM_DrawBox(w, xa, ya, xb, yb, shine, shade);
82 SetAPen(w->RPort, pen);
83 PM_RectFill(w, xa+1, ya+1, xb-1, yb-1);
87 // This is used by the other functions.
90 void PM_DI_SetTextPen(struct PM_Window *a, struct PopupMenu *pm)
92 SetAPen(a->RPort, TEXT(a->p));
93 if(pm->Flags&NPM_FILLTEXT) SetAPen(a->RPort, FILL(a->p));
94 if(pm->Flags&NPM_SHADOWTEXT) SetAPen(a->RPort, SHADOW(a->p));
95 if(pm->Flags&NPM_SHINETEXT) SetAPen(a->RPort, SHINE(a->p));
96 if(pm->Flags&NPM_HILITETEXT) SetAPen(a->RPort, HILITE(a->p));
97 if(pm->Flags&NPM_CUSTOMPEN) SetAPen(a->RPort, pm->TextPen);
100 ULONG PM_RenderCheckMark(struct PM_Window *a, struct PopupMenu *pm, BOOL Selected)
102 ULONG xoff=0;
104 if(pm->Flags&NPM_CHECKIT) { // Should this item have a checkmark?
106 if(pm->Flags&NPM_CHECKED) {
107 xoff=PM_Image_Draw(a,
108 pm->Exclude?PMIMG_EXCLUDE:PMIMG_CHECKMARK,
109 pm->Left+PM_Prefs->pmp_XSpace+1,
110 a->p->DrawInfo,
111 Selected?IDS_SELECTED:IDS_INACTIVESELECTED,
112 pm) + PM_Prefs->pmp_Intermediate;
113 } else {
115 xoff=PM_Image_Draw(a,
116 pm->Exclude?PMIMG_EXCLUDE:PMIMG_CHECKMARK,
117 pm->Left+PM_Prefs->pmp_XSpace+1,
118 a->p->DrawInfo,
119 Selected?IDS_NORMAL:IDS_INACTIVENORMAL,
120 pm);
122 xoff = PM_Image_Width(a->p, pm->Exclude?PMIMG_EXCLUDE:PMIMG_CHECKMARK, pm) + PM_Prefs->pmp_Intermediate;
127 return xoff+PM_Prefs->pmp_XSpace;
130 int PM_NewDrawItem(struct PM_Window *a, struct PopupMenu *pm, BOOL Selected, BOOL Disabled)
132 ULONG style, xoff;
133 STRPTR pmtitle=pm->Title;
135 if(pm->Flags&NPM_HIDDEN) return 0;
137 if(GET_TXTMODE(pm)==NPX_TXTLOCALE)
138 pmtitle=(STRPTR)CallHookA(a->p->LocaleHook, (Object *)pm, &pm->TitleID);
140 if(Selected) {
141 SetAPen(a->RPort, FILL(a->p));
142 PM_RectFill(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height);
144 // --- Test to see how it looks... --- //
145 //PM_DrawBg(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height);
146 //PM_DrawShadow(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height);
147 // --- //
149 } else {
150 PM_DrawBg(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height);
153 if(pm->Flags&NPM_GROUP) {
154 struct PopupMenu *pmp=pm->Sub;
156 if(pmp) do {
157 PM_NewDrawItem(a, pmp, Selected, Disabled);
158 pmp=pmp->Next;
159 } while(pmp);
160 return 0;
164 if(pm->Flags&NPM_HBAR_BIT) {
165 PM_ShortSeparator(a, pm);
166 return TRUE;
167 } else if(pm->Flags&NPM_WIDE_BAR_BIT) {
168 PM_WideSeparator(a, pm);
169 return TRUE;
172 if(!Selected) { // Use RastPort Pen
173 PM_DI_SetTextPen(a, pm);
176 /* Text style and font */
178 SetFont(a->RPort, a->p->MenuFont);
179 SetDrMd(a->RPort, JAM1);
181 style = 0;
183 if(pm->Flags&NPM_UNDERLINEDTEXT) style|=FSF_UNDERLINED;
184 if(pm->Flags&NPM_BOLDTEXT) style|=FSF_BOLD;
185 if(pm->Flags&NPM_ITALICTEXT) style|=FSF_ITALIC;
187 SetSoftStyle(a->RPort, style, ~0);
189 xoff=PM_RenderCheckMark(a, pm, Selected);
191 if(pm->Flags&NPM_COLOURBOX) {
192 if(pm->Flags&NPM_CHECKIT) {
193 if(pm->CommKey) {
194 int x1=(a->Width-3*a->RPort->Font->tf_XSize-PM_Prefs->pmp_XSpace-a->p->BorderWidth)-a->RPort->Font->tf_XSize;
196 x1-=a->RPort->Font->tf_XSize*3+PM_Prefs->pmp_Intermediate;
198 ColourBox(a, x1, pm->Top+PM_Prefs->pmp_YSpace+1, x1+3*a->RPort->Font->tf_XSize, pm->Top+pm->Height-PM_Prefs->pmp_YSpace-1, pm->CBox, SHINE(a->p), SHADOW(a->p), Selected);
199 } else {
200 int x1 = (pm->Width + pm->Left - 3*a->RPort->Font->tf_XSize - PM_Prefs->pmp_XSpace - a->p->BorderWidth);
201 ColourBox(a, x1, pm->Top + PM_Prefs->pmp_YSpace + 1,
202 x1 + 3*a->RPort->Font->tf_XSize, pm->Top + pm->Height - PM_Prefs->pmp_YSpace - 1,
203 pm->CBox, SHINE(a->p), SHADOW(a->p), Selected);
205 } else {
206 ColourBox(a, pm->Left+PM_Prefs->pmp_XSpace, pm->Top+PM_Prefs->pmp_YSpace+1, pm->Left+3*a->RPort->Font->tf_XSize, pm->Top+pm->Height-PM_Prefs->pmp_YSpace-1, pm->CBox, SHINE(a->p), SHADOW(a->p), Selected);
207 xoff+=PM_Prefs->pmp_XSpace+3*a->RPort->Font->tf_XSize;
211 if(!a->p->PullDown) {
212 if(pm->Sub) {
213 PM_Image_Draw(a,
214 PMIMG_SUBMENU,
215 -PM_Prefs->pmp_XSpace,
216 a->p->DrawInfo,
217 Selected?IDS_NORMAL:IDS_INACTIVENORMAL,
218 pm);
222 if(Selected) {
223 if(pm->Flags&NPM_ISIMAGE) {
224 if(pm->Images[1]) {
225 if(pm->Flags&NPM_CENTERED) {
226 PM_DrawImage(a, pm->Images[1],
227 pm->Left+PM_Prefs->pmp_XSpace+ (pm->Width/2-pm->Images[1]->Width/2)>xoff?pm->Width/2-pm->Images[1]->Width/2:xoff,
228 YPosImage_(a, pm, pm->Images[1]), a->p->DrawInfo, IDS_SELECTED);
229 } else {
230 PM_DrawImage(a, pm->Images[1], pm->Left+PM_Prefs->pmp_XSpace+xoff+a->IconColumn, YPosImage_(a, pm, pm->Images[1]), a->p->DrawInfo, IDS_SELECTED);
233 } else {
234 if(pm->Images[1]) {
235 WORD ixoff;
236 ixoff=a->IconColumn/2-pm->Images[1]->Width/2;
237 PM_DrawImage(a, pm->Images[1], pm->Left+PM_Prefs->pmp_XSpace+ixoff, YPosImage_(a, pm, pm->Images[1]), a->p->DrawInfo, IDS_SELECTED);
240 } else {
241 if(pm->Flags&NPM_ISIMAGE) {
242 if(pm->Images[0]) {
243 if(pm->Flags&NPM_CENTERED) {
244 PM_DrawImage(a, pm->Images[0],
245 pm->Left+PM_Prefs->pmp_XSpace+ (pm->Width/2-pm->Images[0]->Width/2)>xoff?pm->Width/2-pm->Images[0]->Width/2:xoff,
246 YPosImage_(a, pm, pm->Images[0]), a->p->DrawInfo, IDS_SELECTED);
247 } else {
248 PM_DrawImage(a, pm->Images[0], pm->Left+PM_Prefs->pmp_XSpace+xoff+a->IconColumn, YPosImage_(a, pm, pm->Images[0]), a->p->DrawInfo, IDS_NORMAL);
251 } else {
252 if(pm->Images[0]) {
253 WORD ixoff;
254 ixoff=a->IconColumn/2-pm->Images[0]->Width/2;
255 PM_DrawImage(a, pm->Images[0], pm->Left+PM_Prefs->pmp_XSpace+ixoff, YPosImage_(a, pm, pm->Images[0]), a->p->DrawInfo, IDS_NORMAL);
260 if(a->IconColumn) {
261 xoff+=a->IconColumn+PM_Prefs->pmp_Intermediate;
264 if(pm->Flags&NPM_CENTERED) {
265 int offs, tw;
267 tw=TextLength(a->RPort,pmtitle,strlen(pmtitle));
268 offs=pm->Width/2-tw/2;
270 if(xoff<offs) xoff=offs;
273 if((pm->Flags&NPM_DISABLED || Disabled) && !PM_Prefs->pmp_SeparatorBar) {
274 SetAPen(a->RPort, BGSHINE(a->p));
275 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm)+1);
276 if(pmtitle) Text(a->RPort, pmtitle, strlen(pmtitle));
277 } else if(pm->Flags&NPM_SHADOWED) {
278 SetAPen(a->RPort, TEXTSHADOW(a->p));
279 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm)+1);
280 if(pmtitle) Text(a->RPort, pmtitle, strlen(pmtitle));
281 } else if(pm->Flags&NPM_OUTLINED) {
282 if(pmtitle) {
283 SetAPen(a->RPort, TEXTOUTLINE(a->p));
284 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm)-1);
285 Text(a->RPort, pmtitle, strlen(pmtitle));
286 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm)+1);
287 Text(a->RPort, pmtitle, strlen(pmtitle));
288 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm)-1);
289 Text(a->RPort, pmtitle, strlen(pmtitle));
290 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm)+1);
291 Text(a->RPort, pmtitle, strlen(pmtitle));
292 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm)+1);
293 Text(a->RPort, pmtitle, strlen(pmtitle));
294 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm));
295 Text(a->RPort, pmtitle, strlen(pmtitle));
296 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm));
297 Text(a->RPort, pmtitle, strlen(pmtitle));
298 PM_Move(a, pm->Left+xoff, YPosText(a, pm)+1);
299 Text(a->RPort, pmtitle, strlen(pmtitle));
300 PM_Move(a, pm->Left+xoff, YPosText(a, pm)-1);
301 Text(a->RPort, pmtitle, strlen(pmtitle));
303 } else if(pm->Flags&NPM_EMBOSSED) {
304 if(pmtitle) {
305 SetAPen(a->RPort, SHINE(a->p));
306 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm)-1);
307 Text(a->RPort, pmtitle, strlen(pmtitle));
308 PM_Move(a, pm->Left+xoff-1, YPosText(a, pm));
309 Text(a->RPort, pmtitle, strlen(pmtitle));
310 PM_Move(a, pm->Left+xoff, YPosText(a, pm)-1);
311 Text(a->RPort, pmtitle, strlen(pmtitle));
312 SetAPen(a->RPort, SHADOW(a->p));
313 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm)+1);
314 Text(a->RPort, pmtitle, strlen(pmtitle));
315 PM_Move(a, pm->Left+xoff+1, YPosText(a, pm));
316 Text(a->RPort, pmtitle, strlen(pmtitle));
317 PM_Move(a, pm->Left+xoff, YPosText(a, pm)+1);
318 Text(a->RPort, pmtitle, strlen(pmtitle));
322 if(!Selected) {
323 PM_DI_SetTextPen(a, pm);
324 } else {
325 SetAPen(a->RPort, FTPEN(a->p));
328 if(pm->Flags&NPM_ISSELECTED) {
329 if(pm->Flags&NPM_CHECKIT) {
330 if((!(pm->Flags&NPM_CHECKED) && pm->Flags&NPM_INITIAL_CHECKED) ||
331 ((pm->Flags&NPM_CHECKED) && !(pm->Flags&NPM_INITIAL_CHECKED))) {
332 SetAPen(a->RPort, HILITE(a->p));
334 } else {
335 SetAPen(a->RPort, HILITE(a->p));
339 if(pm->CommKey) {
340 char x[2];
342 PM_Image_Draw(a,
343 PMIMG_AMIGAKEY,
344 -PM_Prefs->pmp_XSpace-a->RPort->Font->tf_XSize-PM_Prefs->pmp_Intermediate,
345 a->p->DrawInfo,
346 Selected?IDS_NORMAL:IDS_INACTIVENORMAL,
347 pm);
349 x[0]=pm->CommKey;
350 PM_Move(a, XPosLastCol(a), YPosText(a,pm));
351 Text(a->RPort, x, 1);
354 PM_Move(a, pm->Left+xoff, YPosText(a, pm));
355 if((pm->Flags&NPM_DISABLED || Disabled) && !PM_Prefs->pmp_SeparatorBar) SetAPen(a->RPort, BGSHADOW(a->p)); // Set text colour to 'bgminus' if disabled
356 if(pmtitle) Text(a->RPort, pmtitle, strlen(pmtitle));
358 if(PM_Prefs->pmp_SelItemBorder && Selected) {
359 if(PM_Prefs->pmp_MenuBorder==MAGIC_FRAME) {
360 if(PM_Prefs->pmp_SelItemBorder==1) /* Raised */
361 PM_DrawBoxMM2(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height, SHINE(a->p), SHADOW(a->p), HALF(a->p));
362 else
363 PM_DrawBoxMM2(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height, SHADOW(a->p), SHINE(a->p), HALF(a->p));
364 } else {
365 if(PM_Prefs->pmp_SelItemBorder==1) /* Raised */
366 PM_DrawBox(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height, SHINE(a->p), SHADOW(a->p));
367 else
368 PM_DrawBox(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height, SHADOW(a->p), SHINE(a->p));
372 if(pm->Flags&NPM_DISABLED && PM_Prefs->pmp_SeparatorBar) {
373 PM_Ghost(a, pm->Left, pm->Top, pm->Left+pm->Width, pm->Top+pm->Height, SHADOW(a->p));
376 return 0;
380 // Draw a horizontal bar
383 void PM_Separator(struct PM_Window *w, int x, int y, int x2, int shine, int shadow)
385 PM_Move(w, x, y-1);
386 SetAPen(w->RPort, shadow);
387 PM_Draw(w, x2, y-1);
388 PM_Move(w, x, y);
389 SetAPen(w->RPort, shine);
390 PM_Draw(w, x2, y);
393 void PM_XENSeparator(struct PM_Window *w, int x, int y, int x2, int shine, int shadow, int bgplus, int bgminus)
395 PM_Move(w, x+1, y-2);
396 SetAPen(w->RPort, bgminus);
397 PM_Draw(w, x2-1, y-2);
399 PM_Move(w, x, y-1);
400 SetAPen(w->RPort, shadow);
401 PM_Draw(w, x2, y-1);
403 PM_Move(w, x, y);
404 SetAPen(w->RPort, shine);
405 PM_Draw(w, x2, y);
407 PM_Move(w, x+1, y+1);
408 SetAPen(w->RPort, bgplus);
409 PM_Draw(w, x2-1, y+1);
412 void PM_XENSeparatorHalf(struct PM_Window *w, int x, int y, int x2, int shine, int shadow, int bgplus, int bgminus, int half)
414 PM_Move(w, x+1, y-2);
415 SetAPen(w->RPort, bgminus);
416 PM_Draw(w, x2-1, y-2);
418 PM_Move(w, x, y-1);
419 SetAPen(w->RPort, shadow);
420 PM_Draw(w, x2, y-1);
422 PM_Move(w, x, y);
423 SetAPen(w->RPort, shine);
424 PM_Draw(w, x2, y);
426 PM_Move(w, x+1, y+1);
427 SetAPen(w->RPort, bgplus);
428 PM_Draw(w, x2-1, y+1);
431 void PM_NewSeparator(struct PM_Window *w, int x, int y, int x2, int shine, int shadow)
433 PM_Move(w, x, y);
434 SetAPen(w->RPort, shadow);
435 PM_Draw(w, x, y-1);
436 PM_Draw(w, x2-1, y-1);
437 PM_Move(w, x+1, y);
438 SetAPen(w->RPort, shine);
439 PM_Draw(w, x2, y);
440 PM_Draw(w, x2, y-1);
443 void PM_OldSeparator(struct PM_Window *w, int x, int y, int x2, int shine, int shadow)
445 PM_Move(w, x, y-1);
446 SetAPen(w->RPort, shadow);
447 SetDrPt(w->RPort, 0xbbbb);
448 PM_Draw(w, x2, y-1);
450 PM_Move(w, x, y);
451 SetAPen(w->RPort, shadow);
452 SetDrPt(w->RPort, 0xeeee);
453 PM_Draw(w, x2, y);
455 SetDrPt(w->RPort, 0xffff);
458 void PM_ShortSeparator(struct PM_Window *a, struct PopupMenu *pm)
460 if(!PM_Prefs->pmp_SeparatorBar) {
461 if(PM_Prefs->pmp_MenuBorder==MAGIC_FRAME)
462 PM_NewSeparator(a, BarLeft(a, pm), BarTop(a, pm), BarRight(a, pm), BGSHINE(a->p), BGSHADOW(a->p));
463 else PM_NewSeparator(a, BarLeft(a, pm), BarTop(a, pm), BarRight(a, pm), SHINE(a->p), SHADOW(a->p));
464 } else PM_OldSeparator(a, BarLeft(a, pm), BarTop(a, pm), BarRight(a, pm), SHINE(a->p), SHADOW(a->p));
467 void PM_WideSeparator(struct PM_Window *a, struct PopupMenu *pm)
469 if(!PM_Prefs->pmp_SeparatorBar) {
470 if(PM_Prefs->pmp_MenuBorder==MAGIC_FRAME) {
471 PM_XENSeparatorHalf(a, 0, BarTop(a, pm), a->Width-2, SHINE(a->p), SHADOW(a->p), BGSHINE(a->p), BGSHADOW(a->p), HALF(a->p));
472 } else if(PM_Prefs->pmp_MenuBorder==DROPBOX_FRAME) {
473 PM_Move(a, a->p->BorderWidth-1, BarTop(a, pm)-2);
474 SetAPen(a->RPort, SHINE(a->p));
475 PM_Draw(a, a->Width-a->p->BorderWidth, BarTop(a, pm)-2);
476 PM_Move(a, a->p->BorderWidth-1, BarTop(a, pm)+1);
477 SetAPen(a->RPort, SHADOW(a->p));
478 PM_Draw(a, a->Width-a->p->BorderWidth, BarTop(a, pm)+1);
480 SetAPen(a->RPort, BGPEN(a->p));
481 PM_Move(a, a->p->BorderWidth-1, BarTop(a, pm)-1);
482 PM_Draw(a, a->p->BorderWidth-1, BarTop(a, pm));
483 PM_Move(a, a->Width-a->p->BorderWidth, BarTop(a, pm)-1);
484 PM_Draw(a, a->Width-a->p->BorderWidth, BarTop(a, pm));
485 } else {
486 PM_Separator(a, a->p->BorderWidth-1, BarTop(a, pm), a->Width-a->p->BorderWidth-1, SHINE(a->p), SHADOW(a->p));
488 } else {
489 SetAPen(a->RPort, SHADOW(a->p));
490 PM_Move(a, a->p->BorderWidth, BarTop(a, pm));
491 PM_Draw(a, a->Width-a->p->BorderWidth, BarTop(a, pm));
492 PM_Move(a, a->p->BorderWidth, BarTop(a, pm)+1);
493 PM_Draw(a, a->Width-a->p->BorderWidth, BarTop(a, pm)+1);
498 // Draw a bevel box
501 void PM_DrawBoxMM2(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow, int halfshine)
503 SetAPen(w->RPort, halfshine);
504 PM_Pixel(w, x1, y2);
505 PM_Pixel(w, x2, y1);
506 SetAPen(w->RPort, shine);
507 PM_Move(w, x1, y2-1);
508 PM_Draw(w, x1, y1);
509 PM_Draw(w, x2-1, y1);
510 SetAPen(w->RPort, shadow);
511 PM_Move(w, x1+1, y2);
512 PM_Draw(w, x2, y2);
513 PM_Draw(w, x2, y1+1);
516 void PM_DrawXENBoxMM2(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow, int bgplus, int bgminus, int halfshine)
518 SetAPen(w->RPort, shine);
519 PM_Move(w, x1, y2);
520 PM_Draw(w, x1, y1);
521 PM_Draw(w, x2, y1);
522 SetAPen(w->RPort, bgplus);
523 PM_Move(w, x1+1, y2-1);
524 PM_Draw(w, x1+1, y1+1);
525 PM_Draw(w, x2-1, y1+1);
526 SetAPen(w->RPort, shadow);
527 PM_Move(w, x1, y2);
528 PM_Draw(w, x2, y2);
529 PM_Draw(w, x2, y1);
530 SetAPen(w->RPort, bgminus);
531 PM_Move(w, x1+1, y2-1);
532 PM_Draw(w, x2-1, y2-1);
533 PM_Draw(w, x2-1, y1+1);
534 SetAPen(w->RPort, halfshine);
535 PM_Pixel(w, x1, y2);
536 PM_Pixel(w, x2, y1);
539 void PM_DrawBox(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow)
541 SetAPen(w->RPort, shine);
542 PM_Move(w, x1, y2-1);
543 PM_Draw(w, x1, y1);
544 PM_Draw(w, x2-1, y1);
545 SetAPen(w->RPort, shadow);
546 PM_Move(w, x1, y2);
547 PM_Draw(w, x2, y2);
548 PM_Draw(w, x2, y1);
552 void PM_DrawIBox(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow)
554 SetAPen(w->RPort, shadow);
555 PM_Move(w, x1, y2);
556 PM_Draw(w, x1, y1);
557 PM_Draw(w, x2, y1);
559 PM_Move(w, x1, y2);
560 PM_Draw(w, x2, y2);
561 PM_Draw(w, x2, y1);
563 PM_Move(w, x1+1, y1);
564 PM_Draw(w, x1+1, y2);
566 PM_Move(w, x2-1, y1);
567 PM_Draw(w, x2-1, y2);
570 void PM_DrawXENBox(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow, int bgplus, int bgminus)
572 SetAPen(w->RPort, shine);
573 PM_Move(w, x1, y2);
574 PM_Draw(w, x1, y1);
575 PM_Draw(w, x2, y1);
576 SetAPen(w->RPort, bgplus);
577 PM_Move(w, x1+1, y2-1);
578 PM_Draw(w, x1+1, y1+1);
579 PM_Draw(w, x2-1, y1+1);
580 SetAPen(w->RPort, shadow);
581 PM_Move(w, x1, y2);
582 PM_Draw(w, x2, y2);
583 PM_Draw(w, x2, y1);
584 SetAPen(w->RPort, bgminus);
585 PM_Move(w, x1+1, y2-1);
586 PM_Draw(w, x2-1, y2-1);
587 PM_Draw(w, x2-1, y1+1);
590 void PM_DrawDBLBox(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow)
592 PM_DrawBox(w, x1, y1, x2, y2, shine, shadow);
593 PM_DrawBox(w, x1+1, y1+1, x2-1, y2-1, shine, shadow);
596 void PM_DrawDropBox(struct PM_Window *w, int x1, int y1, int x2, int y2, int shine, int shadow)
598 SetAPen(w->RPort, shine);
599 PM_Move(w, x1, y2-1);
600 PM_Draw(w, x1, y1);
601 PM_Draw(w, x2-1, y1);
602 PM_Move(w, x1+4, y2-3);
603 PM_Draw(w, x2-3, y2-3);
604 PM_Draw(w, x2-3, y1+4);
605 SetAPen(w->RPort, shadow);
606 PM_Move(w, x1+3, y2-3);
607 PM_Draw(w, x1+3, y1+3);
608 PM_Draw(w, x2-4, y1+3);
609 PM_Move(w, x1, y2);
610 PM_Draw(w, x2, y2);
611 PM_Draw(w, x2, y1);
614 void PM_DrawPrefBox(struct PM_Root *p, struct PM_Window *w, int x1, int y1, int x2, int y2)
616 switch(PM_Prefs->pmp_MenuBorder) {
617 case BUTTON_FRAME:
618 PM_DrawBox(w, x1, y1, x2, y2, SHINE(p), SHADOW(p));
619 break;
620 case MAGIC_FRAME:
621 PM_DrawXENBoxMM2(w, x1, y1, x2, y2, SHINE(p), SHADOW(p), BGSHINE(p), BGSHADOW(p), HALF(p));
622 break;
623 case THICK_BUTTON_FRAME:
624 PM_DrawXENBox(w, x1, y1, x2, y2, SHINE(p), SHADOW(p), SHINE(p), SHADOW(p));
625 break;
626 case DOUBLE_FRAME:
627 PM_DrawDBLBox(w, x1, y1, x2, y2, SHINE(p), SHADOW(p));
628 break;
629 case DROPBOX_FRAME:
630 PM_DrawDropBox(w, x1, y1, x2, y2, SHINE(p), SHADOW(p));
631 break;
632 case INTUI_FRAME:
633 PM_DrawIBox(w, x1, y1, x2, y2, 0, SHADOW(p));
634 break;