home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / program / fixtree3 / dialog.c next >
C/C++ Source or Header  |  1988-01-24  |  2KB  |  66 lines

  1. #include "dialog.h"
  2. #include <gemdefs.h>
  3. #include <obdefs.h>
  4. #include <osbind.h>
  5. #include "dialog.rsh"
  6.  
  7. /*
  8.         This program needs to be run in the same directory as the
  9.         "dialog.rsc" file is in.
  10. */
  11. main()
  12. {
  13.         OBJECT *dialog;
  14.         char name[11];
  15.  
  16.         appl_init();
  17. /*
  18.         if (!rsrc_load("dialog.rsc")) {
  19.                 form_alert(1, "[0][Cannot find dialog.rsc file|Terminating
  20. ...][OK]");
  21.                 exit(1);
  22.         }
  23. */
  24.  
  25.         fix_tree(NUM_TREE);
  26.  
  27.         rsrc_gaddr(0, DIALOG1, &dialog);
  28.         ((TEDINFO *)dialog[NAME].ob_spec)->te_ptext = name;
  29.         ((TEDINFO *)dialog[NAME].ob_spec)->te_txtlen = 10;
  30.         do_dialog(dialog, 1);
  31.  
  32.         rsrc_gaddr(0, DIALOG2, &dialog);
  33.         dialog[STRING].ob_spec = name;
  34.         do_dialog(dialog, 0);
  35.  
  36.         unfix_tree();
  37. }
  38.  
  39. do_dialog(dialog, flag)
  40. OBJECT *dialog;
  41. int     flag;   /* set to 1 if form_do is needed */
  42. {
  43.         int cx, cy, cw, ch;
  44.  
  45.         form_center(dialog, &cx, &cy, &cw, &ch);
  46.         form_dial(FMD_START, 0, 0, 0, 0, cx, cy, cw, ch);
  47.         form_dial(FMD_GROW, 0, 0, 0, 0, cx, cy, cw, ch);
  48.         objc_draw(dialog, 0, 10, cx, cy, cw, ch);
  49.         if (flag) form_do(dialog, 0);
  50.         else wait(4L);
  51.         form_dial(FMD_SHRINK, 0, 0, 0, 0, cx, cy, cw, ch);
  52.         form_dial(FMD_FINISH, 0, 0, 0, 0, cx, cy, cw, ch);
  53. }
  54.  
  55. wait(waittime)
  56. long     waittime;  /* seconds to wait */
  57. {
  58.   long init_time;
  59.  
  60.   init_time = Gettime;
  61.   while ((Gettime - init_time) < waittime/2)
  62.     {
  63.     ;
  64.     }
  65. }
  66.