浏览代码

Merge branch 'master' into dev

Source commit: 562f7b139c4ba86ebcd6d3f14acaa62e9137e61c
Martin Prikryl 5 年之前
父节点
当前提交
18cf52958e

+ 1 - 1
source/forms/Login.cpp

@@ -86,7 +86,6 @@ __fastcall TLoginDialog::TLoginDialog(TComponent* AOwner)
   FPasswordLabel = PasswordLabel->Caption;
 
   FSiteButtonsPadding = SitesPanel->ClientHeight - ToolsMenuButton->Top - ToolsMenuButton->Height;
-  HideComponentsPanel(this);
 }
 //---------------------------------------------------------------------
 __fastcall TLoginDialog::~TLoginDialog()
@@ -698,6 +697,7 @@ void __fastcall TLoginDialog::FormShow(TObject * /*Sender*/)
   }
 
   // WORKAROUND for a bug in the VCL layout code for bottom aligned controls
+  // This is probably no longer needed after ComponentsPanel was removed
   int Offset = (SitesPanel->ClientHeight - FSiteButtonsPadding - ToolsMenuButton->Height) - ToolsMenuButton->Top;
   ToolsMenuButton->Top = ToolsMenuButton->Top + Offset;
   ManageButton->Top = ManageButton->Top + Offset;

+ 66 - 74
source/forms/Login.dfm

@@ -5,8 +5,8 @@ object LoginDialog: TLoginDialog
   HelpKeyword = 'ui_login'
   BorderIcons = [biSystemMenu, biMinimize, biHelp]
   Caption = 'Login'
-  ClientHeight = 599
-  ClientWidth = 630
+  ClientHeight = 385
+  ClientWidth = 873
   Color = clBtnFace
   Constraints.MinHeight = 399
   Constraints.MinWidth = 600
@@ -19,10 +19,10 @@ object LoginDialog: TLoginDialog
   PixelsPerInch = 96
   TextHeight = 13
   object MainPanel: TPanel
-    Left = 269
+    Left = 512
     Top = 0
     Width = 361
-    Height = 334
+    Height = 361
     Align = alRight
     BevelOuter = bvNone
     TabOrder = 0
@@ -30,25 +30,25 @@ object LoginDialog: TLoginDialog
       Left = 0
       Top = 0
       Width = 361
-      Height = 293
+      Height = 320
       Align = alClient
       BevelOuter = bvNone
       TabOrder = 0
       Visible = False
       DesignSize = (
         361
-        293)
+        320)
       object ContentsGroupBox: TGroupBox
         Left = 2
         Top = 12
         Width = 347
-        Height = 278
+        Height = 305
         Anchors = [akLeft, akTop, akBottom]
         Caption = 'ContentsGroupBox'
         TabOrder = 0
         DesignSize = (
           347
-          278)
+          305)
         object ContentsLabel: TLabel
           Left = 12
           Top = 20
@@ -70,7 +70,7 @@ object LoginDialog: TLoginDialog
           Left = 12
           Top = 42
           Width = 324
-          Height = 224
+          Height = 251
           Anchors = [akLeft, akTop, akRight, akBottom]
           Lines.Strings = (
             'ContentsMemo')
@@ -82,14 +82,14 @@ object LoginDialog: TLoginDialog
       Left = 0
       Top = 0
       Width = 361
-      Height = 293
+      Height = 320
       Align = alClient
       Anchors = [akTop, akRight, akBottom]
       BevelOuter = bvNone
       TabOrder = 1
       DesignSize = (
         361
-        293)
+        320)
       object BasicGroup: TGroupBox
         Left = 2
         Top = 12
@@ -333,18 +333,18 @@ object LoginDialog: TLoginDialog
         Left = 2
         Top = 247
         Width = 347
-        Height = 43
+        Height = 70
         Anchors = [akLeft, akTop, akRight, akBottom]
         Caption = 'Note'
         TabOrder = 1
         DesignSize = (
           347
-          43)
+          70)
         object NoteMemo: TMemo
           Left = 7
           Top = 15
           Width = 333
-          Height = 19
+          Height = 46
           TabStop = False
           Anchors = [akLeft, akTop, akRight, akBottom]
           BevelInner = bvNone
@@ -359,7 +359,7 @@ object LoginDialog: TLoginDialog
     end
     object ButtonPanel: TPanel
       Left = 0
-      Top = 293
+      Top = 320
       Width = 361
       Height = 41
       Align = alBottom
@@ -409,19 +409,19 @@ object LoginDialog: TLoginDialog
   object SitesPanel: TPanel
     Left = 0
     Top = 0
-    Width = 269
-    Height = 334
+    Width = 512
+    Height = 361
     Align = alClient
     BevelOuter = bvNone
     TabOrder = 2
     DesignSize = (
-      269
-      334)
+      512
+      361)
     object SessionTree: TTreeView
       Left = 11
       Top = 12
-      Width = 247
-      Height = 285
+      Width = 490
+      Height = 312
       Anchors = [akLeft, akTop, akRight, akBottom]
       DoubleBuffered = True
       DragMode = dmAutomatic
@@ -457,8 +457,8 @@ object LoginDialog: TLoginDialog
     end
     object SitesIncrementalSearchLabel: TStaticText
       Left = 14
-      Top = 277
-      Width = 142
+      Top = 304
+      Width = 385
       Height = 17
       Anchors = [akLeft, akRight, akBottom]
       BorderStyle = sbsSingle
@@ -468,8 +468,8 @@ object LoginDialog: TLoginDialog
       Visible = False
     end
     object ManageButton: TButton
-      Left = 160
-      Top = 303
+      Left = 403
+      Top = 330
       Width = 98
       Height = 25
       Anchors = [akRight, akBottom]
@@ -479,7 +479,7 @@ object LoginDialog: TLoginDialog
     end
     object ToolsMenuButton: TButton
       Left = 11
-      Top = 303
+      Top = 330
       Width = 98
       Height = 25
       Anchors = [akLeft, akBottom]
@@ -488,30 +488,22 @@ object LoginDialog: TLoginDialog
       OnClick = ToolsMenuButtonClick
     end
   end
-  object ComponentsPanel: TPanel
-    Left = 0
-    Top = 358
-    Width = 630
-    Height = 241
-    Align = alBottom
-    BevelOuter = bvNone
-    Color = clWindow
-    ParentBackground = False
-    TabOrder = 3
-  end
   object ShowAgainPanel: TPanel
     Left = 0
-    Top = 334
-    Width = 630
+    Top = 361
+    Width = 873
     Height = 24
     Align = alBottom
     BevelOuter = bvNone
     TabOrder = 1
     OnMouseDown = PanelMouseDown
+    DesignSize = (
+      873
+      24)
     object ShowAgainCheck: TCheckBox
       Left = 12
       Top = 0
-      Width = 606
+      Width = 849
       Height = 17
       Anchors = [akLeft, akTop, akRight]
       Caption = 
@@ -525,8 +517,8 @@ object LoginDialog: TLoginDialog
   object ActionList: TActionList
     Images = ActionImageList
     OnUpdate = ActionListUpdate
-    Left = 36
-    Top = 365
+    Left = 44
+    Top = 21
     object EditSessionAction: TAction
       Category = 'Sessions'
       Caption = '&Edit'
@@ -701,8 +693,8 @@ object LoginDialog: TLoginDialog
     end
   end
   object ToolsPopupMenu: TPopupMenu
-    Left = 144
-    Top = 421
+    Left = 152
+    Top = 77
     object Import1: TMenuItem
       Action = ImportSessionsAction
     end
@@ -1121,13 +1113,13 @@ object LoginDialog: TLoginDialog
           C4345A5A322BB385B32146A201840664A5C8004D1BC9A91500C1524F7165D321
           E40000000049454E44AE426082}
       end>
-    Left = 36
-    Top = 485
+    Left = 44
+    Top = 189
     Bitmap = {}
   end
   object SaveDropDownMenu: TPopupMenu
-    Left = 268
-    Top = 365
+    Left = 276
+    Top = 21
     object SaveSessionMenuItem: TMenuItem
       Action = SaveSessionAction
       Default = True
@@ -1144,8 +1136,8 @@ object LoginDialog: TLoginDialog
   end
   object ManageSitePopupMenu: TPopupMenu
     Images = ActionImageList
-    Left = 396
-    Top = 365
+    Left = 404
+    Top = 21
     object Shellicon1: TMenuItem
       Caption = 'Site'
       Enabled = False
@@ -1222,8 +1214,8 @@ object LoginDialog: TLoginDialog
   end
   object ManageFolderPopupMenu: TPopupMenu
     Images = ActionImageList
-    Left = 398
-    Top = 421
+    Left = 406
+    Top = 77
     object MenuItem1: TMenuItem
       Caption = 'Site Folder'
       Enabled = False
@@ -1279,8 +1271,8 @@ object LoginDialog: TLoginDialog
   end
   object ManageNewSitePopupMenu: TPopupMenu
     Images = ActionImageList
-    Left = 543
-    Top = 365
+    Left = 151
+    Top = 133
     object MenuItem12: TMenuItem
       Caption = 'New Site'
       Enabled = False
@@ -1343,8 +1335,8 @@ object LoginDialog: TLoginDialog
   end
   object ManageWorkspacePopupMenu: TPopupMenu
     Images = ActionImageList
-    Left = 542
-    Top = 421
+    Left = 406
+    Top = 141
     object MenuItem2: TMenuItem
       Caption = 'Workspace'
       Enabled = False
@@ -1393,8 +1385,8 @@ object LoginDialog: TLoginDialog
     end
   end
   object SessionAdvancedPopupMenu: TPopupMenu
-    Left = 144
-    Top = 365
+    Left = 152
+    Top = 21
     object Session1: TMenuItem
       Caption = 'Session'
       Enabled = False
@@ -1875,14 +1867,14 @@ object LoginDialog: TLoginDialog
           BFF8D73C06EB61FCFFFF3F297A310000D54FEADB815A8A100000000049454E44
           AE426082}
       end>
-    Left = 33
-    Top = 549
+    Left = 41
+    Top = 253
     Bitmap = {}
   end
   object LoginDropDownMenu: TPopupMenu
     Images = ActionImageList
-    Left = 270
-    Top = 421
+    Left = 278
+    Top = 77
     object Login1: TMenuItem
       Action = LoginAction
       Default = True
@@ -2207,8 +2199,8 @@ object LoginDialog: TLoginDialog
           39F9E10FBF7D9BC06146B20BF100E25D48090000D9537415156A030000000000
           49454E44AE426082}
       end>
-    Left = 143
-    Top = 485
+    Left = 151
+    Top = 189
     Bitmap = {}
   end
   object ActionImageList120: TPngImageList
@@ -2610,8 +2602,8 @@ object LoginDialog: TLoginDialog
           D56C9F3609C3C0C340DA86816CF0FF905FCD637BB881FFFF139D95890200B8D8
           399E6C933D3B0000000049454E44AE426082}
       end>
-    Left = 145
-    Top = 549
+    Left = 153
+    Top = 253
     Bitmap = {}
   end
   object SessionImageList144: TPngImageList
@@ -2958,8 +2950,8 @@ object LoginDialog: TLoginDialog
           2E070A6F922DB072F2232AF88EEDDB44960528414400901E44D402001D69BC19
           62FAB43A0000000049454E44AE426082}
       end>
-    Left = 271
-    Top = 485
+    Left = 279
+    Top = 189
     Bitmap = {}
   end
   object SessionImageList192: TPngImageList
@@ -3260,8 +3252,8 @@ object LoginDialog: TLoginDialog
           E0D8BE4D54710046149000288F025A0300B035FD21AB80C6790000000049454E
           44AE426082}
       end>
-    Left = 399
-    Top = 485
+    Left = 407
+    Top = 189
     Bitmap = {}
   end
   object ActionImageList144: TPngImageList
@@ -3771,8 +3763,8 @@ object LoginDialog: TLoginDialog
           BA0C3CD30349C6BB2693432AAF653200CFE8B12FFE592375E1C77BFC7480FFD9
           7E020EF8EA5A9F9886D50000000049454E44AE426082}
       end>
-    Left = 270
-    Top = 549
+    Left = 278
+    Top = 253
     Bitmap = {}
   end
   object ActionImageList192: TPngImageList
@@ -4324,8 +4316,8 @@ object LoginDialog: TLoginDialog
           209FA6A7CBB18441E79A49DF3DB88215E04EC51D07F80B8CCA82E42EA50F1200
           00000049454E44AE426082}
       end>
-    Left = 398
-    Top = 549
+    Left = 406
+    Top = 253
     Bitmap = {}
   end
 end

+ 0 - 1
source/forms/Login.h

@@ -176,7 +176,6 @@ __published:
   TMenuItem *TransferSettingsRule1;
   TGroupBox *NoteGroup;
   TMemo *NoteMemo;
-  TPanel *ComponentsPanel;
   TPngImageList *SessionImageList120;
   TPngImageList *ActionImageList120;
   TAction *SearchSiteNameStartOnlyAction;

+ 8 - 1
source/windows/TerminalManager.cpp

@@ -1390,7 +1390,8 @@ UnicodeString __fastcall TTerminalManager::GetTerminalShortPath(TTerminal * Term
 UnicodeString __fastcall TTerminalManager::GetTerminalTitle(TTerminal * Terminal, bool Unique)
 {
   UnicodeString Result = Terminal->SessionData->SessionName;
-  if (Unique)
+  if (Unique &&
+      (WinConfiguration->SessionTabNameFormat != stnfNone))
   {
     int Index = IndexOf(Terminal);
     // not for background transfer sessions and disconnected sessions
@@ -1406,6 +1407,12 @@ UnicodeString __fastcall TTerminalManager::GetTerminalTitle(TTerminal * Terminal
           UnicodeString Path = GetTerminalShortPath(Terminal);
           if (!Path.IsEmpty())
           {
+            const int MaxPathLen = 16;
+            if ((WinConfiguration->SessionTabNameFormat == stnfShortPathTrunc) &&
+                (Path.Length() > MaxPathLen))
+            {
+              Path = Path.SubString(1, MaxPathLen - 2) + Ellipsis;
+            }
             Result = FORMAT(L"%s (%s)", (Result, Path));
           }
           break;

+ 7 - 6
source/windows/Tools.cpp

@@ -110,7 +110,7 @@ TColor __fastcall GetWindowTextColor(TColor BackgroundColor, TColor Color)
 {
   if (Color == TColor(0))
   {
-    // Could use current theme TMT_TEXTCOLOR - see https://github.com/ysc3839/win32-darkmode/
+    // Could use current theme TMT_TEXTCOLOR - see https://github.com/ysc3839/win32-darkmode
     Color = (IsDarkColor(BackgroundColor) ? clWhite : clWindowText);
     SetContrast(Color, BackgroundColor, 180);
   }
@@ -121,7 +121,7 @@ TColor __fastcall GetWindowColor(TColor Color)
 {
   if (Color == TColor(0))
   {
-    // Could use current theme TMT_FILLCOLOR - see https://github.com/ysc3839/win32-darkmode/
+    // Could use current theme TMT_FILLCOLOR - see https://github.com/ysc3839/win32-darkmode
     Color = (WinConfiguration->UseDarkTheme() ? static_cast<TColor>(RGB(0x20, 0x20, 0x20)) : clWindow);
   }
   return Color;
@@ -241,11 +241,12 @@ void __fastcall RestoreForm(UnicodeString Data, TForm * Form, bool PositionOnly)
       TRect Bounds = OriginalBounds;
       LoadFormDimensions(LeftStr, TopStr, RightStr, BottomStr, PixelsPerInch, Monitor, Form, Bounds, DefaultPos);
 
+      int Padding = ScaleByPixelsPerInch(20, Monitor);
       if (DefaultPos ||
-          ((Bounds.Left < Monitor->Left) ||
-           (Bounds.Left > Monitor->Left + Monitor->WorkareaRect.Width() - 20) ||
-           (Bounds.Top < Monitor->Top) ||
-           (Bounds.Top > Monitor->Top + Monitor->WorkareaRect.Height() - 20)))
+          ((Bounds.Left < Monitor->Left - Padding) ||
+           (Bounds.Left > Monitor->Left + Monitor->WorkareaRect.Width() - Padding) ||
+           (Bounds.Top < Monitor->Top - Padding) ||
+           (Bounds.Top > Monitor->Top + Monitor->WorkareaRect.Height() - Padding)))
       {
         bool ExplicitPlacing = !Monitor->Primary;
         if (!ExplicitPlacing)

+ 2 - 0
source/windows/WinConfiguration.cpp

@@ -578,6 +578,7 @@ void __fastcall TWinConfiguration::Default()
   FAutoSaveWorkspacePasswords = false;
   FAutoWorkspace = L"";
   FPathInCaption = picShort;
+  FSessionTabNameFormat = stnfShortPathTrunc;
   FMinimizeToTray = false;
   FMinimizeToTrayOnce = false;
   FBalloonNotifications = true;
@@ -984,6 +985,7 @@ THierarchicalStorage * TWinConfiguration::CreateScpStorage(bool & SessionList)
     KEY(Bool,     AutoSaveWorkspacePasswords); \
     KEY(String,   AutoWorkspace); \
     KEY(Integer,  PathInCaption); \
+    KEY(Integer,  SessionTabNameFormat); \
     KEY(Bool,     MinimizeToTray); \
     KEY(Bool,     BalloonNotifications); \
     KEY(Integer,  NotificationsTimeout); \

+ 4 - 0
source/windows/WinConfiguration.h

@@ -341,6 +341,7 @@ class TBookmarks;
 class TBookmarkList;
 class TCustomCommandList;
 enum TPathInCaption { picShort, picFull, picNone };
+enum TSessionTabNameFormat { stnfNone, stnfShortPath, stnfShortPathTrunc };
 // constants must be compatible with legacy CopyOnDoubleClick
 enum TDoubleClickAction { dcaOpen = 0, dcaCopy = 1, dcaEdit = 2 };
 //---------------------------------------------------------------------------
@@ -410,6 +411,7 @@ private:
   bool FAutoSaveWorkspacePasswords;
   UnicodeString FAutoWorkspace;
   TPathInCaption FPathInCaption;
+  TSessionTabNameFormat FSessionTabNameFormat;
   bool FMinimizeToTray;
   bool FMinimizeToTrayOnce;
   bool FBalloonNotifications;
@@ -517,6 +519,7 @@ private:
   void __fastcall SetAutoSaveWorkspacePasswords(bool value);
   void __fastcall SetAutoWorkspace(UnicodeString value);
   void __fastcall SetPathInCaption(TPathInCaption value);
+  void __fastcall SetSessionTabNameFormat(TSessionTabNameFormat value);
   void __fastcall SetMinimizeToTray(bool value);
   bool __fastcall GetMinimizeToTray();
   void __fastcall SetBalloonNotifications(bool value);
@@ -714,6 +717,7 @@ public:
   __property bool AutoSaveWorkspacePasswords = { read = FAutoSaveWorkspacePasswords, write = SetAutoSaveWorkspacePasswords };
   __property UnicodeString AutoWorkspace = { read = FAutoWorkspace, write = SetAutoWorkspace };
   __property TPathInCaption PathInCaption = { read = FPathInCaption, write = SetPathInCaption };
+  __property TSessionTabNameFormat SessionTabNameFormat = { read = FSessionTabNameFormat, write = FSessionTabNameFormat };
   __property bool MinimizeToTray = { read = GetMinimizeToTray, write = SetMinimizeToTray };
   __property bool BalloonNotifications = { read = FBalloonNotifications, write = SetBalloonNotifications };
   __property unsigned int NotificationsTimeout = { read = FNotificationsTimeout, write = SetNotificationsTimeout };