@@ -6,14 +6,18 @@ interface
66uses
77 SysUtils, Windows,
88 NppPlugin, SciSupport,
9- NppSimpleObjects;
9+ NppSimpleObjects, L_VersionInfoW ;
1010
1111type
1212 TNppPluginHTMLTag = class (TNppPlugin)
1313 private
1414 FApp: TApplication;
15+ FVersionInfo: TFileVersionInfo;
16+ FVersionStr: nppString;
17+ function SupportsBigFiles : Boolean;
1518 public
1619 constructor Create;
20+ destructor Destroy; override;
1721 procedure commandFindMatchingTag ;
1822 procedure commandSelectTagContents ;
1923 procedure commandSelectTagContentsOnly ;
@@ -46,9 +50,9 @@ procedure _commandAbout(); cdecl;
4650implementation
4751
4852uses
49- DateUtils ,
53+ Strutils ,
5054 ShellAPI,
51- L_VersionInfoW, L_SpecialFolders,
55+ L_SpecialFolders,
5256 U_HTMLTagFinder, U_Entities, U_JSEncode;
5357
5458{ ------------------------------------------------------------------------------------------------ }
@@ -152,13 +156,51 @@ constructor TNppPluginHTMLTag.Create;
152156 self.AddFuncSeparator;
153157
154158 self.AddFuncItem(' &About...' , _commandAbout);
159+
160+ try
161+ FVersionInfo := TFileVersionInfo.Create(TSpecialFolders.DLLFullName);
162+ FVersionStr := ChangeFileExt(ExtractFileName(TSpecialFolders.DLLFullName), ' ' );
163+ FVersionStr :=
164+ Concat(FVersionStr,
165+ Format(' %d.%d.%d (%s bit)' ,
166+ [FVersionInfo.MajorVersion, FVersionInfo.MinorVersion, FVersionInfo.Revision,
167+ { $IFDEF CPUX64} ' 64' { $ELSE} ' 32' { $ENDIF} ]));
168+ except
169+ FreeAndNil(FVersionInfo);
170+ end ;
171+
172+ { $IFNDEF CPUX64}
173+ FVersionStr := ReplaceStr(FVersionStr, ' _unicode' , ' ' );
174+ { $ENDIF}
175+ end ;
176+
177+ { ------------------------------------------------------------------------------------------------ }
178+ destructor TNppPluginHTMLTag.Destroy;
179+ begin
180+ if Assigned(FVersionInfo) then
181+ FreeAndNil(FVersionInfo);
182+ inherited ;
155183end ;
156184
157185{ ------------------------------------------------------------------------------------------------ }
158186procedure TNppPluginHTMLTag.DoNppnToolbarModification ;
187+ var
188+ Msg: string;
159189begin
160190 inherited ;
161191 FApp := GetApplication(@Self.NppData);
192+
193+ { $IFDEF CPUX64}
194+ try
195+ if not SupportsBigFiles then begin
196+ Msg := ' The installed version of HTML Tag requires Notepad++ 8.3 or newer.' #13 #10
197+ + ' Running any plugin command will crash the application!' ;
198+ MessageBox(App.WindowHandle, PChar(Msg), PChar(FVersionStr), MB_ICONWARNING);
199+ end ;
200+ except
201+ HandleException(ExceptObject, ExceptAddr);
202+ end ;
203+ { $ENDIF}
162204end ;
163205
164206{ ------------------------------------------------------------------------------------------------ }
@@ -253,40 +295,50 @@ procedure TNppPluginHTMLTag.commandDecodeJS;
253295{ ------------------------------------------------------------------------------------------------ }
254296procedure TNppPluginHTMLTag.commandAbout ;
255297var
256- Version: TFileVersionInfo;
257298 Text, DLLName: string;
258299begin
259300 try
260301 DLLName := TSpecialFolders.DLLFullName;
261- Version := TFileVersionInfo.Create(DLLName);
262- try
263- Text := Format(' %s v%s %s' #10 #10
302+ if not Assigned(FVersionInfo) then begin
303+ FVersionInfo := TFileVersionInfo.Create(DLLName);
304+ end ;
305+
306+ Text := Format(' %s' #10 #10
264307 + ' Plug-in location: %s' #10
265308 + ' Config location: %s' #10
266309 + ' Bugs: %s' #10
267310 + ' Download: %s' #10 #10
268311 + #$00A9' 2011-2020 %s - %s' #10
269312 + ' a.k.a. %s - %s (v0.1 - v1.1)' #10
270- + #$00A9' 2022 Robert Di Pardo (v1.2 - )' #10 #10
313+ + #$00A9' 2022 Robert Di Pardo (since v1.2)' #10 #10
271314 + ' Licensed under the %s - %s' ,
272- [ExtractFileName(DLLName), Version.FileVersion,
273- { $IFDEF WIN64} ' (64-bits)' { $ELSE} ' (32-bits)' { $ENDIF} ,
274- ExtractFilePath(DLLName),
315+ [FVersionStr,
316+ ExtractFileDir(DLLName),
275317 App.ConfigFolder,
276- Version .Comments,
318+ FVersionInfo .Comments,
277319 ' https://bitbucket.org/rdipardo/htmltag/downloads' ,
278- Version .LegalCopyright, ' http://fossil.2of4.net/npp_htmltag' , // 'http://martijn.coppoolse.com/software',
320+ FVersionInfo .LegalCopyright, ' http://fossil.2of4.net/npp_htmltag' , // 'http://martijn.coppoolse.com/software',
279321 ' vor0nwe' , ' http://sourceforge.net/users/vor0nwe' ,
280322 ' MPL 1.1' , ' http://www.mozilla.org/MPL/1.1' ]);
281- MessageBox(App.WindowHandle, PChar(Text), PChar(Version.FileDescription), MB_ICONINFORMATION)
282- finally
283- FreeAndNil(Version);
284- end ;
323+ MessageBox(App.WindowHandle, PChar(Text), PChar(FVersionInfo.FileDescription), MB_ICONINFORMATION)
285324 except
286325 HandleException(ExceptObject, ExceptAddr);
287326 end ;
288327end { TNppPluginHTMLTag.commandAbout} ;
289328
329+ { ------------------------------------------------------------------------------------------------ }
330+ function TNppPluginHTMLTag.SupportsBigFiles : Boolean;
331+ var
332+ NppVerison: Cardinal;
333+ begin
334+ NppVerison := FApp.SendMessage(NPPM_GETNPPVERSION);
335+ Result :=
336+ (HIWORD(NppVerison) > 8 ) or
337+ ((HIWORD(NppVerison) = 8 ) and
338+ // 8.3 -> 8,3 (*not* 8,30)
339+ ((LOWORD(NppVerison) = 3 ) or (LOWORD(NppVerison) > 21 )));
340+ end { TNppPluginHTMLTag.SupportsBigFiles} ;
341+
290342
291343
292344
0 commit comments