Check-in [01f90f575c]
Not logged in

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

Overview
Comment:Merge and integrate win64 to trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 01f90f575c7328a3b68f95c3071e58f4d71856d3
User & Date: tinus 2019-03-16 09:40:17
References
2019-03-16
12:14 Fixed ticket [240f1abc07]: Would like a 64 bit version of this plug in plus 4 other changes artifact: 10feb91536 user: tinus
Context
2019-03-16
09:54
Bugfixes in publication batch script. check-in: 4df99df5ae user: tinus tags: trunk, src-1.3.2.0
09:40
Merge and integrate win64 to trunk. check-in: 01f90f575c user: tinus tags: trunk
09:36
Added batch-scripts to build or build and publish the plugin. Closed-Leaf check-in: 7dd2b5283a user: tinus tags: win64
2018-11-03
11:17
Updated link, apparently []() is not correct Markdown. check-in: 6dc33f10d6 user: tinus tags: trunk
Changes

Added build.cmd.

            1  +@Echo off
            2  +
            3  +pushd %~dp0
            4  +
            5  +:: prepare to build the DLLs
            6  +call rsvars.bat
            7  +
            8  +MSBuild /v:q /p:Config=Debug;Platform=Win32 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win32_Debug.txt
            9  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win32_Debug.txt && goto TheEnd
           10  +
           11  +MSBuild /v:q /p:Config=Debug;Platform=Win64 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win64_Debug.txt
           12  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win64_Debug.txt && goto TheEnd
           13  +
           14  +MSBuild /v:q /p:Config=Release;Platform=Win32 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win32.txt
           15  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win32.txt && goto TheEnd
           16  +
           17  +MSBuild /v:q /p:Config=Release;Platform=Win64 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win64.txt
           18  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win64.txt && goto TheEnd
           19  +
           20  +:TheEnd
           21  +popd

Added publish.cmd.

            1  +<!-- :: Begin batch script
            2  +@Echo off
            3  +
            4  +:: set code page to UTF-8
            5  +chcp 65001
            6  +
            7  +pushd %~dp0
            8  +
            9  +:: call the WSF script to extract the current version number from the .dproj file
           10  +CScript //nologo "%f0?.wsf" > set_version.cmd
           11  +call set_version.cmd
           12  +del set_version.cmd
           13  +
           14  +echo Preparing to build and release of version "%RELEASE_VERSION%".
           15  +echo Press Ctrl-C to abort publication;
           16  +pause
           17  +
           18  +:: prepare to build the DLLs
           19  +call rsvars.bat
           20  +
           21  +MSBuild /v:q /p:Config=Release;Platform=Win32 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win32.txt
           22  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win32.txt && goto TheEnd
           23  +
           24  +MSBuild /v:q /p:Config=Release;Platform=Win64 /t:build src\prj\PreviewHTML.dproj > out\PreviewHTML_Win64.txt
           25  +if errorlevel 1 echo Compilation errors, aborting... && start "" out\PreviewHTML_Win64.txt && goto TheEnd
           26  +
           27  +fossil commit --tag src-%RELEASE_VERSION% --allow-empty
           28  +
           29  +pushd %~dp0\out\Win32\Release
           30  +if not exist _FOSSIL_ echo goto NoPublicationRepo
           31  +move PreviewHTML.dll PreviewHTML32.dll
           32  +start /wait "Release notes" ReleaseNotes.txt
           33  +fossil commit --tag v%RELEASE_VERSION%-32 --tag v%RELEASE_VERSION%
           34  +popd
           35  +
           36  +pushd %~dp0\out\Win64\Release
           37  +if not exist _FOSSIL_ goto NoPublicationRepo
           38  +move PreviewHTML.dll PreviewHTML64.dll
           39  +start /wait "Release notes" ReleaseNotes.txt
           40  +fossil commit --tag v%RELEASE_VERSION%-64 --tag v%RELEASE_VERSION%
           41  +popd
           42  +
           43  +goto TheEnd
           44  +
           45  +:NoPublicationRepo
           46  +echo There is no publication repository rooted in "%CD%"!
           47  +popd
           48  +
           49  +:TheEnd
           50  +popd
           51  +exit /b
           52  +
           53  +
           54  +-- begin of wsf script -->
           55  +<package>
           56  +	<job>
           57  +		<script language="JScript">
           58  +			var xmlDoc = new ActiveXObject("MSXML2.DOMDocument.6");
           59  +			xmlDoc.Load("src\\prj\\PreviewHTML.dproj");
           60  +			xmlDoc.SetSelectionNamespaces('xmlns:b="http://schemas.microsoft.com/developer/msbuild/2003"');
           61  +			var xmlKeys = xmlDoc.SelectSingleNode("/b:Project/b:PropertyGroup/b:VerInfo_Keys");
           62  +			if (xmlKeys) {
           63  +				var keys = xmlKeys.text;
           64  +				var match = /FileVersion=((\d+\.)+\d+)/.match(keys);
           65  +				if (match) {
           66  +					WScript.Echo("set RELEASE_VERSION=" + match[1]);
           67  +				}
           68  +			}
           69  +		</script>
           70  +	</job>
           71  +</package>

Added src/Debug.pas.

            1  +unit Debug;
            2  +
            3  +interface
            4  +
            5  +procedure ODS(const DebugOutput: string); overload;
            6  +procedure ODS(const DebugOutput: string; const Args: array of const); overload;
            7  +
            8  +implementation
            9  +uses
           10  +  Classes, SysUtils,
           11  +  Windows,
           12  +  L_SpecialFolders;
           13  +
           14  +var
           15  +  OutputLog: TStreamWriter;
           16  +
           17  +{ ------------------------------------------------------------------------------------------------ }
           18  +procedure ODS(const DebugOutput: string); overload;
           19  +begin
           20  +  OutputDebugString(PChar('PreviewHTML['+IntToHex(GetCurrentThreadId, 4)+']: ' + DebugOutput));
           21  +  {$IFDEF DEBUG}
           22  +  if OutputLog = nil then begin
           23  +    OutputLog := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(TSpecialFolders.DLLFullName, '.log'), fmCreate or fmShareDenyWrite), TEncoding.UTF8);
           24  +    OutputLog.OwnStream;
           25  +    OutputLog.BaseStream.Seek(0, soFromEnd);
           26  +  end;
           27  +  OutputLog.Write(FormatDateTime('yyyy-MM-dd hh:nn:ss.zzz: ', Now));
           28  +  OutputLog.WriteLine(DebugOutput.Replace(#10, #10 + StringOfChar(' ', 25)));
           29  +  {$ENDIF}
           30  +end {ODS};
           31  +{ ------------------------------------------------------------------------------------------------ }
           32  +procedure ODS(const DebugOutput: string; const Args: array of const); overload;
           33  +begin
           34  +  ODS(Format(DebugOutput, Args));
           35  +end{ODS};
           36  +
           37  +
           38  +initialization
           39  +
           40  +finalization
           41  +  OutputLog.Free;
           42  +
           43  +end.

Changes to src/F_About.dfm.

     2      2     BorderIcons = []
     3      3     BorderStyle = bsSizeable
     4      4     Caption = 'About Preview HTML'
     5      5     ClientHeight = 256
     6      6     ParentFont = True
     7      7     Position = poDesigned
     8      8     OnCreate = FormCreate
            9  +  ExplicitHeight = 297
     9     10     PixelsPerInch = 96
    10         -  TextHeight = 13
           11  +  TextHeight = 14
    11     12     object lblBasedOn: TLabel
    12     13       Left = 8
    13     14       Top = 96
    14         -    Width = 152
    15         -    Height = 13
           15  +    Width = 175
           16  +    Height = 14
    16     17       Caption = 'Based on the example plugin by'
    17     18     end
    18     19     object lblPlugin: TLabel
    19     20       Left = 8
    20     21       Top = 8
    21         -    Width = 175
    22         -    Height = 13
           22  +    Width = 200
           23  +    Height = 14
    23     24       Caption = 'HTML Preview plugin for Notepad++'
    24     25       ShowAccelChar = False
    25     26     end
    26     27     object lblVersion: TLabel
    27     28       Left = 189
    28     29       Top = 8
    29         -    Width = 42
    30         -    Height = 13
           30  +    Width = 46
           31  +    Height = 14
    31     32       Caption = 'v0.0.0.0'
    32     33     end
    33     34     object lblAuthor: TLinkLabel
    34     35       Left = 8
    35     36       Top = 27
    36         -    Width = 223
    37         -    Height = 17
           37  +    Width = 248
           38  +    Height = 18
    38     39       Caption = 
    39     40         'by Martijn Coppoolse, <a href="mailto:vor0nwe@users.sf.net">vor0' +
    40     41         'nwe@users.sf.net</a>'
    41     42       TabOrder = 1
    42     43       OnLinkClick = lblLinkClick
    43     44     end
    44     45     object lblTribute: TLinkLabel
    45     46       Left = 8
    46     47       Top = 115
    47         -    Width = 203
    48         -    Height = 17
           48  +    Width = 227
           49  +    Height = 18
    49     50       Caption = 
    50     51         'Damjan Zobo Cvetko, <a href="mailto:zobo@users.sf.net">zobo@user' +
    51     52         's.sf.net</a>'
    52     53       TabOrder = 3
    53     54       OnLinkClick = lblLinkClick
    54     55     end
    55     56     object btnOK: TButton
................................................................................
    63     64       Default = True
    64     65       ModalResult = 1
    65     66       TabOrder = 0
    66     67     end
    67     68     object lblURL: TLinkLabel
    68     69       Left = 8
    69     70       Top = 46
    70         -    Width = 172
    71         -    Height = 17
           71  +    Width = 200
           72  +    Height = 18
    72     73       Cursor = crHandPoint
    73     74       Caption = 
    74         -      '<a href="http://fossil.2of4.net/npp_preview">http://fossil.2of4.' +
    75         -      'net/npp_preview</a>'
           75  +      '<a href="https://fossil.2of4.net/npp_preview">https://fossil.2of' +
           76  +      '4.net/npp_preview</a>'
    76     77       TabOrder = 2
    77     78       OnLinkClick = lblLinkClick
    78     79     end
    79     80     object lblIEVersion: TLinkLabel
    80     81       Left = 8
    81     82       Top = 160
    82         -    Width = 200
    83         -    Height = 17
           83  +    Width = 223
           84  +    Height = 18
    84     85       Caption = 'Internet Explorer version %s is installed.'
    85     86       TabOrder = 4
    86     87     end
    87     88   end

Changes to src/F_PreviewHTML.dfm.

     5      5     ClientWidth = 504
     6      6     ParentFont = True
     7      7     OnCreate = FormCreate
     8      8     OnDestroy = FormDestroy
     9      9     OnHide = FormHide
    10     10     OnKeyPress = FormKeyPress
    11     11     OnShow = FormShow
           12  +  ExplicitWidth = 520
           13  +  ExplicitHeight = 461
    12     14     PixelsPerInch = 96
    13         -  TextHeight = 13
           15  +  TextHeight = 14
    14     16     object pnlButtons: TPanel
    15     17       Left = 0
    16     18       Top = 379
    17     19       Width = 504
    18     20       Height = 41
    19     21       Align = alBottom
    20     22       BevelOuter = bvNone
................................................................................
   101    103           TabOrder = 0
   102    104           OnStatusTextChange = wbIEStatusTextChange
   103    105           OnTitleChange = wbIETitleChange
   104    106           OnBeforeNavigate2 = wbIEBeforeNavigate2
   105    107           OnDocumentComplete = wbIEDocumentComplete
   106    108           OnStatusBar = wbIEStatusBar
   107    109           OnNewWindow3 = wbIENewWindow3
          110  +        ExplicitWidth = 557
          111  +        ExplicitHeight = 418
   108    112           ControlData = {
   109         -          4C000000173400002C2700000000000000000000000000000000000000000000
          113  +          4C0000002D2F00007A2300000000000000000000000000000000000000000000
   110    114             000000004C000000000000000000000001000000E0D057007335CF11AE690800
   111    115             2B2E12620B000000000000004C0000000114020000000000C000000000000046
   112    116             8000000000000000000000000000000000000000000000000000000000000000
   113    117             00000000000000000100000000000000000000000000000000000000}
   114    118         end
   115    119       end
   116    120     end

Changes to src/F_PreviewHTML.pas.

    66     66       procedure ForgetBuffer(const BufferID: TBufferID);
    67     67       procedure DisplayPreview(HTML: string; const BufferID: TBufferID);
    68     68     end;
    69     69   
    70     70   var
    71     71     frmHTMLPreview: TfrmHTMLPreview;
    72     72   
    73         -procedure ODS(const DebugOutput: string); overload;
    74         -procedure ODS(const DebugOutput: string; const Args: array of const); overload;
    75         -
    76     73   ////////////////////////////////////////////////////////////////////////////////////////////////////
    77     74   implementation
    78     75   uses
    79     76     ShellAPI, ComObj, StrUtils, IOUtils, Masks, MSHTML,
    80     77     RegExpr, L_SpecialFolders,
           78  +  Debug,
    81     79     WebBrowser, SciSupport, U_Npp_PreviewHTML;
    82     80   
    83     81   {$R *.dfm}
    84         -
    85         -var
    86         -  OutputLog: TStreamWriter;
    87         -
    88         -{ ------------------------------------------------------------------------------------------------ }
    89         -procedure ODS(const DebugOutput: string); overload;
    90         -begin
    91         -  OutputDebugString(PChar('PreviewHTML['+IntToHex(GetCurrentThreadId, 4)+']: ' + DebugOutput));
    92         -  if OutputLog = nil then begin
    93         -    OutputLog := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(TSpecialFolders.DLLFullName, '.log'), fmCreate or fmShareDenyWrite), TEncoding.UTF8);
    94         -    OutputLog.OwnStream;
    95         -    OutputLog.BaseStream.Seek(0, soFromEnd);
    96         -  end;
    97         -  OutputLog.Write(FormatDateTime('yyyy-MM-dd hh:nn:ss.zzz: ', Now));
    98         -  OutputLog.WriteLine(DebugOutput);
    99         -end {ODS};
   100         -{ ------------------------------------------------------------------------------------------------ }
   101         -procedure ODS(const DebugOutput: string; const Args: array of const); overload;
   102         -begin
   103         -  ODS(Format(DebugOutput, Args));
   104         -end{ODS};
   105         -
   106     82   
   107     83   { ================================================================================================ }
   108     84   
   109     85   { ------------------------------------------------------------------------------------------------ }
   110     86   procedure TfrmHTMLPreview.FormCreate(Sender: TObject);
   111     87   begin
   112     88     FScrollPositions := TDictionary<TBufferID,TPoint>.Create;
................................................................................
   180    156   
   181    157       Screen.Cursor := crHourGlass;
   182    158       try
   183    159         {--- MCO 22-01-2013: determine whether the current document matches a custom filter ---}
   184    160         FilterName := DetermineCustomFilter;
   185    161         IsCustom := Length(FilterName) > 0;
   186    162   
   187         -      {$MESSAGE HINT 'TODO: Find a way to communicate why there is no preview, depending on the situation  MCO 22-01-2013'}
          163  +      {$MESSAGE HINT 'TODO: Find a way to communicate why there is no preview, depending on the situation — MCO 22-01-2013'}
   188    164   
   189    165         if IsXML or IsHTML or IsCustom then begin
   190    166           CodePage := SendMessage(hScintilla, SCI_GETCODEPAGE, 0, 0);
   191    167           Size := SendMessage(hScintilla, SCI_GETTEXT, 0, 0);
   192    168           SetLength(Content, Size);
   193    169           SendMessage(hScintilla, SCI_GETTEXT, Size, LPARAM(PAnsiChar(Content)));
   194    170           if CodePage = CP_ACP then begin
................................................................................
   437    413               if SameText(Language, DocLanguage) then begin
   438    414                 Match := True;
   439    415               end;
   440    416             end;
   441    417           end;
   442    418         end;
   443    419   
   444         -      {$MESSAGE HINT 'TODO: Test lexer  MCO 22-01-2013'}
          420  +      {$MESSAGE HINT 'TODO: Test lexer — MCO 22-01-2013'}
   445    421   
   446    422         if Match then
   447    423           Exit(Names[i]);
   448    424       end;
   449    425     finally
   450    426       Names.Free;
   451    427       Filters.Free;
................................................................................
   717    693   procedure TfrmHTMLPreview.wbIETitleChange(ASender: TObject; const Text: WideString);
   718    694   begin
   719    695     inherited;
   720    696     self.UpdateDisplayInfo(StringReplace(Text, 'about:blank', '', [rfReplaceAll]));
   721    697   end;
   722    698   
   723    699   
   724         -initialization
   725         -
   726         -finalization
   727         -  OutputLog.Free;
   728         -
   729    700   end.

Changes to src/U_CustomFilter.pas.

    34     34   
    35     35   ////////////////////////////////////////////////////////////////////////////////////////////////////
    36     36   implementation
    37     37   
    38     38   uses
    39     39     IOUtils,
    40     40     process, Pipes,
           41  +  Debug,
    41     42     F_PreviewHTML;
    42     43   
    43     44   { TCustomFilterThread }
    44     45   
    45     46   { ------------------------------------------------------------------------------------------------ }
    46     47   constructor TCustomFilterThread.Create(const Data: TFilterData);
    47     48   begin
................................................................................
    93     94       end;
    94     95       if Pos('%2', Command) > 0 then begin
    95     96         OutputMethod := cotOutputFile;
    96     97       end else begin
    97     98         OutputMethod := cotStandardOutput;
    98     99       end;
    99    100   
   100         -    {$MESSAGE HINT 'TODO: allow for explicit overrides in the filter settings  Martijn 2013-01-26'}
          101  +    {$MESSAGE HINT 'TODO: allow for explicit overrides in the filter settings — Martijn 2013-01-26'}
   101    102   
   102    103       if Terminated then
   103    104         Exit;
   104    105   
   105    106       {--- Now we figure out what in- and output files we will need ---}
   106    107       if InputMethod = citStandardInput then begin
   107    108         InFile := '';
   108    109         Input := TStringStream.Create(FData.Contents, FData.Encoding, False);
   109    110         if OutputMethod = cotInputFile then begin
   110    111           OutputMethod := cotStandardOutput;
   111         -        {$MESSAGE HINT 'TODO: warn the user that this filter is misconfigured  Martijn 2013-01-26'}
          112  +        {$MESSAGE HINT 'TODO: warn the user that this filter is misconfigured — Martijn 2013-01-26'}
   112    113         end;
   113    114         if OutputMethod = cotOutputFile then
   114    115           OutFile := TPath.GetTempFileName
   115    116         else
   116    117           OutFile := '';
   117    118       end else begin // ContentInput = citFile
   118    119         Input := nil;

Changes to src/U_Npp_PreviewHTML.pas.

    17     17   
    18     18       procedure SetInfo(NppData: TNppData); override;
    19     19   
    20     20       procedure CommandShowPreview;
    21     21       procedure CommandSetIEVersion(const BrowserEmulation: Integer);
    22     22       procedure CommandOpenFile(const Filename: nppString);
    23     23       procedure CommandShowAbout;
    24         -    procedure CommandReplaceHelloWorld;
    25     24   
    26     25       procedure DoNppnToolbarModification; override;
    27         -    procedure DoNppnFileClosed(const BufferID: Cardinal); override;
    28         -    procedure DoNppnBufferActivated(const BufferID: Cardinal); override;
           26  +    procedure DoNppnFileClosed(const BufferID: THandle); override;
           27  +    procedure DoNppnBufferActivated(const BufferID: THandle); override;
    29     28       procedure DoModified(const hwnd: HWND; const modificationType: Integer); override;
    30     29   
    31     30       function  GetSettings(const Name: string = 'Settings.ini'): TIniFile;
    32     31     end {TNppPluginPreviewHTML};
    33     32   
    34         -procedure _FuncReplaceHelloWorld; cdecl;
    35     33   procedure _FuncShowPreview; cdecl;
    36     34   procedure _FuncOpenSettings; cdecl;
    37     35   procedure _FuncOpenFilters; cdecl;
    38     36   procedure _FuncShowAbout; cdecl;
    39     37   
    40     38   procedure _FuncSetIE7; cdecl;
    41     39   procedure _FuncSetIE8; cdecl;
................................................................................
    48     46   
    49     47   var
    50     48     Npp: TNppPluginPreviewHTML;
    51     49   
    52     50   ////////////////////////////////////////////////////////////////////////////////////////////////////
    53     51   implementation
    54     52   uses
    55         -  WebBrowser, Registry;
           53  +  WebBrowser, Registry,
           54  +  Debug;
    56     55   
    57         -{ ------------------------------------------------------------------------------------------------ }
    58         -procedure _FuncReplaceHelloWorld; cdecl;
    59         -begin
    60         -  Npp.CommandReplaceHelloWorld;
    61         -end;
    62     56   { ------------------------------------------------------------------------------------------------ }
    63     57   procedure _FuncOpenSettings; cdecl;
    64     58   begin
    65     59     Npp.CommandOpenFile('Settings.ini');
    66     60   end;
    67     61   { ------------------------------------------------------------------------------------------------ }
    68     62   procedure _FuncOpenFilters; cdecl;
................................................................................
   119    113   { ================================================================================================ }
   120    114   { TNppPluginPreviewHTML }
   121    115   
   122    116   { ------------------------------------------------------------------------------------------------ }
   123    117   constructor TNppPluginPreviewHTML.Create;
   124    118   begin
   125    119     inherited;
   126         -  self.PluginName := '&Preview HTML';
          120  +  self.PluginName := '&Preview HTML'{$IFDEF DEBUG}+' (debug)'{$ENDIF};
   127    121   end {TNppPluginPreviewHTML.Create};
   128    122   
   129    123   { ------------------------------------------------------------------------------------------------ }
   130    124   procedure TNppPluginPreviewHTML.SetInfo(NppData: TNppData);
   131    125   var
   132    126     IEVersion: string;
   133    127     MajorIEVersion, Code, EmulatedVersion: Integer;
................................................................................
   178    172     self.AddFuncItem('&About', _FuncShowAbout);
   179    173   end {TNppPluginPreviewHTML.SetInfo};
   180    174   
   181    175   { ------------------------------------------------------------------------------------------------ }
   182    176   procedure TNppPluginPreviewHTML.CommandOpenFile(const Filename: nppString);
   183    177   var
   184    178     FullPath: nppString;
          179  +  ConfigSample, DllSample: nppString;
   185    180   begin
   186    181     try
   187    182       FullPath := Npp.ConfigDir + '\PreviewHTML\' + Filename;
   188         -    if not FileExists(FullPath) and FileExists(ChangeFileExt(FullPath, '.sample' + ExtractFileExt(FullPath))) then
   189         -      FullPath := ChangeFileExt(FullPath, '.sample' + ExtractFileExt(FullPath));
          183  +    if not FileExists(FullPath) then begin
          184  +      ConfigSample := ChangeFileExt(FullPath, '.sample' + ExtractFileExt(FullPath));
          185  +      DllSample := ChangeFilePath(ConfigSample, ExtractFileDir(FullFileName));
          186  +      if not FileExists(ConfigSample) and FileExists(DllSample) then
          187  +        Win32Check(CopyFile(PChar(string(DllSample)), PChar(string(ConfigSample)), True));
          188  +      if FileExists(ConfigSample) then
          189  +        FullPath := ConfigSample;
          190  +    end;
   190    191       if not DoOpen(FullPath) then
   191    192         MessageBox(Npp.NppData.NppHandle, PChar(Format('Unable to open "%s".', [FullPath])), PChar(Caption), MB_ICONWARNING);
   192    193     except
   193    194       ShowException(ExceptObject, ExceptAddr);
   194    195     end;
   195    196   end {TNppPluginPreviewHTML.CommandOpenFilters};
   196    197   
   197         -{ ------------------------------------------------------------------------------------------------ }
   198         -procedure TNppPluginPreviewHTML.CommandReplaceHelloWorld;
   199         -var
   200         -  s: UTF8String;
   201         -begin
   202         -  s := 'Hello World';
   203         -  SendMessage(self.NppData.ScintillaMainHandle, SCI_REPLACESEL, 0, LPARAM(PAnsiChar(s)));
   204         -end {TNppPluginPreviewHTML.CommandReplaceHelloWorld};
   205         -
   206    198   { ------------------------------------------------------------------------------------------------ }
   207    199   procedure TNppPluginPreviewHTML.CommandSetIEVersion(const BrowserEmulation: Integer);
   208    200   begin
   209    201     if GetBrowserEmulation <> BrowserEmulation then begin
   210    202       SetBrowserEmulation(BrowserEmulation);
   211    203       MessageBox(Npp.NppData.NppHandle,
   212    204                   PChar(Format('The preview browser mode has been set to correspond to Internet Explorer version %d.'#13#10#13#10 +
................................................................................
   268    260     SendMessage(self.NppData.NppHandle, NPPM_ADDTOOLBARICON, WPARAM(self.CmdIdFromDlgId(0)), LPARAM(@tb));
   269    261   
   270    262   //  SendMessage(self.NppData.ScintillaMainHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0);
   271    263   //  SendMessage(self.NppData.ScintillaSecondHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0);
   272    264   end {TNppPluginPreviewHTML.DoNppnToolbarModification};
   273    265   
   274    266   { ------------------------------------------------------------------------------------------------ }
   275         -procedure TNppPluginPreviewHTML.DoNppnBufferActivated(const BufferID: Cardinal);
          267  +procedure TNppPluginPreviewHTML.DoNppnBufferActivated(const BufferID: THandle);
   276    268   begin
   277    269     inherited;
   278    270     if Assigned(frmHTMLPreview) and frmHTMLPreview.Visible then begin
   279    271       frmHTMLPreview.btnRefresh.Click;
   280    272     end;
   281    273   end {TNppPluginPreviewHTML.DoNppnBufferActivated};
   282    274   
   283    275   { ------------------------------------------------------------------------------------------------ }
   284         -procedure TNppPluginPreviewHTML.DoNppnFileClosed(const BufferID: Cardinal);
          276  +procedure TNppPluginPreviewHTML.DoNppnFileClosed(const BufferID: THandle);
   285    277   begin
   286    278     if Assigned(frmHTMLPreview) then begin
   287    279       frmHTMLPreview.ForgetBuffer(BufferID);
   288    280     end;
   289    281     inherited;
   290    282   end {TNppPluginPreviewHTML.DoNppnFileClosed};
   291    283   

Changes to src/common/L_VersionInfoW.pas.

     5      5   uses
     6      6     Windows, SysUtils;
     7      7   
     8      8   type
     9      9     TFileVersionInfo = class
    10     10     private
    11     11       { Private declarations }
    12         -    FFilename         : WideString;
           12  +    FFilename         : string;
    13     13       FHasVersionInfo   : boolean;
    14     14   
    15         -    FCompanyName      : WideString;
    16         -    FFileDescription  : WideString;
    17         -    FFileVersion      : WideString;
    18         -    FInternalname     : WideString;
    19         -    FLegalCopyright   : WideString;
    20         -    FLegalTradeMarks  : WideString;
    21         -    FOriginalFilename : WideString;
    22         -    FProductName      : WideString;
    23         -    FProductVersion   : WideString;
    24         -    FComments         : WideString;
           15  +    FCompanyName      : string;
           16  +    FFileDescription  : string;
           17  +    FFileVersion      : string;
           18  +    FInternalname     : string;
           19  +    FLegalCopyright   : string;
           20  +    FLegalTradeMarks  : string;
           21  +    FOriginalFilename : string;
           22  +    FProductName      : string;
           23  +    FProductVersion   : string;
           24  +    FComments         : string;
    25     25       FMajorVersion     : Word;
    26     26       FMinorVersion     : Word;
    27         -    FRevision          : Word;
           27  +    FRevision         : Word;
    28     28       FBuild            : Word;
           29  +    FFlags            : Word;
           30  +    FFileDateTime     : TDateTime;
    29     31   
    30         -    procedure SetFileName(AFileName: WideString);
           32  +    procedure SetFileName(const AFileName: string);
           33  +    function  HasFlag(const Index: integer): boolean;
    31     34     protected
    32     35       { Protected declarations }
    33     36     public
    34     37       { Public declarations }
    35         -    constructor Create(AFileName: WideString);
           38  +    constructor Create(const AFileName: string);
    36     39       destructor  Destroy; override;
    37     40   
    38         -    property FileName         : WideString read FFileName           write SetFileName;
           41  +    property FileName         : string    read FFileName           write SetFileName;
    39     42     public
    40     43       { Published declarations }
    41         -    property CompanyName      : WideString  read FCompanyName;
    42         -    property FileDescription  : WideString  read FFileDescription;
    43         -    property FileVersion      : WideString  read FFileVersion;
    44         -    property Internalname     : WideString  read FInternalname;
    45         -    property LegalCopyright   : WideString  read FLegalCopyright;
    46         -    property LegalTradeMarks  : WideString  read FLegalTradeMarks;
    47         -    property OriginalFilename : WideString  read FOriginalFilename;
    48         -    property ProductName      : WideString  read FProductName;
    49         -    property ProductVersion   : WideString  read FProductVersion;
    50         -    property Comments         : WideString  read FComments;
    51         -    property MajorVersion     : Word        read FMajorVersion;
    52         -    property MinorVersion     : Word        read FMinorVersion;
    53         -    property Revision         : Word        read FRevision;
    54         -    property Build            : Word        read FBuild;
           44  +    property CompanyName      : string    read FCompanyName;
           45  +    property FileDescription  : string    read FFileDescription;
           46  +    property FileVersion      : string    read FFileVersion;
           47  +    property Internalname     : string    read FInternalname;
           48  +    property LegalCopyright   : string    read FLegalCopyright;
           49  +    property LegalTradeMarks  : string    read FLegalTradeMarks;
           50  +    property OriginalFilename : string    read FOriginalFilename;
           51  +    property ProductName      : string    read FProductName;
           52  +    property ProductVersion   : string    read FProductVersion;
           53  +    property Comments         : string    read FComments;
           54  +    property MajorVersion     : Word      read FMajorVersion;
           55  +    property MinorVersion     : Word      read FMinorVersion;
           56  +    property Revision         : Word      read FRevision;
           57  +    property Build            : Word      read FBuild;
           58  +    property Flags            : Word      read FFlags;
           59  +    property IsDebug          : boolean   index VS_FF_DEBUG         read HasFlag;
           60  +    property IsPreRelease     : boolean   index VS_FF_PRERELEASE    read HasFlag;
           61  +    property IsPatched        : boolean   index VS_FF_PATCHED       read HasFlag;
           62  +    property IsPrivateBuild   : boolean   index VS_FF_PRIVATEBUILD  read HasFlag;
           63  +    property IsInfoInferred   : boolean   index VS_FF_INFOINFERRED  read HasFlag;
           64  +    property IsSpecialBuild   : boolean   index VS_FF_SPECIALBUILD  read HasFlag;
           65  +    property FileDateTime     : TDateTime read FFileDateTime;
    55     66     end;
    56     67   
    57     68   implementation
    58     69   
    59     70   type
    60     71     TLangAndCP = record
    61     72       wLanguage : word;
    62     73       wCodePage : word;
    63     74     end;
    64     75     PLangAndCP = ^TLangAndCP;
    65     76   
    66         -constructor TFileVersionInfo.Create(AFileName: WideString);
           77  +constructor TFileVersionInfo.Create(const AFileName: string);
    67     78   begin
    68     79     inherited Create;
    69     80     SetFileName(AFileName);
    70     81   end;
    71     82   
    72     83   destructor TFileVersionInfo.Destroy;
    73     84   begin
    74     85     inherited Destroy;
    75     86   end;
    76     87   
    77         -procedure TFileVersionInfo.SetFileName(AFileName: WideString);
           88  +procedure TFileVersionInfo.SetFileName(const AFileName: string);
    78     89   var
    79         -  Dummy     : cardinal;
    80         -  BufferSize: integer;
           90  +  Dummy     : UINT;
           91  +  BufferSize: DWORD;
    81     92     Buffer    : Pointer;
    82         -  Lang      : PLangAndCP;
    83         -  SubBlock  : WideString;
    84         -  InfoBlock : VS_FIXEDFILEINFO;
    85         -  InfoPtr   : Pointer;
    86         -  function QueryValue(AName: WideString): WideString;
           93  +  PLang     : PLangAndCP;
           94  +  SubBlock  : string;
           95  +  SysTime: TSystemTime;
           96  +  { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
           97  +  function QueryValue(const AName: string): string;
    87     98     var
    88         -    Value   : PWChar;
           99  +    Value   : PChar;
    89    100     begin
    90         -    SubBlock := WideFormat('\\StringFileInfo\\%.4x%.4x\\%s', [Lang.wLanguage, Lang.wCodePage, AName]);
    91         -    VerQueryValueW(Buffer, PWChar(SubBlock), Pointer(Value), Dummy);
    92         -    Result := WideString(Value);
          101  +    SubBlock := WideFormat('\\StringFileInfo\\%.4x%.4x\\%s', [PLang.wLanguage, PLang.wCodePage, AName]);
          102  +    if VerQueryValue(Buffer, PChar(SubBlock), Pointer(Value), Dummy) then
          103  +      Result := string(Value)
          104  +    else
          105  +      Result := '';
    93    106     end;
          107  +  { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
          108  +var
          109  +  PInfoBlock : PVSFixedFileInfo;
          110  +  FileTime   : TFileTime;
    94    111   begin
    95    112     FFilename := AFileName;
    96    113   
    97         -  BufferSize := GetFileVersionInfoSizeW(PWChar(AFileName), Dummy);
          114  +  BufferSize := GetFileVersionInfoSize(PChar(AFileName), Dummy);
    98    115     FHasVersionInfo := (Buffersize > 0);
    99         -  if BufferSize > 0 then begin
          116  +  if FHasVersionInfo then begin
   100    117       Buffer := AllocMem(BufferSize);
   101    118       try
   102         -      GetFileVersionInfoW(PWChar(AFileName),0,BufferSize,Buffer);
          119  +      GetFileVersionInfo(PChar(AFileName), Dummy, BufferSize, Buffer);
   103    120   
   104    121         SubBlock := '\\VarFileInfo\\Translation';
   105         -      VerQueryValueW(Buffer, PWChar(SubBlock), Pointer(Lang), Dummy);
          122  +      VerQueryValue(Buffer, PChar(SubBlock), Pointer(PLang), Dummy);
   106    123   
   107    124         FCompanyName      := QueryValue('CompanyName');
   108    125         FFileDescription  := QueryValue('FileDescription');
   109    126         FFileVersion      := QueryValue('FileVersion');
   110    127         FInternalName     := QueryValue('InternalName');
   111    128         FLegalCopyright   := QueryValue('LegalCopyright');
   112    129         FLegalTradeMarks  := QueryValue('LegalTradeMarks');
   113    130         FOriginalFilename := QueryValue('OriginalFilename');
   114    131         FProductName      := QueryValue('ProductName');
   115    132         FProductVersion   := QueryValue('ProductVersion');
   116    133         FComments         := QueryValue('Comments');
   117    134   
   118         -      VerQueryValue(Buffer, '\', InfoPtr, Dummy);
   119         -      Move(InfoPtr^, InfoBlock, SizeOf(VS_FIXEDFILEINFO));
   120         -      FMajorVersion := InfoBlock.dwFileVersionMS shr 16;
   121         -      FMinorVersion := InfoBlock.dwFileVersionMS and 65535;
   122         -      FRevision     := InfoBlock.dwFileVersionLS shr 16;
   123         -      FBuild        := InfoBlock.dwFileVersionLS and 65535;
          135  +      VerQueryValue(Buffer, '\', Pointer(PInfoBlock), Dummy);
          136  +      FMajorVersion := PInfoBlock.dwFileVersionMS shr 16;
          137  +      FMinorVersion := PInfoBlock.dwFileVersionMS and 65535;
          138  +      FRevision     := PInfoBlock.dwFileVersionLS shr 16;
          139  +      FBuild        := PInfoBlock.dwFileVersionLS and 65535;
          140  +      FFlags        := PInfoBlock.dwFileFlags and PInfoBlock.dwFileFlagsMask;
          141  +
          142  +      FileTime.dwLowDateTime  := PInfoBlock.dwFileDateLS;
          143  +      FileTime.dwHighDateTime := PInfoBlock.dwFileDateMS;
          144  +      if FileTimeToLocalFileTime(FileTime, FileTime) and FileTimeToSystemTime(FileTime, SysTime) and (SysTime.wYear > 1601) then
          145  +        FFileDateTime := SystemTimeToDateTime(SysTime);
   124    146       finally
   125         -      FreeMem(Buffer,BufferSize);
          147  +      FreeMem(Buffer, BufferSize);
   126    148       end;
   127         -  end
   128         -  else begin
          149  +  end else begin
   129    150       FCompanyname      := '';
   130    151       FFileDescription  := '';
   131    152       FFileVersion      := '';
   132    153       FInternalname     := '';
   133    154       FLegalCopyright   := '';
   134    155       FLegalTradeMarks  := '';
   135    156       FOriginalFilename := '';
................................................................................
   138    159       FComments         := '';
   139    160       FMajorVersion     := 0;
   140    161       FMinorVersion     := 0;
   141    162       FRevision         := 0;
   142    163       FBuild            := 0;
   143    164     end;
   144    165   end;
          166  +
          167  +function TFileVersionInfo.HasFlag(const Index: integer): boolean;
          168  +begin
          169  +  Result := (FFlags and Index) <> 0;
          170  +end;
   145    171   
   146    172   
   147    173   end.
   148    174   

Changes to src/lib/NppDockingForms.pas.

   123    123   {var
   124    124     r:Integer;}
   125    125   
   126    126   begin
   127    127     self.HandleNeeded;
   128    128     //self.Visible := true;
   129    129   
   130         -  FillChar(self.ToolbarData,sizeof(TToolbarData),0);
          130  +  self.ToolbarData := Default(TToolbarData);
   131    131   
   132    132     if (not self.Icon.Empty) then
   133    133     begin
   134    134       self.ToolbarData.IconTab := self.Icon.Handle;
   135    135       self.ToolbarData.Mask := self.ToolbarData.Mask or DWS_ICONTAB;
   136    136     end;
   137    137   
................................................................................
   147    147     GetMem(self.ToolbarData.AdditionalInfo, 1000*sizeof(nppPChar));
   148    148   
   149    149   {$IFDEF NPPUNICODE}
   150    150     StringToWideChar(self.Caption, self.ToolbarData.Title, 500);
   151    151     GetModuleFileNameW(HInstance, self.ToolbarData.ModuleName, 1000);
   152    152     StringToWideChar(ExtractFileName(self.ToolbarData.ModuleName), self.ToolbarData.ModuleName, 1000);
   153    153     StringToWideChar('', self.ToolbarData.AdditionalInfo, 1);
   154         -  {r:=}SendMessageW(self.Npp.NppData.NppHandle, NPPM_DMMREGASDCKDLG, 0, Integer(@self.ToolbarData));
          154  +  {r:=}SendMessageW(self.Npp.NppData.NppHandle, NPPM_DMMREGASDCKDLG, 0, LPARAM(@self.ToolbarData));
   155    155   {$ELSE}
   156    156     StrCopy(self.ToolbarData.Title, PChar(self.Caption));
   157    157     GetModuleFileNameA(HInstance, self.ToolbarData.ModuleName, 1000);
   158    158     StrLCopy(self.ToolbarData.ModuleName, PChar(ExtractFileName(self.ToolbarData.ModuleName)), 1000);
   159    159     StrCopy(self.ToolbarData.AdditionalInfo, PChar(''));
   160    160     {r:=}
   161         -  SendMessageA(self.Npp.NppData.NppHandle, NPPM_DMMREGASDCKDLG, 0, Integer(@self.ToolbarData));
          161  +  SendMessageA(self.Npp.NppData.NppHandle, NPPM_DMMREGASDCKDLG, 0, LPARAM(@self.ToolbarData));
   162    162   {$ENDIF}
   163    163   
   164    164     self.Visible := true;
   165    165   end;
   166    166   
   167    167   procedure TNppDockingForm.Show;
   168    168   begin

Changes to src/lib/NppPluginInclude.pas.

     1      1   procedure DLLEntryPoint(dwReason: DWord);
     2      2   begin
     3      3     case dwReason of
     4      4     DLL_PROCESS_ATTACH:
     5      5     begin
     6      6       // create the main object
     7         -    //Npp := TDbgpNppPlugin.Create;
            7  +//    Npp := TDbgpNppPlugin.Create;
     8      8     end;
     9      9     DLL_PROCESS_DETACH:
    10     10     begin
    11     11       try
    12     12         if Assigned(Npp) then
    13     13           Npp.Free;
    14     14       except
................................................................................
    46     46   
    47     47   procedure beNotified(sn: PSCNotification); cdecl; export;
    48     48   begin
    49     49     if Assigned(Npp) then
    50     50       Npp.BeNotified(sn);
    51     51   end;
    52     52   
    53         -function messageProc(msg: Integer; _wParam: WPARAM; _lParam: LPARAM): LRESULT; cdecl; export;
           53  +function messageProc(msg: UINT; _wParam: WPARAM; _lParam: LPARAM): LRESULT; cdecl; export;
    54     54   var xmsg:TMessage;
    55     55   begin
    56     56     xmsg.Msg := msg;
    57     57     xmsg.WParam := _wParam;
    58     58     xmsg.LParam := _lParam;
    59     59     xmsg.Result := 0;
    60     60     if Assigned(Npp) then

Changes to src/lib/SciSupport.pas.

     6      6   interface
     7      7   
     8      8   {$DEFINE MACRO_SUPPORT}
     9      9   
    10     10   uses Windows;
    11     11   
    12     12   type
    13         -  TScintillaMessageFnc = function(ptr : Pointer; Msg, wParam, lParam : LongInt) : LongInt; cdecl;
    14         -  uptr_t = Longword;
    15         -  sptr_t = Longint;
           13  +  TScintillaMessageFnc = function(ptr : Pointer; Msg: UINT; wParam: WPARAM; lParam : LPARAM) : LRESULT; cdecl;
           14  +  uptr_t = ULONG_PTR;
           15  +  sptr_t = LONG_PTR;
    16     16     TNotifyHeader = record
    17         -	  hwndFrom : Pointer;
    18         -	  idFrom : Cardinal;
    19         -	  code : Cardinal;
           17  +    hwndFrom : HWND;
           18  +    idFrom : uptr_t;
           19  +    code : Cardinal;
    20     20     end;
    21     21     PSCNotification = ^TSCNotification;
    22     22     TSCNotification = record
    23     23       nmhdr 		          : TNotifyHeader;
    24     24       position    	      : Integer;		// SCN_STYLENEEDED, SCN_MODIFIED
    25     25       ch 			            : Integer;		// SCN_CHARADDED, SCN_KEY
    26     26       modifiers		        : Integer;		// SCN_KEY

Changes to src/lib/nppplugin.pas.

   395    395     DMN_CLOSE = (DMN_FIRST + 1); //nmhdr.code = DWORD(DMN_CLOSE, 0)); //nmhdr.hwndFrom = hwndNpp; //nmhdr.idFrom = ctrlIdNpp;
   396    396     DMN_DOCK = (DMN_FIRST + 2);
   397    397     DMN_FLOAT = (DMN_FIRST + 3); //nmhdr.code = DWORD(DMN_XXX, int newContainer);	//nmhdr.hwndFrom = hwndNpp; //nmhdr.idFrom = ctrlIdNpp;
   398    398   
   399    399   
   400    400   type
   401    401   {$IFDEF NPPUNICODE}
   402         -  nppString = WideString;
          402  +  nppString = UnicodeString;
   403    403     nppChar = WChar;
   404    404     nppPChar = PWChar;
   405    405   {$ELSE}
   406    406     nppString = AnsiString;
   407    407     nppChar = AnsiChar;
   408    408     nppPChar = PAnsiChar;
   409    409   {$ENDIF}
................................................................................
   425    425   
   426    426     TToolbarIcons = record
   427    427       ToolbarBmp: HBITMAP;
   428    428       ToolbarIcon: HICON;
   429    429     end;
   430    430   
   431    431     TCommunicationInfo = record
   432         -    internalMsg: Cardinal;
          432  +    internalMsg: NativeUInt;
   433    433       srcModuleName: nppPChar;
   434    434       info: Pointer;
   435    435     end;
   436    436   
   437    437     TNppData = record
   438    438       NppHandle: HWND;
   439    439       ScintillaMainHandle: HWND;
................................................................................
   450    450   
   451    451     PFUNCPLUGINCMD = procedure; cdecl;
   452    452   
   453    453     _TFuncItem = record
   454    454       ItemName: Array[0..FuncItemNameLen-1] of nppChar;
   455    455       Func: PFUNCPLUGINCMD;
   456    456       CmdID: Integer;
   457         -    Checked: Boolean;
          457  +    Checked: BOOL;
   458    458       ShortcutKey: PShortcutKey;
   459    459     end;
   460    460   
   461    461     TToolbarData = record
   462    462       ClientHandle: HWND;
   463    463       Title: nppPChar;
   464    464       DlgId: Integer;
................................................................................
   469    469       PrevContainer: Cardinal; // internal
   470    470       ModuleName:nppPChar; // name of module GetModuleFileName(0...)
   471    471     end;
   472    472   
   473    473     TNppPlugin = class(TObject)
   474    474     private
   475    475       FuncArray: array of _TFuncItem;
   476         -    FClosingBufferID: Integer;
          476  +    FClosingBufferID: THandle;
   477    477       FConfigDir: string;
   478    478     protected
   479    479       PluginName: nppString;
   480         -    function GetPluginsConfigDir: string;
          480  +    function GetPluginDllName: string; virtual;
          481  +    function GetPluginsConfigDir: string; virtual;
   481    482       function AddFuncSeparator: Integer;
   482    483       function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD): Integer; overload;
   483    484       function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; ShortcutKey: TShortcutKey): Integer; overload;
   484    485       function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; Checked: Boolean): Integer; overload;
   485    486       function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; ShortcutKey: TShortcutKey; Checked: Boolean): Integer; overload;
   486    487     public
   487    488       NppData: TNppData;
................................................................................
   492    493       function Caption: string;
   493    494   
   494    495       function CmdIdFromDlgId(DlgId: Integer): Integer;
   495    496   
   496    497       // needed for DLL export.. wrappers are in the main dll file.
   497    498       procedure SetInfo(NppData: TNppData); virtual;
   498    499       function GetName: nppPChar;
   499         -    function GetFuncsArray(var FuncsCount: Integer): Pointer;
          500  +    function GetFuncsArray(out FuncsCount: Integer): Pointer;
   500    501       procedure BeNotified(sn: PSCNotification);
   501    502       procedure MessageProc(var Msg: TMessage); virtual;
   502    503   
   503    504       // hooks
   504    505       procedure DoNppnToolbarModification; virtual;
   505    506       procedure DoNppnShutdown; virtual;
   506         -    procedure DoNppnBufferActivated(const BufferID: Cardinal); virtual;
   507         -    procedure DoNppnFileClosed(const BufferID: Cardinal); virtual;
          507  +    procedure DoNppnBufferActivated(const BufferID: THandle); virtual;
          508  +    procedure DoNppnFileClosed(const BufferID: THandle); virtual;
   508    509       procedure DoUpdateUI(const hwnd: HWND; const updated: Integer); virtual;
   509    510       procedure DoModified(const hwnd: HWND; const modificationType: Integer); virtual;
   510    511   
   511    512       // df
   512    513       function DoOpen(filename: String): boolean; overload;
   513    514       function DoOpen(filename: String; Line: Integer): boolean; overload;
   514    515       procedure GetFileLine(var filename: String; var Line: Integer);
   515    516       function GetWord: string;
   516    517   
   517    518       // helpers
   518    519       property ConfigDir: string  read GetPluginsConfigDir;
          520  +    property FullFileName: string read GetPluginDllName;
   519    521     end;
   520    522   
   521    523   
   522    524   implementation
          525  +uses
          526  +  Debug;
   523    527   
   524    528   { TNppPlugin }
   525    529   
   526    530   { This is hacking for troubble...
   527    531     We need to unset the Application handler so that the forms
   528    532     don't get berserk and start throwing OS error 1004.
   529    533     This happens because the main NPP HWND is already lost when the
................................................................................
   616    620     SetLength(s, StrLen(PChar(s)));
   617    621     filename := s;
   618    622   
   619    623     r := SendMessage(self.NppData.ScintillaMainHandle, SciSupport.SCI_GETCURRENTPOS, 0, 0);
   620    624     Line := SendMessage(self.NppData.ScintillaMainHandle, SciSupport.SCI_LINEFROMPOSITION, r, 0);
   621    625   end;
   622    626   
   623         -function TNppPlugin.GetFuncsArray(var FuncsCount: Integer): Pointer;
          627  +function TNppPlugin.GetFuncsArray(out FuncsCount: Integer): Pointer;
   624    628   begin
   625    629     FuncsCount := Length(self.FuncArray);
   626         -  Result := self.FuncArray;
          630  +  Result := @self.FuncArray[0];
   627    631   end;
   628    632   
   629    633   function TNppPlugin.GetName: nppPChar;
   630    634   begin
   631    635     Result := nppPChar(self.PluginName);
   632    636   end;
          637  +
          638  +function TNppPlugin.GetPluginDllName: string;
          639  +begin
          640  +  Result := StringOfChar(#0, 2048);
          641  +  SetLength(Result, GetModuleFileName(HInstance, PChar(Result), Length(Result) + 1));
          642  +end;
   633    643   
   634    644   function TNppPlugin.GetPluginsConfigDir: string;
   635    645   begin
   636    646     if Length(FConfigDir) = 0 then begin
   637    647       SetLength(FConfigDir, 1001);
   638    648       SendMessage(self.NppData.NppHandle, NPPM_GETPLUGINSCONFIGDIR, 1000, LPARAM(PChar(FConfigDir)));
   639    649       SetString(FConfigDir, PChar(FConfigDir), StrLen(PChar(FConfigDir)));
................................................................................
   640    650     end;
   641    651     Result := FConfigDir;
   642    652   end;
   643    653   
   644    654   procedure TNppPlugin.BeNotified(sn: PSCNotification);
   645    655   begin
   646    656     try
   647         -    if HWND(sn^.nmhdr.hwndFrom) = self.NppData.NppHandle then begin
          657  +    if sn^.nmhdr.hwndFrom = self.NppData.NppHandle then begin
          658  +//      ODS('BeNotified from Notepad++ %d', [sn.nmhdr.code]);
   648    659         case sn.nmhdr.code of
   649    660           NPPN_TB_MODIFICATION: begin
   650    661             self.DoNppnToolbarModification;
   651    662           end;
   652    663           NPPN_SHUTDOWN: begin
   653    664             self.DoNppnShutdown;
   654    665           end;
   655    666           NPPN_BUFFERACTIVATED: begin
   656    667             self.DoNppnBufferActivated(sn.nmhdr.idFrom);
   657    668           end;
   658    669           NPPN_FILEBEFORECLOSE: begin
   659         -          FClosingBufferID := SendMessage(HWND(sn.nmhdr.hwndFrom), NPPM_GETCURRENTBUFFERID, 0, 0);
          670  +          FClosingBufferID := SendMessage(sn.nmhdr.hwndFrom, NPPM_GETCURRENTBUFFERID, 0, 0);
   660    671     //        self.DoNppnBeforeFileClose(FClosingBufferID);
   661    672           end;
   662    673           NPPN_FILECLOSED: begin
   663    674             self.DoNppnFileClosed(FClosingBufferID);
   664    675           end;
   665    676         end;
   666    677       end else begin
          678  +//      ODS('BeNotified from Scintilla %d', [sn.nmhdr.code]);
   667    679         case sn.nmhdr.code of
   668    680           SCN_MODIFIED: begin
   669         -          Self.DoModified(HWND(sn.nmhdr.hwndFrom), sn.modificationType);
          681  +          Self.DoModified(sn.nmhdr.hwndFrom, sn.modificationType);
   670    682           end;
   671    683           SCN_UPDATEUI: begin
   672         -          self.DoUpdateUI(HWND(sn.nmhdr.hwndFrom), sn.updated);
          684  +          self.DoUpdateUI(sn.nmhdr.hwndFrom, sn.updated);
   673    685           end;
   674    686         end;
   675    687       end;
   676    688       // @todo
   677    689     except
   678    690       on E: Exception do begin
   679         -      OutputDebugString(PChar(Format('%s> %s: "%s"', [PluginName, E.ClassName, E.Message])));
          691  +      ODS('%s> %s: "%s"', [PluginName, E.ClassName, E.Message]);
   680    692       end;
   681    693     end;
   682    694   end;
   683    695   
   684    696   procedure TNppPlugin.MessageProc(var Msg: TMessage);
   685    697   //var
   686    698   //  hm: HMENU;
................................................................................
   748    760   end;
   749    761   
   750    762   procedure TNppPlugin.DoNppnToolbarModification;
   751    763   begin
   752    764     // override these
   753    765   end;
   754    766   
   755         -procedure TNppPlugin.DoNppnBufferActivated(const BufferID: Cardinal);
          767  +procedure TNppPlugin.DoNppnBufferActivated(const BufferID: THandle);
   756    768   begin
   757    769     // override these
   758    770   end;
   759    771   
   760         -procedure TNppPlugin.DoNppnFileClosed(const BufferID: Cardinal);
          772  +procedure TNppPlugin.DoNppnFileClosed(const BufferID: THandle);
   761    773   begin
   762    774     // override these
   763    775   end;
   764    776   
   765    777   procedure TNppPlugin.DoModified(const hwnd: HWND; const modificationType: Integer);
   766    778   begin
   767    779     // override these

Changes to src/prj/PreviewHTML.dpr.

    25     25     U_Npp_PreviewHTML in '..\U_Npp_PreviewHTML.pas',
    26     26     F_About in '..\F_About.pas' {AboutForm},
    27     27     F_PreviewHTML in '..\F_PreviewHTML.pas' {frmHTMLPreview},
    28     28     WebBrowser in '..\lib\WebBrowser.pas',
    29     29     L_VersionInfoW in '..\common\L_VersionInfoW.pas',
    30     30     L_SpecialFolders in '..\common\L_SpecialFolders.pas',
    31     31     RegExpr in '..\common\RegExpr.pas',
    32         -  U_CustomFilter in '..\U_CustomFilter.pas';
           32  +  U_CustomFilter in '..\U_CustomFilter.pas',
           33  +  Debug;
    33     34   
    34     35   {$R *.res}
    35     36   
    36     37   {$Include '..\lib\NppPluginInclude.pas'}
    37     38   
    38     39   begin
    39     40     { First, assign the procedure to the DLLProc variable }
    40     41     DllProc := @DLLEntryPoint;
    41     42     { Now invoke the procedure to reflect that the DLL is attaching to the process }
    42     43     DLLEntryPoint(DLL_PROCESS_ATTACH);
    43     44   end.
           45  +

Changes to src/prj/PreviewHTML.dproj.

     1      1   <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2      2       <PropertyGroup>
     3      3           <ProjectGuid>{A2533A0E-8621-4A31-A675-059AFF5AA9FB}</ProjectGuid>
     4      4           <MainSource>PreviewHTML.dpr</MainSource>
     5      5           <Base>True</Base>
     6         -        <Config Condition="'$(Config)'==''">Debug</Config>
     7         -        <TargetedPlatforms>1</TargetedPlatforms>
            6  +        <Config Condition="'$(Config)'==''">Release</Config>
            7  +        <TargetedPlatforms>3</TargetedPlatforms>
     8      8           <AppType>Library</AppType>
     9      9           <FrameworkType>VCL</FrameworkType>
    10     10           <ProjectVersion>18.3</ProjectVersion>
    11         -        <Platform Condition="'$(Platform)'==''">Win32</Platform>
           11  +        <Platform Condition="'$(Platform)'==''">Win64</Platform>
    12     12       </PropertyGroup>
    13     13       <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
    14     14           <Base>true</Base>
    15     15       </PropertyGroup>
    16     16       <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
    17     17           <Base_Win32>true</Base_Win32>
    18     18           <CfgParent>Base</CfgParent>
    19     19           <Base>true</Base>
           20  +    </PropertyGroup>
           21  +    <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
           22  +        <Base_Win64>true</Base_Win64>
           23  +        <CfgParent>Base</CfgParent>
           24  +        <Base>true</Base>
    20     25       </PropertyGroup>
    21     26       <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
    22     27           <Cfg_1>true</Cfg_1>
    23     28           <CfgParent>Base</CfgParent>
    24     29           <Base>true</Base>
           30  +    </PropertyGroup>
           31  +    <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
           32  +        <Cfg_1_Win32>true</Cfg_1_Win32>
           33  +        <CfgParent>Cfg_1</CfgParent>
           34  +        <Cfg_1>true</Cfg_1>
           35  +        <Base>true</Base>
    25     36       </PropertyGroup>
    26     37       <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
    27     38           <Cfg_2>true</Cfg_2>
    28     39           <CfgParent>Base</CfgParent>
    29     40           <Base>true</Base>
    30     41       </PropertyGroup>
    31     42       <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
................................................................................
    32     43           <Cfg_2_Win32>true</Cfg_2_Win32>
    33     44           <CfgParent>Cfg_2</CfgParent>
    34     45           <Cfg_2>true</Cfg_2>
    35     46           <Base>true</Base>
    36     47       </PropertyGroup>
    37     48       <PropertyGroup Condition="'$(Base)'!=''">
    38     49           <SanitizedProjectName>PreviewHTML</SanitizedProjectName>
    39         -        <VerInfo_MinorVer>4</VerInfo_MinorVer>
           50  +        <VerInfo_MinorVer>3</VerInfo_MinorVer>
    40     51           <PostBuildEventCancelOnError>false</PostBuildEventCancelOnError>
    41     52           <PostBuildEvent><![CDATA["C:\MC\Run\Util\Compression\UPX\upx.exe" --best -q "$(OUTPUTPATH)"
    42     53   $(PostBuildEvent)]]></PostBuildEvent>
    43     54           <VerInfo_DLL>true</VerInfo_DLL>
    44     55           <DCC_ImageBase>00400000</DCC_ImageBase>
    45         -        <VerInfo_Keys>CompanyName=Voronwë;FileDescription=HTML Preview plugin for Notepad++;FileVersion=1.4.0.0;InternalName=PreviewHTML;LegalCopyright=© Martijn Coppoolse;LegalTrademarks=;OriginalFilename=PreviewHTML.dll;ProductName=Notepad++;ProductVersion=6.0.0.0;Comments=http://martijn.coppoolse.com/software</VerInfo_Keys>
           56  +        <VerInfo_Keys>CompanyName=Voronwë;FileDescription=HTML Preview plugin for Notepad++;FileVersion=1.3.2.0;InternalName=PreviewHTML;LegalCopyright=© Martijn Coppoolse;LegalTrademarks=;OriginalFilename=PreviewHTML.dll;ProductName=Notepad++;ProductVersion=6.0.0.0;Comments=https://martijn.coppoolse.com/software</VerInfo_Keys>
    46     57           <DCC_UsePackage>vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;soaprtl;dbexpress;dbxcds;indy;dclOffice2k;dOCI6;CoolTrayIcon_D6plus;curlpkg;ThemeManagerD6;VirtualTreesD6;Jcl;JclVcl;JvCoreD6R;JvSystemD6R;JvStdCtrlsD6R;JvAppFrmD6R;JvBandsD6R;JvDBD6R;JvDlgsD6R;JvBDED6R;JvCmpD6R;JvCryptD6R;JvCtrlsD6R;JvCustomD6R;JvDockingD6R;JvDotNetCtrlsD6R;JvEDID6R;JvGlobusD6R;JvHMID6R;JvInterpreterD6R;JvJansD6R;JvManagedThreadsD6R;JvMMD6R;JvNetD6R;JvPageCompsD6R;JvPluginD6R;JvPrintPreviewD6R;JvRuntimeDesignD6R;JvTimeFrameworkD6R;JvUIBD6R;JvValidatorsD6R;JvWizardD6R;JvXPCtrlsD6R;$(DCC_UsePackage)</DCC_UsePackage>
    47     58           <DCC_ExeOutput>..\..\out\$(PLATFORM)\$(CONFIG)</DCC_ExeOutput>
    48     59           <DCC_Define>NPPUNICODE;$(DCC_Define)</DCC_Define>
    49     60           <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
    50     61           <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
    51     62           <DCC_UnitSearchPath>$(DELPHI)\Lib\Debug;C:\PROGRA~1\Jedi\jcl\lib\d6\debug;..\;..\lib;..\common;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
    52     63           <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
................................................................................
    55     66           <GenDll>true</GenDll>
    56     67           <DCC_S>false</DCC_S>
    57     68           <DCC_F>false</DCC_F>
    58     69           <VerInfo_Locale>1033</VerInfo_Locale>
    59     70           <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo>
    60     71           <DCC_E>false</DCC_E>
    61     72           <DCC_DcuOutput>..\..\out\dcu\$(PLATFORM)\$(CONFIG)</DCC_DcuOutput>
           73  +        <VerInfo_Release>2</VerInfo_Release>
    62     74       </PropertyGroup>
    63     75       <PropertyGroup Condition="'$(Base_Win32)'!=''">
    64     76           <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
    65     77           <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
    66     78       </PropertyGroup>
           79  +    <PropertyGroup Condition="'$(Base_Win64)'!=''">
           80  +        <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
           81  +        <BT_BuildType>Debug</BT_BuildType>
           82  +        <Debugger_HostApplication>C:\MC\Run\Office\Np++\x64\notepad++.exe</Debugger_HostApplication>
           83  +    </PropertyGroup>
    67     84       <PropertyGroup Condition="'$(Cfg_1)'!=''">
    68     85           <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
    69     86           <DCC_DebugInformation>0</DCC_DebugInformation>
    70     87           <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
    71     88           <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
    72     89       </PropertyGroup>
           90  +    <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
           91  +        <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
           92  +    </PropertyGroup>
    73     93       <PropertyGroup Condition="'$(Cfg_2)'!=''">
    74     94           <VerInfo_Debug>true</VerInfo_Debug>
    75     95           <VerInfo_PreRelease>true</VerInfo_PreRelease>
    76     96           <PostBuildEvent><![CDATA[]]></PostBuildEvent>
    77     97           <DCC_SymbolReferenceInfo>2</DCC_SymbolReferenceInfo>
    78     98           <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
    79     99           <DCC_Optimize>false</DCC_Optimize>
    80    100           <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
          101  +        <DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
    81    102       </PropertyGroup>
    82    103       <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
    83    104           <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
    84    105       </PropertyGroup>
    85    106       <ItemGroup>
    86    107           <DelphiCompile Include="$(MainSource)">
    87    108               <MainSource>MainSource</MainSource>
................................................................................
   126    147           <Borland.ProjectType/>
   127    148           <BorlandProject>
   128    149               <Delphi.Personality>
   129    150                   <Source>
   130    151                       <Source Name="MainSource">PreviewHTML.dpr</Source>
   131    152                   </Source>
   132    153                   <Excluded_Packages>
   133         -                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
   134         -                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
   135         -                    <Excluded_Packages Name="W:\Lib\BPL\RaizeComponentsVcl310.bpl">Raize Components VCL</Excluded_Packages>
          154  +                    <Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
          155  +                    <Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
   136    156                   </Excluded_Packages>
   137    157                   <VersionInfo>
   138    158                       <VersionInfo Name="IncludeVerInfo">False</VersionInfo>
   139    159                       <VersionInfo Name="AutoIncBuild">False</VersionInfo>
   140    160                       <VersionInfo Name="MajorVer">1</VersionInfo>
   141    161                       <VersionInfo Name="MinorVer">2</VersionInfo>
   142    162                       <VersionInfo Name="Release">0</VersionInfo>
................................................................................
   160    180                       <VersionInfoKeys Name="ProductName"/>
   161    181                       <VersionInfoKeys Name="ProductVersion">6.0.0.0</VersionInfoKeys>
   162    182                       <VersionInfoKeys Name="Comments"/>
   163    183                   </VersionInfoKeys>
   164    184               </Delphi.Personality>
   165    185               <Platforms>
   166    186                   <Platform value="Win32">True</Platform>
   167         -                <Platform value="Win64">False</Platform>
          187  +                <Platform value="Win64">True</Platform>
   168    188               </Platforms>
   169    189           </BorlandProject>
   170    190           <ProjectFileVersion>12</ProjectFileVersion>
   171    191       </ProjectExtensions>
   172    192       <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
   173    193       <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
   174    194       <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'">