• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscaphegui翻訳comegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

ギコナビ


Commit MetaInfo

Revision32dd222766593778018385afa93d4abc10c28f16 (tree)
Time2007-05-11 00:29:42
Authorh677 <h677>
Commiterh677

Log Message

背景色の設定、フォント設定、ウィンドウサイズ、ウィンドウ位置
の不具合の修正

Change Summary

Incremental Difference

--- a/ResPopupBrowser.pas
+++ b/ResPopupBrowser.pas
@@ -19,6 +19,7 @@ type
1919 FTitle :String;
2020 FPopupType: TGikoPopupType;
2121 function GetBodyStyle(): string;
22+ function GetWindowHeight : Integer;
2223 protected
2324 procedure CreateParams(var Params: TCreateParams); override;
2425 public
@@ -31,7 +32,7 @@ type
3132 procedure Clear;
3233 procedure ChildClear;
3334 procedure NavigateBlank;
34- function CalcRect(MaxWidth: Integer): TRect;
35+ function CalcRect(MaxHeight: Integer; MaxWidth: Integer): TRect;
3536 property PopupType: TGikoPopupType read FPopupType write FPopupType;
3637 end;
3738
@@ -103,43 +104,43 @@ var
103104 ARect: TRect;
104105 begin
105106 try
107+ // ‚¢‚Á‚½‚ñk¬
108+ SetWindowPos(Self.Handle, HWND_TOP,
109+ 0, 0, 50 , 50,
110+ SWP_NOMOVE or SWP_NOACTIVATE or SWP_HIDEWINDOW);
111+
106112 doc := Idispatch( olevariant(Self.ControlInterface).Document) as IHTMLDocument2;
107113 doc.open;
108114 doc.charset := 'Shift_JIS';
109115 doc.Write('<html><head>'#13#10 +
110116 '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10 +
111117 Title + GetBodyStyle + '</head><body>' +
112- ADocument + '</body></html>');
118+ ADocument + '<a name="bottom"></a></body></html>');
113119 doc.Close;
114120
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);
121+ ARect := CalcRect(Screen.Height, Screen.Width);
122122 SetWindowPos(Self.Handle, HWND_TOP,
123123 ARect.Left, ARect.Top,
124124 (ARect.Right - ARect.Left) ,
125125 (ARect.Bottom - ARect.Top),
126126 SWP_NOACTIVATE or SWP_HIDEWINDOW);
127- Self.Visible := True;
128127 ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
129-
128+ Self.Visible := True;
130129 except
131130 end;
132131
133132 end;
134133
135134 function TResPopupBrowser.GetBodyStyle(): string;
135+var
136+ i : Integer;
136137 begin
137138
138139 Result := '<style type="text/css">' +
139140 'dl { margin :0px; padding :0px}'#13#10 +
140141 'body { ' +
141142 'border-width: 1px; border-style: solid;white-space: nowrap; ' +
142- 'margin: 2px 4px 0px 0px; padding: 0px 4px 0px 0px';
143+ 'margin: 2px 4px 0px 0px; padding: 0px 4px 0px 0px; ';
143144
144145 if Length( GikoSys.Setting.HintFontName ) > 0 then
145146 Result := Result + 'font-family:"' + GikoSys.Setting.HintFontName + '";';
@@ -147,12 +148,11 @@ begin
147148 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.HintFontSize ) + 'pt;';
148149 if GikoSys.Setting.HintFontColor <> -1 then
149150 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.HintFontColor, 6 ) + ';';
150- if GikoSys.Setting.HintBackColor <> -1 then
151+ if GikoSys.Setting.HintBackColor <> -1 then begin
152+ i := ColorToRGB( GikoSys.Setting.HintBackColor );
151153 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 ) + ';';
154+ IntToHex( (i shr 16) or (i and $ff00) or ((i and $ff) shl 16), 6 ) + ';';
155+ end;
156156
157157 Result := Result + '}</style>';
158158 end;
@@ -173,25 +173,26 @@ begin
173173 end;
174174 end;
175175
176-function TResPopupBrowser.CalcRect(MaxWidth: Integer): TRect;
176+function TResPopupBrowser.CalcRect(MaxHeight: Integer; MaxWidth: Integer): TRect;
177177 var
178178 p: TPoint;
179179 ele: IHTMLElement2;
180+ h, w: Integer;
180181 begin
181182 GetCursorpos(p);
182183 ele := ((Self.Document as IHTMLDocument2).body as IHTMLElement2);
183- Result := Rect(0, 0,
184- ele.scrollWidth + 15,
185- ele.scrollHeight + 15);
184+ h := GetWindowHeight + 25;
185+ w := ele.scrollWidth + 25;
186+ Result := Rect(0, 0, w, h);
186187 case GikoSys.Setting.PopupPosition of
187- gppRightTop: OffsetRect(Result, p.x - (Result.Right - Result.Left) - 2, p.y - (Result.Bottom - Result.Top) - 2);
188- gppRight: OffsetRect(Result, p.x - (Result.Right - Result.Left) - 2, p.y - ((Result.Bottom - Result.Top) div 2));
189- gppRightBottom: OffsetRect(Result, p.x - (Result.Right - Result.Left) -2, p.y + 2);
190- gppTop: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y - (Result.Bottom - Result.Top) - 2);
191- gppCenter: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y - ((Result.Bottom - Result.Top) div 2));
192- gppBottom: OffsetRect(Result, p.x - ((Result.Right - Result.Left) div 2), p.y + 2);
193- gppLeftTop: OffsetRect(Result, p.x + 2, p.y - (Result.Bottom - Result.Top) - 2);
194- gppLeft: OffsetRect(Result, p.x + 2, p.y - ((Result.Bottom - Result.Top) div 2));
188+ gppRightTop: OffsetRect(Result, p.x - w - 2, p.y - h - 2);
189+ gppRight: OffsetRect(Result, p.x - w - 2, p.y - (h div 2));
190+ gppRightBottom: OffsetRect(Result, p.x - w -2, p.y + 2);
191+ gppTop: OffsetRect(Result, p.x - (w div 2), p.y - h - 2);
192+ gppCenter: OffsetRect(Result, p.x - (w div 2), p.y - (h div 2));
193+ gppBottom: OffsetRect(Result, p.x - (w div 2), p.y + 2);
194+ gppLeftTop: OffsetRect(Result, p.x + 2, p.y - h - 2);
195+ gppLeft: OffsetRect(Result, p.x + 2, p.y - (h div 2));
195196 gppLeftBottom: OffsetRect(Result, p.x + 2, p.y + 2);
196197 end;
197198 if (Result.Left < 0) then begin
@@ -200,6 +201,45 @@ begin
200201 if (Result.Top < 0) then begin
201202 OffsetRect(Result, 0, -Result.Top);
202203 end;
204+ if (Result.Right > MaxWidth) then begin
205+ OffsetRect(Result, - (Result.Right - MaxWidth), 0);
206+ end;
207+ if (Result.Bottom > MaxHeight) then begin
208+ OffsetRect(Result, 0, - (Result.Bottom - MaxHeight));
209+ end;
210+ // ‚±‚±‚ōēx¶‚Əã‚ðŠm”F‚µ‚Ä”ò‚яo‚µ‚Ä‚½‚çA‰æ–ʃTƒCƒY‚ð¬‚³‚­‚·‚é
211+ if (Result.Left < 0) then begin
212+ Result := Rect(0, Result.Top,
213+ Result.Right, Result.Bottom);
214+ end;
215+ if (Result.Top < 0) then begin
216+ Result := Rect(Result.Left, 0,
217+ Result.Right, Result.Bottom);
218+ end;
203219 end;
220+function TResPopupBrowser.GetWindowHeight : Integer;
221+var
222+ top: Integer;
223+ item: OleVariant;
224+begin
225+ //ƒuƒ‰ƒEƒU‚ªƒf[ƒ^‚̓ǂݍž‚Ý’†‚ÌŽž‚͓ǂݍž‚Ý‚ð‘Ò‚Â
226+ while (Self.ReadyState <> READYSTATE_COMPLETE) and
227+ (Self.ReadyState <> READYSTATE_INTERACTIVE) do begin
228+ Sleep(1);
229+ Forms.Application.ProcessMessages;
230+ end;
204231
232+ try
233+ top := 0;
234+ item := OleVariant( Self.Document as IHTMLDocument2)
235+ .anchors.item(OleVariant('bottom'));
236+ item.focus();
237+ repeat
238+ top := top + item.offsetTop;
239+ item := item.offsetParent;
240+ until AnsiCompareText(item.tagName, 'body' ) = 0;
241+ Result := top;
242+ except
243+ end;
244+end;
205245 end.