瀏覽代碼

Dedicated context menu for local-local tabs as most commands in the current tab menu are for remote sessions

Part of Bug 1893

Source commit: 054a15549fe9a602a692791f4e60eb3c289f7fee
Martin Prikryl 4 年之前
父節點
當前提交
e8522e0e02
共有 3 個文件被更改,包括 51 次插入17 次删除
  1. 19 15
      source/forms/CustomScpExplorer.cpp
  2. 25 2
      source/forms/NonVisual.dfm
  3. 7 0
      source/forms/NonVisual.h

+ 19 - 15
source/forms/CustomScpExplorer.cpp

@@ -10367,24 +10367,28 @@ void __fastcall TCustomScpExplorerForm::DirViewBusy(TObject * /*Sender*/, int Bu
 void __fastcall TCustomScpExplorerForm::SessionsPageControlContextPopup(TObject * /*Sender*/, TPoint & MousePos, bool & Handled)
 {
   int Index = SessionsPageControl->IndexOfTabAt(MousePos.X, MousePos.Y);
-  // no context menu for "New session tab"
-  if ((Index >= 0) && (GetSessionTabSession(SessionsPageControl->Pages[Index]) != NULL))
+  if (Index >= 0)
   {
-    SessionsPageControl->ActivePageIndex = Index;
-
-    if (DebugAlwaysTrue(SessionTabSwitched()))
+    TManagedTerminal * Session = GetSessionTabSession(SessionsPageControl->Pages[Index]);
+    // no context menu for "New session tab"
+    if (Session != NULL)
     {
-      // copied from TControl.WMContextMenu
-      SendCancelMode(SessionsPageControl);
+      SessionsPageControl->ActivePageIndex = Index;
 
-      // explicit popup instead of using PopupMenu property
-      // to avoid menu to popup somewhere within SessionTabSwitched above,
-      // while connecting yet not-connected session and hence
-      // allowing an access to commands over not-completelly connected session
-      TPoint Point = SessionsPageControl->ClientToScreen(MousePos);
-      TPopupMenu * PopupMenu = NonVisualDataModule->SessionsPopup;
-      PopupMenu->PopupComponent = SessionsPageControl;
-      PopupMenu->Popup(Point.x, Point.y);
+      if (DebugAlwaysTrue(SessionTabSwitched()))
+      {
+        // copied from TControl.WMContextMenu
+        SendCancelMode(SessionsPageControl);
+
+        // explicit popup instead of using PopupMenu property
+        // to avoid menu to popup somewhere within SessionTabSwitched above,
+        // while connecting yet not-connected session and hence
+        // allowing an access to commands over not-completelly connected session
+        TPoint Point = SessionsPageControl->ClientToScreen(MousePos);
+        TPopupMenu * PopupMenu = Session->LocalBrowser ? NonVisualDataModule->LocalBrowserPopup : NonVisualDataModule->SessionsPopup;
+        PopupMenu->PopupComponent = SessionsPageControl;
+        PopupMenu->Popup(Point.x, Point.y);
+      }
     }
   }
   Handled = true;

+ 25 - 2
source/forms/NonVisual.dfm

@@ -2865,7 +2865,7 @@ object NonVisualDataModule: TNonVisualDataModule
     Images = GlyphsModule.ExplorerImages
     OnPopup = QueuePopupPopup
     Options = [tboShowHint]
-    Left = 392
+    Left = 360
     Top = 176
     object ShowQuery1: TTBXItem
       Action = QueueItemQueryAction
@@ -3159,7 +3159,7 @@ object NonVisualDataModule: TNonVisualDataModule
   object SessionsPopup: TTBXPopupMenu
     Images = GlyphsModule.ExplorerImages
     Options = [tboShowHint]
-    Left = 480
+    Left = 456
     Top = 176
     object TBXItem124: TTBXItem
       Action = CloseTabAction
@@ -3285,4 +3285,27 @@ object NonVisualDataModule: TNonVisualDataModule
       Action = CurrentSystemMenuFocusedAction
     end
   end
+  object LocalBrowserPopup: TTBXPopupMenu
+    Images = GlyphsModule.ExplorerImages
+    Options = [tboShowHint]
+    Left = 552
+    Top = 176
+    object TBXItem62: TTBXItem
+      Action = CloseTabAction
+    end
+    object TBXSeparatorItem21: TTBXSeparatorItem
+    end
+    object TBXItem109: TTBXItem
+      Action = NewSessionAction
+    end
+    object TBXSubmenuItem11: TTBXSubmenuItem
+      Action = SavedSessionsAction2
+      Options = [tboDropdownArrow]
+    end
+    object TBXSeparatorItem22: TTBXSeparatorItem
+    end
+    object TBXItem110: TTBXItem
+      Action = SessionsTabsAction2
+    end
+  end
 end

+ 7 - 0
source/forms/NonVisual.h

@@ -662,6 +662,13 @@ __published:    // IDE-managed Components
   TTBXItem *TBXItem101;
   TTBXItem *LocalLocalCopyMenuItem;
   TTBXSeparatorItem *TBXSeparatorItem17;
+  TTBXPopupMenu *LocalBrowserPopup;
+  TTBXItem *TBXItem62;
+  TTBXSeparatorItem *TBXSeparatorItem21;
+  TTBXItem *TBXItem109;
+  TTBXSubmenuItem *TBXSubmenuItem11;
+  TTBXSeparatorItem *TBXSeparatorItem22;
+  TTBXItem *TBXItem110;
   void __fastcall ExplorerActionsUpdate(TBasicAction *Action, bool &Handled);
   void __fastcall ExplorerActionsExecute(TBasicAction *Action, bool &Handled);
   void __fastcall SessionIdleTimerTimer(TObject *Sender);