ギコナビ
Revision | a421f9f8372e3a3994662a5fd982df0397dc0d0a (tree) |
---|---|
Time | 2007-05-19 07:43:35 |
Author | h677 <h677> |
Commiter | h677 |
レスポップアップにフォーカスが当たる問題はほぼ解消
@@ -1867,6 +1867,7 @@ var | ||
1867 | 1867 | Ext: string; |
1868 | 1868 | PathRec: TPathRec; |
1869 | 1869 | Text2: string; |
1870 | + cResPopup: TResPopupBrowser; | |
1870 | 1871 | begin |
1871 | 1872 | // MRirÍXAJ[ª about:blank.. ÅnÜé±ÆðúÒµÄ¢éª |
1872 | 1873 | // IE 7 ÅÍ about:blank.. ÅÍÈ about:.. ÉÈéÌÅAu··é(°âè) |
@@ -1901,9 +1902,6 @@ begin | ||
1901 | 1902 | end; |
1902 | 1903 | // OñƯ¶êI¹ |
1903 | 1904 | if (StatusBar.Panels[1].Text = Text2) then begin |
1904 | - {$IFDEF DEBUG} | |
1905 | - Writeln('Status Text is not changed!'); | |
1906 | - {$ENDIF} | |
1907 | 1905 | if Text2 = '' then begin |
1908 | 1906 | if FResPopupBrowser <> nil then begin |
1909 | 1907 | if not(Sender is TResPopupBrowser) then |
@@ -1930,10 +1928,12 @@ begin | ||
1930 | 1928 | TResPopupBrowser(Sender).ChildClear; |
1931 | 1929 | end; |
1932 | 1930 | end; |
1933 | - | |
1934 | - if not GikoSys.Setting.UnActivePopup then | |
1935 | - if not GikoForm.Active then | |
1936 | - Exit; | |
1931 | + cResPopup := nil; | |
1932 | + | |
1933 | + if not(Sender is TResPopupBrowser) then | |
1934 | + if not GikoSys.Setting.UnActivePopup then | |
1935 | + if not GikoForm.Active then | |
1936 | + Exit; | |
1937 | 1937 | |
1938 | 1938 | |
1939 | 1939 |
@@ -1963,16 +1963,17 @@ begin | ||
1963 | 1963 | e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y); |
1964 | 1964 | if (Assigned(e)) then begin |
1965 | 1965 | CreateResPopupBrowser; |
1966 | + cResPopup := FResPopupBrowser.CreateNewBrowser; | |
1966 | 1967 | tmp2 := ZenToHan(e.Get_outerText); |
1967 | 1968 | if (GikoSys.IsNumeric(tmp2)) then begin |
1968 | 1969 | //ÍXÔÁÛ¢Á·B |
1969 | 1970 | wkIntSt := StrToInt64(tmp2); |
1970 | 1971 | wkIntTo := StrToInt64(tmp2); |
1971 | - FResPopupBrowser.PopupType := gptThread; | |
1972 | - HTMLCreater.SetResPopupText(FResPopupBrowser.CreateNewBrowser, GetActiveContent, wkIntSt, wkIntTo, False, False); | |
1972 | + cResPopup.PopupType := gptThread; | |
1973 | + HTMLCreater.SetResPopupText(cResPopup, GetActiveContent, wkIntSt, wkIntTo, False, False); | |
1973 | 1974 | end else begin |
1974 | - FResPopupBrowser.CreateNewBrowser.PopupType := gptRaw; | |
1975 | - FResPopupBrowser.CreateNewBrowser.Title := s; | |
1975 | + cResPopup.PopupType := gptRaw; | |
1976 | + cResPopup.Title := s; | |
1976 | 1977 | end; |
1977 | 1978 | end; |
1978 | 1979 | end else begin |
@@ -2029,21 +2030,23 @@ begin | ||
2029 | 2030 | wkIntTo := 1; |
2030 | 2031 | end; |
2031 | 2032 | CreateResPopupBrowser; |
2032 | - FResPopupBrowser.CreateNewBrowser.PopupType := gptThread; | |
2033 | - HTMLCreater.SetResPopupText(FResPopupBrowser.CreateNewBrowser, threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst ); | |
2033 | + cResPopup := FResPopupBrowser.CreateNewBrowser; | |
2034 | + cResPopup.PopupType := gptThread; | |
2035 | + HTMLCreater.SetResPopupText(cResPopup, threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst ); | |
2034 | 2036 | end; |
2035 | 2037 | end; |
2036 | 2038 | end; |
2037 | - CreateResPopupBrowser; | |
2038 | - if FResPopupBrowser.CreateNewBrowser.PopupType = gptRaw then begin | |
2039 | - if FResPopupBrowser.CreateNewBrowser.Title <> '' then begin | |
2040 | - FResPopupBrowser.CreateNewBrowser.TitlePopup; | |
2041 | - end; | |
2042 | - end else begin | |
2043 | - if FResPopupBrowser.CreateNewBrowser.RawDocument <> '' then begin | |
2044 | - FResPopupBrowser.CreateNewBrowser.Popup; | |
2045 | - end else if FResPopupBrowser.CreateNewBrowser.Title <> '' then begin | |
2046 | - FResPopupBrowser.CreateNewBrowser.TitlePopup; | |
2039 | + if (cResPopup <> nil) then begin | |
2040 | + if cResPopup.PopupType = gptRaw then begin | |
2041 | + if cResPopup.Title <> '' then begin | |
2042 | + cResPopup.TitlePopup; | |
2043 | + end; | |
2044 | + end else begin | |
2045 | + if cResPopup.RawDocument <> '' then begin | |
2046 | + cResPopup.Popup; | |
2047 | + end else if cResPopup.Title <> '' then begin | |
2048 | + cResPopup.TitlePopup; | |
2049 | + end; | |
2047 | 2050 | end; |
2048 | 2051 | end; |
2049 | 2052 | end; |
@@ -2203,7 +2206,9 @@ var | ||
2203 | 2206 | const |
2204 | 2207 | kMenuName: string = 'menu:'; |
2205 | 2208 | begin |
2206 | - | |
2209 | +{$IFDEF DEBUG} | |
2210 | + Writeln(URL); | |
2211 | +{$ENDIF} | |
2207 | 2212 | if Pos(kMenuName, URL) <> 0 then begin |
2208 | 2213 | sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) ); |
2209 | 2214 |
@@ -3738,16 +3743,17 @@ var | ||
3738 | 3743 | BNum, BRes: string; |
3739 | 3744 | threadItem: TThreadItem; |
3740 | 3745 | aElement : IHTMLElement; |
3746 | + rect: TRect; | |
3747 | + purl, pflag, pdata, ptarget, handler: OleVariant; | |
3741 | 3748 | begin |
3749 | +{$IFDEF DEBUG} | |
3750 | + Writeln(IntToStr(Integer(ppDisp))); | |
3751 | +{$ENDIF} | |
3742 | 3752 | Cancel := True; |
3743 | 3753 | aElement := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement; |
3744 | 3754 | if ( aElement <> nil) then begin |
3745 | 3755 | Text := aElement.Get_outerText; |
3746 | 3756 | Html := aElement.Get_outerHTML; |
3747 | - if (Sender is TResPopupBrowser) then begin | |
3748 | - TResPopupBrowser(Sender).ChildClear; | |
3749 | - FActiveContent.Browser.SetFocus; | |
3750 | - end; | |
3751 | 3757 | if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1) |
3752 | 3758 | or (AnsiPos('', Text) = 1) or (AnsiPos('', Text) = 1) then begin |
3753 | 3759 | if GikoSys.Setting.ResAnchorJamp then begin |
@@ -3773,12 +3779,13 @@ begin | ||
3773 | 3779 | end; |
3774 | 3780 | |
3775 | 3781 | if wkIntSt <> 0 then begin |
3776 | - FActiveContent.IDAnchorPopup(''); | |
3782 | + if (Sender is TResPopupBrowser) then begin | |
3783 | + TResPopupBrowser(Sender).ChildClear | |
3784 | + end; | |
3785 | + FActiveContent.IDAnchorPopup(''); | |
3777 | 3786 | MoveHisotryManager.pushItem(FActiveContent); |
3778 | 3787 | BrowserMovement(IntToStr(wkIntSt)); |
3779 | - end; | |
3780 | - | |
3781 | - | |
3788 | + end; | |
3782 | 3789 | end; |
3783 | 3790 | end else begin |
3784 | 3791 | ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num |
@@ -3808,11 +3815,15 @@ begin | ||
3808 | 3815 | AddressComboBox.Items.Insert(0, URL); |
3809 | 3816 | end; |
3810 | 3817 | end; |
3818 | + if (Sender is TResPopupBrowser) then begin | |
3819 | + TResPopupBrowser(Sender).ChildClear | |
3820 | + end; | |
3821 | + | |
3811 | 3822 | MoveHisotryManager.pushItem(FActiveContent); |
3812 | 3823 | MoveToURL( URL ); |
3813 | 3824 | end; |
3814 | 3825 | end; |
3815 | - end; | |
3826 | + end; | |
3816 | 3827 | |
3817 | 3828 | end; |
3818 | 3829 |
@@ -4650,6 +4661,7 @@ begin | ||
4650 | 4661 | if (Sender is TWebBrowser) then begin |
4651 | 4662 | TWebBrowser(Sender).DoObjectVerb(OLEIVERB_UIACTIVATE); |
4652 | 4663 | end; |
4664 | +// Browser.DoObjectVerb(OLEIVERB_UIACTIVATE); | |
4653 | 4665 | end; |
4654 | 4666 | |
4655 | 4667 | procedure TGikoForm.WMCopyData(var Message: TWMCopyData); |
@@ -7242,7 +7254,7 @@ begin | ||
7242 | 7254 | if PreviewTimer.Enabled then |
7243 | 7255 | PreviewTimer.Enabled := False; |
7244 | 7256 | //tH[JXª¼ÌAvÉÏíÁ½Æ«É|bvAbvÁ |
7245 | - if FResPopupBrowser <> nil then | |
7257 | + if (FResPopupBrowser <> nil) then | |
7246 | 7258 | FResPopupBrowser.Clear; |
7247 | 7259 | |
7248 | 7260 | //vr [ðB· |
@@ -7549,7 +7561,6 @@ procedure TGikoForm.CreateResPopupBrowser; | ||
7549 | 7561 | begin |
7550 | 7562 | if (FResPopupBrowser = nil) then begin |
7551 | 7563 | FResPopupBrowser := TResPopupBrowser.Create(BrowserPanel); |
7552 | - //ShowWindow(FResPopupBrowser.Handle, SW_HIDE); | |
7553 | 7564 | end; |
7554 | 7565 | end; |
7555 | 7566 |
@@ -45,10 +45,11 @@ type | ||
45 | 45 | procedure Write(ADocument: String; OnlyTitle: Boolean = False); |
46 | 46 | procedure Clear; |
47 | 47 | procedure ChildClear; |
48 | - procedure NavigateBlank; | |
48 | + procedure NavigateBlank(Forced: Boolean); | |
49 | 49 | property PopupType: TGikoPopupType read FPopupType write FPopupType; |
50 | 50 | procedure TitlePopup; |
51 | 51 | procedure Popup; |
52 | + procedure Blur; | |
52 | 53 | end; |
53 | 54 | |
54 | 55 | implementation |
@@ -103,23 +104,27 @@ begin | ||
103 | 104 | end else begin |
104 | 105 | FChild := TResPopupBrowser.Create(Self); |
105 | 106 | FChild.ParentBrowser := Self; |
106 | - FChild.NavigateBlank; | |
107 | + FChild.NavigateBlank(False); | |
108 | + FChild.OnEnter := GikoForm.BrowserEnter; | |
107 | 109 | FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2; |
108 | 110 | FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange; |
109 | 111 | FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2; |
110 | 112 | SetWindowPos(FChild.Handle, HWND_BOTTOM, |
111 | 113 | 0, 0, 0 , 0, |
114 | +// SWP_NOZORDER or | |
112 | 115 | SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW); |
113 | 116 | Result := FChild; |
114 | 117 | end; |
115 | 118 | end else begin |
116 | 119 | FParentBrowser := nil; |
117 | - Self.NavigateBlank; | |
120 | + Self.NavigateBlank(False); | |
121 | + Self.OnEnter := GikoForm.BrowserEnter; | |
118 | 122 | Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2; |
119 | 123 | Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange; |
120 | 124 | Self.OnNewWindow2 := GikoForm.BrowserNewWindow2; |
121 | 125 | SetWindowPos(Self.Handle, HWND_BOTTOM, |
122 | 126 | 0, 0, 0 , 0, |
127 | +// SWP_NOZORDER or | |
123 | 128 | SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW); |
124 | 129 | Result := Self; |
125 | 130 | end; |
@@ -130,13 +135,14 @@ begin | ||
130 | 135 | if (Result.ParentBrowser <> nil) then |
131 | 136 | Result := Result.ParentBrowser; |
132 | 137 | end; |
133 | -procedure TResPopupBrowser.NavigateBlank; | |
138 | +procedure TResPopupBrowser.NavigateBlank(Forced: Boolean); | |
134 | 139 | begin |
135 | - if (not Assigned(Self.Document)) then begin | |
140 | + if (not Assigned(Self.Document)) or (Forced) then begin | |
136 | 141 | Self.Navigate('about:blank'); |
137 | 142 | end; |
138 | 143 | while (Self.ReadyState <> READYSTATE_COMPLETE) and |
139 | 144 | (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin |
145 | + Sleep(1); | |
140 | 146 | Forms.Application.ProcessMessages; |
141 | 147 | end; |
142 | 148 | end; |
@@ -152,13 +158,10 @@ procedure TResPopupBrowser.Write(ADocument: String; OnlyTitle: Boolean = False); | ||
152 | 158 | var |
153 | 159 | p: TPoint; |
154 | 160 | doc: Variant; |
155 | - ARect: TRect; | |
161 | + ARect, rect: TRect; | |
156 | 162 | FDispHtmlDocument: DispHTMLDocument; |
157 | - mainActive: Boolean; | |
158 | 163 | begin |
159 | 164 | try |
160 | - mainActive := GikoForm.Active; | |
161 | - | |
162 | 165 | // ^XNo[©çÁ· |
163 | 166 | SetWindowLongA(Self.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); |
164 | 167 | GetCursorpos(p); |
@@ -170,14 +173,15 @@ begin | ||
170 | 173 | doc.open; |
171 | 174 | doc.charset := 'Shift_JIS'; |
172 | 175 | doc.Write('<html><head>'#13#10 + |
173 | - '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10 | |
176 | + '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10 + | |
177 | + '<meta http-equiv="Pragma" content="no-cache">'#13#10 + | |
178 | + '<meta http-equiv="Cache-Control" content="no-cache">'#13#10 | |
174 | 179 | + GetBodyStyle(OnlyTitle) + '</head><body>' |
175 | 180 | + GetTitle(OnlyTitle) |
176 | 181 | + ADocument + '<a name="bottom"></a></body></html>'); |
177 | 182 | |
178 | 183 | doc.Close; |
179 | 184 | |
180 | - | |
181 | 185 | ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth, |
182 | 186 | not OnlyTitle); |
183 | 187 |
@@ -191,11 +195,7 @@ begin | ||
191 | 195 | (ARect.Right - ARect.Left) , |
192 | 196 | (ARect.Bottom - ARect.Top), |
193 | 197 | SWP_NOACTIVATE or SWP_HIDEWINDOW); |
194 | - | |
195 | 198 | ShowWindow(Self.Handle, SW_SHOWNOACTIVATE); |
196 | - if mainActive <> GikoForm.Active then begin | |
197 | - GikoForm.SetFocus; | |
198 | - end; | |
199 | 199 | except |
200 | 200 | end; |
201 | 201 | end; |
@@ -237,15 +237,17 @@ begin | ||
237 | 237 | end; |
238 | 238 | |
239 | 239 | procedure TResPopupBrowser.Clear; |
240 | +var | |
241 | + rect: TRect; | |
240 | 242 | begin |
241 | 243 | ChildClear; |
242 | 244 | if (Self.Visible) then begin |
243 | 245 | Self.Title := ''; |
244 | 246 | Self.RawDocument := ''; |
245 | 247 | Self.FThread := nil; |
246 | - FEvent.Free; | |
247 | - FEvent := nil; | |
248 | - NavigateBlank; | |
248 | + Self.FEvent.Free; | |
249 | + Self.FEvent := nil; | |
250 | + Self.Blur; | |
249 | 251 | ShowWindow(Self.Handle, SW_HIDE); |
250 | 252 | Self.Visible := False; |
251 | 253 | end; |
@@ -296,7 +298,7 @@ begin | ||
296 | 298 | if (Result.Bottom > MaxHeight) then begin |
297 | 299 | OffsetRect(Result, 0, - (Result.Bottom - MaxHeight)); |
298 | 300 | end; |
299 | - | |
301 | + | |
300 | 302 | // ±±ÅÄx¶ÆãðmFµÄòÑoµÄ½çAæÊTCY𬳷é |
301 | 303 | if (Result.Left < 0) then begin |
302 | 304 | Result := Rect(0, Result.Top, |
@@ -335,10 +337,8 @@ begin | ||
335 | 337 | end; |
336 | 338 | function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool; |
337 | 339 | begin |
338 | - if (not GikoSys.Setting.UnActivePopup) then begin | |
339 | - // MRirÌtH[JXðDÁÄéÌÅtH[ɳâèÔ· | |
340 | - GikoForm.SetFocus; | |
341 | - end; | |
340 | + // MRirÌtH[JXðDÁÄéÌÅtH[ɳâèÔ· | |
341 | + Blur; | |
342 | 342 | Result := True; |
343 | 343 | end; |
344 | 344 | function TResPopupBrowser.GetThread: TThreadItem; |
@@ -356,4 +356,36 @@ begin | ||
356 | 356 | end; |
357 | 357 | end; |
358 | 358 | end; |
359 | +procedure TResPopupBrowser.Blur; | |
360 | +var | |
361 | + rect: TRect; | |
362 | +begin | |
363 | + if ((Self.Document as IHTMLDocument2).activeElement <> nil) then begin | |
364 | + // tH[JXOµ | |
365 | + Windows.GetClientRect(Self.Handle, rect); | |
366 | + if (Self.ParentBrowser <> nil) then begin | |
367 | + (Self.Application as IOleObject).DoVerb(OLEIVERB_DISCARDUNDOSTATE, (* iVerb *) | |
368 | + nil, (* lpMsg *) | |
369 | + Self, (* pActiveSite *) | |
370 | + 0, (* lindex - reserved *) | |
371 | + Self.ParentBrowser.Handle, (* hwndParent *) | |
372 | + rect); (* display rectangle *) | |
373 | + Self.ParentBrowser.Blur; | |
374 | + end else begin | |
375 | + (Self.Application as IOleObject).DoVerb(OLEIVERB_DISCARDUNDOSTATE, (* iVerb *) | |
376 | + nil, (* lpMsg *) | |
377 | + Self, (* pActiveSite *) | |
378 | + 0, (* lindex - reserved *) | |
379 | + GikoForm.ActiveContent.Browser.Handle, (* hwndParent *) | |
380 | + rect); (* display rectangle *) | |
381 | + end; | |
382 | + end; | |
383 | +end; | |
384 | + | |
385 | +initialization | |
386 | + OleInitialize(nil); | |
387 | + | |
388 | +finalization | |
389 | + OleUninitialize; | |
390 | + | |
359 | 391 | end. |