home *** CD-ROM | disk | FTP | other *** search
- /* Quick Setup !RunImage in C & using Desklib. *
- * Written by John Fairhurst to aid booting the micro. *
- * Version 2.4 (converted from BASIC) 9/1/93 */
-
- #include "DeskLib:WimpSWIs.h"
- #include "DeskLib:Window.h"
- #include "DeskLib:Error.h"
- #include "DeskLib:Event.h"
- #include "DeskLib:EventMsg.h"
- #include "DeskLib:Handler.h"
- #include "DeskLib:Icon.h"
- #include "DeskLib:Msgs.h"
- #include "DeskLib:Resource.h"
- #include "DeskLib:Screen.h"
- #include "DeskLib:Template.h"
-
- #include <string.h>
- #include <stdlib.h>
-
- #include "roslib.h"
-
- static BOOL quit = FALSE;
- static window_handle win;
-
- static BOOL Button( event_pollblock *,void *);
-
- int main()
- {
- char appname[]="Quick Setup";
- char msgstore[25];
-
- Resource_Initialise("QS");
-
- Msgs_LoadFile("Messages");
-
- Event_Initialise(appname);
- EventMsg_Initialise();
-
- Screen_CacheModeInfo();
- EventMsg_Claim(message_MODECHANGE,event_ANY,Handler_ModeChange,NULL);
- Event_Claim(event_REDRAW, event_ANY, event_ANY, Handler_NullRedraw, NULL);
- Event_Claim(event_OPEN, event_ANY, event_ANY, Handler_OpenWindow, NULL);
-
- Template_Initialise();
- Template_LoadFile("Templates");
-
- win = Window_Create("chooser", 17);
-
- Msgs_Lookup("opt.zero",msgstore,24);
- Icon_SetText(win,4,msgstore);
- Msgs_Lookup("opt.one",msgstore,24);
- Icon_SetText(win,5,msgstore);
- Msgs_Lookup("opt.two",msgstore,24);
- Icon_SetText(win,6,msgstore);
- Msgs_Lookup("opt.three",msgstore,24);
- Icon_SetText(win,7,msgstore);
- Msgs_Lookup("opt.four",msgstore,24);
- Icon_SetText(win,8,msgstore);
- Msgs_Lookup("opt.pinboard",msgstore,24);
- Icon_SetText(win,2,msgstore);
-
- Window_Show(win,open_CENTERED);
-
- Event_Claim(event_CLICK, win, 3, Button, NULL);
-
- while (!quit) Event_Poll();
-
- return(0);
-
- }
-
- static BOOL Button(event_pollblock *event, void *reference)
- {
- char file[31] = "Obey <QS$Dir>.Files.";
- BOOL pinboard = FALSE;
- BOOL done = FALSE;
- int error;
-
- if (!(event->data.mouse.button.data.menu))
- {
- if (Icon_GetSelect(win,5)){ strcat(file,"1");done = TRUE;}
- if (Icon_GetSelect(win,6)){ strcat(file,"2");done = TRUE;}
- if (Icon_GetSelect(win,7)){ strcat(file,"3");done = TRUE;}
- if (Icon_GetSelect(win,8)){ strcat(file,"4");done = TRUE;}
- if (Icon_GetSelect(win,2)){
- error = os_cli("Obey <QS$Dir>.Files.PinBoard");
- if (error) Error_ReportFatal(1,"Something's wrong with the pinboard file.");
- }
- if (Icon_GetSelect(win,4)){ quit = TRUE;return(TRUE);}
- if (done){
- error = os_cli(file);
- if (error) Error_ReportFatal(1,"Something's wrong with the setup file.");
- quit = TRUE;
- }
- else
- Error_Report(4,"You must select a setup option.");
- }
- return(TRUE);
- }