home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap04 / howto03 / delphi10 / ufmgr22.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  57.8 KB  |  1,659 lines

  1. unit Ufmgr22;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, FileCtrl,
  8.    DRWSUtl1, DRWSUtl4;
  9.  
  10. type
  11.   TCCFileMgrForm = class(TForm)
  12.     Panel1: TPanel;
  13.     Panel2: TPanel;
  14.     BitBtn1: TBitBtn;
  15.     Panel3: TPanel;
  16.     Label1: TLabel;
  17.     BitBtn2: TBitBtn;
  18.     BitBtn3: TBitBtn;
  19.     BitBtn4: TBitBtn;
  20.     BitBtn5: TBitBtn;
  21.     BitBtn6: TBitBtn;
  22.     BitBtn7: TBitBtn;
  23.     OpenDialog1: TOpenDialog;
  24.     BitBtn8: TBitBtn;
  25.     BitBtn9: TBitBtn;
  26.     OpenDialog2: TOpenDialog;
  27.     BitBtn10: TBitBtn;
  28.     Panel4: TPanel;
  29.     Panel5: TPanel;
  30.     Panel6: TPanel;
  31.     Panel7: TPanel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.     Label4: TLabel;
  35.     BitBtn11: TBitBtn;
  36.     procedure FormResize(Sender: TObject);
  37.     procedure FormCreate(Sender: TObject);
  38.     procedure BitBtn7Click(Sender: TObject);
  39.     procedure BitBtn1Click(Sender: TObject);
  40.     procedure BitBtn2Click(Sender: TObject);
  41.     procedure BitBtn3Click(Sender: TObject);
  42.     procedure BitBtn4Click(Sender: TObject);
  43.     procedure BitBtn5Click(Sender: TObject);
  44.     procedure FormPaint(Sender: TObject);
  45.     procedure BitBtn8Click(Sender: TObject);
  46.     procedure BitBtn9Click(Sender: TObject);
  47.     procedure BitBtn6Click(Sender: TObject);
  48.     procedure BitBtn1DragDrop(Sender, Source: TObject; X, Y: Integer);
  49.     procedure BitBtn1DragOver(Sender, Source: TObject; X, Y: Integer;
  50.       State: TDragState; var Accept: Boolean);
  51.     procedure BitBtn2DragDrop(Sender, Source: TObject; X, Y: Integer);
  52.     procedure BitBtn3DragDrop(Sender, Source: TObject; X, Y: Integer);
  53.     procedure BitBtn4DragDrop(Sender, Source: TObject; X, Y: Integer);
  54.     procedure BitBtn10Click(Sender: TObject);
  55.     procedure FormDestroy(Sender: TObject);
  56.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  57.       Shift: TShiftState);
  58.     procedure BitBtn9KeyDown(Sender: TObject; var Key: Word;
  59.       Shift: TShiftState);
  60.     procedure Label2Click(Sender: TObject);
  61.     procedure Label3Click(Sender: TObject);
  62.     procedure Label4Click(Sender: TObject);
  63.     procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
  64.       Y: Integer);
  65.     procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  66.       Y: Integer);
  67.     procedure Panel4MouseMove(Sender: TObject; Shift: TShiftState; X,
  68.       Y: Integer);
  69.     procedure Panel3MouseMove(Sender: TObject; Shift: TShiftState; X,
  70.       Y: Integer);
  71.     procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  72.       Y: Integer);
  73.     procedure BitBtn2MouseMove(Sender: TObject; Shift: TShiftState; X,
  74.       Y: Integer);
  75.     procedure BitBtn3MouseMove(Sender: TObject; Shift: TShiftState; X,
  76.       Y: Integer);
  77.     procedure BitBtn4MouseMove(Sender: TObject; Shift: TShiftState; X,
  78.       Y: Integer);
  79.     procedure BitBtn5MouseMove(Sender: TObject; Shift: TShiftState; X,
  80.       Y: Integer);
  81.     procedure BitBtn8MouseMove(Sender: TObject; Shift: TShiftState; X,
  82.       Y: Integer);
  83.     procedure BitBtn9MouseMove(Sender: TObject; Shift: TShiftState; X,
  84.       Y: Integer);
  85.     procedure BitBtn6MouseMove(Sender: TObject; Shift: TShiftState; X,
  86.       Y: Integer);
  87.     procedure BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
  88.       Y: Integer);
  89.     procedure BitBtn10MouseMove(Sender: TObject; Shift: TShiftState; X,
  90.       Y: Integer);
  91.     procedure Panel5MouseMove(Sender: TObject; Shift: TShiftState; X,
  92.       Y: Integer);
  93.     procedure Panel6MouseMove(Sender: TObject; Shift: TShiftState; X,
  94.       Y: Integer);
  95.     procedure Panel7MouseMove(Sender: TObject; Shift: TShiftState; X,
  96.       Y: Integer);
  97.     procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
  98.       Shift: TShiftState; X, Y: Integer);
  99.     procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  100.       Shift: TShiftState; X, Y: Integer);
  101.     procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  102.       Shift: TShiftState; X, Y: Integer);
  103.     procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  104.       Shift: TShiftState; X, Y: Integer);
  105.     procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  106.       Shift: TShiftState; X, Y: Integer);
  107.     procedure BitBtn11Click(Sender: TObject);
  108.   private
  109.     { Private declarations }
  110.   public
  111.     { Public declarations }
  112.     DirectoryListBox1 : TDirectoryListBox;
  113.     FileListBox1 : TIconFileListBox;
  114.     ScrollBox1 : TFileIconPanelScrollbox;
  115.   end;
  116. var
  117.   CCFileMgrForm      : TCCFileMgrForm;
  118.   CurrentView        : Integer;  { This holds the current view setting      }
  119.  
  120. implementation
  121.  
  122. {$R *.DFM}
  123.  
  124. uses DDDFUnit,  { Include custom directory selection form }
  125.      CfmpfUn,   { Include custom options dialog           }
  126.      CCPrnMgr;  { Include printer manager unit            }
  127.  
  128.  
  129. { Set up the resize to replace the icon buttons }
  130. procedure TCCFileMgrForm.FormResize(Sender: TObject);
  131. begin
  132.   { Send in the panel and global buttons list }
  133.   SpacePanelButtons( Panel2 );
  134. end;
  135.  
  136. { Delphi wrote this; use it to set everything up }
  137. procedure TCCFileMgrForm.FormCreate(Sender: TObject);
  138. var TheIconPanel : TFileIconPanel;
  139.     CurrentPath : String;
  140. begin
  141.   { Create the directory list box }
  142.   SavedForm := Self;
  143.   DirectoryListBox1 := TDirectoryListBox.Create( Panel1 );
  144.   DirectoryListBox1.Parent := Panel1;
  145.   DirectoryListBox1.Visible := true;
  146.   DirectoryListbox1.Top := 17;
  147.   DirectoryListbox1.Left := 0;
  148.   DirectoryListbox1.Height := Panel1.Height - 32;
  149.   DirectoryListbox1.Width := 0;
  150.   { Create the file list box }
  151.   FileListBox1 := TIconFileListBox.Create( Panel1 );
  152.   FileListBox1.Parent := Panel1;
  153.   FileListbox1.Top := 17;
  154.   FileListbox1.Left := 146;
  155.   FileListbox1.Height := Panel1.Height - 32;
  156.   FileListbox1.Width := 0;
  157.   FileListBox1.Visible := true;
  158.   FileListBox1.ShowGlyphs := true;
  159.   FileListBox1.MultiSelect := true;
  160.   FileListBox1.DragMode := dmAutomatic;
  161.   { Set intercomponent interactions }
  162.   DirectoryListBox1.FileList := FileListbox1;
  163.   DirectoryListBox1.DirLabel := Label1;
  164.   { Create the scrollbox }
  165.   ScrollBox1 := TFileIconPanelScrollBox.Create( Panel1 );
  166.   ScrollBox1.Parent := Panel1;
  167.   ScrollBox1.align := alClient;
  168.   ScrollBox1.Left := 0;
  169.   ScrollBox1.Top := 0;
  170.   ScrollBox1.Width := Panel1.Width - 32;
  171.   ScrollBox1.Height := Panel1.Height - 32;
  172.   ScrollBox1.IconsNeedRefreshing := false;
  173.   ScrollBox1.TheStoredHandle := Self.Handle;
  174.   ScrollBox1.TheParentForm := Self;
  175.   { Get the current directory with 0 parameter }
  176.   GetDir( 0 , CurrentPath );
  177.   { Set the display caption }
  178.   Label1.Caption := CurrentPath;
  179.   { Add a trailing \ if not root }
  180.   CurrentPath := ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentPath );
  181.   { Get the icons display using scrollbox1 }
  182.   ScrollBox1.GetIconsForEntireDirectory( CurrentPath );
  183.   { Set the Icon View as default }
  184.   CurrentView := 1;
  185.   { Start the FIP IOManager }
  186.   if not assigned( TheIOManager ) then
  187.   begin
  188.     TheIOManager := TIOManager.Create( Self );
  189.     TheIOManager.Parent := Self;
  190.     TheIOManager.InitLocks;
  191.   end;
  192.   if not Assigned( TheMouseManager ) then
  193.   begin
  194.     TheMouseManager := TMouseManager.Create( Self );
  195.     TheMouseManager.InitializeNormal;
  196.   end;
  197.   { Load the special cursor to toggle the LOCK keys }
  198.   Screen.Cursors[ CR_KEYSET ] := LoadCursor( hInstance , 'KEYSET' );
  199.   Screen.Cursors[ CR_NULL ] := LoadCursor( hInstance , 'BLANKCUR' );
  200.   Panel5.Cursor := CR_KEYSET;
  201.   Panel6.Cursor := CR_KEYSET;
  202.   Panel7.Cursor := CR_KEYSET;
  203.   Label2.Visible := TheIOManager.IsCapsLockDown;
  204.   Label3.Visible := TheIOManager.IsNumLockDown;
  205.   Label4.Visible := TheIOManager.IsScrollLockDown;
  206. end;
  207.  
  208. { Delphi wrote this; use it to close the application }
  209. procedure TCCFileMgrForm.BitBtn7Click(Sender: TObject);
  210. begin
  211.   Close;
  212. end;
  213.  
  214. { Delphi wrote this use it to perform a copy on all selected files }
  215. procedure TCCFileMgrForm.BitBtn1Click(Sender: TObject);
  216. var ThePosition  : Integer;       { Loop counter   }
  217.     CurrentName ,                 { Holds work name}
  218.     TheOldString : String;        { Holds Dir      }
  219.     finished     : Boolean;       { Loop control   }
  220.     WorkingDir   : String;        { Holds mod wd   }
  221.     TargetDir    : String;        { target of op   }
  222.     TheResult    : Integer;       { Modal res hold }
  223. begin
  224.   { Get current directory and save it for later }
  225.   GetDir( 0 , TheOldString );
  226.   { Check for need to add trailing \ }
  227.   WorkingDir := TheOldString;
  228.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  229.   { Display the Windows-based directory input form }
  230.   TheResult := DestDDForm.ShowModal;
  231.   { If not cancelled do the copy }
  232.   if TheResult = mrOK then
  233.   begin
  234.     { Get the target directory with \ OK }
  235.     TargetDir := DestDDForm.GetTargetDirectory;
  236.     { Show the hourglass to indicate waiting }
  237.     Screen.Cursor := crHourGlass;
  238.     { Setup to get all selections }
  239.     ThePosition := 1;
  240.     finished := false;
  241.     while not finished do
  242.     begin
  243.       { Call generic file getting routine based on current view}
  244.       case CurrentView of
  245.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  246.              ThePosition );
  247.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  248.              ThePosition );
  249.       end;
  250.       { If returns blank string out of selections so exit }
  251.       if CurrentName = '' then finished := true else
  252.       begin
  253.         { If a directory signal error }
  254.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  255.         begin
  256.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  257.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  258.           begin
  259.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  260.              TargetDir );
  261.           end;
  262.         end
  263.         else
  264.         begin
  265.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  266.         end;
  267.       end;
  268.     end;
  269.     { Reset to normal cursor }
  270.     Screen.Cursor := crDefault;
  271.   end;
  272.   { Reset to the original directory }
  273.   ChDir( TheOldString );
  274. end;
  275.  
  276. { Delphi wrote this, use it to move files which are selected }
  277. procedure TCCFileMgrForm.BitBtn2Click(Sender: TObject);
  278. var ThePosition  : Integer;       { Loop counter   }
  279.     CurrentName ,                 { Holds work name}
  280.     TheOldString : String;        { Holds Dir      }
  281.     finished     : Boolean;       { Loop control   }
  282.     WorkingDir   : String;        { Holds mod wd   }
  283.     TargetDir    : String;        { target of op   }
  284.     TheResult    : Integer;       { Modal res hold }
  285. begin
  286.   { Get current directory and save it for later }
  287.   GetDir( 0 , TheOldString );
  288.   { Check for need to add trailing \ }
  289.   WorkingDir := TheOldString;
  290.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  291.   { Display the Windows-based directory input form }
  292.   TheResult := DestDDForm.ShowModal;
  293.   { If not cancelled do the copy }
  294.   if TheResult = mrOK then
  295.   begin
  296.     { Get the target directory with \ OK }
  297.     TargetDir := DestDDForm.GetTargetDirectory;
  298.     { Show the hourglass to indicate waiting }
  299.     Screen.Cursor := crHourGlass;
  300.     { Set up to get all current selections }
  301.     ThePosition := 1;
  302.     finished := false;
  303.     while not finished do
  304.     begin
  305.       { Call generic file getting routine based on current view}
  306.       case CurrentView of
  307.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  308.              ThePosition );
  309.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  310.              ThePosition );
  311.       end;
  312.       { If returns blank string then out of selections }
  313.       if CurrentName = '' then finished := true else
  314.       begin
  315.         { If a directory signal error }
  316.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  317.         begin
  318.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  319.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  320.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  321.              TargetDir );
  322.         end
  323.         else
  324.         begin
  325.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  326.         end;
  327.       end;
  328.       { Reset to normal cursor }
  329.       Screen.Cursor := crDefault;
  330.     end;
  331.   end;
  332.   { Reset to the original directory }
  333.   ChDir( TheOldString );
  334.   if CurrentView = 1 then { Reset icon display if in view }
  335.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  336. end;
  337.  
  338. { Delphi wrote this, use it to delete files which are selected }
  339. procedure TCCFileMgrForm.BitBtn3Click(Sender: TObject);
  340. var ThePosition  : Integer;       { Loop counter   }
  341.     CurrentName ,                 { Holds work name}
  342.     TheOldString : String;        { Holds Dir      }
  343.     finished     : Boolean;       { Loop control   }
  344.     WorkingDir   : String;        { Holds mod wd   }
  345. begin
  346.   { Get current directory and save it for later }
  347.   GetDir( 0 , TheOldString );
  348.   { Check for need to add trailing \ }
  349.   WorkingDir := TheOldString;
  350.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  351.   { Set up to do loop for selected files }
  352.   ThePosition := 1;
  353.   finished := false;
  354.   while not finished do
  355.   begin
  356.     { Call generic file getting routine based on current view}
  357.     case CurrentView of
  358.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  359.            ThePosition );
  360.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  361.            ThePosition );
  362.     end;
  363.     { if returns blank string out of selections }
  364.     if CurrentName = '' then finished := true else
  365.     begin
  366.       { If its a directory signal error }
  367.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  368.       begin
  369.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation,
  370.          mbYesNoCancel , 0 ) = mrYes then
  371.         begin
  372.           ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  373.           Scrollbox1.TheFWB.RemoveDirectory( Currentname );
  374.         end;
  375.       end
  376.       else
  377.       begin
  378.         { Otherwise get confirmation message and if OKed delete file }
  379.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  380.          mbYesNoCancel , 0 ) = mrYes then
  381.         begin
  382.           ScrollBox1.TheFWB.DeleteTheFile( Currentname );
  383.         end;
  384.       end;
  385.     end;
  386.   end;
  387.   if CurrentView = 1 then { Reset icon display if in view }
  388.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  389. end;
  390.  
  391. { Delphi wrote this; use it to rename selected files }
  392. procedure TCCFileMgrForm.BitBtn4Click(Sender: TObject);
  393. var ThePosition  : Integer;       { Loop counter   }
  394.     CurrentName ,                 { Holds work name}
  395.     TheOldString : String;        { Holds Dir      }
  396.     finished     : Boolean;       { Loop control   }
  397.     WorkingDir   : String;        { Holds mod wd   }
  398. begin
  399.   { Get current directory for later }
  400.   GetDir( 0 , TheOldString );
  401.   { Check for need to add trailing \ }
  402.   WorkingDir := TheOldString;
  403.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  404.   { Set up to do loop for selected files }
  405.   ThePosition := 1;
  406.   finished := false;
  407.   while not finished do
  408.   begin
  409.     { Call generic file getting routine based on current view}
  410.     case CurrentView of
  411.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  412.            ThePosition );
  413.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  414.            ThePosition );
  415.     end;
  416.     { If returns blank string then out of selections }
  417.     if CurrentName = '' then finished := true else
  418.     begin
  419.       { Otherwise set up the opendialog with filename and caption }
  420.       OpenDialog1.Filename := ExtractFilename( CurrentName );
  421.       { Use this to prevent error from changing directories }
  422.       OpenDialog1.Options := [ofNoChangeDir];
  423.       OpenDialog1.Title := 'Rename File';
  424.       { If not cancelled then do rename or signal error }
  425.       if OpenDialog1.Execute then
  426.       begin
  427.         ScrollBox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  428.       end;
  429.     end;
  430.   end;
  431.   if CurrentView = 1 then { Reset icon display if in view }
  432.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  433. end;
  434.  
  435. { Delphi wrote this; use it to make a new directory under current one }
  436. procedure TCCFileMgrForm.BitBtn5Click(Sender: TObject);
  437. begin
  438.   { Set up the dialog to get the new directory name }
  439.   OpenDialog2.FileName := '*.*';
  440.   OpenDialog2.Title := 'Enter Directory Name';
  441.   if OpenDialog1.Execute then
  442.   begin
  443.     { If not cancelled make new directory }
  444.     Scrollbox1.TheFWB.CreateNewDirectory( OpenDialog1.Filename );
  445.   end;
  446.   if CurrentView = 1 then { Reset icon display if in view }
  447.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  448. end;
  449.  
  450. { Delphi wrote this; use it to handle refreshing the scrollbox }
  451. procedure TCCFileMgrForm.FormPaint(Sender: TObject);
  452. var CurrentDirectory : String; { Get current dir }
  453. begin
  454.   { If updated, do refresh }
  455.   if ScrollBox1.IconsNeedRefreshing then
  456.   begin
  457.     Scrollbox1.ClearTheFIPs;
  458.     ScrollBox1.IconsNeedRefreshing := false;
  459.     GetDir( 0 , CurrentDirectory );
  460.     { Force trailing backslash }
  461.     CurrentDirectory := ScrollBox1.TheFWB.ForceTrailingBackSlash(
  462.      CurrentDirectory );
  463.     { Set the label to the new directory }
  464.     Label1.Caption := UpperCase( CurrentDirectory );
  465.     { Do the update }
  466.     ScrollBox1.GetIconsForEntireDirectory( CurrentDirectory );
  467.   end;
  468. end;
  469.  
  470. { Delphi wrote this; use it to reset the current view Icons/List }
  471. procedure TCCFileMgrForm.BitBtn8Click(Sender: TObject);
  472. var TheOldString : String; { Use to get current directory }
  473. begin
  474.   { Reset currentview }
  475.   if CurrentView = 1 then CurrentView := 2 else
  476.    CurrentView := 1;
  477.   { either show the windows boxes or the scrollbox }
  478.   case CurrentView of
  479.     1 : begin
  480.           { Make the listboxes invisible by changing align and width }
  481.           FileListBox1.Visible := false;
  482.           FileListBox1.Align := alNone;
  483.           FileListBox1.Width := 0;
  484.           DirectoryListBox1.Visible := false;
  485.           DirectoryListBox1.align := alNone;
  486.           DirectoryListBox1.Width := 0;
  487.           { Keep them from getting mouse clicks }
  488.           FileListBox1.Enabled := false;
  489.           DirectoryListBox1.Enabled := false;
  490.           { Have the scrollbox get mouse and be seen  by resetting align/wid}
  491.           Scrollbox1.align := alClient;
  492.           Scrollbox1.width := Panel1.Width - 32;
  493.           ScrollBox1.Enabled := true;
  494.           { Tell the scrollbox to repaint itself just in case }
  495.           ScrollBox1.Update;
  496.         end;
  497.     2 : begin
  498.           { Make the listboxes visible by resetting align and width}
  499.           FileListBox1.Visible := true;
  500.           DirectoryListBox1.Visible := true;
  501.           DirectoryListBox1.width := 145;
  502.           DirectoryListBox1.align := alLeft;
  503.           FileListBox1.align := alClient;
  504.           FileListBox1.Width := Panel1.Width - 32 - DirectoryListBox1.Width;
  505.           { Have them getting mouse clicks }
  506.           FileListBox1.Enabled := true;
  507.           DirectoryListBox1.Enabled := true;
  508.           { Have the scrollbox not get mouse and not be seen via align/width}
  509.           ScrollBox1.Enabled := false;
  510.           ScrollBox1.Visible := false;
  511.           ScrollBox1.align := alNone;
  512.           ScrollBox1.Width := 0;
  513.         end;
  514.   end;
  515.   Invalidate;
  516. end;
  517.  
  518. { Delphi wrote this; use it to do a file search display }
  519. procedure TCCFileMgrForm.BitBtn9Click(Sender: TObject);
  520. var CurrentDirectory : String; { Holds current directory }
  521. begin
  522.   { Set up and run the search dialog }
  523.   OpenDialog2.FileName := '*.*';
  524.   { if not cancelled do the search }
  525.   if OpenDialog2.Execute then
  526.   begin
  527.     { Get current directory }
  528.     GetDir( 0 , CurrentDirectory );
  529.     { Force trailing backslash }
  530.     CurrentDirectory :=
  531.      ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentDirectory );
  532.     { display recursive search results }
  533.     GlobalAbortFlag := false;
  534.     Scrollbox1.DisplayRecursiveSearchResults(
  535.      CurrentDirectory + OpenDialog2.Filename );
  536.     Label1.Caption := 'Search Results for ' + CurrentDirectory +
  537.      OpenDialog2.FileName;
  538.   end;
  539. end;
  540.  
  541. { Delphi wrote this; use it to set a file's properties }
  542. procedure TCCFileMgrForm.BitBtn6Click(Sender: TObject);
  543. var ThePosition  : Integer;       { Loop counter   }
  544.     CurrentName ,                 { Holds work name}
  545.     TheOldString : String;        { Holds Dir      }
  546.     finished     : Boolean;       { Loop control   }
  547.     WorkingDir   : String;        { Holds mod wd   }
  548. begin
  549.   { Get current directory for later }
  550.   GetDir( 0 , TheOldString );
  551.   ThePosition := 1;
  552.   { Check for need to add trailing \ }
  553.   Workingdir := TheOldString;
  554.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  555.   { Call generic file getting routine based on current view}
  556.   case CurrentView of
  557.     1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  558.          ThePosition );
  559.     2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  560.          ThePosition );
  561.   end;
  562.   { If nothing selected then abort (gets ..!) }
  563.   if CurrentName = '' then
  564.   begin
  565.     MessageDlg( 'No File Selected!' , mtError , [mbOK] , 0 );
  566.     exit;
  567.   end
  568.   else
  569.   begin
  570.     { Otherwise set up the properties form and show it }
  571.     CCFMPropsForm.WorkingFileName := CurrentName;
  572.     CCFMPropsForm.ThePosition := ThePosition;
  573.     CCFMPropsForm.BitBtn4.Enabled := true;
  574.     CCFMPropsForm.Initialize;
  575.     CCFMPropsForm.ShowModal;
  576.   end;
  577.   if CurrentView = 1 then { Reset icon display if in view }
  578.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  579. end;
  580.  
  581. { Delphi wrote this; use it to drag and drop files for copying }
  582. procedure TCCFileMgrForm.BitBtn1DragDrop(Sender, Source: TObject; X,
  583.   Y: Integer);
  584. var CurrentName ,                 { Holds work name}
  585.     WorkingDir ,
  586.     TheOldString : String;        { Holds Dir      }
  587.     TargetDir    : String;        { target of op   }
  588.     TheResult    : Integer;       { Modal res hold }
  589.     Counter_1    : Integer;
  590. begin
  591.   { Make sure source is indeed a FileIconPanel }
  592.   if Source is TIconFileListbox then
  593.   begin
  594.     with Source as TIconFileListBox do
  595.     begin
  596.      { Get current directory and save it for later }
  597.      GetDir( 0 , TheOldString );
  598.      WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  599.      { Display the Windows-based directory input form }
  600.      TheResult := DestDDForm.ShowModal;
  601.      { If not cancelled do the copy }
  602.      if TheResult = mrOK then
  603.      begin
  604.        for Counter_1 := 1 to Items.Count do
  605.        begin
  606.          if Selected[ Counter_1 - 1 ] then
  607.          begin
  608.             CurrentName := WorkingDIr + Items[ Counter_1 - 1 ];
  609.             { Get the target directory with \ OK }
  610.             TargetDir := DestDDForm.GetTargetDirectory;
  611.             { If a directory signal and do recursive operation }
  612.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  613.             begin
  614.               if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  615.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  616.               begin
  617.                 ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  618.                  TargetDir );
  619.               end;
  620.             end
  621.             else
  622.             begin
  623.               { Do the copy }
  624.               Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  625.             end;
  626.             { Reset to the original directory }
  627.             ChDir( TheOldString );
  628.           end;
  629.         end;
  630.       end;
  631.     end;
  632.     FileListBox1.Update;
  633.     exit;
  634.   end;
  635.   if TheIOManager.WasSHIFTPressed then
  636.   begin
  637.     BitBtn1Click( Source );
  638.     exit;
  639.   end;
  640.   with Source as TFileIconPanel do
  641.   begin
  642.     { Get current directory and save it for later }
  643.     GetDir( 0 , TheOldString );
  644.     { Display the Windows-based directory input form }
  645.     TheResult := DestDDForm.ShowModal;
  646.     { If not cancelled do the copy }
  647.     if TheResult = mrOK then
  648.     begin
  649.       CurrentName := FTheName;
  650.       { Get the target directory with \ OK }
  651.       TargetDir := DestDDForm.GetTargetDirectory;
  652.       { If a directory signal and do recursive operation }
  653.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  654.       begin
  655.         if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  656.          +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  657.         begin
  658.           ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  659.            TargetDir );
  660.         end;
  661.       end
  662.       else
  663.       begin
  664.         { Do the copy }
  665.         Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  666.       end;
  667.       { Reset to the original directory }
  668.       ChDir( TheOldString );
  669.     end;
  670.   end;
  671. end;
  672.  
  673. { Delphi wrote this; use it to generically OK DnD from FIPs }
  674. procedure TCCFileMgrForm.BitBtn1DragOver(Sender, Source: TObject; X,
  675.   Y: Integer; State: TDragState; var Accept: Boolean);
  676. begin
  677.   { Only accept from FileIconPanel components }
  678.   if ( Source is TFileIconPanel ) or
  679.      ( Source is TIconFileListBox ) then Accept := true else Accept := false;
  680. end;
  681.  
  682. { Delphi wrote this; use it to accept Drag and Drop moving }
  683. procedure TCCFileMgrForm.BitBtn2DragDrop(Sender, Source: TObject; X,
  684.   Y: Integer);
  685. var CurrentName ,                 { Holds work name}
  686.     WorkingDir ,
  687.     TheOldString : String;        { Holds Dir      }
  688.     TargetDir    : String;        { target of op   }
  689.     TheResult       : Integer;    { Modal res hold }
  690.     Counter_1   : Integer;
  691. begin
  692.   { Make sure source is indeed a FileIconPanel }
  693.   if Source is TIconFileListbox then
  694.   begin
  695.     with Source as TIconFileListBox do
  696.     begin
  697.       { Get current directory and save it for later }
  698.       GetDir( 0 , TheOldString );
  699.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  700.       { Display the Windows-based directory input form }
  701.       TheResult := DestDDForm.ShowModal;
  702.       for Counter_1 := 1 to Items.Count do
  703.       begin
  704.         if Selected[ Counter_1 - 1 ] then
  705.         begin
  706.           { If not cancelled do the copy }
  707.           if TheResult = mrOK then
  708.           begin
  709.             CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  710.             { Get the target directory with \ OK }
  711.             TargetDir := DestDDForm.GetTargetDirectory;
  712.             { If a directory signal and do recursive operation }
  713.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  714.             begin
  715.               if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir
  716.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  717.               begin
  718.                 ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  719.                  TargetDir );
  720.               end;
  721.             end
  722.             else
  723.             begin
  724.               { Do the copy }
  725.               Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  726.             end;
  727.             { Reset to the original directory }
  728.             ChDir( TheOldString );
  729.           end;
  730.         end;
  731.       end;
  732.     end;
  733.     FileListBox1.Update;
  734.     exit;
  735.   end;
  736.   if TheIOManager.WasSHIFTPressed then
  737.   begin
  738.     BitBtn2Click( Source );
  739.     exit;
  740.   end;
  741.   with Source as TFileIconPanel do
  742.   begin
  743.     { Get current directory and save it for later }
  744.     GetDir( 0 , TheOldString );
  745.     { Display the Windows-based directory input form }
  746.     TheResult := DestDDForm.ShowModal;
  747.     { If not cancelled do the copy }
  748.     if TheResult = mrOK then
  749.     begin
  750.       { Get the target directory with \ OK }
  751.       TargetDir := DestDDForm.GetTargetDirectory;
  752.       { If Copyfile returns false an error occurred }
  753.       CurrentName := FTheName;
  754.       { If a directory signal and do recursion }
  755.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  756.       begin
  757.         if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  758.          '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  759.           ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  760.            TargetDir );
  761.       end
  762.       else
  763.       begin  { Do the move }
  764.         Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  765.         ChDir( TheOldString );
  766.       end;
  767.       { Refresh display }
  768.       ScrollBox1.Update;
  769.     end;
  770.   end;
  771. end;
  772.  
  773. { Delphi wrote this; use it to do drag and drop deletes }
  774. procedure TCCFileMgrForm.BitBtn3DragDrop(Sender, Source: TObject; X,
  775.   Y: Integer);
  776. var WorkingDir ,
  777.     CurrentName : String;  { Holds work name}
  778.     Counter_1   : Integer;
  779. begin
  780.   { Make sure source is indeed a FileIconPanel }
  781.   if Source is TIconFileListbox then
  782.   begin
  783.     with Source as TIconFileListBox do
  784.     begin
  785.       GetDir( 0 , WorkingDir );
  786.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  787.       for Counter_1 := 1 to Items.Count do
  788.       begin
  789.         if Selected[ Counter_1 - 1 ] then
  790.         begin
  791.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  792.           { If a directory signal and do recursive operation }
  793.           if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  794.           begin
  795.             if MessageDlg( 'Delete Directory ' + CurrentName +'?',
  796.              mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  797.             begin
  798.               ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  799.               Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  800.             end;
  801.           end
  802.           else
  803.           begin
  804.             if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  805.              mbYesNoCancel , 0 ) = mrYes then
  806.             begin
  807.               Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  808.             end;
  809.           end;
  810.         end;
  811.       end;
  812.     end;
  813.     FileListBox1.Update;
  814.     exit;
  815.   end;
  816.   if TheIOManager.WasSHIFTPressed then
  817.   begin
  818.     BitBtn3Click( Source );
  819.     exit;
  820.   end;
  821.   with Source as TFileIconPanel do
  822.   begin
  823.     CurrentName := FTheName;
  824.     { If its a directory signal and do recursive delete }
  825.     if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  826.     begin
  827.       if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  828.        mbYesNoCancel , 0 ) = mrYes then
  829.       begin
  830.         Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  831.         Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  832.       end;
  833.     end
  834.     else
  835.     begin
  836.       { Otherwise get confirmation message and if OKed delete file }
  837.       if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  838.        mbYesNoCancel , 0 ) = mrYes then
  839.       begin
  840.         Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  841.       end;
  842.     end;
  843.     { Refresh Display }
  844.     Scrollbox1.Update;
  845.   end;
  846. end;
  847.  
  848. { Delphi wrote this; use it to do drag and drop renames }
  849. procedure TCCFileMgrForm.BitBtn4DragDrop(Sender, Source: TObject; X,
  850.   Y: Integer);
  851. var WorkingDir ,
  852.     CurrentName : String;  { Holds work name}
  853.     Counter_1   : Integer;
  854. begin
  855.   { Make sure source is indeed a FileIconPanel }
  856.   if Source is TIconFileListbox then
  857.   begin
  858.     with Source as TIconFileListBox do
  859.     begin
  860.       GetDir( 0 , WorkingDir );
  861.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  862.       for Counter_1 := 1 to Items.Count do
  863.       begin
  864.         if Selected[ Counter_1 - 1 ] then
  865.         begin
  866.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  867.           { Otherwise set up the opendialog with filename and caption }
  868.           OpenDialog2.Filename := ExtractFilename( CurrentName );
  869.           { Use this to prevent error from changing directories }
  870.           OpenDialog2.Options := [ofNoChangeDir];
  871.           OpenDialog2.Title := 'Rename File';
  872.           { If not cancelled then do rename or signal error }
  873.           if OpenDialog2.Execute then
  874.           begin
  875.             Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  876.           end;
  877.         end;
  878.       end;
  879.     end;
  880.     FileListBox1.Update;
  881.     exit;
  882.   end;
  883.   if TheIOManager.WasSHIFTPressed then
  884.   begin
  885.     BitBtn4Click( Source );
  886.     exit;
  887.   end;
  888.   with Source as TFileIconPanel do
  889.   begin
  890.     CurrentName := FTheName;
  891.     { If a directory signal error }
  892.     { Otherwise set up the opendialog with filename and caption }
  893.     OpenDialog2.Filename := ExtractFilename( CurrentName );
  894.     { Use this to prevent error from changing directories }
  895.     OpenDialog2.Options := [ofNoChangeDir];
  896.     OpenDialog2.Title := 'Rename File';
  897.     { If not cancelled then do rename or signal error }
  898.     if OpenDialog2.Execute then
  899.     begin
  900.       Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  901.     end;
  902.     { Refresh the display }
  903.     ScrollBox1.Update;
  904.   end;
  905. end;
  906.  
  907. procedure TCCFileMgrForm.BitBtn10Click(Sender: TObject);
  908. var TheCCFMForm : TCCFileMgrForm;
  909. begin
  910.   TheCCFMForm := TCCFileMgrForm.Create( Application );
  911.   TheCCFMForm.Show;
  912. end;
  913.  
  914. procedure TCCFileMgrForm.FormDestroy(Sender: TObject);
  915. begin
  916.   { Release the IO Manager }
  917.   if assigned( TheIOManager) then
  918.   begin
  919.     TheIOManager.Free;
  920.     TheIOManager := nil;
  921.   end;
  922.   if Assigned( TheMouseManager ) then
  923.   begin
  924.     TheMouseManager.Free;
  925.     TheMouseManager := nil;
  926.   end;
  927. end;
  928.  
  929. procedure TCCFileMgrForm.FormKeyDown(Sender: TObject; var Key: Word;
  930.   Shift: TShiftState);
  931. var S_lock , N_Lock , C_lock : Boolean;
  932. begin
  933.   case Key of
  934.     VK_Capital : begin
  935.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  936.                    C_Lock := not C_Lock;
  937.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  938.                    Label2.Visible := C_Lock;
  939.                  end;
  940.     VK_End : begin
  941.                 ScrollBox1.VertScrollbar.Position :=
  942.                  ScrollBox1.VertScrollbar.Range;
  943.                 ScrollBox1.HorzScrollbar.Position :=
  944.                  ScrollBox1.HorzScrollBar.Range;
  945.              end;
  946.     VK_Home : begin
  947.                 ScrollBox1.VertScrollbar.Position := 0;
  948.                 ScrollBox1.HorzScrollbar.Position := 0;
  949.               end;
  950.     VK_Left : begin
  951.                 TheMouseManager.InitializeNormal;
  952.                 TheIOManager.WhichState := Shift;
  953.                 if TheIOManager.WasSHIFTPressed then
  954.                  TheMouseManager.MoveSmallJumpLeft else
  955.                   if TheIOManager.WasCTRLPressed then
  956.                    TheMouseManager.MoveLargeJumpLeft else
  957.                     TheMouseManager.MoveSinglePixelLeft;
  958.               end;
  959.     VK_Up : begin
  960.                 TheMouseManager.InitializeNormal;
  961.                 TheIOManager.WhichState := Shift;
  962.                 if TheIOManager.WasSHIFTPressed then
  963.                  TheMouseManager.MoveSmallJumpUP else
  964.                   if TheIOManager.WasCTRLPressed then
  965.                    TheMouseManager.MoveLargeJumpUp else
  966.                     TheMouseManager.MoveSinglePixelUp;
  967.               end;
  968.     VK_Right : begin
  969.                 TheMouseManager.InitializeNormal;
  970.                 TheIOManager.WhichState := Shift;
  971.                 if TheIOManager.WasSHIFTPressed then
  972.                  TheMouseManager.MoveSmallJumpRight else
  973.                   if TheIOManager.WasCTRLPressed then
  974.                    TheMouseManager.MoveLargeJumpRight else
  975.                     TheMouseManager.MoveSinglePixelRight;
  976.               end;
  977.     VK_Down : begin
  978.                 TheMouseManager.InitializeNormal;
  979.                 TheIOManager.WhichState := Shift;
  980.                 if TheIOManager.WasSHIFTPressed then
  981.                  TheMouseManager.MoveSmallJumpDown else
  982.                   if TheIOManager.WasCTRLPressed then
  983.                    TheMouseManager.MoveLargeJumpDown else
  984.                     TheMouseManager.MoveSinglePixelDown;
  985.               end;
  986.     VK_F1 : TheIOManager.OnF1Pressed( Sender , Key , Shift );
  987.     VK_F2 : TheIOManager.OnF2Pressed( Sender , Key , Shift );
  988.     VK_F3 : TheIOManager.OnF3Pressed( Sender , Key , Shift );
  989.     VK_F4 : TheIOManager.OnF4Pressed( Sender , Key , Shift );
  990.     VK_F5 : TheIOManager.OnF5Pressed( Sender , Key , Shift );
  991.     VK_F6 : TheIOManager.OnF6Pressed( Sender , Key , Shift );
  992.     VK_F7 : TheIOManager.OnF7Pressed( Sender , Key , Shift );
  993.     VK_F8 : TheIOManager.OnF8Pressed( Sender , Key , Shift );
  994.     VK_F9 : TheIOManager.OnF9Pressed( Sender , Key , Shift );
  995.     VK_F10 : TheIOManager.OnF10Pressed( Sender , Key , Shift );
  996.     VK_F11 : TheIOManager.OnF11Pressed( Sender , Key , Shift );
  997.     VK_F12 : TheIOManager.OnF12Pressed( Sender , Key , Shift );
  998.     VK_Numlock : Begin
  999.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1000.                    N_Lock := not N_Lock;
  1001.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1002.                    Label3.Visible := N_Lock;
  1003.                  end;
  1004.     VK_Scroll : Begin
  1005.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1006.                    S_Lock := not S_Lock;
  1007.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1008.                    Label4.Visible := S_Lock;
  1009.                 end;
  1010.   end;
  1011. end;
  1012.  
  1013. procedure TCCFileMgrForm.BitBtn9KeyDown(Sender: TObject; var Key: Word;
  1014.   Shift: TShiftState);
  1015. begin
  1016.   case Key of
  1017.     VK_CANCEL : begin
  1018.                   if MessageDlg( 'Control Break Pressed! Abort Search?',
  1019.                    mtConfirmation,mbYesNoCancel,0) = mrYes
  1020.                     then GlobalAbortFlag := true;
  1021.                 end;
  1022.   end;
  1023. end;
  1024.  
  1025. procedure TCCFileMgrForm.Label2Click(Sender: TObject);
  1026. var C_Lock , N_Lock , S_Lock : Boolean;
  1027. begin
  1028.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1029.   C_Lock := not C_Lock;
  1030.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1031.   Label2.Visible := C_Lock;
  1032. end;
  1033.  
  1034. procedure TCCFileMgrForm.Label3Click(Sender: TObject);
  1035. var C_Lock , N_Lock , S_Lock : Boolean;
  1036. begin
  1037.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1038.   N_Lock := not N_Lock;
  1039.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1040.   Label3.Visible := N_Lock;
  1041. end;
  1042.  
  1043. procedure TCCFileMgrForm.Label4Click(Sender: TObject);
  1044. var C_Lock , N_Lock , S_Lock : Boolean;
  1045. begin
  1046.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1047.   S_Lock := not S_Lock;
  1048.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1049.   Label4.Visible := S_Lock;
  1050. end;
  1051.  
  1052. procedure TCCFileMgrForm.Panel2MouseMove(Sender: TObject;
  1053.   Shift: TShiftState; X, Y: Integer);
  1054. var ThePoint, TheOtherPoint : TPoint;
  1055. begin
  1056.   if IconDragging then
  1057.   begin
  1058.     ThePoint.X := X + Panel2.Left;
  1059.     ThePoint.Y := Y + Panel2.Top;
  1060.     TheOtherPoint := ClientToScreen( ThePoint );
  1061.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1062.     exit;
  1063.   end;
  1064.   if BitmapDragging then
  1065.   begin
  1066.     ThePoint.X := X + Panel2.Left;
  1067.     ThePoint.Y := Y + Panel2.Top;
  1068.     TheOtherPoint := ClientToScreen( ThePoint );
  1069.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1070.     exit;
  1071.   end;
  1072. end;
  1073.  
  1074. procedure TCCFileMgrForm.Panel1MouseMove(Sender: TObject;
  1075.   Shift: TShiftState; X, Y: Integer);
  1076. var ThePoint, TheOtherPoint : TPoint;
  1077. begin
  1078.   if IconDragging then
  1079.   begin
  1080.     ThePoint.X := X + Panel1.Left;
  1081.     ThePoint.Y := Y + Panel1.Top;
  1082.     TheOtherPoint := ClientToScreen( ThePoint );
  1083.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1084.     exit;
  1085.   end;
  1086.   if BitmapDragging then
  1087.   begin
  1088.     ThePoint.X := X + Panel1.Left;
  1089.     ThePoint.Y := Y + Panel1.Top;
  1090.     TheOtherPoint := ClientToScreen( ThePoint );
  1091.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1092.     exit;
  1093.   end;
  1094. end;
  1095.  
  1096. procedure TCCFileMgrForm.Panel4MouseMove(Sender: TObject;
  1097.   Shift: TShiftState; X, Y: Integer);
  1098. var ThePoint, TheOtherPoint : TPoint;
  1099. begin
  1100.   if IconDragging then
  1101.   begin
  1102.     ThePoint.X := X + Panel4.Left;
  1103.     ThePoint.Y := Y + Panel4.Top;
  1104.     TheOtherPoint := ClientToScreen( ThePoint );
  1105.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1106.     exit;
  1107.   end;
  1108.   if BitmapDragging then
  1109.   begin
  1110.     ThePoint.X := X + Panel4.Left;
  1111.     ThePoint.Y := Y + Panel4.Top;
  1112.     TheOtherPoint := ClientToScreen( ThePoint );
  1113.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1114.     exit;
  1115.   end;
  1116. end;
  1117.  
  1118. procedure TCCFileMgrForm.Panel3MouseMove(Sender: TObject;
  1119.   Shift: TShiftState; X, Y: Integer);
  1120. var ThePoint, TheOtherPoint : TPoint;
  1121. begin
  1122.   if IconDragging then
  1123.   begin
  1124.     ThePoint.X := X + Panel3.Left;
  1125.     ThePoint.Y := Y + Panel3.Top;
  1126.     TheOtherPoint := ClientToScreen( ThePoint );
  1127.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1128.     exit;
  1129.   end;
  1130.   if BitmapDragging then
  1131.   begin
  1132.     ThePoint.X := X + Panel3.Left;
  1133.     ThePoint.Y := Y + Panel3.Top;
  1134.     TheOtherPoint := ClientToScreen( ThePoint );
  1135.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1136.     exit;
  1137.   end;
  1138. end;
  1139.  
  1140. procedure TCCFileMgrForm.BitBtn1MouseMove(Sender: TObject;
  1141.   Shift: TShiftState; X, Y: Integer);
  1142. var ThePoint, TheOtherPoint : TPoint;
  1143. begin
  1144.   if IconDragging then
  1145.   begin
  1146.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1147.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1148.     TheOtherPoint := ClientToScreen( ThePoint );
  1149.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1150.     exit;
  1151.   end;
  1152.   if BitmapDragging then
  1153.   begin
  1154.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1155.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1156.     TheOtherPoint := ClientToScreen( ThePoint );
  1157.     TheMouseManager.MovebitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1158.     exit;
  1159.   end;
  1160. end;
  1161.  
  1162. procedure TCCFileMgrForm.BitBtn2MouseMove(Sender: TObject;
  1163.   Shift: TShiftState; X, Y: Integer);
  1164. var ThePoint, TheOtherPoint : TPoint;
  1165. begin
  1166.   if IconDragging then
  1167.   begin
  1168.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1169.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1170.     TheOtherPoint := ClientToScreen( ThePoint );
  1171.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1172.     exit;
  1173.   end;
  1174.   if BitmapDragging then
  1175.   begin
  1176.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1177.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1178.     TheOtherPoint := ClientToScreen( ThePoint );
  1179.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1180.     exit;
  1181.   end;
  1182. end;
  1183.  
  1184. procedure TCCFileMgrForm.BitBtn3MouseMove(Sender: TObject;
  1185.   Shift: TShiftState; X, Y: Integer);
  1186. var ThePoint, TheOtherPoint : TPoint;
  1187. begin
  1188.   if IconDragging then
  1189.   begin
  1190.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1191.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1192.     TheOtherPoint := ClientToScreen( ThePoint );
  1193.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1194.     exit;
  1195.   end;
  1196.   if BitmapDragging then
  1197.   begin
  1198.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1199.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1200.     TheOtherPoint := ClientToScreen( ThePoint );
  1201.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1202.     exit;
  1203.   end;
  1204. end;
  1205.  
  1206. procedure TCCFileMgrForm.BitBtn4MouseMove(Sender: TObject;
  1207.   Shift: TShiftState; X, Y: Integer);
  1208. var ThePoint, TheOtherPoint : TPoint;
  1209. begin
  1210.   if IconDragging then
  1211.   begin
  1212.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1213.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1214.     TheOtherPoint := ClientToScreen( ThePoint );
  1215.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1216.     exit;
  1217.   end;
  1218.   if BitmapDragging then
  1219.   begin
  1220.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1221.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1222.     TheOtherPoint := ClientToScreen( ThePoint );
  1223.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1224.     exit;
  1225.   end;
  1226. end;
  1227.  
  1228. procedure TCCFileMgrForm.BitBtn5MouseMove(Sender: TObject;
  1229.   Shift: TShiftState; X, Y: Integer);
  1230. var ThePoint, TheOtherPoint : TPoint;
  1231. begin
  1232.   if IconDragging then
  1233.   begin
  1234.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1235.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1236.     TheOtherPoint := ClientToScreen( ThePoint );
  1237.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1238.     exit;
  1239.   end;
  1240.   if BitmapDragging then
  1241.   begin
  1242.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1243.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1244.     TheOtherPoint := ClientToScreen( ThePoint );
  1245.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1246.     exit;
  1247.   end;
  1248. end;
  1249.  
  1250. procedure TCCFileMgrForm.BitBtn8MouseMove(Sender: TObject;
  1251.   Shift: TShiftState; X, Y: Integer);
  1252. var ThePoint, TheOtherPoint : TPoint;
  1253. begin
  1254.   if IconDragging then
  1255.   begin
  1256.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1257.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1258.     TheOtherPoint := ClientToScreen( ThePoint );
  1259.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1260.     exit;
  1261.   end;
  1262.   if BitmapDragging then
  1263.   begin
  1264.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1265.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1266.     TheOtherPoint := ClientToScreen( ThePoint );
  1267.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1268.     exit;
  1269.   end;
  1270. end;
  1271.  
  1272. procedure TCCFileMgrForm.BitBtn9MouseMove(Sender: TObject;
  1273.   Shift: TShiftState; X, Y: Integer);
  1274. var ThePoint, TheOtherPoint : TPoint;
  1275. begin
  1276.   if IconDragging then
  1277.   begin
  1278.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1279.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1280.     TheOtherPoint := ClientToScreen( ThePoint );
  1281.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1282.     exit;
  1283.   end;
  1284.   if BitmapDragging then
  1285.   begin
  1286.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1287.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1288.     TheOtherPoint := ClientToScreen( ThePoint );
  1289.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1290.     exit;
  1291.   end;
  1292. end;
  1293.  
  1294. procedure TCCFileMgrForm.BitBtn6MouseMove(Sender: TObject;
  1295.   Shift: TShiftState; X, Y: Integer);
  1296. var ThePoint, TheOtherPoint : TPoint;
  1297. begin
  1298.   if IconDragging then
  1299.   begin
  1300.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1301.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1302.     TheOtherPoint := ClientToScreen( ThePoint );
  1303.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1304.     exit;
  1305.   end;
  1306.   if BitmapDragging then
  1307.   begin
  1308.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1309.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1310.     TheOtherPoint := ClientToScreen( ThePoint );
  1311.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1312.     exit;
  1313.   end;
  1314. end;
  1315.  
  1316. procedure TCCFileMgrForm.BitBtn7MouseMove(Sender: TObject;
  1317.   Shift: TShiftState; X, Y: Integer);
  1318. var ThePoint, TheOtherPoint : TPoint;
  1319. begin
  1320.   if IconDragging then
  1321.   begin
  1322.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1323.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1324.     TheOtherPoint := ClientToScreen( ThePoint );
  1325.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1326.     exit;
  1327.   end;
  1328.   if BitmapDragging then
  1329.   begin
  1330.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1331.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1332.     TheOtherPoint := ClientToScreen( ThePoint );
  1333.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1334.     exit;
  1335.   end;
  1336. end;
  1337.  
  1338. procedure TCCFileMgrForm.BitBtn10MouseMove(Sender: TObject;
  1339.   Shift: TShiftState; X, Y: Integer);
  1340. var ThePoint, TheOtherPoint : TPoint;
  1341. begin
  1342.   if IconDragging then
  1343.   begin
  1344.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1345.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1346.     TheOtherPoint := ClientToScreen( ThePoint );
  1347.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1348.     exit;
  1349.   end;
  1350.   if BitmapDragging then
  1351.   begin
  1352.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1353.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1354.     TheOtherPoint := ClientToScreen( ThePoint );
  1355.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1356.     exit;
  1357.   end;
  1358. end;
  1359.  
  1360. procedure TCCFileMgrForm.Panel5MouseMove(Sender: TObject;
  1361.   Shift: TShiftState; X, Y: Integer);
  1362. var ThePoint, TheOtherPoint : TPoint;
  1363. begin
  1364.   if IconDragging then
  1365.   begin
  1366.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1367.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1368.     TheOtherPoint := ClientToScreen( ThePoint );
  1369.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1370.     exit;
  1371.   end;
  1372.   if BitmapDragging then
  1373.   begin
  1374.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1375.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1376.     TheOtherPoint := ClientToScreen( ThePoint );
  1377.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1378.     exit;
  1379.   end;
  1380. end;
  1381.  
  1382. procedure TCCFileMgrForm.Panel6MouseMove(Sender: TObject;
  1383.   Shift: TShiftState; X, Y: Integer);
  1384. var ThePoint, TheOtherPoint : TPoint;
  1385. begin
  1386.   if IconDragging then
  1387.   begin
  1388.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1389.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1390.     TheOtherPoint := ClientToScreen( ThePoint );
  1391.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1392.     exit;
  1393.   end;
  1394.   if BitmapDragging then
  1395.   begin
  1396.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1397.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1398.     TheOtherPoint := ClientToScreen( ThePoint );
  1399.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1400.     exit;
  1401.   end;
  1402. end;
  1403.  
  1404. procedure TCCFileMgrForm.Panel7MouseMove(Sender: TObject;
  1405.   Shift: TShiftState; X, Y: Integer);
  1406. var ThePoint, TheOtherPoint : TPoint;
  1407. begin
  1408.   if IconDragging then
  1409.   begin
  1410.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1411.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1412.     TheOtherPoint := ClientToScreen( ThePoint );
  1413.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1414.     exit;
  1415.   end;
  1416.   if BitmapDragging then
  1417.   begin
  1418.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1419.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1420.     TheOtherPoint := ClientToScreen( ThePoint );
  1421.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1422.     exit;
  1423.   end;
  1424. end;
  1425.  
  1426. procedure TCCFileMgrForm.Panel1MouseUp(Sender: TObject;
  1427.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1428. begin
  1429.   if ( IconDragging or BitmapDragging ) then
  1430.   begin
  1431.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1432.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1433.     IconDragging := false;
  1434.     BitmapDragging := false;
  1435.     Invalidate;
  1436.   end;
  1437. end;
  1438.  
  1439. procedure TCCFileMgrForm.BitBtn1MouseUp(Sender: TObject;
  1440.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1441. var CurrentName ,                 { Holds work name}
  1442.     WorkingDir ,
  1443.     TheOldString : String;        { Holds Dir      }
  1444.     TargetDir    : String;        { target of op   }
  1445.     TheResult    : Integer;       { Modal res hold }
  1446.     Counter_1    : Integer;
  1447. begin
  1448.   If ( IconDragging  or BitmapDragging )then
  1449.   begin
  1450.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1451.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1452.     IconDragging := false;
  1453.     BitmapDragging := false;
  1454.     with GlobalSource as TFileIconPanel do
  1455.     begin
  1456.       { Get current directory and save it for later }
  1457.       GetDir( 0 , TheOldString );
  1458.       { Display the Windows-based directory input form }
  1459.       TheResult := DestDDForm.ShowModal;
  1460.       { If not cancelled do the copy }
  1461.       if TheResult = mrOK then
  1462.       begin
  1463.         CurrentName := FTheName;
  1464.         { Get the target directory with \ OK }
  1465.         TargetDir := DestDDForm.GetTargetDirectory;
  1466.         { If a directory signal and do recursive operation }
  1467.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1468.         begin
  1469.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  1470.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  1471.           begin
  1472.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  1473.              TargetDir );
  1474.           end;
  1475.         end
  1476.         else
  1477.         begin
  1478.           { Do the copy }
  1479.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  1480.         end;
  1481.         { Reset to the original directory }
  1482.         ChDir( TheOldString );
  1483.       end
  1484.       else Invalidate;
  1485.     end;
  1486.   end;
  1487. end;
  1488.  
  1489. procedure TCCFileMgrForm.BitBtn2MouseUp(Sender: TObject;
  1490.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1491. var CurrentName ,                 { Holds work name}
  1492.     WorkingDir ,
  1493.     TheOldString : String;        { Holds Dir      }
  1494.     TargetDir    : String;        { target of op   }
  1495.     TheResult       : Integer;    { Modal res hold }
  1496.     Counter_1   : Integer;
  1497. begin
  1498.   If ( IconDragging  or BitmapDragging )then
  1499.   begin
  1500.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1501.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1502.     IconDragging := false;
  1503.     BitmapDragging := false;
  1504.     with GlobalSource as TFileIconPanel do
  1505.     begin
  1506.       { Get current directory and save it for later }
  1507.       GetDir( 0 , TheOldString );
  1508.       { Display the Windows-based directory input form }
  1509.       TheResult := DestDDForm.ShowModal;
  1510.       { If not cancelled do the copy }
  1511.       if TheResult = mrOK then
  1512.       begin
  1513.         { Get the target directory with \ OK }
  1514.         TargetDir := DestDDForm.GetTargetDirectory;
  1515.         { If Copyfile returns false an error occurred }
  1516.         CurrentName := FTheName;
  1517.         { If a directory signal and do recursion }
  1518.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1519.         begin
  1520.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  1521.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  1522.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  1523.              TargetDir );
  1524.         end
  1525.         else
  1526.         begin  { Do the move }
  1527.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  1528.           ChDir( TheOldString );
  1529.         end;
  1530.         { Refresh display }
  1531.         ScrollBox1.Update;
  1532.       end
  1533.       else Invalidate;
  1534.     end;
  1535.   end;
  1536. end;
  1537.  
  1538. procedure TCCFileMgrForm.BitBtn3MouseUp(Sender: TObject;
  1539.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1540. var WorkingDir ,
  1541.     CurrentName : String;  { Holds work name}
  1542.     Counter_1   : Integer;
  1543. begin
  1544.   If ( IconDragging  or BitmapDragging )then
  1545.   begin
  1546.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1547.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1548.     IconDragging := false;
  1549.     BitmapDragging := false;
  1550.     with GLobalSource as TFileIconPanel do
  1551.     begin
  1552.       CurrentName := FTheName;
  1553.       { If its a directory signal and do recursive delete }
  1554.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1555.       begin
  1556.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  1557.          mbYesNoCancel , 0 ) = mrYes then
  1558.         begin
  1559.           Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  1560.           Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  1561.         end
  1562.         else Invalidate;
  1563.       end
  1564.       else
  1565.       begin
  1566.         { Otherwise get confirmation message and if OKed delete file }
  1567.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  1568.          mbYesNoCancel , 0 ) = mrYes then
  1569.         begin
  1570.           Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  1571.         end
  1572.         else Invalidate;
  1573.       end;
  1574.       { Refresh Display }
  1575.       Scrollbox1.Update;
  1576.     end;
  1577.   end;
  1578. end;
  1579.  
  1580. procedure TCCFileMgrForm.BitBtn4MouseUp(Sender: TObject;
  1581.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1582. var WorkingDir ,
  1583.     CurrentName : String;  { Holds work name}
  1584.     Counter_1   : Integer;
  1585. begin
  1586.   If ( IconDragging  or BitmapDragging )then
  1587.   begin
  1588.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1589.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1590.     IconDragging := false;
  1591.     BitmapDragging := false;
  1592.     with GlobalSource as TFileIconPanel do
  1593.     begin
  1594.       CurrentName := FTheName;
  1595.       { If a directory signal error }
  1596.       { Otherwise set up the opendialog with filename and caption }
  1597.       OpenDialog2.Filename := ExtractFilename( CurrentName );
  1598.       { Use this to prevent error from changing directories }
  1599.       OpenDialog2.Options := [ofNoChangeDir];
  1600.       OpenDialog2.Title := 'Rename File';
  1601.       { If not cancelled then do rename or signal error }
  1602.       if OpenDialog2.Execute then
  1603.       begin
  1604.         Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  1605.       end
  1606.       else Invalidate;
  1607.       { Refresh the display }
  1608.       ScrollBox1.Update;
  1609.     end;
  1610.   end;
  1611. end;
  1612.  
  1613. procedure TCCFileMgrForm.BitBtn11Click(Sender: TObject);
  1614. var ThePosition  : Integer;       { Loop counter   }
  1615.     CurrentName ,                 { Holds work name}
  1616.     TheOldString : String;        { Holds Dir      }
  1617.     finished     : Boolean;       { Loop control   }
  1618.     WorkingDir   : String;        { Holds mod wd   }
  1619.     TargetDir    : String;        { target of op   }
  1620.     TheResult    : Integer;       { Modal res hold }
  1621. begin
  1622.   CCPrintForm := TCCPrintForm.Create( Application );
  1623.   { Get current directory and save it for later }
  1624.   GetDir( 0 , TheOldString );
  1625.   { Check for need to add trailing \ }
  1626.   WorkingDir := TheOldString;
  1627.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  1628.   { Setup to get all selections }
  1629.   ThePosition := 1;
  1630.   finished := false;
  1631.   while not finished do
  1632.   begin
  1633.     { Call generic file getting routine based on current view}
  1634.     case CurrentView of
  1635.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  1636.            ThePosition );
  1637.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  1638.            ThePosition );
  1639.     end;
  1640.     { If returns blank string out of selections so exit }
  1641.     if CurrentName = '' then finished := true else
  1642.     begin
  1643.       { If a directory signal error }
  1644.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1645.       begin
  1646.         { Don't put directories in the list }
  1647.       end
  1648.       else
  1649.       begin
  1650.         CCPrintForm.Listbox1.Items.Add( ExtractFilename( Currentname ));
  1651.       end;
  1652.     end;
  1653.   end;
  1654.   CCPrintForm.ShowModal;
  1655.   CCPrintForm.Free;
  1656. end;
  1657.  
  1658. end.
  1659.