home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / discutils / bootup / qsetup / !QSetup / Source < prev    next >
Encoding:
Text File  |  1994-09-04  |  2.6 KB  |  99 lines

  1.   /* Quick Setup !RunImage in C & using Desklib.          *
  2.    * Written by John Fairhurst to aid booting the micro.  *
  3.    * Version 2.4 (converted from BASIC) 9/1/93            */
  4.  
  5. #include "DeskLib:WimpSWIs.h"          
  6. #include "DeskLib:Window.h"            
  7. #include "DeskLib:Error.h"
  8. #include "DeskLib:Event.h"
  9. #include "DeskLib:EventMsg.h"
  10. #include "DeskLib:Handler.h"
  11. #include "DeskLib:Icon.h"
  12. #include "DeskLib:Msgs.h"
  13. #include "DeskLib:Resource.h"
  14. #include "DeskLib:Screen.h"
  15. #include "DeskLib:Template.h"
  16.  
  17. #include <string.h>
  18. #include <stdlib.h>
  19.  
  20. #include "roslib.h"
  21.  
  22. static BOOL quit = FALSE;
  23. static window_handle win;
  24.  
  25. static BOOL Button( event_pollblock *,void *);
  26.  
  27. int main()
  28. {
  29.   char appname[]="Quick Setup";
  30.   char msgstore[25];
  31.  
  32.   Resource_Initialise("QS");
  33.  
  34.   Msgs_LoadFile("Messages");
  35.  
  36.   Event_Initialise(appname);
  37.   EventMsg_Initialise();
  38.   
  39.   Screen_CacheModeInfo();
  40.   EventMsg_Claim(message_MODECHANGE,event_ANY,Handler_ModeChange,NULL);
  41.   Event_Claim(event_REDRAW, event_ANY, event_ANY, Handler_NullRedraw, NULL);
  42.   Event_Claim(event_OPEN, event_ANY, event_ANY, Handler_OpenWindow, NULL);
  43.  
  44.   Template_Initialise();
  45.   Template_LoadFile("Templates");
  46.  
  47.   win = Window_Create("chooser", 17);
  48.  
  49.   Msgs_Lookup("opt.zero",msgstore,24);
  50.   Icon_SetText(win,4,msgstore);
  51.   Msgs_Lookup("opt.one",msgstore,24);
  52.   Icon_SetText(win,5,msgstore);
  53.   Msgs_Lookup("opt.two",msgstore,24);
  54.   Icon_SetText(win,6,msgstore);
  55.   Msgs_Lookup("opt.three",msgstore,24);
  56.   Icon_SetText(win,7,msgstore);
  57.   Msgs_Lookup("opt.four",msgstore,24);
  58.   Icon_SetText(win,8,msgstore);
  59.   Msgs_Lookup("opt.pinboard",msgstore,24);
  60.   Icon_SetText(win,2,msgstore);
  61.  
  62.   Window_Show(win,open_CENTERED);  
  63.  
  64.   Event_Claim(event_CLICK, win, 3, Button, NULL);
  65.  
  66.   while (!quit) Event_Poll();
  67.  
  68.   return(0);
  69.   
  70. }
  71.  
  72. static BOOL Button(event_pollblock *event, void *reference)
  73. {
  74.   char file[31] = "Obey <QS$Dir>.Files.";
  75.   BOOL pinboard = FALSE;
  76.   BOOL done = FALSE;
  77.   int error;
  78.  
  79.   if (!(event->data.mouse.button.data.menu))
  80.   {
  81.     if (Icon_GetSelect(win,5)){ strcat(file,"1");done = TRUE;}
  82.     if (Icon_GetSelect(win,6)){ strcat(file,"2");done = TRUE;}
  83.     if (Icon_GetSelect(win,7)){ strcat(file,"3");done = TRUE;}
  84.     if (Icon_GetSelect(win,8)){ strcat(file,"4");done = TRUE;}
  85.     if (Icon_GetSelect(win,2)){
  86.      error = os_cli("Obey <QS$Dir>.Files.PinBoard");
  87.      if (error) Error_ReportFatal(1,"Something's wrong with the pinboard file.");
  88.     }
  89.     if (Icon_GetSelect(win,4)){ quit = TRUE;return(TRUE);}
  90.     if (done){
  91.      error = os_cli(file);
  92.      if (error) Error_ReportFatal(1,"Something's wrong with the setup file.");
  93.      quit = TRUE;
  94.     }
  95.     else
  96.      Error_Report(4,"You must select a setup option.");
  97.   }
  98.   return(TRUE);
  99. }