-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
unit GDK.ToolsAPI.CustomEditor; | ||
|
||
interface | ||
|
||
uses | ||
ToolsAPI, | ||
DesignIntf, | ||
VCL.Forms, | ||
Vcl.Graphics; | ||
|
||
type | ||
TCustomEditorView = class(TInterfacedObject, INTACustomEditorView) | ||
strict protected | ||
function GetCaption: string; virtual; abstract; | ||
function GetEditorWindowCaption: string; virtual; abstract; | ||
function GetViewIdentifier: string; virtual; abstract; | ||
function GetFrameClass: TCustomFrameClass; virtual; abstract; | ||
procedure FrameCreated(AFrame: TCustomFrame); virtual; abstract; | ||
function GetImageIndex: Integer; virtual; abstract; | ||
function GetTabHintText: string; virtual; abstract; | ||
|
||
function GetCanCloneView: Boolean; virtual; | ||
function CloneEditorView: INTACustomEditorView; virtual; | ||
function GetEditState: TEditState; virtual; | ||
function EditAction(Action: TEditAction): Boolean; virtual; | ||
procedure CloseAllCalled(var ShouldClose: Boolean); virtual; | ||
procedure Close(var Allowed: Boolean); virtual; | ||
procedure SelectView; virtual; | ||
procedure DeselectView; virtual; | ||
|
||
function GetTabColor: TColor; virtual; | ||
public | ||
property CanCloneView: Boolean read GetCanCloneView; | ||
property Caption: string read GetCaption; | ||
property EditorWindowCaption: string read GetEditorWindowCaption; | ||
property FrameClass: TCustomFrameClass read GetFrameClass; | ||
property ViewIdentifier: string read GetViewIdentifier; | ||
end; | ||
|
||
{$IF CompilerVersion >= 22.0} | ||
TCustomEditorView150 = class(TCustomEditorView, INTACustomEditorView150); | ||
{$ENDIF} | ||
|
||
{$IF CompilerVersion >= 35.0} | ||
TCustomEditorView280 = class(TCustomEditorView150, INTACustomEditorView280); | ||
{$ENDIF} | ||
|
||
|
||
|
||
implementation | ||
|
||
{ TCustomEditorView } | ||
|
||
function TCustomEditorView.GetCanCloneView: Boolean; | ||
begin | ||
Result := False; | ||
end; | ||
|
||
function TCustomEditorView.CloneEditorView: INTACustomEditorView; | ||
begin | ||
Result := nil; | ||
end; | ||
|
||
function TCustomEditorView.GetEditState: TEditState; | ||
begin | ||
Result := [TEditStates.esCanCut, TEditStates.esCanCopy, TEditStates.esCanPaste, TEditStates.esCanDelete]; | ||
end; | ||
|
||
function TCustomEditorView.EditAction(Action: TEditAction): Boolean; | ||
begin | ||
Result := False; | ||
end; | ||
|
||
procedure TCustomEditorView.CloseAllCalled(var ShouldClose: Boolean); | ||
begin | ||
ShouldClose := True | ||
end; | ||
|
||
procedure TCustomEditorView.SelectView; | ||
begin | ||
// No default implementation | ||
end; | ||
|
||
procedure TCustomEditorView.DeselectView; | ||
begin | ||
// No default implementation | ||
end; | ||
|
||
procedure TCustomEditorView.Close(var Allowed: Boolean); | ||
begin | ||
Allowed := True; | ||
end; | ||
|
||
function TCustomEditorView.GetTabColor: TColor; | ||
begin | ||
Result := clNone; | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
unit GDK.ToolsAPI.Helper.Interfaces; | ||
|
||
interface | ||
|
||
uses | ||
ToolsAPI, | ||
System.SysUtils; | ||
|
||
type | ||
IToolsApiHelper = interface; | ||
IToolsApiLogger = interface; | ||
IToolsApiProject = interface; | ||
IToolsApiModule = interface; | ||
IToolsApiEditView = interface; | ||
IToolsApiSourceEditor = interface; | ||
IToolsApiEditReader = interface; | ||
IToolsApiEditWriter = interface; | ||
IToolsApiBuildConfigurations = interface; | ||
IToolsApiBuildConfiguration = interface; | ||
|
||
EToolsApiNoProjectFound = class(Exception); | ||
EToolsApiNoModuleFound = class(Exception); | ||
EToolsApiNoEditorFound = class(Exception); | ||
EToolsApiNoEditViewFound = class(Exception); | ||
EToolsApiNoCustomLogGroupUsed = class(Exception); | ||
|
||
IToolsApiHelper = interface | ||
['{3D85AEBD-3FE0-43A0-9C30-F30F0A820C45}'] | ||
|
||
function Logger: IToolsApiLogger; overload; | ||
function Logger(const GroupName: string): IToolsApiLogger; overload; | ||
|
||
function Project: IToolsApiProject; overload; | ||
function Project(const Project: IOTAProject): IToolsApiProject; overload; | ||
|
||
function Module: IToolsApiModule; overload; | ||
function Module(const Module: IOTAModule): IToolsApiModule; overload; | ||
|
||
function SourceEditor: IToolsApiSourceEditor; | ||
function EditorReader: IToolsApiEditReader; | ||
function EditorWriter: IToolsApiEditWriter; | ||
|
||
procedure EditorInsertText(const Text: TArray<string>; const Position: TOTAEditPos); overload; | ||
procedure EditorInsertText(const Text: TArray<string>; const AtLine: Integer); overload; | ||
function EditorPosition: TOTAEditPos; | ||
function EditorContent: string; | ||
|
||
function BuildConfigurations: IToolsApiBuildConfigurations; | ||
|
||
function EditView: IToolsApiEditView; | ||
end; | ||
|
||
IToolsApiLogger = interface | ||
['{D8FF6783-45A9-4D15-A239-7D5B3EC19D7C}'] | ||
|
||
function UsesCustomGroup: Boolean; | ||
function GetGroup: IOTAMessageGroup; | ||
|
||
procedure Clear; | ||
|
||
procedure Log(const Text: string); overload; | ||
procedure Log(const Text: string; const Params: array of const); overload; | ||
end; | ||
|
||
IToolsApiProject = interface | ||
['{F78C515E-354A-4341-8073-E45B091847B2}'] | ||
|
||
function Get: IOTAProject; | ||
function ProjectConfigurations: IOTAProjectOptionsConfigurations; | ||
|
||
function BuildConfigurations: IToolsApiBuildConfigurations; | ||
end; | ||
|
||
IToolsApiModule = interface | ||
['{6370BA7A-2A5C-468F-BA8F-93B090837B90}'] | ||
|
||
function Get: IOTAModule; | ||
function FileCount: Integer; | ||
|
||
function Editor(const Predicate: TFunc<IOTAEditor, Boolean>): IOTAEditor; | ||
function SourceEditor(const Predicate: TFunc<IOTASourceEditor, Boolean> = nil): IToolsApiSourceEditor; | ||
function FormEditor(const Predicate: TFunc<IOTAFormEditor, Boolean> = nil): IOTAFormEditor; | ||
end; | ||
|
||
IToolsApiEditView = interface | ||
['{5E080CEF-0D18-453E-8AF4-F7CF9BBCE45C}'] | ||
|
||
function TopView: IOTAEditView; | ||
function CursorPosition: TOTAEditPos; | ||
|
||
procedure InsertText(const Text: TArray<string>; const Position: TOTAEditPos); | ||
end; | ||
|
||
IToolsApiSourceEditor = interface | ||
['{1A2D29C0-A6B2-4B21-B17D-781F89A54A14}'] | ||
|
||
function Get: IOTASourceEditor; | ||
function Reader: IToolsApiEditReader; | ||
function Writer: IToolsApiEditWriter; | ||
function UndoableWriter: IToolsApiEditWriter; | ||
end; | ||
|
||
IToolsApiEditReader = interface | ||
['{81675E71-2231-4165-B5CF-EC898D204DEC}'] | ||
|
||
function Get: IOTAEditReader; | ||
function Content: string; | ||
end; | ||
|
||
IToolsApiEditWriter = interface | ||
['{27079628-B140-4E0E-959C-40879C213D52}'] | ||
|
||
function Get: IOTAEditWriter; | ||
|
||
procedure InsertText(const Text: string; const Position: Integer); overload; | ||
procedure InsertText(const Text: string; const Position: TOTAEditPos); overload; | ||
end; | ||
|
||
IToolsApiBuildConfigurations = interface | ||
['{CF2A696D-B493-491F-9E2F-C82D7B69CEFE}'] | ||
|
||
function Base: IToolsApiBuildConfiguration; | ||
function Active: IToolsApiBuildConfiguration; | ||
end; | ||
|
||
IToolsApiBuildConfiguration = interface | ||
['{B1FF2C33-0F59-4FD1-822E-327FA78216D2}'] | ||
function GetSearchPaths: TArray<string>; | ||
procedure SetSearchPaths(const Paths: TArray<string>); | ||
|
||
function Get: IOTABuildConfiguration; | ||
|
||
property SearchPaths: TArray<string> read GetSearchPaths write SetSearchPaths; | ||
end; | ||
|
||
implementation | ||
|
||
end. |
Oops, something went wrong.