added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / prefs / time / main.c
blob3c5db822c3a50c4ffeb090ae8896f2f3af5bf296
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*********************************************************************************************/
8 #include "global.h"
9 #include "version.h"
11 #include <libraries/coolimages.h>
12 #include <aros/debug.h>
14 #include <zune/clock.h>
15 #include <zune/calendar.h>
17 #include <stdlib.h> /* for exit() */
18 #include <stdio.h>
19 #include <string.h>
21 /*********************************************************************************************/
23 #define ARG_TEMPLATE "FROM,EDIT/S,USE/S,SAVE/S,PUBSCREEN/K"
25 #define ARG_FROM 0
26 #define ARG_EDIT 1
27 #define ARG_USE 2
28 #define ARG_SAVE 3
29 #define ARG_PUBSCREEN 4
31 #define NUM_ARGS 5
33 #define DO_SPECIAL_BUTTON_LAYOUT 1 /* all button get same width, but as small as possible,
34 and spread along whole parent group */
36 #define SPACING_BUTTONGROUP 4
38 #define RETURNID_USE 1
39 #define RETURNID_SAVE 2
41 /*********************************************************************************************/
43 static struct libinfo
45 APTR var;
46 STRPTR name;
47 WORD version;
48 BOOL required;
50 libtable[] =
52 {&IntuitionBase , "intuition.library" , 39, TRUE },
53 {&GfxBase , "graphics.library" , 40, TRUE }, /* 40, because of WriteChunkyPixels */
54 {&UtilityBase , "utility.library" , 39, TRUE },
55 {&MUIMasterBase , "muimaster.library" , 0 , TRUE },
56 {NULL }
59 /*********************************************************************************************/
61 static struct Hook yearhook, clockhook, activehook, restorehook;
62 #if DO_SPECIAL_BUTTON_LAYOUT
63 static struct Hook buttonlayouthook;
64 #endif
65 static struct RDArgs *myargs;
66 static Object *activetimestrobj;
67 static IPTR args[NUM_ARGS];
69 static STRPTR monthlabels[] =
71 "January",
72 "February",
73 "March",
74 "April",
75 "May",
76 "June",
77 "July",
78 "August",
79 "September",
80 "October",
81 "November",
82 "December",
83 NULL
86 /*********************************************************************************************/
88 static void CloseLibs(void);
89 static void CloseTimerDev(void);
90 static void FreeArguments(void);
91 static void FreeVisual(void);
92 static void KillGUI(void);
94 /*********************************************************************************************/
96 WORD ShowMessage(STRPTR title, STRPTR text, STRPTR gadtext)
98 struct EasyStruct es;
100 es.es_StructSize = sizeof(es);
101 es.es_Flags = 0;
102 es.es_Title = title;
103 es.es_TextFormat = text;
104 es.es_GadgetFormat = gadtext;
106 return EasyRequestArgs(NULL, &es, NULL, NULL);
109 /*********************************************************************************************/
111 void Cleanup(STRPTR msg)
113 if (msg)
115 if (IntuitionBase && !((struct Process *)FindTask(NULL))->pr_CLI)
117 ShowMessage("Time", msg, MSG(MSG_OK));
119 else
121 printf("Time: %s\n", msg);
125 KillGUI();
126 FreeVisual();
127 FreeArguments();
128 CloseTimerDev();
129 CloseLibs();
130 CleanupLocale();
132 exit(prog_exitcode);
136 /*********************************************************************************************/
138 static void OpenLibs(void)
140 struct libinfo *li;
142 for(li = libtable; li->var; li++)
144 if (!((*(struct Library **)li->var) = OpenLibrary(li->name, li->version)))
146 if (li->required)
148 sprintf(s, MSG(MSG_CANT_OPEN_LIB), li->name, li->version);
149 Cleanup(s);
156 /*********************************************************************************************/
158 static void CloseLibs(void)
160 struct libinfo *li;
162 for(li = libtable; li->var; li++)
164 if (*(struct Library **)li->var) CloseLibrary((*(struct Library **)li->var));
168 /*********************************************************************************************/
170 static void OpenTimerDev(void)
172 if ((TimerMP = CreateMsgPort()))
174 if ((TimerIO = (struct timerequest *)CreateIORequest(TimerMP, sizeof(struct timerequest))))
176 if (!OpenDevice("timer.device", UNIT_VBLANK, (struct IORequest *)TimerIO, 0))
178 TimerBase = (struct Device *)TimerIO->tr_node.io_Device;
183 if (!TimerBase)
185 sprintf(s, MSG(MSG_CANT_OPEN_LIB), "timer.device", 0);
186 Cleanup(s);
190 /*********************************************************************************************/
192 static void CloseTimerDev(void)
194 if (TimerIO)
196 CloseDevice((struct IORequest *)TimerIO);
197 DeleteIORequest((struct IORequest *)TimerIO);
200 if (TimerMP)
202 DeleteMsgPort(TimerMP);
206 /*********************************************************************************************/
208 static void GetArguments(void)
210 if (!(myargs = ReadArgs(ARG_TEMPLATE, args, NULL)))
212 Fault(IoErr(), 0, s, 256);
213 Cleanup(s);
216 // if (!args[ARG_FROM]) args[ARG_FROM] = (IPTR)CONFIGNAME_ENV;
219 /*********************************************************************************************/
221 static void FreeArguments(void)
223 if (myargs) FreeArgs(myargs);
226 /*********************************************************************************************/
228 static void GetVisual(void)
232 /*********************************************************************************************/
234 static void FreeVisual(void)
238 /*********************************************************************************************/
240 #if DO_SPECIAL_BUTTON_LAYOUT
242 /*********************************************************************************************/
244 static ULONG ButtonLayoutFunc(struct Hook *hook, Object *obj, struct MUI_LayoutMsg *msg)
246 IPTR retval = MUILM_UNKNOWN;
248 switch(msg->lm_Type)
250 case MUILM_MINMAX:
252 Object *cstate = (Object *)msg->lm_Children->mlh_Head;
253 Object *child;
255 WORD maxminwidth = 0;
256 WORD maxminheight = 0;
257 WORD numchilds = 0;
259 while((child = NextObject(&cstate)))
261 if (_minwidth(child) > maxminwidth) maxminwidth = _minwidth(child);
262 if (_minheight(child) > maxminheight) maxminheight = _minheight(child);
263 numchilds++;
266 msg->lm_MinMax.MinWidth =
267 msg->lm_MinMax.DefWidth = numchilds * maxminwidth + SPACING_BUTTONGROUP * (numchilds - 1);
268 msg->lm_MinMax.MaxWidth = MUI_MAXMAX;
270 msg->lm_MinMax.MinHeight =
271 msg->lm_MinMax.DefHeight =
272 msg->lm_MinMax.MaxHeight = maxminheight;
274 retval = 0;
275 break;
277 case MUILM_LAYOUT:
279 Object *cstate = (Object *)msg->lm_Children->mlh_Head;
280 Object *child;
282 WORD maxminwidth = 0;
283 WORD maxminheight = 0;
284 WORD numchilds = 0;
285 WORD x = 0, i = 0;
287 while((child = NextObject(&cstate)))
289 if (_minwidth(child) > maxminwidth) maxminwidth = _minwidth(child);
290 if (_minheight(child) > maxminheight) maxminheight = _minheight(child);
291 numchilds++;
294 cstate = (Object *)msg->lm_Children->mlh_Head;
295 while((child = NextObject(&cstate)))
297 if (i == numchilds -1)
299 x = msg->lm_Layout.Width - maxminwidth;
301 else
303 x = maxminwidth + (msg->lm_Layout.Width - numchilds * maxminwidth) / (numchilds - 1);
304 x *= i;
306 MUI_Layout(child, x, 0, maxminwidth, maxminheight, 0);
308 i++;
312 retval = TRUE;
313 break;
315 } /* switch(msg->lm_Type) */
317 return retval;
320 /*********************************************************************************************/
322 #endif /* DO_SPECIAL_BUTTON_LAYOUT */
324 /*********************************************************************************************/
326 static void YearFunc(struct Hook *hook, Object *obj, IPTR *param)
328 IPTR year;
330 get(obj, MUIA_String_Integer, &year);
332 if ((LONG)*param == -1)
333 year--;
334 else if ((LONG)*param == 1)
335 year++;
337 if (year < 1978)
339 year = 1978;
340 nnset(obj, MUIA_String_Integer, year);
342 else if (year > 2099)
344 year = 2099;
345 nnset(obj, MUIA_String_Integer, year);
347 else if (*param)
349 nnset(obj, MUIA_String_Integer, year);
352 nnset(calobj, MUIA_Calendar_Year, year);
356 /*********************************************************************************************/
358 static void ActiveFunc(struct Hook *hook, Object *obj, IPTR *param)
360 Object *active;
361 WORD hand = -1;
363 active = *(Object **)param;
365 if (active == hourobj)
367 hand = MUIV_Clock_EditHand_Hour;
369 else if (active == minobj)
371 hand = MUIV_Clock_EditHand_Minute;
373 else if (active == secobj)
375 hand = MUIV_Clock_EditHand_Second;
378 if (hand != -1)
380 activetimestrobj = active;
381 set(clockobj, MUIA_Clock_EditHand, hand);
386 /*********************************************************************************************/
388 static void ClockFunc(struct Hook *hook, Object *obj, IPTR *param)
390 struct ClockData *cd;
391 UBYTE s[3];
393 get(obj, MUIA_Clock_Time, &cd);
395 if (*param == 0)
397 sprintf(s, "%02d", cd->hour);
398 nnset(hourobj, MUIA_String_Contents, s);
400 sprintf(s, "%02d", cd->min);
401 nnset(minobj, MUIA_String_Contents, s);
403 sprintf(s, "%02d", cd->sec);
404 nnset(secobj, MUIA_String_Contents, s);
406 else
408 struct ClockData cd2;
409 LONG diff = (LONG)*param;
410 LONG max = 0;
411 UWORD *cd2_member = NULL;
413 if (diff == 100) diff = 0; /* 100 means string gadget acknowledge */
415 if (activetimestrobj == hourobj)
417 max = 23;
418 cd2_member = &cd2.hour;
420 else if (activetimestrobj == minobj)
422 max = 59;
423 cd2_member = &cd2.min;
425 else if (activetimestrobj == secobj)
427 max = 59;
428 cd2_member = &cd2.sec;
431 if (max)
433 IPTR number = 0;
435 set(obj, MUIA_Clock_Frozen, TRUE);
436 get(obj, MUIA_Clock_Time, &cd);
438 cd2 = *cd;
440 get(activetimestrobj, MUIA_String_Integer, &number);
442 number += diff;
444 if ((LONG)number < 0)
446 number = max;
448 else if ((LONG)number > max)
450 number = 0;
452 *cd2_member = number;
454 sprintf(s, "%02ld", number);
456 nnset(activetimestrobj, MUIA_String_Contents, s);
458 set(obj, MUIA_Clock_Time, (IPTR)&cd2);
464 /*********************************************************************************************/
466 static void RestoreFunc(struct Hook *hook, Object *obj, APTR msg)
468 RestorePrefs();
470 set(calobj, MUIA_Calendar_Date, (IPTR)&clockdata);
471 set(monthobj, MUIA_Cycle_Active, clockdata.month - 1);
472 set(yearobj, MUIA_String_Integer, clockdata.year);
473 set(clockobj, MUIA_Clock_Frozen, FALSE);
477 /*********************************************************************************************/
479 static void MakeGUI(void)
481 extern struct NewMenu nm;
483 Object *menu, *yearaddobj, *yearsubobj, *timeaddobj, *timesubobj;
484 Object *saveobj, *useobj, *cancelobj;
486 #if DO_SPECIAL_BUTTON_LAYOUT
487 buttonlayouthook.h_Entry = HookEntry;
488 buttonlayouthook.h_SubEntry = (HOOKFUNC)ButtonLayoutFunc;
489 #endif
490 yearhook.h_Entry = HookEntry;
491 yearhook.h_SubEntry = (HOOKFUNC)YearFunc;
493 clockhook.h_Entry = HookEntry;
494 clockhook.h_SubEntry = (HOOKFUNC)ClockFunc;
496 activehook.h_Entry = HookEntry;
497 activehook.h_SubEntry = (HOOKFUNC)ActiveFunc;
499 restorehook.h_Entry = HookEntry;
500 restorehook.h_SubEntry = (HOOKFUNC)RestoreFunc;
502 if (LocaleBase)
504 struct Locale *locale = OpenLocale(NULL);
506 if (locale)
508 WORD i;
510 for(i = 0; i < 12; i++)
512 monthlabels[i] = GetLocaleStr(locale, MON_1 + i);
515 CloseLocale(locale);
520 menu = MUI_MakeObject(MUIO_MenustripNM, &nm, 0);
522 app = ApplicationObject,
523 MUIA_Application_Title, (IPTR)"Time",
524 MUIA_Application_Version, (IPTR)VERSIONSTR,
525 MUIA_Application_Copyright, (IPTR)"Copyright © 1995-2002, The AROS Development Team",
526 MUIA_Application_Author, (IPTR)"The AROS Development Team",
527 MUIA_Application_Description, (IPTR)MSG(MSG_WINTITLE),
528 MUIA_Application_Base, (IPTR)"Time",
529 menu ? MUIA_Application_Menustrip : TAG_IGNORE, menu,
530 SubWindow, wnd = WindowObject,
531 MUIA_Window_Title, (IPTR)MSG(MSG_WINTITLE),
532 MUIA_Window_ID, MAKE_ID('T','W','I','N'),
533 WindowContents, VGroup,
534 Child, HGroup, /* Group containing calendar box and clock box */
535 MUIA_Group_SameWidth, TRUE,
536 Child, VGroup, /* Calendar box */
537 GroupFrame,
538 MUIA_Background, MUII_GroupBack,
539 Child, HGroup, /* Month/year row */
540 Child, monthobj = MUI_MakeObject(MUIO_Cycle, NULL, monthlabels),
541 Child, HVSpace,
542 Child, yearsubobj = TextObject, /* year [-] gadget */
543 ButtonFrame,
544 MUIA_Background, MUII_ButtonBack,
545 MUIA_CycleChain, TRUE,
546 MUIA_Font, MUIV_Font_Button,
547 MUIA_InputMode, MUIV_InputMode_RelVerify,
548 MUIA_Text_Contents, "\033c-",
549 MUIA_FixWidthTxt, (IPTR)"+",
550 End,
551 Child, yearobj = StringObject, /* year gadget */
552 StringFrame,
553 MUIA_CycleChain, TRUE,
554 MUIA_String_Accept, (IPTR)"0123456789",
555 MUIA_FixWidthTxt, (IPTR)"55555",
556 End,
557 Child, yearaddobj = TextObject, /* year [-] gadget */
558 ButtonFrame,
559 MUIA_Background, MUII_ButtonBack,
560 MUIA_CycleChain, TRUE,
561 MUIA_Font, MUIV_Font_Button,
562 MUIA_InputMode, MUIV_InputMode_RelVerify,
563 MUIA_Text_Contents, "\033c+",
564 MUIA_FixWidthTxt, (IPTR)"-",
565 End,
566 End,
567 Child, calobj = CalendarObject,
568 MUIA_CycleChain, TRUE,
569 End,
570 End,
571 Child, VGroup, /* Clock box */
572 GroupFrame,
573 MUIA_Background, MUII_GroupBack,
574 Child, clockobj = ClockObject,
575 End,
576 Child, HGroup,
577 Child, HVSpace,
578 Child, PageGroup,
579 Child, HVSpace,
580 Child, HGroup,
581 MUIA_Group_Spacing, 0,
582 Child, TextObject, /* phantom time [-] gadget */
583 ButtonFrame,
584 MUIA_Background, MUII_ButtonBack,
585 MUIA_Font, MUIV_Font_Button,
586 MUIA_InputMode, MUIV_InputMode_RelVerify,
587 MUIA_Text_Contents, "\033c-",
588 MUIA_FixWidthTxt, (IPTR)"+",
589 End,
590 Child, TextObject, /* phantom time [+] gadget */
591 ButtonFrame,
592 MUIA_Background, MUII_ButtonBack,
593 MUIA_Font, MUIV_Font_Button,
594 MUIA_InputMode, MUIV_InputMode_RelVerify,
595 MUIA_Text_Contents, "\033c+",
596 MUIA_FixWidthTxt, (IPTR)"-",
597 End,
598 End,
599 End,
600 Child, hourobj = StringObject, /* hour gadget */
601 StringFrame,
602 MUIA_CycleChain, TRUE,
603 MUIA_String_Accept, (IPTR)"0123456789",
604 MUIA_FixWidthTxt, (IPTR)"555",
605 End,
606 Child, CLabel2(":"),
607 Child, minobj = StringObject, /* min gadget */
608 StringFrame,
609 MUIA_CycleChain, TRUE,
610 MUIA_String_Accept, (IPTR)"0123456789",
611 MUIA_FixWidthTxt, (IPTR)"555",
612 End,
613 Child, CLabel2(":"),
614 Child, secobj = StringObject, /* sec gadget */
615 StringFrame,
616 MUIA_CycleChain, TRUE,
617 MUIA_String_Accept, (IPTR)"0123456789",
618 MUIA_FixWidthTxt, (IPTR)"555",
619 End,
620 Child, HGroup,
621 MUIA_Group_Spacing, 0,
622 Child, timesubobj = TextObject, /* time [-] gadget */
623 ButtonFrame,
624 MUIA_Background, MUII_ButtonBack,
625 MUIA_CycleChain, TRUE,
626 MUIA_Font, MUIV_Font_Button,
627 MUIA_InputMode, MUIV_InputMode_RelVerify,
628 MUIA_Text_Contents, "\033c-",
629 MUIA_FixWidthTxt, (IPTR)"+",
630 End,
631 Child, timeaddobj = TextObject, /* time [+] gadget */
632 ButtonFrame,
633 MUIA_Background, MUII_ButtonBack,
634 MUIA_CycleChain, TRUE,
635 MUIA_Font, MUIV_Font_Button,
636 MUIA_InputMode, MUIV_InputMode_RelVerify,
637 MUIA_Text_Contents, "\033c+",
638 MUIA_FixWidthTxt, (IPTR)"-",
639 End,
640 End,
641 Child, HVSpace,
642 End,
643 End,
644 End,
645 Child, HGroup, /* save/use/cancel button row */
646 #if DO_SPECIAL_BUTTON_LAYOUT
647 MUIA_Group_LayoutHook, (IPTR)&buttonlayouthook,
648 #else
649 MUIA_FixHeight, 1,
650 MUIA_Group_SameWidth, TRUE,
651 #endif
652 Child, saveobj = CoolImageIDButton(MSG(MSG_GAD_SAVE), COOL_SAVEIMAGE_ID),
653 Child, useobj = CoolImageIDButton(MSG(MSG_GAD_USE), COOL_DOTIMAGE_ID),
654 Child, cancelobj = CoolImageIDButton(MSG(MSG_GAD_CANCEL), COOL_CANCELIMAGE_ID),
655 End,
656 End,
657 End,
658 End;
660 if (!app) Cleanup(MSG(MSG_CANT_CREATE_APP));
662 DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (IPTR) app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
664 DoMethod(cancelobj, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR) app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
665 DoMethod(saveobj, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR) app, 2, MUIM_Application_ReturnID, RETURNID_SAVE);
666 DoMethod(useobj, MUIM_Notify, MUIA_Pressed, FALSE, (IPTR) app, 2, MUIM_Application_ReturnID, RETURNID_USE);
668 DoMethod(wnd, MUIM_Notify, MUIA_Window_MenuAction, MSG_MEN_PROJECT_QUIT, (IPTR) app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
669 DoMethod(wnd, MUIM_Notify, MUIA_Window_MenuAction, MSG_MEN_EDIT_RESTORE, (IPTR) app, 2, MUIM_CallHook, (IPTR)&restorehook);
671 DoMethod(wnd, MUIM_Notify, MUIA_Window_ActiveObject, MUIV_EveryTime, (IPTR) app, 3, MUIM_CallHook, (IPTR)&activehook, MUIV_TriggerValue);
672 DoMethod(monthobj, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, (IPTR) calobj, 3, MUIM_NoNotifySet, MUIA_Calendar_Month0, MUIV_TriggerValue);
673 DoMethod(yearobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, (IPTR) yearobj, 3, MUIM_CallHook, (IPTR)&yearhook, 0);
674 DoMethod(yearaddobj, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, (IPTR) yearobj, 3, MUIM_CallHook, (IPTR)&yearhook, 1);
675 DoMethod(yearsubobj, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, (IPTR) yearobj, 3, MUIM_CallHook, (IPTR)&yearhook, -1);
676 DoMethod(timeaddobj, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, 1);
677 DoMethod(timesubobj, MUIM_Notify, MUIA_Timer, MUIV_EveryTime, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, -1);
678 DoMethod(clockobj, MUIM_Notify, MUIA_Clock_Ticked, TRUE, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, 0);
679 DoMethod(hourobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, 100);
680 DoMethod(minobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, 100);
681 DoMethod(secobj, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, (IPTR) clockobj, 3, MUIM_CallHook, (IPTR)&clockhook, 100);
683 set(calobj, MUIA_Calendar_Date, &clockdata);
684 set(monthobj, MUIA_Cycle_Active, clockdata.month - 1);
685 set(yearobj, MUIA_String_Integer, clockdata.year);
687 CallHook(&clockhook, clockobj, 0);
690 /*********************************************************************************************/
692 static void KillGUI(void)
694 DisposeObject(app);
697 /*********************************************************************************************/
699 static void HandleAll(void)
701 ULONG sigs = 0;
702 LONG returnid;
704 set (wnd, MUIA_Window_Open, TRUE);
706 for(;;)
708 returnid = (LONG) DoMethod(app, MUIM_Application_NewInput, (IPTR) &sigs);
710 if ((returnid == MUIV_Application_ReturnID_Quit) ||
711 (returnid == RETURNID_SAVE) || (returnid == RETURNID_USE)) break;
713 if (sigs)
715 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
716 if (sigs & SIGBREAKF_CTRL_C) break;
720 switch(returnid)
722 case RETURNID_SAVE:
723 case RETURNID_USE:
725 struct ClockData cal_date, clock_time, *dateptr;
726 IPTR frozen = 0;
728 get(calobj, MUIA_Calendar_Date, &dateptr);
729 cal_date = *dateptr;
731 get(clockobj, MUIA_Clock_Frozen, &frozen);
732 if (frozen)
734 get(clockobj, MUIA_Clock_Time, &dateptr);
735 clock_time = *dateptr;
737 else
739 struct timeval tv;
741 GetSysTime(&tv);
742 Amiga2Date(tv.tv_secs, &clock_time);
745 clockdata.sec = clock_time.sec;
746 clockdata.min = clock_time.min;
747 clockdata.hour = clock_time.hour;
748 clockdata.mday = cal_date.mday;
749 clockdata.month = cal_date.month;
750 clockdata.year = cal_date.year;
751 clockdata.wday = cal_date.wday;
753 UsePrefs();
756 break;
761 /*********************************************************************************************/
763 int main(void)
765 InitLocale("System/Prefs/Time.catalog", 1);
766 InitMenus();
767 OpenLibs();
768 OpenTimerDev();
769 GetArguments();
770 InitPrefs((args[ARG_USE] ? TRUE : FALSE), (args[ARG_SAVE] ? TRUE : FALSE));
771 GetVisual();
772 MakeGUI();
773 HandleAll();
774 Cleanup(NULL);
776 return 0;
779 /*********************************************************************************************/