Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Pasfmt.Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ implementation
System.JSON,
Pasfmt.Log,
Pasfmt.OnSave,
Pasfmt.ProjectNotifier,
System.Generics.Collections;

type
Expand All @@ -29,6 +30,7 @@ TPlugin = class(TObject)
FKeyboardBindingIndex: Integer;
FInfoIndex: Integer;
FEditorIndex: Integer;
FProjectIndex: Integer;
FAddInOptions: TPasfmtAddInOptions;
FBitmaps: TObjectList<TBitmap>;

Expand Down Expand Up @@ -99,6 +101,7 @@ constructor TPlugin.Create;
FBitmaps := TObjectList<TBitmap>.Create;

FEditorIndex := (BorlandIDEServices as IOTAEditorServices).AddNotifier(OnSaveInstaller);
FProjectIndex := (BorlandIDEServices as IOTAProject).AddNotifier(OnProjectNotify);
OnSaveInstaller.ConfigureFormatter := ConfigureFormatter;

FPasfmtMenu := TMenuItem.Create((BorlandIDEServices as INTAServices).MainMenu);
Expand Down Expand Up @@ -139,6 +142,7 @@ destructor TPlugin.Destroy;
begin
FinalizeLog;
(BorlandIDEServices as IOTAEditorServices).RemoveNotifier(FEditorIndex);
(BorlandIDEServices as IOTAProject).RemoveNotifier(FProjectIndex);
(BorlandIDEServices as IOTAAboutBoxServices).RemovePluginInfo(FInfoIndex);
(BorlandIDEServices as INTAEnvironmentOptionsServices).UnregisterAddInOptions(FAddInOptions);
(BorlandIDEServices as IOTAKeyboardServices).RemoveKeyboardBinding(FKeyboardBindingIndex);
Expand Down
93 changes: 93 additions & 0 deletions Pasfmt.ProjectNotifier.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
unit Pasfmt.ProjectNotifier;

interface

uses
ToolsAPI,
System.SysUtils,
System.StrUtils;

type
TProjectNotifier = class(TNotifierObject, IOTANotifier, IOTAModuleNotifier, IOTAProjectNotifier)
public
{ IOTANotifier }
procedure AfterSave;
procedure BeforeSave;
procedure Destroyed;
procedure Modified;

{ IOTAModuleNotifier }
function CheckOverwrite: Boolean;
procedure ModuleRenamed(const NewName: string); overload;

{ IOTAProjectNotifier }
procedure ModuleAdded(const AFileName: string);
procedure ModuleRemoved(const AFileName: string);
procedure ModuleRenamed(const AOldFileName, ANewFileName: string); overload;
end;

function OnProjectNotify: TProjectNotifier;

implementation

var
GOnProjectNotifier: IOTAProjectNotifier;

function OnProjectNotify: TProjectNotifier;
begin
if not Assigned(GOnProjectNotifier) then
begin
GOnProjectNotifier := TProjectNotifier.Create;
end;

Result := TProjectNotifier(GOnProjectNotifier);
end;

{ TProjectNotifier }

procedure TProjectNotifier.AfterSave;
begin
inherited;
end;

procedure TProjectNotifier.BeforeSave;
begin
inherited;
end;

function TProjectNotifier.CheckOverwrite: Boolean;
begin
Result := True;
end;

procedure TProjectNotifier.Destroyed;
begin
inherited;
end;

procedure TProjectNotifier.Modified;
begin

end;

procedure TProjectNotifier.ModuleAdded(const AFileName: string);
begin

end;

procedure TProjectNotifier.ModuleRemoved(const AFileName: string);
begin

end;

procedure TProjectNotifier.ModuleRenamed(const NewName: string);
begin

end;

procedure TProjectNotifier.ModuleRenamed(const AOldFileName, ANewFileName: string);
begin

end;

end.
3 changes: 2 additions & 1 deletion Pasfmt.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ contains
Pasfmt.Settings in 'Pasfmt.Settings.pas',
Pasfmt.SettingsFrame in 'Pasfmt.SettingsFrame.pas' {PasfmtSettingsFrame: TFrame},
Pasfmt.OnSave in 'Pasfmt.OnSave.pas',
Pasfmt.Cursors in 'Pasfmt.Cursors.pas';
Pasfmt.Cursors in 'Pasfmt.Cursors.pas',
Pasfmt.ProjectNotifier in 'Pasfmt.ProjectNotifier.pas';

end.
19 changes: 17 additions & 2 deletions Pasfmt.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
<MainSource>Pasfmt.dpk</MainSource>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<ProjectGuid>{5B79110C-4DE7-4913-8685-8C1C2B22ED1D}</ProjectGuid>
<ProjectVersion>19.5</ProjectVersion>
<TargetedPlatforms>1</TargetedPlatforms>
<ProjectName Condition="'$(ProjectName)'==''">Pasfmt</ProjectName>
<ProjectVersion>20.3</ProjectVersion>
<TargetedPlatforms>1048577</TargetedPlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
Expand All @@ -18,6 +19,11 @@
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64x' and '$(Base)'=='true') or '$(Base_Win64x)'!=''">
<Base_Win64x>true</Base_Win64x>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
Expand Down Expand Up @@ -61,6 +67,13 @@
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64x)'!=''">
<BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
<BT_BuildType>Debug</BT_BuildType>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
Expand Down Expand Up @@ -106,6 +119,7 @@
</DCCReference>
<DCCReference Include="Pasfmt.OnSave.pas"/>
<DCCReference Include="Pasfmt.Cursors.pas"/>
<DCCReference Include="Pasfmt.ProjectNotifier.pas"/>
<RcItem Include="version.json">
<ContainerId>ResourceItem</ContainerId>
<ResourceType>RCDATA</ResourceType>
Expand Down Expand Up @@ -144,6 +158,7 @@
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
<Platform value="Win64x">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
Expand Down