home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / CFDFront / CFDFront.h < prev    next >
Encoding:
Text File  |  1992-02-21  |  37.0 KB  |  816 lines  |  [TEXT/MPS ]

  1. // *********************************************************************************
  2. //    TInformationView Header
  3. // *********************************************************************************
  4. class TInformationView : public TDialogView
  5.     {
  6.     private:
  7.         TDocument        *    fDocument;
  8.         TEditText            *    XCoord, * YCoord;
  9.         TStaticText        *    fInfoBox, * fLocBox;
  10. //        TPointData        * fPoint;
  11. //        TBoundryList    * fBoundry;
  12. //        TGPoint        * fgPoint;
  13.         float                 saveX, saveY;
  14.         Point                 savePt;
  15.     public:
  16. // ----------------------------------------------------------------------------------------------------
  17. //    the methods
  18. // ----------------------------------------------------------------------------------------------------
  19.         void IInformationView(TDocument * doc);                                                // initialize the information view
  20.         pascal void IRes(TDocument *, TView *, Ptr *);
  21.         pascal void Draw(Rect * thisRect);                                                        // Draws the view seen in the window. 
  22.         pascal void SuperViewChangedSize(VPoint *delta, Boolean invalidate);    // superview moved; move tinfoview
  23.         pascal void  DoChoice(TView *origView, short itsChoice);                        // do key choice
  24.         void StatusString (Point thePoint);                                                        // display the point coordinates in real.
  25.         void InfoString(char * theString);                                                            // display a message
  26.         void ClrInfo (void);                                                                                // clear message window
  27.         pascal struct TCommand * DoMenuCommand(CmdNumber aCommand);    // do a menu choice
  28.         void ShowDimension (void);                                                                    // show # rows & # columns in grid
  29.     };
  30.  
  31. TInformationView    *gInfoView;
  32. // *********************************************************************************
  33. //    TMDialog - Header
  34. //        Provides a base class for the modeless dialog windows in this program
  35. // *********************************************************************************
  36. class TMDialog : public TDialogView
  37.     {
  38.     protected :
  39.         union xbox
  40.             {
  41.             IDType boxID;
  42.             char boxCH[5];
  43.             };
  44.         union xbox tbox;
  45.  
  46.     public:
  47. // ----------------------------------------------------------------------------------------------------
  48. //    the methods
  49. // ----------------------------------------------------------------------------------------------------
  50.         virtual void BringToFront(void);
  51.         virtual void GetControlName (short index,char * strng);
  52.     };
  53.     
  54. // *********************************************************************************
  55. //    TOptPremix - Header
  56. // *********************************************************************************
  57. class TPremix : public TDialogView
  58.     {
  59.     public:
  60.         void GetParams(void);                                                                            // get the data
  61.     };
  62.     
  63. // *********************************************************************************
  64. //    TDiffusion - Header
  65. // *********************************************************************************
  66. class TDiffusion : public TDialogView
  67.     {
  68.     public:
  69.         void GetParams(void);                                                                            // get the data
  70.     };
  71.     
  72. // *********************************************************************************
  73. //    TTurbulence - Header
  74. // *********************************************************************************
  75. class TTurbulence : public TDialogView
  76.     {
  77.     public:
  78.         void GetParams(void);                                                                            // get the data
  79.     };
  80.     
  81. // *********************************************************************************
  82. //    TPressure - Header
  83. // *********************************************************************************
  84. class TPressure : public TDialogView
  85.     {
  86.     public:
  87.         void GetParams(void);                                                                            // get the data
  88.     };
  89.     
  90. // *********************************************************************************
  91. //    TOptPrint - Header
  92. //        inherits all methods and vars from TDialogView
  93. //        overrides method : DoChoice
  94. // *********************************************************************************
  95. class TOptPrint : public TMDialog
  96.     {
  97.     public:
  98. // ----------------------------------------------------------------------------------------------------
  99. //    the methods
  100. // ----------------------------------------------------------------------------------------------------
  101.         pascal void IRes(TDocument *itsDocument, TView *itsSuperView, Ptr *itsParams);
  102.         pascal void DoChoice(TView *origView, short itsChoice);
  103.         pascal void DismissDialog(ResType dismisser);
  104.         void DecodeBits(long printO);
  105.         void MarkCheckBox (Boolean * checkBox);
  106.     };
  107.     
  108. // *********************************************************************************
  109. //    TOptFlow - Header
  110. //        inherits all methods and vars from TDialogView
  111. //        overrides method : DoChoice
  112. // *********************************************************************************
  113. class TOptFlow : public TMDialog
  114.     {
  115.     public:
  116. // ----------------------------------------------------------------------------------------------------
  117. //    the methods
  118. // ----------------------------------------------------------------------------------------------------
  119.         pascal void DoChoice(TView *origView, short itsChoice);
  120.         pascal void DismissDialog(ResType dismisser);
  121.         void DoLayerDialog(TRadio * theButton, short index);
  122.         void MarkRadioButton (Boolean * radioButton);
  123.     };
  124.     
  125. // *********************************************************************************
  126. //    TOptSolution - Header
  127. //        inherits all methods and vars from TDialogView
  128. //        overrides method : DoChoice
  129. // *********************************************************************************
  130. class TOptSolution : public TMDialog
  131.     {
  132.     public:
  133. // ----------------------------------------------------------------------------------------------------
  134. //    the methods
  135. // ----------------------------------------------------------------------------------------------------
  136.         pascal void DoChoice(TView *, short );
  137.         pascal void DismissDialog(ResType);
  138.         void MarkScroller (long *, float, short);
  139.         void DisplayValue (short, long);
  140.         pascal TCommand * DoKeyCommand(short ch, short aKeyCode, EventInfo *info);
  141.         void SaveEdit(void);
  142.         void BringToFront(void);
  143.     };
  144.  
  145. // *********************************************************************************
  146. //    TOptSolution - Header
  147. //        inherits all methods and vars from TDialogView
  148. //        overrides method : DoChoice
  149. // *********************************************************************************
  150. class TRelax : public TMDialog
  151.     {
  152.     public:
  153. // ----------------------------------------------------------------------------------------------------
  154. //    the methods
  155. // ----------------------------------------------------------------------------------------------------
  156.         pascal void DoChoice(TView *origView, short itsChoice);
  157.         pascal void DismissDialog(ResType dismisser);
  158.         void MarkScroller (float * scroller);
  159.         void DisplayValue (short index, float value);
  160.     };
  161.  
  162. class TMyTypingCommand : public TTETypingCommand
  163.     {
  164.     public :
  165.         pascal void AddCharacter(short aChar);
  166.     };
  167.     
  168. class TMyEView : public TTEView
  169.     {
  170.     public :
  171.         pascal struct TTETypingCommand * DoMakeTypingCommand(short ch);
  172.     };
  173.  
  174. class TMyDialogTEView : public TDialogTEView
  175.     {
  176.     public:
  177.         pascal void IDialogTEView(TDocument *itsDocument, TView *itsSuperView, VPoint *
  178.                 itsLocation, VPoint *itsSize, SizeDeterminer itsHDeterminer, SizeDeterminer itsVDeterminer, 
  179.                 Rect *itsInset, TextStyle *itsTextStyle, short itsJustification, Boolean itsStyleType, Boolean
  180.                 itsAutoWrap);
  181.         pascal struct TTETypingCommand * DoMakeTypingCommand(short ch);
  182.         pascal void InstallSelection(Boolean wasActive, Boolean beActive);
  183.         void StoreData(void);
  184.     };
  185.  
  186. // *********************************************************************************
  187. //    TDataView - Header
  188. //        inherits all methods and vars from TDialogView
  189. // *********************************************************************************
  190. class TDataView : public TMDialog
  191.     {
  192.     private:
  193.         TPoint                 * fPoint;
  194.         TPointMatrix    * matrix;
  195.         TView                * fGeom;                                                                    // the geometry
  196.         TScroller            * fScroll;                                                                    // the scroll bar
  197.         TRadio                * tWall;                                                                    // wall radio button
  198.         TRadio                * tIflw;                                                                    // inflow radio button
  199.         TRadio                * tSymm;                                                                    // symmetry radio button
  200.         TRadio                * tOflw;                                                                    // outflow radio button
  201.         TRadio                * tIntr;                                                                    // Interior radio button
  202.         union wRecord
  203.             {
  204.             WallRecord theData;
  205.             float iData[12];
  206.             };
  207.         union wRecord wRec;
  208.     public:
  209.         pascal void IDataView (void);                                                            // init from resource
  210.         pascal void Draw(Rect * thisRect);                                                    // Draws the view seen in the window. 
  211.         pascal void SuperViewChangedSize(VPoint *delta, Boolean invalidate);
  212.         void ShowData(TSegPoint * tPt);
  213.         pascal void DoChoice(TView *origView, short itsChoice);
  214.         pascal struct TDialogTEView * MakeTEView(void);
  215.         void StoreData(void);
  216.         void ShowIt(void);
  217.         void HideIt(void);
  218.     };
  219.     
  220. // *********************************************************************************
  221. //     the geometry document class.
  222. // *********************************************************************************
  223. class TCFDFrontDocument : public TDocument 
  224.     {
  225.     private:
  226.         friend class TGeomView;
  227.         TGeomView    *    fGeom;
  228.         Str255            fFileName;
  229.         char                fRemoteApplication[512];
  230.         char                fImageName[512];
  231.         short            fMouseAction;
  232.         short            fPass;
  233.         Boolean         fMakeView;
  234.         Boolean            fWriteGrid;    
  235.         
  236. // the fields of the document used to fill in info.
  237. // ----------------------------------------------------------------------------------------------------
  238. //    Document data
  239. // ----------------------------------------------------------------------------------------------------
  240.         float                fWidth;                                                                            // the width of the geometry
  241.         float                fHeight;                                                                        // the height of the geometry
  242.         long                fDialogOn;                                                                        // which dialogs are open?
  243.         TOptPrint        *    optPrint;                                                                    // print dialog - options menu
  244.         TOptFlow        *    optFlow;                                                                    // flow dialog - options menu
  245.         TOptSolution * optSol;                                                                        // solution dialog - options menu
  246.         TRelax            *    optRelax;                                                                    // relaxation dialog - options menu
  247.         
  248.         extended        fPressure;                                                                    // system pressure
  249.         long                fPrintOpts;                                                                    // print options data
  250.         long                fSolution[5];                                                                    // solutions data values
  251.         long                fFlowOpts;                                                                    // flow options data
  252.         float                fRelax[8];                                                                    // solutions data values
  253.         float                fSolutionAccuracy;
  254.         float                fPran[11];                                                                    // prandlt numbers
  255.         float                fBreakup;                                                                        // eddy breakup coefficient
  256.         float             fBoundryRadius;                                                            // inner boundry radius
  257.         float                fTempFuel;                                                                    // temperature of fuel
  258.         float                fTempAir;                                                                    // temperature of air
  259.         short            fCompress;                                                                    // compressiblity
  260.         short            fFuel;                                                                            // type of fuel
  261.         short            fIteration;                                                                    // maximum iterations
  262.         
  263.     public:
  264.         float            fUnitFraction;                                                                    // relates unit of measure to fWidth & fHeight
  265.         short        fExport;
  266.         Boolean        fGridOperation;                                                                    // last operation was on a grid
  267. // ----------------------------------------------------------------------------------------------------
  268. //      the boundries & object pointers
  269. // ----------------------------------------------------------------------------------------------------
  270.         TPointMatrix        *    fPointMatrix;                                                    // matrix overseer
  271.         TInformationView    *    fInfoView;                                                        // the information view at the top
  272.         TDataView            *    fDataView;                                                        // segment data view
  273.         TSegPoint                *    fInterior;                                                            // point representing all interior data
  274.         TOutput                *    fOutput;                                                            // output to disk object
  275.         
  276. // ----------------------------------------------------------------------------------------------------
  277. //    the methods
  278. // ----------------------------------------------------------------------------------------------------
  279.         TCFDFrontDocument (void);                                                                // initialize the extra fields
  280.         pascal void Free(void);
  281.         pascal void DoMakeViews (Boolean forPrinting);                                // make the views
  282.         void SetMouseAction (IDType op);                                                        // set the mouse action mode to that for IDType
  283.         short GetMouseAction (void)                    {return fMouseAction;}            // get the mouse action mode
  284.         pascal void DoSetupMenus (void);                                                        // set up the menu bar
  285.         pascal void Close(void);                                                                    // close document
  286.         pascal TCommand* DoMenuCommand(CmdNumber aCmdNumber);        // menu command processor
  287.         Boolean ICFDFrontDocument(Boolean forPrinting);                                // set up the point fields.
  288.         void SetViewSize (short * xsize, short * ysize);                                // Get the size of the geometry view.
  289.         void ViewToReal(Point thePoint, realPt * realNum);                            // convert the point to the real coords.
  290.         Point RealToView (struct realPt * realNum);                                        // convert the real coords to view point
  291.         pascal void DoWrite(short, Boolean);
  292.         pascal void DoRead(short, Boolean, Boolean);
  293.         Boolean ReadLine(short, char *, char *);
  294.         void AddTerminator(char *);
  295.         pascal void Save(CmdNumber, Boolean, Boolean);
  296.         pascal void ReadFromFile(AppFile *, Boolean);
  297.         long GetFineGrid(void)                            {return fSolution[0];}            // return number of fine grids
  298. // ----------------------------------------------------------------------------------------------------
  299. //    methods for modeless dialog initialization & communication between doc & view
  300. // ----------------------------------------------------------------------------------------------------
  301.         void DecodeParam(short, Boolean *, long);                                        // decode long parameter variable
  302.         void EncodeParam(short, Boolean *, long *);                                    // encode long parameter booleans
  303.         void SetDialogOn (Boolean, short);                                                    // set the bit for the dialog box
  304.         Boolean IsDialogOn (short);                                                                // return the status of the dialog box
  305.         void MakeOptPrint(void);                                                                    // create a print parameters dialog
  306.         void SetPrintOpts (long newData)            {fPrintOpts = newData;}        // set the print options data variable
  307.         long GetPrintOpts (void)                        {return fPrintOpts;}                // get the print options data variable
  308.         void MakeOptFlow(void);                                                                    // create a print parameters dialog
  309.         long GetFlowOpts(void)                            {return fFlowOpts;}                // get the flow options param
  310.         void SetFlowOpts(long newData)            {fFlowOpts = newData;}        // store the flow options param
  311.         float GetRadiusOpts(void)                        {return fBoundryRadius;}        // get the value of the inner radius
  312.         void SetRadiusOpts(float value)                {fBoundryRadius = value;}        // store inner boundry radius
  313.         void MakeOptSolution(void);                                                                // make the solutions dialog
  314.         void SetSolutionOpts(Boolean, short, long, float,short);                     // set the solution parameter data
  315.         void GetRemoteApp(void);
  316.         void SetApp(char *);
  317.         void GetDims (void);                                                                            // Get the dimensions of the geometry
  318.         void SetDimensions(float, float);
  319.         void GetPremixOpts(float *, short *, extended *, float *, float *, float *);    // return the prandlt number
  320.         void SetPremixOpts(float,short,extended,float,float,float);                // set the premix values 
  321.         void GetDiffusionOpts(short *, short *, extended *, float *, float *, float *, float *);    // get diffusion values
  322.         void SetDiffusionOpts(short, short, extended, float, float, float, float);// set diffusion values
  323.         void SetTurbulenceOpts(float, float);
  324.         void GetTurbulenceOpts(float *, float *);
  325.         void MakeOptRelax(void);                                                                    // make relaxation dialog
  326.         void SetRelaxOpts(short index, float value)
  327.                                                                     {fRelax[index-1] = value;}    // set relaxation value
  328.         void SetPressureOpts(extended, float);                                                // pressure options model 1
  329.         void GetPressureOpts(extended *, float *);                                        // pressure options model 1
  330.         void MakeFortranWindow(void);
  331.         void GetImageName(void);
  332.         void SetImageName(char * app);
  333.         };
  334.  
  335. // **********************************************************************
  336. //    the geometry view class.
  337. // **********************************************************************
  338. class TGeomView : public TView
  339.     {
  340.     private:
  341.         Boolean     fDragging;                                                                        // are we dragging a point?
  342.         float            fMCount;
  343.         
  344.     public:
  345.         TCFDFrontDocument    *    fCDocument;                                                    // the document
  346.         TPoint         * fSPoint;                                                                        // currently selected point
  347.         Boolean        fSegment;                                                                            // highlight segment?
  348.         TRow         *    fSSide;                                                                            // current boundry
  349.         short        lastCmd;                                                                            // drag or tinfo command
  350.         float            fMagnify;                                                                            // magnification factor
  351.         short        fHorizSize;                                                                        // horizontal size of geometry
  352.         short         fVertSize;                                                                        // vertical size of geometry
  353.         
  354. // ----------------------------------------------------------------------------------------------------
  355. //    the methods
  356. // ----------------------------------------------------------------------------------------------------
  357.         void                SetGeomViewSize (void);                                                // Set the size of the geometry view from the geometry dims.
  358.         pascal void    Draw(Rect *);                                                                // Draws the view seen in the window. 
  359.         pascal void    IRes (TDocument *, TView *,  Ptr *);                            // init from resource
  360.         pascal struct TCommand * DoMouseCommand(Point * , EventInfo *,    // handle mouse downs in this view
  361.              Point * );
  362.         void                 MagnifyView (float);
  363.         pascal void    CalcMinSize(VPoint *);                                                    // for sizing the geometry view
  364.         void                 UnSelect(void);
  365.         void                 Select(TPoint * , Boolean , TRow * );
  366.         pascal Boolean DoSetCursor(Point , RgnHandle );
  367.         Point             DragCurrent (Point);                                                        // drag the current point (w/ set button)
  368.         
  369. //    Inlines
  370.         Boolean    IsDragging(void)                                    {return fDragging;}
  371.         void        SetDragging(Boolean setit)                    {fDragging  = setit;}
  372.         short    GetHorizViewSize(void)                        {return fHorizSize;}
  373.         short    GetVertViewSize (void)                            {return fVertSize;}
  374.     };
  375.  
  376. // **********************************************************************
  377. //    the TFortranView view class.
  378. // **********************************************************************
  379. class TFortranView : public TTEView
  380.     {
  381.     public:
  382. // ----------------------------------------------------------------------------------------------------
  383. //    the methods
  384. // ----------------------------------------------------------------------------------------------------
  385.         pascal void IRes (TDocument *, TView *,  Ptr *);                            // init from resource
  386.         pascal void Close(void);
  387.         void PutLine (char * message);
  388.     };
  389.  
  390. TFortranView * gFortranView;
  391.  
  392. // **********************************************************************
  393. //    the application class.
  394. // **********************************************************************
  395. class TCFDFrontApplication : public TApplication
  396.     {
  397.     public:
  398.         Boolean fReadOld;
  399. // ----------------------------------------------------------------------------------------------------
  400. //    the methods
  401. // ----------------------------------------------------------------------------------------------------
  402.         pascal struct TDocument *DoMakeDocument(CmdNumber itsCmdNumber);    // make a new document
  403.         pascal void ICFDFrontApplication(OSType itsMainFileType);                        // initialize the application
  404.         pascal void DoSetupMenus (void);                                                                // set up the menus for this application
  405.         pascal void SetUndoText(Boolean, CmdNumber);
  406.         pascal void DoShowAboutApp(void);
  407.         pascal void Idle(IdlePhase);
  408.         pascal void OpenOld(CmdNumber, AppFile *);
  409.     };
  410.  
  411. TCFDFrontApplication *gCFDFrontApplication;                                                    // The application object 
  412.  
  413. // **********************************************************************
  414. //    TNewSegmentCommand - Header
  415. //     create a new segment on a boundry.
  416. // **********************************************************************
  417. class TNewSegmentCommand : public TCommand
  418.     {
  419.     protected:
  420.         TGeomView                *    fGeomView;                                                            // geomView object
  421.         TCFDFrontDocument    *    fCDocument;                                                            // document object
  422.         TPointMatrix            *    fPointMatrix;                                                        // matrix overseer
  423.         TList                        *    saveDeleted;                                                            // list of deleted points
  424.         TPoint                        *    fPoint;                                                                    // the saved point
  425.         TBoundry                    *    fSide;
  426.         Boolean                            done;
  427.         Point                            fLocation;                                                                // location to put point
  428.         short                            fRow, fColumn;                                                        // current row/column for point
  429.     public:
  430. // ----------------------------------------------------------------------------------------------------
  431. //    the methods
  432. // ----------------------------------------------------------------------------------------------------
  433.         void INewSegmentCommand (TGeomView *,TCFDFrontDocument *);            // init the command object
  434.         pascal void TrackFeedback (VPoint *, VPoint *,Boolean, Boolean)        {};     // tracking feedback. Done inline.
  435.         pascal void TrackConstrain (VPoint *, VPoint *, VPoint *);                        // constrain mouse.
  436.         pascal TCommand * TrackMouse (TrackPhase,                                             // tracking mouse.
  437.                     VPoint *, VPoint *, VPoint *, Boolean);
  438.         virtual pascal void DoIt (void);                                                                    // do the command
  439.         pascal void UndoIt (void);                                                                            // do the command
  440.         pascal void RedoIt (void);                                                                            // do the command
  441.         void Draw (TPoint *, TPoint *, short, PointInfo *, PointInfo *);
  442.         pascal void Free (void);                                                                            // free the object
  443.  
  444.         virtual TPoint * CreatePoint (TPoint * tPt, Point * mMouse);
  445.     };
  446.  
  447. // **********************************************************************
  448. //    TNewSectionCommand - Header
  449. //     create a new segment on a boundry.
  450. // **********************************************************************
  451. class TNewSectionCommand : public TNewSegmentCommand
  452.     {
  453.     public:    
  454.         void INewSectionCommand (TGeomView * itsGeometry,                        // init the command object
  455.              TCFDFrontDocument * tDoc);
  456.         TPoint * CreatePoint (TPoint * tPt, Point * mMouse);
  457.     };
  458.     
  459. // *********************************************************************************
  460. //    TDragCommand Header
  461. // *********************************************************************************
  462. class TDragCommand : public TCommand
  463.     {
  464.     protected:
  465.         TCFDFrontDocument    *    fCDocument;                                                        // the document
  466.         TGeomView                *    fGeom;                                                                // the geometry
  467.         TPoint                          * fPoint;                                                                // selected point
  468.         TPointMatrix            *    fMatrix;                                                            // the overseer matrix
  469.     
  470.         PointInfo                    dInfo;                                                                    // information structure
  471.         Point                         fMouse;                                                                // where is the mouse
  472.         Point                        lastTrack;                                                            // where mouse was last tracked
  473.         Point                        fPt;    
  474.         extended                    fLength;                                                                // length of row / column
  475.         short                        fSide;
  476.         
  477.     public:
  478. // ----------------------------------------------------------------------------------------------------
  479. //    the methods
  480. // ----------------------------------------------------------------------------------------------------
  481. //    Overriding MacApp methods.........................................................................................................................
  482.         pascal void UndoIt(void);                                                                        // undo the command
  483.         pascal void RedoIt(void);                                                                        // redo the command
  484.         pascal void DoIt(void);                                                                            // do the command
  485.         pascal TCommand * TrackMouse(TrackPhase, VPoint *, VPoint *,         // track the mouse
  486.               VPoint * , Boolean );
  487.         pascal void TrackFeedback(VPoint * ,VPoint *, Boolean, Boolean);            // give user tracking feedback
  488.         pascal void TrackConstrain (VPoint * ancorPoint,                                         // constrain mouse.
  489.             VPoint * previousPoint, VPoint * nextPoint);
  490.  
  491. //    New Methods...............................................................................................................................................
  492.         short IDragCommand (TGeomView *,TPoint *, Point * );                        // initialize the dragger command
  493.         void DisplayIt(Point,Point);                                                                    // display the new point
  494.         void DisplayObstacles(void);
  495.         void MovePoint(void);                                                                            // move a point directly
  496.     };
  497.     
  498. // **********************************************************************
  499. //    TObstacleCommand - Header
  500. //     create an obstacle in the selected grid cell.
  501. // **********************************************************************
  502. class TObstacleCommand : public TCommand
  503.     {
  504.     protected:
  505.         TGeomView                *    fGeom;
  506.         TCFDFrontDocument     *     fCDocument;
  507.         PointInfo                        fInfo;
  508.         TObstacle                    *    fObstacle;
  509.         
  510.     public:
  511. // ----------------------------------------------------------------------------------------------------
  512. //    the methods
  513. // ----------------------------------------------------------------------------------------------------
  514. //    Overriding MacApp methods.........................................................................................................................
  515.         pascal void IObstacleCommand (TGeomView *,TCFDFrontDocument *, PointInfo *);     // init the create obstacle object
  516.         pascal void DoIt (void);                                                                            // do the command
  517.         pascal void UndoIt (void);                                                                        // do the command
  518.         pascal void RedoIt (void);                                                                        // do the command
  519.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean, Boolean);
  520.         pascal void Commit (void);
  521.         pascal void Free (void);
  522.     };
  523.  
  524. // **********************************************************************
  525. //    TDeleteObstacleCommand - Header
  526. //     delete an obstacle in the selected grid cell.
  527. // **********************************************************************
  528. class TDeleteObstacleCommand : public TCommand
  529.     {
  530.     protected:
  531.         TGeomView                *    fGeom;
  532.         TCFDFrontDocument     *     fCDocument;
  533.         PointInfo                        fInfo;
  534.         TObstacle                    *    fObstacle;
  535.         
  536.     public:
  537. // ----------------------------------------------------------------------------------------------------
  538. //    the methods
  539. // ----------------------------------------------------------------------------------------------------
  540. //    Overriding MacApp methods.........................................................................................................................
  541.         Boolean IDeleteObstacleCommand (TGeomView *,TCFDFrontDocument *, PointInfo *);     // init the create obstacle object
  542.         pascal void DoIt (void);                                                                            // do the command
  543.         pascal void UndoIt (void);                                                                        // do the command
  544.         pascal void RedoIt (void);                                                                        // do the command
  545.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean, Boolean);
  546.         pascal void Commit (void);
  547.         pascal void Free (void);
  548.     };
  549.  
  550. // **********************************************************************
  551. //    TBaffleCommand - Header
  552. //     create an obstacle in the selected grid cell.
  553. // **********************************************************************
  554. class TBaffleCommand : public TCommand
  555.     {
  556.     protected:
  557.         TGeomView                *    fGeom;
  558.         TCFDFrontDocument     *     fCDocument;
  559.         PointInfo                        fInfo;
  560.         TBaffle                        *    fBaffle;
  561.         short                            fDirection;
  562.         
  563.     public:
  564. // ----------------------------------------------------------------------------------------------------
  565. //    the methods
  566. // ----------------------------------------------------------------------------------------------------
  567. //    Overriding MacApp methods.........................................................................................................................
  568.         pascal void IBaffleCommand (TGeomView *,TCFDFrontDocument *, PointInfo *,short);     // init the create obstacle object
  569.         pascal void DoIt (void);                                                                            // do the command
  570.         pascal void UndoIt (void);                                                                        // do the command
  571.         pascal void RedoIt (void);                                                                        // do the command
  572.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean, Boolean);
  573.         pascal void Commit (void);
  574.         pascal void Free (void);
  575.     };
  576.  
  577. // **********************************************************************
  578. //    TDeleteBaffleCommand - Header
  579. //     delete an Baffle in the selected grid cell.
  580. // **********************************************************************
  581. class TDeleteBaffleCommand : public TCommand
  582.     {
  583.     protected:
  584.         TGeomView                *    fGeom;
  585.         TCFDFrontDocument     *     fCDocument;
  586.         PointInfo                        fInfo;
  587.         TBaffle                        *    fBaffle;
  588.         short                            fDirection;
  589.         
  590.     public:
  591. // ----------------------------------------------------------------------------------------------------
  592. //    the methods
  593. // ----------------------------------------------------------------------------------------------------
  594. //    Overriding MacApp methods.........................................................................................................................
  595.         Boolean IDeleteBaffleCommand (TGeomView *,TCFDFrontDocument *, PointInfo *,short);     // init the create obstacle object
  596.         pascal void DoIt (void);                                                                            // do the command
  597.         pascal void UndoIt (void);                                                                        // do the command
  598.         pascal void RedoIt (void);                                                                        // do the command
  599.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean, Boolean);
  600.         pascal void Commit (void);
  601.         pascal void Free (void);
  602.     };
  603.  
  604. // **********************************************************************
  605. //    TTrash - Header
  606. // **********************************************************************
  607. class TCTrash : public TObject
  608.     {
  609.     private :
  610.         short             fRsrsId;
  611.         Rect                fCTrash;
  612.         CIconHandle    theIcon;
  613.     public:
  614.         void             ICTrash(Point, short,short,short,short,short);
  615.         void             CalcLocation(Point *,short,short,short,short);
  616.         Boolean        InTheCan(Point);
  617.         Rect         GetRect(void);
  618.         pascal void DrawCan(void);
  619.         pascal void Free(void);
  620.     };
  621.      
  622. // *********************************************************************************
  623. //    TDeletePointCommand Header
  624. // *********************************************************************************
  625. class TDeletePointCommand : public TCommand
  626.     {
  627.     protected:
  628.         TList                        *    saveDeleted;                                                        // list of deleted points
  629.         WallRecord                 saveData;                                                                // data values
  630.         short                        saveType;                                                            // wall type
  631.         short                        delRightSeg;                                                            // which segment was deleted
  632.         short                        fRow, fColumn;                                                        // index of deleted line
  633.         
  634.         TGeomView                *    fGeom;                                                                // the geometry
  635.         TCFDFrontDocument    *    fCDocument;                                                        // the document
  636.         TBoundry                     *    fSide;                                                                // which side are we on?
  637.         TPoint                        *    fPoint;                                                                // selected segment
  638.         TPoint                        *    fPrev, * fNext;                                                // next / prev segment
  639.         TCTrash                     *     trashL;                                                                // left trash can
  640.         TCTrash                     *     trashR;                                                                // right trash can
  641.         TCTrash                     *     trashLO;                                                            // open trash can
  642.         TCTrash                     *     trashRO;                                                            // open trash can
  643.  
  644.          PointInfo                     fInfo;                                                                    // surrounding points
  645.          short                         nCent, lCent;                                                        // how to center trash cans
  646.         Boolean                     rightOn, leftOn;
  647.         
  648.     public:
  649. // ----------------------------------------------------------------------------------------------------
  650. //    the methods
  651. // ----------------------------------------------------------------------------------------------------
  652.         Boolean IDeletePointCommand (TGeomView *, TPoint *);                            // initialize the dragger command
  653.         pascal void UndoIt(void);                                                                            // undo the command
  654.         pascal void RedoIt(void);                                                                            // redo the command
  655.         pascal void DoIt(void);                                                                                // do the command
  656.         pascal TCommand * TrackMouse(TrackPhase, VPoint *, VPoint *, VPoint *, Boolean);    // track the mouse
  657.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean,Boolean);                 // give user tracking feedback
  658.         void DisplayIt(Point,Point);                                                                        // display the new point
  659.         pascal void Commit(void);
  660.         pascal void Free(void);                                                                                // free command object
  661.     };
  662.     
  663. // *********************************************************************************
  664. //    TDeleteGridCommand Header
  665. // *********************************************************************************
  666. class TDeleteGridCommand : public TCommand
  667.     {
  668.     protected:
  669.         TList                        *    saveDeleted;                                                            // list of deleted points
  670.         short                        fRow, fColumn;                                                            // index of deleted line
  671.          PointInfo                     fInfo;                                                                        // surrounding points
  672.         
  673.         TGeomView                *    fGeom;                                                                    // the geometry
  674.         TCFDFrontDocument    *    fCDocument;                                                            // the document
  675.         TBoundry                     *    fSide;                                                                    // which side are we on?
  676.         TPoint                        *    fPoint;                                                                    // selected segment
  677.         
  678.     public:
  679. // ----------------------------------------------------------------------------------------------------
  680. //    the methods
  681. // ----------------------------------------------------------------------------------------------------
  682.         Boolean IDeleteGridCommand (TGeomView *, TPoint *);                            // initialize the dragger command
  683.         pascal void UndoIt(void);                                                                            // undo the command
  684.         pascal void RedoIt(void);                                                                            // redo the command
  685.         pascal void DoIt(void);                                                                                // do the command
  686.         pascal TCommand * TrackMouse(TrackPhase, VPoint *, VPoint *, VPoint *, Boolean);    // track the mouse
  687.         pascal void TrackFeedback(VPoint *,VPoint *, Boolean,Boolean);                 // give user tracking feedback
  688.         pascal void Commit(void);
  689.     };
  690.     
  691. // **********************************************************************
  692. //    TPctsView - Header
  693. //     TPctsView & TOpPict together provide the palette functionality.
  694. //     The superview contains the entire palette, and the components of the palette also
  695. //     have their own class and functionality
  696. // **********************************************************************
  697. class TPctsView : public TView
  698.     {
  699.     public:
  700. // ----------------------------------------------------------------------------------------------------
  701. //    the methods
  702. // ----------------------------------------------------------------------------------------------------
  703.         inline void TurnAllOff (void);                                                                // Draws the view seen in the window. 
  704.         pascal void IRes (TDocument * itsDocument, TView * itsSuperView,     // we need the fDocument initialized to something real.
  705.             Ptr * itsParams);    
  706.         pascal void Draw(Rect * thisRect);                                                        // Draws the view seen in the window. 
  707.         pascal void SuperViewChangedSize(VPoint *delta, Boolean /*invalidate*/);
  708.     };
  709.  
  710. // **********************************************************************
  711. //    TOpPict - Header
  712. //     TPctsView & TOpPict together provide the palette functionality.
  713. //     The superview contains the entire palette, and the components of the palette also
  714. //     have their own class and functionality
  715. // **********************************************************************
  716. class TOpPict : public TPicture 
  717.     {
  718.     private:
  719.         TGeomView * fGeom;
  720.     public:
  721. // ----------------------------------------------------------------------------------------------------
  722. //    the methods
  723. // ----------------------------------------------------------------------------------------------------
  724.         pascal struct TCommand * DoMouseCommand(Point * theMouse,            // handle mouse clicks in the palette area
  725.             EventInfo * info,Point * hysteresis);
  726.         pascal void IRes (TDocument * itsDocument, TView * itsSuperView,     // we need the fDocument initialized to something real.
  727.             Ptr * itsParams);
  728. };
  729.  
  730. // *********************************************************************************
  731. //    TBoundryRadius - Header
  732. //        inherits all methods and vars from TDialogView
  733. // *********************************************************************************
  734. class TBoundryRadius : public TDialogView
  735.     {
  736.     public:
  737.         void GetParams(void);
  738.     };
  739.     
  740. // *********************************************************************************
  741. //    TDimension - Header
  742. //        inherits all methods and vars from TDialogView
  743. // *********************************************************************************
  744. class TDimension : public TDialogView
  745.     {
  746.     public:
  747.         Boolean GetDimensions (void);
  748.     };
  749.     
  750. // *********************************************************************************
  751. //    TAppDialog - Header
  752. //        inherits all methods and vars from TDialogView
  753. // *********************************************************************************
  754. class TAppDialog : public TDialogView
  755.     {
  756.     public:
  757.         Boolean GetApp (char *);
  758.     };
  759.     
  760. // *********************************************************************************
  761. //    TAppDialog - Header
  762. //        inherits all methods and vars from TDialogView
  763. // *********************************************************************************
  764. class TImageDialog : public TDialogView
  765.     {
  766.     public:
  767.         Boolean GetImage (char *);
  768.     };
  769.     
  770. // *********************************************************************************
  771. //    TWarnDelete - Header
  772. //    Warn the user they are about to delete something
  773. // *********************************************************************************
  774. class TWarnDelete : public TDialogView
  775.     {
  776.     public:
  777.         Boolean ShowDelete (char *);
  778.     };
  779.     
  780. // *********************************************************************************
  781. //    TWarnDialog - Header
  782. // *********************************************************************************
  783. class TWarning : public TDialogView
  784.     {
  785.     short fIconNumber;
  786.     char * msg;
  787.     public:
  788. // ----------------------------------------------------------------------------------------------------
  789. //    the methods
  790. // ----------------------------------------------------------------------------------------------------
  791.         void ShowWarning(void);
  792.         void IWarning(short which, char * parm);
  793.         pascal void Free(void);
  794.     };
  795.  
  796. // **********************************************************************
  797. //     Function declarations
  798. // **********************************************************************
  799. pascal void DrawAllPoints (TObject * tItem, void * tinfo);
  800. pascal void DrawPoint (TObject * tItem, void * tinfo);
  801. pascal void DrawAllLines (TObject * tItem, void * tinfo);
  802. pascal void DrawLine (TObject * tItem, void * tinfo);
  803.  
  804. void SlopeIntercept(slopeStruct * tSlope);
  805. extended CalculateDistance(Point first, Point second);
  806. void     InitColorPattern(void);
  807. Point transform(Point, float);
  808. Point AntiTransform(Point, float);
  809. pascal void TransformGrid (TObject *, void *);
  810. pascal void TransformPoint (TObject *, void *);
  811. extern "C" int RunSpv (char *);
  812. short StopKey(void);
  813. void ShowL(char *);
  814. void test(void);
  815. void SetStop(void);
  816.