浏览代码

Simplifying implementation of SelectByMask

Source commit: 4b46747252a8d6f7e7c593b9618d3b012a4c835b
Martin Prikryl 8 年之前
父节点
当前提交
543c407f94

+ 0 - 1
source/components/UnixDirView.h

@@ -113,7 +113,6 @@ __published:
   __property OnUpdateStatusBar;
   __property PathLabel;
   __property LoadAnimation;
-  __property OnGetSelectFilter;
 
   __property AddParentDir;
   __property DimmHiddenFiles;

+ 6 - 15
source/forms/CustomScpExplorer.cpp

@@ -3969,20 +3969,6 @@ bool __fastcall TCustomScpExplorerForm::OpenBookmark(UnicodeString Local, Unicod
   return Result;
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::RemoteDirViewGetSelectFilter(
-      TCustomDirView *Sender, bool Select, TFileFilter &Filter)
-{
-  DebugAssert(Sender);
-  if (DoSelectMaskDialog(Sender, Select, &Filter, Configuration))
-  {
-    Configuration->Usage->Inc(L"MaskSelections");
-  }
-  else
-  {
-    Abort();
-  }
-}
-//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::CalculateSize(
   TStrings * FileList, __int64 & Size, TCalculateSizeStats & Stats,
   bool & Close)
@@ -7611,8 +7597,13 @@ void __fastcall TCustomScpExplorerForm::SelectAll(TOperationSide Side, TSelectMo
 void __fastcall TCustomScpExplorerForm::SelectByMask(TOperationSide Side, bool Select)
 {
   TCustomDirView * ADirView = DirView(Side);
-  if (ADirView->DoSelectByMask(Select))
+
+  TFileFilter Filter;
+  DefaultFileFilter(Filter);
+  if (DoSelectMaskDialog(ADirView, Select, &Filter, Configuration))
   {
+    Configuration->Usage->Inc(L"MaskSelections");
+    ADirView->SelectFiles(Filter, Select);
     ADirView->SetFocus();
   }
 }

+ 0 - 1
source/forms/CustomScpExplorer.dfm

@@ -87,7 +87,6 @@ object CustomScpExplorerForm: TCustomScpExplorerForm
       UnixColProperties.TypeVisible = False
       OnDDDragFileName = RemoteFileControlDDDragFileName
       OnBusy = DirViewBusy
-      OnGetSelectFilter = RemoteDirViewGetSelectFilter
       OnSelectItem = DirViewSelectItem
       OnLoaded = DirViewLoaded
       OnExecFile = DirViewExecFile

+ 0 - 2
source/forms/CustomScpExplorer.h

@@ -101,8 +101,6 @@ __published:
   void __fastcall ApplicationRestore(TObject * Sender);
   void __fastcall RemoteDirViewContextPopup(TObject *Sender,
     const TPoint &MousePos, bool &Handled);
-  void __fastcall RemoteDirViewGetSelectFilter(
-    TCustomDirView *Sender, bool Select, TFileFilter &Filter);
   void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
   void __fastcall RemoteDirViewDisplayProperties(TObject *Sender);
   void __fastcall DirViewColumnRightClick(TObject *Sender,

+ 0 - 1
source/forms/ScpCommander.dfm

@@ -1417,7 +1417,6 @@ inherited ScpCommanderForm: TScpCommanderForm
       DirColProperties.ExtVisible = False
       PathLabel = LocalPathLabel
       OnUpdateStatusBar = LocalDirViewUpdateStatusBar
-      OnGetSelectFilter = RemoteDirViewGetSelectFilter
       AddParentDir = True
       OnSelectItem = DirViewSelectItem
       OnLoaded = DirViewLoaded

+ 0 - 17
source/packages/filemng/CustomDirView.pas

@@ -107,7 +107,6 @@ type
     FWantUseDragImages: Boolean;
     FDragDropFilesEx: TCustomizableDragDropFilesEx;
     FUseSystemContextMenu: Boolean;
-    FOnGetSelectFilter: TDVGetFilterEvent;
     FOnStartLoading: TNotifyEvent;
     FOnLoaded: TNotifyEvent;
     FDragDrive: TDrive;
@@ -334,7 +333,6 @@ type
     function CreateFileList(Focused: Boolean; FullPath: Boolean; FileList: TStrings = nil): TStrings;
     function AnyFileSelected(OnlyFocused: Boolean; FilesOnly: Boolean;
       FocusedFileOnlyWhenFocused: Boolean): Boolean;
-    function DoSelectByMask(Select: Boolean): Boolean;
     procedure SelectFiles(Filter: TFileFilter; Select: Boolean);
     procedure ExecuteHomeDirectory; virtual; abstract;
     procedure ExecuteParentDirectory; virtual; abstract;
@@ -416,7 +414,6 @@ type
     property Mask: string read FMask write SetMask;
 
     property OnContextPopup;
-    property OnGetSelectFilter: TDVGetFilterEvent read FOnGetSelectFilter write FOnGetSelectFilter;
     property OnStartLoading: TNotifyEvent read FOnStartLoading write FOnStartLoading;
     property OnLoaded: TNotifyEvent read FOnLoaded write FOnLoaded;
     {The mouse has entered the component window as a target of a drag&drop operation:}
@@ -1309,20 +1306,6 @@ begin
   end;
 end;
 
-function TCustomDirView.DoSelectByMask(Select: Boolean): Boolean;
-var
-  Filter: TFileFilter;
-begin
-  Result := False;
-  if Assigned(FOnGetSelectFilter) then
-  begin
-    DefaultFileFilter(Filter);
-    FOnGetSelectFilter(Self, Select, Filter);
-    SelectFiles(Filter, Select);
-    Result := True;
-  end;
-end;
-
 function TCustomDirView.DragCompleteFileList: Boolean;
 begin
   Result := (MarkedCount <= 100) and (not IsRecycleBin);

+ 0 - 1
source/packages/filemng/DirView.pas

@@ -319,7 +319,6 @@ type
     property DirColProperties: TDirViewColProperties read GetDirColProperties write SetDirColProperties;
     property PathLabel;
     property OnUpdateStatusBar;
-    property OnGetSelectFilter;
 
     property LoadAnimation;
     property DimmHiddenFiles;