home *** CD-ROM | disk | FTP | other *** search
/ EDUCORP 8 / Educorp2Compilation.sit / educorp2 / Demos / Aztec Source Level Debugger / demo / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-06-14  |  1.2 KB  |  76 lines

  1. #include "barchart.h"
  2.  
  3. struct XYBase Myxyb;
  4. struct Rect screenRect, pRect;
  5. struct WindowRecord wRecord;
  6.  
  7. main()
  8. {
  9.  
  10.     InitGraf(&qd.thePort);
  11.     InitWindows();
  12.     InitFonts();
  13.     setupmenus();
  14.     InitDialogs();
  15.     InitCursor();
  16.  
  17.     screenRect = qd.screenBits.bounds;
  18.     SetRect(&dragRect, 4, 24, screenRect.right-4, screenRect.bottom-4);
  19.  
  20.     pRect.top = 40;
  21.     pRect.left = 5;
  22.     pRect.bottom = 335;
  23.     pRect.right = 505;
  24.     myWindow = NewWindow(&wRecord, &pRect, "Sample Chart",
  25.                                                 TRUE, 0, -1L, TRUE, 0L);
  26.     SetPort(myWindow);
  27.     pRect = qd.thePort->portRect;
  28.  
  29.     redraw();
  30.  
  31.     handleevents();
  32.  
  33.     exit(0);
  34. }
  35.  
  36. redraw()
  37. {
  38.     register int i;
  39.     static char *hlabels[] = {" ", "84", "85", "86", "87" };
  40.     static char *vlabels[] = {"0", "10", "20", "30", "40" };
  41.  
  42.  
  43.     drawaxes(&Myxyb, 60, 230, 350, 180);
  44.  
  45.     labelhorizontal(&Myxyb, hlabels, 5);
  46.     labelvertical(&Myxyb, vlabels, 5);
  47.  
  48.     for (i=1;i<5;i++) {
  49.         drawbar(&Myxyb, -31+i*348/4, 20, i*24, &qd.black);
  50.     }
  51.  
  52.  
  53.     for (i=1;i<5;i++) {
  54.         drawbar(&Myxyb, -10+i*348/4, 20, i*36, &qd.ltGray);
  55.     }
  56.  
  57.  
  58.     for (i=1;i<5;i++) {
  59.         drawbar(&Myxyb, 11+i*348/4, 20, i*44, &qd.gray);
  60.     }
  61.  
  62. }
  63.  
  64.  
  65. setupmenus()
  66. {
  67.     int i;
  68.     InitMenus();
  69.     myMenus[0] = NewMenu(appleMenu, "\024");
  70.     AddResMenu(myMenus[0], 'DRVR');
  71.     for (i=0;i<NMENUS;i++)
  72.         InsertMenu(myMenus[i], 0);
  73.  
  74.     DrawMenuBar();
  75. }
  76.