• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ギコナビ


Commit MetaInfo

Revisiona421f9f8372e3a3994662a5fd982df0397dc0d0a (tree)
Time2007-05-19 07:43:35
Authorh677 <h677>
Commiterh677

Log Message

レスポップアップにフォーカスが当たる問題はほぼ解消

Change Summary

Incremental Difference

--- a/Giko.pas
+++ b/Giko.pas
@@ -1867,6 +1867,7 @@ var
18671867 Ext: string;
18681868 PathRec: TPathRec;
18691869 Text2: string;
1870+ cResPopup: TResPopupBrowser;
18701871 begin
18711872 // ƒMƒRƒiƒr‚̓ŒƒXƒAƒ“ƒJ[‚ª about:blank.. ‚ÅŽn‚܂邱‚Æ‚ðŠú‘Ò‚µ‚Ä‚¢‚邪
18721873 // IE 7 ‚Å‚Í about:blank.. ‚Å‚Í‚È‚­ about:.. ‚É‚È‚é‚̂ŁA’uŠ·‚·‚é(“Š‚°‚â‚è)
@@ -1901,9 +1902,6 @@ begin
19011902 end;
19021903 // ‘O‰ñ‚Æ“¯‚¶ê‡I—¹
19031904 if (StatusBar.Panels[1].Text = Text2) then begin
1904- {$IFDEF DEBUG}
1905- Writeln('Status Text is not changed!');
1906- {$ENDIF}
19071905 if Text2 = '' then begin
19081906 if FResPopupBrowser <> nil then begin
19091907 if not(Sender is TResPopupBrowser) then
@@ -1930,10 +1928,12 @@ begin
19301928 TResPopupBrowser(Sender).ChildClear;
19311929 end;
19321930 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;
19371937
19381938
19391939
@@ -1963,16 +1963,17 @@ begin
19631963 e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
19641964 if (Assigned(e)) then begin
19651965 CreateResPopupBrowser;
1966+ cResPopup := FResPopupBrowser.CreateNewBrowser;
19661967 tmp2 := ZenToHan(e.Get_outerText);
19671968 if (GikoSys.IsNumeric(tmp2)) then begin
19681969 //‚“‚̓ŒƒX”ԍ†‚Á‚Û‚¢‚Á‚·B
19691970 wkIntSt := StrToInt64(tmp2);
19701971 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);
19731974 end else begin
1974- FResPopupBrowser.CreateNewBrowser.PopupType := gptRaw;
1975- FResPopupBrowser.CreateNewBrowser.Title := s;
1975+ cResPopup.PopupType := gptRaw;
1976+ cResPopup.Title := s;
19761977 end;
19771978 end;
19781979 end else begin
@@ -2029,21 +2030,23 @@ begin
20292030 wkIntTo := 1;
20302031 end;
20312032 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 );
20342036 end;
20352037 end;
20362038 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;
20472050 end;
20482051 end;
20492052 end;
@@ -2203,7 +2206,9 @@ var
22032206 const
22042207 kMenuName: string = 'menu:';
22052208 begin
2206-
2209+{$IFDEF DEBUG}
2210+ Writeln(URL);
2211+{$ENDIF}
22072212 if Pos(kMenuName, URL) <> 0 then begin
22082213 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
22092214
@@ -3738,16 +3743,17 @@ var
37383743 BNum, BRes: string;
37393744 threadItem: TThreadItem;
37403745 aElement : IHTMLElement;
3746+ rect: TRect;
3747+ purl, pflag, pdata, ptarget, handler: OleVariant;
37413748 begin
3749+{$IFDEF DEBUG}
3750+ Writeln(IntToStr(Integer(ppDisp)));
3751+{$ENDIF}
37423752 Cancel := True;
37433753 aElement := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement;
37443754 if ( aElement <> nil) then begin
37453755 Text := aElement.Get_outerText;
37463756 Html := aElement.Get_outerHTML;
3747- if (Sender is TResPopupBrowser) then begin
3748- TResPopupBrowser(Sender).ChildClear;
3749- FActiveContent.Browser.SetFocus;
3750- end;
37513757 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
37523758 or (AnsiPos('„„', Text) = 1) or (AnsiPos('„', Text) = 1) then begin
37533759 if GikoSys.Setting.ResAnchorJamp then begin
@@ -3773,12 +3779,13 @@ begin
37733779 end;
37743780
37753781 if wkIntSt <> 0 then begin
3776- FActiveContent.IDAnchorPopup('');
3782+ if (Sender is TResPopupBrowser) then begin
3783+ TResPopupBrowser(Sender).ChildClear
3784+ end;
3785+ FActiveContent.IDAnchorPopup('');
37773786 MoveHisotryManager.pushItem(FActiveContent);
37783787 BrowserMovement(IntToStr(wkIntSt));
3779- end;
3780-
3781-
3788+ end;
37823789 end;
37833790 end else begin
37843791 ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num
@@ -3808,11 +3815,15 @@ begin
38083815 AddressComboBox.Items.Insert(0, URL);
38093816 end;
38103817 end;
3818+ if (Sender is TResPopupBrowser) then begin
3819+ TResPopupBrowser(Sender).ChildClear
3820+ end;
3821+
38113822 MoveHisotryManager.pushItem(FActiveContent);
38123823 MoveToURL( URL );
38133824 end;
38143825 end;
3815- end;
3826+ end;
38163827
38173828 end;
38183829
@@ -4650,6 +4661,7 @@ begin
46504661 if (Sender is TWebBrowser) then begin
46514662 TWebBrowser(Sender).DoObjectVerb(OLEIVERB_UIACTIVATE);
46524663 end;
4664+// Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
46534665 end;
46544666
46554667 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
@@ -7242,7 +7254,7 @@ begin
72427254 if PreviewTimer.Enabled then
72437255 PreviewTimer.Enabled := False;
72447256 //ƒtƒH[ƒJƒX‚ª‘¼‚̃AƒvƒŠ‚É•Ï‚í‚Á‚½‚Æ‚«‚Ƀ|ƒbƒvƒAƒbƒvÁ‹Ž
7245- if FResPopupBrowser <> nil then
7257+ if (FResPopupBrowser <> nil) then
72467258 FResPopupBrowser.Clear;
72477259
72487260 //ƒvƒŒƒrƒ…[‚ð‰B‚·
@@ -7549,7 +7561,6 @@ procedure TGikoForm.CreateResPopupBrowser;
75497561 begin
75507562 if (FResPopupBrowser = nil) then begin
75517563 FResPopupBrowser := TResPopupBrowser.Create(BrowserPanel);
7552- //ShowWindow(FResPopupBrowser.Handle, SW_HIDE);
75537564 end;
75547565 end;
75557566
--- a/ResPopupBrowser.pas
+++ b/ResPopupBrowser.pas
@@ -45,10 +45,11 @@ type
4545 procedure Write(ADocument: String; OnlyTitle: Boolean = False);
4646 procedure Clear;
4747 procedure ChildClear;
48- procedure NavigateBlank;
48+ procedure NavigateBlank(Forced: Boolean);
4949 property PopupType: TGikoPopupType read FPopupType write FPopupType;
5050 procedure TitlePopup;
5151 procedure Popup;
52+ procedure Blur;
5253 end;
5354
5455 implementation
@@ -103,23 +104,27 @@ begin
103104 end else begin
104105 FChild := TResPopupBrowser.Create(Self);
105106 FChild.ParentBrowser := Self;
106- FChild.NavigateBlank;
107+ FChild.NavigateBlank(False);
108+ FChild.OnEnter := GikoForm.BrowserEnter;
107109 FChild.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
108110 FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
109111 FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;
110112 SetWindowPos(FChild.Handle, HWND_BOTTOM,
111113 0, 0, 0 , 0,
114+// SWP_NOZORDER or
112115 SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW);
113116 Result := FChild;
114117 end;
115118 end else begin
116119 FParentBrowser := nil;
117- Self.NavigateBlank;
120+ Self.NavigateBlank(False);
121+ Self.OnEnter := GikoForm.BrowserEnter;
118122 Self.OnBeforeNavigate2 := GikoForm.BrowserBeforeNavigate2;
119123 Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
120124 Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;
121125 SetWindowPos(Self.Handle, HWND_BOTTOM,
122126 0, 0, 0 , 0,
127+// SWP_NOZORDER or
123128 SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW);
124129 Result := Self;
125130 end;
@@ -130,13 +135,14 @@ begin
130135 if (Result.ParentBrowser <> nil) then
131136 Result := Result.ParentBrowser;
132137 end;
133-procedure TResPopupBrowser.NavigateBlank;
138+procedure TResPopupBrowser.NavigateBlank(Forced: Boolean);
134139 begin
135- if (not Assigned(Self.Document)) then begin
140+ if (not Assigned(Self.Document)) or (Forced) then begin
136141 Self.Navigate('about:blank');
137142 end;
138143 while (Self.ReadyState <> READYSTATE_COMPLETE) and
139144 (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin
145+ Sleep(1);
140146 Forms.Application.ProcessMessages;
141147 end;
142148 end;
@@ -152,13 +158,10 @@ procedure TResPopupBrowser.Write(ADocument: String; OnlyTitle: Boolean = False);
152158 var
153159 p: TPoint;
154160 doc: Variant;
155- ARect: TRect;
161+ ARect, rect: TRect;
156162 FDispHtmlDocument: DispHTMLDocument;
157- mainActive: Boolean;
158163 begin
159164 try
160- mainActive := GikoForm.Active;
161-
162165 // ƒ^ƒXƒNƒo[‚©‚çÁ‚·
163166 SetWindowLongA(Self.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
164167 GetCursorpos(p);
@@ -170,14 +173,15 @@ begin
170173 doc.open;
171174 doc.charset := 'Shift_JIS';
172175 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
174179 + GetBodyStyle(OnlyTitle) + '</head><body>'
175180 + GetTitle(OnlyTitle)
176181 + ADocument + '<a name="bottom"></a></body></html>');
177182
178183 doc.Close;
179184
180-
181185 ARect := CalcRect(Screen.WorkAreaHeight, Screen.WorkAreaWidth,
182186 not OnlyTitle);
183187
@@ -191,11 +195,7 @@ begin
191195 (ARect.Right - ARect.Left) ,
192196 (ARect.Bottom - ARect.Top),
193197 SWP_NOACTIVATE or SWP_HIDEWINDOW);
194-
195198 ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
196- if mainActive <> GikoForm.Active then begin
197- GikoForm.SetFocus;
198- end;
199199 except
200200 end;
201201 end;
@@ -237,15 +237,17 @@ begin
237237 end;
238238
239239 procedure TResPopupBrowser.Clear;
240+var
241+ rect: TRect;
240242 begin
241243 ChildClear;
242244 if (Self.Visible) then begin
243245 Self.Title := '';
244246 Self.RawDocument := '';
245247 Self.FThread := nil;
246- FEvent.Free;
247- FEvent := nil;
248- NavigateBlank;
248+ Self.FEvent.Free;
249+ Self.FEvent := nil;
250+ Self.Blur;
249251 ShowWindow(Self.Handle, SW_HIDE);
250252 Self.Visible := False;
251253 end;
@@ -296,7 +298,7 @@ begin
296298 if (Result.Bottom > MaxHeight) then begin
297299 OffsetRect(Result, 0, - (Result.Bottom - MaxHeight));
298300 end;
299-
301+
300302 // ‚±‚±‚ōēx¶‚Əã‚ðŠm”F‚µ‚Ä”ò‚яo‚µ‚Ä‚½‚çA‰æ–ʃTƒCƒY‚ð¬‚³‚­‚·‚é
301303 if (Result.Left < 0) then begin
302304 Result := Rect(0, Result.Top,
@@ -335,10 +337,8 @@ begin
335337 end;
336338 function TResPopupBrowser.ResPopupBrowserClick(Sender: TObject): WordBool;
337339 begin
338- if (not GikoSys.Setting.UnActivePopup) then begin
339- // ƒMƒRƒiƒr‚̃tƒH[ƒJƒX‚ð’D‚Á‚Ä‚é‚̂ŃtƒH[ƒ€‚É–³—‚â‚è•Ô‚·
340- GikoForm.SetFocus;
341- end;
340+ // ƒMƒRƒiƒr‚̃tƒH[ƒJƒX‚ð’D‚Á‚Ä‚é‚̂ŃtƒH[ƒ€‚É–³—‚â‚è•Ô‚·
341+ Blur;
342342 Result := True;
343343 end;
344344 function TResPopupBrowser.GetThread: TThreadItem;
@@ -356,4 +356,36 @@ begin
356356 end;
357357 end;
358358 end;
359+procedure TResPopupBrowser.Blur;
360+var
361+ rect: TRect;
362+begin
363+ if ((Self.Document as IHTMLDocument2).activeElement <> nil) then begin
364+ // ƒtƒH[ƒJƒXŠO‚µ
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+
359391 end.
Binary files a/gikoNavi.res and b/gikoNavi.res differ