Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merged in trunk, and incorporated some fixes for Win64. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | updatecheck |
Files: | files | file ages | folders |
SHA1: |
23338c79498ddd4d8047261cff30f52b |
User & Date: | tinus 2017-02-19 17:30:12.774 |
Original Comment: | Merged in trunk. |
References
2019-03-15
| ||
18:14 | Grafted Win64-related changes from [23338c7949] and [f09c69e9b9] into their own branch, to make it easier to create a proper 64-bits release. check-in: e1f6b8f94e user: tinus tags: win64 | |
Context
2017-02-19
| ||
20:24 | Moved ODS for OutputDebugString to separate unit. check-in: 24c1e8d83a user: tinus tags: updatecheck | |
17:30 | Merged in trunk, and incorporated some fixes for Win64. check-in: 23338c7949 user: tinus tags: updatecheck | |
2017-02-08
| ||
16:04 | Added versionable ignore-glob. Updated and normalized Delphi project (10.1 Berlin Update 2). check-in: 81540a5449 user: tinus tags: trunk | |
2017-02-07
| ||
21:42 | Added update command. Retrieved release notes for the latest version. check-in: 15ba04d971 user: tinus tags: updatecheck | |
Changes
Added .fossil-settings/ignore-glob.
> > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | */__history/* */__recovery/* out/ *.local *.identcache *.dsk *.stat *.tvsconfig ~*.* *.~* *.bak *.rej *.org *.res |
Added .fossil-settings/ignore-glob.no-warn.
Changes to src/F_PreviewHTML.dfm.
1 2 3 4 5 6 7 8 9 10 11 | inherited frmHTMLPreview: TfrmHTMLPreview BorderStyle = bsSizeToolWin Caption = 'HTML preview' ClientHeight = 420 ClientWidth = 504 ParentFont = True OnCreate = FormCreate OnDestroy = FormDestroy OnHide = FormHide OnKeyPress = FormKeyPress OnShow = FormShow | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | inherited frmHTMLPreview: TfrmHTMLPreview BorderStyle = bsSizeToolWin Caption = 'HTML preview' ClientHeight = 420 ClientWidth = 504 ParentFont = True OnCreate = FormCreate OnDestroy = FormDestroy OnHide = FormHide OnKeyPress = FormKeyPress OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object pnlButtons: TPanel Left = 0 Top = 379 Width = 504 Height = 41 |
︙ | ︙ | |||
103 104 105 106 107 108 109 | TabOrder = 0 OnStatusTextChange = wbIEStatusTextChange OnTitleChange = wbIETitleChange OnBeforeNavigate2 = wbIEBeforeNavigate2 OnDocumentComplete = wbIEDocumentComplete OnStatusBar = wbIEStatusBar OnNewWindow3 = wbIENewWindow3 | < < < < | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | TabOrder = 0 OnStatusTextChange = wbIEStatusTextChange OnTitleChange = wbIETitleChange OnBeforeNavigate2 = wbIEBeforeNavigate2 OnDocumentComplete = wbIEDocumentComplete OnStatusBar = wbIEStatusBar OnNewWindow3 = wbIENewWindow3 ControlData = { 4C000000173400002C2700000000000000000000000000000000000000000000 000000004C000000000000000000000001000000E0D057007335CF11AE690800 2B2E12620B000000000000004C0000000114020000000000C000000000000046 8000000000000000000000000000000000000000000000000000000000000000 00000000000000000100000000000000000000000000000000000000} end |
︙ | ︙ |
Changes to src/F_PreviewHTML.pas.
1 2 3 4 5 6 | unit F_PreviewHTML; //////////////////////////////////////////////////////////////////////////////////////////////////// interface uses | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | unit F_PreviewHTML; //////////////////////////////////////////////////////////////////////////////////////////////////// interface uses Windows, Messages, SysUtils, Classes, Variants, Graphics, Controls, Forms, Generics.Collections, Dialogs, StdCtrls, SHDocVw, OleCtrls, ComCtrls, ExtCtrls, IniFiles, NppPlugin, NppDockingForms, U_CustomFilter; type TBufferID = NativeInt; TfrmHTMLPreview = class(TNppDockingForm) wbIE: TWebBrowser; pnlButtons: TPanel; btnRefresh: TButton; btnClose: TButton; sbrIE: TStatusBar; pnlPreview: TPanel; |
︙ | ︙ | |||
40 41 42 43 44 45 46 | procedure btnAboutClick(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure tmrAutorefreshTimer(Sender: TObject); procedure chkFreezeClick(Sender: TObject); procedure wbIEDocumentComplete(ASender: TObject; const pDisp: IDispatch; const URL: OleVariant); private { Private declarations } | | | | | | | | > > > > > > > > > > | | 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 | procedure btnAboutClick(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure tmrAutorefreshTimer(Sender: TObject); procedure chkFreezeClick(Sender: TObject); procedure wbIEDocumentComplete(ASender: TObject; const pDisp: IDispatch; const URL: OleVariant); private { Private declarations } FBufferID: TBufferID; FScrollPositions: TDictionary<TBufferID,TPoint>; FFilterThread: TCustomFilterThread; FScrollTop: Integer; FScrollLeft: Integer; procedure SaveScrollPos; procedure RestoreScrollPos(const BufferID: TBufferID); function DetermineCustomFilter: string; function ExecuteCustomFilter(const FilterName, HTML: string; const BufferID: TBufferID): Boolean; function TransformXMLToHTML(const XML: WideString): string; procedure FilterThreadTerminate(Sender: TObject); public { Public declarations } procedure ResetTimer; procedure ForgetBuffer(const BufferID: TBufferID); procedure DisplayPreview(HTML: string; const BufferID: TBufferID); end; var frmHTMLPreview: TfrmHTMLPreview; procedure ODS(const DebugOutput: string); overload; procedure ODS(const DebugOutput: string; const Args: array of const); overload; //////////////////////////////////////////////////////////////////////////////////////////////////// implementation uses ShellAPI, ComObj, StrUtils, IOUtils, Masks, MSHTML, RegExpr, L_SpecialFolders, WebBrowser, SciSupport, U_Npp_PreviewHTML; {$R *.dfm} var OutputLog: TStreamWriter; { ------------------------------------------------------------------------------------------------ } procedure ODS(const DebugOutput: string); overload; begin OutputDebugString(PChar('PreviewHTML['+IntToHex(GetCurrentThreadId, 4)+']: ' + DebugOutput)); if OutputLog = nil then begin OutputLog := TStreamWriter.Create(TFileStream.Create(ChangeFileExt(TSpecialFolders.DLLFullName, '.log'), fmCreate or fmShareDenyWrite), TEncoding.UTF8); OutputLog.OwnStream; OutputLog.BaseStream.Seek(0, soFromEnd); end; OutputLog.Write(FormatDateTime('yyyy-MM-dd hh:nn:ss.zzz: ', Now)); OutputLog.WriteLine(DebugOutput); end {ODS}; { ------------------------------------------------------------------------------------------------ } procedure ODS(const DebugOutput: string; const Args: array of const); overload; begin ODS(Format(DebugOutput, Args)); end{ODS}; { ================================================================================================ } { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.FormCreate(Sender: TObject); begin FScrollPositions := TDictionary<TBufferID,TPoint>.Create; self.NppDefaultDockingMask := DWS_DF_FLOATING; // whats the default docking position //self.KeyPreview := true; // special hack for input forms self.OnFloat := self.FormFloat; self.OnDock := self.FormDock; inherited; FBufferID := -1; with TNppPluginPreviewHTML(Npp).GetSettings() do begin |
︙ | ︙ | |||
131 132 133 134 135 136 137 | btnRefresh.Click; end {TfrmHTMLPreview.tmrAutorefreshTimer}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.btnRefreshClick(Sender: TObject); var View: Integer; | | > < | < | 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 | btnRefresh.Click; end {TfrmHTMLPreview.tmrAutorefreshTimer}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.btnRefreshClick(Sender: TObject); var View: Integer; BufferID: TBufferID; hScintilla: THandle; Lexer: NativeInt; IsHTML, IsXML, IsCustom: Boolean; Size: WPARAM; Content: UTF8String; HTML: string; FilterName: string; CodePage: NativeInt; begin if chkFreeze.Checked then Exit; try tmrAutorefresh.Enabled := False; ODS('FreeAndNil(FFilterThread);'); FreeAndNil(FFilterThread); SaveScrollPos; SendMessage(Self.Npp.NppData.NppHandle, NPPM_GETCURRENTSCINTILLA, 0, LPARAM(@View)); if View = 0 then begin hScintilla := Self.Npp.NppData.ScintillaMainHandle; end else begin hScintilla := Self.Npp.NppData.ScintillaSecondHandle; |
︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 | {--- MCO 22-01-2013: determine whether the current document matches a custom filter ---} FilterName := DetermineCustomFilter; IsCustom := Length(FilterName) > 0; {$MESSAGE HINT 'TODO: Find a way to communicate why there is no preview, depending on the situation — MCO 22-01-2013'} if IsXML or IsHTML or IsCustom then begin Size := SendMessage(hScintilla, SCI_GETTEXT, 0, 0); SetLength(Content, Size); SendMessage(hScintilla, SCI_GETTEXT, Size, LPARAM(PAnsiChar(Content))); | > > | > | > > > > > > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | {--- MCO 22-01-2013: determine whether the current document matches a custom filter ---} FilterName := DetermineCustomFilter; IsCustom := Length(FilterName) > 0; {$MESSAGE HINT 'TODO: Find a way to communicate why there is no preview, depending on the situation — MCO 22-01-2013'} if IsXML or IsHTML or IsCustom then begin CodePage := SendMessage(hScintilla, SCI_GETCODEPAGE, 0, 0); Size := SendMessage(hScintilla, SCI_GETTEXT, 0, 0); SetLength(Content, Size); SendMessage(hScintilla, SCI_GETTEXT, Size, LPARAM(PAnsiChar(Content))); if CodePage = CP_ACP then begin HTML := string(PAnsiChar(Content)); end else begin SetLength(HTML, Size); if Size > 0 then begin SetLength(HTML, MultiByteToWideChar(CodePage, 0, PAnsiChar(Content), Size, PWideChar(HTML), Length(HTML))); if Length(HTML) = 0 then RaiseLastOSError; end; end; end; if IsCustom then begin //MessageBox(Npp.NppData.NppHandle, PChar(Format('FilterName: %s', [FilterName])), 'PreviewHTML', MB_ICONINFORMATION); wbIEStatusTextChange(wbIE, Format('Running filter %s...', [FilterName])); if ExecuteCustomFilter(FilterName, HTML, BufferID) then begin Exit; |
︙ | ︙ | |||
214 215 216 217 218 219 220 | begin btnRefresh.Enabled := not chkFreeze.Checked; if btnRefresh.Enabled then btnRefresh.Click; end {TfrmHTMLPreview.chkFreezeClick}; { ------------------------------------------------------------------------------------------------ } | | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | begin btnRefresh.Enabled := not chkFreeze.Checked; if btnRefresh.Enabled then btnRefresh.Click; end {TfrmHTMLPreview.chkFreezeClick}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.DisplayPreview(HTML: string; const BufferID: TBufferID); var IsHTML: Boolean; HeadStart: Integer; Size: WPARAM; Filename: nppString; View: Integer; hScintilla: THandle; |
︙ | ︙ | |||
281 282 283 284 285 286 287 | end; end; end {TfrmHTMLPreview.DisplayPreview}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.SaveScrollPos; var | < > | | > > | | < < < < < | | | < | | > > > > | < < < < | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | end; end; end {TfrmHTMLPreview.DisplayPreview}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.SaveScrollPos; var docEl: IHTMLElement2; P: TPoint; begin FScrollTop := -1; FScrollLeft := -1; if FBufferID = -1 then Exit; if Assigned(wbIE.Document) and Assigned((wbIE.Document as IHTMLDocument3).documentElement) then begin docEl := (wbIE.Document as IHTMLDocument3).documentElement AS IHTMLElement2; P.Y := docEl.scrollTop; P.X := docEl.scrollLeft; FScrollPositions.AddOrSetValue(FBufferID, P); ODS('SaveScrollPos[%x]: %dx%d', [FBufferID, P.X, P.Y]); end else begin FScrollPositions.Remove(FBufferID); ODS('SaveScrollPos[%x]: --', [FBufferID]); end; end {TfrmHTMLPreview.SaveScrollPos}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.RestoreScrollPos(const BufferID: TBufferID); var P: TPoint; docEl: IHTMLElement2; begin {--- MCO 22-01-2013: Look up this buffer's scroll position; if we know one, wait for the page to finish loading, then restore the scroll position. ---} if FScrollPositions.TryGetValue(BufferID, P) then begin FScrollTop := P.Y; FScrollLeft := P.X; ODS('RestoreScrollPos[%x]: %dx%d', [BufferID, P.X, P.Y]); if (FScrollTop <> -1) and Assigned(wbIE.Document) and Assigned((wbIE.Document as IHTMLDocument3).documentElement) then begin docEl := (wbIE.Document as IHTMLDocument3).documentElement as IHTMLElement2; docEl.scrollTop := FScrollTop; docEl.scrollLeft := FScrollLeft; ODS('RestoreScrollPos: done!'); end; end else begin ODS('RestoreScrollPos[%x]: --', [BufferID]); end; FBufferID := BufferID; end {TfrmHTMLPreview.RestoreScrollPos}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.ForgetBuffer(const BufferID: TBufferID); begin if FBufferID = BufferID then FBufferID := -1; if Assigned(FScrollPositions) then begin FScrollPositions.Remove(BufferID); end; end {TfrmHTMLPreview.ForgetBuffer}; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.ResetTimer; begin tmrAutorefresh.Enabled := False; |
︙ | ︙ | |||
433 434 435 436 437 438 439 | finally Names.Free; Filters.Free; end; end {TfrmHTMLPreview.DetermineCustomFilter}; { ------------------------------------------------------------------------------------------------ } | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | finally Names.Free; Filters.Free; end; end {TfrmHTMLPreview.DetermineCustomFilter}; { ------------------------------------------------------------------------------------------------ } function TfrmHTMLPreview.ExecuteCustomFilter(const FilterName, HTML: string; const BufferID: TBufferID): Boolean; var FilterData: TFilterData; DocFile: TFileName; View: Integer; hScintilla: THandle; Filters: TIniFile; BufferEncoding: NativeInt; |
︙ | ︙ | |||
673 674 675 676 677 678 679 | Handle: HWND; begin if not SameText(bstrUrl, 'about:blank') and not StartsText('javascript:', bstrURL) then begin if Assigned(Npp) then Handle := Npp.NppData.NppHandle else Handle := 0; | | | > > > > > > | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | Handle: HWND; begin if not SameText(bstrUrl, 'about:blank') and not StartsText('javascript:', bstrURL) then begin if Assigned(Npp) then Handle := Npp.NppData.NppHandle else Handle := 0; ShellExecute(Handle, nil, PChar(bstrUrl), nil, nil, SW_SHOWDEFAULT); end; Cancel := True; end; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.wbIEStatusBar(ASender: TObject; StatusBar: WordBool); begin sbrIE.Visible := StatusBar; end; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.wbIEStatusTextChange(ASender: TObject; const Text: WideString); begin sbrIE.SimpleText := Text; // sbrIE.Visible := Length(Text) > 0; // if sbrIE.Visible then sbrIE.Invalidate; end; { ------------------------------------------------------------------------------------------------ } procedure TfrmHTMLPreview.wbIETitleChange(ASender: TObject; const Text: WideString); begin inherited; self.UpdateDisplayInfo(StringReplace(Text, 'about:blank', '', [rfReplaceAll])); end; initialization finalization OutputLog.Free; end. |
Changes to src/U_AutoUpdate.pas.
1 2 3 4 5 6 7 8 9 10 11 12 13 | unit U_AutoUpdate; interface uses SysUtils; type TPluginUpdate = class private FURL: string; // FOnProgress: TProgressEvent; // TODO: see L_HttpClient FLatestVersion: string; | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | unit U_AutoUpdate; interface uses SysUtils; type TPluginUpdate = class private FURL: string; // FOnProgress: TProgressEvent; // TODO: see L_HttpClient FLatestVersion: string; function GetCurrentVersion: string; function GetLatestVersion: string; public constructor Create{(const AURL: string)}; function IsUpdateAvailable(out NewVersion, Changes: string): Boolean; |
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | Result := FileVersion; Free; end; end {TPluginUpdate.GetCurrentVersion}; { ------------------------------------------------------------------------------------------------ } function TPluginUpdate.GetLatestVersion: string; var Http: THttpClient; Notes: string; RxVersion: TRegEx; Matches: TMatchCollection; Match: TMatch; i: Integer; begin | > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < < < < < < | 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 | Result := FileVersion; Free; end; end {TPluginUpdate.GetCurrentVersion}; { ------------------------------------------------------------------------------------------------ } function TPluginUpdate.GetLatestVersion: string; begin // TODO end {TPluginUpdate.GetLatestVersion}; { ------------------------------------------------------------------------------------------------ } function TPluginUpdate.IsUpdateAvailable(out NewVersion, Changes: string): Boolean; var Http: THttpClient; Notes: string; RxVersion: TRegEx; Matches: TMatchCollection; Match: TMatch; i: Integer; begin Result := False; // Download the current release notes ODS('Create HttpClient'); Http := THttpClient.Create('http://fossil.2of4.net/npp_preview/doc/publish/ReleaseNotes.txt'); try ODS('Http.Get'); if Http.Get() = 200 then begin ODS('%d %s', [Http.StatusCode, Http.StatusText]); for i := 0 to Http.ResponseHeaders.Count - 1 do ODS(Http.ResponseHeaders[i]); Notes := Http.ResponseString; ODS('Response: "%s"', [Copy(StringReplace(StringReplace(Notes, #10, '·', [rfReplaceAll]), #13, '·', [rfReplaceAll]), 1, 250)]); // get the response stream, and look for the latest version in there Matches := TRegEx.Matches(Notes, 'v[0-9]+(\.[0-9]+){3}'); ODS('Matches: %d', [Matches.Count]); if Matches.Count > 0 then begin Match := Matches.Item[0]; ODS('Match: Success=%s; Value="%s"; Index=%d', [BoolToStr(Match.Success, True), Match.Value, Match.Index]); if Match.Success then begin NewVersion := Match.Value; {$MESSAGE WARN 'TODO: read all versions until we find the current one. Otherwise stop at </pre>.'} if (Matches.Count > 1) and Matches[1].Success then begin Changes := Notes.Substring(Match.Index - 1, Matches[1].Index - Match.Index); end else begin i := Pos('</pre>', Notes); Changes := Notes.Substring(Match.Index - 1, i - Match.Index); end; end; end; end else begin // TODO: show message, open project's main page? raise EUpdateError.CreateFmt('%d %s', [Http.StatusCode, Http.StatusText]); end; finally Http.Free; end; Result := CompareVersions(CurrentVersion, NewVersion) > 0; // TODO: Populate Changes from the text between the match of the first version number, and the next (or, if there is no next, the </pre> tag). end {TPluginUpdate.IsUpdateAvailable}; { ------------------------------------------------------------------------------------------------ } function TPluginUpdate.DownloadUpdate: string; begin // TODO: Download http://fossil.2of4.net/npp_preview/zip/Preview_Plugin.zip?uuid=publish&name=plugins to a temp dir, // extract it to a custom temp folder, and return that folder's path |
︙ | ︙ |
Changes to src/U_Npp_PreviewHTML.pas.
︙ | ︙ | |||
21 22 23 24 25 26 27 | procedure CommandSetIEVersion(const BrowserEmulation: Integer); procedure CommandOpenFile(const Filename: nppString); procedure CommandCheckUpdate; procedure CommandShowAbout; procedure CommandReplaceHelloWorld; procedure DoNppnToolbarModification; override; | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | procedure CommandSetIEVersion(const BrowserEmulation: Integer); procedure CommandOpenFile(const Filename: nppString); procedure CommandCheckUpdate; procedure CommandShowAbout; procedure CommandReplaceHelloWorld; procedure DoNppnToolbarModification; override; procedure DoNppnFileClosed(const BufferID: THandle); override; procedure DoNppnBufferActivated(const BufferID: THandle); override; procedure DoModified(const hwnd: HWND; const modificationType: Integer); override; function GetSettings(const Name: string = 'Settings.ini'): TIniFile; end {TNppPluginPreviewHTML}; procedure _FuncReplaceHelloWorld; cdecl; procedure _FuncCheckUpdate; cdecl; |
︙ | ︙ | |||
310 311 312 313 314 315 316 | SendMessage(self.NppData.NppHandle, NPPM_ADDTOOLBARICON, WPARAM(self.CmdIdFromDlgId(0)), LPARAM(@tb)); // SendMessage(self.NppData.ScintillaMainHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0); // SendMessage(self.NppData.ScintillaSecondHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0); end {TNppPluginPreviewHTML.DoNppnToolbarModification}; { ------------------------------------------------------------------------------------------------ } | | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | SendMessage(self.NppData.NppHandle, NPPM_ADDTOOLBARICON, WPARAM(self.CmdIdFromDlgId(0)), LPARAM(@tb)); // SendMessage(self.NppData.ScintillaMainHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0); // SendMessage(self.NppData.ScintillaSecondHandle, SCI_SETMODEVENTMASK, SC_MOD_INSERTTEXT or SC_MOD_DELETETEXT, 0); end {TNppPluginPreviewHTML.DoNppnToolbarModification}; { ------------------------------------------------------------------------------------------------ } procedure TNppPluginPreviewHTML.DoNppnBufferActivated(const BufferID: THandle); begin inherited; if Assigned(frmHTMLPreview) and frmHTMLPreview.Visible then begin frmHTMLPreview.btnRefresh.Click; end; end {TNppPluginPreviewHTML.DoNppnBufferActivated}; { ------------------------------------------------------------------------------------------------ } procedure TNppPluginPreviewHTML.DoNppnFileClosed(const BufferID: THandle); begin if Assigned(frmHTMLPreview) then begin frmHTMLPreview.ForgetBuffer(BufferID); end; inherited; end {TNppPluginPreviewHTML.DoNppnFileClosed}; |
︙ | ︙ |
Changes to src/lib/SciSupport.pas.
1 2 3 4 5 6 7 8 9 10 11 12 | unit scisupport; // Support unit for scintilla use in pascal. The constants are all created from scintilla.iface by // a python script. interface {$DEFINE MACRO_SUPPORT} uses Windows; type | | | | | | 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 | unit scisupport; // Support unit for scintilla use in pascal. The constants are all created from scintilla.iface by // a python script. interface {$DEFINE MACRO_SUPPORT} uses Windows; type TScintillaMessageFnc = function(ptr : Pointer; Msg: UINT; wParam: WPARAM; lParam : LPARAM) : LRESULT; cdecl; uptr_t = Longword; sptr_t = Longint; TNotifyHeader = record hwndFrom : HWND; idFrom : uptr_t; code : NativeUInt; end; PSCNotification = ^TSCNotification; TSCNotification = record nmhdr : TNotifyHeader; position : Integer; // SCN_STYLENEEDED, SCN_MODIFIED ch : Integer; // SCN_CHARADDED, SCN_KEY modifiers : Integer; // SCN_KEY |
︙ | ︙ |
Changes to src/lib/nppplugin.pas.
︙ | ︙ | |||
425 426 427 428 429 430 431 | TToolbarIcons = record ToolbarBmp: HBITMAP; ToolbarIcon: HICON; end; TCommunicationInfo = record | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | TToolbarIcons = record ToolbarBmp: HBITMAP; ToolbarIcon: HICON; end; TCommunicationInfo = record internalMsg: NativeUInt; srcModuleName: nppPChar; info: Pointer; end; TNppData = record NppHandle: HWND; ScintillaMainHandle: HWND; |
︙ | ︙ | |||
469 470 471 472 473 474 475 | PrevContainer: Cardinal; // internal ModuleName:nppPChar; // name of module GetModuleFileName(0...) end; TNppPlugin = class(TObject) private FuncArray: array of _TFuncItem; | | | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | PrevContainer: Cardinal; // internal ModuleName:nppPChar; // name of module GetModuleFileName(0...) end; TNppPlugin = class(TObject) private FuncArray: array of _TFuncItem; FClosingBufferID: THandle; FConfigDir: string; protected PluginName: nppString; function GetPluginsConfigDir: string; function AddFuncSeparator: Integer; function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD): Integer; overload; function AddFuncItem(Name: nppString; Func: PFUNCPLUGINCMD; ShortcutKey: TShortcutKey): Integer; overload; |
︙ | ︙ | |||
499 500 501 502 503 504 505 | function GetFuncsArray(var FuncsCount: Integer): Pointer; procedure BeNotified(sn: PSCNotification); procedure MessageProc(var Msg: TMessage); virtual; // hooks procedure DoNppnToolbarModification; virtual; procedure DoNppnShutdown; virtual; | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | function GetFuncsArray(var FuncsCount: Integer): Pointer; procedure BeNotified(sn: PSCNotification); procedure MessageProc(var Msg: TMessage); virtual; // hooks procedure DoNppnToolbarModification; virtual; procedure DoNppnShutdown; virtual; procedure DoNppnBufferActivated(const BufferID: THandle); virtual; procedure DoNppnFileClosed(const BufferID: THandle); virtual; procedure DoUpdateUI(const hwnd: HWND; const updated: Integer); virtual; procedure DoModified(const hwnd: HWND; const modificationType: Integer); virtual; // df function DoOpen(filename: String): boolean; overload; function DoOpen(filename: String; Line: Integer): boolean; overload; procedure GetFileLine(var filename: String; var Line: Integer); |
︙ | ︙ | |||
748 749 750 751 752 753 754 | end; procedure TNppPlugin.DoNppnToolbarModification; begin // override these end; | | | | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | end; procedure TNppPlugin.DoNppnToolbarModification; begin // override these end; procedure TNppPlugin.DoNppnBufferActivated(const BufferID: THandle); begin // override these end; procedure TNppPlugin.DoNppnFileClosed(const BufferID: THandle); begin // override these end; procedure TNppPlugin.DoModified(const hwnd: HWND; const modificationType: Integer); begin // override these |
︙ | ︙ |
Changes to src/prj/PreviewHTML.dpr.
︙ | ︙ | |||
20 21 22 23 24 25 26 | Messages, nppplugin in '..\lib\nppplugin.pas', SciSupport in '..\lib\SciSupport.pas', NppForms in '..\lib\NppForms.pas' {NppForm}, NppDockingForms in '..\lib\NppDockingForms.pas' {NppDockingForm}, U_Npp_PreviewHTML in '..\U_Npp_PreviewHTML.pas', F_About in '..\F_About.pas' {AboutForm}, | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | Messages, nppplugin in '..\lib\nppplugin.pas', SciSupport in '..\lib\SciSupport.pas', NppForms in '..\lib\NppForms.pas' {NppForm}, NppDockingForms in '..\lib\NppDockingForms.pas' {NppDockingForm}, U_Npp_PreviewHTML in '..\U_Npp_PreviewHTML.pas', F_About in '..\F_About.pas' {AboutForm}, F_PreviewHTML in '..\F_PreviewHTML.pas' {frmHTMLPreview}, WebBrowser in '..\lib\WebBrowser.pas', L_VersionInfoW in '..\common\L_VersionInfoW.pas', L_SpecialFolders in '..\common\L_SpecialFolders.pas', RegExpr in '..\common\RegExpr.pas', U_CustomFilter in '..\U_CustomFilter.pas', U_AutoUpdate in '..\U_AutoUpdate.pas'; |
︙ | ︙ |
Changes to src/prj/PreviewHTML.dproj.
|
| | | | | | | | | | | | | | | | < < < < < | | | | | | | | < < < < < < | | | | | | | | | | | | | | > | | > | | < > | | | | | | | | | | | | | | | | | | | | < < < | | > | | | | | | | | < | > > > | < | | | | | | < | < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | > | | | | | | < < < < < < < < < | | | | | | < | | | | | | | | < | | | | | | | | < | | < < < < < < < < < | | 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 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectGuid>{A2533A0E-8621-4A31-A675-059AFF5AA9FB}</ProjectGuid> <MainSource>PreviewHTML.dpr</MainSource> <Base>True</Base> <Config Condition="'$(Config)'==''">Debug</Config> <TargetedPlatforms>1</TargetedPlatforms> <AppType>Library</AppType> <FrameworkType>VCL</FrameworkType> <ProjectVersion>18.2</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''"> <Base_Win32>true</Base_Win32> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''"> <Cfg_1>true</Cfg_1> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''"> <Cfg_2>true</Cfg_2> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''"> <Cfg_2_Win32>true</Cfg_2_Win32> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> <SanitizedProjectName>PreviewHTML</SanitizedProjectName> <VerInfo_MinorVer>4</VerInfo_MinorVer> <PostBuildEventCancelOnError>false</PostBuildEventCancelOnError> <PostBuildEvent> <![CDATA["C:\MC\Run\Util\Compression\UPX\upx.exe" --best -q "$(OUTPUTPATH)" $(PostBuildEvent)]]> </PostBuildEvent> <VerInfo_DLL>true</VerInfo_DLL> <DCC_ImageBase>00400000</DCC_ImageBase> <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> <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> <DCC_ExeOutput>..\..\out\$(PLATFORM)\$(CONFIG)</DCC_ExeOutput> <DCC_Define>NPPUNICODE;$(DCC_Define)</DCC_Define> <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <DCC_UnitSearchPath>$(DELPHI)\Lib\Debug;C:\PROGRA~1\Jedi\jcl\lib\d6\debug;..\;..\lib;..\common;$(DCC_UnitSearchPath)</DCC_UnitSearchPath> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> <DCC_N>true</DCC_N> <DCC_K>false</DCC_K> <GenDll>true</GenDll> <DCC_S>false</DCC_S> <DCC_F>false</DCC_F> <VerInfo_Locale>1033</VerInfo_Locale> <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_E>false</DCC_E> <DCC_DcuOutput>..\..\out\dcu\$(PLATFORM)\$(CONFIG)</DCC_DcuOutput> </PropertyGroup> <PropertyGroup Condition="'$(Base_Win32)'!=''"> <DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_1)'!=''"> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> <DCC_DebugInformation>0</DCC_DebugInformation> <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2)'!=''"> <VerInfo_Debug>true</VerInfo_Debug> <VerInfo_PreRelease>true</VerInfo_PreRelease> <PostBuildEvent> <![CDATA[]]> </PostBuildEvent> <DCC_SymbolReferenceInfo>2</DCC_SymbolReferenceInfo> <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> <DCC_Optimize>false</DCC_Optimize> <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''"> <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> </PropertyGroup> <ItemGroup> <DelphiCompile Include="$(MainSource)"> <MainSource>MainSource</MainSource> </DelphiCompile> <RcCompile Include="PreviewHTML_TB.rc"> <Form>PreviewHTML_TB.res</Form> </RcCompile> <DCCReference Include="..\lib\nppplugin.pas"/> <DCCReference Include="..\lib\SciSupport.pas"/> <DCCReference Include="..\lib\NppForms.pas"> <Form>NppForm</Form> </DCCReference> <DCCReference Include="..\lib\NppDockingForms.pas"> <Form>NppDockingForm</Form> </DCCReference> <DCCReference Include="..\U_Npp_PreviewHTML.pas"/> <DCCReference Include="..\F_About.pas"> <Form>AboutForm</Form> </DCCReference> <DCCReference Include="..\F_PreviewHTML.pas"> <Form>frmHTMLPreview</Form> </DCCReference> <DCCReference Include="..\lib\WebBrowser.pas"/> <DCCReference Include="..\common\L_VersionInfoW.pas"/> <DCCReference Include="..\common\L_SpecialFolders.pas"/> <DCCReference Include="..\common\RegExpr.pas"/> <DCCReference Include="..\U_CustomFilter.pas"/> <BuildConfiguration Include="Debug"> <Key>Cfg_2</Key> <CfgParent>Base</CfgParent> </BuildConfiguration> <BuildConfiguration Include="Base"> <Key>Base</Key> </BuildConfiguration> <BuildConfiguration Include="Release"> <Key>Cfg_1</Key> <CfgParent>Base</CfgParent> </BuildConfiguration> </ItemGroup> <ProjectExtensions> <Borland.Personality>Delphi.Personality.12</Borland.Personality> <Borland.ProjectType/> <BorlandProject> <Delphi.Personality> <Source> <Source Name="MainSource">PreviewHTML.dpr</Source> </Source> <Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dcloffice2k240.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dclofficexp240.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> <Excluded_Packages Name="W:\Lib\BPL\RaizeComponentsVcl310.bpl">Raize Components VCL</Excluded_Packages> </Excluded_Packages> <VersionInfo> <VersionInfo Name="IncludeVerInfo">False</VersionInfo> <VersionInfo Name="AutoIncBuild">False</VersionInfo> <VersionInfo Name="MajorVer">1</VersionInfo> <VersionInfo Name="MinorVer">2</VersionInfo> <VersionInfo Name="Release">0</VersionInfo> <VersionInfo Name="Build">0</VersionInfo> <VersionInfo Name="Debug">False</VersionInfo> <VersionInfo Name="PreRelease">False</VersionInfo> <VersionInfo Name="Special">False</VersionInfo> <VersionInfo Name="Private">False</VersionInfo> <VersionInfo Name="DLL">False</VersionInfo> <VersionInfo Name="Locale">1043</VersionInfo> <VersionInfo Name="CodePage">1252</VersionInfo> </VersionInfo> <VersionInfoKeys> <VersionInfoKeys Name="CompanyName"/> <VersionInfoKeys Name="FileDescription"/> <VersionInfoKeys Name="FileVersion">1.2.0.0</VersionInfoKeys> <VersionInfoKeys Name="InternalName"/> <VersionInfoKeys Name="LegalCopyright"/> <VersionInfoKeys Name="LegalTrademarks"/> <VersionInfoKeys Name="OriginalFilename"/> <VersionInfoKeys Name="ProductName"/> <VersionInfoKeys Name="ProductVersion">6.0.0.0</VersionInfoKeys> <VersionInfoKeys Name="Comments"/> </VersionInfoKeys> </Delphi.Personality> <Platforms> <Platform value="OSX32">False</Platform> <Platform value="Win32">True</Platform> <Platform value="Win64">False</Platform> </Platforms> </BorlandProject> <ProjectFileVersion>12</ProjectFileVersion> </ProjectExtensions> <Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/> <Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/> <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='OSX32'"> <PreBuildEvent/> <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> <PreLinkEvent/> <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> <PostBuildEvent>"C:\MC\Run\Util\Compression\UPX\upx.exe" --best -q "$(OUTPUTPATH)" </PostBuildEvent> <PostBuildEventIgnoreExitCode>True</PostBuildEventIgnoreExitCode> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'"> <PreBuildEvent/> <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> <PreLinkEvent/> <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> <PostBuildEvent>"C:\MC\Run\Util\Compression\UPX\upx.exe" --best -q "$(OUTPUTPATH)" </PostBuildEvent> <PostBuildEventIgnoreExitCode>True</PostBuildEventIgnoreExitCode> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win64'"> <PreBuildEvent/> <PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode> <PreLinkEvent/> <PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode> <PostBuildEvent>"C:\MC\Run\Util\Compression\UPX\upx.exe" --best -q "$(OUTPUTPATH)" </PostBuildEvent> <PostBuildEventIgnoreExitCode>True</PostBuildEventIgnoreExitCode> </PropertyGroup> </Project> |