{$P} {This segment of Boxer implements commands with undo} {Copyright 1983, Apple Computer Inc.} UNIT U6Boxer; INTERFACE USES {$U UObject} UObject, {$IFC libraryVersion <= 20} {$U UFont} UFont, {$ENDC} {$U QuickDraw} QuickDraw, {$U UDraw} UDraw, {$U UABC} UABC; CONST colorWhite = 1; colorLtGray = 2; colorGray = 3; colorDkGray = 4; colorBlack = 5; { selection kinds } boxSelectionKind = 1; createBoxSelectionKind = 2; { Menus } uWhite = 1006; uLtGray = 1007; uGray = 1008; uDkGray = 1009; uBlack = 1010; uDuplicate = 1011; uClearAll = 1012; { Phrases } cantUndo = 1001; TYPE TColor = colorWhite..colorBlack; {color of a box} {New Classes for this Application} TBox = SUBCLASS OF TObject {Variables} shapeLRect: LRect; color: TColor; {Creation/Destruction} FUNCTION TBox.CREATE(object: TObject; itsHeap: THeap): TBox; { Highlighting support } PROCEDURE TBox.PaintHandles; { Framing while creating } PROCEDURE TBox.DrawFrame; {Display} PROCEDURE TBox.Draw; END; TBoxView = SUBCLASS OF TView {Variables} boxList: TList; {Creation/Destruction} FUNCTION TBoxView.CREATE(object: TObject; itsHeap: THeap; itsPanel: TPanel; itsExtent: LRect) : TBoxView; FUNCTION TBoxView.BoxWith(LPt: LPoint): TBox; {Invalidation} PROCEDURE TBoxView.InvalBox(invalLRect: LRect); PROCEDURE TBoxView.MousePress(mouseLPt: LPoint); OVERRIDE; {Display} PROCEDURE TBoxView.Draw; OVERRIDE; {Initialization} PROCEDURE TBoxView.InitBoxList(itsHeap: THeap); FUNCTION TBoxView.NoSelection: TSelection; OVERRIDE; END; TBoxSelection = SUBCLASS OF TSelection {Variables} box: TBox; {Creation/Destruction} FUNCTION TBoxSelection.CREATE(object: TObject; itsHeap: THeap; itsView: TView; itsBox: TBox; itsKind: INTEGER; itsAnchorLPt: LPoint): TBoxSelection; {Drawing - per pad} PROCEDURE TBoxSelection.Highlight(highTransit: THighTransit); OVERRIDE; {Selection - per pad} PROCEDURE TBoxSelection.MouseMove(mouseLPt: LPoint); OVERRIDE; PROCEDURE TBoxSelection.MouseRelease; OVERRIDE; {Command Dispatch} FUNCTION TBoxSelection.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; FUNCTION TBoxSelection.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN) : BOOLEAN; OVERRIDE; END; TCreateBoxSelection = SUBCLASS OF TSelection {Variables} box: TBox; {Creation/Destruction} FUNCTION TCreateBoxSelection.CREATE(object: TObject; itsHeap: THeap; itsView: TView; itsAnchorLPt: LPoint): TCreateBoxSelection; {Selection - per pad} PROCEDURE TCreateBoxSelection.MouseMove(mouseLPt: LPoint); OVERRIDE; PROCEDURE TCreateBoxSelection.MouseRelease; OVERRIDE; END; { This command recolors the selected box and is not undoable} TRecolorCmd = SUBCLASS OF TCommand Box: TBox; color: TColor; {Creation} FUNCTION TRecolorCmd.CREATE(object: TObject; itsHeap: THeap; itsCmdNumber: TCmdNumber; itsView: TBoxView; itsBox: TBox; itsColor: TColor): TRecolorCmd; PROCEDURE TRecolorCmd.Perform(cmdPhase: TCmdPhase); OVERRIDE; END; { This command duplicates the selected box and is undoable } TDuplicateCmd = SUBCLASS OF TCommand oldBox, newBox: TBox; {Creation} FUNCTION TDuplicateCmd.CREATE(object: TObject; itsHeap: THeap; itsCmdNumber: TCmdNumber; itsView: TboxView; itsBox: TBox): TDuplicateCmd; {Command Execution} PROCEDURE TDuplicateCmd.Perform(cmdPhase: TCmdPhase); OVERRIDE; END; TBoxProcess = SUBCLASS OF TProcess {Creation/Destruction} FUNCTION TBoxProcess.CREATE: TBoxProcess; FUNCTION TBoxProcess.NewDocManager(volumePrefix: TFilePath; openAsTool: BOOLEAN) : TDocManager; OVERRIDE; END; TBoxDocManager = SUBCLASS OF TDocManager {Creation/Destruction} FUNCTION TBoxDocManager.CREATE(object: TObject; itsHeap: THeap; itsPathPrefix: TFilePath) : TBoxDocManager; FUNCTION TBoxDocManager.NewWindow(heap: THeap; wmgrID: TWindowID): TWindow; OVERRIDE; END; TBoxWindow = SUBCLASS OF TWindow {Creation/Destruction} FUNCTION TBoxWindow.CREATE(object: TObject; itsHeap: THeap; itsWmgrID: TWindowID): TBoxWindow; {Document Creation} PROCEDURE {TBoxWindow.} BlankStationery; OVERRIDE; {Commands} PROCEDURE TBoxWindow.ClearAll; FUNCTION TBoxWindow.NewCommand(cmdNumber: TCmdNumber): TCommand; OVERRIDE; FUNCTION TBoxWindow.CanDoCommand(cmdNumber: TCmdNumber; VAR checkIt: BOOLEAN): BOOLEAN; OVERRIDE; END; IMPLEMENTATION {$I U6Boxer2.text} END.