OSDN Git Service

Browserのフォーカスとショートカットの問題解消
authorh677 <h677>
Mon, 24 May 2004 17:55:50 +0000 (17:55 +0000)
committerh677 <h677>
Mon, 24 May 2004 17:55:50 +0000 (17:55 +0000)
Giko.dfm
Giko.pas
HTMLDocumentEvent.pas

index a1ffe08..30555b4 100644 (file)
--- a/Giko.dfm
+++ b/Giko.dfm
@@ -1,6 +1,6 @@
 object GikoForm: TGikoForm
-  Left = 266
-  Top = 73
+  Left = 172
+  Top = 130
   HorzScrollBar.Visible = False
   VertScrollBar.Visible = False
   AutoScroll = False
@@ -8623,6 +8623,25 @@ object GikoForm: TGikoForm
       Hint = #36984#25246#12373#12428#12383#26495#12398#21517#21069#12434#12467#12500#12540#12377#12427
       OnExecute = TreeSelectNameCopyExecute
     end
+    object SetFocusForBrowserAction: TAction
+      Category = #12473#12524#12483#12489
+      Caption = #12502#12521#12454#12470#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      Hint = #12502#12521#12454#12470#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      OnExecute = SetFocusForBrowserActionExecute
+      OnUpdate = SetFocusForBrowserActionUpdate
+    end
+    object SetFocusForThreadListAction: TAction
+      Category = #12473#12524#12483#12489
+      Caption = #12473#12524#12483#12489#19968#35239#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      Hint = #12473#12524#12483#12489#19968#35239#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      OnExecute = SetFocusForThreadListActionExecute
+    end
+    object SetFocusForCabinetAction: TAction
+      Category = #12473#12524#12483#12489
+      Caption = #12461#12515#12499#12493#12483#12488#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      Hint = #12461#12515#12499#12493#12483#12488#12395#12501#12457#12540#12459#12473#12434#24403#12390#12427
+      OnExecute = SetFocusForCabinetActionExecute
+    end
   end
   object MainMenu: TMainMenu
     Images = HotToobarImageList
index 920153a..93fd92d 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -533,6 +533,9 @@ type
     TreeSelectNamePupupMenu: TMenuItem;
     Browser: TWebBrowser;
     BrowserPanel: TPanel;
+    SetFocusForBrowserAction: TAction;
+    SetFocusForThreadListAction: TAction;
+    SetFocusForCabinetAction: TAction;
                                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure CabinetPanelHide(Sender: TObject);
@@ -851,7 +854,10 @@ type
     procedure FavoriteTreeViewMouseUp(Sender: TObject;
       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     procedure OnlyAHundredResUpdate(Sender: TObject);
-    procedure test1Click(Sender: TObject);
+    procedure SetFocusForBrowserActionExecute(Sender: TObject);
+    procedure SetFocusForBrowserActionUpdate(Sender: TObject);
+    procedure SetFocusForThreadListActionExecute(Sender: TObject);
+    procedure SetFocusForCabinetActionExecute(Sender: TObject);
        private
                { Private \90é\8c¾ }
         //RoundList : TRoundList;
@@ -998,7 +1004,7 @@ type
                function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
                // \8ae\8f\8a\82É\82 \82é\83L\83\83\83r\83l\83b\83g\81E BBS \83\81\83j\83\85\81[\82ð\83Z\83b\83g\81^\8dX\90V
                procedure SetBBSMenu;
-
+               function WebBrowserClick(Sender: TObject): WordBool;
        protected
                procedure CreateParams(var Params: TCreateParams); override;
                procedure WndProc(var Message: TMessage); override;
@@ -1202,7 +1208,7 @@ begin
        Application.OnDeactivate := AppFormDeactivate;
        Self.OnDeactivate := AppFormDeactivate;
        Application.HookMainWindow(Hook);
-       Application.OnMessage := HandleAppMessage;
+       //Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
 
        FTreeType := gttNone;
 
@@ -1725,7 +1731,8 @@ end;
 
 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
 begin
-       SaveCoolBarSettings;
+       if GikoForm.WindowState <> wsMinimized then
+               SaveCoolBarSettings;
        if ( GikoSys.Setting.ShowDialogForEnd ) and
                        (MessageDlg('\83M\83R\83i\83r\82ð\8fI\97¹\82µ\82Ä\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', mtConfirmation,[mbOk, mbCancel], 0) = mrCancel ) then begin
                CanClose := false;
@@ -1991,9 +1998,6 @@ var
 begin
        //\83^\83u\83N\83\8d\81[\83Y
        NotSelectTabCloseAction.Execute;
-       //if BrowserTab.Tabs.Count >= 1 then
-       //      for i := BrowserTab.Tabs.Count - 1 downto 0 do
-       //              DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
        BrowserTabCloseAction.Execute;
        //TreeView\83N\83\8a\83A\81iBBS2ch.Free\82Ì\8cã\82É\83N\83\8a\83A\82·\82é\82ÆXP\83X\83^\83C\83\8b\8e\9e\82É\83G\83\89\81[\8fo\82é\81j
        TreeView.Items.Clear;
@@ -3267,7 +3271,7 @@ begin
                        end;
                        newBrowser.Browser := TWebBrowser(FBrowsers[4]);
                        FBrowsers.Move(4, 0);
-                       newBrowser.Browser.Navigate(BLANK_HTML);
+                       //newBrowser.Browser.Navigate(BLANK_HTML);
                        newBrowser.thread := ThreadItem;
                        newBrowser.Repaint := true;
                        newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
@@ -3291,7 +3295,7 @@ begin
                        end;
                        newBrowser.Browser := TWebBrowser(FBrowsers[4]);
                        FBrowsers.Move(4, 0);
-                       newBrowser.Browser.Navigate(BLANK_HTML);
+                       //newBrowser.Browser.Navigate(BLANK_HTML);
                        newBrowser.thread := ThreadItem;
                        newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
                        newBrowser.Repaint := true;
@@ -3520,22 +3524,6 @@ begin
                        ListView.ItemFocused := ListView.Items.Item[ idx ];
                end;
 //     end;
-
-       if Obj is TBoard then begin
-               if GikoSys.Setting.ListOrientation = gloHorizontal then begin
-                       if GikoSys.Setting.ListWidthState = glsMax then begin
-                               BrowserMinAction.Execute;
-                               if GikoForm.Visible then
-                                       ListView.SetFocus;
-                       end;
-               end else begin
-                       if GikoSys.Setting.ListHeightState = glsMax then begin
-                               BrowserMinAction.Execute;
-                               if GikoForm.Visible then
-                                       ListView.SetFocus;
-                       end;
-               end;
-       end;
 end;
 
 
@@ -4199,25 +4187,7 @@ begin
                InsertBrowserTab(ThreadItem);
        end;
 
-       if ListView.Selected = nil then
-               Exit;
-       if ListView.Selected.Data = nil then
-               Exit;
-       if TThreadItem( ListView.Selected.Data ).IsLogFile then begin
-               if GikoSys.Setting.ListOrientation = gloHorizontal then begin
-                       if GikoSys.Setting.ListWidthState = glsMin then begin
-                               BrowserMaxAction.Execute;
-                               if GikoForm.Visible then
-                                       Browser.SetFocus;
-                       end;
-               end else begin
-                       if GikoSys.Setting.ListHeightState = glsMin then begin
-                               BrowserMaxAction.Execute;
-                               if GikoForm.Visible then
-                                       Browser.SetFocus;
-                       end;
-               end;
-       end;
+
 end;
 
 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
@@ -5955,22 +5925,6 @@ begin
                                AddressComboBox.Text := ThreadItem.URL;
                end;
 
-               if ThreadItem = nil then Exit;
-               if ThreadItem.IsLogFile then begin
-                       if GikoSys.Setting.ListOrientation = gloHorizontal then begin
-                               if GikoSys.Setting.ListWidthState = glsMin then begin
-                                       BrowserMaxAction.Execute;
-                                       if GikoForm.Visible then
-                                               SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
-                               end;
-                       end else begin
-                               if GikoSys.Setting.ListHeightState = glsMin then begin
-                                       BrowserMaxAction.Execute;
-                                       if GikoForm.Visible then
-                                               SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
-                               end;
-                       end;
-               end;
        end;
 
 end;
@@ -6149,6 +6103,7 @@ begin
                        FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
                        BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
                        BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
+                       BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
                end;
        end;
 end;
@@ -6810,22 +6765,6 @@ begin
                        Exit;
 
                InsertBrowserTab(ThreadItem, ActiveTab);
-
-               if ThreadItem.IsLogFile then begin
-                       if GikoSys.Setting.ListOrientation = gloHorizontal then begin
-                               if GikoSys.Setting.ListWidthState = glsMin then begin
-                                       BrowserMaxAction.Execute;
-                                       if GikoForm.Visible then
-                                               Browser.SetFocus;
-                               end;
-                       end else begin
-                               if GikoSys.Setting.ListHeightState = glsMin then begin
-                                       BrowserMaxAction.Execute;
-                                       if GikoForm.Visible then
-                                               Browser.SetFocus;
-                               end;
-                       end;
-               end;
        end;
 end;
 
@@ -9435,7 +9374,7 @@ begin
                                if GikoForm.Visible then
                                        Browser.SetFocus;
                        end;
-               end;
+               end;
        end;
 end;
 
@@ -9944,7 +9883,7 @@ begin
        end;
 end;
 
-// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
+// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g    //\82È\82ñ\82©\8eg\82í\82È\82­\82Ä\82à\93®\82¢\82Ä\82é\8bC\82ª\82·\82é\81@by\82à\82\82ã
 // \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
 function TGikoForm.BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
 var
@@ -9983,7 +9922,7 @@ procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
 var
        key                             : Word;
 begin
-
+{
        case Msg.message of
        WM_KEYDOWN:
                if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
@@ -10008,7 +9947,7 @@ begin
                XBUTTON2:
                end;
        end;
-
+}
 end;
 
 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
@@ -10103,9 +10042,44 @@ begin
        OnlyAHundredRes.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
 end;
 
-procedure TGikoForm.test1Click(Sender: TObject);
+function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
 begin
-       TOleControl(FActiveContent.Browser).Visible := not TOleControl(FActiveContent.Browser).Visible;
+  result := true;
+  if (Sender <> nil) and (Sender is TWebBrowser) then
+  try
+       TWebBrowser(Sender).SetFocus;
+  except
+  end;
+end;
+
+procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
+begin
+    FActiveContent.FBrowser.SetFocus;
+end;
+
+procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
+begin
+       if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
+               (FActiveContent.Browser <> BrowserNullTab.Browser) then
+               SetFocusForBrowserAction.Enabled := true
+       else
+               SetFocusForBrowserAction.Enabled := false;
+end;
+
+procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
+begin
+       if FActiveContent <> nil then
+               WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
+       ListView.SetFocus;
+       if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
+               ListView.Items.Item[0].Selected := true; //\91I\91ð\83A\83C\83e\83\80\82ª\96³\82¢\82Æ\82«\82Í\90æ\93ª\82Ì\82ð\91I\91ð\82·\82é
+end;
+
+procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
+begin
+       if FActiveContent <> nil then
+               WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
+       TreeView.SetFocus;
 end;
 
 initialization
index 0a47fb8..9b119b8 100644 (file)
@@ -15,6 +15,8 @@ type
                FSimpleIID: TGUID;
                FSimpleCon: Integer;
                FOnContextMenu: TDocumentContextMenuEvent;
+               FOnClick: TDocumentContextMenuEvent;
+               FOnMouseMove: TDocumentContextMenuEvent;
        protected
                { IUnknown }
                function QueryInterface(const IID:TGUID; out Obj): HRESULT; stdcall;
@@ -31,6 +33,8 @@ type
                constructor Create(AOwner: TObject; ADisp: IDispatch; const AIID: TGUID);
                destructor Destroy; override;
                property OnContextMenu: TDocumentContextMenuEvent read FOnContextMenu write FOnContextMenu;
+               property OnClick: TDocumentContextMenuEvent read FOnClick write FOnClick;
+               property OnMouseMove: TDocumentContextMenuEvent read FOnMouseMove write FOnMouseMove;
        end;
 
 implementation
@@ -82,6 +86,14 @@ function THTMLDocumentEventSink.Invoke(DispID: Integer; const IID: TGUID;
        ArgErr: Pointer): HRESULT;
 begin
        case DispID of
+    DISPID_MOUSEMOVE:
+                       if Assigned(FOnMouseMove) then begin
+                               PVariant(VarResult)^ := FOnMouseMove(FOwner);
+      end;
+    DISPID_CLICK:
+                       if Assigned(FOnClick) then begin
+                               PVariant(VarResult)^ := FOnClick(FOwner);
+      end;
                1023:
                        if Assigned(FOnContextMenu) then begin
                                PVariant(VarResult)^ := FOnContextMenu(FOwner);