ギコナビ
修订版 | 13337ef9e1f1168799d2935fbff106a32f3e95db (tree) |
---|---|
时间 | 2009-05-05 20:32:22 |
作者 | h677 <h677> |
Commiter | h677 |
close #16508
画像プレビューをダブルクリックで消せるように対応。
プレビューウィンドウを消すメッセージをレスポップアップと共通化した。
@@ -24,8 +24,7 @@ uses | ||
24 | 24 | const |
25 | 25 | NGWORDNAME_PANEL = 3; |
26 | 26 | THREADSIZE_PANEL = 2; |
27 | - USER_RESPOPUPCLEAR = WM_USER + 2005; ///< wParam : TWebBrowser | |
28 | - | |
27 | + USER_POPUPCLEAR = WM_USER + 2005; ///< wParam : TWebBrowser | |
29 | 28 | type |
30 | 29 | |
31 | 30 | TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser); |
@@ -4918,12 +4917,16 @@ begin | ||
4918 | 4917 | senderBrowser := TWebBrowser( Message.WParam ); |
4919 | 4918 | BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url ); |
4920 | 4919 | end; |
4921 | - USER_RESPOPUPCLEAR: | |
4920 | + USER_POPUPCLEAR: | |
4922 | 4921 | if (TObject(Message.WParam) is TResPopupBrowser) then begin |
4923 | 4922 | try |
4924 | 4923 | TResPopupBrowser( Message.WParam ).Clear; |
4925 | 4924 | except |
4926 | 4925 | end; |
4926 | + end else if (TObject(Message.WParam) is TPreviewBrowser) then begin | |
4927 | + if FPreviewBrowser <> nil then begin | |
4928 | + ShowWindow(FPreviewBrowser.Handle, SW_HIDE); | |
4929 | + end; | |
4927 | 4930 | end; |
4928 | 4931 | end; |
4929 | 4932 |
@@ -3,17 +3,23 @@ unit Preview; | ||
3 | 3 | interface |
4 | 4 | uses |
5 | 5 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, |
6 | - ActiveX, | |
6 | + ActiveX, OleCtrls, HTMLDocumentEvent, | |
7 | 7 | {$IF Defined(DELPRO) } |
8 | - SHDocVw | |
8 | + SHDocVw, | |
9 | + MSHTML | |
9 | 10 | {$ELSE} |
10 | - SHDocVw_TLB | |
11 | + SHDocVw_TLB, | |
12 | + MSHTML_TLB | |
11 | 13 | {$IFEND} |
12 | 14 | ; |
13 | 15 | type |
14 | 16 | TPreviewBrowser = class(TWebBrowser) |
15 | 17 | private |
18 | + FEvent: THTMLDocumentEventSink;//uEUhL gCxg | |
16 | 19 | function makeHTML(const URL, Host, Document : String): String; |
20 | + procedure BrowserDocumentComplete(Sender: TObject; | |
21 | + const pDisp: IDispatch; var URL: OleVariant); | |
22 | + function PreviewDbClick(Sender: TObject): WordBool; | |
17 | 23 | protected |
18 | 24 | procedure CreateParams(var Params: TCreateParams); override; |
19 | 25 | public |
@@ -24,7 +30,7 @@ type | ||
24 | 30 | end; |
25 | 31 | |
26 | 32 | implementation |
27 | -uses MojuUtils, GikoSystem, Setting; | |
33 | +uses MojuUtils, GikoSystem, Setting, Giko; | |
28 | 34 | |
29 | 35 | const |
30 | 36 | //vr [t@C¼ |
@@ -37,10 +43,15 @@ const | ||
37 | 43 | constructor TPreviewBrowser.Create(AOwner: TComponent); |
38 | 44 | begin |
39 | 45 | inherited Create(AOwner); |
46 | + FEvent := nil; | |
47 | + OnDocumentComplete := BrowserDocumentComplete; | |
40 | 48 | end; |
41 | 49 | |
42 | 50 | destructor TPreviewBrowser.Destroy; |
43 | 51 | begin |
52 | + if (FEvent <> nil) then begin | |
53 | + FreeAndNil(FEvent); | |
54 | + end; | |
44 | 55 | inherited Destroy; |
45 | 56 | end; |
46 | 57 |
@@ -201,4 +212,25 @@ begin | ||
201 | 212 | + '</body></html>'; |
202 | 213 | end; |
203 | 214 | end; |
215 | +//! hL g®¹Cxg | |
216 | +procedure TPreviewBrowser.BrowserDocumentComplete(Sender: TObject; | |
217 | + const pDisp: IDispatch; var URL: OleVariant); | |
218 | +begin | |
219 | + if (URL <> 'about:blank') then begin | |
220 | + FEvent := THTMLDocumentEventSink.Create(Self, Self.OleObject.Document, | |
221 | + HTMLDocumentEvents2); | |
222 | + FEvent.OnDoubleClick := PreviewDbClick; | |
223 | + end else begin | |
224 | + if (FEvent <> nil) then begin | |
225 | + FreeAndNil(FEvent); | |
226 | + end; | |
227 | + end; | |
228 | +end; | |
229 | +function TPreviewBrowser.PreviewDbClick(Sender: TObject): WordBool; | |
230 | +begin | |
231 | + // ©ªÅ©ªÍÁ¹È¢ÌÅAbZ[WoRÅÁµÄàç¤ | |
232 | + PostMessage( GikoForm.Handle , USER_POPUPCLEAR, Integer( Self ), 0 ); | |
233 | + Result := True; | |
234 | +end; | |
235 | + | |
204 | 236 | end. |
@@ -462,7 +462,7 @@ begin | ||
462 | 462 | // MRirÌtH[JXðDÁÄéÌÅtH[ɳâèÔ· |
463 | 463 | Blur; |
464 | 464 | // ©ªÅ©ªÍÁ¹È¢ÌÅAbZ[WoRÅÁµÄàç¤ |
465 | - PostMessage( GikoForm.Handle , USER_RESPOPUPCLEAR, Integer( Self ), 0 ); | |
465 | + PostMessage( GikoForm.Handle , USER_POPUPCLEAR, Integer( Self ), 0 ); | |
466 | 466 | Result := True; |
467 | 467 | end; |
468 | 468 | initialization |