home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 22.0 KB | 770 lines | [TEXT/MPS ] |
- {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
- { Copyright © 1986-1990 Apple Computer, Inc. All rights reserved. }
-
- VAR
-
- {$J+} { These have storage allocated elsewhere }
- HookedCQDProcsPtrOffset: integer; { offset in object to the QDProcs record }
- OldTEHooksRecOffset: integer; { offset in object to the OldHooks record }
-
- curTabTEView: TTabTEView; { accessed synchronously by the QD
- replacement procs to get context }
- {$J-}
-
- pLastTheLength, pLastTheWidthBefore: integer;
- pLastSelf: TTabTEView;
- pLastTETxMeas: integer;
- pLastTheCharOffset, pLastTheLine: integer;
-
- PROCEDURE myTEDrawHook;
- EXTERNAL;
-
- PROCEDURE myTEWidthHook;
- EXTERNAL;
-
- PROCEDURE myTEHitTestHook;
- EXTERNAL;
-
- PROCEDURE myTEEOLHook;
- EXTERNAL;
-
- FUNCTION CallOriginalTxMeas(byteCount: integer;
- textAddr: Ptr;
- VAR numer: Point;
- VAR denom: Point;
- VAR info: FontInfo;
- actionProc: ProcPtr): integer;
- INLINE $205F, $4E90;
- { MOVE.L (A7)+,A0
- JSR (A0)
- }
-
- PROCEDURE CallOriginalText(theLength: integer;
- theText: Ptr;
- numer: Point;
- denom: Point;
- actionProc: ProcPtr);
- INLINE $205F, $4E90;
- { MOVE.L (A7)+,A0
- JSR (A0)
- }
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEInit}
-
- PROCEDURE InitUTabTEView;
-
- BEGIN
- IF NOT gUTEViewInitialized THEN
- InitUTEView;
-
- IF qTemplateViews THEN
- BEGIN
- { So linker doesn't strip TTabTEView class }
- IF gDeadStripSuppression THEN
- IF Member(TObject(NIL), TTabTEView) THEN;
- END;
- END;
-
- { Follows are the bottleneck procs for QuickDraw to perform tabs }
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
- {$Push} {$ifc qTrace} {$D+} {$endc} { we don't really need these guys traced! }
-
- FUNCTION myTxMeas(theLength: integer;
- theText: Ptr;
- VAR numer: Point;
- VAR denom: Point;
- VAR info: FontInfo): integer;
-
- BEGIN
- IF curTabTEView <> NIL THEN
- myTxMeas := curTabTEView.TETxMeas(theLength, theText, numer, denom, info)
- ELSE
- {$IFC false}
- myTxMeas := CallOriginalTxMeas(theLength, theText, numer, denom, info,
- curTabTEView.fOldCQDProcs.txMeasProc)
- {$EndC}
- DebugStr('whoops!');
- END;
- {$Pop}
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
- {$Push} {$ifc qTrace} {$D+} {$endc} { we don't really need these guys traced! }
-
- PROCEDURE myDrawText(theLength: integer;
- theText: Ptr;
- numer: Point;
- denom: Point);
-
- BEGIN
- IF curTabTEView <> NIL THEN
- curTabTEView.TEDrawText(theLength, theText, numer, denom)
- ELSE
- {$IFC false}
- CallOriginalText(theLength, theText, numer, denom, curTabTEView.fOldCQDProcs.textProc)
- {$EndC}
- DebugStr('whoops!');
- END;
- {$Pop}
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
- {$Push} {$ifc qTrace} {$D+} {$endc} { we don't really need these guys traced! }
-
- PROCEDURE TTabTEView.TEDrawText(theLength: integer;
- theText: Ptr;
- numer: Point;
- denom: Point);
-
- VAR
- i: integer;
- margin: integer;
- currentPoint: Point;
- beginChar: integer;
-
- BEGIN
-
- WITH fHTE^^, currentPoint DO
- BEGIN
- beginChar := 0;
- margin := destRect.left;
- FOR i := 0 TO theLength - 1 DO
- BEGIN
- CASE char(Ptr(ORD(theText) + i)^) OF
- chTab:
- BEGIN
- CallOriginalText(i - beginChar, Ptr(ORD(theText) + beginChar), numer, denom,
- fOldCQDProcs.textProc);
- beginChar := i + 1;
-
- GetPen(currentPoint);
-
- IF fShowInvisibles THEN
- DrawChar(kVisibleTAB);
-
- h := h - margin + fTabSize;
- h := (h DIV fTabSize) * fTabSize + margin + 1;
-
- MoveTo(h, v);
- END;
- chReturn:
- IF fShowInvisibles THEN
- BEGIN
- CallOriginalText(i - beginChar, Ptr(ORD(theText) + beginChar), numer, denom,
- fOldCQDProcs.textProc);
- beginChar := i + 1;
-
- DrawChar(kVisibleCR);
- END;
- chSpace:
- IF fShowInvisibles THEN
- BEGIN
- CallOriginalText(i - beginChar, Ptr(ORD(theText) + beginChar), numer, denom,
- fOldCQDProcs.textProc);
- beginChar := i + 1;
-
- DrawChar(kVisibleSpace);
- END;
- END;
- END;
- END;
-
- CallOriginalText(theLength - beginChar, Ptr(ORD(theText) + beginChar), numer, denom,
- fOldCQDProcs.textProc);
- END;
- {$Pop}
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
- {$Push} {$ifc qTrace} {$D+} {$endc} { we don't really need these guys traced! }
-
- FUNCTION TTabTEView.TETextLength(theText: Ptr;
- theLength: integer;
- theWidthBefore: integer;
- VAR numer: Point;
- VAR denom: Point;
- VAR info: FontInfo): integer;
-
- VAR
- beginChar: integer;
- theWidth: integer;
- i: integer;
- aByte: QDByte;
-
- BEGIN
-
- theWidth := 0;
- beginChar := 0;
- FOR i := 0 TO theLength - 1 DO
- BEGIN
- CASE char(Ptr(ORD(theText) + i)^) OF
- chTab:
- BEGIN
- theWidth := theWidth + CallOriginalTxMeas(i - beginChar, Ptr(ORD(theText) +
- beginChar), numer, denom, info,
- fOldCQDProcs.txMeasProc);
- beginChar := i + 1;
- theWidth := ((theWidth + fTabSize + theWidthBefore) DIV fTabSize) *
- fTabSize - theWidthBefore;
- END;
- chSpace:
- IF fShowInvisibles THEN
- BEGIN
- theWidth := theWidth + CallOriginalTxMeas(i - beginChar, Ptr(ORD(theText) +
- beginChar), numer, denom, info,
- fOldCQDProcs.txMeasProc);
- beginChar := i + 1;
- {$Push} {$R-}
- aByte := QDByte(kVisibleSpace);
- {$Pop}
- theWidth := theWidth + CallOriginalTxMeas(1, @aByte, numer, denom, info,
- fOldCQDProcs.txMeasProc);
- END;
- chReturn:
- IF fShowInvisibles THEN
- BEGIN
- theWidth := theWidth + CallOriginalTxMeas(i - beginChar, Ptr(ORD(theText) +
- beginChar), numer, denom, info,
- fOldCQDProcs.txMeasProc);
- beginChar := i + 1;
- {$Push} {$R-}
- aByte := QDByte(kVisibleCR);
- {$Pop}
- theWidth := theWidth + CallOriginalTxMeas(1, @aByte, numer, denom, info,
- fOldCQDProcs.txMeasProc);
- END;
- END;
- END;
-
- TETextLength := theWidth + CallOriginalTxMeas(theLength - beginChar, Ptr(ORD(theText) +
- beginChar), numer, denom, info,
- fOldCQDProcs.txMeasProc);
- END;
- {$Pop}
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
- {$Push} {$ifc qTrace} {$D+} {$endc} { we don't really need these guys traced! }
-
- FUNCTION TTabTEView.TETxMeas(theLength: integer;
- theText: Ptr;
- VAR numer: Point;
- VAR denom: Point;
- VAR info: FontInfo): integer;
-
- VAR
- TheCharOffset: integer;
- theline: integer;
- theWidthBefore: integer;
-
- BEGIN
- {
- Find which line in the TE the text pointed to by theText starts on and measure the
- distance between the start of the line and the position in theline pointed to by theText.
- This whole scheme depends on textedit passing us a pointer to the actual hText^.
- }
-
- WITH fHTE^^ DO
- BEGIN
- { find out what line we're currently on }
- TheCharOffset := ORD(StripLong(theText)) - ORD(StripLong(hText^));
-
- IF (self = pLastSelf) & (TheCharOffset = pLastTheCharOffset) THEN
- BEGIN
- theline := pLastTheLine;
- END
- ELSE { Scan backward thru the line starts array
- for a linestart less than TheCharOffset }
- BEGIN
- FOR theline := max(nLines - 1, 0) DOWNTO 0 DO
- IF lineStarts[theline] <= TheCharOffset THEN
- LEAVE
- END;
-
- { if the line is the same we may be able to save some calculation by caching }
-
- {$IFC FALSE}
- {### NOT NOW }
- IF (self = pLastSelf) & (theline = pLastTheLine) THEN
- BEGIN
- IF (TheCharOffset < pLastTheCharOffset) THEN { starts sooner on line. saved
- theWidthBefore info is useless }
- BEGIN
- IF (lineStarts[theline] = TheCharOffset) | (lineStarts[theline] < 0) THEN { the
- beginning of a line or end of text }
- theWidthBefore := 0
- ELSE
- theWidthBefore := TETextLength(Ptr(ORD(hText^) + lineStarts[theline]),
- TheCharOffset - lineStarts[theline], 0, numer,
- denom, info);
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- END
- ELSE IF (TheCharOffset > pLastTheCharOffset) THEN { starts later on line. Attempt to
- re-use some width before info }
- BEGIN
- IF (TheCharOffset < (pLastTheCharOffset + pLastTheLength)) THEN { starts sooner than
- end of last run pLastTETxMeas is useless }
- BEGIN
- theWidthBefore := TETextLength(Ptr(ORD(hText^) + pLastTheCharOffset),
- TheCharOffset - pLastTheCharOffset,
- theWidthBefore, numer, denom, info);
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- END
- ELSE IF (TheCharOffset > (pLastTheCharOffset + pLastTheLength)) THEN
- BEGIN
- theWidthBefore := pLastTheWidthBefore + pLastTETxMeas;
- theWidthBefore := TETextLength(Ptr(ORD(hText^) + pLastTheCharOffset +
- pLastTheLength), TheCharOffset -
- (pLastTheCharOffset + pLastTheLength),
- theWidthBefore, numer, denom, info);
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- END
- ELSE { must be equal }
- BEGIN
- theWidthBefore := pLastTheWidthBefore + pLastTETxMeas;
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info)
- END
- END
- ELSE { must be equal starting position }
- BEGIN
- IF (theLength < pLastTheLength) THEN
- BEGIN
- IF (lineStarts[theline] = TheCharOffset) | (lineStarts[theline] < 0) THEN { the
- beginning of a line or end of text }
- theWidthBefore := 0
- ELSE
- theWidthBefore := TETextLength(Ptr(ORD(hText^) + lineStarts[theline]),
- TheCharOffset - lineStarts[theline], 0,
- numer, denom, info);
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- END
- ELSE IF (theLength > pLastTheLength) THEN
- BEGIN
- pLastTETxMeas := pLastTETxMeas + TETextLength(Ptr(ORD(theText) +
- pLastTheLength), theLength -
- pLastTheLength,
- pLastTheWidthBefore +
- pLastTETxMeas, numer, denom, info)
- END
- ELSE { must be equal }
- BEGIN
- pLastTETxMeas := pLastTETxMeas;
- END;
-
- END;
- END
- ELSE { line not the same. no caching available }
- {$EndC}
- BEGIN
- IF (lineStarts[theline] = TheCharOffset) | (lineStarts[theline] < 0) THEN { the
- beginning of a line or end of text }
- theWidthBefore := 0
- ELSE
- theWidthBefore := TETextLength(Ptr(ORD(hText^) + lineStarts[theline]),
- TheCharOffset - lineStarts[theline], 0, numer,
- denom, info);
- pLastTETxMeas := TETextLength(theText, theLength, theWidthBefore, numer, denom, info);
- END
-
- END;
-
- pLastTheWidthBefore := theWidthBefore;
- pLastTheCharOffset := TheCharOffset;
- pLastTheLine := theline;
- pLastTheLength := theLength;
- pLastSelf := self;
- TETxMeas := pLastTETxMeas;
- END;
- {$Pop}
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
-
- PROCEDURE TTabTEView.WithHookedGrafProcsDo(PROCEDURE whatToDo);
-
- VAR
- oldGrafPort: GrafPtr; { the GrafPort found in the TE }
- oldGrafProcs: QDProcsPtr; { the grafprocs pointer found in the TE's
- grafport }
- oldCurTEView: TTabTEView; { the saved setting of the curTEView }
-
- BEGIN
-
- { Make SELF available to the hooked grafprocs that will be invoked later
- save the old curTabTEView first }
- oldCurTEView := curTabTEView;
- curTabTEView := self;
-
- { save its old grafprocs pointer }
- oldGrafProcs := fHTE^^.inPort^.grafProcs;
- fHTE^^.inPort^.grafProcs := QDProcsPtr(fHookedCQDProcsPtr);
-
- { Do what we were called for }
- whatToDo;
-
- { restore the old curTabTEView, grafprocs and that showed we were hooked in }
-
- curTabTEView := oldCurTEView;
- fHTE^^.inPort^.grafProcs := oldGrafProcs;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
-
- FUNCTION TTabTEView.DoMouseCommand(VAR theMouse: Point;
- VAR info: EventInfo;
- VAR hysteresis: Point): TCommand; OVERRIDE;
-
- PROCEDURE whatToDo;
-
- BEGIN
- DoMouseCommand := INHERITED DoMouseCommand(theMouse, info, hysteresis);
- END;
-
- BEGIN
- { lousy TE (6.0) doesn't always respect TECustomHook! }
- WithHookedGrafProcsDo(whatToDo)
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ARes}
-
- PROCEDURE TTabTEView.DoSetupMenus; OVERRIDE;
- BEGIN
- INHERITED DoSetupMenus;
- Enable(cIncTabs, TRUE);
- Enable(cDecTabs, TRUE);
- EnableCheck(cShowInvs, TRUE, fShowInvisibles); {}
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S ASelCommand}
-
- FUNCTION TTabTEView.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
- VAR
- aSetTabCmd:TSetTabCommand;
- aShowInvsCmd:TShowInvsCommand;
- BEGIN
- DoMenuCommand := NIL;
- CASE aCmdNumber OF
- cIncTabs:
- BEGIN
- New(aSetTabCmd);
- FailNIL(aSetTabCmd);
- aSetTabCmd.ISetTabCommand(SELF, aCmdNumber, fTabSize + 1);
- PostCommand(aSetTabCmd);
- END;
- cDecTabs:
- BEGIN
- New(aSetTabCmd);
- FailNIL(aSetTabCmd);
- aSetTabCmd.ISetTabCommand(SELF, aCmdNumber, fTabSize - 1);
- PostCommand(aSetTabCmd);
- END;
- cShowInvs:
- BEGIN
- New(aShowInvsCmd);
- FailNIL(aShowInvsCmd);
- aShowInvsCmd.IShowInvsCommand(SELF, aCmdNumber, fShowInvisibles);
- PostCommand(aShowInvsCmd);
- END;
- OTHERWISE
- DoMenuCommand := INHERITED DoMenuCommand(aCmdNumber);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEOpen}
-
- PROCEDURE TTabTEView.IRes(itsDocument: TDocument;
- itsSuperView: TView;
- VAR itsParams: Ptr); OVERRIDE;
-
- VAR
- aProcPtr: ProcPtr;
-
- BEGIN
- fHookedCQDProcsPtr := NIL;
-
- INHERITED IRes(itsDocument, itsSuperView, itsParams);
-
- fHookedCQDProcsPtr := CQDProcsPtr(NewPermPtr(sizeof(CQDProcs)));
- fTabSize := kDefaultTabSize;
- fShowInvisibles := FALSE;
- fControlChars := fControlChars + [chTab]; { tell TTE to accept tabs }
-
- IF fStyleType THEN { only for style right now… sorry! }
- BEGIN
- IF fHTE <> NIL THEN
- BEGIN
- { Storing SELF in the refcon should be in MacApp }
- GetStylHandle(fHTE)^^.teRefCon := longint(self);
-
- { let the ASM code know the offset of some of our structures }
- HookedCQDProcsPtrOffset := StripLong(@fHookedCQDProcsPtr) - StripLong(Handle(self)^);
- OldTEHooksRecOffset := StripLong(@fOldTEHooksRec) - StripLong(Handle(self)^);
-
- { set up custom hooks into my TE to handle tabs }
- aProcPtr := @myTEDrawHook;
- TECustomHook(intDrawHook, aProcPtr, fHTE);
- fOldTEHooksRec.DrawHook := aProcPtr;
-
- aProcPtr := @myTEWidthHook;
- TECustomHook(intWidthHook, aProcPtr, fHTE);
- fOldTEHooksRec.WidthHook := aProcPtr;
-
- aProcPtr := @myTEHitTestHook;
- TECustomHook(intHitTestHook, aProcPtr, fHTE);
- fOldTEHooksRec.HitTestHook := aProcPtr;
-
- END;
- END;
- BeInPort(GetGrafPort);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TENonRes}
-
- PROCEDURE TTabTEView.BeInPort(itsPort: GrafPtr); OVERRIDE;
- { save a copy of the currently effective GrafProcs and create a new version of the hooked procs }
-
- VAR
- theCProcs: CQDProcs;
- theProcs: QDProcs;
- aQDProcsPtr: QDProcsPtr;
- isColor: Boolean;
- itsCPort: CGrafPtr;
-
- BEGIN
- INHERITED BeInPort(itsPort);
-
- IF (fHTE <> NIL) & (fHookedCQDProcsPtr <> NIL) THEN
- BEGIN
- itsCPort := CGrafPtr(itsPort);
- isColor := itsCPort^.portversion = $C000;
-
- IF isColor THEN
- BEGIN
- IF itsCPort^.grafProcs = NIL THEN
- BEGIN
- SetStdCProcs(theCProcs);
- fOldCQDProcs := theCProcs;
- END
- ELSE
- fOldCQDProcs := CQDProcsPtr(itsCPort^.grafProcs)^;
- END
- ELSE
- BEGIN
- IF itsPort^.grafProcs = NIL THEN
- BEGIN
- SetStdProcs(theProcs);
- aQDProcsPtr := QDProcsPtr(@fOldCQDProcs);
- aQDProcsPtr^ := theProcs;
- END
- ELSE
- BEGIN
- aQDProcsPtr := QDProcsPtr(@fOldCQDProcs);
- aQDProcsPtr^ := itsPort^.grafProcs^;
- END;
- END;
-
- { stuff my replacements into the hooked grafprocs }
- fHookedCQDProcsPtr^ := fOldCQDProcs;
- fHookedCQDProcsPtr^.textProc := @myDrawText;
- fHookedCQDProcsPtr^.txMeasProc := @myTxMeas;
- END
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEOpen}
-
- PROCEDURE TTabTEView.SetTabSize(newSize: integer; redraw: BOOLEAN);
-
- BEGIN
- fTabSize := newSize;
- fSpecsChanged := TRUE;
- SynchView(FALSE);
- IF redraw THEN
- ForceRedraw;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TERes}
-
- PROCEDURE TTabTEView.ShowInvisibles(showEm: Boolean; redraw: BOOLEAN);
-
- BEGIN
- fShowInvisibles := showEm;
- IF redraw THEN
- ForceRedraw;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEFields}
-
- PROCEDURE TTabTEView.Fields(PROCEDURE DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: integer)); OVERRIDE;
-
- PROCEDURE QDProcsFields(theTitle: Str255;
- VAR theProcs: CQDProcs;
- PROCEDURE DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: integer));
-
- BEGIN
- DoToField(theTitle, NIL, bTitle);
- DoToField(' textProc', @theProcs.textProc, bPointer);
- DoToField(' lineProc', @theProcs.lineProc, bPointer);
- DoToField(' rectProc', @theProcs.rectProc, bPointer);
- DoToField(' rRectProc', @theProcs.rRectProc, bPointer);
- DoToField(' ovalProc', @theProcs.ovalProc, bPointer);
- DoToField(' arcProc', @theProcs.arcProc, bPointer);
- DoToField(' polyProc', @theProcs.polyProc, bPointer);
- DoToField(' rgnProc', @theProcs.rgnProc, bPointer);
- DoToField(' bitsProc', @theProcs.bitsProc, bPointer);
- DoToField(' commentProc', @theProcs.commentProc, bPointer);
- DoToField(' txMeasProc', @theProcs.txMeasProc, bPointer);
- DoToField(' getPicProc', @theProcs.getPicProc, bPointer);
- DoToField(' putPicProc', @theProcs.putPicProc, bPointer);
- END;
-
- BEGIN
- DoToField('TTabTEView', NIL, bClass);
- DoToField('fTabSize', @fTabSize, bInteger);
- DoToField('fShowInvisibles', @ShowInvisibles, bBoolean);
- {$Push} {$H-}
- QDProcsFields('fOldCQDProcs', fOldCQDProcs, DoToField);
- QDProcsFields('fHookedCQDProcsPtr', fHookedCQDProcsPtr^, DoToField);
- {$Pop}
-
- INHERITED Fields(DoToField);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TESelCommand}
-
- PROCEDURE TSetTabCommand.ISetTabCommand(itsView: TView;
- itsCmdNumber: CmdNumber;
- tabSetting: INTEGER);
- BEGIN
- ICommand(itsCmdNumber, itsView.fDocument, itsView, NIL);
- IF Member(itsView, TTabTEView) THEN
- fOldTabSetting := TTabTEView(itsView).fTabSize
- ELSE
- fOldTabSetting := 0;
- fNewTabSetting := tabSetting;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TSetTabCommand.DoIt; OVERRIDE;
- { sets new tabs, then calls ForceRedraw }
- BEGIN
- IF fView.Focus THEN; {??? What if Focus fails}
- IF Member(fView,TTabTEView) THEN
- TTabTEView(fView).SetTabSize(fNewTabSetting, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TSetTabCommand.RedoIt; OVERRIDE;
- { calls DoIt }
- BEGIN
- DoIt;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TSetTabCommand.UndoIt; OVERRIDE;
- { restores previous tab setting }
- BEGIN
- IF fView.Focus THEN; {??? What if Focus fails}
- IF Member(fView,TTabTEView) THEN
- TTabTEView(fView).SetTabSize(fOldTabSetting, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEFields}
-
- { Debugging }
-
- PROCEDURE TSetTabCommand.Fields(PROCEDURE
- DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
- BEGIN
- DoToField('TSetTabCommand', NIL, bClass);
- DoToField('fOldTabSetting', @fOldTabSetting, bInteger);
- DoToField('fNewTabSetting', @fNewTabSetting, bInteger);
- INHERITED Fields(DoToField);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TESelCommand}
-
- PROCEDURE TShowInvsCommand.IShowInvsCommand(itsView: TView;
- itsCmdNumber: CmdNumber;
- invsWereShown: BOOLEAN);
- BEGIN
- ICommand(itsCmdNumber, itsView.fDocument, itsView, NIL);
- fInvsWereShown := invsWereShown;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TShowInvsCommand.DoIt; OVERRIDE;
- { sets new tabs, then calls ForceRedraw }
- BEGIN
- IF fView.Focus THEN; {??? What if Focus fails}
- IF Member(fView,TTabTEView) THEN
- TTabTEView(fView).ShowInvisibles(NOT fInvsWereShown, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TShowInvsCommand.RedoIt; OVERRIDE;
- { calls DoIt }
- BEGIN
- DoIt;
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEDoCommand}
-
- PROCEDURE TShowInvsCommand.UndoIt; OVERRIDE;
- { restores previous tab setting }
- BEGIN
- IF fView.Focus THEN; {??? What if Focus fails}
- IF Member(fView,TTabTEView) THEN
- TTabTEView(fView).ShowInvisibles(fInvsWereShown, kRedraw);
- END;
-
- {--------------------------------------------------------------------------------------------------}
- {$S TEFields}
-
- { Debugging }
-
- PROCEDURE TShowInvsCommand.Fields(PROCEDURE
- DoToField(fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER)); OVERRIDE;
- BEGIN
- DoToField('TShowInvsCommand', NIL, bClass);
- DoToField('fInvsWereShown', @fInvsWereShown, bBoolean);
- INHERITED Fields(DoToField);
- END;
-