home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / prbgi097.zip / C.ZIP / TVBGI.CPP < prev    next >
Text File  |  1992-12-15  |  18KB  |  554 lines

  1. /*---------------------------------------------------------*/
  2. /*                                                         */
  3. /*   Turbo Vision 1.0                                      */
  4. /*   Turbo Vision BGI Support Demo                         */
  5. /*   Copyright (c) 1991 by Borland International           */
  6. /*                                                         */
  7. /*---------------------------------------------------------*/
  8. /*
  9.    Sorry, this is my first OOP (and Turbo Vision) program.
  10.    Andrzej Resztak
  11.    e-mail: Resztak@PLUMCS11.bitnet
  12.  */
  13. #define Uses_TKeys
  14. #define Uses_TApplication
  15. #define Uses_TEvent
  16. #define Uses_TRect
  17. #define Uses_TDialog
  18. #define Uses_TButton
  19. #define Uses_TMenuBar
  20. #define Uses_TSubMenu
  21. #define Uses_TMenuItem
  22. #define Uses_TStatusLine
  23. #define Uses_TStatusItem
  24. #define Uses_TStatusDef
  25. #define Uses_TDeskTop
  26. #define Uses_MsgBox
  27. #define Uses_TChDirDialog
  28. #define Uses_THistory
  29. #define Uses_TWindow
  30. #define Uses_TInputLine
  31. #define Uses_TLabel
  32. #define Uses_TSItem
  33. #define Uses_TCheckBoxes
  34. #define Uses_TCollection
  35. #define Uses_TSystemError
  36. #include <tv.h>
  37.  
  38. #include "Tvbgi.h"
  39. #include <stdlib.h>
  40. #include <graphics.h>
  41. #include <string.h>
  42. #include <strstrea.h>
  43. #include <alloc.h>
  44. #include <assert.h>
  45.  
  46. #include "tv2.h"
  47. #include "prtgraph.h"
  48. #include "BGIDEMO.H"
  49.  
  50. #if __BCPLUSPLUS__==0x0200
  51.    #error Sorry, this program seems to not work under BC++ 2.0.
  52.    #error I am new to OOP and Turbo Vision and don't know why.
  53.    #error The error has nothing common with PrintBGI package.
  54.    #error It just hangs up when (or after) choosing printer.
  55.    #error So if you want to use it under BC++ 2.0 change code
  56.           choosing printer.
  57. #endif
  58.  
  59.  
  60. unsigned _stklen=4096;
  61.  
  62. char pathToDrivers[MAXPATH] = "";  // Default location of *.BGI files
  63.  
  64. int _PRT__pascal TVUserPrtFunc( void far* UserPtr,
  65.                                 PRT__handleT   *handlePPtr,
  66.                                 const char far* BGIpath );
  67.  
  68. static int StdBGI;
  69.  
  70. /*================*/
  71. TBGIApp::TBGIApp() :
  72. /*================*/
  73.     TProgInit( &TBGIApp::initStatusLine,
  74.            &TBGIApp::initMenuBar,
  75.            &TBGIApp::initDeskTop )
  76. {   const char far *p=NULL;
  77.     if (*pathToDrivers==0) p = getenv("BGIPATH");
  78.     if ( p==NULL ) p = pathToDrivers;
  79.     strcpy(Options.bgiPath, p);
  80.     fexpand(Options.bgiPath);
  81.  
  82.     Options.PicWidth = 4.0;
  83.     Options.PicHeight = 3.0;
  84.     Options.Preview=1;
  85.     StdBGI=Options.StdBGI=0;
  86.     Options.PrinterNo = Options.PRTModeNo = -1;
  87.     appDriver = DETECT;
  88.     appMode = 0;
  89.     if (graphAppInit(appDriver, appMode, Options.bgiPath, True) == False)
  90.     messageBox("Cannot load graphics driver.", mfError | mfOKButton);
  91.     PRT_LinkDrivers();
  92. }
  93.  
  94. /*================*/
  95. TBGIApp::~TBGIApp()
  96. /*================*/
  97. {
  98.     graphAppDone();
  99. }
  100.  
  101. /*===================*/
  102. void TBGIApp::newWin()
  103. /*===================*/
  104. {
  105.     static ushort winNum = 0;
  106.     TWindow *p;
  107.  
  108.     TRect r(deskTop->getExtent());
  109.     r = TRect( winNum % (deskTop->size.y-1),
  110.                winNum % (deskTop->size.y-1),
  111.                deskTop->size.x,
  112.                deskTop->size.y);
  113.  
  114.     char msgStr[10];
  115.     ostrstream os( msgStr, 10 );
  116.     os << "Window " << winNum << ends;
  117.     p = new TWindow( r, msgStr, 0 );
  118.     p->options |= ofTileable;
  119.     deskTop->insert( validView(p) );
  120.     winNum++;
  121. }
  122.  
  123. int ScreenPreview=1;
  124. /*========================================================================*/
  125. void TBGIApp::doGraphics(int far Graphfunc(void far * UserPointer), void far* UserPointer)
  126. /*========================================================================*/
  127. {
  128.     char errorMsg[MAXSIZE];
  129.     ushort    maxX,maxY;
  130.     static const int CLIP_ON=1;
  131.  
  132.  
  133.    if ( Options.StdBGI )
  134.    {  // Std. BGI driver and std. Borland example code
  135.       suspend();
  136.       if (graphicsStart() == False)
  137.        {
  138.          resume();
  139.           strcpy(errorMsg,grapherrormsg(graphresult()));
  140.           strcat( errorMsg,"." );
  141.           messageBox(errorMsg, mfError | mfOKButton);
  142.        }
  143.        else
  144.        {
  145.           maxX = getmaxx();
  146.           maxY = getmaxy();
  147.           outtextxy(0, (maxY - textheight("M")),
  148.               "Press any key to return...");
  149.           setviewport(0, 0, maxX - 1, (maxY - (textheight("M") + 5)), CLIP_ON);
  150.  
  151.          Graphfunc(UserPointer);
  152.  
  153.           graphicsStop();
  154.          resume();
  155.        }
  156.    }
  157.    else
  158.    {
  159.       static int   PRTdrv=DETECT,PRTmode;
  160.       int          ReturnCode;
  161.       unsigned     oldhelpCtx;
  162.       PRT_LinkDrivers(); /* link drivers definitions into an executable code */
  163.       ReturnCode=PRT_SetDriver ( Options.PrinterNo+1, Options.PRTModeNo,
  164.                                  1000*Options.PicWidth,  1000*Options.PicHeight,
  165.                                  PRT_INVERSE );
  166.       if ( ReturnCode )
  167.             messageBox("Wrong printer or mode specified", mfError | mfOKButton);
  168.       else
  169.       {
  170.          ScreenPreview=Options.Preview;
  171.          PRT_SetOutName(Options.PrintDest);
  172.          PRT_SetUserPrintFunc(TVUserPrtFunc);
  173.          if ( PRTdrv==DETECT )
  174.          {
  175.             PRTmode=0;
  176.             /* If you want you may not linkining in the BitImage BGI driver into the */
  177.             /* EXE file. To do comment out following two lines. */
  178.             PRTdrv = PRT_installuserdriver ( "BitImage", NULL );
  179.             PRT_registerfarbgidriver ( BitImage );
  180.             PRT_SetHaltVariable((unsigned char *)&TSystemError::ctrlBreakHit);
  181.          }
  182.          oldhelpCtx = helpCtx;
  183.          helpCtx = hcGraphBuild;
  184.          TProgram::application->statusLine->update(); // change status line
  185.          TSystemError::ctrlBreakHit=0;     // reset break indicator
  186.          ReturnCode = PRT_PrintBGI ( &PRTdrv,&PRTmode,Options.bgiPath,
  187.                                      Graphfunc, UserPointer );
  188.          helpCtx = oldhelpCtx;
  189.          TProgram::application->statusLine->update();
  190.          if ( ReturnCode )
  191.              messageBox(PRT_grapherrormsg(ReturnCode), mfError | mfOKButton);
  192.       }
  193.    }
  194.  
  195. }
  196.  
  197. /*-------------------------------------------------*/
  198. void TEnumPrinter::newFocusedItem( ccIndex newItem )
  199. /*-------------------------------------------------*/
  200. {
  201.    TEnumValue::newFocusedItem(newItem);
  202.    if (EnumM!=NULL) EnumM->setModes(False);
  203. }
  204.  
  205. /*----------------------------------------------*/
  206. TEnumPrinter::TEnumPrinter(const TRect& bounds ):
  207.    TEnumValue(bounds,32)
  208. /*----------------------------------------------*/
  209. {  int maxl=0;
  210.     EnumM=NULL;
  211.     TStrCollection *PrinterNames= new TStrCollection ( PRT_MaxDriver(),PRT_MaxDriver() );
  212.     for ( int i=1; i<=PRT_MaxDriver(); i++ )
  213.     {   const char*s;
  214.         PRT_DriverName(i,&s);
  215.         if ( maxl<strlen(s) ) maxl=strlen(s);
  216.         PrinterNames->insert(newStr(s));
  217.     }
  218.    newList(PrinterNames,-1);
  219. }
  220.  
  221. /*-----------------------------------------------------------------*/
  222. TEnumMode::TEnumMode ( const TRect& bounds, const TEnumPrinter *EP ):
  223. /*-----------------------------------------------------------------*/
  224.    TEnumValue( bounds,32 )
  225. {
  226.    EnumP=EP;
  227.    setModes(False);
  228. };
  229.  
  230. /*------------------*/
  231. Boolean TEnumMode::setModes(Boolean errMsg)
  232. /*------------------*/
  233. {  int p;
  234.    p = EnumP->focusedItem;
  235.     if ( p<0 || p>=PRT_MaxDriver() )
  236.     {
  237.        if ( errMsg )
  238.             messageBox("You must specify printer first", mfError | mfOKButton);
  239.        return False;
  240.     }
  241.     else
  242.     {
  243.        int maxmode;
  244.        PRT_MaxMode(p+1,&maxmode);
  245.        TStrCollection *ModeNames= new TStrCollection ( maxmode+1,maxmode+1 );
  246.        for ( int i=0; i<=maxmode; i++ )
  247.        {   const char*s;
  248.            PRT_ModeName(p+1,i,&s);
  249.            ModeNames->insert(newStr(s));
  250.        }
  251.        newList(ModeNames,maxmode);
  252.        return True;
  253.     }
  254. }
  255.  
  256. /*----------------------------------------------*/
  257. void TEnumMode::MakeSelection()
  258. /*----------------------------------------------*/
  259. {
  260.    if ( setModes(True) )
  261.       TEnumValue::MakeSelection();
  262. }
  263.  
  264. /*=======================*/
  265. void TBGIApp::SetGraphOptions()
  266. /*=======================*/
  267. {
  268.  
  269.     TDialog *d = new TDialog(TRect(0,0,55,17), "Graph options");
  270.     d->options |= ofCentered;
  271.  
  272.     // Buttons
  273.     d->insert(new TButton( TRect(31,14,40,16), "~C~ancel", cmCancel, bfNormal) );
  274.     d->insert(new TButton( TRect(10,14,19,16),"O~K~", cmOK, bfDefault) );
  275.  
  276.     // Input line, history list and label
  277.     TInputLine *pathInput = new TInputLine( TRect(22,2,50,3), MAXPATH );
  278.     d->insert( pathInput );
  279.     // d->insert( new THistory(TRect(52,2,55,3), pathInput, hlSetBGIPath) );
  280.     d->insert ( new TLabel( TRect(2,2,21,3), "~B~GI path:", pathInput ) );
  281.  
  282.     TInputLine *PrtInput = new TInputLine( TRect(22,4,50,5), MAXPATH );
  283.     d->insert( PrtInput );
  284.     d->insert ( new TLabel( TRect(2,4,21,5), "print ~D~estination:", PrtInput ) );
  285.  
  286.     TInput_float *Wfloat = new TInput_float(TRect(14,6,22,7),7);
  287.     d->insert( Wfloat );
  288.     d->insert ( new TLabel( TRect(2,6,11,7), "~W~idth:", Wfloat ) );
  289.     TInput_float *Hfloat = new TInput_float(TRect(44,6,52,7),7);
  290.     d->insert( Hfloat );
  291.     d->insert ( new TLabel( TRect(32,6,41,7), "~H~eight:", Hfloat ) );
  292.  
  293.     d->insert ( new TCheckBoxes(TRect(2,8,31,9),
  294.                 new TSItem("screen pre~V~iew",NULL)) );
  295.     d->insert ( new TCheckBoxes( TRect(2,9,31,10),
  296.                                new TSItem("~S~tandard BGI driver",NULL) ) );
  297.  
  298.     TEnumPrinter *EP = new TEnumPrinter( TRect(16,11,50,12) );
  299.     d->insert( EP );
  300.     d->insert ( new TEnumArrow( TRect(50,11,51,12), "", EP ) );
  301.     d->insert ( new TLabel( TRect(2,11,15,12), "~P~rinter type", EP ) );
  302.  
  303.     TEnumMode *EM = new TEnumMode( TRect(16,12,50,13), EP );
  304.     d->insert( EM );
  305.     d->insert ( new TEnumArrow( TRect(50,12,51,13), "", EM ) );
  306.     d->insert ( new TLabel( TRect(2,12,15,13), "printer ~M~ode", EM ) );
  307.  
  308.     EP->EnumM = EM;
  309.     EP->setData(&Options.PrinterNo);
  310.  
  311.     fexpand(Options.bgiPath);
  312.     strcpy(Options.PrintDest,PRT_GetOutName());
  313.     d->setData(&Options);
  314.     d = (TDialog *) validView(d);
  315.     if (d != NULL)
  316.     {
  317.       d->selectNext(True);
  318.        if (deskTop->execView(d) == cmOK)
  319.        {
  320.            d->getData(&Options);
  321.            if ( (strlen(Options.bgiPath) > 0) && (Options.bgiPath[strlen(Options.bgiPath)-1] != '\\') )
  322.            strcat(Options.bgiPath,"\\");
  323.           PRT_SetOutName(Options.PrintDest);
  324.            if ( graphAppInit(appDriver, appMode, Options.bgiPath, True) == False )
  325.            messageBox("Cannot load graphics driver.", mfError | mfOKButton);
  326.        }
  327.     destroy( d );
  328.    StdBGI = Options.StdBGI;
  329.     }
  330. }
  331.  
  332. /*======================*/
  333. void TBGIApp::changeDir()
  334. /*======================*/
  335. {
  336.     TView *p;
  337.  
  338.     p = validView(new TChDirDialog(0, hlChangeDir));
  339.     if (p != NULL)
  340.     {
  341.     deskTop->execView(p);
  342.     destroy( p );
  343.     }
  344. }
  345.  
  346. /*=================*/
  347. void TBGIApp::tile()
  348. /*=================*/
  349. {
  350.     TRect r(deskTop->getExtent());
  351.     deskTop->tile(r);
  352. }
  353.  
  354. /*====================*/
  355. void TBGIApp::cascade()
  356. /*====================*/
  357. {
  358.     TRect r(deskTop->getExtent());
  359.     deskTop->cascade(r);
  360. }
  361.  
  362. /*=====================================*/
  363. void TBGIApp::handleEvent(TEvent& event)
  364. /*=====================================*/
  365. {
  366.     TApplication::handleEvent(event);
  367.     switch (event.what)
  368.     {
  369.        case evCommand:
  370.        switch (event.message.command)
  371.        {
  372.            case cmNewWin:
  373.            newWin();
  374.            break;
  375.            case cmChangeDir:
  376.            changeDir();
  377.            break;
  378.            case cmGraphOptions:
  379.            SetGraphOptions();
  380.            break;
  381.  
  382.          case cmReportStatus     : doGraphics(ReportStatus     ,&appDriver); break;
  383.          case cmBar3DDemo        : doGraphics(Bar3DDemo        ,NULL); break;
  384.          case cmRandomBars       : doGraphics(RandomBars       ,NULL); break;
  385.          case cmColorDemo        : doGraphics(ColorDemo        ,NULL); break;
  386.          case cmArcDemo          : doGraphics(ArcDemo          ,NULL); break;
  387.          case cmCircleDemo       : doGraphics(CircleDemo       ,NULL); break;
  388.          case cmPieDemo          : doGraphics(PieDemo          ,NULL); break;
  389.          case cmBarDemo          : doGraphics(BarDemo          ,NULL); break;
  390.          case cmLineRelDemo      : doGraphics(LineRelDemo      ,NULL); break;
  391.          case cmPutPixelDemo     : doGraphics(PutPixelDemo     ,NULL); break;
  392.          case cmPutImageDemo     : doGraphics(PutImageDemo     ,NULL); break;
  393.          case cmLineToDemo       : doGraphics(LineToDemo       ,NULL); break;
  394.          case cmLineStyleDemo    : doGraphics(LineStyleDemo    ,NULL); break;
  395.          case cmUserLineStyleDemo: doGraphics(UserLineStyleDemo,NULL); break;
  396.          case cmFillStyleDemo    : doGraphics(FillStyleDemo    ,NULL); break;
  397.          case cmFillPatternDemo  : doGraphics(FillPatternDemo  ,NULL); break;
  398.          case cmPolyDemo         : doGraphics(PolyDemo         ,NULL); break;
  399.  
  400.            case cmTile:
  401.            tile();
  402.            break;
  403.            case cmCascade:
  404.            cascade();
  405.            break;
  406.            default :
  407.            return;
  408.  
  409.        }
  410.        break;
  411.        default:
  412.            return;
  413.     }
  414.    clearEvent(event);
  415. }
  416.  
  417. /*=====================================*/
  418. TMenuBar *TBGIApp::initMenuBar(TRect r)
  419. /*=====================================*/
  420. {
  421.  
  422.     r.b.y = r.a.y + 1;
  423.  
  424.     return new TMenuBar( r,
  425.        *new TSubMenu( "~T~est", hcNoContext ) +
  426.     //*new TMenuItem( "~B~GI settings...", 0, kbNoKey, hcNoContext ) +
  427.     *new TMenuItem( "~G~raph options...", cmGraphOptions,kbNoKey, hcNoContext ) +
  428.          newLine() +
  429.     *new TMenuItem( "~C~hange dir...", cmChangeDir, kbNoKey, hcNoContext ) +
  430.     *new TMenuItem( "E~x~it", cmQuit, kbAltX, hcNoContext, "Alt-X" ) +
  431.    *new TSubMenu( "~G~raph", hcNoContext ) +
  432.       *new TMenuItem( "ReportStatus     ", cmReportStatus     ,kbNoKey, hcNoContext ) +
  433.       *new TMenuItem( "Bar3DDemo        ", cmBar3DDemo        ,kbNoKey, hcNoContext ) +
  434.       *new TMenuItem( "RandomBars       ", cmRandomBars       ,kbNoKey, hcNoContext ) +
  435.       *new TMenuItem( "ColorDemo        ", cmColorDemo        ,kbNoKey, hcNoContext ) +
  436.       *new TMenuItem( "ArcDemo          ", cmArcDemo          ,kbNoKey, hcNoContext ) +
  437.       *new TMenuItem( "CircleDemo       ", cmCircleDemo       ,kbNoKey, hcNoContext ) +
  438.       *new TMenuItem( "PieDemo          ", cmPieDemo          ,kbNoKey, hcNoContext ) +
  439.       *new TMenuItem( "BarDemo          ", cmBarDemo          ,kbNoKey, hcNoContext ) +
  440.       *new TMenuItem( "LineRelDemo      ", cmLineRelDemo      ,kbNoKey, hcNoContext ) +
  441.       *new TMenuItem( "PutPixelDemo     ", cmPutPixelDemo     ,kbNoKey, hcNoContext ) +
  442.       *new TMenuItem( "PutImageDemo     ", cmPutImageDemo     ,kbNoKey, hcNoContext ) +
  443.       *new TMenuItem( "LineToDemo       ", cmLineToDemo       ,kbNoKey, hcNoContext ) +
  444.       *new TMenuItem( "LineStyleDemo    ", cmLineStyleDemo    ,kbNoKey, hcNoContext ) +
  445.       *new TMenuItem( "UserLineStyleDemo", cmUserLineStyleDemo,kbNoKey, hcNoContext ) +
  446.       *new TMenuItem( "FillStyleDemo    ", cmFillStyleDemo    ,kbNoKey, hcNoContext ) +
  447.       *new TMenuItem( "FillPatternDemo  ", cmFillPatternDemo  ,kbNoKey, hcNoContext ) +
  448.       *new TMenuItem( "PolyDemo         ", cmPolyDemo         ,kbNoKey, hcNoContext ) +
  449.     *new TSubMenu( "~W~indows", hcNoContext ) +
  450.     *new TMenuItem( "~S~ize/move", cmResize, kbCtrlF5, hcNoContext, "Ctrl-F5" ) +
  451.     *new TMenuItem( "~Z~oom", cmZoom, kbF5, hcNoContext, "F5" ) +
  452.     *new TMenuItem( "~T~ile", cmTile, kbNoKey, hcNoContext ) +
  453.     *new TMenuItem( "C~a~scade", cmCascade, kbNoKey, hcNoContext ) +
  454.     *new TMenuItem( "~N~ext", cmNext, kbF6, hcNoContext, "F6" ) +
  455.     *new TMenuItem( "~P~revious", cmPrev, kbShiftF6, hcNoContext, "Shift-F6" ) +
  456.     *new TMenuItem( "~C~lose",cmClose, kbAltF3, hcNoContext, "Alt-F3" ) +
  457.          newLine() +
  458.     *new TMenuItem( "Add ~w~indow", cmNewWin, kbF4, hcNoContext, "F4" )
  459.     );
  460.  
  461. }
  462.  
  463. /*==========================================*/
  464. TStatusLine *TBGIApp::initStatusLine(TRect r)
  465. /*==========================================*/
  466. {
  467.     r.a.y = r.b.y - 1;
  468.     return new TStatusLine( r,
  469.     *new TStatusDef( 0, 0xFFF0 ) +
  470.         *new TStatusItem( "~Alt-X~ Exit", kbAltX, cmQuit ) +
  471.         // *new TStatusItem( "~Alt-F5~ Graph", kbAltF5, cmDoGraphics ) +
  472.         *new TStatusItem( 0, kbF10, cmMenu ) +
  473.         *new TStatusItem( 0, kbAltF3, cmClose ) +
  474.         *new TStatusItem( 0, kbF5, cmZoom ) +
  475.         *new TStatusItem( 0, kbCtrlF5, cmResize ) +
  476.         *new TStatusItem("", kbF6, cmNext) +
  477.     *new TStatusDef( 0xfffe, hcGraphBuild ) +
  478.         *new TStatusItem( "Creating bit image map of the picture", kbAltX, cmQuit ) +
  479.     *new TStatusDef( 0xffff, hcGraphPrint ) +
  480.         *new TStatusItem( "Printing picture - press Ctrl Break to stop", kbAltX, cmQuit )
  481.         );
  482. }
  483.  
  484. /*========================*/
  485. void TBGIApp::outOfMemory()
  486. /*========================*/
  487. {
  488.     messageBox("Out of memory.", mfError | mfOKButton);
  489. }
  490.  
  491.  
  492.     TBGIApp bgiApp;
  493. /*=======*/
  494. int main()
  495. /*=======*/
  496. {
  497.     assert ( heapcheck()>0 );
  498.     assert ( heapfillfree(0x12f7)>0 );
  499.     assert ( heapcheckfree(0x12f7)>0 );
  500.  
  501.     bgiApp.run();
  502.     return 0;
  503. }
  504.  
  505.  
  506. /*                         */
  507. /* CHANGETEXTSTYLE: similar to settextstyle, but checks for */
  508. /* errors that might occur whil loading the font file.      */
  509. /*                         */
  510.  
  511. /*========================================================*/
  512. void changetextstyle(int font, int direction, int charsize)
  513. /*========================================================*/
  514. {
  515.   int m;
  516.   int x,y;
  517.  
  518.   graphresult();        /* clear error code     */
  519.   if ( font == DEFAULT_FONT )
  520.   {
  521.       PRT_Resolution ( &x,&y );
  522.       m = min ( y+60/120, getmaxx()/600+1 );
  523.       if (m>1) charsize *=m;
  524.   }
  525.   settextstyle(font, direction, charsize);
  526.   // grErrorTest();
  527. }
  528.  
  529.  
  530. /*==============*/
  531. void Pause(void)
  532. /*==============*/
  533. {
  534.   static char msg[] = "Esc aborts, Ctrl-P prints, other key continue ...";
  535.   TEvent event;
  536.  
  537.   StatusLine( msg );       /* Put msg at bottom of screen   */
  538.  
  539.    if ( StdBGI )
  540.    {
  541.        do
  542.       {
  543.            event.getKeyEvent();
  544.            // if (event.what == evNothing) event.getMouseEvent();
  545.        } while ( event.what != evMouseDown &&  event.what != evKeyDown );
  546.       // clearEvent(event);
  547.    }
  548. }
  549.  
  550.  
  551.  
  552. #include "BGIDEMO.INC"                                     /* A.R. */
  553.  
  554.