• 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

Revision19c15d5c303c8d40ea351d54f51d7b4c46b4e6ff (tree)
Time2007-05-09 06:27:45
Authorh677 <h677>
Commiterh677

Log Message

レスポップアップのフォントの設定、ウィンドウサイズの計算(バグあり)、クリック時の動作設定

Change Summary

Incremental Difference

--- a/Giko.pas
+++ b/Giko.pas
@@ -4840,7 +4840,7 @@ begin
48404840 if ThreadItem <> nil then begin
48414841 Num := StrToInt64(s);
48424842 FHint.PopupType := gptThread;
4843- HTMLCreater.SetResPopupText(FResPopupBrowser, ThreadItem, Num, Num, False, False);
4843+ HTMLCreater.SetResPopupText(FResPopupBrowser.CreateNewBrowser, ThreadItem, Num, Num, False, False);
48444844 if FHint.ResCount <> 0 then
48454845 ShowTextPopup;
48464846 Result := False;
--- a/HTMLCreate.pas
+++ b/HTMLCreate.pas
@@ -1288,7 +1288,6 @@ begin
12881288 if ThreadItem <> nil then begin
12891289 ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
12901290 ResLink.FKey := ChangeFileExt(ThreadItem.FileName, '');
1291- Html.Add('<DL>');
12921291 //if ThreadItem.IsBoardPlugInAvailable then begin
12931292 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
12941293 //===== ƒvƒ‰ƒOƒCƒ“‚É‚æ‚é•\Ž¦
@@ -1315,8 +1314,9 @@ begin
13151314 end;
13161315 end;
13171316 end;
1318- Html.Add('</DL>');
1319- Hint.Write(Html.Text);
1317+ if (Html.Count > 0) then begin
1318+ Hint.Write('<DL>' + Html.Text + '</DL>');
1319+ end;
13201320 end;
13211321 finally
13221322 Html.Free;
--- a/ResPopupBrowser.pas
+++ b/ResPopupBrowser.pas
@@ -2,7 +2,7 @@ unit ResPopupBrowser;
22 interface
33 uses
44 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
5- ActiveX, OleCtrls, HintWindow,
5+ ActiveX, OleCtrls, HintWindow,
66 {$IF Defined(DELPRO) }
77 SHDocVw,
88 MSHTML
@@ -18,6 +18,7 @@ type
1818 FChild :TResPopupBrowser;
1919 FTitle :String;
2020 FPopupType: TGikoPopupType;
21+ function GetBodyStyle(): string;
2122 protected
2223 procedure CreateParams(var Params: TCreateParams); override;
2324 public
@@ -43,6 +44,7 @@ begin
4344 inherited Create(AOwner);
4445 FChild := nil;
4546 Visible := False;
47+ Title := '';
4648 end;
4749
4850 destructor TResPopupBrowser.Destroy;
@@ -69,6 +71,7 @@ begin
6971 FChild.NavigateBlank;
7072 FChild.OnEnter := GikoForm.BrowserEnter;
7173 FChild.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
74+ FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;
7275 ShowWindow(FChild.Handle, SW_HIDE);
7376 Result := FChild;
7477 end;
@@ -77,6 +80,7 @@ begin
7780 Self.NavigateBlank;
7881 Self.OnEnter := GikoForm.BrowserEnter;
7982 Self.OnStatusTextChange := GikoForm.BrowserStatusTextChange;
83+ Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;
8084 Result := Self;
8185 end;
8286
@@ -96,30 +100,68 @@ var
96100 doc: Variant;
97101 ARect: TRect;
98102 begin
103+ Self.Visible := True;
104+ ShowWindow(Self.Handle, SW_SHOW);
99105 try
100106 doc := Idispatch( olevariant(Self.ControlInterface).Document) as IHTMLDocument2;
101107 doc.open;
102108 doc.charset := 'Shift_JIS';
103- doc.Write('<html><body topmargin="2" leftmargin="2" style="border-width: 1px; border-style: solid;white-space: nowrap">'
104- + ADocument + '</body></html>');
109+ doc.Write('<html><head>'#13#10 +
110+ '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10 +
111+ Title + GetBodyStyle + '</head><body>' +
112+ ADocument + '</body></html>');
105113 doc.Close;
106- Self.Visible := True;
107114
108- ARect := CalcRect(Screen.Width);
109- SetWindowPos(Self.Handle, HWND_TOPMOST,
115+ while (Self.ReadyState <> READYSTATE_COMPLETE) and
116+ (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin
117+ Sleep(1);
118+ Forms.Application.ProcessMessages;
119+ end;
120+
121+ ARect := CalcRect(Screen.Width);
122+ SetWindowPos(Self.Handle, HWND_TOPMOST,
110123 ARect.Left, ARect.Top,
111124 (ARect.Right - ARect.Left) ,
112125 (ARect.Bottom - ARect.Top),
113126 SWP_NOACTIVATE or SWP_HIDEWINDOW);
114127
115- ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
128+ ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
129+
116130 except
117131 end;
132+
118133 end;
134+
135+function TResPopupBrowser.GetBodyStyle(): string;
136+begin
137+
138+ Result := '<style type="text/css">' +
139+ 'dl { margin :0px; padding :0px}'#13#10 +
140+ 'body { ' +
141+ 'border-width: 1px; border-style: solid;white-space: nowrap; ' +
142+ 'margin: 2px 4px 0px 0px; padding: 0px 4px 0px 0px';
143+
144+ if Length( GikoSys.Setting.HintFontName ) > 0 then
145+ Result := Result + 'font-family:"' + GikoSys.Setting.HintFontName + '";';
146+ if GikoSys.Setting.HintFontSize <> 0 then
147+ Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.HintFontSize ) + 'pt;';
148+ if GikoSys.Setting.HintFontColor <> -1 then
149+ Result := Result + 'color:#' + IntToHex( GikoSys.Setting.HintFontColor, 6 ) + ';';
150+ if GikoSys.Setting.HintBackColor <> -1 then
151+ Result := Result + 'background-color:#' +
152+ IntToHex(
153+ (GikoSys.Setting.HintBackColor shr 16) or
154+ (GikoSys.Setting.HintBackColor and $ff00) or
155+ ((GikoSys.Setting.HintBackColor and $ff) shl 16), 6 ) + ';';
156+
157+ Result := Result + '}</style>';
158+end;
159+
119160 procedure TResPopupBrowser.Clear;
120161 begin
121162 ChildClear;
122163 if (Self.Visible) then begin
164+ Self.Title := '';
123165 Self.Visible := False;
124166 ShowWindow(Self.Handle, SW_HIDE);
125167 end;
@@ -134,19 +176,24 @@ end;
134176 function TResPopupBrowser.CalcRect(MaxWidth: Integer): TRect;
135177 var
136178 p: TPoint;
179+ doc: Variant;
180+ ele: IHTMLElement2;
137181 begin
138182 GetCursorpos(p);
139- Result := Rect(0, 0, 500, 200);
183+ ele := ((Self.Document as IHTMLDocument2).body as IHTMLElement2);
184+ Result := Rect(0, 0,
185+ ele.scrollWidth + 15,
186+ ele.scrollHeight + 15);
140187 case GikoSys.Setting.PopupPosition of
141- gppRightTop: OffsetRect(Result, p.x - (Result.Right - Result.Left) - 5, p.y - (Result.Bottom - Result.Top) - 5);
142- gppRight: OffsetRect(Result, p.x - (Result.Right - Result.Left) - 5, p.y - ((Result.Bottom - Result.Top) div 2));
143- gppRightBottom: OffsetRect(Result, p.x - (Result.Right - Result.Left) - 5, p.y + 5);
144- gppTop: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y - (Result.Bottom - Result.Top) - 5);
188+ gppRightTop: OffsetRect(Result, p.x - (Result.Right - Result.Left), p.y - (Result.Bottom - Result.Top));
189+ gppRight: OffsetRect(Result, p.x - (Result.Right - Result.Left), p.y - ((Result.Bottom - Result.Top) div 2));
190+ gppRightBottom: OffsetRect(Result, p.x - (Result.Right - Result.Left), p.y);
191+ gppTop: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y - (Result.Bottom - Result.Top));
145192 gppCenter: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y - ((Result.Bottom - Result.Top) div 2));
146- gppBottom: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y + 5);
147- gppLeftTop: OffsetRect(Result, p.x + 5, p.y - (Result.Bottom - Result.Top) - 5);
148- gppLeft: OffsetRect(Result, p.x + 5, p.y - ((Result.Bottom - Result.Top) div 2));
149- gppLeftBottom: OffsetRect(Result, p.x + 5, p.y + 5); //ƒMƒRƒiƒrƒXƒŒ ƒp[ƒg‚P‚Ì453Ž‚ÉŠ´ŽÓ
193+ gppBottom: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y);
194+ gppLeftTop: OffsetRect(Result, p.x, p.y - (Result.Bottom - Result.Top));
195+ gppLeft: OffsetRect(Result, p.x, p.y - ((Result.Bottom - Result.Top) div 2));
196+ gppLeftBottom: OffsetRect(Result, p.x, p.y);
150197 end;
151198 if (Result.Left < 0) then begin
152199 OffsetRect(Result, -Result.Left, 0);
@@ -154,7 +201,6 @@ begin
154201 if (Result.Top < 0) then begin
155202 OffsetRect(Result, 0, -Result.Top);
156203 end;
157-
158204 end;
159205
160206 end.