Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/ResPopupBrowser.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.12 by h677, Sat May 19 05:06:06 2007 UTC revision 1.1.2.13 by h677, Sun May 27 13:11:20 2007 UTC
# Line 112  begin Line 112  begin
112              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;              FChild.OnNewWindow2 := GikoForm.BrowserNewWindow2;
113              SetWindowPos(FChild.Handle, HWND_BOTTOM,              SetWindowPos(FChild.Handle, HWND_BOTTOM,
114                  0, 0, 0 , 0,                  0, 0, 0 , 0,
 //                SWP_NOZORDER or  
115                  SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);                  SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
116              Result := FChild;              Result := FChild;
117          end;          end;
# Line 125  begin Line 124  begin
124          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;          Self.OnNewWindow2 := GikoForm.BrowserNewWindow2;
125          SetWindowPos(Self.Handle, HWND_BOTTOM,          SetWindowPos(Self.Handle, HWND_BOTTOM,
126              0, 0, 0 , 0,              0, 0, 0 , 0,
 //            SWP_NOZORDER or  
127              SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);              SWP_NOSIZE or SWP_NOMOVE or  SWP_NOACTIVATE or SWP_HIDEWINDOW);
128          Result := Self;          Result := Self;
129      end;      end;
# Line 262  function TResPopupBrowser.CalcRect(MaxHe Line 260  function TResPopupBrowser.CalcRect(MaxHe
260  var  var
261          p: TPoint;          p: TPoint;
262      ele: IHTMLElement2;      ele: IHTMLElement2;
263      h, w: Integer;      h, w, dx1, dx2, dy1, dy2: Integer;
264  begin  begin
265          GetCursorpos(p);          GetCursorpos(p);
266      ele := ((Self.Document as IHTMLDocument2).body as IHTMLElement2);      ele := ((Self.Document as IHTMLDocument2).body as IHTMLElement2);
# Line 273  begin Line 271  begin
271          h := GetWindowHeight + 5;          h := GetWindowHeight + 5;
272          w := ele.scrollWidth + 10;          w := ele.scrollWidth + 10;
273      end;      end;
274    
275        dx1 := 0; dx2 := 0;
276        dy1 := 0; dy2 := 0;
277    
278          Result := Rect(0, 0, w, h);          Result := Rect(0, 0, w, h);
279      case GikoSys.Setting.PopupPosition of      case GikoSys.Setting.PopupPosition of
280          gppRightTop:            OffsetRect(Result, p.x - w - 2, p.y - h - 2);          gppRightTop:
281          gppRight:                       OffsetRect(Result, p.x - w - 2, p.y - (h div 2));          begin
282          gppRightBottom: OffsetRect(Result, p.x - w -2, p.y + 2);              dx1 := -w; dx2 := -2;
283          gppTop:                                 OffsetRect(Result, p.x - (w div 2), p.y - h - 2);              dy1 := -h; dy2 := -2;
284          gppCenter:                      OffsetRect(Result, p.x - (w div 2), p.y - (h div 2));          end;
285          gppBottom:                      OffsetRect(Result, p.x - (w div 2), p.y + 2);          gppRight:
286          gppLeftTop:                     OffsetRect(Result, p.x + 2, p.y - h - 2);          begin
287          gppLeft:                                OffsetRect(Result, p.x + 2, p.y - (h div 2));              dx1 := -w; dx2 := -2;
288          gppLeftBottom:  OffsetRect(Result, p.x + 2, p.y + 2);              dy1 := - (h div 2); dy2 := 0;
289            end;
290            gppRightBottom:
291            begin
292                dx1 := -w; dx2 := -2;
293                dy1 := 0; dy2 := +2;
294            end;
295            gppTop:
296            begin
297                dx1 := - (w div 2); dx2 := 0;
298                dy1 := -h; dy2 := -2;
299            end;
300            // 廃止 gppCenter: OffsetRect(Result, p.x - (w div 2), p.y - (h div 2));
301            gppBottom:
302            begin
303                dx1 := - (w div 2); dx2 := 0;
304                dy1 := 0; dy2 := +2;
305            end;
306            gppLeftTop:
307            begin
308                dx1 := 0; dx2 := +2;
309                dy1 := -h; dy2 := -2;
310            end;
311            gppLeft:
312            begin
313                dx1 := 0; dx2 := +2;
314                dy1 := - (h div 2); dy2 := 0;
315            end;
316            gppLeftBottom:
317            begin
318                dx1 := 0; dx2 := +2;
319                dy1 := 0; dy2 := +2;
320            end;
321      end;      end;
322        // 初期位置に移動
323        OffsetRect(Result, p.x + dx1 + dx2, p.y + dy1 + dy2);
324    
325        // 以下、初期位置に問題があるときの移動
326      if (Result.Left < 0) then begin      if (Result.Left < 0) then begin
327          OffsetRect(Result, -Result.Left, 0);          // 逆サイドに余裕があれば、出力位置の左右転換
328            if (p.X * 2 < MaxWidth) then begin
329                if ( (GikoSys.Setting.PopupPosition = gppTop) or
330                    (GikoSys.Setting.PopupPosition = gppBottom)) then begin
331                    OffsetRect(Result, -Result.Left, 0);
332                end else begin
333                    OffsetRect(Result, - (dx1 + 2 * dx2), 0);
334                end;
335            end else begin
336                // 画面端まで画面幅を小さくする
337                Result := Rect(0, Result.Top,
338                    Result.Right, Result.Bottom);
339            end;
340      end;      end;
341      if (Result.Top < 0) then begin      if (Result.Top < 0) then begin
342          OffsetRect(Result, 0, -Result.Top);          // 底側に余裕があれば、出力位置の上下転換
343            if (p.Y * 2 < MaxHeight) then begin
344                OffsetRect(Result, 0, - (dy1 + 2 * dy2));
345            end else begin
346                // 画面端まで画面高を小さくする
347                Result := Rect(Result.Left, 0,
348                    Result.Right, Result.Bottom);
349            end;
350      end;      end;
351      if (Result.Right > MaxWidth) then begin      if (Result.Right > MaxWidth) then begin
352          OffsetRect(Result, - (Result.Right - MaxWidth), 0);          // 逆サイドに余裕があれば、出力位置の左右転換
353            if (p.X * 2 > MaxWidth) then begin
354                if( (GikoSys.Setting.PopupPosition = gppTop) or
355                    (GikoSys.Setting.PopupPosition = gppBottom)) then begin
356                    OffsetRect(Result, -(Result.Right - MaxWidth), 0);
357                end else begin
358                    OffsetRect(Result, -w - (dx1 + 2 * dx2), 0);
359                end;
360            end else begin
361                // 画面端まで画面幅を小さくする
362                Result := Rect(Result.Left, Result.Top,
363                    MaxWidth, Result.Bottom);
364            end;
365      end;      end;
366      if (Result.Bottom > MaxHeight) then begin      if (Result.Bottom > MaxHeight) then begin
367          OffsetRect(Result, 0, - (Result.Bottom - MaxHeight));          // 上側に余裕があれば、出力位置の上下転換
368      end;          if (p.Y * 2 > MaxHeight) then begin
369                OffsetRect(Result, 0, -h - (dy1 + 2 * dy2));
370      // ここで再度左と上を確認して飛び出してたら、画面サイズを小さくする          end else begin
371      if (Result.Left < 0) then begin              // 画面端まで画面高を小さくする
372          Result := Rect(0, Result.Top,              Result := Rect(Result.Left, Result.Top,
373              Result.Right, Result.Bottom);                  Result.Right, 0);
374      end;          end;
     if (Result.Top < 0) then begin  
         Result := Rect(Result.Left, 0,  
             Result.Right, Result.Bottom);  
375      end;      end;
376  end;  end;
377  function TResPopupBrowser.GetWindowHeight : Integer;  function TResPopupBrowser.GetWindowHeight : Integer;

Legend:
Removed from v.1.1.2.12  
changed lines
  Added in v.1.1.2.13

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26