Check-in [23ed19ff24]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added View class, implementing all the UI notifiers.
Timelines: family | ancestors | descendants | both | feature/rewrite-multi-async
Files: files | file ages | folders
SHA1: 23ed19ff241d0709af50674f43c94b4188016699
User & Date: tinus 2016-02-14 18:18:59
Context
2016-02-21
13:00
Register a module notifier for each file opened, and unregister it on destruction. check-in: 9368ecb481 user: tinus tags: feature/rewrite-multi-async
2016-02-14
18:18
Added View class, implementing all the UI notifiers. check-in: 23ed19ff24 user: tinus tags: feature/rewrite-multi-async
17:11
Added repo cache unit. check-in: 487a412c72 user: tinus tags: feature/rewrite-multi-async
Changes

Changes to src/Delphi10/VCSInfo_BPL.dpk.

29
30
31
32
33
34
35
36
37
38
39

requires
  rtl,
  designide;

contains
  VCSInfoMenuWzrd in '..\VCSInfoMenuWzrd.pas',
  u_FinalPathName in '..\u_FinalPathName.pas',
  VCSInfoWzrd in '..\VCSInfoWzrd.pas';

end.







|
<


29
30
31
32
33
34
35
36

37
38

requires
  rtl,
  designide;

contains
  VCSInfoMenuWzrd in '..\VCSInfoMenuWzrd.pas',
  u_FinalPathName in '..\u_FinalPathName.pas';


end.

Changes to src/Delphi10/VCSInfo_BPL.dproj.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...
130
131
132
133
134
135
136

137
138
139
140
141
142
143
...
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
...
524
525
526
527
528
529
530
531









532
533
534
535
536
537
538
    <PropertyGroup Condition="'$(Base)'!=''">
        <DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
        <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
        <DCC_CBuilderOutput>All</DCC_CBuilderOutput>
        <GenPackage>true</GenPackage>
        <GenDll>true</GenDll>
        <SanitizedProjectName>VCSInfo_BPL</SanitizedProjectName>
        <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
        <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
        <DCC_E>false</DCC_E>
        <DCC_N>false</DCC_N>
        <DCC_S>false</DCC_S>
        <DCC_F>false</DCC_F>
        <DCC_K>false</DCC_K>
        <VerInfo_Locale>1033</VerInfo_Locale>
................................................................................
        <DCC_DebugDCUs>true</DCC_DebugDCUs>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
        <DCC_RemoteDebug>true</DCC_RemoteDebug>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">

        <VerInfo_Keys>CompanyName=Martijn Coppoolse;FileDescription=VCS Info;FileVersion=0.1.0.0;InternalName=VCSInfo;LegalCopyright=;LegalTrademarks=;OriginalFilename=VCSInfo.bpl;ProductName=VCS Info;ProductVersion=1.0;Comments=http://fossil.2of4.net/vcsInfo</VerInfo_Keys>
        <VerInfo_MajorVer>0</VerInfo_MajorVer>
        <VerInfo_PreRelease>true</VerInfo_PreRelease>
        <VerInfo_DLL>true</VerInfo_DLL>
        <VerInfo_MinorVer>1</VerInfo_MinorVer>
        <DCC_RemoteDebug>false</DCC_RemoteDebug>
    </PropertyGroup>
................................................................................
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <DCCReference Include="rtl.dcp"/>
        <DCCReference Include="designide.dcp"/>
        <DCCReference Include="..\VCSInfoMenuWzrd.pas"/>
        <DCCReference Include="..\u_FinalPathName.pas"/>
        <DCCReference Include="..\VCSInfoWzrd.pas"/>
        <None Include="..\..\todo.md"/>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
        <BuildConfiguration Include="Base">
            <Key>Base</Key>
................................................................................
                </DeployFile>
                <DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\VCSInfo_BPL.bpl" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>VCSInfo_BPL.bpl</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                    <Platform Name="OSX32">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectOSXResource">
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\Resources</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="AndroidClassesDexFile">
................................................................................
                </DeployClass>
                <DeployClass Name="Android_LauncherIcon36">
                    <Platform Name="Android">
                        <RemoteDir>res\drawable-ldpi</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectiOSDeviceResourceRules"/>









                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>







|







 







>







 







<







 







|
<
<
<
<
<
<
<
<
<







 







|
>
>
>
>
>
>
>
>
>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
152
153
154
155
156
157
158

159
160
161
162
163
164
165
...
201
202
203
204
205
206
207
208









209
210
211
212
213
214
215
...
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
    <PropertyGroup Condition="'$(Base)'!=''">
        <DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
        <DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
        <DCC_CBuilderOutput>All</DCC_CBuilderOutput>
        <GenPackage>true</GenPackage>
        <GenDll>true</GenDll>
        <SanitizedProjectName>VCSInfo_BPL</SanitizedProjectName>
        <DCC_DcuOutput>..\..\out\DCU\$(Platform)\$(Config)</DCC_DcuOutput>
        <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
        <DCC_E>false</DCC_E>
        <DCC_N>false</DCC_N>
        <DCC_S>false</DCC_S>
        <DCC_F>false</DCC_F>
        <DCC_K>false</DCC_K>
        <VerInfo_Locale>1033</VerInfo_Locale>
................................................................................
        <DCC_DebugDCUs>true</DCC_DebugDCUs>
        <DCC_Optimize>false</DCC_Optimize>
        <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
        <DCC_RemoteDebug>true</DCC_RemoteDebug>
    </PropertyGroup>
    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
        <VerInfo_Keys>CompanyName=Martijn Coppoolse;FileDescription=VCS Info;FileVersion=0.1.0.0;InternalName=VCSInfo;LegalCopyright=;LegalTrademarks=;OriginalFilename=VCSInfo.bpl;ProductName=VCS Info;ProductVersion=1.0;Comments=http://fossil.2of4.net/vcsInfo</VerInfo_Keys>
        <VerInfo_MajorVer>0</VerInfo_MajorVer>
        <VerInfo_PreRelease>true</VerInfo_PreRelease>
        <VerInfo_DLL>true</VerInfo_DLL>
        <VerInfo_MinorVer>1</VerInfo_MinorVer>
        <DCC_RemoteDebug>false</DCC_RemoteDebug>
    </PropertyGroup>
................................................................................
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <DCCReference Include="rtl.dcp"/>
        <DCCReference Include="designide.dcp"/>
        <DCCReference Include="..\VCSInfoMenuWzrd.pas"/>
        <DCCReference Include="..\u_FinalPathName.pas"/>

        <None Include="..\..\todo.md"/>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
        </BuildConfiguration>
        <BuildConfiguration Include="Base">
            <Key>Base</Key>
................................................................................
                </DeployFile>
                <DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\17.0\Bpl\VCSInfo_BPL.bpl" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>VCSInfo_BPL.bpl</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="ProjectiOSDeviceResourceRules"/>









                <DeployClass Name="ProjectOSXResource">
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\Resources</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="AndroidClassesDexFile">
................................................................................
                </DeployClass>
                <DeployClass Name="Android_LauncherIcon36">
                    <Platform Name="Android">
                        <RemoteDir>res\drawable-ldpi</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                    <Platform Name="OSX32">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                </DeployClass>
                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>

Changes to src/Delphi10/VCSInfo_XSeattle.dpr.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
  using PChar or ShortString parameters. }

{$R *.dres}

uses
  System.SysUtils,
  System.Classes,
  VCSInfoWzrd in '..\VCSInfoWzrd.pas',
  RepoCache in '..\RepoCache.pas';

{$R *.res}

begin
end.







|
<





11
12
13
14
15
16
17
18

19
20
21
22
23
  using PChar or ShortString parameters. }

{$R *.dres}

uses
  System.SysUtils,
  System.Classes,
  VCSInfoWzrd in '..\VCSInfoWzrd.pas';


{$R *.res}

begin
end.

Changes to src/Delphi10/VCSInfo_XSeattle.dproj.

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
...
523
524
525
526
527
528
529
530




531
532






533
534
535





536
537
538
539
540
541
542
        <DCC_DebugInformation>0</DCC_DebugInformation>
    </PropertyGroup>
    <ItemGroup>
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <DCCReference Include="..\VCSInfoWzrd.pas"/>
        <DCCReference Include="..\RepoCache.pas"/>
        <RcItem Include="..\Res\logo.bmp">
            <ResourceType>BITMAP</ResourceType>
            <ResourceId>BMP_LOGO</ResourceId>
        </RcItem>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
................................................................................
                </DeployFile>
                <DeployFile LocalName="..\..\out\Win32\Debug\VCSInfo_XSeattle.dll" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>VCSInfo_XSeattle.dll</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                    <Platform Name="iOSDevice64">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\MacOS</RemoteDir>
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="iOSDevice32">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="iOSSimulator">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectOSXResource">
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\Resources</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
................................................................................
                </DeployClass>
                <DeployClass Name="Android_LauncherIcon36">
                    <Platform Name="Android">
                        <RemoteDir>res\drawable-ldpi</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectiOSDeviceResourceRules">




                    <Platform Name="iOSDevice64">
                        <Operation>1</Operation>






                    </Platform>
                    <Platform Name="iOSDevice32">
                        <Operation>1</Operation>





                    </Platform>
                </DeployClass>
                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>







<







 







|
<
<
<
<


<
<
<
<
<
<



<
<
<
<
<







 







|
>
>
>
>


>
>
>
>
>
>



>
>
>
>
>







97
98
99
100
101
102
103

104
105
106
107
108
109
110
...
148
149
150
151
152
153
154
155




156
157






158
159
160





161
162
163
164
165
166
167
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
        <DCC_DebugInformation>0</DCC_DebugInformation>
    </PropertyGroup>
    <ItemGroup>
        <DelphiCompile Include="$(MainSource)">
            <MainSource>MainSource</MainSource>
        </DelphiCompile>
        <DCCReference Include="..\VCSInfoWzrd.pas"/>

        <RcItem Include="..\Res\logo.bmp">
            <ResourceType>BITMAP</ResourceType>
            <ResourceId>BMP_LOGO</ResourceId>
        </RcItem>
        <BuildConfiguration Include="Release">
            <Key>Cfg_2</Key>
            <CfgParent>Base</CfgParent>
................................................................................
                </DeployFile>
                <DeployFile LocalName="..\..\out\Win32\Debug\VCSInfo_XSeattle.dll" Configuration="Debug" Class="ProjectOutput">
                    <Platform Name="Win32">
                        <RemoteName>VCSInfo_XSeattle.dll</RemoteName>
                        <Overwrite>true</Overwrite>
                    </Platform>
                </DeployFile>
                <DeployClass Name="ProjectiOSDeviceResourceRules">




                    <Platform Name="iOSDevice64">
                        <Operation>1</Operation>






                    </Platform>
                    <Platform Name="iOSDevice32">
                        <Operation>1</Operation>





                    </Platform>
                </DeployClass>
                <DeployClass Name="ProjectOSXResource">
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\Resources</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
................................................................................
                </DeployClass>
                <DeployClass Name="Android_LauncherIcon36">
                    <Platform Name="Android">
                        <RemoteDir>res\drawable-ldpi</RemoteDir>
                        <Operation>1</Operation>
                    </Platform>
                </DeployClass>
                <DeployClass Name="DependencyModule">
                    <Platform Name="Win32">
                        <Operation>0</Operation>
                        <Extensions>.dll;.bpl</Extensions>
                    </Platform>
                    <Platform Name="iOSDevice64">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="OSX32">
                        <RemoteDir>Contents\MacOS</RemoteDir>
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="iOSDevice32">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                    <Platform Name="iOSSimulator">
                        <Operation>1</Operation>
                        <Extensions>.dylib</Extensions>
                    </Platform>
                </DeployClass>
                <ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
                <ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
                <ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>

Added src/VCSInfoView.pas.

























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
unit VCSInfoView;

interface
uses
  ToolsAPI, System.Classes;

type
  TVCSInfoView = class(TNotifierObject,
                        IOTAIDENotifier, IOTAIDENotifier50, IOTAIDENotifier80,
                        IOTAModuleNotifier, IOTAModuleNotifier80, IOTAModuleNotifier90)
  public
    procedure LogMessage(const Text: string; const Args: array of const); overload;
    procedure LogMessage(const Text: string); overload;
  public
    { IOTAIDENotifier }

    { This procedure is called for many various file operations within the
      IDE }
    procedure FileNotification(NotifyCode: TOTAFileNotification;
      const FileName: string; var Cancel: Boolean);
    { This function is called immediately before the compiler is invoked.
      Set Cancel to True to cancel the compile }
    procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean); overload;
    { This procedure is called immediately following a compile.  Succeeded
      will be true if the compile was successful }
    procedure AfterCompile(Succeeded: Boolean); overload;

    { IOTAIDENotifier50 }

    { Same as BeforeCompile on IOTAIDENotifier except indicates if the compiler
      was invoked due to a CodeInsight compile }
    procedure BeforeCompile(const Project: IOTAProject; IsCodeInsight: Boolean;
      var Cancel: Boolean); overload;
    { Same as AfterCompile on IOTAIDENotifier except indicates if the compiler
      was invoked due to a CodeInsight compile }
    procedure AfterCompile(Succeeded: Boolean; IsCodeInsight: Boolean); overload;

    { IOTAIDENotifier80 }

    { Same as AfterCompile on IOTAIDENotifier except adds a project, like it
      should have done all along. }
    procedure AfterCompile(const Project: IOTAProject; Succeeded:
      Boolean; IsCodeInsight: Boolean); overload;
  public
    { IOTAModuleNotifier }

    { CheckOverwrite is called during a SaveAs operation to determine if any
      files associated with this module will overwrite any other files.
      Return True to allow the overwrite or no overwrite will occur }
    function CheckOverwrite: Boolean;
    { User has renamed the module }
    procedure ModuleRenamed(const NewName: string);

    {IOTAModuleNotifier80 }

    { AllowSave is called immediately prior to doing any type of save operation
      in order to allow any add-ins to enable/disable the saving of any specific
      module.  This is useful when one module is to be kept in sync with another
      module such as keeping the name of a module the same base name as the
      project. }
    function AllowSave: Boolean;
    { GetOverwriteFileNameCount returns the number of filenames to check for an
      overwrite during a save as operation.  This is simply a list of files that
      the IDE will check if they exist.  If any of these files exist, then the
      IDE will prompt for an overwrite and display the filename in the overwrite
      prompt dialog. }
    function GetOverwriteFileNameCount: Integer;
    { GetOverwriteFileName returns the index'd filename for the IDE to check for
      existence during a save as operation. }
    function GetOverwriteFileName(Index: Integer): string;
    { SetSaveFileName will be called with the fully qualified filename that the
      user entered in the Save As dialog.  This name can then be used to
      determine all the resulting names }
    procedure SetSaveFileName(const FileName: string);

    property OverwriteFileNameCount: Integer read GetOverwriteFileNameCount;
    property OverwriteFileNames[Index: Integer]: string read GetOverwriteFileName;

    { IOTAModuleNotifier90 }

    { BeforeRename is call just before the new file is save/renamed on disk.}
    procedure BeforeRename(const OldFileName, NewFileName: string);
    { AfterRename is call just after the new file is save/renamed on disk.}
    procedure AfterRename(const OldFileName, NewFileName: string);
  end;


implementation
uses
  System.SysUtils;

{ TVCSInfoView }

procedure TVCSInfoView.LogMessage(const Text: string; const Args: array of const);
begin
  LogMessage(Format(Text, Args));
end;

procedure TVCSInfoView.LogMessage(const Text: string);
const
  RFC3339: TFormatSettings = (DateSeparator: '-'; TimeSeparator: ':';
                              ShortDateFormat: 'yyyy-MM-dd'; LongDateFormat: 'yyyy-MM-dd';
                              ShortTimeFormat: 'hh:nn:ss'; LongTimeFormat: 'hh:nn:ss.zzz');
var
  Messages: IOTAMessageServices;
  Group: IOTAMessageGroup;
  TimeStamp, Line: string;
begin
  Messages := ToolsAPI.BorlandIDEServices as IOTAMessageServices;
  Group := Messages.GetGroup(Self.ClassName);
  if Group = nil then begin
    Group := Messages.AddMessageGroup(Self.ClassName);
    Group.CanClose := True;
    Group.AutoScroll := True;
  end;
  TimeStamp := DateTimeToStr(Now, RFC3339);
  for Line in Text.Replace(#13#10, #10).Split([#10, #13]) do begin
    Messages.AddTitleMessage(TimeStamp + #9 + Line, Group);
    if TimeStamp[1] <> #9 then
      TimeStamp := StringOfChar(#9, 2);
  end;
end {TVCSInfoView.LogMessage};

procedure TVCSInfoView.AfterCompile(Succeeded, IsCodeInsight: Boolean);
begin
end;

procedure TVCSInfoView.AfterCompile(const Project: IOTAProject; Succeeded, IsCodeInsight: Boolean);
begin
  if not IsCodeInsight then begin
    // TODO: update workdir status
  end;
end;

procedure TVCSInfoView.AfterCompile(Succeeded: Boolean);
begin
end;

procedure TVCSInfoView.AfterRename(const OldFileName, NewFileName: string);
begin
  // TODO: rename in VCS as well
  LogMessage('Renamed "%s" to "%s"', [OldFilename, NewFileName]);
end;

function TVCSInfoView.AllowSave: Boolean;
begin
  Result := True;
  // TODO: schedule to refresh the working dir in two seconds
  LogMessage('AllowSave: %d', [Ord(Result)]);
end;

procedure TVCSInfoView.BeforeCompile(const Project: IOTAProject; var Cancel: Boolean);
begin
end;

procedure TVCSInfoView.BeforeCompile(const Project: IOTAProject; IsCodeInsight: Boolean;
  var Cancel: Boolean);
begin
end;

procedure TVCSInfoView.BeforeRename(const OldFileName, NewFileName: string);
begin
end;

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

procedure TVCSInfoView.FileNotification(NotifyCode: TOTAFileNotification; const FileName: string;
  var Cancel: Boolean);
begin
  case NotifyCode of
    ofnFileOpened: begin
      // TODO: Reflect change in UI
      LogMessage('File opened: "%s"', [FileName]);
    end;
    ofnActiveProjectChanged: begin
      // TODO: Reflect change in UI (if necessary)
      LogMessage('Active project changed: "%s"', [FileName]);
    end;
  end;
end;

function TVCSInfoView.GetOverwriteFileName(Index: Integer): string;
begin
  Result := '';
end;

function TVCSInfoView.GetOverwriteFileNameCount: Integer;
begin
  Result := 0;
end;

procedure TVCSInfoView.ModuleRenamed(const NewName: string);
begin
end;

procedure TVCSInfoView.SetSaveFileName(const FileName: string);
begin
end;


end.

Changes to src/VCSInfoWzrd.pas.

1
2
3
4
5
6

7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48


49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
72
73
74
75
76
77
78

79
80
81
82
83
84
85
unit VCSInfoWzrd;

interface
uses
  Vcl.Graphics,
  ToolsAPI;


type
  TVCSInfoStatusWizard = class(TNotifierObject, IOTAWizard)
  private
    FLogo: TBitmap;

  public
    constructor Create;
    destructor Destroy; override;

    { IOTAWizard }
    function GetIDString: string;
    function GetName: string;
    function GetState: TWizardState;
    procedure Execute;
  end;

implementation



const
  scWizardID = 'net.2of4.VCSInfoStatusWizard';
resourcestring
  rsWizardName = 'VCS Info Wizard';

{ ------------------------------------------------------------------------------------------------ }
procedure Register;
begin
  RegisterPackageWizard(TVCSInfoStatusWizard.Create);
end;


{ TVCSInfoStatusWizard }

constructor TVCSInfoStatusWizard.Create;
begin
  FLogo := TBitmap.Create;
  FLogo.LoadFromResourceName(HInstance, 'BMP_LOGO');
  (BorlandIDEServices as IOTAAboutBoxServices).AddPluginInfo(rsWizardName, rsWizardName, FLogo.Handle,
                                                            False, 'Open source');
  SplashScreenServices.AddPluginBitmap(rsWizardName, FLogo.Handle,
                                        False, 'Open source');
  // TODO: set up cache (Model)
  // TODO: set up UI, including timer and notifiers (View)


  // TODO: set up thread queue (Controller)
end;

destructor TVCSInfoStatusWizard.Destroy;
begin
  // TODO: destroy all the objects we own
  FLogo.Free;

  inherited;
end;

procedure TVCSInfoStatusWizard.Execute;
begin
  // TODO: when will this be called?

end;

function TVCSInfoStatusWizard.GetIDString: string;
begin
  Result := scWizardID;
end;

................................................................................
  Result := rsWizardName;
end;

function TVCSInfoStatusWizard.GetState: TWizardState;
begin
  Result := [wsEnabled];
end;




function InitializeWizard(const BorlandIDEServices: IBorlandIDEServices): IOTAWizard;
begin
  Result := TVCSInfoStatusWizard.Create;
end;





|
>





>












>
>







<
<
<
<
<
<







|

|


>
>







>






|







 







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34






35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
unit VCSInfoWzrd;

interface
uses
  Vcl.Graphics,
  ToolsAPI,
  VCSInfoView;

type
  TVCSInfoStatusWizard = class(TNotifierObject, IOTAWizard)
  private
    FLogo: TBitmap;
    FView: TVCSInfoView;
  public
    constructor Create;
    destructor Destroy; override;

    { IOTAWizard }
    function GetIDString: string;
    function GetName: string;
    function GetState: TWizardState;
    procedure Execute;
  end;

implementation
uses
  System.SysUtils;

const
  scWizardID = 'net.2of4.VCSInfoStatusWizard';
resourcestring
  rsWizardName = 'VCS Info Wizard';

{ ------------------------------------------------------------------------------------------------ }






{ TVCSInfoStatusWizard }

constructor TVCSInfoStatusWizard.Create;
begin
  FLogo := TBitmap.Create;
  FLogo.LoadFromResourceName(HInstance, 'BMP_LOGO');
  (BorlandIDEServices as IOTAAboutBoxServices).AddPluginInfo(rsWizardName, rsWizardName, FLogo.Handle,
                                                            False, 'Freeware');
  SplashScreenServices.AddPluginBitmap(rsWizardName, FLogo.Handle,
                                        False, 'Freeware');
  // TODO: set up cache (Model)
  // TODO: set up UI, including timer and notifiers (View)
  FView := TVCSInfoView.Create;
  (BorlandIDEServices as IOTAServices).AddNotifier(FView);
  // TODO: set up thread queue (Controller)
end;

destructor TVCSInfoStatusWizard.Destroy;
begin
  // TODO: destroy all the objects we own
  FLogo.Free;
  FView.Free;
  inherited;
end;

procedure TVCSInfoStatusWizard.Execute;
begin
  // TODO: when will this be called?
  FView.LogMessage('Execute');
end;

function TVCSInfoStatusWizard.GetIDString: string;
begin
  Result := scWizardID;
end;

................................................................................
  Result := rsWizardName;
end;

function TVCSInfoStatusWizard.GetState: TWizardState;
begin
  Result := [wsEnabled];
end;




function InitializeWizard(const BorlandIDEServices: IBorlandIDEServices): IOTAWizard;
begin
  Result := TVCSInfoStatusWizard.Create;
end;