2 Copyright © 2003, The AROS Development Team.
8 #include <intuition/imageclass.h>
9 #include <proto/graphics.h>
10 #include <proto/exec.h>
14 #include "imspec_intern.h"
17 extern struct Library
*MUIMasterBase
;
19 static void draw_thick_line(struct RastPort
*rp
,int x1
, int y1
, int x2
, int y2
)
31 #define ARROW_SPACING 1
32 #define ARROW_VSPACING ARROW_SPACING
33 #define ARROW_HSPACING ARROW_SPACING
34 #define VERTARROW_VSPACING ARROW_VSPACING
35 #define HORIZARROW_HSPACING ARROW_HSPACING
37 void arrowup_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
40 struct RastPort
*rport
= mri
->mri_RastPort
;
42 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
46 if ((width
> 8 + ARROW_SPACING
) && (height
> 8 + ARROW_SPACING
))
48 Move(rport
, left
+ ARROW_HSPACING
+ 1, top
+ height
- 1 - VERTARROW_VSPACING
);
49 Draw(rport
, left
+ width
- cx
, top
+ VERTARROW_VSPACING
);
51 Move(rport
, left
+ ARROW_HSPACING
, top
+ height
- 1 - VERTARROW_VSPACING
);
52 Draw(rport
, left
+ width
- cx
- 1, top
+ VERTARROW_VSPACING
);
53 if ((width
> 8 + ARROW_SPACING
) && (height
> 8 + ARROW_SPACING
))
55 Move(rport
, left
+ width
- 1 - ARROW_HSPACING
- 1, top
+ height
- 1 - VERTARROW_VSPACING
);
56 Draw(rport
, left
+ cx
- 1, top
+ VERTARROW_VSPACING
);
58 Move(rport
, left
+ width
- 1 - ARROW_HSPACING
, top
+ height
- 1 - VERTARROW_VSPACING
);
59 Draw(rport
, left
+ cx
, top
+ VERTARROW_VSPACING
);
62 void arrowdown_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
65 struct RastPort
*rport
= mri
->mri_RastPort
;
67 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
71 if ((width
> 8 + ARROW_SPACING
) && (height
> 8 + ARROW_SPACING
))
73 Move(rport
, left
+ ARROW_HSPACING
+ 1, top
+ VERTARROW_VSPACING
);
74 Draw(rport
, left
+ width
- cx
, top
+ height
- 1 - VERTARROW_VSPACING
);
76 Move(rport
, left
+ ARROW_HSPACING
, top
+ VERTARROW_VSPACING
);
77 Draw(rport
, left
+ width
- cx
- 1, top
+ height
- 1 - VERTARROW_VSPACING
);
78 if ((width
> 8 + ARROW_SPACING
) && (height
> 8 + ARROW_SPACING
))
80 Move(rport
, left
+ width
- 1 - ARROW_HSPACING
- 1, top
+ VERTARROW_VSPACING
);
81 Draw(rport
, left
+ cx
- 1, top
+ height
- 1 - VERTARROW_VSPACING
);
83 Move(rport
, left
+ width
- 1 - ARROW_HSPACING
, top
+ VERTARROW_VSPACING
);
84 Draw(rport
, left
+ cx
, top
+ height
- 1 - VERTARROW_VSPACING
);
87 void arrowleft_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
90 struct RastPort
*rport
= mri
->mri_RastPort
;
92 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
96 if ((height
> 8 + ARROW_SPACING
) && (width
> 8 + ARROW_SPACING
))
98 Move(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ ARROW_VSPACING
+ 1);
99 Draw(rport
, left
+ HORIZARROW_HSPACING
, top
+ height
- cy
);
101 Move(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ ARROW_VSPACING
);
102 Draw(rport
, left
+ HORIZARROW_HSPACING
, top
+ height
- cy
- 1);
103 if ((height
> 8 + ARROW_SPACING
) && (width
> 8 + ARROW_SPACING
))
105 Move(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ height
- 1 - ARROW_VSPACING
- 1);
106 Draw(rport
, left
+ HORIZARROW_HSPACING
, top
+ cy
- 1);
108 Move(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ height
- 1 - ARROW_VSPACING
);
109 Draw(rport
, left
+ HORIZARROW_HSPACING
, top
+ cy
);
112 void arrowright_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
115 struct RastPort
*rport
= mri
->mri_RastPort
;
117 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
121 if ((height
> 8 + ARROW_SPACING
) && (width
> 8 + ARROW_SPACING
))
123 Move(rport
, left
+ HORIZARROW_HSPACING
, top
+ ARROW_VSPACING
+ 1);
124 Draw(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ height
- cy
);
126 Move(rport
, left
+ HORIZARROW_HSPACING
, top
+ ARROW_VSPACING
);
127 Draw(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ height
- cy
- 1);
128 if ((height
> 8 + ARROW_SPACING
) && (width
> 8 + ARROW_SPACING
))
130 Move(rport
, left
+ HORIZARROW_HSPACING
, top
+ height
- 1- ARROW_VSPACING
- 1);
131 Draw(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ cy
- 1);
133 Move(rport
, left
+ HORIZARROW_HSPACING
, top
+ height
- 1 - ARROW_VSPACING
);
134 Draw(rport
, left
+ width
- 1 - HORIZARROW_HSPACING
, top
+ cy
);
137 void checkbox_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
139 int h_spacing
= width
/ 4;
140 int v_spacing
= height
/ 4;
141 int bottom
= top
+ height
- 1;
142 int right
= left
+ width
- 1;
144 /* Draw checkmark (only if image is in selected state) */
146 if (state
== IDS_SELECTED
)
148 left
+= h_spacing
;right
-= h_spacing
;width
-= h_spacing
* 2;
149 top
+= v_spacing
;bottom
-= v_spacing
;height
-= v_spacing
* 2;
151 SetAPen(mri
->mri_RastPort
, mri
->mri_Pens
[MPEN_TEXT
]);
153 draw_thick_line(mri
->mri_RastPort
, left
, top
+ height
/ 3 , left
, bottom
);
154 draw_thick_line(mri
->mri_RastPort
, left
+ 1, bottom
, right
- 1, top
);
158 void mx_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
160 struct RastPort
*rport
= mri
->mri_RastPort
;
161 int bottom
= top
+ height
- 1;
162 int right
= left
+ width
- 1;
166 if (state
== IDS_SELECTED
)
176 SetAPen(rport
, mri
->mri_Pens
[col1
]);
177 RectFill(rport
, left
+ 3, top
, right
- 3, top
);
178 WritePixel(rport
, left
+ 2, top
+ 1);
179 WritePixel(rport
, left
+ 1, top
+ 2);
180 RectFill(rport
, left
, top
+ 3, left
, bottom
- 3);
181 WritePixel(rport
, left
+ 1, bottom
- 2);
182 WritePixel(rport
, left
+ 2, bottom
- 1);
184 SetAPen(rport
, mri
->mri_Pens
[col2
]);
185 WritePixel(rport
, right
- 2, top
+ 1);
186 WritePixel(rport
, right
- 1, top
+ 2);
187 RectFill(rport
, right
, top
+ 3, right
, bottom
- 3);
188 WritePixel(rport
, right
- 1, bottom
- 2);
189 WritePixel(rport
, right
- 2, bottom
- 1);
190 RectFill(rport
, left
+ 3, bottom
, right
- 3, bottom
);
192 SetAPen(rport
, mri
->mri_DrawInfo
->dri_Pens
[BACKGROUNDPEN
]);
193 RectFill(rport
, left
+ 3, top
+ 1, right
- 3, bottom
- 1);
194 RectFill(rport
, left
+ 2, top
+ 2, right
- 2, bottom
- 2);
195 RectFill(rport
, left
+ 1, top
+ 3, right
- 1, bottom
- 3);
197 if (state
== IDS_SELECTED
)
199 left
+= 3;right
-= 3;width
-= 6;
200 top
+= 3;bottom
-= 3;height
-= 6;
202 SetAPen(rport
, mri
->mri_Pens
[MPEN_FILL
]);
203 if ((width
>= 5) && (height
>= 5))
205 RectFill(rport
, left
, top
+ 2, left
, bottom
- 2);
206 RectFill(rport
, left
+ 1, top
+ 1, left
+ 1, bottom
- 1);
207 RectFill(rport
, left
+ 2, top
, right
- 2, bottom
);
208 RectFill(rport
, right
- 1, top
+ 1, right
- 1, bottom
- 1);
209 RectFill(rport
, right
, top
+ 2, right
, bottom
- 2);
211 RectFill(rport
, left
, top
, right
, bottom
);
212 RectFill(rport
, left
- 1, top
+ 1, right
+ 1, bottom
- 1);
213 RectFill(rport
, left
+ 1, top
- 1, right
- 1, bottom
+ 1);
218 void cycle_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
220 struct RastPort
*rport
= mri
->mri_RastPort
;
221 int bottom
= top
+ height
- 1;
222 int right
= left
+ width
- 1;
227 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
229 Move(rport
,left
,top
+1);
230 Draw(rport
,left
,bottom
-1);
231 Move(rport
,left
+1,top
);
232 Draw(rport
,left
+1,bottom
);
233 Draw(rport
,right
-7,bottom
);
234 Move(rport
,right
-7,bottom
-1);
235 Draw(rport
,right
-6,bottom
-1);
236 Move(rport
,left
+2,top
);
237 Draw(rport
,right
-7,top
);
238 Move(rport
,right
-7,top
+1);
239 Draw(rport
,right
-6,top
+1);
242 arrow_top
= top
+ (3 * height
/ 4) - 3;
243 /* prevent arrow touching bottom */
244 if (arrow_top
+ 4 >= bottom
-1)
245 arrow_top
= bottom
- 5;
247 RectFill(rport
,right
-7,top
+1,right
-6,arrow_top
-1);
249 /* The small arrow */
250 Move(rport
,right
- 6 - 3, top
+2);
251 Draw(rport
,right
- 7 + 3, top
+2);
252 Move(rport
,right
- 6 - 2, top
+3);
253 Draw(rport
,right
- 7 + 2, top
+3);
254 Move(rport
,right
- 6 - 1, top
+4);
255 Draw(rport
,right
- 7 + 1, top
+4);
257 /* makes arrow bigger */
258 if (arrow_top
- top
- 2 >= 4)
260 Move(rport
,right
- 6 - 3, arrow_top
-1);
261 Draw(rport
,right
- 7 + 3, arrow_top
-1);
262 Move(rport
,right
- 6 - 2, arrow_top
);
263 Draw(rport
,right
- 7 + 2, arrow_top
);
264 Move(rport
,right
- 6 - 2, arrow_top
+1);
265 Draw(rport
,right
- 7 + 2, arrow_top
+1);
266 Move(rport
,right
- 6 - 1, arrow_top
+2);
267 Draw(rport
,right
-7 7 + 1, arrow_top
+2);
271 Move(rport
,right
- 6 - 3, arrow_top
);
272 Draw(rport
,right
- 7 + 3, arrow_top
);
273 Move(rport
,right
- 6 - 2, arrow_top
+1);
274 Draw(rport
,right
- 7 + 2, arrow_top
+1);
275 Move(rport
,right
- 6 - 1, arrow_top
+2);
276 Draw(rport
,right
- 7 + 1, arrow_top
+2);
281 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
282 Move(rport
,right
- 1, top
);
283 Draw(rport
,right
- 1, bottom
);
284 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
285 Move(rport
,right
, top
);
286 Draw(rport
,right
, bottom
);
289 void popup_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
292 struct RastPort
*rport
= mri
->mri_RastPort
;
296 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
300 Move(rport
, left
+ HSPACING
+ 1, top
+ VSPACING
);
301 Draw(rport
, left
+ width
- cx
, top
+ height
- 1 - VSPACING
);
302 Move(rport
, left
+ HSPACING
, top
+ VSPACING
);
303 Draw(rport
, left
+ width
- cx
- 1, top
+ height
- 1 - VSPACING
);
305 Move(rport
, left
+ width
- 1 - HSPACING
- 1, top
+ VSPACING
);
306 Draw(rport
, left
+ cx
- 1, top
+ height
- 1 - VSPACING
);
307 Move(rport
, left
+ width
- 1 - HSPACING
, top
+ VSPACING
);
308 Draw(rport
, left
+ cx
, top
+ height
- 1 - VSPACING
);
310 bottom
= top
+ height
- 1 + 3;
311 right
= left
+ width
- 1;
312 Move(rport
, left
, bottom
-2);
313 Draw(rport
, right
, bottom
-2);
314 Move(rport
, left
, bottom
-1);
315 Draw(rport
, right
, bottom
-1);
318 void popfile_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
322 struct RastPort
*rport
= mri
->mri_RastPort
;
324 right
= left
+ width
- 1;
325 bottom
= top
+ height
- 1;
327 edgex
= left
+ width
* 5 / 8;
328 edgey
= top
+ height
* 5 / 8;
330 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
331 Move(rport
, left
, top
);
332 Draw(rport
, left
, bottom
);
333 Move(rport
, left
+1, top
);
334 Draw(rport
, left
+1, bottom
);
336 Move(rport
, left
, bottom
);
337 Draw(rport
, right
, bottom
);
338 Move(rport
, left
, bottom
-1);
339 Draw(rport
, right
, bottom
-1);
341 Move(rport
, right
, bottom
-1);
342 Draw(rport
, right
, edgey
);
343 Move(rport
, right
-1, bottom
-1);
344 Draw(rport
, right
-1, edgey
);
346 Move(rport
, right
, edgey
-1);
347 Draw(rport
, edgex
, edgey
-1);
348 Draw(rport
, edgex
, top
);
349 Draw(rport
, left
+2,top
);
350 Move(rport
, left
+2,top
+1);
351 Draw(rport
, edgex
-1,top
+1);
353 Move(rport
, edgex
+1, top
);
354 Draw(rport
, right
, edgey
-1);
358 void popdrawer_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
361 int halfx
,halfy
,quartery
;
362 struct RastPort
*rport
= mri
->mri_RastPort
;
364 right
= left
+ width
- 1;
365 bottom
= top
+ height
- 1;
367 halfx
= (left
+ right
) / 2;
368 halfy
= (top
+ bottom
) / 2;
369 quartery
= top
+ height
/ 4;
371 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
372 Move(rport
, left
, quartery
);
373 Draw(rport
, left
, bottom
);
374 Move(rport
, left
+1, quartery
);
375 Draw(rport
, left
+1, bottom
);
376 Draw(rport
, right
, bottom
);
377 Draw(rport
, right
, halfy
);
378 Draw(rport
, halfx
, halfy
);
379 Draw(rport
, halfx
, quartery
);
380 Draw(rport
, left
+1,quartery
);
382 Move(rport
, halfx
, quartery
-1);
383 Draw(rport
, halfx
+ 2, top
);
384 Draw(rport
, right
- 2, top
);
385 Draw(rport
, right
, quartery
-1);
386 Draw(rport
, right
, halfy
);
389 static void stddrawer_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
)
391 struct RastPort
*rport
= mri
->mri_RastPort
;
392 int right
= left
+ width
- 1;
393 int bottom
= top
+ height
- 1;
396 #define XX(x) (x * (width - 1) / 100)
397 #define YY(y) (y * (height - 1) / 100)
401 for(y
= 0; y
< YY(YOFF
); y
++)
403 x
= (YY(XOFF
) > 1) ? XX(XOFF
) * y
/ (YY(YOFF
) - 1) : 1;
404 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
405 RectFill(rport
, left
+ XX(XOFF
) - x
, top
+ y
, right
- XX(XOFF
) + x
, top
+ y
);
406 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
407 WritePixel(rport
, left
+ XX(XOFF
) - x
, top
+ y
);
408 WritePixel(rport
, right
- XX(XOFF
) + x
, top
+ y
);
412 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
413 RectFill(rport
, left
, top
+ YY(YOFF
), right
, bottom
);
415 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
416 Move(rport
, left
+ XX(XOFF
), top
);
417 Draw(rport
, right
- XX(XOFF
), top
);
419 Move(rport
, left
, top
+ YY(YOFF
));
420 Draw(rport
, left
, bottom
);
421 Draw(rport
, right
, bottom
);
422 Draw(rport
, right
, top
+ YY(YOFF
));
423 Draw(rport
, left
, top
+ YY(YOFF
));
432 void drawer_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
434 struct RastPort
*rport
= mri
->mri_RastPort
;
435 int right
= left
+ width
- 1;
437 stddrawer_draw(mri
, left
, top
, width
, height
);
439 #define XX(x) x * (width - 1) / 100
440 #define YY(y) y * (height - 1) / 100
442 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
443 Move(rport
, left
+ XX(40), top
+ YY(75));
444 Draw(rport
, right
- XX(40), top
+ YY(75));
451 void harddisk_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
453 struct RastPort
*rport
= mri
->mri_RastPort
;
455 stddrawer_draw(mri
, left
, top
, width
, height
);
457 #define XX(x) x * (width - 1) / 100
458 #define YY(y) y * (height - 1) / 100
460 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
461 Move(rport
, left
+ XX(20), top
+ YY(75));
462 Draw(rport
, left
+ XX(30), top
+ YY(75));
468 void disk_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
470 struct RastPort
*rport
= mri
->mri_RastPort
;
471 int right
= left
+ width
- 1;
472 int bottom
= top
+ height
- 1;
475 #define XX(x) (x * (width - 1) / 100)
476 #define YY(y) (y * (height - 1) / 100)
480 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
481 for(y
= 0; y
< YY(YOFF
); y
++)
483 x
= (YY(YOFF
) > 1) ? XX(XOFF
) * y
/ (YY(YOFF
) - 1) : 1;
484 RectFill(rport
, left
, top
+ y
, right
- XX(XOFF
) + x
, top
+ y
);
486 RectFill(rport
, left
, top
+ YY(YOFF
), right
, bottom
);
488 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
489 RectFill(rport
, left
+ XX(33), top
, right
- XX(33), top
+ YY(YOFF
));
490 RectFill(rport
, left
+ XX(25), top
+ YY(60), right
- XX(25), bottom
);
498 void ram_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
500 struct RastPort
*rport
= mri
->mri_RastPort
;
503 #define XX(x) left + x * (width - 1) / 100
504 #define YY(y) top + y * (height - 1) / 100
506 right
= left
+ width
- 1;
507 bottom
= top
+ height
- 1;
509 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
510 RectFill(rport
, left
, top
, right
, bottom
);
512 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
513 Move(rport
, XX(33), YY(20));
514 Draw(rport
, XX(33), YY(80));
516 Move(rport
, XX(71), YY(20));
517 Draw(rport
, XX(61), YY(20));
518 Draw(rport
, XX(61), YY(80));
519 Draw(rport
, XX(71), YY(80));
525 void volume_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
527 struct RastPort
*rport
= mri
->mri_RastPort
;
530 #define XX(x) left + x * (width - 1) / 100
531 #define YY(y) top + y * (height - 1) / 100
533 right
= left
+ width
- 1;
534 bottom
= top
+ height
- 1;
536 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
537 RectFill(rport
, left
, top
, right
, bottom
);
539 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHINE
]);
540 Move(rport
, XX(8), YY(20));
541 Draw(rport
, XX(8), YY(60));
542 Draw(rport
, XX(16), YY(80));
543 Draw(rport
, XX(24), YY(60));
544 Draw(rport
, XX(24), YY(20));
546 Move(rport
, XX(40), YY(20));
547 Draw(rport
, XX(60), YY(20));
548 Draw(rport
, XX(60), YY(80));
549 Draw(rport
, XX(40), YY(80));
550 Draw(rport
, XX(40), YY(20));
552 Move(rport
, XX(80), YY(20));
553 Draw(rport
, XX(80), YY(80));
554 Draw(rport
, XX(92), YY(80));
560 void network_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
562 struct RastPort
*rport
= mri
->mri_RastPort
;
563 int right
= left
+ width
- 1;
565 stddrawer_draw(mri
, left
, top
, width
, height
);
567 #define XX(x) x * (width - 1) / 100
568 #define YY(y) y * (height - 1) / 100
570 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
571 Move(rport
, left
+ XX(40), top
+ YY(75));
572 Draw(rport
, right
- XX(40), top
+ YY(75));
578 void assign_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
580 struct RastPort
*rport
= mri
->mri_RastPort
;
581 int right
= left
+ width
- 1;
583 stddrawer_draw(mri
, left
, top
, width
, height
);
585 #define XX(x) x * (width - 1) / 100
586 #define YY(y) y * (height - 1) / 100
588 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
589 Move(rport
, left
+ XX(40), top
+ YY(75));
590 Draw(rport
, right
- XX(40), top
+ YY(75));
596 void tape_play_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
598 struct RastPort
*rport
= mri
->mri_RastPort
;
599 int x
, half
= height
/ 2;
601 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
603 for(x
= 0; x
< width
; x
++)
605 int y
= (width
> 1) ? half
* x
/ (width
- 1) : 1;
607 RectFill(rport
, left
+ width
- 1 - x
, top
+ half
- y
, left
+ width
- 1 - x
, top
+ half
+ y
);
611 void tape_playback_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
613 struct RastPort
*rport
= mri
->mri_RastPort
;
614 int x
, half
= height
/ 2;
616 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
618 for(x
= 0; x
< width
; x
++)
620 int y
= (width
> 1) ? half
* x
/ (width
- 1) : 1;
622 RectFill(rport
, left
+ x
, top
+ half
- y
, left
+ x
, top
+ half
+ y
);
626 void tape_pause_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
628 struct RastPort
*rport
= mri
->mri_RastPort
;
630 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
631 RectFill(rport
, left
, top
, left
+ width
/ 4, top
+ height
- 1);
632 RectFill(rport
, left
+ width
- 1 - width
/ 4, top
, left
+ width
- 1, top
+ height
- 1);
635 void tape_stop_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
637 struct RastPort
*rport
= mri
->mri_RastPort
;
639 SetAPen(rport
, mri
->mri_Pens
[MPEN_TEXT
]);
640 RectFill(rport
, left
, top
, left
+ width
- 1, top
+ height
- 1);
643 void tape_record_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
645 struct RastPort
*rport
= mri
->mri_RastPort
;
646 int rx
= (width
- 1) / 2;
647 int ry
= (height
- 1) / 2;
648 int x
= rx
, y
= 0; /* ellipse points */
650 /* intermediate terms to speed up loop */
651 int t1
= rx
* rx
, t2
= t1
<< 1, t3
= t2
<< 1;
652 int t4
= ry
* ry
, t5
= t4
<< 1, t6
= t5
<< 1;
653 int t7
= rx
* t5
, t8
= t7
<< 1, t9
= 0L;
654 int d1
= t2
- t7
+ (t4
>> 1); /* error terms */
655 int d2
= (t1
>> 1) - t8
+ t5
;
657 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
659 while (d2
< 0) /* til slope = -1 */
662 /* draw 4 points using symmetry */
663 RectFill(rport
, left
+ rx
- x
, top
+ ry
+ y
, left
+ rx
+ x
, top
+ ry
+ y
);
664 RectFill(rport
, left
+ rx
- x
, top
+ ry
- y
, left
+ rx
+ x
, top
+ ry
- y
);
666 y
++; /* always move up here */
668 if (d1
< 0) /* move straight up */
673 else /* move up and left */
677 d1
= d1
+ t9
+ t2
- t8
;
678 d2
= d2
+ t9
+ t5
- t8
;
682 do /* rest of top right quadrant */
684 /* draw 4 points using symmetry */
685 RectFill(rport
, left
+ rx
- x
, top
+ ry
+ y
, left
+ rx
+ x
, top
+ ry
+ y
);
686 RectFill(rport
, left
+ rx
- x
, top
+ ry
- y
, left
+ rx
+ x
, top
+ ry
- y
);
688 x
--; /* always move left here */
690 if (d2
< 0) /* move up and left */
694 d2
= d2
+ t9
+ t5
- t8
;
696 else /* move straight left */
705 void tape_up_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
707 struct RastPort
*rport
= mri
->mri_RastPort
;
708 int y
, half
= width
/ 2;
710 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
712 for(y
= 0; y
< height
; y
++)
714 int x
= (height
> 1) ? half
* y
/ (height
- 1) : 1;
716 RectFill(rport
, left
+ half
- x
, top
+ y
, left
+ half
+ x
, top
+ y
);
720 void tape_down_draw(struct MUI_RenderInfo
*mri
, LONG left
, LONG top
, LONG width
, LONG height
, LONG state
)
722 struct RastPort
*rport
= mri
->mri_RastPort
;
723 int y
, half
= width
/ 2;
725 SetAPen(rport
, mri
->mri_Pens
[MPEN_SHADOW
]);
727 for(y
= 0; y
< height
; y
++)
729 int x
= (height
> 1) ? half
* y
/ (height
- 1) : 1;
731 RectFill(rport
, left
+ half
- x
, top
+ height
- 1 - y
, left
+ half
+ x
, top
+ height
- 1 - y
);
739 VECTOR_DRAW_FUNC draw_func
;
742 static const struct vector_image vector_table
[] =
744 { 8 + 2 * ARROW_SPACING
, 8 + 2 * ARROW_SPACING
, arrowup_draw
},
745 { 8 + 2 * ARROW_SPACING
, 8 + 2 * ARROW_SPACING
, arrowdown_draw
},
746 { 8 + 2 * ARROW_SPACING
, 8 + 2 * ARROW_SPACING
, arrowleft_draw
},
747 { 8 + 2 * ARROW_SPACING
, 8 + 2 * ARROW_SPACING
, arrowright_draw
},
748 { 16, 10, checkbox_draw
},
750 { 15, 8, cycle_draw
},
751 { 10, 11, popup_draw
},
752 { 10, 11, popfile_draw
},
753 { 10, 11, popdrawer_draw
},
755 { 13, 8, drawer_draw
},
756 { 13, 8, harddisk_draw
},
757 { 12, 8, disk_draw
},
759 { 14, 6, volume_draw
},
760 { 13, 8, network_draw
},
761 { 13, 8, assign_draw
},
763 { 4, 7, tape_play_draw
},
764 { 4, 7, tape_playback_draw
},
765 { 6, 7, tape_pause_draw
},
766 { 6, 7, tape_stop_draw
},
767 { 7, 7, tape_record_draw
},
768 { 7, 4, tape_up_draw
},
769 { 7, 4, tape_down_draw
},
772 #define VECTOR_TABLE_ENTRIES (sizeof(vector_table)/sizeof(vector_table[0]))
774 struct MUI_ImageSpec_intern
*zune_imspec_create_vector(LONG vect
)
776 struct MUI_ImageSpec_intern
*spec
;
778 if (!(vect
>= 0 && vect
< VECTOR_TABLE_ENTRIES
))
781 if ((spec
= mui_alloc_struct(struct MUI_ImageSpec_intern
)))
783 spec
->type
= IST_VECTOR
;
784 spec
->u
.vect
.type
= vect
;
785 spec
->u
.vect
.draw
= vector_table
[vect
].draw_func
;
790 BOOL
zune_imspec_vector_get_minmax(struct MUI_ImageSpec_intern
*spec
, struct MUI_MinMax
*minmax
)
792 if (!spec
|| spec
->type
!= IST_VECTOR
)
794 if ((spec
->u
.vect
.type
>= 0) && (spec
->u
.vect
.type
< VECTOR_TABLE_ENTRIES
))
796 minmax
->MinWidth
= vector_table
[spec
->u
.vect
.type
].minwidth
;
797 minmax
->MinHeight
= vector_table
[spec
->u
.vect
.type
].minheight
;
798 minmax
->DefWidth
= minmax
->MinWidth
;
799 minmax
->DefHeight
= minmax
->MinHeight
;
800 minmax
->MaxWidth
= MUI_MAXMAX
;
801 minmax
->MaxHeight
= MUI_MAXMAX
;