Browse Source

Unused code

Source commit: 9f5e8f2a990b05a4da03395e0f33dba9648d101e
Martin Prikryl 3 months ago
parent
commit
757cc40e2f
1 changed files with 14 additions and 44 deletions
  1. 14 44
      source/packages/my/ComboEdit.pas

+ 14 - 44
source/packages/my/ComboEdit.pas

@@ -144,14 +144,12 @@ type
   private
     FErrMode: Cardinal;
     FAcceptFiles: Boolean;
-    FOnDropFiles: TNotifyEvent;
     FOnBeforeDialog: TExecOpenDialogEvent;
     FOnAfterDialog: TExecOpenDialogEvent;
     procedure SetDragAccept(Value: Boolean);
     procedure SetAcceptFiles(Value: Boolean);
     procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
   protected
-    FMultipleDirs: Boolean;
     procedure CreateHandle; override;
     procedure DestroyWindowHandle; override;
     procedure DoAfterDialog(var FileName: string; var Action: Boolean); dynamic;
@@ -167,7 +165,6 @@ type
       write FOnBeforeDialog;
     property OnAfterDialog: TExecOpenDialogEvent read FOnAfterDialog
       write FOnAfterDialog;
-    property OnDropFiles: TNotifyEvent read FOnDropFiles write FOnDropFiles;
     property OnButtonClick;
   end;
 
@@ -290,7 +287,6 @@ type
   published
     property DialogText: string read FDialogText write FDialogText;
     property InitialDir: string read FInitialDir write FInitialDir;
-    property MultipleDirs: Boolean read FMultipleDirs write FMultipleDirs default False;
     property AutoSelect;
     property ButtonHint;
     property BorderStyle;
@@ -357,21 +353,6 @@ end;
 
 { Utility functions }
 
-type
-  TCharSet = TSysCharSet;
-
-function ExtractSubstr(const S: string; var Pos: Integer;
-  const Delims: TCharSet): string;
-var
-  I: Integer;
-begin
-  I := Pos;
-  while (I <= Length(S)) and not CharInSet(S[I], Delims) do Inc(I);
-  Result := Copy(S, Pos, I - Pos);
-  if (I <= Length(S)) and CharInSet(S[I], Delims) then Inc(I);
-  Pos := I;
-end;
-
 function ValidFileName(const FileName: string): Boolean;
   function HasAny(const Str, Substr: string): Boolean;
   var
@@ -698,19 +679,16 @@ end;
 procedure TFileDirEdit.WMDropFiles(var Msg: TWMDropFiles);
 var
   AFileName: array[0..255] of Char;
-  I, Num: Cardinal;
+  Num: Cardinal;
 begin
   Msg.Result := 0;
   try
     Num := DragQueryFile(Msg.Drop, $FFFFFFFF, nil, 0);
-    if Num > 0 then begin
+    if Num > 0 then
+    begin
       ClearFileList;
-      for I := 0 to Num - 1 do begin
-        DragQueryFile(Msg.Drop, I, PChar(@AFileName), Pred(SizeOf(AFileName)));
-        ReceptFileDir(StrPas(AFileName));
-        if not FMultipleDirs then Break;
-      end;
-      if Assigned(FOnDropFiles) then FOnDropFiles(Self);
+      DragQueryFile(Msg.Drop, 0, PChar(@AFileName), Pred(SizeOf(AFileName)));
+      ReceptFileDir(StrPas(AFileName));
     end;
   finally
     DragFinish(Msg.Drop);
@@ -924,11 +902,7 @@ end;
 
 procedure TFilenameEdit.ReceptFileDir(const AFileName: string);
 begin
-  if FMultipleDirs then begin
-    if FDialog.Files.Count = 0 then SetFileName(AFileName);
-    FDialog.Files.Add(AFileName);
-  end
-  else SetFileName(AFileName);
+  SetFileName(AFileName);
 end;
 
 function TFilenameEdit.GetDialogFiles: TStrings;
@@ -1016,10 +990,10 @@ end;
 
 procedure TFilenameEdit.SetOptions(Value: TOpenOptions);
 begin
-  if Value <> FDialog.Options then begin
+  if Value <> FDialog.Options then
+  begin
     FDialog.Options := Value;
-    FMultipleDirs := ofAllowMultiSelect in FDialog.Options;
-    if not FMultipleDirs then ClearFileList;
+    ClearFileList;
   end;
 end;
 
@@ -1058,22 +1032,18 @@ begin
   end;
   if CanFocus then SetFocus;
   DoAfterDialog(Temp, Action);
-  if Action then begin
+  if Action then
+  begin
     SelText := '';
-    if (Text = '') or not MultipleDirs then Text := Temp
-    else Text := Text + ';' + Temp;
+    Text := Temp;
     if (Temp <> '') and DirectoryExists(Temp) then InitialDir := Temp;
   end;
 end;
 
 procedure TDirectoryEdit.ReceptFileDir(const AFileName: string);
-var
-  Temp: string;
 begin
-  if FileExists(ApiPath(AFileName)) then Temp := ExtractFilePath(AFileName)
-  else Temp := AFileName;
-  if (Text = '') or not MultipleDirs then Text := Temp
-  else Text := Text + ';' + Temp;
+  if FileExists(ApiPath(AFileName)) then Text := ExtractFilePath(AFileName)
+    else Text := AFileName;
 end;
 
 initialization