home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / fli106c / examples / diawin.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-25  |  19.6 KB  |  857 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.02
  4. // Copyright (C) 1990, 1991
  5. // Software Dimensions
  6. //
  7. // Dialog Development System
  8. //
  9.  
  10. #include "fliwin.h"
  11. #include "colors.h"
  12. #include "dds.h"
  13.  
  14. #include <stdio.h>
  15. #include <alloc.h>
  16. #include <mem.h>
  17. #include <string.h>
  18. #include <io.h>
  19.  
  20. #include "open.h"
  21. #include "saveas.h"
  22. #include "yesno.h"
  23.  
  24. //-------------------------------------------------------------------------
  25. //
  26. // This is the event handler for the dialog window
  27. // The global event handler is in GLOBAL.CPP
  28. //
  29. // Other definitions for the dialog window class are farther down
  30. // in this file.
  31. //
  32. //-------------------------------------------------------------------------
  33.  
  34. int DialogWindow::EventHandler(int Event)
  35. {
  36.   switch(Event)
  37.   {
  38.     case winOpen:
  39.       OpenDialog &Open=*new OpenDialog("*.DDS");
  40.       char *File=Open.OpenFile();
  41.       char Storage[100];
  42.  
  43.       if (File)
  44.         strcpy(FileName,File);
  45.       else
  46.         strcpy(FileName,"");
  47.  
  48.       delete &Open;
  49.  
  50.       if (FileName[0])
  51.         LoadFile(FileName);
  52.       return RefreshEvent;
  53.  
  54.     case winSave:
  55.  
  56.       int SaveAsed=0;
  57.  
  58. ReRequestSave:
  59.  
  60.       if (!FileName[0])
  61.       {
  62.         SaveAs &Dialog=*new SaveAs("Save File As");
  63.         int Load=Dialog.UseDialog();
  64.         if (Load==FileSaveAs || Load==kbCr)
  65.         {
  66.           if (Dialog.FileName[0])
  67.             strcpy(FileName,Dialog.FileName);
  68.         }
  69.         else
  70.         {
  71.           delete &Dialog;
  72.           return CompleteEvent;
  73.         }
  74.         delete &Dialog;
  75.         SaveAsed=1;
  76.       }
  77.  
  78.       if (!strstr(FileName,".DDS"))
  79.       {
  80.         char Test[100];
  81.         strcpy(Test,FileName);
  82.         strcat(Test,".DDS");
  83.         if (!access(Test,0))
  84.         {
  85.           YesNo &Query=*new YesNo();
  86.           Query + "A file by that name already exists!"
  87.                 + ""
  88.                 + "Are you sure you want to save over it?";
  89.           Query.Title("Warning");
  90.           int Response=Query.UseYesNo();
  91.           delete &Query;
  92.           if (!Response && !SaveAsed)
  93.             return CompleteEvent;
  94.           else if (!Response && SaveAsed)
  95.           {
  96.             FileName[0]=0;
  97.             goto ReRequestSave;
  98.           }
  99.         }
  100.         SaveFile(Test);
  101.       }
  102.       else
  103.       {
  104.         if (!access(FileName,0))
  105.         {
  106.           YesNo &Query=*new YesNo();
  107.           Query + "A file by that name already exists!"
  108.                 + ""
  109.                 + "Are you sure you want to save over it?";
  110.           Query.Title("Warning");
  111.           int Response=Query.UseYesNo();
  112.           delete &Query;
  113.           if (!Response && !SaveAsed)
  114.             return CompleteEvent;
  115.           else if (!Response && SaveAsed)
  116.           {
  117.             FileName[0]=0;
  118.             goto ReRequestSave;
  119.           }
  120.         }
  121.         SaveFile(FileName);
  122.       }
  123.  
  124.       return CompleteEvent;
  125.  
  126.     case winSaveAs:
  127.  
  128. ReRequestSaveAs:
  129.  
  130.       if (strchr(FileName,'.'))
  131.         *(strchr(FileName,'.'))=0;
  132.  
  133.       SaveAs &Dialog=*new SaveAs("Save File As");
  134.       strcpy(Dialog.FileName,FileName);
  135.       int Load=Dialog.UseDialog();
  136.       if (Load==FileSaveAs || Load==kbCr)
  137.       {
  138.         if (Dialog.FileName[0])
  139.           strcpy(FileName,Dialog.FileName);
  140.       }
  141.       else
  142.       {
  143.         delete &Dialog;
  144.         return CompleteEvent;
  145.       }
  146.       delete &Dialog;
  147.  
  148.       if (FileName[0])
  149.       {
  150.         if (!strstr(FileName,".DDS"))
  151.         {
  152.           char Test[100];
  153.           strcpy(Test,FileName);
  154.           strcat(Test,".DDS");
  155.           if (!access(Test,0))
  156.           {
  157.             YesNo &Query=*new YesNo();
  158.             Query + "A file by that name already exists!"
  159.                   + ""
  160.                   + "Are you sure you want to save over it?";
  161.             Query.Title("Warning");
  162.             int Response=Query.UseYesNo();
  163.             delete &Query;
  164.             if (!Response)
  165.               goto ReRequestSaveAs;
  166.           }
  167.           SaveFile(Test);
  168.         }
  169.         else
  170.         {
  171.           if (!access(FileName,0))
  172.           {
  173.             YesNo &Query=*new YesNo();
  174.             Query + "A file by that name already exists!"
  175.                   + ""
  176.                   + "Are you sure you want to save over it?";
  177.             Query.Title("Warning");
  178.             int Response=Query.UseYesNo();
  179.             delete &Query;
  180.             if (!Response)
  181.               goto ReRequestSaveAs;
  182.           }
  183.           SaveFile(FileName);
  184.         }
  185.       }
  186.  
  187.       return CompleteEvent;
  188.  
  189.     case winGenCPP:
  190.  
  191. ReRequest:
  192.  
  193.       char Loader[50];
  194.  
  195.       SaveAs &Dia=*new SaveAs("Generate Into");
  196.       strcpy(Dia.FileName,"");
  197.       Load=Dia.UseDialog();
  198.       if (Load==FileSaveAs || Load==kbCr)
  199.       {
  200.         if (Dia.FileName[0])
  201.           strcpy(Loader,Dia.FileName);
  202.       }
  203.       else
  204.       {
  205.         delete &Dia;
  206.         return CompleteEvent;
  207.       }
  208.       delete &Dia;
  209.  
  210.       if (Loader[0])
  211.       {
  212.         if (!strstr(Loader,".CPP"))
  213.         {
  214.           char Test[100];
  215.           strcpy(Test,Loader);
  216.           strcat(Test,".CPP");
  217.           if (!access(Test,0))
  218.           {
  219.             YesNo &Query=*new YesNo();
  220.             Query + "That file exists!"
  221.                   + ""
  222.                   + "Are you sure you want to save over it?";
  223.             Query.Title("Warning");
  224.             int Response=Query.UseYesNo();
  225.             delete &Query;
  226.             if (!Response)
  227.               goto ReRequest;
  228.           }
  229.           Generate(Test);
  230.         }
  231.         else
  232.         {
  233.           if (!access(Loader,0))
  234.           {
  235.             YesNo &Query=*new YesNo();
  236.             Query + "That file exists!"
  237.                   + ""
  238.                   + "Are you sure you want to save over it?";
  239.             Query.Title("Warning");
  240.             int Response=Query.UseYesNo();
  241.             delete &Query;
  242.             if (!Response)
  243.               goto ReRequest;
  244.           }
  245.           Generate(Loader);
  246.         }
  247.       }
  248.       return CompleteEvent;
  249.  
  250.     case winNew:
  251.       if (NumberPieces)
  252.       {
  253.         YesNo &Query=*new YesNo();
  254.         Query + "There is stuff on this dialog!"
  255.               + ""
  256.               + "Are you sure you want to clear it?";
  257.         Query.Title("Warning");
  258.         int Response=Query.UseYesNo();
  259.         delete &Query;
  260.         if (!Response)
  261.           return CompleteEvent;
  262.       }
  263.  
  264.       RemoveTheMenus();
  265.  
  266.       if (NumberPieces)
  267.       {
  268.         for (int i=0;i<NumberPieces;i++)
  269.           delete Pieces[i];
  270.         free(Pieces);
  271.         Pieces=0;
  272.         NumberPieces=0;
  273.         CursorX=0;
  274.         CursorY=0;
  275.         Insert=0;
  276.         FileName[0]=0;
  277.         X=0;
  278.         Y=1;
  279.         Width=Blaze.WhatWidth();
  280.         Height=Blaze.WhatHeight()-2;
  281.         strcpy(DerivedClass,"DiaDerived");
  282.         if (Title)
  283.         {
  284.           delete Title;
  285.           Title=0;
  286.         }
  287.         CurrentColor=Colors.DiaInterior;
  288.       }
  289.  
  290.       for (int y=0;y<60;y++)
  291.         for (int x=0;x<sizeof(Interior[0]);x+=2)
  292.         {
  293.           *(Interior[y]+x)=0;
  294.           *(Interior[y]+x+1)=WinInterior;
  295.         }
  296.  
  297.       return RefreshEvent;
  298.  
  299.     case layoutTest:
  300.       TestDialog();
  301.       return CompleteEvent;
  302.  
  303.     case layoutSpecs:
  304.       LayOut();
  305.       return RefreshEvent;
  306.  
  307.     case layoutEditMode:
  308.       RemoveTheMenus();
  309.       VirtualizedInterior();
  310.       return CompleteEvent;
  311.  
  312.     case drawColor:
  313.       ChangeColor();
  314.       return CompleteEvent;
  315.  
  316.     case drawBox:
  317.       PlaceObject(PieceHandler::Box);
  318.       return CompleteEvent;
  319.  
  320.     case drawFillBox:
  321.       PlaceObject(PieceHandler::FilledBox);
  322.       return CompleteEvent;
  323.  
  324.     case drawHLine:
  325.             PlaceObject(PieceHandler::HorizontalLine);
  326.       return CompleteEvent;
  327.  
  328.     case drawVLine:
  329.       PlaceObject(PieceHandler::VerticalLine);
  330.       return CompleteEvent;
  331.  
  332.     case drawShadow:
  333.       PlaceObject(PieceHandler::Shadow);
  334.       return CompleteEvent;
  335.  
  336.     case drawErase:
  337.       PlaceObject(PieceHandler::EraseArea);
  338.       return CompleteEvent;
  339.  
  340.     case drawTrans:
  341.       PlaceObject(PieceHandler::ColorizeArea);
  342.       return CompleteEvent;
  343.  
  344.     case elementChar:
  345.       PlaceElement(PieceHandler::Character);
  346.       return CompleteEvent;
  347.  
  348.     case elementInt:
  349.       PlaceElement(PieceHandler::Integer);
  350.       return CompleteEvent;
  351.  
  352.     case elementLong:
  353.       PlaceElement(PieceHandler::Long);
  354.       return CompleteEvent;
  355.  
  356.     case elementFloat:
  357.       PlaceElement(PieceHandler::Float);
  358.       return CompleteEvent;
  359.  
  360.     case elementDouble:
  361.       PlaceElement(PieceHandler::Double);
  362.       return CompleteEvent;
  363.  
  364.     case elementBcd:
  365.       PlaceElement(PieceHandler::Bcd);
  366.       return CompleteEvent;
  367.  
  368.     case elementCheck:
  369.       PlaceElement(PieceHandler::Check);
  370.       return CompleteEvent;
  371.  
  372.     case elementPush:
  373.       PlaceElement(PieceHandler::Push);
  374.       return CompleteEvent;
  375.  
  376.     case elementHeading:
  377.       PlaceElement(PieceHandler::GroupHeading);
  378.       return CompleteEvent;
  379.  
  380.     case elementHRadio:
  381.       PlaceElement(PieceHandler::HRadio);
  382.       return CompleteEvent;
  383.  
  384.     case elementVRadio:
  385.       PlaceElement(PieceHandler::VRadio);
  386.       return CompleteEvent;
  387.  
  388.     case elementPickGeneric:
  389.       PlaceElement(PieceHandler::PickGeneric);
  390.       return CompleteEvent;
  391.  
  392.     case manipMove:
  393.       MoveObject();
  394.       return CompleteEvent;
  395.  
  396.     case manipSize:
  397.       SizeObject();
  398.       return CompleteEvent;
  399.  
  400.     case manipForward:
  401.       BringFront();
  402.             return CompleteEvent;
  403.  
  404.     case manipBack:
  405.       PushBack();
  406.       return CompleteEvent;
  407.  
  408.     case manipCopy:
  409.       CopyObject();
  410.       return CompleteEvent;
  411.  
  412.     case manipObjectColor:
  413.       ColorObject();
  414.       return CompleteEvent;
  415.  
  416.     case manipDeletePiece:
  417.       DeleteObject();
  418.       return CompleteEvent;
  419.  
  420.     case manipTextColor:
  421.       ColorText();
  422.       return CompleteEvent;
  423.  
  424.     case manipMoveText:
  425.       MoveText();
  426.       return CompleteEvent;
  427.  
  428.     case manipCopyText:
  429.       CopyText();
  430.       return CompleteEvent;
  431.  
  432.     case manipToStart:
  433.       ManipToStart();
  434.       return CompleteEvent;
  435.  
  436.     case manipToEnd:
  437.       ManipToEnd();
  438.       return CompleteEvent;
  439.  
  440.     case manipEarlier:
  441.       ManipEarlier();
  442.       return CompleteEvent;
  443.  
  444.     case manipLater:
  445.       ManipLater();
  446.       return CompleteEvent;
  447.  
  448.  
  449.     case kbRight:
  450.       if (CursorX<=Blaze.WhatWinWidth()-1)
  451.       {
  452.         CursorX++;
  453.         Cursor();
  454.       }
  455.       return CompleteEvent;
  456.  
  457.     case kbLeft:
  458.       if (CursorX)
  459.       {
  460.                 CursorX--;
  461.         Cursor();
  462.       }
  463.       return CompleteEvent;
  464.  
  465.     case kbDown:
  466.       if (CursorY<=Blaze.WhatWinHeight()-1)
  467.       {
  468.         CursorY++;
  469.         Cursor();
  470.       }
  471.       return CompleteEvent;
  472.  
  473.     case kbUp:
  474.       if (CursorY)
  475.       {
  476.         CursorY--;
  477.         Cursor();
  478.       }
  479.       return CompleteEvent;
  480.  
  481.     case kbHome:
  482.       CursorX=0;
  483.       Cursor();
  484.       return CompleteEvent;
  485.  
  486.     case kbEnd:
  487.       CursorX=Blaze.WhatWinWidth()-1;
  488.       Cursor();
  489.       return CompleteEvent;
  490.  
  491.     case kbPgUp:
  492.       CursorY=0;
  493.             Cursor();
  494.       return CompleteEvent;
  495.  
  496.     case kbPgDn:
  497.       CursorY=Blaze.WhatWinHeight()-1;
  498.       Cursor();
  499.       return CompleteEvent;
  500.  
  501.     case kbCr:
  502.       CursorX=0;
  503.       if (CursorY<=Blaze.WhatWinHeight()-1)
  504.       {
  505.         CursorY++;
  506.         Cursor();
  507.       }
  508.       return CompleteEvent;
  509.  
  510.     case kbIns:
  511.       Insert=(Insert)?0:1;
  512.       {
  513.         BlazeClass Blaze;
  514.  
  515.         Blaze (X+Width-5,Y+Height-1) << WinTitle << ((Insert)?"Ins":"Ovr");
  516.       }
  517.       return CompleteEvent;
  518.  
  519.     case ValidatedMousedEvent:
  520.       if (MouseEvent&MouseLeftButtonRelease || MouseButtonStatus&LeftButton)
  521.       {
  522.         CursorX=MouseHorizontal;
  523.         CursorY=MouseVertical;
  524.         Cursor();
  525.       }
  526.       if (MouseEvent&MouseLeftButtonPress)
  527.         MoveObject(1);
  528.       return CompleteEvent;
  529.  
  530.     case kbDel:
  531.             memmove((Interior[CursorY]+(CursorX*2)),(Interior[CursorY]+(CursorX*2)+2),
  532.         sizeof(Interior[0])-(CursorX*2));
  533.       VirtualizedInterior();
  534.       return CompleteEvent;
  535.  
  536.     case kbBackSpace:
  537.       if (!Insert)
  538.       {
  539.         if (!CursorX)
  540.           return CompleteEvent;
  541.         CursorX--;
  542.         *(Interior[CursorY]+(CursorX*2))=0;
  543.         *(Interior[CursorY]+(CursorX*2)+1)=CurrentColor;
  544.         VirtualizedInterior();
  545.         return CompleteEvent;
  546.       }
  547.       else
  548.       {
  549.         if (!CursorX)
  550.           return CompleteEvent;
  551.         CursorX--;
  552.         memmove((Interior[CursorY]+(CursorX*2)),(Interior[CursorY]+(CursorX*2)+2),
  553.           sizeof(Interior[0])-(CursorX*2));
  554.         VirtualizedInterior();
  555.         return CompleteEvent;
  556.       }
  557.  
  558.     case drawPlop:
  559.             int Plopped=PlopCharacter();
  560.  
  561.             if (Plopped)
  562.             {
  563.                 Event=Plopped;
  564.                 RemoveTheMenus();
  565.                 goto PlopChar;
  566.             }
  567.  
  568.             return CompleteEvent;
  569.  
  570.          default:
  571.             if (Event>=' ' && Event<='~')
  572.             {
  573.  
  574. PlopChar:
  575.  
  576.                 if (!Insert)
  577.                 {
  578.           *(Interior[CursorY]+(CursorX*2))=Event;
  579.           *(Interior[CursorY]+(CursorX*2)+1)=CurrentColor;
  580.           if (CursorX<=Blaze.WhatWinWidth()-1)
  581.           {
  582.             CursorX++;
  583.             Cursor();
  584.           }
  585.           VirtualizedInterior();
  586.           return CompleteEvent;
  587.         }
  588.         else
  589.         {
  590.           memmove((Interior[CursorY]+(CursorX*2)+2),(Interior[CursorY]+(CursorX*2)),
  591.             sizeof(Interior[0])-(CursorX*2));
  592.  
  593.           *(Interior[CursorY]+(CursorX*2))=Event;
  594.           *(Interior[CursorY]+(CursorX*2)+1)=CurrentColor;
  595.           if (CursorX<=Blaze.WhatWinWidth()-1)
  596.                     {
  597.             CursorX++;
  598.             Cursor();
  599.           }
  600.           VirtualizedInterior();
  601.           return CompleteEvent;
  602.         }
  603.             }
  604.     }
  605.     return Event;
  606. }
  607.  
  608. //-------------------------------------------------------------------------
  609. //
  610. // This is a nifty function that virtualizes the interior of the DDS
  611. // window so flicker doesn't happen when it is updated.  This function
  612. // is necessary since each time a new character is placed into the window
  613. // it must be updated "flicker free".
  614. //
  615. //-------------------------------------------------------------------------
  616.  
  617. void DialogWindow::VirtualizedInterior()
  618. {
  619.   int X, Y, Width, Height;
  620.  
  621.   Blaze.WindowInformation(X,Y,Width,Height);
  622.   char *VirtualizedScreen=new char[(Blaze.WhatWidth()*2)*Blaze.WhatHeight()];
  623.   Blaze.UseMemory(VirtualizedScreen);
  624.  
  625.   ShowInterior();
  626.  
  627.   MouseHide();
  628.   Blaze.UseVideo();
  629.   Blaze.BlockCopyVirtualToVisual(X,Y,Width,Height,VirtualizedScreen);
  630.   delete VirtualizedScreen;
  631.   MouseShow();
  632. }
  633.  
  634. //-------------------------------------------------------------------------
  635. //
  636. // This displays the interior of the dialog window -- all objects and
  637. // elements are drawn in the exact order in which they will be drawn
  638. // on the generated dialog
  639. //
  640. //-------------------------------------------------------------------------
  641.  
  642. void DialogWindow::ShowInterior()
  643. {
  644.   MouseHide();
  645.  
  646.   int X, Y, Width, Height;
  647.  
  648.   Blaze.WindowInformation(X,Y,Width,Height);
  649.  
  650.   Blaze.EraseArea(0,0,Width,Height,WinInterior);
  651.  
  652.   int Object=1;
  653.   char ZPos[10];
  654.  
  655.     // Blaze Drawing Tools
  656.  
  657.   if (NumberPieces)
  658.   {
  659.     for (int i=0;i<NumberPieces;i++)
  660.     {
  661.       PieceHandler &Piece=*Pieces[i];
  662.       if (Piece.LayOut<PieceHandler::__DUMMY__)
  663.       {
  664.         Piece.DrawFigure();
  665.         if (ZPositioning)
  666.         {
  667.           sprintf(ZPos,"O%d",Object++);
  668.           Blaze (Piece.X,Piece.Y) << Piece.Color << ZPos;
  669.         }
  670.       }
  671.     }
  672.   }
  673.  
  674.   // Blaze Text
  675.  
  676.   for (int y=0;y<Height;y++)
  677.   {
  678.     char *OutPut=Interior[y];
  679.     for (int x=0;x<Width;x++,OutPut+=2)
  680.     {
  681.       if (*OutPut)
  682.         Blaze (x,y) << (int)*(OutPut+1) << *OutPut;
  683.     }
  684.   }
  685.  
  686.   // Elements
  687.  
  688.   if (NumberPieces)
  689.   {
  690.     Object=1;
  691.  
  692.     for (int i=0;i<NumberPieces;i++)
  693.     {
  694.       PieceHandler &Piece=*Pieces[i];
  695.       if (Piece.LayOut>PieceHandler::__DUMMY__ && Piece.LayOut<PieceHandler::__DUMMY2__)
  696.       {
  697.         Piece.DrawFigure();
  698.         if (ZPositioning)
  699.         {
  700.           sprintf(ZPos,"E%d",Object++);
  701.           Blaze (Piece.X,Piece.Y) << Piece.Color << ZPos;
  702.  
  703.           if (Piece.Prompter && *Piece.Prompter)
  704.             Blaze (Piece.PromptX,Piece.PromptY) << Colors.DiaLocator << ZPos;
  705.         }
  706.       }
  707.     }
  708.   }
  709.  
  710.   // Group headings
  711.  
  712.   if (NumberPieces)
  713.   {
  714.     for (int i=0;i<NumberPieces;i++)
  715.     {
  716.       PieceHandler &Piece=*Pieces[i];
  717.       if (Piece.LayOut>PieceHandler::__DUMMY2__)
  718.         Piece.DrawFigure();
  719.     }
  720.   }
  721.  
  722.   MouseShow();
  723. }
  724.  
  725. //-------------------------------------------------------------------------
  726. //
  727. // This displays the cursor inside the dialog window
  728. //
  729. // It also display the current location and a count of elements and objects
  730. //
  731. //-------------------------------------------------------------------------
  732.  
  733. void DialogWindow::Cursor()
  734. {
  735.   Blaze.VisibleCursor();
  736.   if (CursorY>Blaze.WhatWinHeight()-1)
  737.     CursorY=Blaze.WhatWinHeight()-1;
  738.   if (CursorX>Blaze.WhatWinWidth()-1)
  739.     CursorX=Blaze.WhatWinWidth()-1;
  740.   Blaze.WindowGotoXY(CursorX,CursorY);
  741.  
  742.   int Objects=0;
  743.   int Elements=0;
  744.  
  745.   if (NumberPieces)
  746.   for (int i=0;i<NumberPieces;i++)
  747.   {
  748.     if (Pieces[i]->LayOut<PieceHandler::__DUMMY__)
  749.       Objects++;
  750.     else if (Pieces[i]->LayOut<PieceHandler::__DUMMY2__)
  751.       Elements++;
  752.   }
  753.  
  754.   BlazeClass Blaze;
  755.   char Locate[25];
  756.   sprintf(Locate,"%03dO %03dE %03dX %03dY",Objects,Elements,CursorX,CursorY);
  757.   Blaze (Blaze.WhatWidth()-31,0) << Colors.PromptLineBold << Locate;
  758. }
  759.  
  760. //-------------------------------------------------------------------------
  761. //
  762. // This overrides the ShowWindow virtual function in the WindowElement
  763. // class so we can draw a couple of extra items on the border of the dialog
  764. // box.  These items are the current color and insert mode status indicator.
  765. //
  766. // This illustrates how you can mess with the outside of the window.  You
  767. // can use this in your own programs!
  768. //
  769. //-------------------------------------------------------------------------
  770.  
  771. void DialogWindow::ShowWindow()
  772. {
  773.   WindowElement::ShowWindow();
  774.  
  775.   BlazeClass InsBlaze;
  776.   InsBlaze.UseMemory(Blaze.WhatOutput());
  777.  
  778.   InsBlaze (X+Width-5,Y+Height-1) << WinTitle << ((Insert)?"Ins":"Ovr");
  779.   InsBlaze (X+2,Y+Height-1) << CurrentColor << "Color";
  780. }
  781.  
  782. //-------------------------------------------------------------------------
  783. //
  784. // This is the constructor for the Dialog Window
  785. //
  786. //-------------------------------------------------------------------------
  787.  
  788. DialogWindow::DialogWindow(char *LoadIt)
  789. {
  790.   if (!LoadIt)
  791.     FileName[0]=0;
  792.   else
  793.     strcpy(FileName,LoadIt);
  794.  
  795.   ZoomIcon=0;
  796.  
  797.   CursorX=0;
  798.   CursorY=0;
  799.  
  800.   Interior=0;
  801.   Insert=0;
  802.  
  803.   strcpy(DerivedClass,"DiaDerived");
  804.  
  805.   CurrentColor=Colors.DiaInterior;
  806.  
  807.   WinInterior=Colors.DiaInterior;
  808.   WinBorder=Colors.DiaBorder;
  809.   WinIcons=Colors.DiaCloseIcon;
  810.   WinTitle=Colors.DiaTitle;
  811.   WinSizeCorner=Colors.DiaCloseIcon;
  812.  
  813.   Interior=new char[61][sizeof(Interior[0])];
  814.  
  815.   for (int y=0;y<60;y++)
  816.     for (int x=0;x<sizeof(Interior[0]);x+=2)
  817.     {
  818.       *(Interior[y]+x)=0;
  819.       *(Interior[y]+x+1)=WinInterior;
  820.     }
  821.  
  822.   Pieces=0;
  823.   NumberPieces=0;
  824.  
  825.   if (!(!Blaze))
  826.     !Blaze;
  827.  
  828.   if (!(+Blaze))
  829.     +Blaze;
  830.  
  831.   if (LoadIt)
  832.     LoadFile(FileName);
  833. }
  834.  
  835. //-------------------------------------------------------------------------
  836. //
  837. // This is the destructor for the Dialog Window
  838. //
  839. //-------------------------------------------------------------------------
  840.  
  841. DialogWindow::~DialogWindow()
  842. {
  843.   delete Interior;
  844.  
  845.   if (Title)
  846.     delete Title;
  847.  
  848.   if (Pieces)
  849.   {
  850.     for (int i=0;i<NumberPieces;i++)
  851.       delete Pieces[i];
  852.     free(Pieces);
  853.   }
  854. }
  855.  
  856.  
  857.