OSDN Git Service

businessのスペル修正
[gikonavigoeson/gikonavi.git] / ResPopupBrowser.pas
index 11fd7ad..6039ba3 100644 (file)
@@ -29,6 +29,7 @@ type
         function GetTitle(OnlyTitle: Boolean): string;
                function CalcRect(WorkArea: TRect; Scroll: Boolean): TRect;
         function ResPopupBrowserClick(Sender: TObject): WordBool;
+        function ResPopupBrowserDbClick(Sender: TObject): WordBool;
         function GetThread: TThreadItem;
        protected
                procedure CreateParams(var Params: TCreateParams); override;
@@ -150,7 +151,16 @@ begin
 end;
 procedure TResPopupBrowser.Popup;
 begin
-    Write(Self.RawDocument, false);
+    if (GetAsyncKeyState(VK_SHIFT) = Smallint($8001)) then begin
+        // \83V\83t\83g\89\9f\82µ\82Ä\82é\8fê\8d\87\82Í\82»\82Ì\82Ü\82Ü\8fo\82·
+        Write(Self.RawDocument, false);
+    end else begin
+        // éx\82µ\8aG\82ª\8c©\82¦\82é\82æ\82¤\82É\94¼\8ap\83X\83y\81[\83X*2\82ð *2\82É\92u\8a·\82·\82é
+        Write(
+            MojuUtils.CustomStringReplace(
+                Self.RawDocument, '  ', '  '),
+            false);
+    end;
 end;
 procedure TResPopupBrowser.Write(ADocument: String; OnlyTitle: Boolean = False);
 var
@@ -179,13 +189,14 @@ begin
                 + ADocument + '<a name="bottom"></a></body></html>');
 
         doc.Close;
-
-        ARect := CalcRect(Screen.WorkAreaRect, not OnlyTitle);
+        // \83}\83\8b\83`\83\82\83j\83^\91Î\89\9e
+        ARect := CalcRect(Screen.MonitorFromPoint(p).WorkareaRect,
+                        not OnlyTitle);
 
         FDispHtmlDocument := Idispatch(OleVariant(Self.ControlInterface).Document) as DispHTMLDocument;
         FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
         FEvent.OnClick := ResPopupBrowserClick;
-
+        FEvent.OnDoubleClick := ResPopupBrowserDbClick;
         Self.Visible := True;
         SetWindowPos(Self.Handle, HWND_TOPMOST,
             ARect.Left, ARect.Top,
@@ -330,22 +341,22 @@ begin
     // \88È\89º\81A\8f\89\8aú\88Ê\92u\82É\96â\91è\82ª\82 \82é\82Æ\82«\82Ì\88Ú\93®
     if (Result.Left < WorkArea.Left) then begin
         // \8bt\83T\83C\83h\82É\97]\97T\82ª\82 \82ê\82Î\81A\8fo\97Í\88Ê\92u\82Ì\8d\89E\93]\8a·
-        if (p.X * 2 < MaxWidth) then begin
+        if ((p.X - WorkArea.Left) * 2 < MaxWidth) then begin
             if ( (GikoSys.Setting.PopupPosition = gppTop) or
                 (GikoSys.Setting.PopupPosition = gppBottom)) then begin
-                OffsetRect(Result, -Result.Left, WorkArea.Left);
+                OffsetRect(Result, -Result.Left, 0);
             end else begin
                 OffsetRect(Result, - (dx1 + 2 * dx2), 0);
             end;
         end else begin
             // \89æ\96Ê\92[\82Ü\82Å\89æ\96Ê\95\9d\82ð\8f¬\82³\82­\82·\82é
-            Result := Rect(0, Result.Top,
+            Result := Rect(WorkArea.Left, Result.Top,
                 Result.Right, Result.Bottom);
         end;
     end;
     if (Result.Top < WorkArea.Top) then begin
         // \92ê\91¤\82É\97]\97T\82ª\82 \82ê\82Î\81A\8fo\97Í\88Ê\92u\82Ì\8fã\89º\93]\8a·
-        if (p.Y * 2 < MaxHeight) then begin
+        if ((p.Y - WorkArea.Top) * 2 < MaxHeight) then begin
             OffsetRect(Result, 0, - (dy1 + 2 * dy2));
         end else begin
             // \89æ\96Ê\92[\82Ü\82Å\89æ\96Ê\8d\82\82ð\8f¬\82³\82­\82·\82é
@@ -355,7 +366,7 @@ begin
     end;
     if (Result.Right > WorkArea.Right) then begin
         // \8bt\83T\83C\83h\82É\97]\97T\82ª\82 \82ê\82Î\81A\8fo\97Í\88Ê\92u\82Ì\8d\89E\93]\8a·
-        if (p.X * 2 > WorkArea.Right) then begin
+        if ((p.X - WorkArea.Left) * 2 > WorkArea.Right) then begin
             if( (GikoSys.Setting.PopupPosition = gppTop) or
                 (GikoSys.Setting.PopupPosition = gppBottom)) then begin
                 OffsetRect(Result, -(Result.Right - WorkArea.Right), 0);
@@ -375,7 +386,7 @@ begin
     end;
     if (Result.Bottom > WorkArea.Bottom) then begin
         // \8fã\91¤\82É\97]\97T\82ª\82 \82ê\82Î\81A\8fo\97Í\88Ê\92u\82Ì\8fã\89º\93]\8a·
-        if (p.Y * 2 > WorkArea.Bottom) then begin
+        if ((p.Y - WorkArea.Top) * 2 > WorkArea.Bottom) then begin
             OffsetRect(Result, 0, -h - (dy1 + 2 * dy2));
             // \8fã\82É\8aÑ\82¢\82½\8fê\8d\87\82Í\81A
             if (Result.Top < WorkArea.Top) then begin
@@ -443,7 +454,14 @@ begin
     FOleInPlaceActiveObject := Self.ControlInterface as IOleInPlaceActiveObject;
     FOleInPlaceActiveObject.OnFrameWindowActivate(False);
 end;
-
+function TResPopupBrowser.ResPopupBrowserDbClick(Sender: TObject): WordBool;
+begin
+    // \83M\83R\83i\83r\82Ì\83t\83H\81[\83J\83X\82ð\92D\82Á\82Ä\82é\82Ì\82Å\83t\83H\81[\83\80\82É\96³\97\9d\82â\82è\95Ô\82·
+    Blur;
+    // \8e©\95ª\82Å\8e©\95ª\82Í\8fÁ\82¹\82È\82¢\82Ì\82Å\81A\83\81\83b\83Z\81[\83W\8co\97R\82Å\8fÁ\82µ\82Ä\82à\82ç\82¤
+    PostMessage( GikoForm.Handle , USER_RESPOPUPCLEAR, Integer( Self ), 0 );
+    Result := True;
+end;
 initialization
     OleInitialize(nil);