Class TframeView

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TframeView = class(TFrame)

Description

TframeView is used to display one view of the model and to handle user-interaction with the TPhastGrid and TScreenObjects. Much of the user interaction is delegated to descendants of TCustomInteractiveTool.

Hierarchy

Overview

Fields

Implicit BackOne: TMenuItem;
Implicit ForwardOne: TMenuItem;
Implicit Hide: TMenuItem;
Implicit ModelCube: TRbwModelCube;
Implicit OrderMenu: TPopupMenu;
Implicit Panel1: TPanel;
Implicit rulHorizontal: TRbwRuler;
Implicit rulVertical: TRbwRuler;
Implicit ToBack: TMenuItem;
Implicit ToFront: TMenuItem;
Implicit ZoomBox: TQRbwZoomBox2;
Private FBitMap: TBitMap;
Private FBusy: boolean;
Private FColRowLayerSelector: TCustomLayerRowColumnSelector;
Private FDeltaGridAngle: real;
Private FDrawing: boolean;
Private FMagnificationChanged: boolean;
Private FPreviousScreenObjects: TList;
Private FResizing: boolean;
Private FViewDirection: TViewDirection;
Public FSelectBottomRight: TPoint;
Public FSelectTopLeft: TPoint;

Methods

Implicit procedure BackOneClick(Sender: TObject);
Implicit procedure ForwardOneClick(Sender: TObject);
Implicit procedure HideClick(Sender: TObject);
Implicit procedure ModelCubePaint(Sender: TObject);
Implicit procedure OrderMenuPopup(Sender: TObject);
Implicit procedure rulerDblClick(Sender: TObject);
Implicit procedure rulerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
Implicit procedure ToBackClick(Sender: TObject);
Implicit procedure ToFrontClick(Sender: TObject);
Implicit procedure ZoomBoxBottomPaintBoxPaint(Sender: TObject);
Implicit procedure ZoomBoxExit(Sender: TObject);
Implicit procedure ZoomBoxPaintBoxDblClick(Sender: TObject);
Implicit procedure ZoomBoxPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Implicit procedure ZoomBoxPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
Implicit procedure ZoomBoxPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Implicit procedure ZoomBoxPaintBoxPaint(Sender: TObject);
Implicit procedure ZoomBoxPan(Sender: TObject; DeltaX, DeltaY: real);
Implicit procedure ZoomBoxResize(Sender: TObject);
Private procedure AdjustHorizontalScale(const NewX: integer);
Private procedure AdjustVerticalScale(const NewY: integer);
Private function ColorDataSet: TDataArray;
Private function ColorTimeList: TTimeList;
Private procedure DrawGridAndScreenObjects;
Private procedure DrawImage(const Source: TCompressedBitmapItem; const Dest: TBitMap);
Private procedure DrawScreenObjects;
Private procedure GetColLayer(APoint: T2DRealPoint; out Col, Layer: integer);
Private function GetColRowLayerSelector: TCustomLayerRowColumnSelector;
Private function GetCurrentScreenObject: TScreenObject;
Private function GetGridChanged: boolean;
Private function GetNeedToRecalculateCellColors: boolean;
Private procedure GetNodeColLayer(APoint: T2DRealPoint; out Col, Layer: integer);
Private procedure GetNodeRowCol(APoint: T2DRealPoint; out Row, Column: integer);
Private procedure GetNodeRowLayer(APoint: T2DRealPoint; out Row, Layer: integer);
Private procedure GetRowCol(APoint: T2DRealPoint; out Row, Column: integer);
Private procedure GetRowLayer(APoint: T2DRealPoint; out Row, Layer: integer);
Private function GetScreenObjectsChanged: boolean;
Private function GridCenter: T2DRealPoint;
Private procedure InitializeDataSet;
Private procedure InvalidateScreenObjects;
Private procedure PaintRotatedBMP(const X, Y, Angle: double; const Source, Dest: TBitMap);
Private function RecalculateCellColors: boolean;
Private procedure ResetCellColors;
Private procedure RotatedGridCorners(const Angle: real; out PointArray: array of TPoint);
Private procedure SetDeltaGridAngle(const Value: real);
Private procedure SetGridChanged(const Value: boolean);
Private procedure SetNeedToRecalculateCellColors(const Value: boolean);
Private procedure SetScreenObjectsChanged(const Value: boolean);
Private procedure SetUpColRowLayerSelector;
Private procedure SetViewDirection(const Value: TViewDirection);
Private procedure UpdateStatusBar(const X, Y: integer);
Private procedure UpdateTimeDataSet;
Private procedure WarnTooBig;
Public procedure AdjustScales;
Public constructor Create(AOwner: TComponent); override;
Public function CursorGrid: TCursorGrid;
Public destructor Destroy; override;
Public procedure DisplayItem;
Public procedure DrawRotatedGrid(const DeltaAngle: real);
Public function EvaluatedAt: TEvaluatedAt;
Public procedure FinishScreenObjects;
Public procedure ItemChange(Sender: TObject);
Public procedure ShowMagnification;
Public procedure UpdateSelectRectangle;

Properties

Protected property GridChanged: boolean read GetGridChanged write SetGridChanged;
Protected property ColRowLayerSelector: TCustomLayerRowColumnSelector read GetColRowLayerSelector;
Public property CurrentScreenObject: TScreenObject read GetCurrentScreenObject;
Public property DeltaGridAngle: real read FDeltaGridAngle write SetDeltaGridAngle;
Public property MagnificationChanged: boolean read FMagnificationChanged write FMagnificationChanged;
Public property NeedToRecalculateCellColors: boolean read GetNeedToRecalculateCellColors write SetNeedToRecalculateCellColors;
Public property PreviousScreenObjects: TList read FPreviousScreenObjects;
Public property Resizing: boolean read FResizing write FResizing;
Public property ScreenObjectsHaveChanged: boolean read GetScreenObjectsChanged write SetScreenObjectsChanged;
Public property ViewDirection: TViewDirection read FViewDirection write SetViewDirection;

Description

Fields

Implicit BackOne: TMenuItem;

BackOne: TMenuItem; See BackOneClick.

Implicit ForwardOne: TMenuItem;

ForwardOne: TMenuItem; See ForwardOneClick.

Implicit Hide: TMenuItem;

Hide: TMenuItem; See HideClick.

Implicit ModelCube: TRbwModelCube;

ModelCube: TRbwModelCube; ModelCube allows the user to change the selected column, row, or layer by clicking on the model cube. See TCustomLayerRowColumnSelector.MouseDown, TCustomLayerRowColumnSelector.MouseMove, TCustomLayerRowColumnSelector.MouseUp, ModelCubePaint, TCustomLayerRowColumnSelector.ChangeColRowLayer, and ColRowLayerSelector.

Implicit OrderMenu: TPopupMenu;

OrderMenu: TPopupMenu; OrderMenu is a pop-up menu that holds the TMenuItems declared as part of TframeView. See ToFront, ToBack, ForwardOne, BackOne, and Hide. Its OnPopup event is handled by OrderMenuPopup.

Implicit Panel1: TPanel;

Panel1: TPanel; Panel1 holds ModelCube and rulHorizontal.

Implicit rulHorizontal: TRbwRuler;

rulHorizontal: TRbwRuler; rulHorizontal is the horizontal ruler. See rulerDblClick and rulerMouseMove.

Implicit rulVertical: TRbwRuler;

rulVertical: TRbwRuler; rulVertical is the vertical ruler. See rulerDblClick and rulerMouseMove.

Implicit ToBack: TMenuItem;

ToBack: TMenuItem; See ToBackClick.

Implicit ToFront: TMenuItem;

ToFront: TMenuItem; See ToFrontClick.

Implicit ZoomBox: TQRbwZoomBox2;

ZoomBox: TQRbwZoomBox2; ZoomBox is responsible for displaying one view of the model. See ZoomBoxBottomPaintBoxPaint, ZoomBoxExit, ZoomBoxPan, ZoomBoxResize, ZoomBoxPaintBoxDblClick, ZoomBoxPaintBoxMouseDown, ZoomBoxPaintBoxMouseMove, ZoomBoxPaintBoxMouseUp, and ZoomBoxPaintBoxPaint.

Private FBitMap: TBitMap;

FBitMap: TBitMap; FBitMap is the TBitMap on which the PhastGrid and TScreenObjects are drawn.

Private FBusy: boolean;

FBusy: boolean; FBusy is used inside ZoomBoxPaintBoxMouseUp to prevent it from being called again until it has finished whatever it has to do.

Private FColRowLayerSelector: TCustomLayerRowColumnSelector;

FColRowLayerSelector: TCustomLayerRowColumnSelector; See ColRowLayerSelector.

Private FDeltaGridAngle: real;

FDeltaGridAngle: real; See DeltaGridAngle.

Private FDrawing: boolean;

FDrawing: boolean; FDrawing is used inside ZoomBoxPaintBoxPaint to prevent it from being called again until it has finished whatever it has to do.

Private FMagnificationChanged: boolean;

FMagnificationChanged: boolean; See MagnificationChanged.

Private FPreviousScreenObjects: TList;

FPreviousScreenObjects: TList; See PreviousScreenObjects.

Private FResizing: boolean;

FResizing: boolean; See Resizing.

Private FViewDirection: TViewDirection;

FViewDirection: TViewDirection; See ViewDirection.

Public FSelectBottomRight: TPoint;

FSelectBottomRight: TPoint; FSelectBottomRight is the bottom right corner of the rectangle outlining the selected TScreenObjects.

Public FSelectTopLeft: TPoint;

FSelectTopLeft: TPoint; FSelectTopLeft is the top left corner of the rectangle outlining the selected TScreenObjects.

Methods

Implicit procedure BackOneClick(Sender: TObject);

BackOneClick allows the user to move selected objects back one in the list of objects so that they move behind one other object.

Implicit procedure ForwardOneClick(Sender: TObject);

ForwardOneClick allows the user to move selected objects forward one in the list of objects so that they move forward of one other object.

Implicit procedure HideClick(Sender: TObject);

HideClick hides the selected TScreenObjects.

Implicit procedure ModelCubePaint(Sender: TObject);

ModelCubePaint draws a black rectangle outlining the ModelCube component.

Implicit procedure OrderMenuPopup(Sender: TObject);

OrderMenuPopup enables or disables ToFront, ToBack, ForwardOne, BackOne, and Hide depending on the context.

Implicit procedure rulerDblClick(Sender: TObject);

rulerDblClick is OnDblClick event handler for rulHorizontal, and rulVertical. It shows the TfrmRulerOptions form.

Implicit procedure rulerMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

rulerMouseMove is OnMouseMove event handler for rulHorizontal, and rulVertical. rulerMouseMove sets TfrmGoPhast.CursorGrid to cgNone;

Implicit procedure ToBackClick(Sender: TObject);

ToBackClick allows the user to move the selected TScreenObjects behind all other TScreenObjects.

Implicit procedure ToFrontClick(Sender: TObject);

ToFrontClick allows the user to move the selected TScreenObjects in front of all other TScreenObjects.

Implicit procedure ZoomBoxBottomPaintBoxPaint(Sender: TObject);

ZoomBoxBottomPaintBoxPaint for the current TScreenObject and previous TScreenObject to be drawn with relatively little flickering until the ZoomBox.Image has been updated. ZoomBoxBottomPaintBoxPaint is the ZoomBox.BottomPaintBox.OnPaint event handler.

Implicit procedure ZoomBoxExit(Sender: TObject);

If the user clicks on a button or somewhere else while creating a TScreenObject, the TScreenObject is terminated. ZoomBoxExit is the ZoomBox.OnExit event handler.

Implicit procedure ZoomBoxPaintBoxDblClick(Sender: TObject);

ZoomBoxPaintBoxDblClick is the ZoomBox.PaintBox.OnDblClick event handler It delegates the event to frmGoPhast.CurrentTool.DoubleClick.

Implicit procedure ZoomBoxPaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

ZoomBoxPaintBoxMouseDown is the event handler for ZoomBox.PaintBox.OnMouseDown If the right mouse button is depressed, it exits and allows OrderMenu to take over. Otherwise it updates frmGoPhast.CursorGrid, frmGoPhast.CursorX, and frmGoPhast.CursorY. Then it delegates the event to frmGoPhast.CurrentTool.MouseDown.

Implicit procedure ZoomBoxPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);

ZoomBoxPaintBoxMouseMove is the event handler for ZoomBox.PaintBox.OnMouseMove Otherwise it updates frmGoPhast.CursorGrid, frmGoPhast.CursorX, and frmGoPhast.CursorY. It then calls UpdateStatusBar. Then it delegates the event to frmGoPhast.CurrentTool.MouseMove.

Implicit procedure ZoomBoxPaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

ZoomBoxPaintBoxMouseUp is the event handler for ZoomBox.PaintBox.OnMouseDown. If the right mouse button is depressed, it exits and allows OrderMenu to take over. Otherwise it updates frmGoPhast.CursorGrid, frmGoPhast.CursorX, and frmGoPhast.CursorY. Then it delegates the event to frmGoPhast.CurrentTool.MouseUp.

Implicit procedure ZoomBoxPaintBoxPaint(Sender: TObject);

ZoomBoxPaintBoxPaint is the event handler for ZoomBox.PaintBox.OnPaint. ZoomBoxPaintBoxPaint draws the PhastGrid and TScreenObjects.

Implicit procedure ZoomBoxPan(Sender: TObject; DeltaX, DeltaY: real);

ZoomBoxPan is the event handler for ZoomBox.OnPan. It updates rulHorizontal and rulVertical with its current position.

Implicit procedure ZoomBoxResize(Sender: TObject);

ZoomBoxResize is the event handler for ZoomBox.OnResize. ZoomBoxResize sets frmGoPhast.timTimer.OnTimer to frmGoPhast.ResizeZoomBoxes with a delay of 100 ms. The effect is to prevent the control from redrawing until the user has finished resizing it.

Private procedure AdjustHorizontalScale(const NewX: integer);

AdjustHorizontalScale is used to redraw the horizontal scale.

Parameters
NewX
NewX indicates how far the image in ZoomBox has moved in the X direction in pixels.
Private procedure AdjustVerticalScale(const NewY: integer);

AdjustVerticalScale is used to redraw the vertical scale.

Parameters
NewY
NewY indicates how far the image in ZoomBox has moved in the Y direction in pixels.
Private function ColorDataSet: TDataArray;

ColorDataSet returns the TDataArray the is used to color the grid in this view of the model.

Private function ColorTimeList: TTimeList;

If ColorDataSet is a transient TDataArray, ColorTimeList is the TTimeList that owns it.

Private procedure DrawGridAndScreenObjects;

DrawGridAndScreenObjects is the main routine for drawing the grid and PhastGrid and TScreenObjects. It will also draw any imported images.

Private procedure DrawImage(const Source: TCompressedBitmapItem; const Dest: TBitMap);

DrawImage will draw an imported image (Source) on a bitmap (Dest) at its proper location.

Private procedure DrawScreenObjects;

DrawScreenObjects will draw the TScreenObjects on FBitMap.

Private procedure GetColLayer(APoint: T2DRealPoint; out Col, Layer: integer);

GetColLayer gets the column and layer numbers of the element containing APoint; APoint must be on a side view of the model.

Private function GetColRowLayerSelector: TCustomLayerRowColumnSelector;

See ColRowLayerSelector.

Private function GetCurrentScreenObject: TScreenObject;

See CurrentScreenObject.

Private function GetGridChanged: boolean;

See GridChanged.

Private function GetNeedToRecalculateCellColors: boolean;

See NeedToRecalculateCellColors.

Private procedure GetNodeColLayer(APoint: T2DRealPoint; out Col, Layer: integer);

GetNodeColLayer returns the column and layer numbers of the cell containing APoint; APoint must be on a side view of the model.

Private procedure GetNodeRowCol(APoint: T2DRealPoint; out Row, Column: integer);

GetNodeRowCol returns the column and row numbers of the cell containing APoint; APoint must be on a top view of the model. APoint must be in real-world coordinates not grid coordinates.

Private procedure GetNodeRowLayer(APoint: T2DRealPoint; out Row, Layer: integer);

GetNodeRowLayer returns the row and layer numbers of the cell containing APoint; APoint must be on a front view of the model.

Private procedure GetRowCol(APoint: T2DRealPoint; out Row, Column: integer);

GetRowCol gets the column and row numbers of the element containing APoint; APoint must be on a top view of the model. APoint must be in real-world coordinates not grid coordinates.

Private procedure GetRowLayer(APoint: T2DRealPoint; out Row, Layer: integer);

GetRowLayer gets the row and layer numbers of the element containing APoint; APoint must be on a front view of the model.

Private function GetScreenObjectsChanged: boolean;

See ScreenObjectsHaveChanged.

Private function GridCenter: T2DRealPoint;

GridCenter returns a T2DRealPoint for the center of the grid.

Private procedure InitializeDataSet;

InitializeDataSet initializes the data set used to color the grid on this view of the model.

Private procedure InvalidateScreenObjects;

InvalidateScreenObjects calls TScreenObject.InvalidateCoordinates for every TScreenObject on this view of the model.

Private procedure PaintRotatedBMP(const X, Y, Angle: double; const Source, Dest: TBitMap);

PaintRotatedBMP draws Source on Dest at position X,Y rotated by Angle. Angle is in degrees.

Private function RecalculateCellColors: boolean;

RecalculateCellColors checks if the data set used to color the grid on this view of the model is up to date. If not, it initializes it. Once it is up to data, RecalculateCellColors will store the correct color for each cell or element in the grid.

Private procedure ResetCellColors;

ResetCellColors sets to the colors of each cell or element in the grid to White.

Private procedure RotatedGridCorners(const Angle: real; out PointArray: array of TPoint);

RotatedGridCorners sets PointArray to the positions of the corner of the grid after having been rotated by Angle.

Private procedure SetDeltaGridAngle(const Value: real);

See DeltaGridAngle.

Private procedure SetGridChanged(const Value: boolean);

See GridChanged.

Private procedure SetNeedToRecalculateCellColors(const Value: boolean);

See NeedToRecalculateCellColors.

Private procedure SetScreenObjectsChanged(const Value: boolean);

See ScreenObjectsHaveChanged.

Private procedure SetUpColRowLayerSelector;

SetUpColRowLayerSelector changes ColRowLayerSelector based on ViewDirection.

Private procedure SetViewDirection(const Value: TViewDirection);

See ViewDirection.

Private procedure UpdateStatusBar(const X, Y: integer);

UpdateStatusBar shows appropriate text on the status bar.

Private procedure UpdateTimeDataSet;

When the data set used to color the grid is a transient TDataArray, UpdateTimeDataSet is used to make sure that an up to date version of the TDataArray is used.

Private procedure WarnTooBig;

If the magnification is too big, zoom out a bit and warn the user.

Public procedure AdjustScales;

AdjustScales adjusts the scales on rulHorizontal and rulVertical to match the coordinates in ZoomBox.

Public constructor Create(AOwner: TComponent); override;

Create creates an instance of TframeView.

Public function CursorGrid: TCursorGrid;

CursorGrid is used to indicate which view of the model (if any) the cursor is over.

Public destructor Destroy; override;

Destroy destroys the current instance of TframeView. Do not call TframeView directly. Call Free instead.

Public procedure DisplayItem;

DisplayItem displays the column, row, or layer that is selected on the status bar.

Public procedure DrawRotatedGrid(const DeltaAngle: real);

DrawRotatedGrid draws an outline of the grid after it is rotated by DeltaAngle.

Public function EvaluatedAt: TEvaluatedAt;

See TCustomLayerRowColumnSelector.EvaluatedAt.

Public procedure FinishScreenObjects;

See TCustomCreateScreenObjectTool.FinishScreenObjects;

Public procedure ItemChange(Sender: TObject);

See TCustomLayerRowColumnSelector.ItemChange;

Public procedure ShowMagnification;

ShowMagnification shows the magnification on the status bar.

Public procedure UpdateSelectRectangle;

UpdateSelectRectangle calculates the coordinates of a rectangle that surrounds the selected objects.

Properties

Protected property GridChanged: boolean read GetGridChanged write SetGridChanged;

GridChanged is used to indicate that a change has been made to the grid so that the view of the model needs to be redrawn.

Protected property ColRowLayerSelector: TCustomLayerRowColumnSelector read GetColRowLayerSelector;

ColRowLayerSelector is used to respond to the OnMouseDown, OnMouseMove, and OnMouseUp events of ModelCube. It allows the user to change the selected column, row, or layer to be changed by clicking on ModelCube.

Public property CurrentScreenObject: TScreenObject read GetCurrentScreenObject;

CurrentScreenObject is the TScreenObject that is being created.

Public property DeltaGridAngle: real read FDeltaGridAngle write SetDeltaGridAngle;

When rotating the grid with TRotateGridTool, DeltaGridAngle is used to store the amount by which the grid is being rotated.

Public property MagnificationChanged: boolean read FMagnificationChanged write FMagnificationChanged;

When zooming in or out, MagnificationChanged is set to true to indicate that redrawing of the model must occur.

Public property NeedToRecalculateCellColors: boolean read GetNeedToRecalculateCellColors write SetNeedToRecalculateCellColors;

When the TDataArray used to color the grid is changed NeedToRecalculateCellColors is set to true to indicate that the cell colors need to be updated.

Public property PreviousScreenObjects: TList read FPreviousScreenObjects;

PreviousScreenObjects is used in ZoomBoxBottomPaintBoxPaint to draw TScreenObjects with relatively little flickering.

Public property Resizing: boolean read FResizing write FResizing;

Resizing is used in ZoomBoxResize and ResizeZoomBoxes to introduce a small delay before the paintbox redraws.

Public property ScreenObjectsHaveChanged: boolean read GetScreenObjectsChanged write SetScreenObjectsChanged;

ScreenObjectsHaveChanged is used to indicate that there has been a change to the TScreenObjects so the view of the model needs to be redrawn.

Public property ViewDirection: TViewDirection read FViewDirection write SetViewDirection;

ViewDirection indicates the direction from which the model is viewed in this TframeView.


Generated by PasDoc 0.10.0 on 2006-10-31 09:56:34