📄 toolsapi.pas
字号:
{ krUnhandled - Return this if the key is not to be handled by this proc.
Will execute the next handler assigned to this key. This will
also allow any menu shortcuts to execute if no other handers
handle the key.
krHandled - This proc handled the key and no further processing is
required. No menu shortcuts will be processed
krNextProc - This proc handled the key but execute the next handler if one
exists. No menu shortcuts will be processed }
TKeyBindingResult = (krUnhandled, krHandled, krNextProc);
{ Keybinding proc }
TKeyBindingProc = procedure (const Context: IOTAKeyContext; KeyCode: TShortcut;
var BindingResult: TKeyBindingResult) of object;
TMoveCursorMasks = Byte;
{ TSearchDirection }
TSearchDirection = (sdForward, sdBackward);
IOTANotifier = interface(IUnknown)
['{F17A7BCF-E07D-11D1-AB0B-00C04FB16FB3}']
{ This procedure is called immediately after the item is successfully saved.
This is not called for IOTAWizards }
procedure AfterSave;
{ This function is called immediately before the item is saved. This is not
called for IOTAWizard }
procedure BeforeSave;
{ The associated item is being destroyed so all references should be dropped.
Exceptions are ignored. }
procedure Destroyed;
{ This associated item was modified in some way. This is not called for
IOTAWizards }
procedure Modified;
end;
IOTAEditorNotifier = interface(IOTANotifier)
['{0E3B9D7B-E119-11D1-AB0C-00C04FB16FB3}']
{ Called when a new edit view is created(opInsert) or destroyed(opRemove) }
procedure ViewNotification(const View: IOTAEditView; Operation: TOperation);
{ Called when a view is activated }
procedure ViewActivated(const View: IOTAEditView);
end;
IOTAFormNotifier = interface(IOTANotifier)
['{0E3B9D7C-E119-11D1-AB0C-00C04FB16FB3}']
{ Called when the given form is activated }
procedure FormActivated;
{ This is called immediately prior to the form being streamed out. This
may be called without first getting a BeforeSave as in the case of
the project being compiled. }
procedure FormSaving;
{ Called when a component on this form was renamed }
procedure ComponentRenamed(ComponentHandle: TOTAHandle;
const OldName, NewName: string);
end;
IOTAEditor = interface(IUnknown)
['{F17A7BD0-E07D-11D1-AB0B-00C04FB16FB3}']
{ Call this to register an IOTANotifier. The result is the index to be
used when calling RemoveNotifier. If <0 then an error occurred. }
function AddNotifier(const ANotifier: IOTANotifier): Integer;
{ Returns the actual filename of this module editor. Rename through
IOTAModule}
function GetFileName: string;
{ Returns the editor specific modified status }
function GetModified: Boolean;
{ Returns the associated IOTAModule }
function GetModule: IOTAModule;
{ Mark this editor modified. The associated module will also be modified }
function MarkModified: Boolean;
{ Call with the index obtained from AddNotifier }
procedure RemoveNotifier(Index: Integer);
{ Show this editor. If no views are active, at least one will be created }
procedure Show;
property FileName: string read GetFileName;
property Modified: Boolean read GetModified;
property Module: IOTAModule read GetModule;
end;
IOTAToolsFilterNotifier = interface(IOTANotifier)
['{CEF1F13A-E877-4F20-88F2-F7E2BA61AAF4}']
{ Used by tools filter to fill message view with build result information. }
{ FileName is the name of the file that was compiled. }
{ ErrorCode is the error code result from the compile. }
{ StdOut is a string list of the standard out while the tool was executed. }
{ StdError is a string list of the standard error while the tool was executed. }
procedure Filter(FileName: string; ErrorCode: Integer;
StdOut, StdError: TStrings);
{ Should return an unique name for the filter. }
function GetFilterName: string;
end;
IOTAToolsFilter60 = interface(IUnknown)
['{8864B891-9B6D-4002-BB2E-1D6E59BFA49A}']
{ Call this to register an IOTANotifier. The result is the index to be
used when calling RemoveNotifier. If <0 then an error occurred. }
function AddNotifier(const ANotifier: IOTANotifier): Integer;
{ Call with the index obtained from AddNotifier }
procedure RemoveNotifier(Index: Integer);
end;
IOTAToolsFilter = interface(IOTAToolsFilter60)
['{891B2757-FC6F-4DE9-B653-F55A52733324}']
function FindFilter(const Name: string): IUnknown;
end;
{ Use the IOTAEditReader class to gain read access to an editor buffer:
NOTES:
The buffer is accessed as a linear "file" with line breaks included.
This reader interface could be accessed through a custom read-only
TStream descendant.
WARNING!!!
o A IOTAEditReader should never be active at the same time as an IOTAEditWriter.
}
IOTAEditReader = interface(IUnknown)
['{26EB0E4F-F97B-11D1-AB27-00C04FB16FB3}']
function GetText(Position: Longint; Buffer: PChar; Count: Longint): Longint;
end;
{ Use the IOTAEditWriter class to gain write access to an editor buffer:
NOTES:
o As with the reader, the buffer is accessed as a linear "file" with
line breaks included. The writer uses a "copy in place" metaphor for
modifying the editor buffer. In other words, the writer can be thought
of as simply copying from one buffer to another. All positions (Pos)
passed to the function are positions relative to the orginal file. Due
to the "copy" metaphor of the writer it does not support moving backward
in the editor buffer. It is recomended that all modifications that must
be performed should be done from the start to the finish.
o After the IOTAEditWriter is released, the undo-buffer of the editor
is flushed unless CreateUndoableWriter was called to obtain the
IOTAEditWriter.
WARNING!!!
o A IOTAEditWriter should never be active at the same time as an IOTAEditReader.
}
IOTAEditWriter = interface(IUnknown)
['{26EB0E50-F97B-11D1-AB27-00C04FB16FB3}']
procedure CopyTo(Pos: Longint);
procedure DeleteTo(Pos: Longint);
procedure Insert(Text: PChar);
function Position: Longint;
function GetCurrentPos: TOTACharPos;
property CurrentPos: TOTACharPos read GetCurrentPos;
end;
{ TOTASyntaxHighlighter is deprecated }
TOTASyntaxHighlighter = (shNone = 0,
shQuery = 1,
shPascal = 2,
shC = 3,
shSQL = 4,
shIDL = 5,
shMax = $FF);
{
TOTASyntaxCode:
The values which should be used with this type are defined in ToolsAPI as:
atWhiteSpace = 0;
atComment = 1;
atReservedWord = 2;
atIdentifier = 3;
etc...
Do not exceed SyntaxOff
}
POTASyntaxCode = ^TOTASyntaxCode;
TOTASyntaxCode = Byte;
{
TOTALineClass:
The value which is used for this type in the Highlighter interfaces is
user defineable (it is used to gain context for lines).
}
TOTALineClass = Byte;
{$IFDEF FATCHAR}
POTAEdChar = PWideChar;
{$ELSE}
POTAEdChar = PChar;
{$ENDIF}
{
TOTALineSize:
Length of line buffer to be tokenized.
}
TOTALineSize = Word;
IOTAHighlighter = interface(IOTANotifier)
['{79D28DA1-42F6-44B9-AE33-D001FD75DC40}']
function GetIDString: string;
function GetName: string;
procedure Tokenize(StartClass: TOTALineClass; LineBuf: POTAEdChar;
LineBufLen: TOTALineSize; HighlightCodes: POTASyntaxCode);
function TokenizeLineClass(StartClass: TOTALineClass;
LineBuf: POTAEdChar; LineBufLen: TOTALineSize): TOTALineClass;
property Name: string read GetName;
property IDString: string read GetIDString;
end;
IOTAHighlightServices = interface
['{78C26089-6CAD-40D1-BAC2-37A84DF8F3E6}']
function GetHighlighterCount: Integer;
function GetHighlighter(Index: Integer): IOTAHighlighter;
function AddHighlighter(const AHighlighter: IOTAHighlighter): Integer;
procedure RemoveHighlighter(Index: Integer);
property Highlighter[Index: Integer]: IOTAHighlighter read GetHighlighter;
property HighlighterCount: Integer read GetHighlighterCount;
end;
TOTABlockType = (btInclusive, btLine, btColumn, btNonInclusive, btUnknown);
IOTAEditView40 = interface(IUnknown)
['{0E3B9D78-E119-11D1-AB0C-00C04FB16FB3}']
{ Return the Current cursor position }
function GetCursorPos: TOTAEditPos;
{ Set the current Cursor position }
procedure SetCursorPos(const Value: TOTAEditPos);
{ Return the Current top visible position }
function GetTopPos: TOTAEditPos;
{ Set the current top visible position }
procedure SetTopPos(const Value: TOTAEditPos);
{ Get size of the visible portion of the view in character cells }
function GetViewSize: TSize;
{ Converts a linear buffer offset position to a CharPos }
function PosToCharPos(Pos: Longint): TOTACharPos;
{ Convert a CharPos to a linear buffer offset }
function CharPosToPos(CharPos: TOTACharPos): Longint;
{ Convert between a EdPos and a CharPos }
procedure ConvertPos(EdPosToCharPos: Boolean; var EditPos: TOTAEditPos;
var CharPos: TOTACharPos);
{ Return the token attributes at the given EdPos. If IncludeMargin is true,
the attribute at the right margin line is the margin line attribute, else
it returns the actual char attribute }
procedure GetAttributeAtPos(const EdPos: TOTAEditPos; IncludeMargin: Boolean;
var Element, LineFlag: Integer);
{ Returns true if this interface instance is connected to the same
underlying view as the indicated instance. You must use this method
in order to test for equality between views since several interface
instances may share a single view. You should also not hold onto
these view interfaces for any length of time, unless a notifier is
registered with the IOTASourceEditor so you can determine when the
underlying implementation is vanishing. }
function SameView(EditView: IOTAEditView): Boolean;
property CursorPos: TOTAEditPos read GetCursorPos write SetCursorPos;
property TopPos: TOTAEditPos read GetTopPos write SetTopPos;
property ViewSize: TSize read GetViewSize;
end;
IOTASearchOptions = interface(IUnknown)
['{D1766F8B-D915-11D2-A8C1-00C04FA32F53}']
function GetCaseSensitive: Boolean;
function GetDirection: TSearchDirection;
function GetFromCursor: Boolean;
function GetRegularExpression: Boolean;
function GetSearchText: string;
function GetWholeFile: Boolean;
function GetWordBoundary: Boolean;
procedure SetCaseSensitive(Value: Boolean);
procedure SetDirection(Value: TSearchDirection);
procedure SetFromCursor(Value: Boolean);
procedure SetRegularExpression(Value: Boolean);
procedure SetSearchText(const Value: string);
procedure SetWholeFile(Value: Boolean);
procedure SetWordBoundary(Value: Boolean);
property CaseSensitive: Boolean read GetCaseSensitive write SetCaseSensitive;
property Direction: TSearchDirection read GetDirection write SetDirection;
property FromCursor: Boolean read GetFromCursor write SetFromCursor;
property RegularExpression: Boolean read GetRegularExpression write SetRegularExpression;
property SearchText: string read GetSearchText write SetSearchText;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -