1
0
Эх сурвалжийг харах

Now that TIEComboBox's sole remaining functionality is auto-sizing of its dropdown list, it can be replaced by THistoryComboBox with history functionality disabled

Source commit: 0f402917c2d8a86f6efd8490f40dd6f36716e54f
Martin Prikryl 6 жил өмнө
parent
commit
68545d2a15

+ 0 - 8
source/DriveDir.cbproj

@@ -139,14 +139,6 @@
 			<BuildOrder>20</BuildOrder>
 			<BuildOrder>19</BuildOrder>
 		</DelphiCompile>
-		<ResFiles Include="packages\filemng\IEComboBox.dcr">
-			<BuildOrder>-1</BuildOrder>
-			<BuildOrder>29</BuildOrder>
-		</ResFiles>
-		<DelphiCompile Include="packages\filemng\IEComboBox.pas">
-			<BuildOrder>26</BuildOrder>
-			<BuildOrder>24</BuildOrder>
-		</DelphiCompile>
 		<DelphiCompile Include="packages\filemng\IEDriveInfo.pas">
 			<BuildOrder>38</BuildOrder>
 			<BuildOrder>22</BuildOrder>

+ 1 - 1
source/forms/LocationProfiles.cpp

@@ -16,7 +16,7 @@
 #include <Math.hpp>
 #include <GUITools.h>
 //---------------------------------------------------------------------
-#pragma link "IEComboBox"
+#pragma link "HistoryComboBox"
 #pragma link "PngImageList"
 #ifndef NO_RESOURCES
 #pragma resource "*.dfm"

+ 4 - 2
source/forms/LocationProfiles.dfm

@@ -306,7 +306,7 @@ object LocationProfilesDialog: TLocationProfilesDialog
       end
     end
   end
-  object LocalDirectoryEdit: TIEComboBox
+  object LocalDirectoryEdit: THistoryComboBox
     Left = 46
     Top = 25
     Width = 419
@@ -316,8 +316,9 @@ object LocationProfilesDialog: TLocationProfilesDialog
     TabOrder = 0
     Text = 'LocalDirectoryEdit'
     OnChange = DirectoryEditChange
+    SaveOn = []
   end
-  object RemoteDirectoryEdit: TIEComboBox
+  object RemoteDirectoryEdit: THistoryComboBox
     Left = 46
     Top = 73
     Width = 501
@@ -328,6 +329,7 @@ object LocationProfilesDialog: TLocationProfilesDialog
     TabOrder = 2
     Text = 'RemoteDirectoryEdit'
     OnChange = DirectoryEditChange
+    SaveOn = []
   end
   object LocalDirectoryBrowseButton: TButton
     Left = 470

+ 3 - 4
source/forms/LocationProfiles.h

@@ -2,13 +2,12 @@
 #ifndef LocationProfilesH
 #define LocationProfilesH
 //----------------------------------------------------------------------------
-#include "IEComboBox.hpp"
+#include "HistoryComboBox.hpp"
 #include <System.Classes.hpp>
 #include <Vcl.ComCtrls.hpp>
 #include <Vcl.Controls.hpp>
 #include <Vcl.ImgList.hpp>
 #include <Vcl.StdCtrls.hpp>
-#include "IEComboBox.hpp"
 #include <ComCtrls.hpp>
 #include <ImgList.hpp>
 #include "PngImageList.hpp"
@@ -35,12 +34,12 @@ __published:
   TButton *DownSessionBookmarkButton;
   TButton *UpSessionBookmarkButton;
   TLabel *LocalDirectoryLabel;
-  TIEComboBox *RemoteDirectoryEdit;
+  THistoryComboBox *RemoteDirectoryEdit;
   TButton *RenameSessionBookmarkButton;
   TLabel *RemoteDirectoryLabel;
   TButton *SessionBookmarkMoveToButton;
   TPngImageList *BookmarkImageList;
-  TIEComboBox *LocalDirectoryEdit;
+  THistoryComboBox *LocalDirectoryEdit;
   TButton *LocalDirectoryBrowseButton;
   TButton *SwitchButton;
   TButton *HelpButton;

+ 1 - 1
source/forms/OpenDirectory.cpp

@@ -14,7 +14,7 @@
 #include "OpenDirectory.h"
 #include "WinConfiguration.h"
 //---------------------------------------------------------------------
-#pragma link "IEComboBox"
+#pragma link "HistoryComboBox"
 #ifndef NO_RESOURCES
 #pragma resource "*.dfm"
 #endif

+ 4 - 2
source/forms/OpenDirectory.dfm

@@ -32,7 +32,7 @@ object OpenDirectoryDialog: TOpenDirectoryDialog
     Height = 32
     AutoSize = True
   end
-  object LocalDirectoryEdit: TIEComboBox
+  object LocalDirectoryEdit: THistoryComboBox
     Left = 46
     Top = 25
     Width = 270
@@ -41,8 +41,9 @@ object OpenDirectoryDialog: TOpenDirectoryDialog
     TabOrder = 1
     Text = 'LocalDirectoryEdit'
     OnChange = DirectoryEditChange
+    SaveOn = []
   end
-  object RemoteDirectoryEdit: TIEComboBox
+  object RemoteDirectoryEdit: THistoryComboBox
     Left = 46
     Top = 25
     Width = 351
@@ -53,6 +54,7 @@ object OpenDirectoryDialog: TOpenDirectoryDialog
     TabOrder = 0
     Text = 'RemoteDirectoryEdit'
     OnChange = DirectoryEditChange
+    SaveOn = []
   end
   object OKBtn: TButton
     Left = 159

+ 3 - 4
source/forms/OpenDirectory.h

@@ -2,7 +2,7 @@
 #ifndef OpenDirectoryH
 #define OpenDirectoryH
 //----------------------------------------------------------------------------
-#include "IEComboBox.hpp"
+#include "HistoryComboBox.hpp"
 #include <System.Classes.hpp>
 #include <Vcl.ComCtrls.hpp>
 #include <Vcl.Controls.hpp>
@@ -12,7 +12,6 @@
 #include <Terminal.h>
 #include <WinInterface.h>
 #include <Bookmarks.h>
-#include "IEComboBox.hpp"
 #include <PasTools.hpp>
 #include <ComCtrls.hpp>
 #include <Vcl.ExtCtrls.hpp>
@@ -23,8 +22,8 @@ class TOpenDirectoryDialog : public TForm
 __published:
   TButton *OKBtn;
   TButton *CancelBtn;
-  TIEComboBox *RemoteDirectoryEdit;
-  TIEComboBox *LocalDirectoryEdit;
+  THistoryComboBox *RemoteDirectoryEdit;
+  THistoryComboBox *LocalDirectoryEdit;
   TLabel *EditLabel;
   TPageControl *PageControl;
   TButton *LocalDirectoryBrowseButton;

+ 0 - 1
source/forms/ScpExplorer.cpp

@@ -21,7 +21,6 @@
 #pragma link "IEListView"
 #pragma link "NortonLikeListView"
 #pragma link "UnixDirView"
-#pragma link "IEComboBox"
 #pragma link "CustomDriveView"
 #pragma link "UnixDriveView"
 #pragma link "TB2Dock"

+ 0 - 162
source/packages/filemng/IEComboBox.pas

@@ -1,162 +0,0 @@
-unit IEComboBox;
-
-{==================================================================
-
- Components TIECustomCombobox  /  Version 1.4  / January 2000
-            TIEComboBox
-            TIEDriveBox
- ==================================================================
-
-
-    Description:
-    ============
-    TIECustomComboBox is a combobox with variable width of the dropdown list.
-
-    TIEComboBox publishes the properties of the class TIECustomComboBox.
-
-
-    Author:
-    =======
-    (c) Ingo Eckel 1999
-    Sodener Weg 38
-    65812 Bad Soden
-    Germany
-
-    For detailed documentation and history see the documentation in TIEDriveComboBox.htm.
-
-    V1.3:
-    - Property DisplayStyle changed.
-
-
-{==================================================================}
-
-{Required compiler options:}
-{$A+,B-,X+,H+,P+}
-
-interface
-
-uses
-  StdCtrls, Controls, Messages, Types, Classes, Graphics;
-
-type
-// =======================================================================
-// Class TIECustomComboBox
-// =======================================================================
-  TIECustomComboBox = class(TCustomComboBox)
-  protected
-    procedure DropDown; override;
-    function GetMaxItemWidth: Integer;
-  end;
-
-
-// =======================================================================
-// Class TIEComboBox
-// =======================================================================
-  TIEComboBox = class(TIECustomComboBox)
-  published
-    property Style; {Must be published before Items}
-    property Align;
-    property Anchors;
-    property BiDiMode;
-    property Color;
-    property Constraints;
-    property Ctl3D;
-    property DragCursor;
-    property DragKind;
-    property DragMode;
-    property DropDownCount;
-    property Enabled;
-    property Font;
-    property ImeMode;
-    property ImeName;
-    property ItemHeight;
-    property Items;
-    property MaxLength;
-    property ParentBiDiMode;
-    property ParentColor;
-    property ParentCtl3D;
-    property ParentFont;
-    property ParentShowHint;
-    property PopupMenu;
-    property ShowHint;
-    property Sorted;
-    property TabOrder;
-    property TabStop;
-    property Text;
-    property Visible;
-    property OnChange;
-    property OnClick;
-    property OnDblClick;
-    property OnDragDrop;
-    property OnDragOver;
-    property OnDrawItem;
-    property OnDropDown;
-    property OnEndDock;
-    property OnEndDrag;
-    property OnEnter;
-    property OnExit;
-    property OnKeyDown;
-    property OnKeyPress;
-    property OnKeyUp;
-    property OnMeasureItem;
-    property OnStartDock;
-    property OnStartDrag;
-  end;
-
-procedure Register;
-
-implementation
-
-uses
-  SysUtils, Forms, Dialogs, Imglist, ShellAPI, CommCtrl, Math, Windows, PasTools;
-
-procedure Register;
-begin
-  RegisterComponents('DriveDir', [TIEComboBox]);
-end;
-
-// =======================================================================
-// Class TIECustomComboBox
-// =======================================================================
-
-procedure TIECustomComboBox.DropDown;
-var
-  ItemWidth: Integer;
-begin
-  {set the width of the list box to 8 pixels > than the
-   widest string to buffer the right side. Anything less than
-   8 for some reason touches the end of the item on high-res
-   monitor settings.}
-  // The same code is in THistoryComboBox.DropDown
-  ItemWidth := GetMaxItemWidth + ScaleByPixelsPerInch(8, Self);
-  if Items.Count > DropDownCount then
-    Inc(ItemWidth, GetSystemMetricsForControl(Self, SM_CXVSCROLL));
-  Self.Perform(CB_SETDROPPEDWIDTH, ItemWidth, 0);
-
-  inherited;
-end; {TIECustomComboBox.DropDown}
-
-function TIECustomComboBox.GetMaxItemWidth: Integer;
-var
-  DC: HDC;
-  SaveFont: HFont;
-  Size: TSize;
-  Index: Integer;
-begin
-  Result := 0;
-  DC := GetDC(0);
-  try
-    SaveFont := SelectObject(DC, Font.Handle);
-    for Index := 0 to Items.Count - 1 do
-    begin
-      GetTextExtentPoint32(DC, PChar(Items[Index]), Length(Items[Index]), Size);
-      if Size.Cx > Result then Result := Size.Cx;
-    end;
-    SelectObject(DC, SaveFont);
-  finally
-    ReleaseDC(0, DC);
-  end;
-end; {TIECustomComboBox.GetMaxItemWidth}
-
-initialization
-end.

+ 1 - 4
source/packages/my/HistoryComboBox.pas

@@ -90,7 +90,7 @@ begin
   begin
     if Items.IndexOf(Text) < 0 then SaveToHistory;
   end;
-  if DroppedDown and (Key = VK_DELETE) and (ssCtrl in Shift) then
+  if DroppedDown and (Key = VK_DELETE) and (ssCtrl in Shift) and (SaveOn <> []) then
   begin
     Items.Clear;
     Key := 0;
@@ -118,7 +118,6 @@ begin
   inherited;
   if soDropDown in SaveOn then SaveToHistory;
 
-  // taken from TIECustomComboBox:
   ItemWidth := GetMaxItemWidth + ScaleByPixelsPerInch(8, Self);
   if Items.Count > DropDownCount then
     Inc(ItemWidth, GetSystemMetricsForControl(Self, SM_CXVSCROLL));
@@ -152,8 +151,6 @@ begin
   end;
 end;
 
-// taken from TIECustomComboBox:
-
 function THistoryComboBox.GetMaxItemWidth: Integer;
 var
   DC: HDC;