?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*****************************************************************************
2 * Module for Microchip Graphics Library
3 * GOL Layer
4 *****************************************************************************
5 * FileName: GOL.c
6 * Dependencies: Graphics.h
7 * Processor: PIC24F, PIC24H, dsPIC, PIC32
8 * Compiler: MPLAB C30 V3.00, MPLAB C32
9 * Linker: MPLAB LINK30, MPLAB LINK32
10 * Company: Microchip Technology Incorporated
11 *
12 * Software License Agreement
13 *
14 * Copyright © 2008 Microchip Technology Inc. All rights reserved.
15 * Microchip licenses to you the right to use, modify, copy and distribute
16 * Software only when embedded on a Microchip microcontroller or digital
17 * signal controller, which is integrated into your product or third party
18 * product (pursuant to the sublicense terms in the accompanying license
19 * agreement).
20 *
21 * You should refer to the license agreement accompanying this Software
22 * for additional information regarding your rights and obligations.
23 *
24 * SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY
25 * KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
26 * OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR
27 * PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR
28 * OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION,
29 * BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT
30 * DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL,
31 * INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
32 * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY
33 * CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF),
34 * OR OTHER SIMILAR COSTS.
35 *
36 * Author Date Comment
37 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38 * Anton Alkhimenok and
39 * PAT 11/12/07 Version 1.0 release
40 * PAT 06/29/09 Added multi-line support for Buttons.
41 * Pradeep Budagutta 03 Dec 2009 Added Double Buffering Support
42 * PAT 04/29/10 Fixed GOLGetFocusNext() issue.
43 *****************************************************************************/
44 #include "Graphics\Graphics.h"
45  
46 #ifdef USE_GOL
47  
48 // Pointer to the current linked list of objects displayed and receiving messages
49 OBJ_HEADER *_pGolObjects = NULL;
50  
51 // Pointer to the default GOL scheme (created in GOLInit())
52 GOL_SCHEME *_pDefaultGolScheme = NULL;
53  
54 // Pointer to the object receiving keyboard input
55 OBJ_HEADER *_pObjectFocused = NULL;
56  
57 #ifdef USE_FOCUS
58  
59 /*********************************************************************
60 * Function: OBJ_HEADER *GOLGetFocusPrev()
61 *
62 * Overview: This function returns the pointer to the previous object
63 * in the active linked list which is able to receive
64 * keyboard input.
65 *
66 * PreCondition: none
67 *
68 * Input: none
69 *
70 * Output: This returns the pointer of the previous object in the
71 * active list capable of receiving keyboard input. If
72 * there is no object capable of receiving keyboard
73 * inputs (i.e. none can be focused) NULL is returned.
74 *
75 * Side Effects: none
76 *
77 ********************************************************************/
78 OBJ_HEADER *GOLGetFocusPrev(void)
79 {
80 OBJ_HEADER *pPrevObj;
81 OBJ_HEADER *pCurObj;
82 OBJ_HEADER *pFocusedObj;
83  
84 if(_pGolObjects == NULL)
85 return (NULL);
86  
87 if(_pObjectFocused == NULL)
88 {
89 pFocusedObj = _pGolObjects;
90 }
91 else
92 {
93 pFocusedObj = _pObjectFocused;
94 }
95  
96 pPrevObj = NULL;
97 pCurObj = pFocusedObj;
98  
99 while(1)
100 {
101 if(GOLCanBeFocused(pCurObj))
102 pPrevObj = pCurObj;
103  
104 if(pCurObj->pNxtObj == NULL)
105 if(_pGolObjects == pFocusedObj)
106 return (pPrevObj);
107  
108 if(pCurObj->pNxtObj == pFocusedObj)
109 return (pPrevObj);
110  
111 pCurObj = (OBJ_HEADER *)pCurObj->pNxtObj;
112  
113 if(pCurObj == NULL)
114 pCurObj = _pGolObjects;
115 }
116 }
117  
118 /*********************************************************************
119 * Function: OBJ_HEADER *GOLGetFocusNext()
120 *
121 * Overview: This function returns the pointer to the next object
122 * in the active linked list which is able to receive
123 * keyboard input.
124 *
125 * PreCondition: none
126 *
127 * Input: none
128 *
129 * Output: This returns the pointer of the next object in the
130 * active list capable of receiving keyboard input. If
131 * there is no object capable of receiving keyboard
132 * inputs (i.e. none can be focused) NULL is returned.
133 *
134 * Side Effects: none
135 *
136 ********************************************************************/
137 OBJ_HEADER *GOLGetFocusNext(void)
138 {
139 OBJ_HEADER *pNextObj, *pObjStart;
140  
141 if(_pGolObjects == NULL)
142 return (NULL);
143  
144 if(_pObjectFocused == NULL)
145 {
146 pNextObj = _pGolObjects;
147 }
148 else
149 {
150 pNextObj = _pObjectFocused;
151 }
152  
153 pObjStart = pNextObj;
154  
155 do
156 {
157 pNextObj = (OBJ_HEADER *)pNextObj->pNxtObj;
158  
159 if(pNextObj == NULL)
160 pNextObj = _pGolObjects;
161  
162 if(GOLCanBeFocused(pNextObj))
163 break;
164 } while(pNextObj != pObjStart);
165  
166 // if we reached the starting point and the starting point cannot
167 // be focused, then all objects cannot be focused. return NULL
168 if(!GOLCanBeFocused(pNextObj))
169 return NULL;
170  
171 return (pNextObj);
172 }
173  
174 /*********************************************************************
175 * Function: void GOLSetFocus(OBJ_HEADER* object)
176 *
177 * PreCondition: none
178 *
179 * Input: pointer to the object to be focused
180 *
181 * Output:
182 *
183 * Side Effects: none
184 *
185 * Overview: moves keyboard focus to the object
186 *
187 * Note: none
188 *
189 ********************************************************************/
190 void GOLSetFocus(OBJ_HEADER *object)
191 {
192 if(!GOLCanBeFocused(object))
193 return;
194  
195 if(_pObjectFocused != NULL)
196 {
197 ClrState(_pObjectFocused, FOCUSED);
198 SetState(_pObjectFocused, DRAW_FOCUS);
199 }
200  
201 SetState(object, DRAW_FOCUS | FOCUSED);
202  
203 _pObjectFocused = object;
204 }
205  
206 /*********************************************************************
207 * Function: WORD GOLCanBeFocused(OBJ_HEADER* object)
208 *
209 * PreCondition: none
210 *
211 * Input: pointer to the object
212 *
213 * Output: non-zero if the object supports keyboard focus, zero if not
214 *
215 * Side Effects: none
216 *
217 * Overview: checks if object support keyboard focus
218 *
219 * Note: none
220 *
221 ********************************************************************/
222 WORD GOLCanBeFocused(OBJ_HEADER *object)
223 {
224 if
225 (
226 (object->type == OBJ_BUTTON) ||
227 (object->type == OBJ_CHECKBOX) ||
228 (object->type == OBJ_RADIOBUTTON) ||
229 (object->type == OBJ_LISTBOX) ||
230 (object->type == OBJ_SLIDER)
231 )
232 {
233 if(!GetState(object, DISABLED))
234 return (1);
235 }
236  
237 return (0);
238 }
239  
240 #endif
241  
242 /*********************************************************************
243 * Function: GOL_SCHEME *GOLCreateScheme(void)
244 *
245 * PreCondition: none
246 *
247 * Input: none
248 *
249 * Output: pointer to scheme object
250 *
251 * Side Effects: none
252 *
253 * Overview: creates a color scheme object and assign default colors
254 *
255 * Note: none
256 *
257 ********************************************************************/
258 GOL_SCHEME *GOLCreateScheme(void)
259 {
260 GOL_SCHEME *pTemp;
261 pTemp = (GOL_SCHEME *)GFX_malloc(sizeof(GOL_SCHEME));
262 if(pTemp != NULL)
263 {
264 pTemp->EmbossDkColor = EMBOSSDKCOLORDEFAULT;
265 pTemp->EmbossLtColor = EMBOSSLTCOLORDEFAULT;
266 pTemp->TextColor0 = TEXTCOLOR0DEFAULT;
267 pTemp->TextColor1 = TEXTCOLOR1DEFAULT;
268 pTemp->TextColorDisabled = TEXTCOLORDISABLEDDEFAULT;
269 pTemp->Color0 = COLOR0DEFAULT;
270 pTemp->Color1 = COLOR1DEFAULT;
271 pTemp->ColorDisabled = COLORDISABLEDDEFAULT;
272 pTemp->CommonBkColor = COMMONBACKGROUNDCOLORDEFAULT;
273 pTemp->pFont = (void *) &FONTDEFAULT;
274 }
275  
276 return (pTemp);
277 }
278  
279 /*********************************************************************
280 * Function: void GOLInit()
281 *
282 * PreCondition: none
283 *
284 * Input: none
285 *
286 * Output: none
287 *
288 * Side Effects: none
289 *
290 * Overview: initializes GOL
291 *
292 * Note: none
293 *
294 ********************************************************************/
295 void GOLInit(void)
296 {
297  
298 // Initialize display
299 InitGraph();
300  
301 // Initialize the default GOL scheme
302 _pDefaultGolScheme = GOLCreateScheme();
303 }
304  
305 /*********************************************************************
306 * Function: void GOLFree()
307 *
308 * PreCondition: none
309 *
310 * Input: none
311 *
312 * Output: none
313 *
314 * Side Effects: none
315 *
316 * Overview: frees memory of all objects in the current linked list
317 * and starts a new linked list. This function must be
318 * called only inside the GOLDrawCallback()function when
319 * using GOLDraw() and GOLMsg() to manage rendering and
320 * message processing.
321 *
322 * Note: drawing and messaging must be suspended
323 *
324 ********************************************************************/
325 void GOLFree(void)
326 {
327 OBJ_HEADER *pNextObj;
328 OBJ_HEADER *pCurrentObj;
329  
330 pCurrentObj = _pGolObjects;
331 while(pCurrentObj != NULL)
332 {
333 pNextObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
334  
335 #ifdef USE_LISTBOX
336 if(pCurrentObj->type == OBJ_LISTBOX)
337 LbDelItemsList((LISTBOX *)pCurrentObj);
338 #endif
339 #ifdef USE_GRID
340 if(pCurrentObj->type == OBJ_GRID)
341 GridFreeItems((GRID *)pCurrentObj);
342 #endif
343 #ifdef USE_CHART
344 if(pCurrentObj->type == OBJ_CHART)
345 ChRemoveDataSeries((CHART *)pCurrentObj, 0);
346 #endif
347 #ifdef USE_TEXTENTRY
348 if(pCurrentObj->type == OBJ_TEXTENTRY)
349 TeDelKeyMembers((TEXTENTRY *)pCurrentObj);
350 #endif
351 GFX_free(pCurrentObj);
352 pCurrentObj = pNextObj;
353 }
354  
355 GOLNewList();
356 }
357  
358 /*********************************************************************
359 * Function: BOOL GOLDeleteObject(OBJ_HEADER * object)
360 *
361 * PreCondition: none
362 *
363 * Input: pointer to the object
364 *
365 * Output: none
366 *
367 * Side Effects: none
368 *
369 * Overview: Deletes an object to the linked list objects for the current screen.
370 *
371 * Note: none
372 *
373 ********************************************************************/
374 BOOL GOLDeleteObject(OBJ_HEADER *object)
375 {
376 if(!_pGolObjects)
377 return (FALSE);
378  
379 if(object == _pGolObjects)
380 {
381 _pGolObjects = (OBJ_HEADER *)object->pNxtObj;
382 }
383 else
384 {
385 OBJ_HEADER *curr;
386 OBJ_HEADER *prev;
387  
388 curr = (OBJ_HEADER *)_pGolObjects->pNxtObj;
389 prev = (OBJ_HEADER *)_pGolObjects;
390  
391 while(curr)
392 {
393 if(curr == object)
394 break;
395  
396 prev = (OBJ_HEADER *)curr;
397 curr = (OBJ_HEADER *)curr->pNxtObj;
398 }
399  
400 if(!curr)
401 return (FALSE);
402  
403 prev->pNxtObj = curr->pNxtObj;
404 }
405  
406 #ifdef USE_LISTBOX
407 if(object->type == OBJ_LISTBOX)
408 LbDelItemsList((LISTBOX *)object);
409 #endif
410 #ifdef USE_GRID
411 if(object->type == OBJ_GRID)
412 GridFreeItems((GRID *)object);
413 #endif
414 #ifdef USE_CHART
415 if(object->type == OBJ_CHART)
416 ChRemoveDataSeries((CHART *)object, 0);
417 #endif
418 #ifdef USE_TEXTENTRY
419 if(object->type == OBJ_TEXTENTRY)
420 TeDelKeyMembers((TEXTENTRY *)object);
421 #endif
422 GFX_free(object);
423  
424 return (TRUE);
425 }
426  
427 /*********************************************************************
428 * Function: BOOL GOLDeleteObject(OBJ_HEADER * object)
429 *
430 * PreCondition: none
431 *
432 * Input: pointer to the object
433 *
434 * Output: none
435 *
436 * Side Effects: none
437 *
438 * Overview: Deletes an object to the linked list objects for the current screen using
439 * the given ID to search for the object.
440 *
441 * Note: none
442 *
443 ********************************************************************/
444 BOOL GOLDeleteObjectByID(WORD ID)
445 {
446 OBJ_HEADER *object;
447  
448 object = GOLFindObject(ID);
449  
450 if(!object)
451 return (FALSE);
452  
453 return (GOLDeleteObject(object));
454 }
455  
456 /*********************************************************************
457 * Function: OBJ_HEADER* GOLFindObject(WORD ID)
458 *
459 * PreCondition: none
460 *
461 * Input: object ID
462 *
463 * Output: pointer to the object
464 *
465 * Side Effects: none
466 *
467 * Overview: searches for the object by its ID in the current objects linked list,
468 * returns NULL if the object is not found
469 *
470 * Note: none
471 *
472 ********************************************************************/
473 OBJ_HEADER *GOLFindObject(WORD ID)
474 {
475 OBJ_HEADER *pNextObj;
476  
477 pNextObj = _pGolObjects;
478 while(pNextObj != NULL)
479 {
480 if(pNextObj->ID == ID)
481 {
482 return (pNextObj);
483 }
484  
485 pNextObj = (OBJ_HEADER *)pNextObj->pNxtObj;
486 }
487  
488 return (NULL);
489 }
490  
491 /*********************************************************************
492 * Function: void GOLAddObject(OBJ_HEADER * object)
493 *
494 * PreCondition: none
495 *
496 * Input: pointer to the object
497 *
498 * Output: none
499 *
500 * Side Effects: none
501 *
502 * Overview: adds an object to the linked list objects for the current screen.
503 * Object will be drawn and will receive messages.
504 *
505 * Note: none
506 *
507 ********************************************************************/
508 void GOLAddObject(OBJ_HEADER *object)
509 {
510 OBJ_HEADER *pNextObj;
511  
512 if(_pGolObjects == NULL)
513 {
514 _pGolObjects = object;
515 }
516 else
517 {
518 pNextObj = _pGolObjects;
519 while(pNextObj->pNxtObj != NULL)
520 {
521 pNextObj = (OBJ_HEADER *)pNextObj->pNxtObj;
522 }
523  
524 pNextObj->pNxtObj = (void *)object;
525 }
526  
527 object->pNxtObj = NULL;
528 }
529  
530 /*********************************************************************
531 * Function: WORD GOLDraw()
532 *
533 * PreCondition: none
534 *
535 * Input: none
536 *
537 * Output: non-zero if drawing is complete
538 *
539 * Side Effects: none
540 *
541 * Overview: redraws objects in the current linked list
542 *
543 * Note: none
544 *
545 ********************************************************************/
546 WORD GOLDraw(void)
547 {
548 static OBJ_HEADER *pCurrentObj = NULL;
549 SHORT done;
550  
551 #ifdef USE_DOUBLE_BUFFERING
552 static BYTE DisplayUpdated = 0;
553 if(IsDisplayUpdatePending())
554 {
555 return 0;
556 }
557 #endif // USE_DOUBLE_BUFFERING
558  
559 if(pCurrentObj == NULL)
560 {
561 if(GOLDrawCallback())
562 {
563 // It's last object jump to head
564 pCurrentObj = _pGolObjects;
565  
566 #ifdef USE_DOUBLE_BUFFERING
567 if(DisplayUpdated)
568 {
569 RequestDisplayUpdate();
570 DisplayUpdated = 0;
571 return(0);
572 }
573 #endif //USE_DOUBLE_BUFFERING
574 }
575 else
576 {
577 return (0); // drawing is not done
578 }
579 }
580  
581 done = 0;
582 while(pCurrentObj != NULL)
583 {
584 if(IsObjUpdated(pCurrentObj))
585 {
586 switch(pCurrentObj->type)
587 {
588 #if defined(USE_BUTTON) || defined(USE_BUTTON_MULTI_LINE)
589  
590 case OBJ_BUTTON:
591 done = BtnDraw((BUTTON *)pCurrentObj);
592 break;
593 #endif
594 #ifdef USE_WINDOW
595  
596 case OBJ_WINDOW:
597 done = WndDraw((WINDOW *)pCurrentObj);
598 break;
599 #endif
600 #ifdef USE_CHECKBOX
601  
602 case OBJ_CHECKBOX:
603 done = CbDraw((CHECKBOX *)pCurrentObj);
604 break;
605 #endif
606 #ifdef USE_RADIOBUTTON
607  
608 case OBJ_RADIOBUTTON:
609 done = RbDraw((RADIOBUTTON *)pCurrentObj);
610 break;
611 #endif
612 #ifdef USE_EDITBOX
613  
614 case OBJ_EDITBOX:
615 done = EbDraw((EDITBOX *)pCurrentObj);
616 break;
617 #endif
618 #ifdef USE_LISTBOX
619  
620 case OBJ_LISTBOX:
621 done = LbDraw((LISTBOX *)pCurrentObj);
622 break;
623 #endif
624 #ifdef USE_SLIDER
625  
626 case OBJ_SLIDER:
627 done = SldDraw((SLIDER *)pCurrentObj);
628 break;
629 #endif
630 #ifdef USE_PROGRESSBAR
631  
632 case OBJ_PROGRESSBAR:
633 done = PbDraw((PROGRESSBAR *)pCurrentObj);
634 break;
635 #endif
636 #ifdef USE_STATICTEXT
637  
638 case OBJ_STATICTEXT:
639 done = StDraw((STATICTEXT *)pCurrentObj);
640 break;
641 #endif
642 #ifdef USE_DIGITALMETER
643  
644 case OBJ_DIGITALMETER:
645 done = DmDraw((DIGITALMETER *)pCurrentObj);
646 break;
647 #endif
648 #ifdef USE_PICTURE
649  
650 case OBJ_PICTURE:
651 done = PictDraw((PICTURE *)pCurrentObj);
652 break;
653 #endif
654 #ifdef USE_GROUPBOX
655  
656 case OBJ_GROUPBOX:
657 done = GbDraw((GROUPBOX *)pCurrentObj);
658 break;
659 #endif
660 #ifdef USE_ROUNDDIAL
661  
662 case OBJ_ROUNDDIAL:
663 done = RdiaDraw((ROUNDDIAL *)pCurrentObj);
664 break;
665 #endif
666 #ifdef USE_METER
667  
668 case OBJ_METER:
669 done = MtrDraw((METER *)pCurrentObj);
670 break;
671 #endif
672 #ifdef USE_CUSTOM
673  
674 case OBJ_CUSTOM:
675 done = CcDraw((CUSTOM *)pCurrentObj);
676 break;
677 #endif
678 #ifdef USE_GRID
679  
680 case OBJ_GRID:
681 done = GridDraw((GRID *)pCurrentObj);
682 break;
683 #endif
684 #ifdef USE_CHART
685  
686 case OBJ_CHART:
687 done = ChDraw((CHART *)pCurrentObj);
688 break;
689 #endif
690 #ifdef USE_TEXTENTRY
691  
692 case OBJ_TEXTENTRY:
693 done = TeDraw((TEXTENTRY *)pCurrentObj);
694 break;
695 #endif
696  
697 default:
698 break;
699 }
700  
701 if(done)
702 {
703 GOLDrawComplete(pCurrentObj);
704  
705 #ifdef USE_DOUBLE_BUFFERING
706  
707 InvalidateRectangle(pCurrentObj->left, pCurrentObj->top,
708 pCurrentObj->right, pCurrentObj->bottom);
709 DisplayUpdated = 1;
710  
711 #endif //USE_DOUBLE_BUFFERING
712  
713 }
714 else
715 {
716 return (0); // drawing is not done
717 }
718 }
719  
720 pCurrentObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
721 }
722  
723 return (1); // drawing is completed
724 }
725  
726 /*********************************************************************
727 * Function: void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom)
728 *
729 * PreCondition: none
730 *
731 * Input: left,top,right,bottom - rectangle borders
732 *
733 * Output: none
734 *
735 * Side Effects: none
736 *
737 * Overview: marks objects with parts in the rectangle to be redrawn
738 *
739 * Note: none
740 *
741 ********************************************************************/
742 void GOLRedrawRec(SHORT left, SHORT top, SHORT right, SHORT bottom)
743 {
744 OBJ_HEADER *pCurrentObj;
745  
746 pCurrentObj = _pGolObjects;
747  
748 while(pCurrentObj != NULL)
749 {
750 if
751 (
752 !(
753 (pCurrentObj->left > right) ||
754 (pCurrentObj->right < left) ||
755 (pCurrentObj->top > bottom) ||
756 (pCurrentObj->bottom < top)
757 )
758 )
759 if
760 (
761 ((pCurrentObj->left >= left) && (pCurrentObj->left <= right)) ||
762 ((pCurrentObj->right >= left) && (pCurrentObj->right <= right)) ||
763 ((pCurrentObj->top >= top) && (pCurrentObj->top <= bottom)) ||
764 ((pCurrentObj->bottom >= top) && (pCurrentObj->bottom <= bottom))
765 )
766 {
767 GOLRedraw(pCurrentObj);
768 }
769  
770 pCurrentObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
771 } //end of while
772 }
773  
774 /*********************************************************************
775 * Function: void GOLMsg(GOL_MSG *pMsg)
776 *
777 * PreCondition: none
778 *
779 * Input: pointer to the message
780 *
781 * Output: none
782 *
783 * Side Effects: none
784 *
785 * Overview: processes message for all objects in the liked list
786 *
787 * Note: none
788 *
789 ********************************************************************/
790 void GOLMsg(GOL_MSG *pMsg)
791 {
792 OBJ_HEADER *pCurrentObj;
793 WORD translatedMsg;
794  
795 if(pMsg->uiEvent == EVENT_INVALID)
796 return;
797  
798 pCurrentObj = _pGolObjects;
799  
800 while(pCurrentObj != NULL)
801 {
802 switch(pCurrentObj->type)
803 {
804 #if defined(USE_BUTTON) || defined(USE_BUTTON_MULTI_LINE)
805  
806 case OBJ_BUTTON:
807 translatedMsg = BtnTranslateMsg((BUTTON *)pCurrentObj, pMsg);
808 if(translatedMsg == OBJ_MSG_INVALID)
809 break;
810 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
811 BtnMsgDefault(translatedMsg, (BUTTON *)pCurrentObj, pMsg);
812 break;
813 #endif
814 #ifdef USE_WINDOW
815  
816 case OBJ_WINDOW:
817 translatedMsg = WndTranslateMsg((WINDOW *)pCurrentObj, pMsg);
818 if(translatedMsg == OBJ_MSG_INVALID)
819 break;
820 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
821 break;
822 #endif
823 #ifdef USE_CHECKBOX
824  
825 case OBJ_CHECKBOX:
826 translatedMsg = CbTranslateMsg((CHECKBOX *)pCurrentObj, pMsg);
827 if(translatedMsg == OBJ_MSG_INVALID)
828 break;
829 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
830 CbMsgDefault(translatedMsg, (CHECKBOX *)pCurrentObj, pMsg);
831 break;
832 #endif
833 #ifdef USE_RADIOBUTTON
834  
835 case OBJ_RADIOBUTTON:
836 translatedMsg = RbTranslateMsg((RADIOBUTTON *)pCurrentObj, pMsg);
837 if(translatedMsg == OBJ_MSG_INVALID)
838 break;
839 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
840 RbMsgDefault(translatedMsg, (RADIOBUTTON *)pCurrentObj, pMsg);
841 break;
842 #endif
843 #ifdef USE_EDITBOX
844  
845 case OBJ_EDITBOX:
846 translatedMsg = EbTranslateMsg((EDITBOX *)pCurrentObj, pMsg);
847 if(translatedMsg == OBJ_MSG_INVALID)
848 break;
849 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
850 EbMsgDefault(translatedMsg, (EDITBOX *)pCurrentObj, pMsg);
851 break;
852 #endif
853 #ifdef USE_LISTBOX
854  
855 case OBJ_LISTBOX:
856 translatedMsg = LbTranslateMsg((LISTBOX *)pCurrentObj, pMsg);
857 if(translatedMsg == OBJ_MSG_INVALID)
858 break;
859 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
860 LbMsgDefault(translatedMsg, (LISTBOX *)pCurrentObj, pMsg);
861 break;
862 #endif
863 #ifdef USE_SLIDER
864  
865 case OBJ_SLIDER:
866 translatedMsg = SldTranslateMsg((SLIDER *)pCurrentObj, pMsg);
867 if(translatedMsg == OBJ_MSG_INVALID)
868 break;
869 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
870 SldMsgDefault(translatedMsg, (SLIDER *)pCurrentObj, pMsg);
871 break;
872 #endif
873 #ifdef USE_GROUPBOX
874  
875 case OBJ_GROUPBOX:
876 translatedMsg = GbTranslateMsg((GROUPBOX *)pCurrentObj, pMsg);
877 if(translatedMsg == OBJ_MSG_INVALID)
878 break;
879 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
880 break;
881 #endif
882 #ifdef USE_PROGRESSBAR
883  
884 case OBJ_PROGRESSBAR:
885 break;
886 #endif
887 #ifdef USE_STATICTEXT
888  
889 case OBJ_STATICTEXT:
890 translatedMsg = StTranslateMsg((STATICTEXT *)pCurrentObj, pMsg);
891 if(translatedMsg == OBJ_MSG_INVALID)
892 break;
893 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
894 break;
895 #endif
896 #ifdef USE_DIGITALMETER
897  
898 case OBJ_DIGITALMETER:
899 translatedMsg = DmTranslateMsg((DIGITALMETER *)pCurrentObj, pMsg);
900 if(translatedMsg == OBJ_MSG_INVALID)
901 break;
902 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
903 break;
904 #endif
905 #ifdef USE_PICTURE
906  
907 case OBJ_PICTURE:
908 translatedMsg = PictTranslateMsg((PICTURE *)pCurrentObj, pMsg);
909 if(translatedMsg == OBJ_MSG_INVALID)
910 break;
911 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
912 break;
913 #endif
914 #ifdef USE_ROUNDDIAL
915  
916 case OBJ_ROUNDDIAL:
917 translatedMsg = RdiaTranslateMsg((ROUNDDIAL *)pCurrentObj, pMsg);
918 if(translatedMsg == OBJ_MSG_INVALID)
919 break;
920 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
921 RdiaMsgDefault(translatedMsg, (ROUNDDIAL *)pCurrentObj, pMsg);
922 break;
923 #endif
924 #ifdef USE_METER
925  
926 case OBJ_METER:
927 translatedMsg = MtrTranslateMsg((METER *)pCurrentObj, pMsg);
928 if(translatedMsg == OBJ_MSG_INVALID)
929 break;
930 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
931 MtrMsgDefault(translatedMsg, (METER *)pCurrentObj, pMsg);
932 break;
933 #endif
934 #ifdef USE_CUSTOM
935  
936 case OBJ_CUSTOM:
937 translatedMsg = CcTranslateMsg((CUSTOM *)pCurrentObj, pMsg);
938 if(translatedMsg == OBJ_MSG_INVALID)
939 break;
940 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
941 CcMsgDefault((CUSTOM *)pCurrentObj, pMsg);
942 break;
943 #endif
944 #ifdef USE_GRID
945  
946 case OBJ_GRID:
947 translatedMsg = GridTranslateMsg((GRID *)pCurrentObj, pMsg);
948 if(translatedMsg == OBJ_MSG_INVALID)
949 break;
950 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
951 GridMsgDefault(translatedMsg, (GRID *)pCurrentObj, pMsg);
952 break;
953 #endif
954 #ifdef USE_CHART
955  
956 case OBJ_CHART:
957 translatedMsg = ChTranslateMsg((CHART *)pCurrentObj, pMsg);
958 if(translatedMsg == OBJ_MSG_INVALID)
959 break;
960 GOLMsgCallback(translatedMsg, pCurrentObj, pMsg);
961 break;
962 #endif
963 #ifdef USE_TEXTENTRY
964  
965 case OBJ_TEXTENTRY:
966 translatedMsg = TeTranslateMsg((TEXTENTRY *)pCurrentObj, pMsg);
967 if(translatedMsg == OBJ_MSG_INVALID)
968 break;
969 if(GOLMsgCallback(translatedMsg, pCurrentObj, pMsg))
970 TeMsgDefault(translatedMsg, (TEXTENTRY *)pCurrentObj, pMsg);
971 break;
972 #endif
973  
974 default:
975 break;
976 }
977  
978 pCurrentObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
979 }
980 }
981  
982 /*********************************************************************
983 * Variables for rounded panel drawing. Used by GOLRndPanelDraw and GOLRndPanelDrawTsk
984 ********************************************************************/
985 SHORT _rpnlX1, // Center x position of upper left corner
986 _rpnlY1, // Center y position of upper left corner
987 _rpnlX2, // Center x position of lower right corner
988 _rpnlY2, // Center y position of lower right corner
989 _rpnlR; // radius
990 WORD _rpnlFaceColor, // face color
991 _rpnlEmbossLtColor, // emboss light color
992 _rpnlEmbossDkColor, // emboss dark color
993 _rpnlEmbossSize; // emboss size
994 void *_pRpnlBitmap = NULL;
995  
996 /*********************************************************************
997 * Function: WORD GOLPanelDrawTsk(void)
998 *
999 * PreCondition: parameters must be set with
1000 * GOLRndPanelDraw(x,y,radius,width,height,faceClr,embossLtClr,
1001 * embossDkClr,pBitmap,embossSize)
1002 *
1003 * Input: None
1004 *
1005 * Output: Output: non-zero if drawing is completed
1006 *
1007 * Overview: draws a rounded panel on screen. Must be called repeatedly. Drawing is done
1008 * when it returns non-zero.
1009 *
1010 * Note: none
1011 *
1012 ********************************************************************/
1013 WORD GOLPanelDrawTsk(void)
1014 {
1015  
1016 #ifndef USE_NONBLOCKING_CONFIG
1017  
1018 WORD counter;
1019  
1020 if(_rpnlR)
1021 {
1022  
1023 // draw upper left portion of the embossed area
1024 SetColor(_rpnlEmbossLtColor);
1025 Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0xE1);
1026  
1027 // draw lower right portion of the embossed area
1028 SetColor(_rpnlEmbossDkColor);
1029 Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0x1E);
1030 }
1031 else
1032 {
1033  
1034 // object is rectangular panel draw the embossed areas
1035 counter = 1;
1036 SetColor(_rpnlEmbossLtColor);
1037 while(counter < _rpnlEmbossSize)
1038 {
1039 Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY1 + counter); // draw top
1040 Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX1 + counter, _rpnlY2 - counter); // draw left
1041 counter++;
1042 }
1043  
1044 counter = 1;
1045 SetColor(_rpnlEmbossDkColor);
1046 while(counter < _rpnlEmbossSize)
1047 {
1048 Bar(_rpnlX1 + counter, _rpnlY2 - counter, _rpnlX2 - counter, _rpnlY2 - counter); // draw bottom
1049 Bar(_rpnlX2 - counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY2 - counter); // draw right
1050 counter++;
1051 }
1052 }
1053  
1054 // draw the face color
1055 SetColor(_rpnlFaceColor);
1056 if(_rpnlR)
1057 FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize);
1058 else
1059 Bar(_rpnlX1 + _rpnlEmbossSize, _rpnlY1 + _rpnlEmbossSize, _rpnlX2 - _rpnlEmbossSize, _rpnlY2 - _rpnlEmbossSize);
1060  
1061 #if (COLOR_DEPTH == 1)
1062 if(_rpnlFaceColor == BLACK)
1063 {
1064 SetColor(WHITE);
1065 if(_rpnlR)
1066 Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - (_rpnlEmbossSize - 1));
1067 else
1068 Bevel
1069 (
1070 _rpnlX1 + (_rpnlEmbossSize - 1),
1071 _rpnlY1 + (_rpnlEmbossSize - 1),
1072 _rpnlX2 - (_rpnlEmbossSize - 1),
1073 _rpnlY2 - (_rpnlEmbossSize - 1),
1074  
1075 );
1076 }
1077  
1078 #endif
1079  
1080 // draw bitmap
1081 if(_pRpnlBitmap != NULL)
1082 {
1083 PutImage
1084 (
1085 (((_rpnlX2 + _rpnlX1) - (GetImageWidth((void *)_pRpnlBitmap))) >> 1) + 1,
1086 (((_rpnlY2 + _rpnlY1) - (GetImageHeight((void *)_pRpnlBitmap))) >> 1) + 1,
1087 _pRpnlBitmap,
1088 IMAGE_NORMAL
1089 );
1090 }
1091  
1092 // check if we need to draw the frame
1093 if
1094 (
1095 (_pRpnlBitmap == NULL) ||
1096 (
1097 ((_rpnlX2 - _rpnlX1 + _rpnlR) >= GetImageWidth((void *)_pRpnlBitmap)) &&
1098 ((_rpnlY2 - _rpnlY1 + _rpnlR) >= GetImageHeight((void *)_pRpnlBitmap))
1099 )
1100 )
1101 {
1102  
1103 // draw the outline
1104 SetColor(_rpnlEmbossDkColor);
1105 Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR);
1106 }
1107  
1108 return (1);
1109  
1110 #else
1111  
1112 typedef enum
1113 {
1114 BEGIN,
1115 ARC1,
1116 DRAW_EMBOSS1,
1117 DRAW_EMBOSS2,
1118 DRAW_EMBOSS3,
1119 DRAW_EMBOSS4,
1120 DRAW_FACECOLOR,
1121 #if (COLOR_DEPTH == 1)
1122 DRAW_INNERFRAME,
1123 #endif
1124 DRAW_FRAME,
1125 DRAW_IMAGE,
1126 } ROUND_PANEL_DRAW_STATES;
1127  
1128 static ROUND_PANEL_DRAW_STATES state = BEGIN;
1129 static WORD counter;
1130  
1131 while(1)
1132 {
1133 if(IsDeviceBusy())
1134 return (0);
1135 switch(state)
1136 {
1137 case BEGIN:
1138 if(_rpnlR)
1139 {
1140  
1141 // draw upper left portion of the embossed area
1142 SetColor(_rpnlEmbossLtColor);
1143 if(!Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0xE1))
1144 return (0);
1145 state = ARC1;
1146 }
1147 else
1148 {
1149 state = DRAW_EMBOSS1;
1150 counter = 1;
1151 goto rnd_panel_draw_emboss;
1152 }
1153  
1154 case ARC1:
1155  
1156 // draw upper left portion of the embossed area
1157 SetColor(_rpnlEmbossDkColor);
1158 if(!Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0x1E))
1159 return (0);
1160 state = DRAW_FACECOLOR;
1161 goto rnd_panel_draw_facecolor;
1162  
1163 // now draw the upper portion of the embossed area
1164 case DRAW_EMBOSS1:
1165 rnd_panel_draw_emboss : SetColor(_rpnlEmbossLtColor);
1166 while(counter < _rpnlEmbossSize)
1167 {
1168  
1169 // draw top
1170 if(!Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY1 + counter))
1171 {
1172 return (0);
1173 }
1174  
1175 counter++;
1176 }
1177  
1178 counter = 1;
1179 state = DRAW_EMBOSS2;
1180 break;
1181  
1182 case DRAW_EMBOSS2:
1183 while(counter < _rpnlEmbossSize)
1184 {
1185  
1186 // draw left
1187 if(!Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX1 + counter, _rpnlY2 - counter))
1188 {
1189 return (0);
1190 }
1191  
1192 counter++;
1193 }
1194  
1195 counter = 1;
1196 state = DRAW_EMBOSS3;
1197 break;
1198  
1199 // now draw the lower portion of the embossed area
1200 case DRAW_EMBOSS3:
1201 SetColor(_rpnlEmbossDkColor);
1202 while(counter < _rpnlEmbossSize)
1203 {
1204  
1205 // draw bottom
1206 if(!Bar(_rpnlX1 + counter, _rpnlY2 - counter, _rpnlX2 - counter, _rpnlY2 - counter))
1207 {
1208 return (0);
1209 }
1210  
1211 counter++;
1212 }
1213  
1214 counter = 1;
1215 state = DRAW_EMBOSS4;
1216 break;
1217  
1218 case DRAW_EMBOSS4:
1219 while(counter < _rpnlEmbossSize)
1220 {
1221  
1222 // draw right
1223 if(!Bar(_rpnlX2 - counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY2 - counter))
1224 {
1225 return (0);
1226 }
1227  
1228 counter++;
1229 }
1230  
1231 state = DRAW_FACECOLOR;
1232 break;
1233  
1234 // draw the face color
1235 case DRAW_FACECOLOR:
1236 rnd_panel_draw_facecolor : SetColor(_rpnlFaceColor);
1237 if(_rpnlR)
1238 {
1239 if(!FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize))
1240 return (0);
1241 }
1242 else
1243 {
1244 if
1245 (
1246 !Bar
1247 (
1248 _rpnlX1 + _rpnlEmbossSize,
1249 _rpnlY1 + _rpnlEmbossSize,
1250 _rpnlX2 - _rpnlEmbossSize,
1251 _rpnlY2 - _rpnlEmbossSize
1252 )
1253 )
1254 {
1255 return (0);
1256 }
1257 }
1258  
1259 state = DRAW_IMAGE;
1260 break;
1261  
1262 case DRAW_IMAGE:
1263 if(_pRpnlBitmap != NULL)
1264 {
1265 if
1266 (
1267 !PutImage
1268 (
1269 ((_rpnlX2 + _rpnlX1 - GetImageWidth((void *)_pRpnlBitmap)) >> 1) + 1,
1270 ((_rpnlY2 + _rpnlY1 - GetImageHeight((void *)_pRpnlBitmap)) >> 1) + 1,
1271 _pRpnlBitmap,
1272 IMAGE_NORMAL
1273 )
1274 )
1275 {
1276 return (0);
1277 }
1278 }
1279  
1280 #if (COLOR_DEPTH == 1)
1281 state = DRAW_INNERFRAME;
1282 break;
1283 #else
1284 state = DRAW_FRAME;
1285 #endif
1286 break;
1287  
1288 #if (COLOR_DEPTH == 1)
1289  
1290 case DRAW_INNERFRAME:
1291 if(_rpnlFaceColor == BLACK)
1292 {
1293 SetColor(WHITE);
1294 if(_rpnlR)
1295 {
1296 if(!Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - (_rpnlEmbossSize - 1)))
1297 {
1298 return (0);
1299 }
1300 }
1301 else
1302 {
1303 if(!Bevel( _rpnlX1 + (_rpnlEmbossSize - 1),
1304 _rpnlY1 + (_rpnlEmbossSize - 1),
1305 _rpnlX2 - (_rpnlEmbossSize - 1),
1306 _rpnlY2 - (_rpnlEmbossSize - 1),
1307  
1308 {
1309 return (0);
1310 }
1311 }
1312 }
1313  
1314 state = DRAW_FRAME;
1315 break;
1316 #endif
1317  
1318 case DRAW_FRAME:
1319  
1320 // check if we need to draw the frame
1321 if
1322 (
1323 (_pRpnlBitmap == NULL) ||
1324 (
1325 ((_rpnlX2 - _rpnlX1 + _rpnlR) >= GetImageWidth((void *)_pRpnlBitmap)) &&
1326 ((_rpnlY2 - _rpnlY1 + _rpnlR) >= GetImageHeight((void *)_pRpnlBitmap))
1327 )
1328 )
1329 {
1330  
1331 // draw the outline frame
1332 #if (COLOR_DEPTH == 1)
1333 SetColor(WHITE);
1334 #else
1335 SetColor(_rpnlEmbossDkColor);
1336 #endif
1337 if(!Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR))
1338 {
1339 return (0);
1340 }
1341 }
1342  
1343 state = BEGIN;
1344 return (1);
1345 } // end of switch
1346 } // end of while
1347 #endif //#ifndef USE_NONBLOCKING_CONFIG
1348 }
1349  
1350  
1351 /*********************************************************************
1352 * Function: WORD GOLTwoTonePanelDrawTsk(void)
1353 *
1354 * PreCondition: parameters must be set with
1355 * GOLRndPanelDraw(x,y,radius,width,height,faceClr,embossLtClr,
1356 * embossDkClr,pBitmap,embossSize)
1357 *
1358 * Input: None
1359 *
1360 * Output: Output: non-zero if drawing is completed
1361 *
1362 * Overview: draws a rounded panel on screen. Must be called repeatedly. Drawing is done
1363 * when it returns non-zero.
1364 *
1365 * Note: none
1366 *
1367 ********************************************************************/
1368 WORD GOLTwoTonePanelDrawTsk(void)
1369 {
1370 // In this panel draw task the emboss light and dark colors are used as
1371 // the panel face colors and the panel face color is used as an outline color
1372  
1373 #ifndef USE_NONBLOCKING_CONFIG
1374  
1375 WORD counter;
1376  
1377 SetColor(_rpnlFaceColor);
1378 if(_rpnlR)
1379 {
1380 // draw the outline
1381 Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0xFF);
1382 }
1383 else
1384 {
1385 // object is rectangular panel draw the outline embossed areas
1386 counter = 1;
1387 while(counter < _rpnlEmbossSize)
1388 {
1389 Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY1 + counter); // draw top
1390 Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX1 + counter, _rpnlY2 - counter); // draw left
1391 Bar(_rpnlX1 + counter, _rpnlY2 - counter, _rpnlX2 - counter, _rpnlY2 - counter); // draw bottom
1392 Bar(_rpnlX2 - counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY2 - counter); // draw right
1393 counter++;
1394 }
1395 }
1396  
1397 // draw the top half of the face
1398 SetColor(_rpnlEmbossLtColor);
1399 if(_rpnlR)
1400 {
1401 SetBevelDrawType(DRAWTOPBEVEL);
1402 FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize);
1403 }
1404 else
1405 {
1406 Bar(_rpnlX1 + _rpnlEmbossSize, _rpnlY1 + _rpnlEmbossSize,
1407 _rpnlX2 - _rpnlEmbossSize, (_rpnlY1 + ((_rpnlY2 - _rpnlY1) >> 1)));
1408 }
1409  
1410 // draw the bottom half of the face
1411 SetColor(_rpnlEmbossDkColor);
1412 if(_rpnlR)
1413 {
1414 SetBevelDrawType(DRAWBOTTOMBEVEL);
1415 FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize);
1416 }
1417 else
1418 {
1419 Bar(_rpnlX1 + _rpnlEmbossSize, (_rpnlY1 + ((_rpnlY2 - _rpnlY1) >> 1)) + 1,
1420 _rpnlX2 - _rpnlEmbossSize, _rpnlY2 - _rpnlEmbossSize);
1421 }
1422  
1423 SetBevelDrawType(DRAWFULLBEVEL);
1424  
1425  
1426 #if (COLOR_DEPTH == 1)
1427  
1428 if(_rpnlFaceColor == BLACK)
1429 {
1430 SetColor(WHITE);
1431 if(_rpnlR)
1432 Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - (_rpnlEmbossSize - 1));
1433 else
1434 Bevel
1435 (
1436 _rpnlX1 + (_rpnlEmbossSize - 1),
1437 _rpnlY1 + (_rpnlEmbossSize - 1),
1438 _rpnlX2 - (_rpnlEmbossSize - 1),
1439 _rpnlY2 - (_rpnlEmbossSize - 1),
1440  
1441 );
1442 }
1443  
1444 #endif
1445  
1446 // draw bitmap
1447 if(_pRpnlBitmap != NULL)
1448 {
1449 PutImage
1450 (
1451 (((_rpnlX2 + _rpnlX1) - (GetImageWidth((void *)_pRpnlBitmap))) >> 1) + 1,
1452 (((_rpnlY2 + _rpnlY1) - (GetImageHeight((void *)_pRpnlBitmap))) >> 1) + 1,
1453 _pRpnlBitmap,
1454 IMAGE_NORMAL
1455 );
1456 }
1457  
1458 return (1);
1459  
1460 #else
1461  
1462 typedef enum
1463 {
1464 BEGIN,
1465 DRAW_EMBOSS1,
1466 DRAW_EMBOSS2,
1467 DRAW_EMBOSS3,
1468 DRAW_EMBOSS4,
1469 DRAW_FACECOLOR1,
1470 DRAW_FACECOLOR2,
1471 #if (COLOR_DEPTH == 1)
1472 DRAW_INNERFRAME,
1473 #endif
1474 DRAW_IMAGE,
1475 } ROUND_PANEL_DRAW_STATES;
1476  
1477 static ROUND_PANEL_DRAW_STATES state = BEGIN;
1478 static WORD counter;
1479  
1480 while(1)
1481 {
1482 if(IsDeviceBusy())
1483 return (0);
1484 switch(state)
1485 {
1486 case BEGIN:
1487 if(_rpnlR)
1488 {
1489  
1490 // draw the outline
1491 SetColor(_rpnlFaceColor);
1492 if(!Arc(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize, _rpnlR, 0xFF))
1493 return (0);
1494 state = DRAW_FACECOLOR1;
1495 }
1496 else
1497 {
1498 state = DRAW_EMBOSS1;
1499 counter = 1;
1500 goto rnd_panel_draw_emboss;
1501 }
1502  
1503 // now draw the upper portion of the embossed area
1504 case DRAW_EMBOSS1:
1505 rnd_panel_draw_emboss : SetColor(_rpnlFaceColor);
1506 while(counter < _rpnlEmbossSize)
1507 {
1508  
1509 // draw top
1510 if(!Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY1 + counter))
1511 {
1512 return (0);
1513 }
1514  
1515 counter++;
1516 }
1517  
1518 counter = 1;
1519 state = DRAW_EMBOSS2;
1520 break;
1521  
1522 case DRAW_EMBOSS2:
1523 while(counter < _rpnlEmbossSize)
1524 {
1525  
1526 // draw left
1527 if(!Bar(_rpnlX1 + counter, _rpnlY1 + counter, _rpnlX1 + counter, _rpnlY2 - counter))
1528 {
1529 return (0);
1530 }
1531  
1532 counter++;
1533 }
1534  
1535 counter = 1;
1536 state = DRAW_EMBOSS3;
1537 break;
1538  
1539 // now draw the lower portion of the embossed area
1540 case DRAW_EMBOSS3:
1541 //SetColor(_rpnlEmbossDkColor);
1542 while(counter < _rpnlEmbossSize)
1543 {
1544  
1545 // draw bottom
1546 if(!Bar(_rpnlX1 + counter, _rpnlY2 - counter, _rpnlX2 - counter, _rpnlY2 - counter))
1547 {
1548 return (0);
1549 }
1550  
1551 counter++;
1552 }
1553  
1554 counter = 1;
1555 state = DRAW_EMBOSS4;
1556 break;
1557  
1558 case DRAW_EMBOSS4:
1559 while(counter < _rpnlEmbossSize)
1560 {
1561  
1562 // draw right
1563 if(!Bar(_rpnlX2 - counter, _rpnlY1 + counter, _rpnlX2 - counter, _rpnlY2 - counter))
1564 {
1565 return (0);
1566 }
1567  
1568 counter++;
1569 }
1570  
1571 state = DRAW_FACECOLOR1;
1572 break;
1573  
1574 // draw the top half of the face
1575 case DRAW_FACECOLOR1:
1576 SetColor(_rpnlEmbossLtColor);
1577 if(_rpnlR)
1578 {
1579 SetBevelDrawType(DRAWTOPBEVEL);
1580 if(!FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize))
1581 return (0);
1582 }
1583 else
1584 {
1585 if
1586 (
1587 !Bar
1588 (
1589 _rpnlX1 + _rpnlEmbossSize,
1590 _rpnlY1 + _rpnlEmbossSize,
1591 _rpnlX2 - _rpnlEmbossSize,
1592 (_rpnlY1 + ((_rpnlY2 - _rpnlY1) >> 1))
1593 )
1594 )
1595 {
1596 return (0);
1597 }
1598 }
1599  
1600 state = DRAW_FACECOLOR2;
1601 break;
1602  
1603 // draw the bottom half of the face
1604 case DRAW_FACECOLOR2:
1605 SetColor(_rpnlEmbossDkColor);
1606 if(_rpnlR)
1607 {
1608 SetBevelDrawType(DRAWBOTTOMBEVEL);
1609 if(!FillBevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - _rpnlEmbossSize))
1610 return (0);
1611 }
1612 else
1613 {
1614 if
1615 (
1616 !Bar
1617 (
1618 _rpnlX1 + _rpnlEmbossSize,
1619 (_rpnlY1 + ((_rpnlY2 - _rpnlY1) >> 1)) + 1,
1620 _rpnlX2 - _rpnlEmbossSize,
1621 _rpnlY2 - _rpnlEmbossSize
1622 )
1623 )
1624 {
1625 return (0);
1626 }
1627 }
1628 SetBevelDrawType(DRAWFULLBEVEL);
1629 state = DRAW_IMAGE;
1630 break;
1631  
1632 case DRAW_IMAGE:
1633 if(_pRpnlBitmap != NULL)
1634 {
1635 if
1636 (
1637 !PutImage
1638 (
1639 ((_rpnlX2 + _rpnlX1 - GetImageWidth((void *)_pRpnlBitmap)) >> 1) + 1,
1640 ((_rpnlY2 + _rpnlY1 - GetImageHeight((void *)_pRpnlBitmap)) >> 1) + 1,
1641 _pRpnlBitmap,
1642 IMAGE_NORMAL
1643 )
1644 )
1645 {
1646 return (0);
1647 }
1648 }
1649  
1650 #if (COLOR_DEPTH == 1)
1651 state = DRAW_INNERFRAME;
1652 break;
1653 #else
1654 state = BEGIN;
1655 return (1);
1656 #endif
1657 break;
1658  
1659 #if (COLOR_DEPTH == 1)
1660  
1661 case DRAW_INNERFRAME:
1662 if(_rpnlFaceColor == BLACK)
1663 {
1664 SetColor(WHITE);
1665 if(_rpnlR)
1666 {
1667 if(!Bevel(_rpnlX1, _rpnlY1, _rpnlX2, _rpnlY2, _rpnlR - (_rpnlEmbossSize - 1)))
1668 {
1669 return (0);
1670 }
1671 }
1672 else
1673 {
1674 if(!Bevel( _rpnlX1 + (_rpnlEmbossSize - 1),
1675 _rpnlY1 + (_rpnlEmbossSize - 1),
1676 _rpnlX2 - (_rpnlEmbossSize - 1),
1677 _rpnlY2 - (_rpnlEmbossSize - 1),
1678  
1679 {
1680 return (0);
1681 }
1682 }
1683 }
1684  
1685 state = BEGIN;
1686 return (1);
1687 #endif
1688  
1689 } // end of switch
1690 } // end of while
1691 #endif //#ifndef USE_NONBLOCKING_CONFIG
1692 }
1693  
1694  
1695 #endif // USE_GOL
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3