home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / delphi / kompon / d3456 / FILEEXPL.ZIP / LsFileExplorer28.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2002-03-08  |  179.3 KB  |  6,032 lines

  1.  
  2. {=============================================================================}
  3. { Unit LsFileExplorer28.pas -- v2.873                                         }
  4. {=============================================================================}
  5. {
  6.   Archive       :- FileExpl.zip
  7.  
  8.   Components    :- TLsDirTree21,
  9.                    TLsDirTreeCombo28 and
  10.                    TLsFilelistView28.
  11.                    For Delphi 3, 4, 5 and 6 (also for **C++Builder 4 and 5)
  12.  
  13.                    ** Although not tested by the author, many users reported
  14.                       that these components are working fine with C++Builder
  15.                       4 and 5.
  16.  
  17.   Version       :- 2.8.7.3
  18.  
  19.   Author        :- Leo D. Shih <ldshih@ecn.ab.ca>
  20.  
  21.   Last UpDate   :- March, 2002
  22.                                                                               }
  23. {-----------------------------------------------------------------------------}
  24. {
  25. LICENSE AND DISCLAIMER
  26. ======================
  27.  
  28.   Copyright (C)1998/2002 Leo D. Shih, All rights reserved
  29.   -------------------------------------------------------
  30.  
  31. TLsDirTree21, TlsDirTreeCombo28 and TlsFileListView28 (components) are currently
  32. distributed as Freeware, thus
  33.  
  34. 1. You may copy and distribute verbatim copies of these components as you
  35. receive them, in any medium, provided that this copyright notice included
  36. in the source code file (LsFileExplorer28.pas) is kept intact.
  37.  
  38. 2. You may modify the source code of these components to improve their features,
  39. performance, etc. provided that
  40.  
  41.   2.1 You may not change the original copyright notice.
  42.  
  43.   2.2 The modified source code should contain descriptions what you have
  44.       changed, and your name and e-mail address.
  45.  
  46.   2.3 Send the modified portion of the source code to the author so that the
  47.       author may incorporate the modification into future releases of these
  48.       components, with appropriate acknowledgement.
  49.  
  50. 3. You may use these components, or any part thereof, in your program,
  51. provided that you meet following conditions:
  52.  
  53.   3.1 This notice may not be removed or altered from any source distribution,
  54.       and the origin of these components must not be misrepresented.
  55.  
  56.   3.2 Appropriated credit to the author should be included in the "AboutForm"
  57.       or the "HelpFile", and the documentation of your program.
  58.  
  59.   3.3 If your program is to be distributed as commercial products, in addition
  60.       to above conditions, please write to the author for permission.
  61.  
  62. These components are provided 'as-is', without warranty of any kind, either
  63. expressed or implied. In no event shall the author be liable for any problems
  64. or damages arising from the use of these components.
  65.                                                                               }
  66. {-----------------------------------------------------------------------------}
  67. {
  68. ACKNOWLEDGMENTS
  69. ===============
  70.   I'm most grateful to those people in the Delphi community who have
  71.   reported bugs, suggested fixings or recommanded improvements. In
  72.   particular, I would like to thank Ales Trtnik, Andreas Roth, Brad Huggins,
  73.   Claude Hunter, Detlef Scheil, Harrie Roaymans, Marcelo Rodrigues,
  74.   Steve Pinneo, Tom Lisjac, Maximo Yarritu, Bogdan Giusca, Bernd Ohse,
  75.   Ales Turai and Jake Jones for their professional suggestions.
  76.  
  77.   Also, I would like thank Andreas Roth, Bernd Ohse, Bernard Bourguignon,
  78.   David Abdaleon and Alberto Meyer for their German, French, Spanish and
  79.   Brazillian-Portuguese translations .
  80.                                                                               }
  81. {-----------------------------------------------------------------------------}
  82. {
  83. Brief Description
  84. =================
  85.  
  86.   1. TLsDirTree21
  87.   ---------------
  88.   TLsDirTree21 is a simple but fully functional Directory Treeview with a
  89.   popup FileListDlg (i.e. a simplified File ListView), that
  90.   (a) displays drives/directories in the DirectoryTree and files of the
  91.       selected directory in a popup FileListDlg.  Thus directories can be
  92.       selected from the DirectoryTree, and files can be selected or opened
  93.       in the FileListDlg;
  94.   (b) supports creating, renaming, deleting, copying and moving operations
  95.       on directories;
  96.   (c) calculates the size of a selected portion of the DirectoryTree.
  97.   (d) connects and disconnects network drives.
  98.  
  99.   2. TLsDirTreeCombo28
  100.   --------------------
  101.   TLsDirTreeCombo28 is a specialized ComboBox with a dropdown Directory
  102.   TreeView, that displays a hierarchical tree of drives and directories of
  103.   the File System.
  104.  
  105.   3. TLsFilelistView28 w/TLsFilelistView28PopUp
  106.   ---------------------------------------------
  107.   TLsFilelistView28 is a File ListView component. In addition to its normal
  108.   functions, it can perform various file management tasks, such as cut, copy,
  109.   paste, rename, delete, open, view and send_to operations on files.  It also
  110.   provides statistics on Disk-FreeSpace, Selected-Numbers and Selected-Size as
  111.   those available in the Windows Explorer.
  112.  
  113.   TLsDirTree21 and TLsFilelistView28 provide with French, German Spanish and
  114.   Brazilian-Portuguese language support in addition to English language.
  115.  
  116.   -> For further information please refer to LsFileExplorer28.txt
  117.                                                                               }
  118. {=============================================================================}
  119.  
  120. {Compiler version definations}
  121. {============================}
  122.  
  123. {$IFNDEF VER80}  //If not D1
  124.   {$DEFINE D2_OR_HIGHER}
  125.   {$IFNDEF VER90}  //If not D2
  126.     {$DEFINE BCB1_OR_HIGHER}
  127.     {$IFNDEF VER93}  //If not BCB 1
  128.       {$DEFINE D3_OR_HIGHER}
  129.       {$IFNDEF VER100}  //If not D3
  130.         {$DEFINE BCB3_OR_HIGHER}
  131.         {$IFNDEF VER110}  //IF not BCB 3
  132.           {$DEFINE D4_OR_HIGHER}
  133.           {$IFNDEF VER120}  //If not D4
  134.             {$DEFINE BCB4_OR_HIGHER}
  135.             {$IFNDEF VER125}  //If not BCB 4
  136.               {$DEFINE D5_OR_HIGHER}
  137.               {$IFNDEF VER130}  //If not D5
  138.                 {$DEFINE D6_OR_HIGHER}
  139.               {$ENDIF}
  140.             {$ENDIF}
  141.           {$ENDIF}
  142.         {$ENDIF}
  143.       {$ENDIF}
  144.     {$ENDIF}
  145.   {$ENDIF}
  146. {$ENDIF}
  147.  
  148. {-----------------------------------------------------------------------------}
  149.  
  150. unit LsFileExplorer28;
  151.  
  152. interface
  153.  
  154. {$IFDEF D6_OR_HIGHER}   //870
  155.   {$WARN SYMBOL_PLATFORM OFF}
  156.   {$WARN UNIT_PLATFORM OFF}
  157. {$ENDIF}
  158.  
  159. uses
  160.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Buttons,
  161.   Dialogs, StdCtrls, ExtCtrls, ComCtrls, CommCtrl, ShellAPI, ClipBrd, Menus,
  162.   FileCtrl, Registry, LsConsts,  //872
  163. {$IFNDEF D3_OR_HIGHER}
  164.   ShellObj, OLE2
  165. {$ELSE}
  166.   ShlObj, ActiveX, ComObj
  167. {$ENDIF}
  168. {$IFDEF D4_OR_HIGHER},
  169.   ImgList
  170. {$ENDIF};
  171.  
  172.  
  173. type
  174.  
  175.   TFileAttr = (ftReadOnly, ftHidden, ftSystem, ftArchive, ftNormal);
  176.   TFileType = set of TFileAttr;
  177.  
  178.   TLanguage = (lnSysDefault, lnEnglish, lnFrench, lnGerman, lnSpanish,
  179.                lnPortuguese);  //872 //873
  180.  
  181.   TDtFormat = (df_MMddyyyy, df_MMddyy, df_ddMMyyyy, //70
  182.     df_ddMMyy_GB, df_ddMMyy_DE, df_ddMMyy_IT,
  183.     df_yyyyMMdd, df_yyMMdd, df_Customize);
  184.  
  185.   TTmFormat = (tfLongFormat, tfShortFormat, tfCustomize);  //85
  186.  
  187.   // for LsDirTreeCombo28
  188.   TPathChangeEvent =
  189.     procedure(Sender: TObject; SelectedPath: string) of object;  //83
  190.   // for LsDirTree21
  191.   TDirChangeEvent =
  192.     procedure(Sender: TObject; SelectedPath: string) of object;  //83
  193.   TFileChangeEvent =
  194.     procedure(Sender: TObject; SelectedFile: string) of Object;  //83
  195.   // for LsFileListView28
  196.   TSelItemChangeEvent =
  197.     procedure(Sender: TObject; SelectedItem: string) of Object;  //83
  198.  
  199.   TLsFilelistView28 = class;
  200.   TLsFilelistView28PopUp = class;
  201.   TLsDirTreeCombo28 = class;
  202.   TLsDirTreeView = class;
  203.   TLsDirTree21PopUp = class;
  204.   TLsSpeedButton = Class;  //862
  205.  
  206.   {*******************************************}
  207.   {             TLsDirTreeView                }
  208.   {  Drop-down TreeView of TLsDirTreeCombo28  }
  209.   {*******************************************}
  210.  
  211.   TLsDirTreeView = class(TCustomTreeView)
  212.   private
  213.     TreeViewPath: string;
  214.     FSelectedPath: string;
  215.     FExpandRoot: Boolean;
  216.     FMouseInControl: Boolean;
  217.     procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
  218.     procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
  219.     procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
  220.     procedure WMLButtonDown(var Message: TWMLButtonDown); message
  221.       WM_LBUTTONDOWN;
  222.  
  223.   protected
  224.     procedure CreateParams(var Params: TCreateParams); override;
  225.     procedure CreateWnd; override;
  226.     procedure Expand(Node: TTreeNode); override;
  227.     procedure LoadDrives;
  228.     procedure MakePath(Node: TTreeNode);
  229.     procedure AddSubs(Path: string; Node: TTreeNode);
  230.     procedure Expanding(Sender: TObject; Node: TTreeNode;
  231.       var AllowExpansion: Boolean);
  232.   end;
  233.  
  234.   {*******************************************}
  235.   {            TLsDirTreeCombo28              }
  236.   {*******************************************}
  237.  
  238.   TLsDirTreeCombo28 = class(TCustomEdit)
  239.     Btn: TSpeedButton;
  240.     Tree: TLsDirTreeView;
  241.  
  242.   private
  243.     FFileList: TLsFilelistView28;
  244.     FWinDir: string;
  245.     ImageIndex: integer;
  246.     ImagLst: TImageList;
  247.     FCanvas: TControlCanvas;
  248.     FOnPathChange: TPathChangeEvent;  //83
  249.     FAbout: String;  //85
  250.     FInitialDir: String;  //85
  251.  
  252.   protected
  253.     procedure CreateWnd; override;
  254.     procedure Notification(AComponent: TComponent;
  255.       Operation: TOperation); override;
  256.     procedure CreateWindowHandle(const Params: TCreateParams); override;
  257.     procedure CreateParams(var Params: TCreateParams); override;
  258.     procedure SetEditRect;
  259.     procedure BtnClick(Sender: TObject);
  260.     function GetFileList: TLsFilelistView28;
  261.     procedure SetFileList(Value: TLsFilelistView28);
  262.     function GetBtnGlyph: TBitmap;
  263.     procedure SetBtnGlyph(NewValue: TBitmap);
  264.     function GetTreeHeight: Integer;
  265.     procedure SetTreeHeight(newValue: Integer);
  266.     function GetSelectedPath: string;
  267.     procedure SetSelectedPath(Value: string);
  268.     function GetExpandRoot: Boolean;
  269.     procedure SetExpandRoot(Value: Boolean);
  270.     function GetHideSelection: Boolean;
  271.     procedure SetHideSelection(Value: Boolean);
  272.     procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
  273.     procedure Keydown(var Key: Word; Shift: TShiftState); override; //52
  274.     procedure SetAbout(Value: String);  //85
  275.     procedure SetInitialDir(Value: String);  //85
  276.     procedure WMRButtonUp(var Message: TWMRButtonUp); message WM_RBUTTONUP;  //862
  277.     procedure WMKillFocus(var Message: TWMKILLFOCUS); message WM_KILLFOCUS;  //862
  278.  
  279.   public
  280.   { Public declarations }
  281.     constructor create(AOwner: TComponent); override;
  282.     destructor destroy; override;
  283.     procedure SetBounds(Left, Top, Width, Height: Integer); override;
  284.     procedure OpenPath(dPath: string);
  285.     procedure ResetTreeView;
  286.     procedure ConnectNetResource(Sender: TObject);  //862+
  287.     procedure DisConnectNetResource(Sender: TObject);  //862+
  288.  
  289.     property InitialDir: String read FInitialDir write SetInitialDir;  //870
  290.  
  291.   published
  292.     property SelectedPath: string read GetSelectedPath write SetSelectedPath;
  293.     property FileList: TLsFilelistView28 read GetFileList write SetFileList;
  294.     property ExpandRoot: Boolean read GetExpandRoot write SetExpandRoot
  295.       default True;
  296.     property HideSelection: Boolean read GetHideSelection
  297.       write SetHideSelection default True;
  298.     property About: String read FAbout write SetAbout;  //85
  299.     property Align;
  300.     property BorderStyle;
  301.     property Color;
  302.     property Ctl3D;
  303.     property DragCursor;
  304.     property DragMode;
  305.     property Enabled;
  306.     property Font;
  307.     property Height;
  308.     property HelpContext;
  309.     property Hint;
  310.     property Left;
  311.     property Name;
  312.     property Glyph: TBitmap read GetBtnGlyph write SetBtnGlyph;
  313.     property ParentColor;
  314.     property ParentCtl3D;
  315.     property ParentFont;
  316.     property ParentShowHint;
  317.     property PopupMenu;
  318.     property ReadOnly; //53+
  319.     property ShowHint;
  320.     property TabOrder;
  321.     property TabStop;
  322.     property Tag;
  323.     property Top;
  324.     property TreeHeight: Integer read GetTreeHeight write SetTreeHeight;
  325.     property Visible;
  326.     property Width;
  327.     property OnPathChange: TPathChangeEvent read FOnPathChange
  328.       write FOnPathChange;  //83
  329.     property OnClick;
  330.     property OnDblClick;
  331.     property OnDragDrop;
  332.     property OnDragOver;
  333.     property OnEndDrag;
  334.     property OnEnter;
  335.     property OnExit;
  336.     property OnKeyDown;
  337.     property OnKeyPress;
  338.     property OnKeyUp;
  339.     property OnMouseDown;
  340.     property OnMouseMove;
  341.     property OnMouseUp;
  342.     property OnStartDrag;
  343. {$IFDEF D4_OR_HIGHER}
  344.     property Anchors;
  345.     property BiDiMode;
  346.     property Constraints;
  347. {$ENDIF}
  348.   end;
  349.  
  350.   {******************************************}
  351.   {            TLsSpeedButton           //862}
  352.   {******************************************}
  353.  
  354.   TLsSpeedButton = Class(TSpeedButton)  //862>>
  355.   private
  356.     procedure WMRButtonUp(var Message: TWMRButtonUp); Message WM_RBUTTONUP;
  357.   end;  //862
  358.  
  359.  {*******************************************}
  360.  {             TLsDirTree21              //60}
  361.  {*******************************************}
  362.  
  363.   TLsDirTree21 = class(TCustomTreeView)
  364.   private
  365.     FFileList: TLsFilelistView28;
  366.     FSelectedPath: string;
  367.     TreeViewPath: string;
  368.     FPopUpMenu: TLsDirTree21PopUp;
  369.     FPopUpMenuEnabled: Boolean;
  370.     FIsNewFolder: Boolean;
  371.     FSelectedFile: string;  //80^
  372.     DlgForm: TForm;  //82
  373.     FileView: TListView;  //82
  374.     BtnOK: TBitBtn;   //82
  375.     SImgList: TImageList;  //82
  376.     FOnDirChange: TDirChangeEvent;  //83
  377.     FOnFileChange: TFileChangeEvent;  //83
  378.     FAbout: String;  //85
  379.     FInitialDir: String;  //85
  380.     FisCutCopy: Boolean;  //86
  381.     FOpMode: integer;  //86
  382.     FSrcPath: string;  //86
  383.     FDestPath: String;  //86
  384.     FNetDrive: array[0..25] of Boolean;  //871
  385.     FTvLanguage: TLanguage;  //872ln
  386.  
  387.   protected
  388.     procedure CreateWnd; override;
  389.     procedure Expanding(Sender: TObject; Node: TTreeNode;
  390.       var AllowExpansion: Boolean);
  391.     procedure LoadRoot;
  392.     procedure LoadDrives;
  393.     procedure Loaded; override;
  394.     procedure AddSubs(Path: string; Node: TTreeNode);
  395.     procedure MakePath(Node: TTreeNode);
  396.     procedure MouseDown(Button: TMouseButton;
  397.       Shift: TShiftState; X, Y: Integer); override;
  398.     procedure KeyUp(var Key: Word; Shift: TShiftState); override;  //84
  399.     procedure SetAbout(Value: String);  //85
  400.     procedure SetFileList(Value: TLsFilelistView28);
  401.     procedure SetInitialDir(Value: string);  //85
  402.     procedure SetTvLanguage(Value: TLanguage);  //872ln
  403.     procedure SetPopUpMenuEnabled(Value: Boolean);
  404.     procedure SetSelectedPath(Value: string);
  405.     procedure SetSelectedFile(Value: string); //80^
  406.     procedure InitializeVar;  //872ln
  407.  
  408.     function CanEdit(Node: TTreeNode): Boolean; override;
  409.     procedure Edit(const Item: TTVItem); override;
  410.     function GetPathFromNode(Node: TTreeNode): string;
  411.     procedure OpenFileListDlg(Sender: TObject);  //82
  412.     procedure DlgFormResize(Sender: TObject);  //82
  413.     procedure FileViewDblClick(Sender: TObject);  //80^ //82
  414.     procedure OKBtnClick(Sender: TObject);  //82
  415.  
  416.   public
  417.   { Public declarations }
  418.     constructor create(AOwner: TComponent); override;
  419.     destructor destroy; override;
  420.     procedure ReLoad;
  421.     procedure OpenPath(dPath: string);
  422.     procedure SHowFolderContents; //80^
  423.     function AddNewNode(ParentNode: TTreeNode; NodeName: string):
  424.       Boolean;
  425.     function DeleteNode(Node: TTreeNode): Boolean;
  426.     function GetTreeSize: double; //integer;   //85
  427.     procedure ConnectNetResource(Sender: TObject);  //82
  428.     procedure DisConnectNetResource(Sender: TObject);  //82
  429.     procedure CutOrCopyNode(Mode: integer);  //86
  430.     procedure PasteNode;  //86
  431. {$IFDEF D4_OR_HIGHER}
  432.     procedure ShowNodeProperties;
  433. {$ENDIF}
  434.  
  435.     property Images;  //85
  436.     property Items;   //85
  437.     property InitialDir: string read FInitialDir Write SetInitialDir;  //870
  438.  
  439.   published
  440.     property FileList: TLsFilelistView28 read FFileList write SetFileList;
  441.     property PopUpMenuEnabled: Boolean read FPopUpMenuEnabled
  442.       write SetPopUpMenuEnabled default True;
  443.     property SelectedPath: string read FSelectedPath write SetSelectedPath;
  444.     property SelectedFile: string read FSelectedFile write SetSelectedFile;  //80^
  445.     property About: string read FAbout write SetAbout;  //85
  446.     property Language: TLanguage read FTvLanguage write SetTvLanguage;  //872ln
  447.     property Align;
  448.     property BorderStyle;
  449.     property Color;
  450.     property Ctl3D;
  451.     property DragCursor;
  452.     property DragMode;
  453.     property Enabled;
  454.     property Font;
  455.     property Height;
  456.     property HelpContext;
  457.     property HideSelection;
  458.     property Hint;
  459.     property Indent;
  460.     property Left;
  461.     property Name;
  462.     property ParentColor;
  463.     property ParentCtl3D;
  464.     property ParentFont;
  465.     property ParentShowHint;
  466.     property PopupMenu;
  467.     property ReadOnly;
  468.     property ShowButtons;
  469.     property ShowHint;
  470.     property ShowLines;
  471.     property ShowRoot;
  472.     property SortType;
  473.     property TabOrder;
  474.     property TabStop;
  475.     property Tag;
  476.     property Top;
  477.     property Visible;
  478.     property Width;
  479.     property OnDirChange: TDirChangeEvent read FOnDirChange write FOnDirChange;  //83
  480.     property OnFileChange: TFileChangeEvent read FOnFileChange write FOnFileChange;  //83
  481.     property OnClick;
  482.     property OnCollapsed;
  483.     property OnCollapsing;
  484.     property OnDblClick;
  485.     property OnDeletion;
  486.     property OnDragDrop;
  487.     property OnDragOver;
  488.     property OnEdited;
  489.     property OnEditing;
  490.     property OnEndDrag;
  491.     property OnEnter;
  492.     property OnExit;
  493.     property OnExpanded;
  494.     property OnExpanding;
  495.     property OnKeyDown;
  496.     property OnKeyPress;
  497.     property OnKeyUp;
  498.     property OnMouseDown;
  499.     property OnMouseMove;
  500.     property OnMouseUp;
  501.     property OnStartDrag;
  502. {$IFDEF D4_OR_HIGHER}
  503.     property Anchors;
  504.     property BiDiMode;
  505.     property Constraints;
  506. {$ENDIF}
  507.   end;
  508.  
  509.   {========== TLsDirTree21PopUp =============}
  510.  
  511.   TLsDirTree21PopUp = class(TPopupMenu)
  512.   private
  513.     FDirTree: TLsDirTree21; //70
  514.     Bmp1,
  515.       Bmp2,
  516.       Bmp3,
  517.       Bmp4,  //86
  518.       Bmp5,  //86
  519.       Bmp6,  //86
  520.       Bmp7,  //70
  521.       Bmp8,  //80
  522.       Bmp9,  //82
  523.       Bmp10  //82
  524. {$IFDEF D4_OR_HIGHER},
  525.       Bmp11  //862
  526. {$ENDIF}
  527.       : HBitmap;
  528.  
  529.     TvItemID_0,    //872ln>
  530.       TvItemID_1,
  531.       TvItemID_2,
  532.       TvItemID_4,
  533.       TvItemID_5,
  534.       TvItemID_6,
  535.       TvItemID_8,
  536.       TvItemID_9,
  537.       TvItemID_11,
  538.       TvItemID_12,
  539.       TvItemID_14: string;  //872ln<
  540.  
  541.   protected
  542.     function AddNewItem(const aCaption: string; aShortCut: TShortCut;
  543.       aChecked, aEnabled: Boolean; aGroup: integer; aOnClick: TNotifyEvent;
  544.       hCtx: word; const aName: string; aTag: Integer; aBitMap: HBitMap): TMenuItem;
  545.  
  546.     procedure SetDirTree(Value: TLsDirTree21);
  547.     procedure ItemOnClick(Sender: TObject);
  548.   public
  549.     constructor Create(AOwner: TComponent); override;
  550.     destructor Destroy; override;
  551.     procedure BuildItems;
  552.     procedure Popup(X, Y: integer); override;
  553.     property DirTree: TLsDirTree21 read FDirTree;
  554.   end;
  555.  
  556.  
  557.  {*******************************************}
  558.  {           TLsFilelistView28               }
  559.  {*******************************************}
  560.  
  561.   TLsFilelistView28 = class(TCustomListView)
  562.   private
  563.   { Private declarations }
  564.     //80 >>
  565.     FColWidth_Name: Integer;
  566.     FColWidth_Size: Integer;
  567.     FColWidth_Type: Integer;
  568.     FColWidth_Mod: Integer;
  569.     FColWidth_Attr: Integer;
  570.     //80 <<
  571.     FDirTreeCombo: TLsDirTreeCombo28;
  572.     FDirTree: TLsDirTree21;
  573.     FDirectory: string;
  574.     FDirectorySize: integer;
  575.     FSelectedItem: string;
  576.     FFileType: TFileType;
  577.     FOpMode: Integer;
  578.     FMask: string;
  579.     FParentDirEnabled: Boolean;  //870
  580.     FPopupMenu: TLsFilelistView28PopUp;
  581.     FPopUpMenuEnabled: Boolean;
  582.     FSelectedFiles: TStrings;
  583.     FShowFolders: Boolean;
  584.     FSortColumn: integer;
  585.     FSortForward: boolean;
  586.     OldFName: string;
  587.     FDblClickToOpen: Boolean; //70
  588.     FDateFormat: TDtFormat;  //70
  589.     FTimeFormat: TTmFormat; //85
  590.     FDFormatStr: string; //70>
  591.     FTFormatStr: string;
  592.     FHideFileExt: Boolean; //70<
  593.     FAbout: string;  //85
  594.     SImgLst: TImageList;
  595.     LImgLst: TImageList;
  596.     ParentImgIdx: integer;  //872
  597.     Bmp_Up28: HBitMap; //70>
  598.     Bmp_Down28: HBitMap;
  599.     FBitMap: TBitmap; //70<
  600.     FileColExists: Boolean;  //872
  601.     FParentDirCaption : string;  //872
  602.     FColumnClickEnabled : Boolean;  //70
  603.     FOnItemChange: TSelItemChangeEvent;  //83
  604.     FLanguage: TLanguage;  //872ln>
  605.     DrvTypeStr0: string;
  606.     DrvTypeStr1: string;
  607.     DrvTypeStr2: string;
  608.     DrvTypeStr3: string;
  609.     DrvTypeStr4: string;
  610.     DrvTypeStr5: string;
  611.     DrvTypeStr6: string;  //872ln
  612.  
  613.     function GetDriveFreeSpace: Integer;  //872bcb
  614.     function GetSelectedNum: Integer;
  615.     function GetSelectedSize: Integer;
  616.  
  617.     procedure Createimages;
  618.     procedure CompareFiles(Sender: TObject; Item1,
  619.       Item2: TListItem; Data: Integer; var Compare: Integer);
  620.     procedure ColumnClick(Sender: TObject; Column: TListColumn);
  621.     procedure SetPopUpMenuEnabled(Value: Boolean);
  622.     procedure SetDblClickToOpen(Value: Boolean);
  623.     procedure SetParentDirEnabled(Value: Boolean);  //870
  624.     procedure InitializeVar;  //872ln
  625.  
  626.   protected
  627.   { Protected declarations }
  628.     function AddFiles(FileMask: string; Attr: DWORD): Boolean;
  629.     function CanEdit(Item: TListItem): Boolean; override;
  630.     function GetSelectedItem: string;
  631.     function GetDirectory: string;
  632.     function GetWkgMask(var MaskStr: string): string;
  633.  
  634.     procedure AddDrives;
  635.     procedure Click; override;
  636.     procedure CreateWnd; override;
  637.     procedure CreateDriveColumns;
  638.     procedure CreateFileColumns;
  639.     procedure DblClick; override;
  640.     procedure Edit(const Item: TLVItem); override;
  641.     procedure Keydown(var Key: Word; Shift: TShiftState); override;
  642.     procedure KeyUp(var Key: Word; Shift: TShiftState); override;  //84
  643.     procedure Notification(AComponent: TComponent;
  644.       Operation: TOperation); override;
  645.  
  646.     procedure SetAbout(Value: string);  //85
  647.     procedure SetColWidth_Name(Value: Integer);  //80
  648.     procedure SetColWidth_Size(Value: Integer);  //80
  649.     procedure SetColWidth_Type(Value: Integer);  //80
  650.     procedure SetColWidth_Mod(Value: Integer);   //80
  651.     procedure SetColWidth_Attr(Value: Integer);  //80
  652.  
  653.     procedure SetDirectory(NewDir: string);
  654.     procedure SetDirTreeCombo(Val: TLsDirTreeCombo28);
  655.     procedure SetDirTree(VaL: TLsDirTree21);
  656.     procedure SetFileType(NewFileType: TFileType);
  657.     procedure SetHideFileExt(Value: Boolean); //70
  658.     procedure SetMask(const NewMasks: string);
  659.     procedure SetLanguage(Value: TLanguage);  //872ln
  660.     procedure SetParentDirCaption(Value: string);  //872
  661.     procedure SetShowFolders(Value: Boolean);
  662.     procedure SetSelectedItem(NewItem: string);
  663.     procedure SetDaTeFormat(Value: TDtFormat); Virtual; //70
  664.     procedure SetTimeFormat(Value: TTmFormat); Virtual; //85
  665.     procedure SendTo(SubItems: integer);
  666.     procedure SendTo2(Path: string);
  667.     procedure SendToPath(DestPath: string);
  668.     procedure SendToDrive(DriveID: string);
  669.  
  670.   public
  671.   { Public declarations }
  672.     constructor Create(AOwner: TComponent); override;
  673.     destructor Destroy; override;
  674.     procedure CutCopy(Mode: integer);
  675.     procedure DeleteItems;
  676.     procedure FindFile;
  677.     procedure NewFolder;
  678.     procedure OneLevelUp;
  679.     procedure OpenItem;
  680.     procedure Paste;
  681.     procedure RenameFile;
  682.     procedure UpdateFileList;
  683.     procedure ViewFile;
  684.     procedure CreateShortCut;  //85
  685. {$IFDEF D4_OR_HIGHER}  //861>>
  686.     procedure ShowFileProperties;
  687. {$ELSE}
  688.     procedure FileAttr;
  689. {$ENDIF}  //861<<
  690.     property DirectorySize: integer read FDirectorySize;
  691.     property SelCount;
  692.     property Selected;
  693.  
  694.   published
  695.   { Published declarations }
  696.     property About: string read FAbout write SetAbout;  //85
  697.     property ColWidth_Name: Integer read FColWidth_Name
  698.       write SetColWidth_Name Default 165;  //80
  699.     property ColWidth_Size: Integer read FColWidth_Size
  700.       write SetColWidth_Size Default 75;  //80
  701.     property ColWidth_Type: Integer read FColWidth_Type
  702.       write SetColWidth_Type Default 95;  //80
  703.     property ColWidth_Mod:  Integer read FColWidth_Mod
  704.       write SetColWidth_Mod Default 115;   //80
  705.     property ColWidth_Attr: Integer read FColWidth_Attr
  706.       write SetColWidth_Attr Default 40;  //80
  707.     property DateFormat: TDtFormat read FDaTeFormat write SetDaTeFormat
  708.       default df_Customize;   //82
  709.     property Directory: string read GetDirectory write SetDirectory;
  710.     property DirTreeCombo: TLsDirTreeCombo28 read FDirTreeCombo
  711.       write SetDirTreeCombo;
  712.     property DirTree: TLsDirTree21 read FDirTree
  713.       write SetDirTree; //60
  714.     property DriveFreeSpace: Integer read GetDriveFreeSpace;  //872bcb
  715.     property DblClickToOpen: Boolean read FDblClickToOpen
  716.       write SetDblClickToOpen default True;
  717.     property FileType: TFileType read FFileType write SetFileType default
  718.       [ftNormal];
  719.     property HideFileExt: Boolean read FHideFileExt write SetHideFileExt
  720.       default False; //70
  721.     property Language: TLanguage read FLanguage write SetLanguage;  //872ln
  722.     property Mask: string read FMask write SetMask;
  723.     property ParentDirEnabled: Boolean read FParentDirEnabled
  724.       write SetParentDirEnabled default True;  //870
  725.     property ParentDirCaption: string read FParentDirCaption
  726.       write SetParentDirCaption;  //872
  727.     property PopUpMenuEnabled: Boolean read FPopUpMenuEnabled
  728.       write SetPopUpMenuEnabled default True;
  729.     property SelectedItem: string read GetSelectedItem write SetSelectedItem;
  730.     property SelectedNumber: Integer read GetSelectedNum;
  731.     property SelectedSize: Integer read GetSelectedSize;
  732.     property ShowFolders: Boolean read FShowFolders write SetShowFolders
  733.       default True;
  734.     property TimeFormat: TTmFormat read FTimeFormat write SetTimeFormat;  //85
  735.     property Align;
  736.     property BorderStyle;
  737.     property Color;
  738.     property Ctl3D;
  739.     property Cursor;
  740.     property DragMode;
  741.     property DragCursor;
  742.     property Enabled;
  743.     property Font;
  744.     property Height;
  745.     property HideSelection default False;
  746.     property Hint;
  747.     property IconOptions;
  748.     property Items;
  749.     property Left;
  750.     property MultiSelect default True;
  751.     property Name;
  752.     property ParentColor;
  753.     property ParentFont;
  754.     property ParentShowHint;
  755.     property PopupMenu;
  756.     property ReadOnly default False;
  757.     property RowSelect default False;
  758.     property ShowColumnHeaders default True;
  759.     property ShowHint;
  760.     property TabOrder;
  761.     property TabStop;
  762.     property Tag;
  763.     property Top;
  764.     property ViewStyle default vsReport;
  765.     property Visible;
  766.     property Width;
  767.     property OnItemChange: TSelItemChangeEvent read FOnItemChange
  768.       write FOnItemChange;  //83
  769.     property OnClick;
  770.     property OnColumnClick;
  771.     property OnCompare;
  772.     property OnDblClick;
  773.     property OnDeletion;
  774.     property OnDragDrop;
  775.     property OnDragOver;
  776.     property OnEdited;
  777.     property OnEditing;
  778.     property OnEndDrag;
  779.     property OnEnter;
  780.     property OnExit;
  781.     property OnInsert;
  782.     property OnKeyDown;
  783.     property OnKeyPress;
  784.     property OnKeyUp;
  785.     property OnMouseDown;
  786.     property OnMouseMove;
  787.     property OnMouseUp;
  788.     property OnStartDrag;
  789.     property HotTrack;
  790. {$IFDEF D4_OR_HIGHER}
  791.     property Anchors;
  792.     property BiDiMode;
  793.     property Constraints;
  794.     property HotTrackStyles;
  795. {$ENDIF}
  796.   end;
  797.  
  798.  { ====== TLsFilelistView28PopUp ====== }
  799.  
  800.   TLsFilelistView28PopUp = class(TPopupMenu)
  801.   private
  802.     SendToList: TStrings;
  803.     FFileListView: TLsFilelistView28;
  804.     Bmp1, Bmp2,
  805.       Bmp3, Bmp4,
  806.       Bmp5, Bmp6,
  807.       Bmp7, Bmp8,
  808.       Bmp9, Bmp10,
  809.       Bmp11, Bmp12,
  810.       Bmp13 : HBitmap; //70 //85
  811.  
  812.     LvItemID_0,    //872ln>
  813.       LvItemID_1,
  814.       LvItemID_3,
  815.       LvItemID_5,
  816.       LvItemID_6,
  817.       LvItemID_7,
  818.       LvItemID_9,
  819.       LvItemID_10,
  820.       LvItemID_12,
  821.       LvItemID_14,
  822.       LvItemID_30,
  823.       LvItemID_31,
  824.       LvItemID_32,
  825.       LvItemID_33: string;  //872ln<
  826.  
  827.   protected
  828.     function AddNewItem(const aCaption: string; aShortCut: TShortCut;
  829.       aChecked, aEnabled: Boolean; aGroup: integer; aOnClick: TNotifyEvent;
  830.       hCtx: word; const aName: string; aTag: Integer; aBitMap: HBitMap): TMenuItem;  //862
  831.     procedure SetFileListView(Value: TLsFilelistView28);
  832.     procedure GetSendToSubMenu;
  833.     procedure ItemOnClick(Sender: TObject);
  834.  
  835.   public
  836.     constructor Create(AOwner: TComponent); override;
  837.     destructor Destroy; override;
  838.     procedure BuildItems;
  839.     procedure Popup(X, Y: integer); override;
  840.     property FileListView: TLsFilelistView28 read FFileListView;
  841.   end;
  842.  
  843.  
  844.  
  845. {*******************************************}
  846. {           Global Functions                }
  847. {*******************************************}
  848.  
  849. function ExecuteFile(const Operation, FileName, Params, DefaultDir: string;
  850.   ShowCmd: Integer): THandle;
  851. function DoSHFileOp(Handle: THandle; OpMode: UInt; Src: string;
  852.   Dest: string; var Aborted: Boolean): Boolean;
  853. function AddNullToStr(Path: string): string;
  854. function StrContains(Str1, Str2: string): Boolean;
  855. function BrowseForDir(const FormHandle: HWND; var DirPath: string):
  856.   Boolean;
  857. function numpos(a: char; b: string; c: integer): integer;
  858. function getcount(a: char; b: string): integer;
  859. function GetDiskSize(Root: string): LongInt;
  860. function GetFreeDiskSize(Root: string): LongInt;
  861. function DiskinDrive(Drive: Char; ShowMsg: word): Boolean;
  862. function SlashSep(Path, FName: string): string;
  863. function AddSlash(Path: string): string;
  864. function DelSlash(Path: string): string;
  865. function FileTimeToDateTimeStr(FTime: TFileTime; DFormat: string; //70
  866.   TFormat: string): string;
  867. function FileDirExist(FDName: string): Boolean;
  868. function GetNormalIcon(Path: string): integer;
  869. function GetSelectedIcon(Path: string): Integer;
  870. function ConvertSize(FSize: integer; FAttr: string): String;
  871. function ExtractFileNameOnly(FName: string): String;  //85
  872. {$IFDEF D4_OR_HIGHER}
  873. procedure ShowProperties(FName: string);
  874. {$ENDIF}
  875.  
  876. procedure Register;
  877.  
  878.  
  879. implementation
  880.  
  881. {$R LsFileExplorer28.Res}
  882.  
  883. const
  884.   InvalidDOSChars = '\*?/="<>|:,;+^';
  885.   DefaultMask = '*.*';
  886.   FileOpMode: array[0..3] of UInt =
  887.     (FO_COPY, FO_DELETE, FO_MOVE, FO_RENAME);
  888.  
  889.   FileExt: array[0..15] of string = ('.C', '.CPP', '.DPK', '.DPR', '.H',
  890.     '.INF', '.INI', '.PAS', '.PRG', '.TXT', '.DOC', '.RTF', '.WRI', '.BMP',
  891.     '.GIF', '.JPG');  //85
  892.  
  893.   LsFileExplorerKey = 'Software\LdShih\LsFileExplorer';
  894.  
  895. var
  896.   SelectedDir: String;  //80^
  897.   Drives     : Set of 0..25; //80^
  898.   LvLangID: TLanguage;  //872ln>
  899.   TvLangID: TLanguage;
  900.   //Language-specific messages
  901.   ewDrive,  //873
  902.   ewFolder,  //873
  903.   ewError,
  904.   ewFile,
  905.   ewFrom,
  906.   ewTo,
  907.   ewCancel,
  908.   ewBrowse,
  909.   ewReadOnly,
  910.   ewArchive,
  911.   ewHidden,
  912.   ewSystem,
  913.   esCannot,
  914.   esSpecifyDir,
  915.   esInvalidDrvID,
  916.   esDrvNotReady,
  917.   esExists,
  918.   esInvalidDirName,
  919.   esConfirmRename,
  920.   esCannotAddDrv,
  921.   esNewFolder,
  922.   esInvalidChars,
  923.   esNotFound,
  924.   esFilesIn,
  925.   esFileOpFailed,
  926.   esReadOnly,
  927.   esNoFileSelected,
  928.   esSendToFolder,
  929.   esSendToPath,
  930.   esPersistSaveError,
  931.   esSetAttr,
  932.   esTreeSize,  //873
  933.   esAllSubDir: string;  //872LN<
  934.  
  935.  
  936. {***********************************************************************}
  937. {                        Global Functions                               }
  938. {***********************************************************************}
  939.  
  940. function ExecuteFile(const Operation, FileName, Params, DefaultDir: string;
  941.   ShowCmd: Integer): THandle;
  942. var
  943.   zOperation: array[0..79] of Char;
  944.   zFileName: array[0..MAX_PATH] of Char;  //870
  945.   zParams: array[0..79] of Char;
  946.   zDir: array[0..MAX_PATH] of Char;       //870
  947. begin
  948.   Result := ShellExecute(Application.Handle,
  949.     StrPCopy(zOperation, Operation),
  950.     StrPCopy(zFileName, FileName),
  951.     StrPCopy(zParams, Params),
  952.     StrPCopy(zDir, DefaultDir), ShowCmd);
  953.   if Result <= 32 then
  954. //    MessageDlg('ERROR - Can''t ' + Operation + ' file  ' +
  955.     MessageDlg(esCannot + Operation + ewFile +
  956.       FileName, mtError, [mbOK], 0);   //872ln
  957. end; {ExecuteFile}
  958.  
  959. function DoSHFileOp(Handle: THandle; OpMode: UInt; Src: string;
  960.   Dest: string; var Aborted: Boolean): Boolean;
  961. var
  962.   ipFileOp: TSHFileOpStruct;
  963. begin
  964.   Src := AddNullToStr(Src);
  965.   Dest := AddNullToStr(Dest);
  966.   FillChar(ipFileOp, SizeOf(ipFileOp), 0);
  967.   with ipFileOp do
  968.   begin
  969.     wnd := GetActiveWindow;  //Handle;
  970.     wFunc := OpMode;
  971.     pFrom := pChar(Src);
  972.     pTo := pChar(Dest);
  973.     fFlags := FOF_ALLOWUNDO;  // or FOF_RENAMEONCOLLISION;
  974.     fAnyOperationsAborted := Aborted;
  975.     hNameMappings := nil;
  976.     lpszProgressTitle := '';
  977.   end;
  978.   Result := SHFileOperation(ipFileOp) = 0;
  979.   if ipFileOp.fAnyOperationsAborted = True then
  980.     Result := False;
  981. end; {DoSHFileOp}
  982.  
  983. function AddNullToStr(Path: string): string; //70
  984. begin
  985.   if Path = '' then exit;
  986.   if Path[Length(Path)] <> #0 then
  987.     Result := Path + #0
  988.   else
  989.     Result := Path;
  990. end; {AddnullToStr}
  991.  
  992. function StrContains(Str1, Str2: string): Boolean;
  993. var
  994.   i: Integer;
  995. begin
  996.   for i := 1 to Length(Str1) do
  997.     if Pos(Str1[i], Str2) <> 0 then
  998.     begin
  999.       Result := True;
  1000.       Exit;
  1001.     end;
  1002.   Result := False;
  1003. end; {StringCountains}
  1004.  
  1005. function BrowseForDir(const FormHandle: HWND; var DirPath: string):
  1006.   Boolean;
  1007. var
  1008.   pidl: PItemIDList;
  1009.   FBrowseInfo: TBrowseInfo;
  1010.   Success: Boolean;
  1011.   TitleName: string;
  1012.   Buffer: array[0..Max_Path] of Char;
  1013. begin
  1014.   Result := False;
  1015.   ZeroMemory(@FBrowseInfo, SizeOf(FBrowseInfo));
  1016.   try
  1017.     GetMem(FBrowseInfo.pszDisplayName, MAX_PATH);
  1018.     FBrowseInfo.HWndOwner := FormHandle;
  1019. //    TitleName := 'Please specify a directory';   //872ln
  1020.     TitleName := esSpecifyDir;  //872ln
  1021.     FBrowseInfo.lpszTitle := PChar(TitleName);
  1022.     pidl := SHBrowseForFolder(FBrowseInfo);
  1023.     if pidl <> nil then
  1024.     begin
  1025.       Success := SHGetPathFromIDList(pidl, Buffer);
  1026.       if Success then
  1027.       begin
  1028.         DirPath := Buffer;
  1029.         if DirPath[Length(DirPath)] <> '\' then
  1030.           DirPath := DirPath + '\';
  1031.         result := True;
  1032.       end;
  1033.       GlobalFreePtr(pidl);
  1034.     end;
  1035.   finally
  1036.     if Assigned(FBrowseInfo.pszDisplayName) then
  1037.       FreeMem(FBrowseInfo.pszDisplayName, Max_Path);
  1038.   end;
  1039. end; {BrowseForDir}
  1040.  
  1041. function numpos(a: char; b: string; c: integer): integer;
  1042. var
  1043.   it: integer;
  1044.   az: integer;
  1045. begin
  1046.   result := maxint;
  1047.   if length(b) > 0 then
  1048.   begin
  1049.     az := 0;
  1050.     for it := 1 to length(b) do
  1051.       if b[it] = a then
  1052.       begin
  1053.         inc(az);
  1054.         if az = c then
  1055.         begin
  1056.           result := it;
  1057.           exit;
  1058.         end;
  1059.       end;
  1060.   end;
  1061. end; {numpos}
  1062.  
  1063. function getcount(a: char; b: string): integer;
  1064. var
  1065.   i: integer;
  1066. begin
  1067.   result := 0;
  1068.   if length(b) > 0 then
  1069.     for i := 1 to length(b) do
  1070.       if b[i] = a then inc(result);
  1071. end; {getcount}
  1072.  
  1073. function GetDiskSize(Root: string): LongInt; //81
  1074. var
  1075.   DrvID: Byte;
  1076. begin
  1077.   Root := UpperCase(Root);
  1078.   DrvID := Ord(Root[1]) - 64;
  1079.   Result := DiskSize(DrvID) div 1024;  //in KB
  1080. end; {GetDiskSize}
  1081.  
  1082. function GetFreeDiskSize(Root: string): LongInt;  //81
  1083. var
  1084.   DrvID: Byte;
  1085. begin
  1086.   Root := UpperCase(Root);
  1087.   DrvID := Ord(Root[1]) - 64;
  1088.   Result := DiskFree(DrvID) div 1024;  //in KB
  1089. end; {GetFreeDiskSize}
  1090.  
  1091. function DiskinDrive(Drive: Char; ShowMsg: word): Boolean;
  1092. var
  1093.   ErrorMode: word;
  1094. begin
  1095.   if Drive in ['a'..'z'] then
  1096.     Dec(Drive, $20);
  1097.   if not (Drive in ['A'..'Z']) then
  1098. //    MessageDlg('Not a valid Drive ID', mtError, [mbOK], 0);
  1099.     MessageDlg(esInvalidDrvID, mtError, [mbOK], 0);  //872ln
  1100.  
  1101.   ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
  1102.   try
  1103.     if DiskSize(Ord(Drive) - $40) = -1 then
  1104.     begin
  1105.       if ShowMsg > 0 then
  1106.       begin
  1107.         MessageBeep(MB_IconHand);
  1108. //        MessageDlg('There is no disk in Drive ' + Drive + #13 +
  1109. //                   'or Drive ' + Drive + ': is not ready',
  1110. //                   mtWarning, [mbOK], 0);                //872ln
  1111.         MessageDlg(esDrvNotReady, mtWarning, [mbOK], 0);   //872ln
  1112.       end;
  1113.       Result := False
  1114.     end
  1115.     else
  1116.       Result := True;
  1117.   finally
  1118.     SetErrorMode(ErrorMode);
  1119.   end;
  1120. end; {DiskinDrive}
  1121.  
  1122. function SlashSep(Path, FName: string): string;
  1123. begin
  1124.   if (Path = '') or (FName = '') then exit;
  1125.   Result := AddSlash(Path) + FName;
  1126. end; {SlashSep}
  1127.  
  1128. function AddSlash(Path: string): string;
  1129. begin
  1130.   if Path = '' then exit;
  1131.   if Path[Length(Path)] <> '\' then
  1132.     Result := Path + '\'
  1133.   else
  1134.     Result := Path;
  1135. end; {AddSlash}
  1136.  
  1137. function DelSlash(Path: string): string;
  1138. begin
  1139.   Result := Path;
  1140.   if Path <> '' then
  1141.     if Path[Length(Path)] = '\' then
  1142.       Delete(Result, Length(Path), 1);
  1143. end; {DelSlash}
  1144.  
  1145. function FileTimeToDateTimeStr(FTime: TFileTime; DFormat,
  1146.   TFormat: string): string;  //70
  1147. var
  1148.   SysTime       : TSystemTime;
  1149.   DateTime      : TDateTime;
  1150.   LocalFileTime : TFileTime;
  1151. begin
  1152.   FileTimeToLocalFileTime(Ftime, LocalFileTime);
  1153.   FileTimeToSystemTime(LocalFileTime, SysTime);
  1154.   DateTime := SystemTimeToDateTime(SysTime);
  1155.   Result := FormatDateTime(DFormat + ' ' + TFormat, DateTime);
  1156. end; {FileTimeToDateTimeStr}
  1157.  
  1158. function FileDirExist(FDName: string): Boolean;
  1159. var
  1160.   SRec: TSearchRec;
  1161.   FName: string;
  1162. begin
  1163.   FillChar(SRec, SizeOf(TSearchRec), 0);
  1164.   Result := FindFirst(AddNullToStr(FDName), faAnyFile or faDirectory, SRec) = 0;
  1165.   if Result then
  1166.   begin
  1167.     FName := ExtractFileName(DelSlash(FDName));
  1168.     if (FName[Length(FName)] = #0) then
  1169.       FName := Copy(FName, 1, Length(FName) - 1);
  1170. //    MessageDlg('"' + FName + '" already exists !', mtError, [mbOK], 0);  //872ln
  1171.     MessageDlg('"' + FName + '" ' + esExists, mtError, [mbOK], 0);  //872ln
  1172.   end;
  1173.   SysUtils.FindClose(SRec);
  1174. end; {FileDirExist}
  1175.  
  1176. function GetNormalIcon(Path: string): integer;
  1177. var
  1178.   sfi: TShFileInfo;
  1179. begin
  1180.   SHGetFileInfo(Pchar(Path), 0, sfi, SizeOf(TSHFileInfo),
  1181.     SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  1182.   Result := sfi.iIcon;
  1183. end; {GetNormalIcon}
  1184.  
  1185. function GetSelectedIcon(Path: string): Integer;
  1186. var
  1187.   sfi: TShFileInfo;
  1188. begin
  1189.   SHGetFileInfo(Pchar(Path), 0, sfi, sizeOf(TSHFileInfo),
  1190.     SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_OPENICON);
  1191.   Result := sfi.iIcon;
  1192. end; {GetSelectedIcon}
  1193.  
  1194. function ConvertSize(FSize: integer; FAttr: String): String;
  1195. begin
  1196.   if (FSize < 1024) and (FSize > 0) then
  1197.     FSize := 1024;
  1198.   Result := IntToStr(FSize div 1024) + ' KB';  //80
  1199.   if (UpperCase(FAttr) = 'DIR') then
  1200.     Result := ' ';  //'0';   //80
  1201. end; {ConvertSize}
  1202.  
  1203. function ExtractFileNameOnly(FName: string): String;  //85 >>
  1204. var
  1205.   Ext: string;
  1206. begin
  1207.   Result := ExtractFileName(FName);
  1208.   Ext := ExtractFileExt(FName);
  1209.   if Ext <> '' then
  1210.     Delete(Result, Pos(Ext, Result), Length(Ext));
  1211. end;  {ExtractFileNameOnly}  //85 <<
  1212.  
  1213. {$IFDEF D4_OR_HIGHER}
  1214. procedure ShowProperties(FName: string);    //862 >>
  1215. var
  1216.   sei: SHELLEXECUTEINFO;
  1217.   err: longint;
  1218. begin
  1219.   try
  1220.     ZeroMemory(addr(sei),sizeof(sei));
  1221.     sei.cbSize := sizeof(sei);
  1222.     sei.lpFile := pchar(FName);
  1223.     sei.lpVerb := 'properties';
  1224.     sei.fMask  := SEE_MASK_INVOKEIDLIST;
  1225.     ShellExecuteEx(addr(sei));
  1226.   except
  1227.     err:=getlasterror;
  1228.     case err of
  1229.       ERROR_FILE_NOT_FOUND: showmessage('The specified file was not found.');
  1230.       ERROR_PATH_NOT_FOUND: showmessage('The specified path was not found.');
  1231.       ERROR_DDE_FAIL: showmessage('The DDE transaction failed.');
  1232.       ERROR_NO_ASSOCIATION: showmessage(
  1233.         'There is no application associated with the given filename extension.');
  1234.       ERROR_ACCESS_DENIED: showmessage('Access denied');
  1235.       ERROR_DLL_NOT_FOUND : showmessage('DLL not found');
  1236.       ERROR_CANCELLED : showmessage('The function prompted the user for the ' +
  1237.         'location of the application, but the user cancelled the request.');
  1238.       ERROR_NOT_ENOUGH_MEMORY: showmessage('Not enough memory for this operation');
  1239.       ERROR_SHARING_VIOLATION: showmessage('Sharing violation');
  1240.     end;
  1241.   end;
  1242. end;  {ShowFileProperties}  //862 <<
  1243. {$ENDIF}
  1244.  
  1245. ///// End of Global Functions /////
  1246.  
  1247.  
  1248. {*************************************************************************}
  1249. {                           TLsDirTreeCombo28                             }
  1250. {*************************************************************************}
  1251.  
  1252. { ===== LsDirTreeView is the Drop-down TreeView of TLsDirTreeCombo28 ==== }
  1253.  
  1254.  
  1255. procedure TLsDirTreeView.CreateParams(var Params: TCreateParams);
  1256. begin
  1257.   inherited CreateParams(Params);
  1258.   with Params do
  1259.   begin
  1260.     Style := Style or WS_BORDER;
  1261.     ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;  //862
  1262.     WindowClass.Style := CS_SAVEBITS;
  1263.   end;
  1264. end;  {CreateParams}
  1265.  
  1266.  
  1267. procedure TLsDirTreeView.CreateWnd;
  1268. begin
  1269.   inherited CreateWnd;
  1270. //  Font.Size := 8;                 //82
  1271. //  Font.Name := 'MS Sans Serif';   //82
  1272.   Windows.SetParent(Handle, 0);
  1273.   CallWindowProc(DefWndProc, Handle, wm_SetFocus, 0, 0);
  1274. end; {CreateWnd}
  1275.  
  1276. procedure TLsDirTreeView.CMMouseEnter(var Message: TMessage);
  1277. begin
  1278.   inherited;
  1279.   FMouseInControl := True;
  1280.   ReleaseCapture;
  1281. end; {CMMouseEnter}
  1282.  
  1283. procedure TLsDirTreeView.CMMouseLeave(var Message: TMessage);
  1284. var
  1285.   x, y: integer;
  1286.   PtPos: TPoint;
  1287. begin
  1288.   inherited;
  1289.   FMouseInControl := False;
  1290.   if not visible then
  1291.   begin
  1292.     x := 0;
  1293.     y := 0;
  1294.     PtPos := Point(x, y);
  1295.     PtPos := ClientToScreen(PtPos);
  1296.     SetCaptureControl(ControlAtPos(PtPos, False));
  1297.   end
  1298.   else
  1299.     SetCaptureControl(Self);
  1300. end; {CMMouseLeave}
  1301.  
  1302. procedure TLsDirTreeView.WMMouseMove(var Message: TWMMouseMove);
  1303. var
  1304.   TreeHitTest: THitTests;
  1305. begin
  1306.   inherited;
  1307.   if FMouseInControl and Enabled then
  1308.   begin
  1309.     TreeHitTest := GetHitTestInfoAt(Message.XPos, Message.YPos);
  1310.     if htOnLabel in TreeHitTest then
  1311.       Selected := GetNodeAt(Message.XPos, Message.YPos);
  1312.   end;
  1313. end; {WMMouseMove}
  1314.  
  1315. procedure TLsDirTreeView.WMLButtonDown(var Message: TWMLButtonDown);
  1316. var
  1317.   HitTest: THitTests;
  1318.   DrvCh: Char;
  1319. begin
  1320.   inherited;
  1321.   case FMouseInControl of
  1322.     False:
  1323.       begin
  1324.         ReleaseCapture;
  1325.         Enabled := False;
  1326.         Visible := False;
  1327.       end;
  1328.     True:
  1329.       begin
  1330.         SendMessage((Owner as TLsDirTreeCombo28).Handle, WM_LBUTTONDOWN, 0, 0);
  1331.         HitTest := GetHitTestInfoAt(Message.XPos, Message.YPos);
  1332.         if (htOnItem in HitTest) then
  1333.         begin
  1334.           MakePath(Selected);
  1335.  
  1336.           if (Selected = Items[0]) then
  1337.             FSelectedPath := 'Drives'
  1338.           else
  1339.             FSelectedPath := TreeViewPath;
  1340.  
  1341.           with (Owner as TLsDirTreeCombo28) do
  1342.           begin
  1343.             SetSelectedPath(FSelectedPath);
  1344.             ImageIndex := Tree.Selected.ImageIndex;
  1345.             Text := Selected.Text;
  1346.             if Assigned(FOnPathChange) then
  1347.               FOnPathChange(Self, FSelectedPath);  //83
  1348.           end;
  1349.  
  1350.           Enabled := False;
  1351.           Visible := False;
  1352.  
  1353.           if Selected.Level = 1 then
  1354.             if GetDriveType(PChar(FSelectedPath)) = DRIVE_REMOVABLE then
  1355.             begin
  1356.               DrvCh := FSelectedPath[1];
  1357.               if not DiskInDrive(DrvCh, 1) then
  1358.                 exit;
  1359.             end;
  1360.         end; {Hittest}
  1361.         ReleaseCapture;
  1362.       end;
  1363.   end; {Case}
  1364. end; {WMLButtonDown}
  1365.  
  1366. procedure TLsDirTreeView.Expand(Node: TTreeNode);
  1367. begin
  1368.   Items.BeginUpdate;
  1369.   Node.AlphaSort;
  1370.   Items.EndUpdate;
  1371.   inherited Expand(Node);
  1372. end; {Expand}
  1373.  
  1374. procedure TLsDirTreeView.LoadDrives;
  1375. var
  1376.   ADrive: integer;
  1377.   DriveLetter: char;
  1378.   DriveString: string;
  1379.   DrvName: string;
  1380.   Sfi: TSHFileInfo;
  1381.   Root: TTreenode;
  1382.   idRoot: PItemIDList;
  1383. begin
  1384.   Root := nil;
  1385.   Items.BeginUpdate;
  1386.   Items.Clear;
  1387.   if SHGetSpecialFolderLocation(Handle, CSIDL_DRIVES, idRoot) = NOERROR then
  1388.     if SHGetFileInfo(PChar(idRoot), 0, Sfi, SizeOf(TSHFileInfo), SHGFI_PIDL
  1389.       or SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_DISPLAYNAME) <> 0 then
  1390.     begin
  1391.       Root := items.AddFirst(nil, Sfi.szDisplayName);
  1392.       Root.ImageIndex := Sfi.iIcon;
  1393.       Root.SelectedIndex := Sfi.iIcon;
  1394.     end;
  1395.   Integer(Drives) := GetLogicalDrives;
  1396.   for ADrive := 0 to 25 do
  1397.   begin
  1398.     if (ADrive in Drives) then
  1399.     begin
  1400.       DriveLetter := Chr(ADrive + ord('A'));
  1401.       DriveString := DriveLetter + ':\';
  1402.       SHGetFileInfo(PChar(DriveString), 0, Sfi, SizeOf(Sfi),
  1403.         SHGFI_DISPLAYNAME);
  1404.       DrvName := Copy(Sfi.szDisplayName, 1, (Pos('(', Sfi.szDisplayName) - 1));
  1405.       with Items do
  1406.       begin
  1407.         AddChild(Root, ' (' + DriveLetter + ':)  ' + DrvName);
  1408.         Items[Count - 1].HasChildren := true;
  1409.         Items[Count - 1].ImageIndex := GetNormalIcon(DriveString);
  1410.         Items[Count - 1].SelectedIndex := GetSelectedIcon(DriveString);
  1411.       end;
  1412.     end;
  1413.   end;
  1414.   Items.EndUpdate;
  1415. end; {LoadDrives}
  1416.  
  1417. procedure TLsDirTreeView.MakePath(Node: TTreeNode);
  1418.  
  1419.   procedure MakeSubPath;
  1420.   begin
  1421.     if Node.Level = 1 then
  1422.       TreeViewPath := Copy(Node.Text, 3, 2) + '\' + TreeViewPath
  1423.     else if Node.Level > 1 then
  1424.       if TreeViewPath = '' then
  1425.         TreeViewPath := Node.Text
  1426.       else
  1427.         TreeViewPath := Node.Text + '\' + TreeViewPath;
  1428.   end; {MakeSubPath}
  1429.  
  1430. begin
  1431.   TreeViewPath := '';
  1432.   MakeSubPath;
  1433.   while Node.Parent <> nil do
  1434.   begin
  1435.     Node := Node.Parent;
  1436.     MakeSubPath;
  1437.   end;
  1438. end; {MakePath}
  1439.  
  1440. procedure TLsDirTreeView.AddSubs(Path: string; Node: TTreeNode);
  1441. var
  1442.   ANode: TTreeNode;
  1443.   APath: string;
  1444.   hFindFile: THandle;
  1445.   Win32FD: TWin32FindData;
  1446.  
  1447.   function IsDirectory(dWin32FD: TWin32FindData): Boolean;
  1448.   var
  1449.     FName: string;
  1450.   begin
  1451.     FName := StrPas(dWin32FD.cFileName);
  1452.     with dWin32FD do
  1453.       Result := (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY =
  1454.         FILE_ATTRIBUTE_DIRECTORY) and (FName <> '.') and (FName <> '..');
  1455.   end; {IsDirectory}
  1456.  
  1457.   function HasSubs(sPath: string): Boolean;
  1458.   var
  1459.     sAPath: string;
  1460.     shFindFile: THandle;
  1461.     sWin32FD: TWin32FindData;
  1462.   begin
  1463.     Result := False;
  1464.     sAPath := sPath;
  1465.     sAPath := AddSlash(sAPath);
  1466.     shFindFile := FindFirstFile(PChar(sAPath + '*.*'), sWin32FD);
  1467.     if shFindFile <> INVALID_HANDLE_VALUE then
  1468.     try
  1469.       repeat
  1470.         if IsDirectory(sWin32FD) then
  1471.         begin
  1472.           Result := True;
  1473.           Break;
  1474.         end;
  1475.       until not FindNextFile(shFindFile, sWin32FD);
  1476.     finally
  1477.       Windows.FindClose(shFindFile);
  1478.     end;
  1479.   end; {HasSubs}
  1480.  
  1481. begin
  1482.   APath := Path;
  1483.   APath := AddSlash(APath);
  1484.   hFindFile := FindFirstFile(PChar(APath + '*.*'), Win32FD);
  1485.   if hFindFile <> INVALID_HANDLE_VALUE then
  1486.   try
  1487.     repeat
  1488.       if IsDirectory(Win32FD) then
  1489.       begin
  1490.         ANode := Items.AddChild(Node, Win32FD.cFileName);
  1491.         ANode.HasChildren := HasSubs(APath + Win32FD.cFileName);
  1492.         ANode.ImageIndex := GetNormalIcon(APath + Win32FD.cFileName);
  1493.         ANode.SelectedIndex := GetSelectedIcon(APath + Win32FD.cFileName);
  1494.       end;
  1495.     until not FindNextFile(hFindFile, Win32FD);
  1496.   finally
  1497.     Windows.FindClose(hFindFile);
  1498.   end;
  1499. end; {AddSubs}
  1500.  
  1501. procedure TLsDirTreeView.Expanding(Sender: TObject; Node: TTreeNode;
  1502.   var AllowExpansion: Boolean);
  1503. var
  1504.   OldCursor: TCursor;  //872
  1505. begin
  1506.   if Node.GetFirstChild = nil then
  1507.   begin
  1508.     OldCursor := Screen.Cursor;   //872
  1509.     Screen.Cursor := crHourGlass; //872
  1510.     try
  1511.       MakePath(Node);
  1512.       Node.HasChildren := false;
  1513.       AddSubs(TreeViewPath, Node);
  1514.       Node.AlphaSort;
  1515.     finally
  1516.       Screen.Cursor := OldCursor;  //872
  1517.     end;
  1518.   end;
  1519. end; {Expending}
  1520.  
  1521. ///// End of TLsDirTreeView /////
  1522.  
  1523.  
  1524. { ========================= TLsDirTreeCombo28 ========================== }
  1525.  
  1526. constructor TLsDirTreeCombo28.Create;
  1527. var
  1528.   sfi: TShFileInfo;
  1529. begin
  1530.   inherited Create(AOwner);  //AOwner);
  1531.   Width := 216;
  1532.   Height := 21;
  1533.   TabOrder := 0;
  1534.   ReadOnly := True; //53+
  1535.   if Text <> '' then
  1536.     HideSelection := True;  //862
  1537.  
  1538.   FCanvas := TControlCanvas.create;
  1539.   FCanvas.Control := self;
  1540.  
  1541.   Btn := TLsSpeedButton.Create(Self);  //862
  1542.   Btn.Parent := Self;
  1543.  
  1544.   Tree := TLsDirTreeView.Create(Self);
  1545.   with Tree do
  1546.   begin
  1547.     Parent := Self;
  1548.     Top := Self.Top + Self.Height;
  1549.     Height := 240;
  1550.     Visible := False;  //85
  1551.   end;
  1552.  
  1553.   ImagLst := TImageList.Create(Self);
  1554.   try
  1555.     SetLength(FWinDir, MAX_PATH);  //85
  1556.     Setlength(FWinDir, GetWindowsDirectory(PChar(FWinDir), MAX_PATH));  //85
  1557.     FWinDir := AddSlash(FWinDir);                                       //85
  1558.     ImagLst.Handle := SHGetFileInfo(PChar(FWinDir), 0, sfi, sizeOf(sfi),
  1559.       SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  1560. //    ImagLst.BkColor := clNone;  //871
  1561.     ImagLst.ShareImages := True;
  1562. //    ImagLst.BlendColor := clHighLight;  //871
  1563.   finally
  1564.     Tree.Images := ImagLst;
  1565.   end;
  1566.   FAbout := 'Version 2.8.7.3';  //861
  1567. end; {Create}
  1568.  
  1569.  
  1570. destructor TLsDirTreeCombo28.destroy;
  1571. var
  1572.   i: integer;
  1573. begin
  1574.   for i := Tree.Items.Count - 1 downto 0 do //70
  1575.     Tree.Items[i].Free;
  1576.   ImagLst.Free;
  1577.  
  1578.   inherited Destroy;
  1579. end; {destroy}
  1580.  
  1581.  
  1582. procedure TLsDirTreeCombo28.CreateWnd;
  1583. begin
  1584.   inherited CreateWnd;
  1585.   SetEditRect;
  1586. end; {CreateWnd}
  1587.  
  1588. procedure TLsDirTreeCombo28.CreateParams(var Params: TCreateParams);
  1589. begin
  1590.   inherited CreateParams(Params);
  1591.   Params.style := Params.style or ES_MULTILINE or WS_CLIPCHILDREN;  //862
  1592. end;  {CrateParams}
  1593.  
  1594. procedure TLsDirTreeCombo28.CreateWindowHandle(const Params: TCreateParams);
  1595. begin
  1596.   inherited CreateWindowHandle(Params);
  1597. //  Font.Name := 'MS Sans Serif';  //82
  1598. //  Font.Size := 8;                //82
  1599.   with Btn do
  1600.   begin
  1601.     Top := 0;  //Self.Top + 1; //870
  1602.     Left := Self.Left + Self.Width - 21;  //19;  //85
  1603.     Width := 17;
  1604.     Height := 17;
  1605.     Cursor := crArrow;
  1606.     Down := False;
  1607.     OnClick := BtnClick;
  1608.     Glyph.Handle := LoadBitmap(0, pChar(OBM_COMBO));
  1609.     NumGlyphs := 1;
  1610.   end; {Btn}
  1611.  
  1612.   with Tree do
  1613.   begin
  1614.     Left := 0;
  1615.     Top := 0;
  1616.     Width := 0;
  1617.     BorderStyle := bsSingle;
  1618.     Ctl3D := False;
  1619.     LoadDrives;
  1620.     OnExpanding := Expanding;
  1621.     ExpandRoot := True;
  1622.     ReadOnly := True;
  1623.     Enabled := False;
  1624.     Visible := False;
  1625.   end; {Tree}
  1626.  
  1627.   if Tree.Selected = nil then
  1628.   begin
  1629.     ImageIndex := Tree.Items[0].ImageIndex;
  1630.     Text := Tree.Items[0].Text;
  1631.   end;
  1632. end; {CreateWindowHandle}
  1633.  
  1634.  
  1635.  
  1636. procedure TLsDirTreeCombo28.SetEditRect;
  1637. var
  1638.   Loc: TRect;
  1639. begin
  1640.   if (ImageIndex >= 0) and (ImageIndex < Tree.Images.Count) then
  1641.   begin
  1642.     SetRect(Loc, 23, 0, ClientWidth - Btn.Width - 2, ClientHeight + 1);
  1643.     SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc));
  1644.   end
  1645.   else
  1646.   begin
  1647.     SetRect(Loc, 0, 0, ClientWidth - Btn.Width - 2, ClientHeight + 1);
  1648.     SendMessage(Handle, EM_SETRECTNP, 0, LongInt(@Loc));
  1649.   end;
  1650. end; {SetEditRect}
  1651.  
  1652. procedure TLsDirTreeCombo28.BtnClick(Sender: TObject);
  1653. var
  1654.   CP, SP: TPoint;
  1655. begin
  1656.   CP.X := Left;
  1657.   CP.Y := Top + Height;
  1658.   SP := Parent.ClientToScreen(CP);
  1659.   if (SP.Y + Tree.Height) > Screen.Height then  //85 >>
  1660.   begin
  1661.     CP.Y := Top - Tree.Height;
  1662.     SP := Parent.ClientToScreen(CP);
  1663.   end;  //85 <<
  1664.   with Tree do
  1665.   begin
  1666.     Left := SP.X;
  1667.     Top := SP.Y;
  1668.     Width := Self.Width;
  1669.     if Enabled = False then
  1670.     begin
  1671.       Enabled := True;
  1672.       Visible := True;
  1673.       BringToFront; //60
  1674.       SetCaptureControl(Tree);
  1675.       if Focused = False then
  1676.         SetFocus;  //862
  1677.     end
  1678.     else
  1679.     begin
  1680.       SendToBack; //60
  1681.       Enabled := False;
  1682.       Visible := False;
  1683.       ReleaseCapture;
  1684.     end;
  1685.   end;
  1686. end; {BtnClick}
  1687.  
  1688. procedure TLsDirTreeCombo28.SetBounds(Left, Top, Width, Height: Integer);
  1689. begin
  1690.   case Parent <> nil of
  1691.     True:
  1692.       begin
  1693.         inherited SetBounds(Left, Top, Width, Height);
  1694.         with Btn do
  1695.         begin
  1696.           Left := Self.Width - Btn.Width - 4;
  1697.           Height := Self.Height - 4;
  1698.         end;
  1699.         SetEditRect;
  1700.       end;
  1701.     False: inherited SetBounds(Left, Top, Width, Height);
  1702.   end;
  1703. end; {SetBounds}
  1704.  
  1705. procedure TLsDirTreeCombo28.OpenPath(dPath: string);
  1706. var
  1707.   CurItem: TTreeNode;
  1708.   count: Integer;
  1709.   TempPath: string;
  1710.   CurPath: string;
  1711.   FullPath: string; //51
  1712. begin
  1713.   if (dPath = '') or (Length(dPath) = 1) then exit; //53
  1714.   if not DirectoryExists(dPath) then exit; //53
  1715.   dPath := AddSlash(dPath); //51
  1716.   FullPath := dPath;
  1717.   with Tree do
  1718.   begin
  1719.     Items.BeginUpdate;
  1720.     CurItem := Items.GetFirstNode;
  1721.     if CurItem.Expanded then
  1722.       CurItem.Collapse(True);
  1723.     while Pos('\', dPath) > 0 do
  1724.     begin
  1725.       count := Pos('\', dPath);
  1726.       tempPath := Copy(dPath, 1, count);
  1727.       dPath := Copy(dPath, count + 1, Length(dPath));
  1728.       CurItem := CurItem.getFirstChild;
  1729.       while CurItem <> nil do
  1730.       begin
  1731.         if CurItem.Level = 1 then
  1732.           CurPath := Copy(CurItem.Text, 3, 2) + '\'
  1733.         else if CurItem.Level > 1 then
  1734.           CurPath := CurItem.Text + '\';
  1735.         if AnsiCompareText(CurPath, TempPath) = 0 then //51
  1736.         begin
  1737.           CurItem.Selected := True;
  1738.           CurItem.Expand(False);
  1739.           Break;
  1740.         end;
  1741.         CurItem := CurItem.GetNext;
  1742.         if CurItem = nil then exit;
  1743.       end;
  1744.     end;
  1745.     Items.EndUpdate;
  1746.   end;
  1747.   ImageIndex := Tree.Selected.ImageIndex;
  1748.   Text := CurItem.Text;
  1749.   if AnsiCompareText(Tree.FSelectedPath, FullPath) <> 0 then //51
  1750.     Tree.FSelectedPath := FullPath; //51
  1751.   if Assigned(FOnPathChange) then
  1752.     FOnPathChange(Self, Tree.FSelectedPath);  //84
  1753. end; {OpenPath}
  1754.  
  1755. procedure TLsDirTreeCombo28.ResetTreeView;
  1756. begin
  1757.   with Tree do
  1758.   begin
  1759.     Items.BeginUpdate;
  1760.     try
  1761.       Selected := nil;
  1762.       Items.Clear;
  1763.       LoadDrives;
  1764.       OnExpanding := Expanding;
  1765.     finally
  1766.       Items.EndUpdate;
  1767.     end;
  1768.   end;
  1769. end; {ResetTreeView}
  1770.  
  1771. procedure TLsDirTreeCombo28.WMPaint(var Message: TWMPaint);
  1772. var
  1773.   Img: TCustomImageList;
  1774.   YPos: integer;
  1775. begin
  1776.   inherited PaintHandler(Message);
  1777.   Img := Tree.Images;
  1778.   if (ImageIndex >= 0) and (ImageIndex < Tree.Images.Count) then
  1779.   begin
  1780.     YPos := ClientHeight div 2 - 8;
  1781.     Img.Draw(FCanvas, 5, YPos, ImageIndex);
  1782.   end;
  1783. end; {WMPaint}
  1784.  
  1785. function TLsDirTreeCombo28.GetSelectedPath: string;
  1786. begin
  1787.   GetSelectedPath := Tree.FSelectedPath;
  1788. end; {GetSelectedPath}
  1789.  
  1790. procedure TLsDirTreeCombo28.SetSelectedPath(Value: string);
  1791. begin
  1792.   if AnsiCompareText(Tree.FSelectedPath, Value) <> 0 then
  1793.     Tree.FSelectedPath := Value;
  1794.   if FFileList <> nil then
  1795.     FFileList.Directory := Tree.FSelectedPath;
  1796. end; {SetSelectedPath}
  1797.  
  1798. procedure TLsDirTreeCombo28.SetInitialDir(Value: String);  //85 >>
  1799. begin
  1800.   if (Value = '') or (AnsiCompareText(FInitialDir, Value) = 0 ) then
  1801.     exit;
  1802.   Value := AddSlash(Value);
  1803.   if not DirectoryExists(Value) then
  1804.     exit
  1805.   else begin
  1806.     FInitialDir := Value;
  1807.     OpenPath(FInitialDir);
  1808.     if Assigned(FFileList) then
  1809.       FFileList.Directory := FInitialDir;
  1810.   end;
  1811. end;  {SetInitialDir}  //85 <<
  1812.  
  1813. function TLsDirTreeCombo28.GetFileList: TLsFilelistView28;
  1814. begin
  1815.   GetFileList := FFileList;
  1816. end; {GetFileList}
  1817.  
  1818. procedure TLsDirTreeCombo28.SetFileList(Value: TLsFilelistView28);
  1819. begin
  1820.   if FFileList <> Value then
  1821.     FFileList := Value;
  1822.   if (FFileList <> nil) and (Tree.FSelectedPath <> '') then
  1823.   begin
  1824.     FFileList.Directory := Tree.FSelectedPath;
  1825.     FFileList.UpdateFileList;
  1826.   end;
  1827. end; {SetFileList}
  1828.  
  1829. function TLsDirTreeCombo28.GetExpandRoot: Boolean;
  1830. begin
  1831.   GetExpandRoot := Tree.FExpandRoot;
  1832. end; {GetExpandRoot}
  1833.  
  1834. procedure TLsDirTreeCombo28.SetExpandRoot(Value: Boolean);
  1835. begin
  1836.   Tree.FExpandRoot := Value;
  1837.   with Tree do
  1838.     if FExpandRoot and Assigned(Items[0]) then
  1839.       Items[0].Expand(False);
  1840. end; {SetExpandRoot}
  1841.  
  1842. procedure TLsDirTreeCombo28.Notification(AComponent: TComponent;
  1843.   Operation: TOperation);
  1844. begin
  1845.   inherited Notification(AComponent, Operation);
  1846.   if (Operation = opRemove) and (AComponent = FFileList) then
  1847.     FFileList := nil;
  1848. end; {Notification}
  1849.  
  1850. function TLsDirTreeCombo28.GetBtnGlyph: TBitmap;
  1851. begin
  1852.   GetBtnGlyph := Btn.Glyph;
  1853. end; {GetBtnGlyph}
  1854.  
  1855. procedure TLsDirTreeCombo28.SetBtnGlyph(NewValue: TBitmap);
  1856. begin
  1857.   if NewValue <> nil then
  1858.     Btn.Glyph.Assign(NewValue);
  1859. end; {SetBtnGlyph}
  1860.  
  1861. function TLsDirTreeCombo28.GetTreeHeight: integer;
  1862. begin
  1863.   GetTreeHeight := Tree.Height;
  1864. end; {GetTreeHeight}
  1865.  
  1866. procedure TLsDirTreeCombo28.SetTreeHeight(newValue: Integer);
  1867. begin
  1868.   Tree.Height := newValue;
  1869. end; {SetTreeHeight}
  1870.  
  1871. function TLsDirTreeCombo28.GetHideSelection: Boolean;
  1872. begin
  1873.   GetHideSelection := Tree.HideSelection;
  1874. end; {GetHideSelection}
  1875.  
  1876. procedure TLsDirTreeCombo28.SetHideSelection(Value: Boolean);
  1877. begin
  1878.   Tree.HideSelection := Value;
  1879. end; {SetHideSelection}
  1880.  
  1881.  
  1882. procedure TLsDirTreeCombo28.Keydown(var Key: Word; Shift: TShiftState);
  1883. var
  1884.   CurItem: TTreeNode;
  1885. begin
  1886.   case Key of
  1887.     VK_RIGHT: Tree.Selected.Expand(False); //52 Expand Selected Node
  1888.     VK_LEFT: //52 Collapse Selected Node
  1889.       begin
  1890.         with Tree do
  1891.         begin
  1892.           if Selected.Expanded then
  1893.             Selected.Collapse(True);
  1894.           if (Selected.getPrevSibling = Items[0]) or
  1895.             (Selected.GetPrevVisible = Items[0]) or
  1896.             (Selected = Items[0]) then exit;
  1897.           CurItem := Selected.GetPrevVisible;
  1898.           CurItem.Selected := True;
  1899.         end;
  1900.       end;
  1901.     VK_F4: //52 Activate LsDirTreeView
  1902.       begin
  1903.         BtnClick(Self);
  1904.         if Tree.Visible then
  1905.           Tree.SetFocus;
  1906.       end;
  1907.     VK_F5:   //872>  Refresh
  1908.       begin
  1909.         ResetTreeView;
  1910.         OpenPath(Tree.FSelectedPath);
  1911.       end;                            //872<
  1912.     VK_ESCAPE: //52 Close LsDirTreeView
  1913.       begin
  1914.         if Tree.Enabled = True then
  1915.         begin
  1916.           Tree.Enabled := False;
  1917.           Tree.Visible := False;
  1918.         end;
  1919.       end;
  1920.     VK_DOWN: //52 Move to NextChild or nextVisible
  1921.       begin
  1922.         with Tree do
  1923.         begin
  1924.           if (Selected.GetNext = nil) or
  1925.             (Selected.getNextVisible = nil) then exit; //53
  1926.           if Selected.Expanded then
  1927.             CurItem := Selected.GetNext
  1928.           else
  1929.             CurItem := Selected.getNextVisible;
  1930.           CurItem.Selected := True;
  1931.         end;
  1932.       end;
  1933.     VK_UP: //52 Move to prevChild or prevVisible
  1934.       begin
  1935.         with Tree do
  1936.         begin
  1937.           if Selected = Items[0] then exit;
  1938.           CurItem := Selected.GetPrevVisible;
  1939.           CurItem.Selected := True;
  1940.         end;
  1941.       end;
  1942.     VK_RETURN: //52 set the SelectedPath
  1943.       begin
  1944.         with Tree do
  1945.         begin
  1946.           MakePath(selected);
  1947.           if (Selected = Items[0]) then
  1948.             FSelectedPath := 'Drives'
  1949.           else
  1950.             FSelectedPath := TreeViewPath;
  1951.           SetSelectedPath(FSelectedPath);
  1952.  
  1953.           if Assigned(FOnPathChange) then
  1954.             FOnPathChange(Self, FSelectedPath);  //83
  1955.  
  1956.           SendToBack;
  1957.           Enabled := False;
  1958.           Visible := False;
  1959.           if Selected.Level = 1 then
  1960.             if GetDriveType(PChar(FSelectedPath)) = DRIVE_REMOVABLE then
  1961.             begin
  1962.               if not DiskInDrive(FSelectedPath[1], 1) then
  1963.                 exit;
  1964.             end;
  1965.         end;
  1966.         Text := Tree.selected.Text;
  1967.       end; //VK_Return
  1968.   end;
  1969.   inherited KeyDown(Key, Shift);
  1970. end; {Keydown}
  1971.  
  1972. procedure TLsDirTreeCombo28.SetAbout(Value: string);  //85 >>
  1973. begin
  1974.   // Property About is Readonly.
  1975. end;                                                  //85 <<
  1976.  
  1977. procedure TLsDirTreeCombo28.WMRButtonUp(var Message: TWMRButtonUp);  //862
  1978. begin
  1979.   Message.Result := 1;
  1980. end;  //862<<
  1981.  
  1982. procedure TLsDirTreeCombo28.WMKillFocus
  1983. (var Message: TWMKILLfOCUS);  //862
  1984. begin
  1985.   if Tree.Enabled then
  1986.   begin
  1987.     ReleaseCapture;
  1988.     Tree.Enabled := False;
  1989.     Tree.Visible := False;
  1990.   end;
  1991. end;  //862<<
  1992.  
  1993. //
  1994. procedure TLsDirTreeCombo28.ConnectNetResource(Sender: TObject);  //862+>>
  1995. var
  1996.   ADrv: integer;
  1997.   DrvLtr: Char;
  1998.   CurNode: TTreeNode;
  1999. begin
  2000.   DrvLtr := ' ';
  2001.   Integer(Drives) := GetLogicalDrives;
  2002.   for ADrv := 0 to 25 do
  2003.     if ADrv in Drives then
  2004.       DrvLtr := Chr(ADrv + Ord('B'));
  2005.   if WNetConnectionDialog(Application.Handle, RESOURCETYPE_DISK) = NO_ERROR then
  2006.   begin
  2007.     ReSetTreeview;
  2008.     Tree.Items[0].Expand(False);
  2009.     CurNode := Tree.Items[0].GetLastChild;
  2010.     CurNode.Selected := True;
  2011.     Tree.FSelectedPath := DrvLtr + ':\';
  2012.     OpenPath(Tree.FSelectedPath);
  2013.     if Assigned(FFileList) then
  2014.       FFilelist.Directory := Tree.FSelectedPath;
  2015.   end;
  2016. end; //ConnecttoNetResource   //862+<<
  2017.  
  2018. procedure TLsDirTreeCombo28.DisConnectNetResource(Sender: TObject);  //862+>>
  2019. begin
  2020.   WNetDisconnectDialog(Application.Handle, RESOURCETYPE_DISK);
  2021.   ReSetTreeview;
  2022.   Tree.Items[0].Expand(False);
  2023.   Tree.Items[0].Selected := True;
  2024.   SelectedPath := 'Drives';
  2025.   if Assigned(FFileList) then
  2026.   begin
  2027.     FFileList.Directory := SelectedPath;
  2028.     FFileList.UpdateFileList;
  2029.   end;
  2030.   OpenPath(Tree.FSelectedPath);
  2031.   ImageIndex := Tree.Selected.ImageIndex;
  2032.   Text := Tree.Items[0].Text;
  2033. end;  //DisConnectNetResource   //862+<<
  2034.  
  2035. ///// End of TLsDirTreeCombo28 /////
  2036.  
  2037. { ***** TLsSpeedButton  ***** }
  2038.  
  2039. procedure TLsSpeedButton.WMRButtonUp(var Message: TWMRButtonUp);  //862>>
  2040. begin
  2041.   Message.Result := 1;
  2042. end;  //862<<
  2043.  
  2044. /////  End of TLsSpeedButton  /////
  2045.  
  2046.  
  2047. {************************************************************************}
  2048. {                         TLsDirTree21                              //70 }
  2049. {************************************************************************}
  2050.  
  2051. procedure TLsDirTree21.CreateWnd;
  2052. begin
  2053.   inherited CreateWnd;
  2054.  
  2055.   CallWindowProc(DefWndProc, Handle, WM_SETFOCUS, 0, 0);
  2056.   if not (csLoading in ComponentState) then
  2057.     LoadRoot;
  2058. end; {CreateWnd}
  2059.  
  2060.  
  2061. constructor TLsDirTree21.Create;
  2062. var
  2063.   sfi: TShFileInfo;
  2064.   hImgLst: Uint;
  2065. begin
  2066.   inherited Create(AOwner);
  2067. //  Font.size := 8;                //80
  2068. //  Font.name := 'MS Sans Serif';  //80
  2069.  
  2070.   Width := 180;
  2071.   Height := 120;
  2072.  
  2073.   Images := TImageList.Create(Self);
  2074.   hImgLst := SHGetFileInfo('', 0,
  2075.     sfi, SizeOf(sfi),
  2076.     SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  2077.   if hImgLst <> 0 then
  2078.   begin
  2079.     Images.Handle := hImgLst;
  2080. //    Images.BkColor := clNone;  //871
  2081.     Images.ShareImages := True;
  2082.   end;
  2083.  
  2084.   SetTvLanguage(lnEnglish);  //872ln
  2085.   InitializeVar;
  2086.  
  2087.   FPopupMenu := TLsDirTree21PopUp.Create(Self);
  2088.   FPopupMenu.BuildItems;
  2089.   FPopupMenu.AutoPopup := True;
  2090.   FPopupMenu.FDirTree := Self;
  2091.   PopupMenu := FPopupMenu;
  2092.   FPopUpMenuEnabled := True;
  2093.  
  2094.   OnExpanding := Expanding;
  2095.   ReadOnly := False;
  2096.   SortType := stNone;
  2097.   HideSelection := False;
  2098.   FIsNewFolder := False;
  2099.   FisCutCopy := False;  //86
  2100.   FAbout := 'Version 2.1.7.3';  //861
  2101. end; {Create}
  2102.  
  2103. destructor TLsDirTree21.destroy;
  2104. var
  2105.   i: integer;
  2106. begin
  2107.   for i := Items.Count - 1 downto 0 do
  2108.     Items[i].Free;
  2109.   Images.Free;
  2110.   inherited Destroy;
  2111. end; {Destroy}
  2112.  
  2113. procedure TLsDirTree21.LoadRoot;
  2114. var
  2115.   Sfi: TSHFileInfo;
  2116.   Root: TTreenode;
  2117.   idRoot: PItemIDList;
  2118. begin
  2119.   Items.BeginUpdate;
  2120.   Items.Clear;
  2121.   if SHGetSpecialFolderLocation(Handle, CSIDL_DRIVES, idRoot) = NOERROR then
  2122.     if SHGetFileInfo(PChar(idRoot), 0, Sfi, SizeOf(TSHFileInfo), SHGFI_PIDL
  2123.       or
  2124.       SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_DISPLAYNAME) <> 0 then
  2125.     begin
  2126.       Root := items.AddFirst(nil, Sfi.szDisplayName);
  2127.       Root.ImageIndex := Sfi.iIcon;
  2128.       Root.SelectedIndex := Sfi.iIcon;
  2129.     end;
  2130.   Items.EndUpdate;
  2131. end; {LoadRoot}
  2132.  
  2133. procedure TLsDirTree21.LoadDrives;
  2134. var
  2135.   ADrive: integer;
  2136.   DriveLetter: char;
  2137.   DriveString: string;
  2138.   DrvName: string;
  2139.   Sfi: TSHFileInfo;
  2140. begin
  2141.   Items.BeginUpdate;
  2142.   Integer(Drives) := GetLogicalDrives;
  2143.   for ADrive := 0 to 25 do
  2144.   begin
  2145.     if ADrive in Drives then
  2146.     begin
  2147.       DriveLetter := Chr(ADrive + ord('A'));
  2148.       DriveString := DriveLetter + ':\';
  2149.       SHGetFileInfo(PChar(DriveString), 0, Sfi, SizeOf(Sfi),
  2150.         SHGFI_DISPLAYNAME);
  2151.       DrvName := Copy(Sfi.szDisplayName, 1, (Pos('(', Sfi.szDisplayName) - 1));
  2152.       with Items do
  2153.       begin
  2154.         AddChild(Items[0], ' (' + DriveLetter + ':)  ' + DrvName);
  2155.         ShowButtons := True;
  2156.         Items[Count - 1].HasChildren := true;
  2157.         Items[Count - 1].ImageIndex := GetNormalIcon(DriveString);
  2158.         Items[Count - 1].SelectedIndex := GetSelectedIcon(DriveString);
  2159.         if GetDriveType(PChar(DriveString)) = DRIVE_REMOTE then  //871>>
  2160.           FNetDrive[ADrive] := True
  2161.         else
  2162.           FNetDrive[ADrive] := False;  //871<<
  2163.       end;
  2164.     end;
  2165.   end;
  2166.   Items.EndUpdate;
  2167. end; {LoadDrives}
  2168.  
  2169. procedure TLsDirTree21.MakePath(Node: TTreeNode);
  2170.  
  2171.   procedure MakeSubPath;
  2172.   begin
  2173.     if Node.Level = 1 then
  2174.       TreeViewPath := Copy(Node.Text, 3, 2) + '\' + TreeViewPath
  2175.     else if Node.Level > 1 then
  2176.       if TreeViewPath = '' then
  2177.         TreeViewPath := Node.Text
  2178.       else
  2179.         TreeViewPath := Node.Text + '\' + TreeViewPath;
  2180.   end; {MakeSubPath}
  2181.  
  2182. begin
  2183.   TreeViewPath := '';
  2184.   MakeSubPath;
  2185.   while Node.Parent <> nil do
  2186.   begin
  2187.     Node := Node.Parent;
  2188.     MakeSubPath;
  2189.   end;
  2190. end; {MakePath}
  2191.  
  2192. procedure TLsDirTree21.AddSubs(Path: string; Node: TTreeNode);
  2193. var
  2194.   ANode: TTreeNode;
  2195.   APath: string;
  2196.   hFindFile: THandle;
  2197.   Win32FD: TWin32FindData;
  2198.   DriveLtr: Char;  //871
  2199.  
  2200.   function IsDirectory(dWin32FD: TWin32FindData): Boolean;
  2201.   var
  2202.     FName: string;
  2203.   begin
  2204.     FName := StrPas(dWin32FD.cFileName);
  2205.     with dWin32FD do
  2206.       Result := (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY =
  2207.         FILE_ATTRIBUTE_DIRECTORY) and (FName <> '.') and (FName <> '..');
  2208.   end; {IsDirectory}
  2209.  
  2210.   function HasSubs(sPath: string): Boolean;
  2211.   var
  2212.     sAPath: string;
  2213.     shFindFile: THandle;
  2214.     sWin32FD: TWin32FindData;
  2215.   begin
  2216.     Result := False;
  2217.     sAPath := sPath;
  2218.     sAPath := AddSlash(sAPath);
  2219.     shFindFile := FindFirstFile(PChar(sAPath + '*.*'), sWin32FD);
  2220.     if shFindFile <> INVALID_HANDLE_VALUE then
  2221.     try
  2222.       repeat
  2223.         if IsDirectory(sWin32FD) then
  2224.         begin
  2225.           Result := True;
  2226.           Break;
  2227.         end;
  2228.       until not FindNextFile(shFindFile, sWin32FD);
  2229.     finally
  2230.       Windows.FindClose(shFindFile);
  2231.     end;
  2232.   end; {HasSubs}
  2233.  
  2234. begin
  2235.   APath := Path;
  2236.   APath := AddSlash(APath);
  2237.   DriveLtr := UpCase(Path[1]);
  2238.   hFindFile := FindFirstFile(PChar(APath + '*.*'), Win32FD);
  2239.   if hFindFile <> INVALID_HANDLE_VALUE then
  2240.   try
  2241.     repeat
  2242.       if IsDirectory(Win32FD) then
  2243.       begin
  2244.         ANode := Items.AddChild(Node, Win32FD.cFileName);
  2245.         if FNetDrive[ord(DriveLtr) - 65] = True then  //871
  2246.           ANode.HasChildren := True
  2247.         else  //871<<
  2248.           ANode.HasChildren := HasSubs(APath + Win32FD.cFileName);
  2249.         ANode.ImageIndex := GetNormalIcon(APath + Win32FD.cFileName);
  2250.         ANode.SelectedIndex := GetSelectedIcon(APath + Win32FD.cFileName);
  2251.       end;
  2252.     until not FindNextFile(hFindFile, Win32FD);
  2253.   finally
  2254.     Windows.FindClose(hFindFile);
  2255.   end;
  2256. end; {addSubs}
  2257.  
  2258. procedure TLsDirTree21.ReLoad;
  2259. begin
  2260.   Items.BeginUpdate;
  2261.   Items.Clear;
  2262.   LoadRoot;
  2263.   LoadDrives;
  2264.   Items.EndUpdate;
  2265. end; {Reload}
  2266.  
  2267. procedure TLsDirTree21.Loaded;  //70
  2268. begin
  2269.   inherited Loaded;
  2270.   Reload;
  2271.   if Items.GetFirstNode <> nil then
  2272.     Items.GetFirstNode.Expand(False);
  2273. end; {Loaded}
  2274.  
  2275. procedure TLsDirTree21.Expanding(Sender: TObject; Node: TTreeNode;
  2276.   var AllowExpansion: Boolean);
  2277. var
  2278.   OldCursor: TCursor;  //872
  2279. begin
  2280.   if Node.GetFirstChild = nil then
  2281.   begin
  2282.     OldCursor := Screen.Cursor;   //872
  2283.     Screen.Cursor := crHourGlass;  //872
  2284.     try
  2285.       MakePath(Node);
  2286.       Node.HasChildren := false;
  2287.       AddSubs(TreeViewPath, Node);
  2288.       Node.AlphaSort;
  2289.     finally
  2290.       Screen.Cursor := OldCursor;  //872
  2291.     end;
  2292.   end;
  2293. end; {Expanding}
  2294.  
  2295. procedure TLsDirTree21.MouseDown(Button: TMouseButton;
  2296.   Shift: TShiftState; X, Y: Integer);
  2297. var
  2298.   vHitTest: THitTests;
  2299.   DrvChar: Char;
  2300. begin
  2301.   inherited MouseDown(button, shift, x, y);  //85
  2302.   TreeViewPath := '';
  2303. //  if Button = mbRight then exit;  //85
  2304. //  if Button = mbLeft then         //85
  2305. //  begin                           //85
  2306.     vHitTest := GetHitTestInfoAt(X, Y);
  2307.     if (htOnItem in vHitTest) or (htOnIcon in vHitTest) then
  2308.     begin
  2309.       Selected := GetNodeAt(X, Y);  //85
  2310.       if (Selected.Level = 0) and (Items[0].getFirstChild = nil) then
  2311.         LoadDrives
  2312.       else
  2313.         MakePath(Selected);
  2314.  
  2315.       if Selected = Items[0] then
  2316.         FSelectedPath := 'Drives'
  2317.       else
  2318.         FSelectedPath := TreeViewPath;
  2319.  
  2320.       if Selected.Level = 1 then
  2321.         if GetDriveType(PChar(FSelectedPath)) in
  2322.           [DRIVE_REMOVABLE, DRIVE_CDROM] then
  2323.         begin
  2324.           DrvChar := FSelectedPath[1];
  2325.           if not DiskInDrive(DrvChar, 1) then
  2326.             exit;
  2327.         end;
  2328.  
  2329.       if Assigned(FOnDirChange) then        //83
  2330.         FOnDirChange(Self, FSelectedPath);
  2331.       if Assigned(FFileList) and (FSelectedPath <> '') then
  2332.         FFileList.Directory := FSelectedPath;
  2333.     end;
  2334. //  end;  //85
  2335. end; {MouseDown}
  2336.  
  2337. procedure TLsDirTree21.SetSelectedPath(Value: string);
  2338. begin
  2339.   if AnsiCompareText(Value, FSelectedPath) = 0 then
  2340.     exit;
  2341.   FSelectedPath := Value;
  2342. end; {SetSelectedPath}
  2343.  
  2344. procedure TLsDirTree21.SetSelectedFile(Value: string); //80^
  2345. begin
  2346.   if AnsiCompareText(Value, FSelectedFile) = 0 then exit;
  2347.     FSelectedFile := Value;
  2348. end;  {SetSelectedFile}
  2349.  
  2350. procedure TLsDirTree21.SetInitialDir(Value: string);  //85 >>
  2351. begin
  2352.   if (Value = '') or (AnsiCompareText(Value, FInitialDir) = 0)  then
  2353.     exit;
  2354.   Value := AddSlash(Value);
  2355.   if (not DirectoryExists(Value)) then
  2356.     exit
  2357.   else begin
  2358.     FInitialDir := Value;
  2359.     OpenPath(FInitialDir);
  2360.     if Assigned(FFileList) then
  2361.       FFileList.Directory := FInitialDir;
  2362.   end;
  2363. end;   {SetInitialDir}  //85 <<
  2364.  
  2365. procedure TLsDirTree21.OpenPath(dPath: string);
  2366. var
  2367.   CurNode: TTreeNode;
  2368.   count: Integer;
  2369.   TempPath: string;
  2370.   CurPath: string;
  2371.   FullPath: string;
  2372. begin
  2373.   if (dPath = '') or (Length(dPath) = 1) then exit;
  2374.   if not DirectoryExists(dPath) then exit;
  2375.   dPath := AddSlash(dPath);
  2376.   FullPath := dPath;
  2377.   Items.BeginUpdate;
  2378.   CurNode := Items.GetFirstNode;  //70
  2379.   if CurNode.getFirstChild = nil then
  2380.     LoadDrives;
  2381.   if CurNode.Expanded then
  2382.     CurNode.Collapse(True);
  2383.   CurNode := Items.GetFirstNode;
  2384.   while Pos('\', dPath) > 0 do
  2385.   begin
  2386.     count := Pos('\', dPath);
  2387.     tempPath := Copy(dPath, 1, count);
  2388.     dPath := Copy(dPath, count + 1, Length(dPath));
  2389.     CurNode := CurNode.getFirstChild;
  2390.  
  2391.     while CurNode <> nil do
  2392.     begin
  2393.       if CurNode.Level = 1 then
  2394.         CurPath := Copy(CurNode.Text, 3, 2) + '\'
  2395.       else if CurNode.Level > 1 then
  2396.         CurPath := CurNode.Text + '\';
  2397.       if AnsiCompareText(CurPath, tempPath) = 0 then
  2398.       begin
  2399.         CurNode.Selected := True;
  2400.         CurNode.Expand(False);
  2401.         Break;
  2402.       end;
  2403.       CurNode := CurNode.GetNext;
  2404.       if CurNode = nil then exit;
  2405.     end;
  2406.   end;
  2407.   Items.EndUpdate;
  2408.   if AnsiCompareText(FSelectedPath, FullPath) <> 0 then
  2409.   begin
  2410.     FullPath := AddSlash(FullPath);
  2411.     FSelectedPath := FullPath;
  2412.   end;
  2413.   if Assigned(FOnDirChange) then
  2414.     FOnDirChange(Self, FSelectedPath);  //83
  2415. end; {OpenPath}
  2416.  
  2417. procedure TLsDirTree21.KeyUp(var Key: Word; Shift: TShiftState);  //84
  2418. var
  2419.   DrvChar: Char;
  2420. begin
  2421.   if (Key = VK_UP) or (Key = VK_DOWN) or (Key = VK_LEFT) or (Key = VK_RIGHT) then
  2422.   begin
  2423.     inherited KeyUp(Key, Shift);
  2424.  
  2425.     if selected = nil then exit;
  2426.     if (Selected.Level = 0) and (Items[0].getFirstChild = nil) then
  2427.       LoadDrives
  2428.     else
  2429.       MakePath(Selected);
  2430.  
  2431.     if (Selected.Level = 0) then
  2432.       FSelectedPath := 'Drives'
  2433.     else
  2434.       FSelectedPath := TreeViewPath;
  2435.  
  2436.     if Selected.Level = 1 then
  2437.       if GetDriveType(PChar(FSelectedPath)) in
  2438.         [DRIVE_REMOVABLE, DRIVE_CDROM] then
  2439.       begin
  2440.         DrvChar := FSelectedPath[1];
  2441.         if not DiskInDrive(DrvChar, 1) then
  2442.           exit;
  2443.       end;
  2444.  
  2445.     if Assigned(FOnDirChange) then
  2446.       FOnDirChange(Self, FSelectedPath);  //83
  2447.     if Assigned(FFileList) and (FSelectedPath <> '') then
  2448.       FFileList.Directory := FSelectedPath;
  2449.   end;
  2450.   if Key=VK_F5 then   //872>
  2451.   begin
  2452.     Reload;
  2453.     OpenPath(FSelectedPath);
  2454.   end;                        //872<
  2455. end; {KeyUp}  //84
  2456.  
  2457. function TLsDirTree21.GetPathFromNode(Node: TTreeNode): string;
  2458. begin
  2459.   Result := '';
  2460.   if Node = nil then exit;
  2461.   if Assigned(Node) then
  2462.   begin
  2463.     MakePath(Node);
  2464.     Result := TreeViewPath;
  2465.   end;
  2466. end; {GetPathFromNode}
  2467.  
  2468. function TLsDirTree21.CanEdit(Node: TTreeNode): Boolean;
  2469. begin
  2470.   Result := False;
  2471.   if (Assigned(Node.Parent)) and (Node.Level > 1) and
  2472.     (not ReadOnly) then
  2473.     Result := inherited CanEdit(Node);
  2474. end; {CanEdit}
  2475.  
  2476. procedure TLsDirTree21.Edit(const Item: TTVItem);
  2477. var
  2478.   OldDirName: string;
  2479.   NewDirName: string;
  2480.   Aborted: Boolean;
  2481.   OldCur: TCursor;
  2482.   Rslt: Boolean;
  2483.   SelNode: TTreeNode;
  2484.   PrevNode: TTreeNode;
  2485.  
  2486.   function GetNodeFromItem(Item: TTVItem): TTreeNode;
  2487.   begin
  2488.     with Item do
  2489.       if (State and TVIF_PARAM) <> 0 then
  2490.         Result := Pointer(lParam)
  2491.       else
  2492.         Result := Items.GetNode(hItem);
  2493.   end; {GetNodeFromItem}
  2494.  
  2495. begin
  2496.   SelNode := GetNodeFromItem(Item);
  2497.   PrevNode := SelNode.Parent;
  2498.   if not Assigned(SelNode) then exit;
  2499.   if (SelNode = Items[0]) or (SelNode.Level = 1) then
  2500.     exit;
  2501.  
  2502.   if (Length(Item.pszText) = 0)
  2503.     or (StrContains(InvalidDosChars, Item.pszText)) then
  2504.   begin
  2505.     MessageBeep(MB_ICONHAND);
  2506.     if (Length(Item.pszText) > 0) then
  2507. //      MessageDlg('Error - Invalid Directory Name' + #13 +    //872ln
  2508.       MessageDlg(esInvalidDirName + #13 +    //872ln
  2509.         Item.pszText, mtError, [mbOK], 0);
  2510.     Exit;
  2511.   end;
  2512.   if SelNode <> nil then
  2513.     OldDirName := GetPathFromNode(SelNode);
  2514.   if OldDirName = '' then exit;
  2515.   OldCur := Screen.Cursor;
  2516.   Screen.Cursor := crHourGlass;
  2517.   try
  2518.     Aborted := False;
  2519.     OldDirName := DelSlash(OldDirName);
  2520.     NewDirName := ExtractFilePath(OldDirName) + Item.pszText;
  2521.  
  2522.     if not FIsNewFolder then
  2523.     begin
  2524. //      if MessageDlg('Do you want to rename the selected folder' + #13 + #13 +
  2525. //        '    From  : ' + ExtractFileName(OldDirName) + #13 +
  2526. //        '    To     : ' + ExtractFileName(NewDirName), mtConfirmation,
  2527. //        [mbYes, mbNo], 0) = mrNo then  //872ln
  2528.       if MessageDlg(esConfirmRename + #13 + #13 +
  2529.                     '    ' + ewFrom + ExtractFileName(OldDirName) + #13 +
  2530.                     '    ' + ewTo + ExtractFileName(NewDirName), mtConfirmation,
  2531.                     [mbYes, mbNo], 0) = mrNo then   //872ln
  2532.         exit;
  2533.     end;
  2534.  
  2535.     Rslt := DoSHFileOp(Parent.Handle, FO_RENAME, OldDirName,
  2536.       NewDirName, Aborted);
  2537.  
  2538.     if Rslt then
  2539.     begin
  2540.       inherited Edit(Item);
  2541.       Selected := PrevNode;
  2542.       if Assigned(FFileList) then
  2543.       begin
  2544.         FFileList.Directory := GetPathFromNode(Selected);
  2545.       end;
  2546.     end;
  2547.   finally
  2548.     Screen.Cursor := OldCur;
  2549.     FIsNewFolder := False;
  2550.   end;
  2551. end; {Edit}
  2552.  
  2553. function TLsDirTree21.AddNewNode(ParentNode: TTreeNode;
  2554.   NodeName: string): Boolean;
  2555. var
  2556.   Path: string;
  2557.   Dir: string;
  2558.   NewNode: TTreeNode;
  2559. begin
  2560.   Result := False;
  2561.   if ParentNode = nil then
  2562.     ParentNode := Selected;
  2563.   if ParentNode.Level = 0 then
  2564.   begin
  2565. //    MessageDlg('Can''t add drives', mtError, [mbOK], 0);
  2566.     MessageDlg(ewError + esCannotAddDrv , mtError, [mbOK], 0);  //872ln
  2567.     exit;
  2568.   end;
  2569.  
  2570.   if NodeName = '' then
  2571.   begin
  2572. //    NodeName := 'New Folder';
  2573.     NodeName := esNewFolder;  //872ln
  2574.     FIsNewFolder := True;
  2575.   end;
  2576.   try
  2577.     Path := GetPathFromNode(ParentNode);
  2578.     if Path = '' then exit;
  2579.     Path := AddSlash(Path);
  2580.     Dir := Path + NodeName;
  2581. //    Dir := AddNullToStr(Dir);  //80
  2582.  
  2583.     if StrContains(InvalidDosChars, NodeName) then
  2584.     begin
  2585.       MessageBeep(MB_ICONHAND);
  2586. //      MessageDlg('Folder Name contains invalid characters', mtError, [mbOK], 0);
  2587.       MessageDlg(esInvalidChars, mtError, [mbOK], 0);  //872ln
  2588.       exit;
  2589.     end;
  2590.     Items.BeginUpdate;
  2591.  
  2592.     Result := CreateDirectory(PChar(Dir), nil);
  2593.  
  2594.     if Result then
  2595.     begin
  2596.       ReLoad;
  2597.       Dir := AddSlash(Dir);
  2598.       OpenPath(Dir);
  2599.       NewNode := Selected;
  2600.       if (NewNode <> nil) and (NodeName = 'New Folder') then
  2601.         NewNode.EditText;
  2602.     end;
  2603.   finally
  2604.     Items.EndUpdate;
  2605.   end;
  2606. end; {AddNewNode}
  2607.  
  2608.  
  2609. function TLsDirTree21.DeleteNode(Node: TTreeNode): Boolean;
  2610. var
  2611.   DelDir: string;
  2612.   DelPath: string;
  2613.   PrevNode: TTreeNode;
  2614.   oldCur: TCursor;
  2615.   Aborted: Boolean;
  2616. begin
  2617.   Result := False;
  2618.   Aborted := True;
  2619.   PrevNode := Node.Parent;
  2620.   if (Assigned(Node)) and (Node.Level > 1) then
  2621.   begin
  2622.     oldCur := Screen.Cursor;
  2623.     Screen.Cursor := crHourGlass;
  2624.     if Selected <> nil then
  2625.       DelDir := GetPathFromNode(Selected);
  2626.     if DelDir = '' then exit;
  2627.     if not DirectoryExists(Deldir) then
  2628.     begin
  2629.       MessageBeep(MB_ICONHAND);
  2630. //      MessageDlg(DelDir + 'not found', mtError, [mbOK], 0);
  2631.       MessageDlg(DelDir + esNotFound, mtError, [mbOK], 0);
  2632.       Screen.Cursor := oldCur;
  2633.       exit;
  2634.     end;
  2635.     DelDir := DelSlash(Deldir);
  2636.     DelPath := ExtractFilePath(DelDir);
  2637.  //   MessageBeep(MB_ICONHAND);
  2638.     Result := DoSHFileOp(Parent.Handle, FO_DELETE, DelDir, '', Aborted);
  2639.     if Result then
  2640.     begin
  2641.       if Assigned(PrevNode) then
  2642.         Selected := PrevNode;
  2643.       Node.Delete;
  2644.       if Assigned(FFileList) then
  2645.         FFileList.Directory := GetPathFromNode(Selected);
  2646.     end;
  2647.     Screen.Cursor := oldCur;
  2648.   end;
  2649. end; {DeleteNode}
  2650.  
  2651. procedure TLsDirTree21.SetFileList(Value: TLsFilelistView28);
  2652. begin
  2653.   if FFileList <> Value then
  2654.     FFileList := Value;
  2655.   if (Assigned(FFileList)) and (FSelectedPath <> '') then
  2656.     FFileList.Directory := FSelectedPath;
  2657. end; {SetFileList}
  2658.  
  2659. procedure TLsDirTree21.SetPopUpMenuEnabled(Value: Boolean);
  2660. begin
  2661.   if Value <> FPopUpMenuEnabled then
  2662.   begin
  2663.     FPopUpMenuEnabled := Value;
  2664.     if FPopUpMenuEnabled then
  2665.       PopupMenu := FPopupMenu
  2666.     else
  2667.       PopupMenu := nil;
  2668.   end;
  2669. end; {SetPopUpMenuEnabled}
  2670.  
  2671. procedure TLsDirTree21.SetTvLanguage(Value: TLanguage);  //872ln
  2672. var
  2673.   LangID: integer;
  2674. begin
  2675.   if value = lnSysDefault then
  2676.   begin
  2677.     LangID := GetUserDefaultLangID and $3FF;  //SysLocale.PriLangID;
  2678.     Case LangID of
  2679.       LANG_ENGLISH      : Value := lnEnglish;    //$09
  2680.       LANG_FRENCH       : Value := lnFrench;     //$0C
  2681.       LANG_GERMAN       : Value := lnGerman;     //$07
  2682.       LANG_SPANISH      : Value := lnSpanish;    //$0A
  2683.       LANG_PORTUGUESE   : Value := lnPortuguese; //$16
  2684.     else
  2685.       Value := lnEnglish;
  2686.     end;
  2687.   end;
  2688.   if value <> FTvLanguage then
  2689.   begin
  2690.     FTvLanguage := Value;
  2691.     TvLangID := FTvLanguage;
  2692.     InitializeVar;
  2693.     FPopupMenu.Free;
  2694.     Application.ProcessMessages;
  2695.     FPopupMenu := TLsDirTree21PopUp.Create(Self);
  2696.     FPopupMenu.BuildItems;
  2697.     FPopupMenu.AutoPopup := True;
  2698.     FPopupMenu.FDirTree := Self;
  2699.     PopupMenu := FPopupMenu;
  2700.     FPopUpMenuEnabled := True;
  2701.     ReCreateWnd;
  2702.   end;
  2703. end;  //872ln
  2704.  
  2705. //872ts>
  2706. function TLsDirTree21.GetTreeSize: double;
  2707. var
  2708.   CurNode: TTreeNode;
  2709.   CurPath, CurDir, DispSize, DispName: string;
  2710.   FTreeSize, TreeSize: double;
  2711.   OldCur: TCurSor;
  2712.   ActualSize: string; //872ts
  2713.  
  2714.   function ComputeFolderSize(ADir: String): Double;
  2715.   var
  2716.     hFnd: THandle;
  2717.     Fnd: TWin32FindData;
  2718.     Temp: integer;
  2719.     FDir,FName: string;
  2720.   begin
  2721.     Result := 0;
  2722.     if Length(ADir) <> 0 then
  2723.     begin
  2724.       if ADir[Length(ADir)] <> '\' then
  2725.         ADir := ADir + '\';
  2726.       FDir := ADir;
  2727.     end
  2728.     else
  2729.       Exit;
  2730.     hFnd := FindFirstFile(PChar(FDir + '*.*'),Fnd);
  2731.     if hFnd <> INVALID_HANDLE_VALUE then
  2732.     begin
  2733.       try
  2734.         repeat
  2735.           FName := Trim(StrPas(Fnd.cFileName));
  2736.           if (FName <> '.') and (FName <> '..') then
  2737.           begin
  2738.             if (Fnd.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) <>
  2739.               FILE_ATTRIBUTE_DIRECTORY then
  2740.             begin
  2741.               Temp := (Fnd.nFileSizeHigh * MAXDWORD)  + Fnd.nFileSizeLow;
  2742.               Result := Result + Temp;
  2743.             end
  2744.             else
  2745.               Result := Result + ComputeFolderSize(FDir + FName);
  2746.          end;
  2747.        until not FindNextFile(hFnd,Fnd);
  2748.      finally
  2749.        Windows.FindClose(hFnd);
  2750.      end;
  2751.     end;
  2752.   end;
  2753.  
  2754. begin
  2755.   CurPath := '';
  2756.   OldCur := Screen.Cursor;
  2757.   Screen.Cursor := crHourGlass;
  2758.   Items.BeginUpdate;
  2759.   try
  2760.     CurNode := Selected;
  2761.     CurPath := GetPathFromNode(CurNode);
  2762.     CurDir := ExtractFileName(CurPath);
  2763.     FTreeSize := ComputeFolderSize(CurPath);
  2764.     if (CurNode.Level = 1) then
  2765. //    DispName := Drv + CurPath
  2766.     DispName := ewDrive + CurPath
  2767.     else if (CurNode.Level > 1) then
  2768. //    DispName := Fldr + CurDir + '"';
  2769.     DispName := ewFolder + CurDir + '"';
  2770.   finally
  2771.     Items.EndUpdate;
  2772.     Screen.CurSor := OldCur;
  2773.   end;
  2774.   Result := FTreeSize;
  2775.   ActualSize := Format('%0.0n Bytes',[FTreeSize]);
  2776.   if (FTreeSize > 0) and (FTreeSize < 1024) then
  2777.     TreeSize := 1.0
  2778.   else
  2779.     TreeSize := FTreeSize / 1024;
  2780.   if TreeSize <= 99999 then
  2781.     DispSize := Format('%.2n KB',[TreeSize])
  2782.   else
  2783.     DispSize := Format('%.2n MB',[TreeSize/1024]);
  2784.  
  2785.   MessageDlg( '===== ' + esTreeSize + ' =====' + #13#13 +   //873
  2786.              DispName + #13 + esAllSubDir + #13 +           //873
  2787.              ' =  ' + ActualSize + #13 +
  2788.              '     (i.e. ' + DispSize + ' )', mtInformation,[mbOK],0);  //872ln<
  2789. end;  {GetTreeSize}
  2790. //872ts<
  2791.  
  2792. procedure TLsDirTree21.ShowFolderContents; //80^
  2793. var
  2794.   CurFolder: string;
  2795. begin
  2796.   SelectedDir := '';
  2797.   SelectedDir := Self.FSelectedPath;
  2798.   if Selected.Level = 1 then
  2799.     CurFolder := '" ' + SelectedDir[1] + ':\ "'
  2800.   else if Selected.Level > 1 then
  2801.     CurFolder := '" ..\' + ExtractFileName(DelSlash(SelectedDir)) + ' "';
  2802.   if Items.GetFirstNode <> nil then
  2803.     Items.GetFirstNode.Collapse(True);
  2804.   OpenFileListDlg(Self);
  2805.   with DlgForm do
  2806.   begin
  2807.     Caption := 'Files in ' + CurFolder;
  2808.     Show;
  2809.   end;
  2810. end;  {ShowFolderContents}
  2811.  
  2812. procedure TLsDirTree21.ConnectNetResource(Sender: TObject);  //82
  2813. var
  2814.   ADrv: integer;
  2815.   DrvLtr: Char;
  2816.   CurNode: TTreeNode;
  2817. begin
  2818.   DrvLtr := ' ';
  2819.   Integer(Drives) := GetLogicalDrives;
  2820.   for ADrv := 0 to 25 do
  2821.     if ADrv in Drives then
  2822.       DrvLtr := Chr(ADrv + Ord('B'));
  2823.   if WNetConnectionDialog(Application.Handle, RESOURCETYPE_DISK) = NO_ERROR then
  2824.   begin
  2825.     Reload;
  2826.     Items[0].Expand(False);
  2827.     CurNode := Items[0].GetLastChild;
  2828.     CurNode.Selected := True;
  2829.     FSelectedPath := DrvLtr + ':\';
  2830.     if Assigned(FFileList) then
  2831.       FFilelist.Directory := FSelectedPath;
  2832.   end;
  2833. end; //ConnecttoNetResource   //82
  2834.  
  2835.  
  2836. procedure TLsDirTree21.DisConnectNetResource(Sender: TObject);  //82
  2837. begin
  2838.   WNetDisconnectDialog(Application.Handle, RESOURCETYPE_DISK);
  2839.   Reload;
  2840.   Items[0].Expand(False);
  2841.   Items[0].Selected := True;
  2842.   SelectedPath := 'Drives';
  2843.   if Assigned(FFileList) then
  2844.   begin
  2845.     FFileList.Directory := SelectedPath;
  2846.     FFileList.UpdateFileList;
  2847.   end;
  2848. end;  //DisConnectNetResource   //82
  2849.  
  2850. //82 >>
  2851. procedure TLsDirTree21.OpenFileListDlg(Sender: TObject);  //82 >>
  2852. var
  2853.   FFont: TFont;
  2854.   Panel1,
  2855.     Panel2: TPanel;
  2856.  
  2857.   procedure CreateImages;  //80^
  2858.   var
  2859.     sfi: TSHFileInfo;
  2860.     hImgList: Uint;
  2861.   begin
  2862.     SImgList := TImageList.Create(Self);
  2863.     hImgList := SHGetFileInfo('', 0, sfi, SizeOf(sfi), SHGFI_SYSICONINDEX or
  2864.                 SHGFI_SMALLICON);
  2865.     if hImgList <> 0 then
  2866.     begin
  2867.       SImgList.Handle := hImgList;
  2868.       SImgList.ShareImages := True;
  2869.     end;
  2870.     FileView.SmallImages := SImgList;
  2871.   end;  //CreateImages
  2872.  
  2873.   procedure BuildFileList; //80 //82
  2874.   var
  2875.     CurDir,
  2876.     FName,
  2877.       FileName: string;
  2878.     sfi: TSHFileInfo;
  2879.     hFindFile: THandle;
  2880.     Win32FD: TWin32FindData;
  2881.     OldCur: TCursor;
  2882.   begin
  2883.     OldCur := Screen.Cursor;
  2884.     CurDir := AddSlash(SelectedDir);
  2885.     hFindFile := FindFirstFile(PChar(CurDir + '*.*'), Win32FD);
  2886.     if hFindFile <> INVALID_HANDLE_VALUE then
  2887.     try
  2888.       Screen.Cursor := crHourGlass;
  2889.       FileView.Items.BeginUpdate;
  2890.       repeat
  2891.         with Win32FD do
  2892.         begin
  2893.           if (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY > 0) then
  2894.             Continue;
  2895.           FName := StrPas(Win32FD.cFileName);
  2896.           FileName := CurDir + FName;
  2897.           SHGetFileInfo(PChar(FileName), 0, sfi, SizeOf(sfi),
  2898.             SHGFI_SYSICONINDEX or SHGFI_DISPLAYNAME);
  2899.  
  2900.           with FileView.Items.Add do
  2901.           begin
  2902.             Caption := FName;
  2903.             ImageIndex := sfi.iIcon;
  2904.             SubItems.Add(FileName);
  2905.           end;
  2906.         end;
  2907.       until not FindNextFile(hFindFile, Win32FD);
  2908.     finally
  2909.       Windows.FindClose(hFindFile);
  2910.       FileView.Items.EndUpdate;
  2911.       Screen.Cursor := OldCur;
  2912.     end;
  2913.   end;  {BuildList}
  2914.  
  2915. begin
  2916.   DlgForm := TForm.Create(Self);
  2917.   with DlgForm do
  2918.   begin
  2919.     Parent := self;
  2920.     Align := alClient;
  2921.     BorderStyle := bsSizeToolWin; //bsSizeable;
  2922.     BorderIcons := BorderIcons - [biMaximize] - [biMinimize] -
  2923.       [biSystemMenu];
  2924.     FFont := TFont.Create;
  2925.     if owner is TForm then
  2926.       FFont.Assign(TForm(Owner).Font);
  2927.     Enabled := True;
  2928.     TabStop := False;
  2929.     FormStyle := fsStayOnTop;
  2930.     OnResize := DlgFormResize;  //82
  2931.  
  2932.     Panel1 := TPanel.Create(Self);
  2933.     with Panel1 do
  2934.     begin
  2935.       Parent := DlgForm;
  2936.       Align := alBottom;
  2937.       BevelInner := bvNone;
  2938.       BevelOuter := bvNone;
  2939.       Caption := '';
  2940.       Height := 22;
  2941.       TabStop := False;  //84
  2942.     end;
  2943.  
  2944.     Panel2 := TPanel.Create(Self);
  2945.     with Panel2 do
  2946.     begin
  2947.       Parent := Panel1;
  2948.       Height := 22;
  2949.       Width := 80;
  2950.       Align := alRight;
  2951.       BevelInner := bvNone;
  2952.       BevelOuter := bvNone;
  2953.       Caption := '';
  2954.       TabStop := False;  //84
  2955.     end;
  2956.  
  2957.     BtnOK := TBitBtn.Create(Self);  //84
  2958.     with BtnOk do
  2959.     begin
  2960.       Parent := Panel2;
  2961.       Height := 22;
  2962.       Width := 60;
  2963.       Top := 1;
  2964.       Left := 1;
  2965.       Caption := '&OK';
  2966.       Kind := bkOK;  //84
  2967.       Layout := blGlyphLeft;
  2968.       TabStop := True;
  2969. //      Glyph.Handle := LoadBitmap(hInstance, 'OK28');  //84
  2970.       OnClick := OKBtnClick;
  2971.       ModalResult := mrOK;
  2972.     end;
  2973.  
  2974.     FileView := TListView.Create(Self);
  2975.     with FileView do
  2976.     begin
  2977.       ParentWindow := DlgForm.Handle;
  2978.       parent := DlgForm;
  2979.       Align := alClient;
  2980.       Enabled := True;
  2981.       ViewStyle := vsList;
  2982.       HideSelection := False;  //84
  2983.       Hint := 'LeftClick - Select' +#13 +
  2984.               'DblClick  - Open';
  2985.       ShowHint := True;
  2986.       SortType := stText;
  2987.       TabStop := True;  //84
  2988.       Visible := True;
  2989.       OnDblClick := FileViewDblClick;
  2990.       CreateImages;
  2991.       BuildFileList;
  2992.       AlphaSort;
  2993.       if (Visible = True) and (Items.Count <> 0) then
  2994.         Items[0].Focused := True;  //84
  2995.     end;
  2996.   end; //DlgForm
  2997. end;  {OpenFileListDlg}  //82 <<
  2998.  
  2999. procedure TLsDirTree21.DlgFormResize(Sender: TObject);   //82 >>
  3000. begin
  3001.   with DlgForm do
  3002.   begin
  3003.     FileView.Width := DlgForm.ClientWidth;
  3004.     FileView.Height := DlgForm.ClientHeight;
  3005.   end;
  3006. end;  //DlgFormResize  //82 <<
  3007.  
  3008.  
  3009. procedure TLsDirTree21.FileViewDblClick(Sender: TObject);  //82 >>
  3010. var
  3011.   sFile,
  3012.   sDir: string;
  3013. begin
  3014.   with DlgForm do
  3015.   begin
  3016.     if FileView.Selected <> nil then
  3017.     begin
  3018.       hide;
  3019.       sFile := ExtractFileName(FileView.Selected.SubItems[0]);
  3020.       sDir := ExtractFilePath(FileView.Selected.SubItems[0]);
  3021.       ExecuteFile('Open', sFile, '', sDir, SW_SHOW);
  3022.     end;
  3023.     visible := True;
  3024.   end;
  3025. end;  {FileViewDblClick}  //82 <<
  3026.  
  3027.  
  3028. procedure TLsDirTree21.OKBtnClick(Sender: TObject);  //82 >>
  3029. begin
  3030.   FSelectedFile := '';
  3031.   with DlgForm do
  3032.   try
  3033.     if FileView.Selected <> nil then   //82
  3034.     begin
  3035.       FSelectedFile := FileView.Selected.SubItems[0];
  3036. //      ShowMessage(SelectedFile);  //for debugging
  3037.       if Assigned(FOnFileChange) then      //83
  3038.         FOnFileChange(Self, FSelectedFile);
  3039.     end;
  3040.   finally
  3041.     SImgList.Free;
  3042.     FileView.Free;
  3043.     DlgForm.Close;
  3044.   end;
  3045.   OpenPath(SelectedDir);
  3046. end;  {OKBtnClick}  //82 <<
  3047.  
  3048. procedure TLsDirTree21.SetAbout(Value: String);  //85 >>
  3049. Begin
  3050.   // About property is ReadOnly.
  3051. end;  {SetAbout} //85 <<
  3052.  
  3053. procedure TLsDirTree21.CutOrCopyNode(Mode: integer);  //86 >>
  3054. begin
  3055.   FOpMode := -1;
  3056.   if (Selected = nil) or (SelectedPath = '') then
  3057.     exit;
  3058.   FSrcPath := SelectedPath;
  3059.   FOpMode := Mode;
  3060.   FisCutCopy := True;
  3061. end;  {CutOrCopyNode} //86 <<
  3062.  
  3063. procedure TLsDirTree21.PasteNode;  //86 >>
  3064. var
  3065.   Abort: Boolean;
  3066. begin
  3067.   if (Selected = nil) or (SelectedPath = '') or
  3068.     (FSrcPath = '') then
  3069.   begin
  3070.     FisCutCopy := False;
  3071.     exit;
  3072.   end;
  3073.   Abort := False;
  3074.   FDestPath := AddSlash(SelectedPath);
  3075.   if DoSHFileOp(Parent.Handle, FileOpMode[FOpMode], FSrcPath, FDestPath, Abort) then
  3076.   begin
  3077.     Reload;
  3078.     OpenPath(FDestPath)
  3079.   end else
  3080. //    MessageDlg('File operation failed', mtError, [mbOK], 0);
  3081.     MessageDlg(esFileOpFailed, mtError, [mbOK], 0);  //872ln
  3082.   FisCutCopy := False;
  3083. end;  {PasteNode}  //86 <<
  3084.  
  3085. {$IFDEF D4_OR_HIGHER}
  3086. procedure TLsDirTree21.ShowNodeProperties;    //862 >>
  3087. var
  3088.   FolderPath: string;
  3089. begin
  3090.   if Selected = nil then
  3091.     exit;
  3092.   FolderPath := '';
  3093.   folderPath := Self.SelectedPath;
  3094.   if FolderPath <> '' then
  3095.     ShowProperties(FolderPath);
  3096. end;  {ShowNodeProperties}  //862 <<
  3097. {$ENDIF}
  3098.  
  3099. procedure TLsDirTree21.InitializeVar;  //872ln
  3100. begin
  3101.   if TvLangID = lnEnglish then
  3102.   begin
  3103.     ewDrive            :=  ENGLISH_ewDrive;   //873
  3104.     ewFolder           :=  ENGLISH_ewFolder;  //873
  3105.     ewError            :=  ENGLISH_ewError;
  3106.     ewFile             :=  ENGLISH_ewFile;
  3107.     ewFrom             :=  ENGLISH_ewFrom;
  3108.     ewTo               :=  ENGLISH_ewTo;
  3109.     esCannot           :=  ENGLISH_esCannot;
  3110.     esSpecifyDir       :=  ENGLISH_esSpecifyDir;
  3111.     esInvalidDrvID     :=  ENGLISH_esInvalidDrvID;
  3112.     esDrvNotReady      :=  ENGLISH_esDrvNotReady;
  3113.     esExists           :=  ENGLISH_esExists;
  3114.     esInvalidDirName   :=  ENGLISH_esInvalidDirName;
  3115.     esConfirmRename    :=  ENGLISH_esConfirmRename;
  3116.     esCannotAddDrv     :=  ENGLISH_esCannotAddDrv;
  3117.     esNewFolder        :=  ENGLISH_esNewFolder;
  3118.     esInvalidChars     :=  ENGLISH_esInvalidChars;
  3119.     esNotFound         :=  ENGLISH_esNotFound;
  3120.     esFilesIn          :=  ENGLISH_esFilesIn;
  3121.     esFileOpFailed     :=  ENGLISH_esFileOpFailed;
  3122.     esTreeSize         :=  ENGLISH_esTreeSize;   //873
  3123.     esAllSubDir        :=  ENGLISH_esAllSubDir;  //873
  3124.   end
  3125.   else if TvLangID = lnFrench then
  3126.   begin
  3127.     ewDrive            :=  FRENCH_ewDrive;       //873
  3128.     ewFolder           :=  FRENCH_ewFolder;      //873
  3129.     ewError            :=  FRENCH_ewError;
  3130.     ewFile             :=  FRENCH_ewFile;
  3131.     ewFrom             :=  FRENCH_ewFrom;
  3132.     ewTo               :=  FRENCH_ewTo;
  3133.     esCannot           :=  FRENCH_esCannot;
  3134.     esSpecifyDir       :=  FRENCH_esSpecifyDir;
  3135.     esInvalidDrvID     :=  FRENCH_esInvalidDrvID;
  3136.     esDrvNotReady      :=  FRENCH_esDrvNotReady;
  3137.     esExists           :=  FRENCH_esExists;
  3138.     esInvalidDirName   :=  FRENCH_esInvalidDirName;
  3139.     esConfirmRename    :=  FRENCH_esConfirmRename;
  3140.     esCannotAddDrv     :=  FRENCH_esCannotAddDrv;
  3141.     esNewFolder        :=  FRENCH_esNewFolder;
  3142.     esInvalidChars     :=  FRENCH_esInvalidChars;
  3143.     esNotFound         :=  FRENCH_esNotFound;
  3144.     esFilesIn          :=  FRENCH_esFilesIn;
  3145.     esFileOpFailed     :=  FRENCH_esFileOpFailed;
  3146.     esTreeSize         :=  FRENCH_esTreeSize;   //873
  3147.     esAllSubDir        :=  FRENCH_esAllSubDir;   //873
  3148.   end
  3149.   else if TvLangID = lnGerman then
  3150.   begin
  3151.     ewDrive            :=  GERMAN_ewDrive;   //873
  3152.     ewFolder           :=  GERMAN_ewFolder;  //873
  3153.     ewError            :=  GERMAN_ewError;
  3154.     ewFile             :=  GERMAN_ewFile;
  3155.     ewFrom             :=  GERMAN_ewFrom;
  3156.     ewTo               :=  GERMAN_ewTo;
  3157.     esCannot           :=  GERMAN_esCannot;
  3158.     esSpecifyDir       :=  GERMAN_esSpecifyDir;
  3159.     esInvalidDrvID     :=  GERMAN_esInvalidDrvID;
  3160.     esDrvNotReady      :=  GERMAN_esDrvNotReady;
  3161.     esExists           :=  GERMAN_esExists;
  3162.     esInvalidDirName   :=  GERMAN_esInvalidDirName;
  3163.     esConfirmRename    :=  GERMAN_esConfirmRename;
  3164.     esCannotAddDrv     :=  GERMAN_esCannotAddDrv;
  3165.     esNewFolder        :=  GERMAN_esNewFolder;
  3166.     esInvalidChars     :=  GERMAN_esInvalidChars;
  3167.     esNotFound         :=  GERMAN_esNotFound;
  3168.     esFilesIn          :=  GERMAN_esFilesIn;
  3169.     esFileOpFailed     :=  GERMAN_esFileOpFailed;
  3170.     esTreeSize         :=  GERMAN_esTreeSize;   //873
  3171.     esAllSubDir        :=  GERMAN_esAllSubDir;   //873
  3172.   end
  3173.   else if TvLangID = lnSpanish then
  3174.   begin
  3175.     ewDrive            :=  SPANISH_ewDrive;   //873
  3176.     ewFolder           :=  SPANISH_ewFolder;   //873
  3177.     ewError            :=  SPANISH_ewError;
  3178.     ewFile             :=  SPANISH_ewFile;
  3179.     ewFrom             :=  SPANISH_ewFrom;
  3180.     ewTo               :=  SPANISH_ewTo;
  3181.     esCannot           :=  SPANISH_esCannot;
  3182.     esSpecifyDir       :=  SPANISH_esSpecifyDir;
  3183.     esInvalidDrvID     :=  SPANISH_esInvalidDrvID;
  3184.     esDrvNotReady      :=  SPANISH_esDrvNotReady;
  3185.     esExists           :=  SPANISH_esExists;
  3186.     esInvalidDirName   :=  SPANISH_esInvalidDirName;
  3187.     esConfirmRename    :=  SPANISH_esConfirmRename;
  3188.     esCannotAddDrv     :=  SPANISH_esCannotAddDrv;
  3189.     esNewFolder        :=  SPANISH_esNewFolder;
  3190.     esInvalidChars     :=  SPANISH_esInvalidChars;
  3191.     esNotFound         :=  SPANISH_esNotFound;
  3192.     esFilesIn          :=  SPANISH_esFilesIn;
  3193.     esFileOpFailed     :=  SPANISH_esFileOpFailed;
  3194.     esTreeSize         :=  SPANISH_esTreeSize;  //873
  3195.     esAllSubDir        :=  SPANISH_esAllSubDir;  //873
  3196.   end
  3197.   else if TvLangID = lnPortuguese then  //873>
  3198.   begin
  3199.     ewDrive            :=  BRAZ_PORT_ewDrive;
  3200.     ewFolder           :=  BRAZ_PORT_ewFolder;
  3201.     ewError            :=  BRAZ_PORT_ewError;
  3202.     ewFile             :=  BRAZ_PORT_ewFile;
  3203.     ewFrom             :=  BRAZ_PORT_ewFrom;
  3204.     ewTo               :=  BRAZ_PORT_ewTo;
  3205.     esCannot           :=  BRAZ_PORT_esCannot;
  3206.     esSpecifyDir       :=  BRAZ_PORT_esSpecifyDir;
  3207.     esInvalidDrvID     :=  BRAZ_PORT_esInvalidDrvID;
  3208.     esDrvNotReady      :=  BRAZ_PORT_esDrvNotReady;
  3209.     esExists           :=  BRAZ_PORT_esExists;
  3210.     esInvalidDirName   :=  BRAZ_PORT_esInvalidDirName;
  3211.     esConfirmRename    :=  BRAZ_PORT_esConfirmRename;
  3212.     esCannotAddDrv     :=  BRAZ_PORT_esCannotAddDrv;
  3213.     esNewFolder        :=  BRAZ_PORT_esNewFolder;
  3214.     esInvalidChars     :=  BRAZ_PORT_esInvalidChars;
  3215.     esNotFound         :=  BRAZ_PORT_esNotFound;
  3216.     esFilesIn          :=  BRAZ_PORT_esFilesIn;
  3217.     esFileOpFailed     :=  BRAZ_PORT_esFileOpFailed;
  3218.     esTreeSize         :=  BRAZ_PORT_esTreeSize;
  3219.     esAllSubDir        :=  BRAZ_PORT_esAllSubDir;
  3220.   end;  //873<
  3221. end;  //872
  3222.  
  3223. ///// End of TLsDirTree21 /////
  3224.  
  3225.  
  3226. { ======================== TLsDirTree21PopUp =========================== }
  3227.  
  3228. constructor TLsDirTree21PopUp.Create(AOwner: TComponent);
  3229. begin
  3230.   inherited Create(AOwner);
  3231.   //85 86>>
  3232.   Bmp1 := LoadImage(hInstance, 'NewFolder28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3233.   Bmp2 := LoadImage(hInstance, 'EditFolder28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3234.   Bmp3 := LoadImage(hInstance, 'DelFolder28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3235.   Bmp4 := LoadImage(hInstance, 'Cut28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3236.   Bmp5 := LoadImage(hInstance, 'Copy28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3237.   Bmp6 := LoadImage(hInstance, 'Paste28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3238.   Bmp7 := LoadImage(hInstance, 'TreeSize28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3239.   Bmp8 := LoadImage(hInstance, 'DirContents28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3240.   Bmp9 := LoadImage(hInstance, 'NetConnect28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3241.   Bmp10 := LoadImage(hInstance, 'NetDisConnect28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  3242. {$IFDEF D4_OR_HIGHER}
  3243.   Bmp11 := LoadImage(hInstance, 'Attributes28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);  //862
  3244. {$ENDIF}
  3245.   //85 86<<
  3246. end; {Create}
  3247.  
  3248. destructor TLsDirTree21PopUp.Destroy;
  3249. begin
  3250.   DeleteObject(Bmp1); //70
  3251.   DeleteObject(Bmp2); //70
  3252.   DeleteObject(Bmp3); //70
  3253.   DeleteObject(Bmp4); //86
  3254.   DeleteObject(Bmp5); //86
  3255.   DeleteObject(Bmp6); //86
  3256.   DeleteObject(Bmp7); //70
  3257.   DeleteObject(Bmp8);  //80
  3258.   DeleteObject(Bmp9);  //82
  3259.   DeleteObject(Bmp10); //82
  3260. {$IFDEF D4_OR_HIGHER}
  3261.   DeleteObject(Bmp11); //862
  3262. {$ENDIF}
  3263.   inherited Destroy;
  3264. end; {Destroy}
  3265.  
  3266. function TLsDirTree21PopUp.AddNewItem(const aCaption: string;
  3267.   aShortCut: TShortCut; aChecked, aEnabled: Boolean; aGroup: integer;
  3268.   aOnClick: TNotifyEvent; hCtx: word; const aName: string; aTag: integer;
  3269.   aBitMap: HBitmap): TMenuItem;  //70 //862
  3270. begin
  3271.   Result := TMenuItem.Create(nil);
  3272.   with result do
  3273.   begin
  3274.     Caption := aCaption;
  3275.     ShortCut := aShortCut;
  3276.     Checked := aChecked;
  3277.     Enabled := aEnabled;
  3278.     GroupIndex := aGroup;
  3279.     OnClick := aOnClick;
  3280.     Name := aName;
  3281.     Tag := aTag;  //862
  3282. {$IFDEF D4_OR_HIGHER}
  3283.     BITMAP.Handle := aBitmap;
  3284. {$ENDIF}
  3285.   end;
  3286. end; {AddNewItem}
  3287.  
  3288. procedure TLsDirTree21PopUp.SetDirTree(Value: TLsDirTree21);
  3289. begin
  3290.   FDirTree := Value;
  3291. end; {SetDirTree}
  3292.  
  3293. procedure TLsDirTree21PopUp.BuildItems; //70  //862>
  3294. begin
  3295.   //Set language-specific MenuItem captions
  3296.   if TvLangID = lnEnglish then  //872ln>
  3297.   begin
  3298.     TvItemID_0  :=  ENGLISH_TvItemID_0;  //'&New Folder';
  3299.     TvItemID_1  :=  ENGLISH_TvItemID_1;  //'&Rename Folder';
  3300.     TvItemID_2  :=  ENGLISH_TvItemID_2;  //'&Delete Folder';
  3301.     TvItemID_4  :=  ENGLISH_TvItemID_4;  //'Cu&t';
  3302.     TvItemID_5  :=  ENGLISH_TvItemID_5;  //'&Copy';
  3303.     TvItemID_6  :=  ENGLISH_TvItemID_6;  //'&Paste';
  3304.     TvItemID_8  :=  ENGLISH_TvItemID_8;  //'Tree &Size';
  3305.     TvItemID_9  :=  ENGLISH_TvItemID_9;  //'&Folder Contents';
  3306.     TvItemID_11 :=  ENGLISH_TvItemID_11; //'&Map Network Drive ...';
  3307.     TvItemID_12 :=  ENGLISH_TvItemID_12; //'Dis&Connect Network Drive';
  3308.     TvItemID_14 :=  ENGLISH_TvItemID_14; //'&Property';
  3309.   end
  3310.   else if TvLangID = lnFrench then
  3311.   begin
  3312.     TvItemID_0  :=  FRENCH_TvItemID_0;  //'&Nouveau Dossier';
  3313.     TvItemID_1  :=  FRENCH_TvItemID_1;  //'&Renommer le Dossier';
  3314.     TvItemID_2  :=  FRENCH_TvItemID_2;  //'&Effacer le Dossier';
  3315.     TvItemID_4  :=  FRENCH_TvItemID_4;  //'Cou&per';
  3316.     TvItemID_5  :=  FRENCH_TvItemID_5;  //'&Copier';
  3317.     TvItemID_6  :=  FRENCH_TvItemID_6;  //'Co&ller';
  3318.     TvItemID_8  :=  FRENCH_TvItemID_8;  //'Taille de l''&arborescence';
  3319.     TvItemID_9  :=  FRENCH_TvItemID_9;  //'&Contenu du Dossier';
  3320.     TvItemID_11 :=  FRENCH_TvItemID_11; //'&Connecter Lecteur RΘseau ...';
  3321.     TvItemID_12 :=  FRENCH_TvItemID_12; //'&DΘconnecter Lecteur RΘseau';
  3322.     TvItemID_14 :=  FRENCH_TvItemID_14; //'&PropriΘtΘs';
  3323.   end
  3324.   else if TvLangID = lnGerman then
  3325.   begin
  3326.     TvItemID_0  :=  GERMAN_TvItemID_0;  //'&Neuer Ordner';
  3327.     TvItemID_1  :=  GERMAN_TvItemID_1;  //'&Ordner umbenennen';
  3328.     TvItemID_2  :=  GERMAN_TvItemID_2;  //'Ordner &l÷schen';
  3329.     TvItemID_4  :=  GERMAN_TvItemID_4;  //'ausschnei&den';
  3330.     TvItemID_5  :=  GERMAN_TvItemID_5;  //'&kopieren';
  3331.     TvItemID_6  :=  GERMAN_TvItemID_6;  //'&einfⁿgen';
  3332.     TvItemID_8  :=  GERMAN_TvItemID_8;  //'Ordnergr÷▀e';
  3333.     TvItemID_9  :=  GERMAN_TvItemID_9;  //'&Ordner Inhalt';
  3334.     TvItemID_11 :=  GERMAN_TvItemID_11; //'Netzwerk &verbinden...';
  3335.     TvItemID_12 :=  GERMAN_TvItemID_12; //'Netzwerk &trennen';
  3336.     TvItemID_14 :=  GERMAN_TvItemID_14; //'Ei&genschaft';
  3337.   end
  3338.   else if TvLangID = lnSpanish then
  3339.   begin
  3340.     TvItemID_0  :=  SPANISH_TvItemID_0;  //'&Nueva carpeta';
  3341.     TvItemID_1  :=  SPANISH_TvItemID_1;  //'&Renombrar carpeta';
  3342.     TvItemID_2  :=  SPANISH_TvItemID_2;  //'&Borrar carpeta';
  3343.     TvItemID_4  :=  SPANISH_TvItemID_4;  //'Cor&tar';
  3344.     TvItemID_5  :=  SPANISH_TvItemID_5;  //'&Copiar';
  3345.     TvItemID_6  :=  SPANISH_TvItemID_6;  //'&Pegar';
  3346.     TvItemID_8  :=  SPANISH_TvItemID_8;  //'Ta&ma±o del ßrbol';
  3347.     TvItemID_9  :=  SPANISH_TvItemID_9;  //'C&ontenido de la carpeta';
  3348.     TvItemID_11 :=  SPANISH_TvItemID_11; //'Con&ectar unidad de red';
  3349.     TvItemID_12 :=  SPANISH_TvItemID_12; //'De&sconectar unidad de red';
  3350.     TvItemID_14 :=  SPANISH_TvItemID_14; //'&Propiedades';
  3351.   end //872ln
  3352.   else if TvLangID = lnPortuguese then  //873>
  3353.   begin
  3354.     TvItemID_0  :=  BRAZ_PORT_TvItemID_0;  //'&New Folder';
  3355.     TvItemID_1  :=  BRAZ_PORT_TvItemID_1;  //'&Rename Folder';
  3356.     TvItemID_2  :=  BRAZ_PORT_TvItemID_2;  //'&Delete Folder';
  3357.     TvItemID_4  :=  BRAZ_PORT_TvItemID_4;  //'Cu&t';
  3358.     TvItemID_5  :=  BRAZ_PORT_TvItemID_5;  //'&Copy';
  3359.     TvItemID_6  :=  BRAZ_PORT_TvItemID_6;  //'&Paste';
  3360.     TvItemID_8  :=  BRAZ_PORT_TvItemID_8;  //'Tree &Size';
  3361.     TvItemID_9  :=  BRAZ_PORT_TvItemID_9;  //'&Folder Contents';
  3362.     TvItemID_11 :=  BRAZ_PORT_TvItemID_11; //'&Map Network Drive ...';
  3363.     TvItemID_12 :=  BRAZ_PORT_TvItemID_12; //'Dis&Connect Network Drive';
  3364.     TvItemID_14 :=  BRAZ_PORT_TvItemID_14; //'&Property';
  3365.   end;  //873<
  3366.  
  3367.   //Build MenuItems
  3368.   Items.Add(AddNewItem(TvItemID_0, 0, False, True, 0,   //872ln>
  3369.     ItemOnClick, 0, 'AddNode', 1, Bmp1));     //Items[0]
  3370.   Items.Add(AddNewItem(TvItemID_1, 0, False, True, 0,
  3371.     ItemOnClick, 0, 'EditNode', 2, Bmp2));    //Items[1]
  3372.   Items.Add(AddNewItem(TvItemID_2, 0, False, True, 0,
  3373.     ItemOnClick, 0, 'DelNode', 3, Bmp3));     //Items[2]
  3374.   Items.Add(NewLine);
  3375.   //86 >>
  3376.   Items.Add(AddNewItem(TvItemID_4, 0, False, True, 0,
  3377.     ItemOnClick, 0, 'CutNode', 4, Bmp4));     //Items[4]
  3378.   Items.Add(AddNewItem(TvItemID_5, 0, False, True, 0,
  3379.     ItemOnClick, 0, 'CopyNode', 5, Bmp5));    //Items[5]
  3380.   Items.Add(AddNewItem(TvItemID_6, 0, False, True, 0,
  3381.     ItemOnClick, 0, 'PasteNode', 6, Bmp6));   //Items[6]
  3382.   Items.Add(NewLine);
  3383.   //86 <<
  3384.   Items.Add(AddNewItem(TvItemID_8, 0, False, True, 0,
  3385.     ItemOnClick, 0, 'GetTreeSize', 7, Bmp7)); //Items[8]
  3386.   Items.Add(AddNewItem(TvItemID_9, 0, False, True, 0,
  3387.     ItemOnClick, 0, 'ShowFolderContents', 8, Bmp8));  //Items[9]  //80
  3388.   Items.Add(NewLine);  //82
  3389.   Items.Add(AddNewItem(TvItemID_11, 0, False, True, 0,
  3390.     ItemOnClick, 0, 'ConnectNetResource', 9, Bmp9));  //Items[11]  //82
  3391.   Items.Add(AddNewItem(TvItemID_12, 0, False, True, 0,
  3392.     ItemOnClick, 0, 'DisConnectNetResource', 10, Bmp10)); //Items[12]  //82
  3393. {$IFDEF D4_OR_HIGHER}
  3394.   Items.Add(NewLine);  //862
  3395.   Items.Add(AddNewItem(TvItemID_14, 0, False, True, 0,
  3396.     ITemOnClick, 0, 'ItemProperty', 11, Bmp11)); //Items[14]  //862
  3397. {$ENDIF}  //872ln<
  3398. end; {BuildItems}
  3399.  
  3400. procedure TLsDirTree21PopUp.ItemOnClick(Sender: TObject);
  3401. var
  3402.   Node: TTreeNode;
  3403. begin
  3404.   if (TMenuItem(Sender).Name = '') or (TMenuItem(Sender).Tag = 0) then
  3405.     exit;
  3406.   with Sender as TMenuItem do  //862>>
  3407.   begin
  3408.     case Tag of
  3409.       1: FDirTree.AddNewNode(FDirTree.Selected, '');
  3410.       2: FDirTree.Selected.EditText;
  3411.       3: begin
  3412.            Node := FDirTree.Selected;
  3413.            if Assigned(Node) then
  3414.              FDirTree.DeleteNode(Node);
  3415.          end;
  3416.       4: FDirTree.CutOrCopyNode(2);
  3417.       5: FDirTree.CutOrCopyNode(0);
  3418.       6: FDirTree.PasteNode;
  3419.       7: FDirTree.GetTreeSize;
  3420.       8: FDirTree.SHowFolderContents;  //80
  3421.       9: FDirTree.ConnectNetResource(Sender); //82
  3422.       10: FDirTree.DisConnectNetResource(Sender); //82
  3423.      {$IFDEF D4_OR_HIGHER}
  3424.       11: FDirTree.ShowNodeProperties; //862
  3425.      {$ENDIF}
  3426.     end;  //case
  3427.   end;  //with ...
  3428. end; {ItemOnClick}
  3429.  
  3430. procedure TLsDirTree21PopUp.PopUp(X, Y: integer);
  3431. begin
  3432.   with FDirTree do
  3433.   begin
  3434.     Self.Items[0].Enabled := (Selected.Level > 0) and (Selected <> nil);
  3435.     Self.Items[1].Enabled := (Selected.Level > 1) and (Selected <> nil);
  3436.     Self.Items[2].Enabled := (Selected.Level > 1) and (Selected <> nil);
  3437.     //86 >>
  3438.     Self.Items[4].Enabled := (Selected.Level > 1) and (Selected <> nil);
  3439.     Self.Items[5].Enabled := (Selected.Level > 1) and (Selected <> nil);
  3440.     Self.Items[6].Enabled := (Selected.Level > 1) and (Selected <> nil)
  3441.       and (FisCutCopy = True) ;
  3442.     //86 <<
  3443.     Self.ITems[8].Enabled := (Selected.Level > 0) and (Selected <> nil);
  3444.     Self.ITems[9].Enabled := (Selected.Level > 0) and (Selected <> nil);  //80^
  3445. {$IFDEF D4_OR_HIGHER}
  3446.     Self.Items[14].Enabled := (Selected.Level > 0) and (Selected <> nil);  //862
  3447. {$ENDIF}
  3448.   end;
  3449.   inherited Popup(X + 10, Y + 10);
  3450. end; {PopUp}
  3451.  
  3452. ///// End of TLsDirTree21PopUp /////
  3453.  
  3454.  
  3455. {************************************************************************}
  3456. {                         LsFilelistView28                               }
  3457. {************************************************************************}
  3458.  
  3459. constructor TLsFilelistView28.Create(AOwner: TComponent);
  3460. begin
  3461.   inherited Create(AOwner);
  3462.   FSelectedFiles := TStringList.Create;
  3463.   MultiSelect := True;
  3464.   ReadOnly := False;
  3465.   SetDaTeFormat(df_Customize);  //(df_MMddyyyy); //81
  3466.   SetTimeFormat(tfShortFormat); //85
  3467.   HideSelection := False;
  3468.   SetParentDirEnabled(True);  //870
  3469.   Createimages;
  3470.  
  3471.   ViewStyle := vsReport;
  3472.   FMask := DefaultMask;
  3473.   FSortForward := True;
  3474.   FSortColumn := 0;
  3475.   OnCompare := CompareFiles;
  3476.   OnColumnClick := ColumnClick;
  3477.  
  3478.   Bmp_Up28 := LoadImage(hInstance, 'Bmp_Up28', IMAGE_BITMAP, 0, 0,
  3479.               LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS);  //873
  3480.   Bmp_Down28 := LoadImage(hInstance, 'Bmp_Down28', IMAGE_BITMAP, 0, 0,
  3481.               LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS); //873
  3482.   FBitmap := TBitmap.Create; //70
  3483.  
  3484.   FColWidth_Name := 165;  //80
  3485.   FColWidth_Size := 75;   //80
  3486.   FColWidth_Type := 95;   //80
  3487.   FColWidth_Mod  := 125;  //80
  3488.   FColWidth_Attr := 40;   //80
  3489.  
  3490.   ShowColumnHeaders := True;
  3491.   FShowFolders := True;
  3492.   FDblClickToOpen := True;
  3493.   FColumnClickEnabled := True;  //70
  3494.  
  3495.   SetLanguage(lnEnglish);  //872ln
  3496.   InitializeVar;  //872ln
  3497.  
  3498.   FPopupMenu := TLsFilelistView28PopUp.Create(Self);
  3499.   FPopupMenu.BuildItems;
  3500.   FPopupMenu.AutoPopup := True;
  3501.   FPopupMenu.FFileListView := Self;
  3502.   PopupMenu := FPopupMenu;
  3503.   FPopUpMenuEnabled := True;
  3504.   FFileType := [ftReadOnly, ftHidden, ftSystem, ftArchive];
  3505.   if FParentDirCaption = '' then
  3506.     FParentDirCaption := ' Parent';  //872
  3507.   FDirectory := 'Drives';
  3508.   FAbout := 'Version 2.8.7.3';  //861
  3509. end; {Create}
  3510.  
  3511. destructor TLsFilelistView28.Destroy;
  3512. begin
  3513. //  LargeImages.Free;  //870
  3514. //  SmallImages.Free;  //870
  3515.  
  3516.   LImgLst.Free;
  3517.   SImgLst.Free;
  3518.   FPopupMenu.Free;
  3519.   FSelectedFiles.Free;
  3520.   FBitMap.Free;
  3521.   DeleteObject(Bmp_Up28);
  3522.   DeleteObject(Bmp_Down28);
  3523.  
  3524.   inherited Destroy;
  3525. end; {Destroy}
  3526.  
  3527. procedure TLsFilelistView28.CreateWnd;
  3528. begin
  3529.   inherited CreateWnd;
  3530. //  Font.Size := 8;  //80
  3531. //  Font.Name := 'MS Sans Serif';  //80
  3532.   if not (csLoading in ComponentState) then
  3533.     CreateFileColumns;
  3534. end; {CreateWnd}
  3535.  
  3536. function TLsFilelistView28.GetDriveFreeSpace: Integer;  //872bcb
  3537. begin
  3538.   Result := GetFreeDiskSize(Copy(FDirectory, 1, 1) + ':\');
  3539. end; {GetDriveFreeSpace}
  3540.  
  3541. function TLsFilelistView28.GetSelectedNum: Integer;
  3542. begin
  3543.   Result := SelCount;
  3544.   if Result = 0 then Result := Items.Count;
  3545. end; {GetSelectedNum}
  3546.  
  3547. function TLsFilelistView28.GetSelectedSize: Integer;
  3548. var
  3549.   i, FSize: UInt;
  3550.   FName: string;
  3551.   win32FD: TWin32FindData;
  3552.   hFindFile: THandle;
  3553. begin
  3554.   Result := 0;
  3555.   FSize := 0;
  3556.   hFindFile := 0;
  3557.   if SelCount = 0 then exit;
  3558.   for i := 0 to Items.Count - 1 do
  3559.   begin
  3560.     if Items[i].selected then
  3561.     begin
  3562.       FName := ExtractFileName(Items[i].SubItems[4] + #0);
  3563.       hFindFile := FindFirstFile(pChar(FName), win32FD);
  3564.       if hFindFile <> INVALID_HANDLE_VALUE then
  3565.         FSize := FSize + ((win32FD.nFileSizeHigh * MAXDWORD) +
  3566.           win32FD.nFileSizeLow);
  3567.     end;
  3568.   end;
  3569.   Windows.FindClose(hFindFile);
  3570.   Result := FSize;
  3571. end; {GetSelectedSize}
  3572.  
  3573. function TLsFilelistView28.GetDirectory: string;
  3574. begin
  3575.   Result := FDirectory;
  3576. end; {GetDirectory}
  3577.  
  3578. procedure TLsFilelistView28.SetColWidth_Name(Value: Integer);  //80+
  3579. begin
  3580.   if Value <> FColWidth_Name then
  3581.     FColWidth_Name := Value;
  3582. end;  {SetColWidth_Name}
  3583.  
  3584. procedure TLsFilelistView28.SetColWidth_Size(Value: Integer);  //80+
  3585. begin
  3586.   if Value <> FColWidth_Size then
  3587.     FColWidth_Size := Value;
  3588. end;  {SetColWidth_Size}
  3589.  
  3590. procedure TLsFilelistView28.SetColWidth_Type(Value: Integer);  //80+
  3591. begin
  3592.   if Value <> FColWidth_Type then
  3593.     FColWidth_Type := Value;
  3594. end;  {SetColWidth_Type}
  3595.  
  3596. procedure TLsFilelistView28.SetColWidth_Mod(Value: Integer);  //80+
  3597. begin
  3598.   if Value <> FColWidth_Mod then
  3599.     FColWidth_Mod := Value;
  3600. end;  {SetColWidth_Mod}
  3601.  
  3602. procedure TLsFilelistView28.SetColWidth_Attr(Value: Integer);  //80+
  3603. begin
  3604.   if Value <> FColWidth_Attr then
  3605.     FColWidth_Attr := Value;
  3606. end;  {SetColWidth_Attr}
  3607.  
  3608. procedure TLsFilelistView28.SetDirectory(NewDir: string);
  3609. begin
  3610.   if AnsiCompareText(NewDir, FDirectory) = 0 then exit;
  3611.   if (UpperCase(NewDir) = 'DRIVES') then
  3612.   begin
  3613.     FDirectory := NewDir;
  3614.     UpdateFileList;
  3615.   end
  3616.   else
  3617.   begin
  3618.     if not DirectoryExists(NewDir) then exit;
  3619.     NewDir := AddSlash(NewDir);
  3620.     SetCurrentDir(NewDir);
  3621.     FDirectory := NewDir;
  3622.     UpdateFileList;
  3623.   end;
  3624. end; {SetDirectory}
  3625.  
  3626. procedure TLsFilelistView28.SetDirTreeCombo(val: TLsDirTreeCombo28);
  3627. begin
  3628.   if FDirTreeCombo = Val then
  3629.     exit
  3630.   else
  3631.   begin
  3632.     if Assigned(FDirTreeCombo) then
  3633.       FDirTreeCombo.FileList := nil;
  3634.     FDirTreeCombo := Val;
  3635.   end;
  3636.   if Assigned(FDirTreeCombo) then
  3637.     FDirTreeCombo.FileList := self;
  3638. end; {SetDirTreeCombo}
  3639.  
  3640. procedure TLsFilelistView28.SetDirTree(VaL: TLsDirTree21);
  3641. begin
  3642.   if FDirTree = Val then
  3643.     exit
  3644.   else
  3645.   begin
  3646.     if Assigned(FDirTree) then
  3647.       FDirTree.FileList := nil;
  3648.     FDirTree := Val;
  3649.   end;
  3650.   if Assigned(FDirTree) then
  3651.     FDirTree.FileList := self;
  3652. end; {SetDirTree}
  3653.  
  3654. procedure TLsFilelistView28.Notification(AComponent: TComponent;
  3655.   Operation: TOperation);
  3656. begin
  3657.   inherited Notification(AComponent, Operation);
  3658.   if (Operation = opRemove) and (AComponent = FDirTree) then
  3659.     FDirTree := nil;
  3660.   if (Operation = opRemove) and (AComponent = FDirTreeCombo) then
  3661.     FDirTreeCombo := nil;
  3662. end; {Notification}
  3663.  
  3664. procedure TLsFilelistView28.SetMask(const NewMasks: string);
  3665. begin
  3666.   if FMask <> NewMasks then
  3667.   begin
  3668.     FMask := NewMasks;
  3669.     UpdateFileList;
  3670.   end;
  3671. end; {SetMask}
  3672.  
  3673. function TLsFilelistView28.GetSelectedItem: string;
  3674. begin
  3675.   Result := FSelectedItem;
  3676. end; {GetSelectedItem}
  3677.  
  3678. procedure TLsFilelistView28.SetSelectedItem(NewItem: string);
  3679. begin
  3680.   if FSelectedItem = NewItem then exit;
  3681.   FSelectedItem := NewItem;
  3682. end; {SetSelectedItem}
  3683.  
  3684. procedure TLsFilelistView28.SetFileType(NewFileType: TFileType);
  3685. begin
  3686.   if NewFileType <> FFileType then
  3687.   begin
  3688.     FFileType := NewFileType;
  3689.     UpdateFileList;
  3690.   end;
  3691. end; {SetFileType}
  3692.  
  3693. procedure TLsFilelistView28.SetDaTeFormat(Value: TDtFormat); //70
  3694. var
  3695.   DefaultLCID: LCID;
  3696. begin
  3697.   if Value <> FDateFormat then
  3698.     FDateFormat := Value;
  3699.   DefaultLCID := GetThreadLocale;
  3700.   case FDateFormat of
  3701.     df_MMddyyyy: FDFormatStr := 'MM/dd/yyyy';
  3702.     df_MMddyy: FDFormatStr := 'MM/dd/yy';
  3703.     df_ddMMyyyy: FDFormatStr := 'dd/MM/yyyy';
  3704.     df_ddMMyy_GB: FDFormatStr := 'dd/MM/yy';
  3705.     df_ddMMyy_DE: FDFormatStr := 'dd.MM.yy';
  3706.     df_ddMMyy_IT: FDFormatStr := 'dd-MM-yy';
  3707.     df_yyyyMMdd: FDFormatStr := 'yyyy-MM-dd';
  3708.     df_yyMMdd: FDFormatStr := 'yy-MM-dd';
  3709.     df_Customize: FDFormatStr :=
  3710.       GetLocaleStr(DefaultLCID, LOCALE_SSHORTDATE, '');
  3711.   end;
  3712. end; {SetDaTeFormat}
  3713.  
  3714. procedure TLsFileListView28.SetTimeFormat(Value: TTmFormat);  //85 >>
  3715. var
  3716.   DeFaultLCID: LCID;
  3717.   i: integer;
  3718. begin
  3719.   if Value <> FTimeFormat then
  3720.     FTimeFormat := Value;
  3721.   case FTimeFormat of
  3722.     tfLongFormat :  FTFormatStr := LongTimeFormat;
  3723.     tfShortFormat:  FTFormatStr := ShortTimeFormat;
  3724.     tfCustomize  :
  3725.       begin
  3726.         DefaultLCID := GetThreadLocale;
  3727.         FTFormatStr := '';
  3728.         FTFormatStr := GetLocaleStr(DefaultLCID, LOCALE_STIMEFORMAT, '');
  3729.         i := Pos('t', FTFormatStr);
  3730.         if i > 0 then
  3731.           FTFormatStr := Copy(FTFormatStr, 1, i -1 );
  3732.         FTFormatStr := FTFormatStr + ' AM/PM';
  3733. //        ShowMessage(FTFormatStr);  //
  3734.       end;
  3735.   end;
  3736. end; {SetTFormatStr}  //85 <<
  3737.  
  3738. procedure TLsFilelistView28.SetShowFolders(Value: Boolean);
  3739. begin
  3740.   if FShowFolders = Value then
  3741.     exit;
  3742.   FShowFolders := Value;
  3743.   UpdateFileList;
  3744. end; {SetShowFolders}
  3745.  
  3746. procedure TLsFilelistView28.SetHideFileExt(Value: Boolean);
  3747. begin
  3748.   if Value <> FHideFileExt then
  3749.     FHideFileExt := Value;
  3750. end; {SetHideFileExt}
  3751.  
  3752. procedure TLsFileListView28.SetParentDirEnabled(Value: Boolean);  //870 >>
  3753. begin
  3754.   if Value <> FParentDirEnabled then
  3755.     FParentDirEnabled := Value;
  3756. end;  {SetParentDirEnabled}  //870 <<
  3757.  
  3758. procedure TLsFilelistView28.SetParentDirCaption(Value: string);  //872
  3759. begin
  3760.   Value := Trim(Value);
  3761.   if ansiCompareText(Value, Trim(FParentDirCaption)) <> 0 then
  3762.     FParentDirCaption := ' ' + Value;
  3763. end;  {SetParentDirCaption}  //872
  3764.  
  3765. procedure TLsFilelistView28.SetLanguage(Value: TLanguage);  //872ln
  3766. var
  3767.   LangID: integer;
  3768. begin
  3769.   if Value = lnSysDefault then
  3770.   begin
  3771.     LangID := GetSystemDefaultLangID and $3FF; //SysLocale.PriLangID;
  3772.     // ShowMessage(IntToStr(LangID));  //debugging
  3773.     Case LangID of
  3774.       LANG_ENGLISH      : Value := lnEnglish;     //$09
  3775.       LANG_FRENCH       : Value := lnFrench;      //$0C
  3776.       LANG_GERMAN       : Value := lnGerman;      //$07
  3777.       LANG_SPANISH      : Value := lnSpanish;     //$0A
  3778.       LANG_PORTUGUESE   : Value := lnPortuguese;  //$16  //873
  3779.     else
  3780.       Value := lnEnglish;
  3781.     end;
  3782.   end;
  3783.   if value <> FLanguage then
  3784.   begin
  3785.     FLanguage := Value;
  3786.     LvLangID := FLanguage;
  3787.     InitializeVar;
  3788.     FPopupMenu.Free;
  3789.     Application.ProcessMessages;
  3790.     FPopupMenu := TLsFilelistView28PopUp.Create(Self);
  3791.     FPopupMenu.BuildItems;
  3792.     FPopupMenu.AutoPopup := True;
  3793.     FPopupMenu.FFileListView := Self;
  3794.     PopupMenu := FPopupMenu;
  3795.     FPopUpMenuEnabled := True;
  3796.     ReCreateWnd;
  3797.   end;
  3798. end;  //872ln
  3799.  
  3800.  
  3801. procedure TLsFilelistView28.Createimages;
  3802. var
  3803.   sfi: TSHFileInfo;
  3804.   Reg: TRegistry;  //872
  3805.  
  3806.   procedure LoadParentBmp;  //872>
  3807.   begin
  3808.     LImgLst.ResInstLoad(hInstance, rtBitmap, 'Parent_L282', clNone);
  3809.     SImgLst.ResInstLoad(hInstance, rtBitmap, 'Parent_S282', clNone);
  3810.     ParentImgIdx := LImgLst.Count - 1;
  3811.   end;  //872<
  3812.  
  3813.   function CompareBmps(Idx: integer): Boolean;  //872>
  3814.   var
  3815.     Bmp1, Bmp2: TBitmap;
  3816.     Ms1, Ms2: TMemoryStream;
  3817.     Idx2: integer;
  3818.   begin
  3819.     Result := False;
  3820.     Idx2 := -1;
  3821.     Bmp1 := TBitmap.Create;
  3822.     Bmp2 := TBitmap.Create;
  3823.     Ms1 := TMemoryStream.Create;
  3824.     Ms2 := TMemoryStream.Create;
  3825.     try
  3826.       LImgLst.GetBitmap(Idx, Bmp1);
  3827.       LImgLst.ResInstLoad(hInstance, rtBitmap, 'Parent_L282', clNone);
  3828.       Idx2 := LImgLst.Count - 1;
  3829.       LImgLst.GetBitmap(Idx2, Bmp2);
  3830.       Bmp1.SaveToStream(Ms1);
  3831.       Bmp2.SaveToStream(Ms2);
  3832.       if Ms1.Size = Ms2.Size then
  3833.         Result := CompareMem(Ms1.Memory, Ms2.Memory, Ms1.Size);
  3834.     finally
  3835.       LImgLst.Delete(Idx2);
  3836.       Bmp1.Free;
  3837.       Bmp2.Free;
  3838.       Ms1.Free;
  3839.       Ms2.Free;
  3840.     end;
  3841.   end;  //872<
  3842.  
  3843. begin   //862>
  3844.   ParentImgIdx := -1;
  3845.   LImgLst := TImageList.Create(Self);
  3846.   LImgLst.Handle := SHGetFileInfo('', 0, sfi, SizeOf(TSHFileInfo),
  3847.       SHGFI_SYSICONINDEX or SHGFI_LARGEICON);  //or SHGFI_SHELLICONSIZE);  //871
  3848.   if LImgLst.Handle <> 0 then
  3849.     LImgLst.ShareImages := True;
  3850.  
  3851.   SImgLst := TImageList.Create(Self);
  3852.   SImgLst.Handle := SHGetFileInfo('', 0, sfi, SizeOf(TSHFileInfo),
  3853.       SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  3854.   if SImgLst.Handle <> 0 then
  3855.     SImgLst.ShareImages := True;
  3856.   //872>
  3857.   Reg := TRegistry.Create;
  3858.   try
  3859.     Reg.Rootkey := HKEY_CURRENT_USER;
  3860.     Reg.OpenKey(LsFileExplorerKey, True);
  3861.     try
  3862.       case  Reg.ValueExists('ParentImgIdx') of
  3863.         True:
  3864.           begin
  3865.             ParentImgIdx := Reg.ReadInteger('ParentImgIdx');
  3866.             if (CompareBmps(ParentImgIdx) = False) or
  3867.                (ParentImgIdx > LImgLst.Count - 1) then
  3868.             begin
  3869.               LoadParentBmp;
  3870.               Reg.WriteInteger('ParentImgIdx', ParentImgIdx);
  3871.             end;
  3872.           end;
  3873.         False:
  3874.           begin
  3875.             LoadParentBmp;
  3876.             Reg.WriteInteger('ParentImgIdx', ParentImgIdx);
  3877.           end;
  3878.       end;  //case
  3879.     finally
  3880.       Reg.CloseKey;
  3881.     end;
  3882.   finally
  3883.     Reg.Free;
  3884.   end;  //872<
  3885.   LargeImages := LImgLst;
  3886.   SmallImages := SImgLst;
  3887. end; {CreateImages}
  3888.  
  3889. procedure TLsFilelistView28.CreateDriveColumns;
  3890. var
  3891.   i: integer;
  3892. begin
  3893.   //872ln>
  3894.   Columns.Clear;
  3895.   Columns.BeginUpdate;
  3896.   for i := 0 to 4 do
  3897.     Columns.Add;
  3898.   //Caption
  3899.   if FLanguage = lnEnglish then
  3900.   begin
  3901.     Columns[0].Caption := ENGLISH_ColIdName;
  3902.     Columns[1].Caption := ENGLISH_ColIdType;
  3903.     Columns[2].Caption := ENGLISH_ColIdHdSize;
  3904.     Columns[3].Caption := ENGLISH_ColIdFSpace;
  3905.     Columns[4].Caption := ENGLISH_ColIdAttr;
  3906.   end
  3907.   else if FLanguage = lnFrench then
  3908.   begin
  3909.     Columns[0].Caption := FRENCH_ColIdName;
  3910.     Columns[1].Caption := FRENCH_ColIdType;
  3911.     Columns[2].Caption := FRENCH_ColIdHdSize;
  3912.     Columns[3].Caption := FRENCH_ColIdFSpace;
  3913.     Columns[4].Caption := FRENCH_ColIdAttr;
  3914.   end
  3915.   else if FLanguage = lnGerman then
  3916.   begin
  3917.     Columns[0].Caption := GERMAN_ColIdName;
  3918.     Columns[1].Caption := GERMAN_ColIdType;
  3919.     Columns[2].Caption := GERMAN_ColIdHdSize;
  3920.     Columns[3].Caption := GERMAN_ColIdFSpace;
  3921.     Columns[4].Caption := GERMAN_ColIdAttr;
  3922.   end
  3923.   else if FLanguage = lnSpanish then
  3924.   begin
  3925.     Columns[0].Caption := SPANISH_ColIdName;
  3926.     Columns[1].Caption := SPANISH_ColIdType;
  3927.     Columns[2].Caption := SPANISH_ColIdHdSize;
  3928.     Columns[3].Caption := SPANISH_ColIdFSpace;
  3929.     Columns[4].Caption := SPANISH_ColIdAttr;
  3930.   end
  3931.   else if FLanguage = lnPortuguese then  //873
  3932.   begin
  3933.     Columns[0].Caption := BRAZ_PORT_ColIdName;
  3934.     Columns[1].Caption := BRAZ_PORT_ColIdType;
  3935.     Columns[2].Caption := BRAZ_PORT_ColIdHdSize;
  3936.     Columns[3].Caption := BRAZ_PORT_ColIdFSpace;
  3937.     Columns[4].Caption := BRAZ_PORT_ColIdAttr;
  3938.   end;  //873
  3939.   //Width
  3940.   Columns[0].Width := 160;
  3941.   Columns[1].Width := 110;
  3942.   Columns[2].Width := 90;
  3943.   Columns[3].Width := 90;
  3944.   Columns[4].Width := 40;
  3945.   //Alignment
  3946.   Columns[0].Alignment := taLeftJustify;
  3947.   Columns[1].Alignment := taLeftJustify;
  3948.   Columns[2].Alignment := taRightJustify;
  3949.   Columns[3].Alignment := taRightJustify;
  3950.   Columns[4].Alignment := taLeftJustify;
  3951.   Columns.EndUpdate;
  3952.   FileColExists := False;  //872ln
  3953. end; {CreateDriveColumns}
  3954.  
  3955. procedure TLsFilelistView28.CreateFileColumns;
  3956. var
  3957.   i: integer;
  3958. begin
  3959.   //872ln>
  3960.   Columns.Clear;
  3961.   Columns.BeginUpdate;
  3962.   for i := 0 to 4 do
  3963.     Columns.Add;
  3964.   //Caption
  3965.   if FLanguage = lnEnglish then
  3966.   begin
  3967.     Columns[0].Caption := ENGLISH_ColIDName;
  3968.     Columns[1].Caption := ENGLISH_ColIDSize;
  3969.     Columns[2].Caption := ENGLISH_ColIDType;
  3970.     Columns[3].Caption := ENGLISH_ColIDDate;
  3971.     Columns[4].Caption := ENGLISH_ColIDAttr;
  3972.   end
  3973.   else if FLanguage = lnFrench then
  3974.   begin
  3975.     Columns[0].Caption := FRENCH_ColIDName;
  3976.     Columns[1].Caption := FRENCH_ColIDSize;
  3977.     Columns[2].Caption := FRENCH_ColIDType;
  3978.     Columns[3].Caption := FRENCH_ColIDDate;
  3979.     Columns[4].Caption := FRENCH_ColIDAttr;
  3980.   end
  3981.   else if FLanguage = lnGerman then
  3982.   begin
  3983.     Columns[0].Caption := GERMAN_ColIDName;
  3984.     Columns[1].Caption := GERMAN_ColIDSize;
  3985.     Columns[2].Caption := GERMAN_ColIDType;
  3986.     Columns[3].Caption := GERMAN_ColIDDate;
  3987.     Columns[4].Caption := GERMAN_ColIDAttr;
  3988.   end
  3989.   else if FLanguage = lnSpanish then
  3990.   begin
  3991.     Columns[0].Caption := SPANISH_ColIDName;
  3992.     Columns[1].Caption := SPANISH_ColIDSize;
  3993.     Columns[2].Caption := SPANISH_ColIDType;
  3994.     Columns[3].Caption := SPANISH_ColIDDate;
  3995.     Columns[4].Caption := SPANISH_ColIDAttr;
  3996.   end
  3997.   else if FLanguage = lnPortuguese then   //873>
  3998.   begin
  3999.     Columns[0].Caption := BRAZ_PORT_ColIDName;
  4000.     Columns[1].Caption := BRAZ_PORT_ColIDSize;
  4001.     Columns[2].Caption := BRAZ_PORT_ColIDType;
  4002.     Columns[3].Caption := BRAZ_PORT_ColIDDate;
  4003.     Columns[4].Caption := BRAZ_PORT_ColIDAttr; //873<
  4004.   end;
  4005.   //Width
  4006.   Columns[0].Width := FColWidth_Name;
  4007.   Columns[1].Width := FColWidth_Size;
  4008.   Columns[2].Width := FColWidth_Type;
  4009.   Columns[3].Width := FColWidth_Mod;
  4010.   Columns[4].Width := FColWidth_Attr;
  4011.   //Alignment
  4012.   Columns[0].Alignment := taLeftJustify;
  4013.   Columns[1].Alignment := taRightJustify;
  4014.   Columns[2].Alignment := taLeftJustify;
  4015.   Columns[3].Alignment := taLeftJustify;
  4016.   Columns[4].Alignment := taLeftJustify;
  4017.   Columns.EndUpdate;
  4018.   FileColExists := True;  //872ln<
  4019. end; {CreateFileColumns}
  4020.  
  4021. procedure TLsFilelistView28.ColumnClick(Sender: TObject;
  4022.   Column: TListColumn);
  4023. var
  4024.   required_column: integer;
  4025.  
  4026.   procedure SetColumnBitmap; //70
  4027.   var
  4028.     Hditem: THdItem;
  4029.     i: Integer;
  4030.   begin
  4031.     for i := 0 to Columns.Count - 1 do
  4032.     begin
  4033.       FBitmap.Releasehandle;
  4034.       Hditem.Mask := HDI_FORMAT;
  4035.       Header_GetItem(GetDlgItem(Self.Handle, 0), i, Hditem);
  4036.       Hditem.Mask := HDI_BITMAP or HDI_FORMAT;
  4037.  
  4038.       if i = Required_Column then
  4039.       begin
  4040.         if FSortForward then
  4041.           FBitmap.Handle := Bmp_Down28  //Bmp_Up28
  4042.         else
  4043.           FBitmap.Handle := Bmp_Up28;  //Bmp_Down28;
  4044.         Hditem.fmt := Hditem.fmt or HDF_BITMAP
  4045.           {$IFDEF D4_OR_HIGHER} or HDF_BITMAP_ON_RIGHT{$ENDIF};
  4046.       end
  4047.       else begin
  4048.         FBitmap.Handle := Bmp_Down28;  //Bmp_Up28;
  4049.         Hditem.fmt := Hditem.fmt and not (HDF_BITMAP
  4050.           {$IFDEF D4_OR_HIGHER} or HDF_BITMAP_ON_RIGHT{$ENDIF});
  4051.       end;
  4052.       Hditem.hbm := FBitmap.Handle;
  4053.       Header_SetItem(GetDlgItem(Self.Handle, 0), i, hditem);
  4054.     end;
  4055.   end; {SetColumnBitmap}
  4056.  
  4057. begin
  4058.   if not FColumnClickEnabled then exit;  //70
  4059.   required_column := Column.Index;
  4060.   if required_column = FSortColumn then
  4061.     FSortForward := not FSortForward
  4062.   else
  4063.   begin
  4064.     FSortColumn := required_column;
  4065.     FSortForward := True;
  4066.   end;
  4067.   SortType := stData;
  4068.   SortType := stNone;
  4069.   SetColumnBitmap; //70
  4070. end; {ColumnClick}
  4071.  
  4072. procedure TLsFilelistView28.CompareFiles(Sender: TObject; Item1,
  4073.   Item2: TListItem; Data: Integer; var Compare: Integer);
  4074. var
  4075.   Caption1,
  4076.     Caption2,
  4077.     str1,
  4078.     str2: string;   //80
  4079.   size1,
  4080.     size2,
  4081.     i,              //80
  4082.     result: integer;
  4083. {$IFDEF D4_OR_HIGHER}
  4084.   date1,
  4085.     date2: Double;  //861
  4086. {$ELSE}
  4087.   date1,
  4088.     date2: TDateTime;  //861
  4089. {$ENDIF}
  4090.   TopItem: Boolean;
  4091.  
  4092. begin
  4093.   Result := 0;
  4094.   // To force Directories to be displayed before Files and to keep
  4095.   // "Parent Folder" at the top regardless sorting directions.
  4096.   //  if (Item1.Caption = ' Parent') or (Item2.Caption = ' Parent') then  //81
  4097.   if (Item1.Caption = FParentDirCaption) or (Item2.Caption = FParentDirCaption) then  //872
  4098.     TopItem := True    //80
  4099.   else
  4100.     TopItem := False;  //80
  4101.  
  4102.   if (Item1.SubItems[5] = 'dir') and (Item2.SubItems[5] <> 'dir') then
  4103.     Result := -1
  4104.   else if (Item1.SubItems[5] <> 'dir') and (Item2.SubItems[5] = 'dir') then
  4105.     Result := 1
  4106.   // Compare files
  4107.   else
  4108.   begin
  4109.     Case FSortColumn of
  4110.     // sort on file name
  4111.     0: begin
  4112.          Caption1 := AnsiUpperCase(Item1.Caption);
  4113.          Caption2 := AnsiUpperCase(Item2.Caption);
  4114.          if Caption1 > Caption2 then
  4115.            Result := 1
  4116.          else if Caption1 < Caption2 then
  4117.            Result := -1;
  4118.        end;
  4119.     // sort on file size
  4120.     1: begin
  4121.          // Convert space to integer and eleminate word 'KB'
  4122.          //80 >>
  4123.          str1 := Item1.SubItems.Strings[0];
  4124.          if str1 = ' ' then
  4125.            size1 := 0
  4126.          else
  4127.          begin
  4128.            i := Pos('K', str1);
  4129.            str1 := copy(str1, 1, i-2);
  4130.            size1 := StrToInt(Trim(str1));
  4131.          end;
  4132.          str2 := Item2.SubItems.Strings[0];
  4133.          if str2 = ' ' then
  4134.            size2 := 0
  4135.          else
  4136.          begin
  4137.            i := Pos('K', str2);
  4138.            str2 := copy(str2, 1, i-2);
  4139.            size2 := StrToInt(Trim(str2));
  4140.          end;
  4141.          //80 <<
  4142.  
  4143.          if Size1 > Size2 then
  4144.            Result := 1
  4145.          else if Size1 < Size2 then
  4146.            Result := -1;
  4147.        end;
  4148.     // sort on files' modified date
  4149.     3: begin
  4150. //       date1 := StrToDateTime(Item1.SubItems.Strings[2]);  //861>>
  4151. //       date2 := StrToDateTime(Item2.SubItems.Strings[2]);
  4152. //       result := Round(1E5 * (date1 - date2));             //861<<
  4153.          if Item1 = Item2 then Result := 0   //861>>
  4154.          else if Item1 = nil then Result := -1
  4155.          else if Item2 = nil then Result := 1
  4156.          else begin
  4157.          {$IFDEF D4_OR_HIGHER}
  4158.            date1 := StrToFloat(Item1.SubItems[6]);
  4159.            date2 := StrToFloat(Item2.SubItems[6]);
  4160.          {$ELSE}
  4161.            date1 := StrToDateTime(Item1.SubItems[6]);
  4162.            date2 := StrToDateTime(Item2.SubItems[6]);
  4163.          {$ENDIF}
  4164.            if date1 < date2 then
  4165.              Result := -1
  4166.            else if date1 > date2 then
  4167.              Result := 1
  4168.            else Result := 0;  //861<<
  4169.          end;
  4170.        end;
  4171.        else begin
  4172.          result := CompareText(Item1.SubItems.Strings[FSortColumn - 1],
  4173.            Item2.SubItems.Strings[FSortColumn - 1]);
  4174.        end;
  4175.     end;  //case
  4176.   end; //else
  4177.   if FSortForward then
  4178.     if TopItem then       //80+
  4179.       Compare := result   //80+
  4180.     else                  //80+
  4181.       Compare := -result
  4182.   else begin
  4183.     Compare := result;
  4184.   end;
  4185. end; {CompareFiles}
  4186.  
  4187. procedure TLsFilelistView28.Keydown(var Key: Word; Shift: TShiftState);
  4188. var
  4189.   i: integer;  //84
  4190. begin
  4191.   if Shift = [ssCtrl] then
  4192.   begin
  4193.     case Key of
  4194.       $43:
  4195.         if Selected <> nil then CutCopy(0);      //(VK_C)Copy
  4196.       $58:
  4197.         if Selected <> nil then CutCopy(2);      //(VK_X)Cut
  4198.       $56:
  4199.         if FSelectedFiles.Count <> 0 then Paste; //(VK_V)Paste
  4200.       $4F:
  4201.         if Selected <> nil then OpenItem;        //(VK_O)OpenItem
  4202.       $46:
  4203.         if Selected <> nil then ViewFile;        //(VK_F)View file
  4204.       $4E:
  4205.         if AnsiCompareText(FDirectory, 'DRIVES') <> 0 then
  4206.           NewFolder;                             //(VK_N)New Folder
  4207.       $41:                                       //(VK_A)Select All  //84
  4208.         begin
  4209.           if Items.Count <> 0 then
  4210.           begin
  4211.             for i := 0 to Items.Count -1 do
  4212.               Items[i].Selected := True;
  4213.           end;
  4214.         end;
  4215.     end;
  4216.   end
  4217.   else if (Shift = []) and (not isEditing) then
  4218.   begin
  4219.     case Key of
  4220. //      VK_UP: Click;                            //UpArrow    //84
  4221. //      VK_DOWN: Click;                          //DownArrow  //84
  4222.       VK_DELETE:
  4223.         if Selected <> nil then DeleteItems;     //Delete File
  4224.       VK_RETURN:
  4225.         if Selected <> nil then OpenItem;        //Open
  4226.       VK_BACK: OneLevelUp;                       //Previous Directory
  4227.       VK_F2:
  4228.         if Selected <> nil then RenameFile;      //ReName File
  4229.       VK_F3: FindFile;
  4230.       VK_F5: UpdateFileList;                     //Refresh
  4231.  
  4232.       VK_F4:                                     //Display TreeView
  4233.         begin
  4234.           if not Assigned(DirTreeCombo) then exit;
  4235.           DirTreeCombo.BtnClick(Self);
  4236.           if DirTreeCombo.Tree.Visible then
  4237.             DirTreeCombo.Tree.SetFocus;
  4238.         end;
  4239.       VK_ESCAPE:                                 //52 Close TreeView
  4240.         begin
  4241.           if not Assigned(DirTreeCombo) then exit;
  4242.           if DirTreeCombo.Tree.Enabled = True then
  4243.           begin
  4244.             DirTreeCombo.Tree.Enabled := False;
  4245.             DirTreeCombo.Tree.Visible := False;
  4246.             DirTreeCombo.SendToBack;
  4247.           end;
  4248.         end;
  4249.     end; // case
  4250.   end; // else
  4251.   inherited KeyDown(Key, Shift);
  4252. end; {KeyDown}
  4253.  
  4254. procedure TLsFilelistView28.KeyUp(var Key: Word; Shift: TShiftState);  //84
  4255. begin
  4256.   Inherited KeyUp(Key, Shift);
  4257.   if (Key = VK_UP) or (Key = VK_DOWN) then  Click;
  4258. end;  {KeyUp}
  4259.  
  4260. function TLsFileListView28.GetWkgMask(var MaskStr: string): string; //84
  4261. var
  4262.   SepPos: integer;
  4263. begin
  4264.   SepPos := Pos(';', MaskStr);
  4265.   if SepPos = 0 then
  4266.     Result := MaskStr
  4267.   else
  4268.     Result := Copy(MaskStr, 1, SepPos - 1);
  4269.   System.Delete(MaskStr, 1, (Length(Result) + 1));
  4270. end;  {GetWkgMask}
  4271.  
  4272. procedure TLsFilelistView28.UpdateFileList;
  4273. var
  4274.   oldCur: TCursor;
  4275. //  MaskPtr: PChar;  //84
  4276.   TmpMask,
  4277.     WkgMask: string;  //84
  4278.   AttrIndex: TFileAttr;
  4279. //  Ptr: PChar;  //84
  4280.   DirAttr,
  4281.     FileAttr: DWORD;
  4282.   FName,
  4283.     CurPath: string;
  4284. const
  4285.   dwFileAttr: array[TFileAttr] of DWord = (FILE_ATTRIBUTE_READONLY,
  4286.     FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_SYSTEM,
  4287.     FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_NORMAL);
  4288. begin
  4289.   Items.beginUpdate;
  4290.   Items.Clear;
  4291.   OldCur := Screen.Cursor;
  4292.   Screen.Cursor := crHourGlass;
  4293.   FDirectorySize := 0;
  4294.   try
  4295.   // Add Drives to LsFilelistView28
  4296.     if UpperCase(FDirectory) = 'DRIVES' then
  4297.     begin
  4298.       CreateDriveColumns;
  4299.       AddDrives;
  4300.     end
  4301.     else begin
  4302.     // Add directories to LsFilelistView28
  4303.       if not FileColExists then
  4304.         CreateFileColumns;   //872
  4305.       FileAttr := 0;
  4306.       for AttrIndex := ftReadOnly to ftNormal do
  4307.         if AttrIndex in FileType then
  4308.           FileAttr := FileAttr or dwFileAttr[AttrIndex];
  4309.       DirAttr := FileAttr or FILE_ATTRIBUTE_DIRECTORY;
  4310.       CurPath := AddSlash(FDirectory);
  4311.       FName := CurPath + '*.*';
  4312.  
  4313.       if ShowFolders then
  4314.         AddFiles(FName, DirAttr);
  4315.  
  4316.       ////84 >>
  4317.       TmpMask := FMask;
  4318.       While (Length(TmpMask) > 0) and (TmpMask[1] = ' ') do
  4319.         System.Delete(TmpMask, 1, 1);
  4320.       While (Length(TmpMask) > 0) and (TmpMask[Length(TmpMask)] = ' ') do
  4321.         System.Delete(TmpMask, Length(TmpMask), 1);
  4322.       if Length(TmpMask) =  0 then
  4323.         TmpMask := '*.*';
  4324.  
  4325.       While Length(TmpMask) > 0 do
  4326.       begin
  4327.         WkgMask := GetWkgMask(TmpMask);
  4328.         AddFiles((CurPath + WkgMask), FileAttr);
  4329.       end;
  4330.       {**
  4331.       // Add files to LsFilelistView28
  4332.       MaskPtr := PChar(FMask);
  4333.       while MaskPtr <> nil do
  4334.       begin
  4335.         Ptr := StrScan(MaskPtr, ';');
  4336.         if Ptr <> nil then
  4337.           Ptr^ := #0;
  4338.         AddFiles((CurPath + StrPas(MaskPtr)), FileAttr);
  4339.         if Ptr <> nil then
  4340.         begin
  4341.           Ptr^ := ';';
  4342.           inc(Ptr);
  4343.         end;
  4344.         MaskPtr := Ptr;
  4345.       end; // while MaskPtr ...
  4346.       **}
  4347.       ////84 <<
  4348.     end; // else  FDirectory <> 'Drives'
  4349.   finally
  4350.     FSortForward := True;
  4351.     ColumnClick(Self, Columns[0]);
  4352.   end; // try
  4353.   Items.EndUpdate;
  4354.   Screen.Cursor := oldCur;
  4355.   if (Items.Count > 0) and (SelCount = 0) then
  4356.     ItemFocused := Items[0];
  4357.   Application.ProcessMessages;
  4358. end; {UpdateFileList}
  4359.  
  4360. procedure TLsFilelistView28.AddDrives;
  4361. var
  4362.   sfi: TSHFileInfo;
  4363.   NewItem: TListItem;
  4364.   i: Integer;
  4365.   DiskType: Integer;
  4366.   DiskSize,
  4367.     FreeSize: Integer;
  4368.   Drv: Char;
  4369.   DrvName: string;
  4370.  
  4371.   function GetDriveTypeStr(Root: string): string;
  4372.   var
  4373.     DrvType: Integer;
  4374.   begin
  4375.     if LvLangID = lnEnglish then  //872ln>
  4376.     begin
  4377.       DrvTypeStr0 :=  ENGLISH_DrvTypeStr0;   //Unknown
  4378.       DrvTypeStr1 :=  ENGLISH_DrvTypeStr1;   //Not exist
  4379.       DrvTypeStr2 :=  ENGLISH_DrvTypeStr2;   //Removable Disk
  4380.       DrvTypeStr3 :=  ENGLISH_DrvTypeStr3;   //Fixed Disk
  4381.       DrvTypeStr4 :=  ENGLISH_DrvTypeStr4;   //Network Disk
  4382.       DrvTypeStr5 :=  ENGLISH_DrvTypeStr5;   //CD-Rom Disk
  4383.       DrvTypeStr6 :=  ENGLISH_DrvTypeStr6;   //RAM Disk
  4384.     end
  4385.     else if LvLangID = lnFrench then
  4386.     begin
  4387.       DrvTypeStr0 :=  FRENCH_DrvTypeStr0;
  4388.       DrvTypeStr1 :=  FRENCH_DrvTypeStr1;
  4389.       DrvTypeStr2 :=  FRENCH_DrvTypeStr2;
  4390.       DrvTypeStr3 :=  FRENCH_DrvTypeStr3;
  4391.       DrvTypeStr4 :=  FRENCH_DrvTypeStr4;
  4392.       DrvTypeStr5 :=  FRENCH_DrvTypeStr5;
  4393.       DrvTypeStr6 :=  FRENCH_DrvTypeStr6;
  4394.     end
  4395.     else if LvLangID = lnGerman then
  4396.     begin
  4397.       DrvTypeStr0 :=  GERMAN_DrvTypeStr0;
  4398.       DrvTypeStr1 :=  GERMAN_DrvTypeStr1;
  4399.       DrvTypeStr2 :=  GERMAN_DrvTypeStr2;
  4400.       DrvTypeStr3 :=  GERMAN_DrvTypeStr3;
  4401.       DrvTypeStr4 :=  GERMAN_DrvTypeStr4;
  4402.       DrvTypeStr5 :=  GERMAN_DrvTypeStr5;
  4403.       DrvTypeStr6 :=  GERMAN_DrvTypeStr6;
  4404.     end
  4405.     else if LvLangID = lnSpanish then
  4406.     begin
  4407.       DrvTypeStr0 :=  SPANISH_DrvTypeStr0;
  4408.       DrvTypeStr1 :=  SPANISH_DrvTypeStr1;
  4409.       DrvTypeStr2 :=  SPANISH_DrvTypeStr2;
  4410.       DrvTypeStr3 :=  SPANISH_DrvTypeStr3;
  4411.       DrvTypeStr4 :=  SPANISH_DrvTypeStr4;
  4412.       DrvTypeStr5 :=  SPANISH_DrvTypeStr5;
  4413.       DrvTypeStr6 :=  SPANISH_DrvTypeStr6;
  4414.     end  //872ln
  4415.     else if LvLangID = lnPortuguese then   //873>
  4416.     begin
  4417.       DrvTypeStr0 :=  BRAZ_PORT_DrvTypeStr0;
  4418.       DrvTypeStr1 :=  BRAZ_PORT_DrvTypeStr1;
  4419.       DrvTypeStr2 :=  BRAZ_PORT_DrvTypeStr2;
  4420.       DrvTypeStr3 :=  BRAZ_PORT_DrvTypeStr3;
  4421.       DrvTypeStr4 :=  BRAZ_PORT_DrvTypeStr4;
  4422.       DrvTypeStr5 :=  BRAZ_PORT_DrvTypeStr5;
  4423.       DrvTypeStr6 :=  BRAZ_PORT_DrvTypeStr6;
  4424.     end;  //873<
  4425.  
  4426.     DrvType := GetDriveType(PChar(Root));
  4427.     case DrvType of
  4428.       0: Result := DrvTypeStr0;
  4429.       1: Result := DrvTypeStr1;
  4430.       DRIVE_REMOVABLE: Result := DrvTypeStr2;
  4431.       DRIVE_FIXED: Result := DrvTypeStr3;
  4432.       DRIVE_REMOTE: Result := DrvTypeStr4;
  4433.       DRIVE_CDROM: Result :=  DrvTypeStr5;
  4434.       DRIVE_RAMDISK: Result := DrvTypeStr6;  //872ln<
  4435.     end;
  4436.   end; {GetDriveTypeStr}
  4437.  
  4438. begin
  4439.   FColumnClickEnabled := False; //70
  4440.   Integer(Drives) := GetLogicalDrives;
  4441.   for i := 0 to 25 do
  4442.     if (i in Drives) then
  4443.     begin
  4444.       Drv := Char(i + Ord('A'));
  4445.       NewItem := Items.Add;
  4446.       try
  4447.         SHGetFileInfo(PChar(Drv + ':\'), 0, sfi, SizeOf(sfi),
  4448.           SHGFI_SYSICONINDEX or SHGFI_DISPLAYNAME or SHGFI_TYPENAME);
  4449.         if SmallImages <> nil then
  4450.           NewItem.ImageIndex := sfi.Iicon;
  4451.         DrvName := copy(sfi.szDisplayName, 1,
  4452.           (Pos('(', sfi.szDisplayName) - 1));
  4453.         NewItem.Caption := ' (' + Drv + ':)  ' + DrvName;
  4454.         DiskType := GetDriveType(PChar(Drv + ':\'));
  4455.         NewItem.SubItems.Add(GetDriveTypeStr(Drv + ':\'));
  4456.  
  4457.         if (DiskType <> DRIVE_REMOVABLE) and (DiskType <> DRIVE_CDROM) then
  4458.         begin
  4459.           DiskSize := GetDiskSize(Drv + ':\');
  4460.           FreeSize := GetFreeDiskSize(Drv + ':\');
  4461.         end
  4462.         else
  4463.         begin
  4464.           DiskSize := 0;
  4465.           FreeSize := 0;
  4466.         end;
  4467.  
  4468.         if DiskSize > 0 then
  4469.           NewItem.SubItems.Add(FormatFloat('###,###,### Mb',
  4470.             DiskSize div 1000))
  4471.         else
  4472.           NewItem.SubItems.Add('0 Mb');
  4473.  
  4474.         if FreeSize > 0 then
  4475.           NewItem.SubItems.Add(FormatFloat('###,###,### Mb',
  4476.             FreeSize div 1000))
  4477.         else
  4478.           NewItem.SubItems.Add('0 Mb');
  4479.         NewItem.SubItems.Add('');
  4480.         NewItem.SubItems.Add(Drv + ':\');
  4481.         NewItem.SubItems.Add('drv');
  4482.       except
  4483.         Items.Delete(NewItem.Index);
  4484.       end;
  4485.     end;
  4486. end; {AddDrives}
  4487.  
  4488. function TLsFilelistView28.AddFiles(FileMask: string; Attr: DWord):
  4489.   Boolean;
  4490. var
  4491.   sfi: TSHFileInfo;
  4492.   attributes,
  4493.     CurPath,
  4494.     FDate,
  4495.     FName,
  4496.     FileName,
  4497.     FileDir: string;
  4498.     FFileTime: string; //861
  4499.   Count,
  4500.     FSize: Integer;
  4501.   hFindFile: THandle;
  4502.   Win32FD: TWin32FindData;
  4503.  
  4504.   function AttrStr(Attr: integer): string;
  4505.   begin
  4506.     Result := '';
  4507.     if (FILE_ATTRIBUTE_ARCHIVE and Attr) > 0 then Result := Result + 'A';
  4508.     if (FILE_ATTRIBUTE_READONLY and Attr) > 0 then Result := Result + 'R';
  4509.     if (FILE_ATTRIBUTE_HIDDEN and Attr) > 0 then Result := Result + 'H';
  4510.     if (FILE_ATTRIBUTE_SYSTEM and Attr) > 0 then Result := Result + 'S';
  4511.   end;
  4512.  
  4513. begin
  4514.   Result := False;
  4515.   FColumnClickEnabled := True; //70
  4516.   CurPath := AddSlash(FDirectory);
  4517.   hFindFile := FindFirstFile(PChar(FileMask), Win32FD);
  4518.   if hFindFile <> INVALID_HANDLE_VALUE then
  4519.   try
  4520.     repeat
  4521.       with Win32FD do
  4522.       begin
  4523.         if ((Attr and FILE_ATTRIBUTE_DIRECTORY) =
  4524.           (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY)) and
  4525.           ((Attr and FILE_ATTRIBUTE_READONLY) >=
  4526.           (dwFileAttributes and FILE_ATTRIBUTE_READONLY)) and
  4527.           ((Attr and FILE_ATTRIBUTE_HIDDEN) >=
  4528.           (dwFileAttributes and FILE_ATTRIBUTE_HIDDEN)) and
  4529.           ((Attr and FILE_ATTRIBUTE_SYSTEM) >=
  4530.           (dwFileAttributes and FILE_ATTRIBUTE_SYSTEM)) then
  4531.         begin
  4532.           if (dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) > 0 then
  4533.             FileDir := 'dir'
  4534.           else
  4535.             FileDir := 'file';
  4536.  
  4537.           FName := StrPas(Win32FD.cFilename);
  4538.           FileName := CurPath + FName;
  4539.  
  4540.           Case FParentDirEnabled of  //870 >>
  4541.             True:
  4542.               if (FName = '.') then continue; //70
  4543.             False:
  4544.               if ( FName = '.' )  or  ( FName = '..' )  then continue;  //70
  4545.           end;  //870 <<
  4546.  
  4547.           SHGetFileInfo(PChar(FileName), 0, sfi, SizeOf(sfi),
  4548.             SHGFI_TYPENAME or SHGFI_SYSICONINDEX or //SHGFI_ICON or  //871
  4549.             SHGFI_DISPLAYNAME);
  4550.  
  4551.           FSize := (nFileSizeHigh * MAXDWORD) + nFileSizeLow;
  4552.           FDate := FileTimeToDateTimeStr(ftLastWriteTime, FDFormatStr,
  4553.             FTFormatStr);
  4554.          {$IFDEF D4_OR_HIGHER}  //861>>
  4555.           FFileTime := FloatToStr(Int64(ftLastWriteTime.dwHighDateTime) shl 32 +
  4556.                          ftLastWriteTime.dwLowDateTime);
  4557.          {$ELSE}
  4558.           FFileTime := FileTimeToDateTimeStr(ftLastWriteTime, 'MM/dd/yy',
  4559.                        'HH:mm:ss');
  4560.          {$ENDIF}  //861<<
  4561.           Attributes := AttrStr(dwFileAttributes);
  4562.  
  4563.           with Items.Add do
  4564.           begin
  4565.             if (FName = '..') then //70
  4566.             begin
  4567.               Caption := FParentDirCaption; //' Parent';  //872
  4568.               ImageIndex := ParentImgIdx;   //872
  4569.             end
  4570.             else begin
  4571.               case FHideFileExt of //70
  4572.                 True:
  4573.                   begin
  4574.                     Count := Length(ExtractFileExt(FName));  //870
  4575.                     if Count > 0 then
  4576.                       Caption := Copy(FName, 1, Length(FName) - Count)  //870
  4577.                     else Caption := FName;
  4578.                   end;
  4579.                 False:
  4580.                   Caption := FName;
  4581.               end;  //case
  4582.               ImageIndex := sfi.iIcon;   //862
  4583.             end;  //else begin
  4584.  
  4585.             SubItems.Add(ConvertSize(FSize, FileDir)); //SubItems[0]-Size
  4586. //            if FName = '..' then  //871>>
  4587. //              SubItems.Add(' ')
  4588. //            else  //871
  4589.             SubItems.Add(sfi.szTypeName);     //SubItems[1]-TypeName
  4590.             SubItems.Add(FDate);              //SubItems[2]-DateTime
  4591.             SubItems.Add(Attributes);         //SubItems[3]-Attributes
  4592.             SubItems.Add(FileName);           //SubItems[4]-Path+FileName
  4593.             SubItems.Add(FileDir);            //SubItems[5]-dir or file
  4594.             SubItems.Add(FFileTime);          //SubItems[6]-FileTime  //861
  4595.           end; // with Items ...
  4596.  
  4597.           FDirectorySize := FDirectorySize + FSize;
  4598.           Result := True;
  4599.         end; // Attr ...
  4600.       end; // with Win32FD
  4601.     until not FindNextFile(hFindFile, Win32FD);
  4602.   finally
  4603.     windows.FindClose(hFindFile);
  4604.   end; // try
  4605. end; {AddFiles}
  4606.  
  4607. procedure TLsFilelistView28.OneLevelUp;
  4608. var
  4609.   NewDir: string;
  4610.   OldDir: string;  //873
  4611.   i: integer;  //873
  4612. begin
  4613.   OldDir := AddSlash(FDirectory);
  4614.   if UpperCase(Directory) = 'DRIVES' then
  4615.     exit;
  4616.   FDirectory := AddSlash(FDirectory);
  4617.   if (FDirectory[Length(FDirectory) - 1] = ':') then
  4618.   begin
  4619.     if (FDirTreeCombo <> nil) then
  4620.       FDirTreeCombo.OpenPath(FDirTreeCombo.Tree.Items[0].Text);
  4621.     if (FDirTree <> nil) then
  4622.       FDirTree.OpenPath(FDirTree.Items[0].Text);
  4623.     SetDirectory('Drives');
  4624.   end
  4625.   else begin
  4626.     FDirectory := Copy(FDirectory, 1, Length(FDirectory) - 1);
  4627.     NewDir := ExtractFilePath(FDirectory);
  4628.     SetDirectory(NewDir);
  4629.     if FDirTree <> nil then
  4630.       FDirTree.OpenPath(NewDir);
  4631.     if FDirTreeCombo <> nil then
  4632.       FDirTreeCombo.OpenPath(NewDir);
  4633.     for i := 0 to Items.Count - 1 do  //873>
  4634.     begin
  4635.       if (AddSlash(Items[i].SubItems[4]) = OldDir) then
  4636.         Items[i].Selected := True;
  4637.     end;  //873<      
  4638.   end;
  4639. end; {OneLevelUp}
  4640.  
  4641. procedure TLsFilelistView28.Click;
  4642. begin
  4643.   if Selected = nil then  //85
  4644.     exit
  4645.   else
  4646.     FSelectedItem := Selected.SubItems[4];
  4647.   if Assigned(FOnItemChange) then  //83
  4648.     FOnItemChange(Self, FSelectedItem);  //83
  4649.   inherited Click;
  4650. end; {Click}
  4651.  
  4652. procedure TLsFilelistView28.SetDblClickToOpen(Value: Boolean);
  4653. begin
  4654.   if Value <> FDblClickToOpen then
  4655.     FDblClickToOpen := Value;
  4656. end; {SetDblClickToOpen}
  4657.  
  4658. procedure TLsFilelistView28.DblClick;
  4659. begin
  4660.   if (Selected = nil) or (Selected.Caption = '') then
  4661.     exit;                                              //81
  4662.   if FDblClickToOpen then //70
  4663.     OpenItem
  4664.   else begin
  4665.     if (Selected.Caption = FParentDirCaption) then  //' Parent') then //872
  4666.       OneLevelUp
  4667.     else
  4668.       inherited DblClick;
  4669.   end;
  4670. end; {DblClick}
  4671.  
  4672. procedure TLsFilelistView28.SetPopUpMenuEnabled(Value: Boolean);
  4673. begin
  4674.   if Value <> FPopUpMenuEnabled then
  4675.   begin
  4676.     FPopUpMenuEnabled := Value;
  4677.     if FPopUpMenuEnabled then
  4678.       PopupMenu := FPopupMenu
  4679.     else
  4680.     begin
  4681.       PopupMenu := nil;
  4682.       MouseCapture := False; //80
  4683.     end;
  4684.   end;
  4685. end; {SetPopUpMenuEnabled}
  4686.  
  4687.  
  4688. ///// FileOperations /////
  4689.  
  4690. function TLsFilelistView28.CanEdit(Item: TListItem): Boolean;
  4691. begin
  4692.   Result := False;
  4693.   if not ReadOnly then
  4694.   begin
  4695.     OldFName := Item.SubItems[4];
  4696.     Result := inherited CanEdit(Item);
  4697.   end;
  4698. end; {CanEdit}
  4699.  
  4700. procedure TLsFilelistView28.Edit(const Item: TLVItem);
  4701. var
  4702.   Path,
  4703.     newFName,
  4704.     DirOrFile: string;
  4705.   Abort: Boolean;
  4706.   OldCur: TCursor;
  4707. begin
  4708.   inherited Edit(Item);
  4709.   OldCur := Screen.Cursor;
  4710.   Screen.Cursor := crHourGlass;
  4711.   Items.BeginUpdate;
  4712.   try
  4713.     if Selected <> nil then
  4714.     begin
  4715.       Path := ExtractFilePath(OldFName);
  4716.       DirOrFile := Selected.SubItems[5];
  4717.       newFName := AddNullToStr(Path + Selected.Caption);
  4718.       if AnsiCompareText(OldFName, newFName) = 0 then exit;
  4719.  
  4720.       if not FileDirExist(newFName) then
  4721.         DoSHFileOp(Parent.Handle, FO_RENAME, OldFName, newFName, Abort);
  4722.  
  4723.       UpdateFileList;
  4724.  
  4725.       if AnsiCompareText(DirOrFile, 'DIR') = 0 then
  4726.       begin
  4727.         if Assigned(FDirTree) then
  4728.         begin
  4729.           FDirTree.Reload;
  4730.           FDirTree.OpenPath(Path);
  4731.         end
  4732.         else if Assigned(FDirTreeCombo) then
  4733.         begin
  4734.           FDirTreeCombo.ResetTreeView;
  4735.           FDirTreeCombo.OpenPath(Path);
  4736.         end;
  4737.       end;
  4738.     end;
  4739.   finally
  4740.     Items.EndUpdate;
  4741.     Screen.Cursor := oldCur;
  4742.   end;
  4743. end; {Edit}
  4744.  
  4745. procedure TLsFilelistView28.NewFolder;
  4746. var
  4747.   NewDir: string;
  4748.   i: integer;
  4749. begin
  4750.   //81 >>
  4751.   NewDir := SlashSep(FDirectory, esNewFolder);  //872ln AndyRoth
  4752.   if DirectoryExists(NewDir) then
  4753.   begin
  4754.     i := 1;
  4755.     Repeat
  4756.       inc(i);
  4757.     until not DirectoryExists(NewDir + '(' + IntToStr(i) + ')');
  4758.     NewDir := NewDir + '(' + IntToStr(i) + ')';
  4759.   end;  //81 <<
  4760.   CreateDir(NewDir);
  4761.   UpdateFileList;
  4762.   //81 >>
  4763.   Selected := nil;
  4764.   For i := 0 to Items.Count - 1 do
  4765.   begin
  4766.     if Items[i].SubItems[4] = NewDir then
  4767.       Selected := Items[i];
  4768.   end;
  4769.   CanEdit(Selected);
  4770.   Selected.EditCaption;
  4771.   //81 <<
  4772.   if Assigned(DirTreeCombo) then
  4773.   begin
  4774.     FDirTreeCombo.ResetTreeView;
  4775.     FDirTreeCombo.OpenPath(NewDir);
  4776.   end
  4777.   else if Assigned(FDirTree) then
  4778.   begin
  4779.     FDirTree.Reload;
  4780.     FDirTree.OpenPath(NewDir);
  4781.   end;
  4782. end; {NewFolder}
  4783.  
  4784. procedure TLsFilelistView28.RenameFile;
  4785. var
  4786.   SelItem: TListItem;
  4787. begin
  4788.   if Selected = nil then exit;
  4789.   if ReadOnly or (UpperCase(Selected.SubItems[3]) = 'R') then
  4790.   begin
  4791. //    MessageDlg('It''s ReadOnly', mtWarning, [mbOK], 0);
  4792.     MessageDlg(esReadOnly, mtWarning, [mbOK], 0);  //872ln
  4793.     exit;
  4794.   end;
  4795.   OldFName := AddNullToStr(Selected.SubItems[4]);
  4796.   SelItem := Selected;
  4797.   CanEdit(SelItem);
  4798.   Selected.EditCaption;
  4799. end; {ReNameFile}
  4800.  
  4801. procedure TLsFilelistView28.DeleteItems;
  4802. var
  4803.   i: integer;
  4804.   Abort: Boolean;
  4805.   DelFName: string;
  4806.   oldCur: TCursor;
  4807. begin
  4808.   Abort := False;
  4809.   oldCur := Screen.Cursor;
  4810.   Screen.Cursor := crHourGlass;
  4811.   if not SetCurrentDir(FDirectory) then exit;
  4812.   try
  4813.     FSelectedFiles.Clear;
  4814.     DelFName := '';
  4815.     for i := 0 to Items.Count - 1 do
  4816.     begin
  4817.       if Items[i].Selected then
  4818. //        FSelectedFiles.Add(AddNullToStr(Items[i].SubItems[4])); //60  //81
  4819.         DelFName := DelFName + AddNullToStr(Items[i].SubItems[4]); //81
  4820.     end;
  4821.     DoSHFileOp(Parent.Handle, FileOpMode[1], DelFName, '', Abort);
  4822.  
  4823.   finally
  4824.     UpdateFileList;
  4825.     FSelectedFiles.Clear;
  4826.     if Assigned(FDirTreeCombo) then
  4827.     begin
  4828.       FDirTreeCombo.ResetTreeView;
  4829.       FDirTreeCombo.OpenPath(FDirectory);
  4830.     end
  4831.     else if Assigned(FDirTree) then
  4832.     begin
  4833.       FDirTree.Reload;
  4834.       FDirTree.OpenPath(FDirectory);
  4835.     end;
  4836.   end;
  4837.   Screen.Cursor := oldCur;
  4838. end; {DeleteItems}
  4839.  
  4840. procedure TLsFilelistView28.CutCopy(Mode: integer);
  4841. var
  4842.   i: integer;
  4843. begin
  4844.   FOpMode := -1;
  4845.   FSelectedFiles.Clear;
  4846.   for i := 0 to Items.Count - 1 do
  4847.   begin
  4848.     if Items[i].selected then
  4849.       FSelectedFiles.Add(AddNullToStr(Items[i].SubItems[4]));
  4850.   end;
  4851.   FOpMode := Mode;
  4852. end; {CutCopy}
  4853.  
  4854. procedure TLsFilelistView28.Paste;
  4855. var
  4856.   i: integer;
  4857.   FSrc,
  4858.     FDes,
  4859.     DFName: string;
  4860.   Abort: Boolean;
  4861.   oldCur: TCursor;
  4862. begin
  4863.   Abort := False;
  4864.   oldCur := Screen.Cursor;
  4865.   Screen.Cursor := crHourGlass;
  4866.   if not SetCurrentDir(FDirectory) then
  4867.     exit;
  4868.   if FSelectedFiles.Count = 0 then
  4869.   begin
  4870. //    MessageDlg('No file(s) selected', mtWarning, [mbOK], 0);
  4871.     MessageDlg(esNoFileSelected, mtWarning, [mbOK], 0);  //872ln
  4872.     exit;
  4873.   end;
  4874.   try
  4875.     for i := 0 to FSelectedFiles.Count - 1 do
  4876.     begin
  4877.       FSrc := '';
  4878.       FDes := '';
  4879.       FSrc := FSelectedFiles.Strings[i];
  4880.       DFName := ExtractFileName(FSrc);
  4881.       FDes := SlashSep(FDirectory, DFName);
  4882.       FDes := AddNullToStr(FDes);
  4883.       DoSHFileOp(Parent.Handle, FileOpMode[FOpMode], FSrc, FDes, Abort);
  4884.     end;
  4885.   finally
  4886.     UpdateFileList;
  4887.     FSelectedFiles.Clear;
  4888.     //81 >>
  4889.     if Assigned(FDirTreeCombo) then
  4890.     begin
  4891.       FDirTreeCombo.ResetTreeView;
  4892.       FDirTreeCombo.OpenPath(FDirectory);
  4893.     end
  4894.     else if Assigned(FDirTree) then
  4895.     begin
  4896.       FDirTree.Reload;
  4897.       FDirTree.OpenPath(FDirectory);
  4898.     end;
  4899.     //81 <<
  4900.   end;
  4901.   Screen.Cursor := oldCur;
  4902. end; {Paste}
  4903.  
  4904. procedure TLsFilelistView28.OpenItem;
  4905. var
  4906.   sFile,
  4907.     sDir: string;
  4908.   cDrv: Char;
  4909.   oldCur: TCursor;
  4910. begin
  4911.   if Selected = nil then exit;
  4912.   OldCur := Screen.Cursor;
  4913.   Screen.Cursor := crHourGlass;
  4914.   if (Selected.Caption = FParentDirCaption) then   //' Parent') then //872
  4915.   begin
  4916.     OneLevelUp;
  4917.     Screen.Cursor := oldCur;
  4918.     exit;
  4919.   end;
  4920.   if (Selected.SubItems[5] = 'dir') or
  4921.     (Selected.SubItems[5] = 'drv') then
  4922.   begin
  4923.     sDir := Selected.SubItems[4];
  4924.     sDir := AddSlash(sDir);
  4925.     if Selected.SubItems[5] = 'drv' then
  4926.       if GetDriveType(PChar(sDir)) = DRIVE_REMOVABLE then
  4927.       begin
  4928.         cDrv := Selected.SubItems[4][1];
  4929.         if not DiskInDrive(cDrv, 1) then
  4930.         begin
  4931.           Screen.Cursor := OldCur;
  4932.           exit;
  4933.         end;
  4934.       end;
  4935.     SetDirectory(sDir);
  4936.     if FDirTree <> nil then
  4937.       FDirTree.OpenPath(sDir);
  4938.     if FDirTreeCombo <> nil then
  4939.       FDirTreeCombo.OpenPath(sDir);
  4940.   end
  4941.   else if Selected.SubItems[5] = 'file' then
  4942.   begin
  4943.     sFile := ExtractFileName(Selected.SubItems[4]);
  4944.     sDir := ExtractFilePath(Selected.SubItems[4]);
  4945.     ExecuteFile('Open', sFile, '', sDir, SW_SHOW);
  4946.   end;
  4947.   Screen.Cursor := OldCur;
  4948. end; {OpenItem}
  4949.  
  4950. procedure TLsFilelistView28.ViewFile;
  4951. var
  4952.   i: integer;
  4953.   sExt,
  4954.     sFName,
  4955.     sPath,
  4956.     WinDir : string;
  4957. begin
  4958.   if Selected <> nil then
  4959.   begin
  4960.     sPath := AddSlash(ExtractFilePath(Selected.SubItems[4]));
  4961.     sFName := ExtractFileName(Selected.SubItems[4]);
  4962.     sExt := UpperCase(ExtractFileExt(Selected.SubItems[4]));
  4963.     SetLength(WinDir, MAX_PATH); //52
  4964.     SetLength(WinDir, GetWindowsDirectory(PChar(WinDir), MAX_PATH)); //52
  4965.     WinDir := AddSlash(WinDir);
  4966.     for i := Low(FileExt) to High(FileExt) do
  4967.       if (i <= 9) and (sExt = FileExt[i]) then
  4968.         ExecuteFile('Open', WinDir + 'NotePad.exe', sFName, sPath, SW_SHOW)
  4969.       else if (i > 9) and (i <= 12) and (sExt = FileExt[i]) then
  4970.         ExecuteFile('Open', WinDir + 'Write.exe', sFName, sPath, SW_SHOW)
  4971.       else if (i > 12) and (i <=15) and (sExt = FileExt[i]) then
  4972.         ExecuteFile('Open', WinDir + 'PBrush.exe', sFName, sPath, SW_SHOW);  //85
  4973.   end;
  4974. end; {ViewFile}
  4975.  
  4976. procedure TLsFilelistView28.FindFile;
  4977. begin
  4978.   if Focused then
  4979.     ExecuteFile('Find', Directory, '', '', SW_SHOWNORMAL);
  4980. end; {FindFile}
  4981.  
  4982. procedure TLsFilelistView28.SendTo(SubItems: integer);
  4983. var
  4984.   ADirPath,
  4985.     SelPath: string;
  4986.   CopyBrd: TRichEdit;
  4987.   FNMemo: TMemo;
  4988.   AImage: TImage;
  4989.   FPath,
  4990.     FExt: string;
  4991.   i: integer;
  4992.   oldCur: TCursor;
  4993.  
  4994.   function InputDlg(AValue: string): string;
  4995.   var
  4996.     TDlgForm: TForm;
  4997.     Prompt: TLabel;
  4998.     Edit: TEdit;
  4999.     BtnOk: TBitBtn;
  5000.     BtnCancel: TBitBtn;
  5001.     BtnBrowse: TBitBtn;
  5002.     ButtonTop: Integer;
  5003.     ButtonWidth: Integer;
  5004.     ButtonHeight: Integer;
  5005.     mrBrowse: TModalResult;
  5006.   begin
  5007.     Result := '';
  5008.     mrBrowse := mrNo + 3;
  5009.     TDlgForm := TForm.Create(Application);
  5010.     with TDlgForm do
  5011.     try
  5012.       Canvas.Font.Name := 'MS Sans Serif';
  5013.       Canvas.Font.Size := 8;
  5014.       BorderStyle := bsDialog;
  5015.       Caption := esSendToFolder; //872ln AndyRoth
  5016.       ClientWidth := 333;
  5017.       ClientHeight := 135;
  5018.       Position := poScreenCenter;
  5019.       Prompt := TLabel.Create(TDlgForm);
  5020.       with Prompt do
  5021.       begin
  5022.         Parent := TDlgForm;
  5023.         AutoSize := True;
  5024.         Left := 20;
  5025.         Top := 12;
  5026.         Caption := esSendToPath; //872ln AndyRoth
  5027.       end;
  5028.       Edit := TEdit.Create(TDlgForm);
  5029.       with Edit do
  5030.       begin
  5031.         Parent := TDlgForm;
  5032.         Left := Prompt.Left;
  5033.         Top := 32;
  5034.         Width := 293;
  5035.         MaxLength := 285;
  5036.         Text := AValue;
  5037.         SelectAll;
  5038.       end;
  5039.       ButtonTop := 80;
  5040.       ButtonWidth := 75;
  5041.       ButtonHeight := 25;
  5042.       BtnOK := TBitBtn.Create(TDlgForm);
  5043.       with BtnOK do
  5044.       begin
  5045.         Parent := TDlgForm;
  5046.         Kind := bkOK;
  5047.         Caption := 'OK';
  5048.         ModalResult := mrOk;
  5049.         Default := True;
  5050.         Cancel := True;
  5051.         SetBounds(37, ButtonTop, ButtonWidth, ButtonHeight);
  5052.       end;
  5053.       BtnCancel := TBitBtn.Create(TDlgForm);
  5054.       with BtnCancel do
  5055.       begin
  5056.         Parent := TDlgForm;
  5057.         Kind := bkCancel;
  5058.         Caption := ewCancel; //872ln AndyRoth
  5059.         ModalResult := mrCancel;
  5060.         Cancel := True;
  5061.         SetBounds(129, ButtonTop, ButtonWidth, ButtonHeight);
  5062.       end;
  5063.       BtnBrowse := TBitBtn.Create(TDlgForm);
  5064.       with BtnBrowse do
  5065.       begin
  5066.         Parent := TDlgForm;
  5067.         Kind := bkHelp;
  5068.         Caption := ewBrowse; //872ln AndyRoth
  5069.         Cancel := False;
  5070.         ModalResult := mrBrowse;
  5071.         SetBounds(221, ButtonTop, ButtonWidth, ButtonHeight);
  5072.       end;
  5073.       ShowModal;
  5074.       if ModalResult = mrBrowse then
  5075.       begin
  5076.         if BrowseForDir(Application.Handle, ADirPath) then
  5077.           SelPath := InputDlg(ADirPath);
  5078.       end;
  5079.       if ModalResult = mrOK then
  5080.       begin
  5081.         AValue := Edit.Text;
  5082.         if AValue <> '' then
  5083.           Result := AValue;
  5084.         TDlgForm.Close;
  5085.         exit;
  5086.       end;
  5087.       if ModalResult = mrCancel then
  5088.       begin
  5089.         Result := '';
  5090.       end;
  5091.     finally
  5092.       TDlgForm.Free;
  5093.     end;
  5094.   end; {InputDlg}
  5095.  
  5096. begin
  5097.   AImage := nil;
  5098.   case SubItems of
  5099.     0:
  5100.       begin
  5101.         ADirPath := '';
  5102.         InputDlg(ADirPath);
  5103.         if SelPath <> '' then
  5104.           SendToPath(SelPath);
  5105.       end;
  5106.     1:
  5107.       begin
  5108.         FPath := Selected.SubItems[4];
  5109.         FExt := UpperCase(ExtractFileExt(FPath));
  5110.         if (FExt = '.BMP') or (FExt = '.WMF') then
  5111.         begin
  5112.           try
  5113.             AImage := TImage.Create(Self);
  5114.             AImage.Parent := Self;
  5115.             AImage.Picture.LoadFromFile(FPath);
  5116.             ClipBoard.Assign(AImage.Picture);    //85
  5117.           finally
  5118.             AImage.Free;
  5119.           end;
  5120.         end
  5121.         else
  5122.         begin
  5123.           OldCur := Screen.Cursor;
  5124.           Screen.Cursor := crHourGlass;
  5125.           CopyBrd := TRichEdit.Create(Self);
  5126.           with CopyBrd do
  5127.           begin
  5128.             Parent := Self;
  5129.             PlainText := False;
  5130.             Visible := False;
  5131.           end;
  5132.           if Selected <> nil then
  5133.           try
  5134.             CopyBrd.Lines.LoadFromFile(FPath);
  5135.             CopyBrd.SelectAll;
  5136.             CopyBrd.CopyToClipboard;
  5137.           finally
  5138.             CopyBrd.Free;
  5139.             Screen.Cursor := OldCur;
  5140.           end;
  5141.         end;
  5142.       end;
  5143.     2:
  5144.       begin
  5145.         FNMemo := TMemo.Create(Self);
  5146.         FNMemo.Parent := Self;
  5147.         FNMemo.Lines.Clear;
  5148.         try
  5149.           for i := 0 to Items.Count - 1 do
  5150.           begin
  5151.             if Items[i].Selected then
  5152.               FNMemo.Lines.Add(Selected.SubItems[4] + #0);
  5153.           end;
  5154.           FNMemo.SelectAll;
  5155.           FNMemo.CopyToClipboard;
  5156.         finally
  5157.           FNMemo.Free;
  5158.         end;
  5159.       end;
  5160.     3:
  5161.       begin
  5162.         if Selected <> nil then
  5163.           CreateShortCut;  //85
  5164.       end;
  5165.   end;
  5166. end; {SendTo}
  5167.  
  5168.  
  5169. procedure TLsFilelistView28.SendTo2(Path: string);
  5170. var
  5171.   FName: string;
  5172.   PName: string;
  5173.   DPath: string;
  5174.   Drv: string;
  5175.  
  5176.  // Resolving Shortcuts
  5177.   function GetShellLinkPath(Handle: THandle; LinkFileName: string):
  5178.       string;
  5179.   var
  5180.     pShlLnk: IShellLink;
  5181.     pszPath: array[0..MAX_PATH - 1] of Char;
  5182.     win32FD: TWin32FindData;
  5183.     ppF: IPersistFile;
  5184.     hRes: hResult;
  5185. //  {$IFNDEF D3_OR_HIGHER}   //82
  5186. //    pSource: array[0..MAX_PATH - 1] of wideChar;  //82
  5187. //  {$ELSE}   //82
  5188.     IUnk: IUnknown;
  5189.     pSource: WideString;
  5190. //  {$ENDIF}  //82
  5191.   begin
  5192.     Result := '';
  5193.  
  5194. //{$IFNDEF D3_OR_HIGHER}  //82 >>
  5195. //    CoInitialize(nil);
  5196. //    if CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER,
  5197. //      IID_IShellLink, pShlLnk) = S_OK then
  5198. //      if pShlLnk.QueryInterface(IID_IPersistFile, ppF) = S_OK then
  5199. //      try
  5200. //        MultiByteToWideChar(CP_ACP, 0, @LinkFileName[1], -1, pSource,
  5201. //          MAX_PATH);
  5202. //        //  ShowMessage(pSource);    // for debug
  5203. //        if ppF.Load(pSource, STGM_READ) = S_OK then
  5204. //        begin
  5205. //          hRes := pShlLnk.GetPath(pszPath, MAX_PATH, win32FD, SLGP_SHORTPATH
  5206. //            );
  5207. //          if hRes = S_OK then
  5208. //            Result := StrPas(pszPath)
  5209. //          else
  5210. //            exit;
  5211. //        end;
  5212. //      finally
  5213. //        ppF.Release;
  5214. //        CoUnInitialize;
  5215. //      end;
  5216. //{$ELSE}  //82 <<
  5217.  
  5218.     IUnk := CreateComObject(CLSID_ShellLink);
  5219.     pShlLnk := IUnk as IShellLink;
  5220.     ppF := IUnk as IPersistFile;
  5221.     pSource := LinkFileName;
  5222.  
  5223.     hRes := ppF.Load(pWideChar(pSource), STGM_READ);
  5224.     if Succeeded(hRes) then
  5225.     begin
  5226.       hRes := pShlLnk.Resolve(Application.Handle, SLR_ANY_MATCH);
  5227.       if Succeeded(hRes) then
  5228.       begin
  5229.         hRes := pShlLnk.GetPath(@pszPath, MAX_PATH, Win32FD, 0);
  5230.         if Succeeded(hRes) then
  5231.           Result := string(pChar(@pszPath));
  5232.       end;
  5233.     end;
  5234. //{$ENDIF}  //82
  5235.   end; {GetShellLinkPath}
  5236.  
  5237. begin
  5238.   if Selected = nil then exit;
  5239.   if UpperCase(ExtractFileExt(Path)) = '.LNK' then
  5240.   begin
  5241.     FName := GetShellLinkPath(Handle, Path);
  5242.     PName := ExtractFileName(Selected.SubItems[4]);
  5243.     DPath := ExtractFilePath(Selected.SubItems[4]);
  5244.     // ShowMessage(FName); // for debug
  5245.     if FName = '' then exit;
  5246.     Drv := Copy(FName, 1, 3);
  5247.     if (GetDriveType(PChar(Drv)) = DRIVE_REMOVABLE) then
  5248.       SendToDrive(FName)
  5249.     else
  5250.     begin
  5251.       if DirectoryExists(FName) then
  5252.         SendToPath(FName)
  5253.       else
  5254.         ExecuteFile('Open', FName, PName, DPath, SW_SHOW);
  5255.     end;
  5256.   end
  5257.   else if DirectoryExists(Path) then
  5258.     SendToPath(Path);
  5259. end; {SendTo2}
  5260.  
  5261. procedure TLsFilelistView28.SendToPath(DestPath: string);
  5262. var
  5263.   i: integer;
  5264.   FSrc: string;
  5265.   FDes: string;
  5266.   DFName: string;
  5267.   Abort: Boolean;
  5268.   OldCur: TCursor;
  5269. begin
  5270.   if not SetCurrentDir(FDirectory) then exit;
  5271.   Abort := False;
  5272.   OldCur := Screen.Cursor;
  5273.   Screen.Cursor := crHourGlass;
  5274.   FSelectedFiles.Clear;
  5275.   try
  5276.     for i := 0 to Items.Count - 1 do
  5277.       if Items[i].Selected then
  5278.         FSelectedFiles.Add(Items[i].SubItems[4] + #0);
  5279.     for i := 0 to FSelectedFiles.Count - 1 do
  5280.     begin
  5281.       FSrc := '';
  5282.       FDes := '';
  5283.       FSrc := FSelectedFiles.Strings[i];
  5284.       DFName := ExtractFileName(FSrc);
  5285.       FDes := DestPath + DFName + #0;
  5286.       DoSHFileOp(Parent.Handle, FileOpMode[0], FSrc, FDes, Abort);
  5287.     end;
  5288.   finally
  5289.     FSelectedFiles.Clear;
  5290.     Screen.Cursor := OldCur;
  5291.   end;
  5292. end; {SendToPath}
  5293.  
  5294. procedure TLsFilelistView28.SendToDrive(DriveID: string);
  5295. var
  5296.   Drv: Char;
  5297.   OldCur: TCursor;
  5298. begin
  5299.   OldCur := Screen.Cursor;
  5300.   Screen.Cursor := crHourGlass;
  5301.   Drv := DriveID[1];
  5302.   if not DiskInDrive(Drv, 1) then
  5303.   begin
  5304.     Screen.Cursor := oldCur;
  5305.     exit
  5306.   end
  5307.   else
  5308.     SendToPath(DriveID);
  5309.   Screen.Cursor := oldCur;
  5310. end; {SendToDrive}
  5311.  
  5312. procedure TLsFileListView28.CreateShortCut;  //85 >>
  5313. var
  5314.   sPath: array[0..Max_Path] of Char;
  5315.   SrcFile,
  5316.     SrcName,
  5317.     DesPath: string;
  5318.   WidePath: WideString;
  5319.   IShLink: IShellLink;
  5320.   IPFile: IPersistFile;
  5321.   IUnk: IUnknown;
  5322.   hRes: hResult;
  5323. begin
  5324.   GetWindowsDirectory(sPath, Max_Path);
  5325.   DesPath := AddSlash(StrPas(sPath)) + 'DESKTOP\';
  5326.  
  5327.   if Selected = nil then
  5328.   begin
  5329. //    MessageDlg('No file selected', mtError, [mbOK], 0);
  5330.     MessageDlg(esNoFileSelected, mtError, [mbOK], 0);  //872ln
  5331.     exit;
  5332.   end;
  5333.  
  5334.   SrcFile := Selected.SubItems[4];
  5335.   SrcName := ExtractFileName(SrcFile);
  5336.   SrcName := ExtractFileNameOnly(SrcName);
  5337.  
  5338.   IUnk := CreateComObject(CLSID_ShellLink);
  5339.   IShLink := IUnk as IShellLink;
  5340.   IPFile := IUnk as IPersistFile;
  5341.  
  5342.   with IShLink do
  5343.   begin
  5344.     hRes := SetPath(PChar(SrcFile));
  5345.     if Succeeded(hRes) then
  5346.       hRes := SetWorkingDirectory(PChar(ExtractFilePath(SrcFile)));
  5347.     if Succeeded(hRes) then
  5348.       SetDescription(PChar(SrcName))
  5349.   end;
  5350.  
  5351.   WidePath :=  AddSlash(DesPath) + SrcName + '.lnk';
  5352.   if Succeeded(hRes) then
  5353.     hRes := IPFile.Save(PWChar(WidePath), False);
  5354.   if Failed(hRes) then
  5355. //    MessageDlg('Error - PersistFile.Save failed', mtError, [mbOK], 0);
  5356.     MessageDlg(esPersistSaveError, mtError, [mbOK], 0);  //872ln
  5357. end; {CreateShortCut}  //85 <<
  5358.  
  5359. {$IFDEF D4_OR_HIGHER}
  5360. procedure TLsFilelistView28.ShowFileProperties;    //861>> //862>>
  5361. var
  5362.   Filename: TFileName;
  5363. begin
  5364.   if Selected = nil then
  5365.     exit;
  5366.   Filename := Selected.SubItems[4];
  5367.   if FileName = '' then exit;
  5368.   ShowProperties(FileName);
  5369. end;  {ShowFileProperties}  //861 <<
  5370.  
  5371. {$ELSE}
  5372. procedure TLsFilelistView28.FileAttr;
  5373. var
  5374.   NewAttr,
  5375.     OldAttr: word;
  5376.   AttrForm: TForm;
  5377.   Panel1: TPanel;
  5378.   CbxA,
  5379.     CbxR,
  5380.     CbxS,
  5381.     CbxH: TCheckBox;
  5382.   BtnOK,
  5383.     BtnCancel: TBitBtn;
  5384.   LblFName: TLabel;
  5385. begin
  5386.   AttrForm := TForm.Create(Application);
  5387.   with AttrForm do
  5388.   try
  5389.     ClientHeight := 172;
  5390.     ClientWidth := 266;
  5391.     Canvas.Font.Name := 'MS Sens Serif';
  5392.     Canvas.Font.Size := 8;
  5393.     BorderStyle := bsDialog;
  5394.     Caption := 'Set Attributes';
  5395.     Position := poScreenCenter;
  5396.     LblFName := TLabel.Create(Self);
  5397.     with LblFName do
  5398.     begin
  5399.       Parent := AttrForm;
  5400.       Left := 20;
  5401.       Top := 12;
  5402.       Font.Size := 10;
  5403.       Caption := ExtractFileName(Selected.SubItems[4]);
  5404.     end;
  5405.     Panel1 := TPanel.Create(Self);
  5406.     with Panel1 do
  5407.     begin
  5408.       Parent := AttrForm;
  5409.       Left := 20;
  5410.       Top := 34;
  5411.       Height := 77;
  5412.       Width := 225;
  5413.       BevelOuter := bvNone;
  5414.       BevelInner := bvLowered;
  5415.       CbxR := TCheckBox.Create(Self);
  5416.       with CbxR do
  5417.       begin
  5418.         Parent := Panel1;
  5419.         Left := 20;
  5420.         Top := 16;
  5421.         Caption := 'ReadOnly';
  5422.         Checked := False;
  5423.       end;
  5424.       CbxA := TCheckBox.create(Self);
  5425.       with CbxA do
  5426.       begin
  5427.         Parent := Panel1;
  5428.         Left := 20;
  5429.         Top := 44;
  5430.         Caption := 'Archive';
  5431.         Checked := False;
  5432.       end;
  5433.       CbxH := TCheckBox.Create(Self);
  5434.       with CbxH do
  5435.       begin
  5436.         Parent := Panel1;
  5437.         Left := 120;
  5438.         Top := 16;
  5439.         Caption := 'Hidden';
  5440.         Caption := Trim(Caption);
  5441.         Checked := False;
  5442.       end;
  5443.       CbxS := TCheckBox.Create(Self);
  5444.       with CbxS do
  5445.       begin
  5446.         Parent := Panel1;
  5447.         Left := 120;
  5448.         Top := 44;
  5449.         Caption := 'System';
  5450.         Caption := Trim(Caption);
  5451.         Checked := False;
  5452.       end;
  5453.     end; // Panel1
  5454.     BtnOK := TBitBtn.Create(Self);
  5455.     with BtnOK do
  5456.     begin
  5457.       Parent := AttrForm;
  5458.       Top := 128;
  5459.       Left := 44;
  5460.       Height := 25;
  5461.       Width := 75;
  5462.       Kind := bkOK;
  5463.       ModalResult := mrOK;
  5464.     end;
  5465.     BtnCancel := TBitBtn.Create(Self);
  5466.     with BtnCancel do
  5467.     begin
  5468.       Parent := AttrForm;
  5469.       Top := 128;
  5470.       Left := 140;
  5471.       Height := 25;
  5472.       Width := 75;
  5473.       Kind := bkCancel;
  5474.       ModalResult := mrCancel;
  5475.     end;
  5476.     OldAttr := FileGetAttr(Selected.SubItems[4]);
  5477.     CbxR.Checked := OldAttr and faReadOnly = faReadOnly;
  5478.     CbxA.Checked := OldAttr and faArchive = faArchive;
  5479.     CbxH.Checked := OldAttr and faHidden = faHidden;
  5480.     CbxS.Checked := OldAttr and faSysFile = faSysFile;
  5481.     ShowModal;
  5482.     if ModalResult = mrOK then
  5483.     begin
  5484.       NewAttr := OldAttr;
  5485.       if CbxR.Checked then
  5486.         NewAttr := NewAttr or faReadOnly
  5487.       else
  5488.         NewAttr := NewAttr and not faReadOnly;
  5489.       if CbxA.Checked then
  5490.         NewAttr := NewAttr or faArchive
  5491.       else
  5492.         NewAttr := NewAttr and not faArchive;
  5493.       if CbxS.Checked then
  5494.         NewAttr := NewAttr or faSysFile
  5495.       else
  5496.         NewAttr := NewAttr and not faSysFile;
  5497.       if CbxH.Checked then
  5498.         NewAttr := NewAttr or faHidden
  5499.       else
  5500.         NewAttr := NewAttr and not faHidden;
  5501.       if NewAttr <> OldAttr then
  5502.         FileSetAttr(Selected.SubItems[4], NewAttr);
  5503.       UpdateFileList;
  5504.     end; // mrOK
  5505.   finally
  5506.     AttrForm.Free;
  5507.   end;
  5508. end; {FileAttr}
  5509. {$ENDIF}
  5510.  
  5511. procedure TLsFilelistView28.SetAbout(Value: string);  //85 >
  5512. Begin
  5513.   // Property About is ReadOnly.
  5514. end; {SetAbout}  //85 <
  5515.  
  5516. procedure TLsFilelistView28.InitializeVar;  //872ln>
  5517. begin
  5518.   if (LvLangID = lnEnglish) then
  5519.   begin
  5520.     ewError            :=  ENGLISH_ewError;
  5521.     ewFile             :=  ENGLISH_ewFile;
  5522.     ewCancel           :=  ENGLISH_ewCancel;
  5523.     ewBrowse           :=  ENGLISH_ewBrowse;
  5524.     ewReadOnly         :=  ENGLISH_ewReadOnly;
  5525.     ewArchive          :=  ENGLISH_ewArchive;
  5526.     ewHidden           :=  ENGLISH_ewHidden;
  5527.     ewSystem           :=  ENGLISH_ewSystem;
  5528.  
  5529.     esCannot           :=  ENGLISH_esCannot;
  5530.     esSpecifyDir       :=  ENGLISH_esSpecifyDir;
  5531.     esInvalidDrvID     :=  ENGLISH_esInvalidDrvID;
  5532.     esDrvNotReady      :=  ENGLISH_esDrvNotReady;
  5533.     esExists           :=  ENGLISH_esExists;
  5534.     esNewFolder        :=  ENGLISH_esNewFolder;
  5535.     esReadOnly         :=  ENGLISH_esReadOnly;
  5536.     esNoFileSelected   :=  ENGLISH_esNoFileSelected;
  5537.     esSendToFolder     :=  ENGLISH_esSendToFolder;
  5538.     esSendToPath       :=  ENGLISH_esSendToPath;
  5539.     esPersistSaveError :=  ENGLISH_esPersistSaveError;
  5540.     esSetAttr          :=  ENGLISH_esSetAttr;
  5541.   end
  5542.   else if (LvLangID = lnFrench) then
  5543.   begin
  5544.     ewError            :=  FRENCH_ewError;
  5545.     ewFile             :=  FRENCH_ewFile;
  5546.     ewCancel           :=  FRENCH_ewCancel;
  5547.     ewBrowse           :=  FRENCH_ewBrowse;
  5548.     ewReadOnly         :=  FRENCH_ewReadOnly;
  5549.     ewArchive          :=  FRENCH_ewArchive;
  5550.     ewHidden           :=  FRENCH_ewHidden;
  5551.     ewSystem           :=  FRENCH_ewSystem;
  5552.  
  5553.     esCannot           :=  FRENCH_esCannot;
  5554.     esSpecifyDir       :=  FRENCH_esSpecifyDir;
  5555.     esInvalidDrvID     :=  FRENCH_esInvalidDrvID;
  5556.     esDrvNotReady      :=  FRENCH_esDrvNotReady;
  5557.     esExists           :=  FRENCH_esExists;
  5558.     esNewFolder        :=  FRENCH_esNewFolder;
  5559.     esReadOnly         :=  FRENCH_esReadOnly;
  5560.     esNoFileSelected   :=  FRENCH_esNoFileSelected;
  5561.     esSendToFolder     :=  FRENCH_esSendToFolder;
  5562.     esSendToPath       :=  FRENCH_esSendToPath;
  5563.     esPersistSaveError :=  FRENCH_esPersistSaveError;
  5564.     esSetAttr          :=  FRENCH_esSetAttr;
  5565.   end
  5566.   else if (LvLangID = lnGerman) then
  5567.   begin
  5568.     ewError            :=  GERMAN_ewError;
  5569.     ewFile             :=  GERMAN_ewFile;
  5570.     ewCancel           :=  GERMAN_ewCancel;
  5571.     ewBrowse           :=  GERMAN_ewBrowse;
  5572.     ewReadOnly         :=  GERMAN_ewReadOnly;
  5573.     ewArchive          :=  GERMAN_ewArchive;
  5574.     ewHidden           :=  GERMAN_ewHidden;
  5575.     ewSystem           :=  GERMAN_ewSystem;
  5576.  
  5577.     esCannot           :=  GERMAN_esCannot;
  5578.     esSpecifyDir       :=  GERMAN_esSpecifyDir;
  5579.     esInvalidDrvID     :=  GERMAN_esInvalidDrvID;
  5580.     esDrvNotReady      :=  GERMAN_esDrvNotReady;
  5581.     esExists           :=  GERMAN_esExists;
  5582.     esNewFolder        :=  GERMAN_esNewFolder;
  5583.     esReadOnly         :=  GERMAN_esReadOnly;
  5584.     esNoFileSelected   :=  GERMAN_esNoFileSelected;
  5585.     esSendToFolder     :=  GERMAN_esSendToFolder;
  5586.     esSendToPath       :=  GERMAN_esSendToPath;
  5587.     esPersistSaveError :=  GERMAN_esPersistSaveError;
  5588.     esSetAttr          :=  GERMAN_esSetAttr;
  5589.   end
  5590.   else if (LvLangID = lnSpanish) then
  5591.   begin
  5592.     ewError            :=  SPANISH_ewError;
  5593.     ewFile             :=  SPANISH_ewFile;
  5594.     ewCancel           :=  SPANISH_ewCancel;
  5595.     ewBrowse           :=  SPANISH_ewBrowse;
  5596.     ewReadOnly         :=  SPANISH_ewReadOnly;
  5597.     ewArchive          :=  SPANISH_ewArchive;
  5598.     ewHidden           :=  SPANISH_ewHidden;
  5599.     ewSystem           :=  SPANISH_ewSystem;
  5600.  
  5601.     esCannot           :=  SPANISH_esCannot;
  5602.     esSpecifyDir       :=  SPANISH_esSpecifyDir;
  5603.     esInvalidDrvID     :=  SPANISH_esInvalidDrvID;
  5604.     esDrvNotReady      :=  SPANISH_esDrvNotReady;
  5605.     esExists           :=  SPANISH_esExists;
  5606.     esNewFolder        :=  SPANISH_esNewFolder;
  5607.     esReadOnly         :=  SPANISH_esReadOnly;
  5608.     esNoFileSelected   :=  SPANISH_esNoFileSelected;
  5609.     esSendToFolder     :=  SPANISH_esSendToFolder;
  5610.     esSendToPath       :=  SPANISH_esSendToPath;
  5611.     esPersistSaveError :=  SPANISH_esPersistSaveError;
  5612.     esSetAttr          :=  SPANISH_esSetAttr;
  5613.   end
  5614.   else if (LvLangID = lnPortuguese) then  //873>
  5615.   begin
  5616.     ewError            :=  BRAZ_PORT_ewError;
  5617.     ewFile             :=  BRAZ_PORT_ewFile;
  5618.     ewCancel           :=  BRAZ_PORT_ewCancel;
  5619.     ewBrowse           :=  BRAZ_PORT_ewBrowse;
  5620.     ewReadOnly         :=  BRAZ_PORT_ewReadOnly;
  5621.     ewArchive          :=  BRAZ_PORT_ewArchive;
  5622.     ewHidden           :=  BRAZ_PORT_ewHidden;
  5623.     ewSystem           :=  BRAZ_PORT_ewSystem;
  5624.  
  5625.     esCannot           :=  BRAZ_PORT_esCannot;
  5626.     esSpecifyDir       :=  BRAZ_PORT_esSpecifyDir;
  5627.     esInvalidDrvID     :=  BRAZ_PORT_esInvalidDrvID;
  5628.     esDrvNotReady      :=  BRAZ_PORT_esDrvNotReady;
  5629.     esExists           :=  BRAZ_PORT_esExists;
  5630.     esNewFolder        :=  BRAZ_PORT_esNewFolder;
  5631.     esReadOnly         :=  BRAZ_PORT_esReadOnly;
  5632.     esNoFileSelected   :=  BRAZ_PORT_esNoFileSelected;
  5633.     esSendToFolder     :=  BRAZ_PORT_esSendToFolder;
  5634.     esSendToPath       :=  BRAZ_PORT_esSendToPath;
  5635.     esPersistSaveError :=  BRAZ_PORT_esPersistSaveError;
  5636.     esSetAttr          :=  BRAZ_PORT_esSetAttr;
  5637.   end;  //873<
  5638. end;  {InitializeVar}  //872ln<
  5639.  
  5640.  
  5641. //// End of TLsFilelistView28 /////
  5642.  
  5643.  
  5644. {***********************************************************************}
  5645. {                       LsFilelistView28PopUp                           }
  5646. {***********************************************************************}
  5647.  
  5648. constructor TLsFilelistView28PopUp.Create(AOwner: TComponent);
  5649. {$IFDEF D4_OR_HIGHER}  //70
  5650. var
  5651.   sfi: TSHFileInfo;
  5652.   hImgLst: Uint;
  5653. {$ENDIF}
  5654. begin
  5655.   inherited Create(AOwner);
  5656.   SendToList := TStringList.Create;
  5657. {$IFDEF D4_OR_HIGHER}      //70
  5658.   Images := TImageList.Create(self);
  5659.   hImgLst := SHGetFileInfo('', 0,
  5660.                            sfi, SizeOf(sfi),
  5661.                            SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
  5662.   if hImgLst <> 0 then
  5663.   begin
  5664.     Images.Handle := hImgLst;
  5665.     Images.BkColor := clNone;  //80+
  5666.     Images.ShareImages := True;
  5667.   end;
  5668. {$ENDIF}
  5669.  
  5670.   // Load Bitmaps from Resource  //85 >>
  5671.   Bmp1 := LoadImage(hInstance, 'Open28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5672.   Bmp2 := LoadImage(hInstance, 'View28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5673.   Bmp3 := LoadImage(hInstance, 'SendTo28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5674.   Bmp4 := LoadImage(hInstance, 'Cut28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5675.   Bmp5 := LoadImage(hInstance, 'Copy28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5676.   Bmp6 := LoadImage(hInstance, 'Paste28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5677.   Bmp7 := LoadImage(hInstance, 'ReName28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5678.   Bmp8 := LoadImage(hInstance, 'Delete28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5679.   Bmp9 := LoadImage(hInstance, 'Attributes28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5680.   Bmp10 := LoadImage(hInstance, 'NewFolder28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5681.   Bmp11 := LoadImage(hInstance, 'AnyFolder28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5682.   Bmp12 := LoadImage(hInstance, 'ClipBoard28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5683.   Bmp13 := LoadImage(hInstance, 'DeskTop28', IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
  5684.   //85 <<
  5685. end; {Create}
  5686.  
  5687. destructor TLsFilelistView28PopUp.Destroy;
  5688. begin
  5689.   SendToList.Free;
  5690. {$IFDEF D4_OR_HIGHER}
  5691.   Images.Free;  //70
  5692. {$ENDIF}
  5693.   DeleteObject(Bmp1); //70 >>
  5694.   DeleteObject(Bmp2);
  5695.   DeleteObject(Bmp3);
  5696.   DeleteObject(Bmp4);
  5697.   DeleteObject(Bmp5);
  5698.   DeleteObject(Bmp6);
  5699.   DeleteObject(Bmp7);
  5700.   DeleteObject(Bmp8);
  5701.   DeleteObject(Bmp9);
  5702.   DeleteObject(Bmp10);
  5703.   DeleteObject(Bmp11);
  5704.   DeleteObject(Bmp12); //70 <<
  5705.   DeleteObject(Bmp13); //85
  5706.   inherited Destroy;
  5707. end; {Destroy}
  5708.  
  5709. function TLsFilelistView28PopUp.AddNewItem(const aCaption: string;
  5710.   aShortCut: TShortCut; aChecked, aEnabled: Boolean;
  5711.   aGroup: integer; aOnClick: TNotifyEvent;
  5712.   hCtx: word; const aName: string; aTag: Integer;
  5713.   aBitMap: HBitmap): TMenuItem; //70  //862
  5714. begin
  5715.   Result := TMenuItem.Create(nil);
  5716.   with result do
  5717.   begin
  5718.     Caption := aCaption;
  5719.     ShortCut := aShortCut;
  5720.     Checked := aChecked;
  5721.     Enabled := aEnabled;
  5722.     GroupIndex := aGroup;
  5723.     OnClick := aOnClick;
  5724.     Name := aName;
  5725.     Tag := aTag;   //862
  5726. {$IFDEF D4_OR_HIGHER}
  5727.     BITMAP.Handle := aBitmap;
  5728. {$ENDIF}
  5729.   end;
  5730. end; {AddNewItem}
  5731.  
  5732.  
  5733. procedure TLsFilelistView28PopUp.SetFileListView(Value: TLsFilelistView28);
  5734. begin
  5735.   FFileListView := Value;
  5736. end; {SetFileListView}
  5737.  
  5738.  
  5739. procedure TLsFilelistView28PopUp.GetSendToSubMenu;
  5740. var
  5741.   SendToDir,
  5742.     FName,
  5743.     FullName: string;
  5744.   win32FD: TWin32FindData;
  5745.   hFindFile: THandle;
  5746.   sfi: TSHFileInfo;
  5747.   i: integer;
  5748.   NewItem: TMenuItem;
  5749.  
  5750.   function GetShellPath(Handle: THandle; var DestPath: string;
  5751.     nFldr: integer): Boolean;
  5752.   var
  5753.     ShellMalloc: IMALLOC;
  5754.     shBuff: pChar;
  5755.     idRoot: PItemIDList;
  5756.   begin
  5757.     Result := False;
  5758.     SetLength(DestPath, MAX_PATH);
  5759.     if CoGetMalloc(1, ShellMalloc) = NOERROR then
  5760.     try
  5761.       shBuff := PChar(ShellMalloc.Alloc(MAX_PATH));
  5762.       if assigned(shBuff) then
  5763.       begin
  5764.         SHGetSpecialFolderLocation(Handle, nFldr, idRoot);
  5765.         // Convert idRoot to a file system path and pass to shBuff.
  5766.         if SHGetPathFromIDList(idRoot, shBuff) then
  5767.         begin
  5768.           DestPath := shBuff;
  5769.           Result := True;
  5770.         end;
  5771.       end;
  5772.     finally
  5773.       ShellMalloc.Free(idRoot);
  5774.       ShellMalloc._Release; //53
  5775.       //  ShellMalloc.Free(shBuff);   //53
  5776.     end;
  5777.   end; {GetShellPath}
  5778.  
  5779. begin
  5780.   SendToList.Clear;
  5781.   i := 0;
  5782.   if GetShellPath(Handle, SendToDir, CSIDL_SENDTO) then
  5783.   begin
  5784.     hFindFile := FindFirstFile(PChar(SlashSep(SendToDir, '*.LNK')), win32FD);
  5785.     if hFindFile <> INVALID_HANDLE_VALUE then
  5786.     try
  5787.       repeat
  5788.         with win32FD do
  5789.         begin
  5790.           FName := StrPas(cFileName);
  5791.           if (FName = '.') or (FName = '..') then continue;
  5792.           FullName := SlashSep(SendToDir, FName);
  5793.           SHGetFileInfo(PChar(FullName), 0, sfi, SizeOf(sfi),
  5794.             SHGFI_SYSICONINDEX or SHGFI_SMALLICON or SHGFI_DISPLAYNAME); //60
  5795.  
  5796.           NewItem := AddNewItem(StrPas(sfi.szDisplayName), 0, False,
  5797.             True, 1, ItemOnClick, 0, 'Send_To' + IntToStr(i + 4), 34 + i, 0);  //862
  5798.          {$IFDEF D4_OR_HIGHER}
  5799.           NewItem.ImageIndex := sfi.iIcon; //60
  5800.          {$ENDIF}
  5801.           Items.Items[3].Add(NewItem);
  5802.           SendToList.Add(FullName);
  5803.           inc(i);
  5804.         end;
  5805.       until not FindNextFile(hFindFile, win32FD);
  5806.     finally
  5807.       Windows.FindClose(hFindFile);
  5808.     end;
  5809.   end;
  5810. end; {GetSendToSubMenu}
  5811.  
  5812.  
  5813. procedure TLsFilelistView28PopUp.BuildItems; //70
  5814. begin
  5815.   //define language specific MenuItem's captions
  5816.   if LvLangID = lnEnglish then  //872ln>
  5817.   begin
  5818.     LvItemID_0  :=  ENGLISH_LvItemID_0;
  5819.     LvItemID_1  :=  ENGLISH_LvItemID_1;
  5820.     LvItemID_3  :=  ENGLISH_LvItemID_3;
  5821.     LvItemID_5  :=  ENGLISH_LvItemID_5;
  5822.     LvItemID_6  :=  ENGLISH_LvItemID_6;
  5823.     LvItemID_7  :=  ENGLISH_LvItemID_7;
  5824.     LvItemID_9  :=  ENGLISH_LvItemID_9;
  5825.     LvItemID_10 :=  ENGLISH_LvItemID_10;
  5826.     LvItemID_12 :=  ENGLISH_LvItemID_12;
  5827.     LvItemID_14 :=  ENGLISH_LvItemID_14;
  5828.     LvItemID_30 :=  ENGLISH_LvItemID_30;
  5829.     LvItemID_31 :=  ENGLISH_LvItemID_31;
  5830.     LvItemID_32 :=  ENGLISH_LvItemID_32;
  5831.     LvItemID_33 :=  ENGLISH_LvItemID_33;
  5832.   end
  5833.   else if LvLangID = lnFrench then
  5834.   begin
  5835.     LvItemID_0  :=  FRENCH_LvItemID_0;
  5836.     LvItemID_1  :=  FRENCH_LvItemID_1;
  5837.     LvItemID_3  :=  FRENCH_LvItemID_3;
  5838.     LvItemID_5  :=  FRENCH_LvItemID_5;
  5839.     LvItemID_6  :=  FRENCH_LvItemID_6;
  5840.     LvItemID_7  :=  FRENCH_LvItemID_7;
  5841.     LvItemID_9  :=  FRENCH_LvItemID_9;
  5842.     LvItemID_10 :=  FRENCH_LvItemID_10;
  5843.     LvItemID_12 :=  FRENCH_LvItemID_12;
  5844.     LvItemID_14 :=  FRENCH_LvItemID_14;
  5845.     LvItemID_30 :=  FRENCH_LvItemID_30;
  5846.     LvItemID_31 :=  FRENCH_LvItemID_31;
  5847.     LvItemID_32 :=  FRENCH_LvItemID_32;
  5848.     LvItemID_33 :=  FRENCH_LvItemID_33;
  5849.   end
  5850.   else if LvLangID = lnGerman then
  5851.   begin
  5852.     LvItemID_0  :=  GERMAN_LvItemID_0;
  5853.     LvItemID_1  :=  GERMAN_LvItemID_1;
  5854.     LvItemID_3  :=  GERMAN_LvItemID_3;
  5855.     LvItemID_5  :=  GERMAN_LvItemID_5;
  5856.     LvItemID_6  :=  GERMAN_LvItemID_6;
  5857.     LvItemID_7  :=  GERMAN_LvItemID_7;
  5858.     LvItemID_9  :=  GERMAN_LvItemID_9;
  5859.     LvItemID_10 :=  GERMAN_LvItemID_10;
  5860.     LvItemID_12 :=  GERMAN_LvItemID_12;
  5861.     LvItemID_14 :=  GERMAN_LvItemID_14;
  5862.     LvItemID_30 :=  GERMAN_LvItemID_30;
  5863.     LvItemID_31 :=  GERMAN_LvItenID_31;
  5864.     LvItemID_32 :=  GERMAN_LvItemID_32;
  5865.     LvItemID_33 :=  GERMAN_LvItemID_33;
  5866.   end
  5867.   else if LvLangID = lnSpanish then
  5868.   begin
  5869.     LvItemID_0  :=  SPANISH_LvItemID_0;
  5870.     LvItemID_1  :=  SPANISH_LvItemID_1;
  5871.     LvItemID_3  :=  SPANISH_LvItemID_3;
  5872.     LvItemID_5  :=  SPANISH_LvItemID_5;
  5873.     LvItemID_6  :=  SPANISH_LvItemID_6;
  5874.     LvItemID_7  :=  SPANISH_LvItemID_7;
  5875.     LvItemID_9  :=  SPANISH_LvItemID_9;
  5876.     LvItemID_10 :=  SPANISH_LvItemID_10;
  5877.     LvItemID_12 :=  SPANISH_LvItemID_12;
  5878.     LvItemID_14 :=  SPANISH_LvItemID_14;
  5879.     LvItemID_30 :=  SPANISH_LvItemID_30;
  5880.     LvItemID_31 :=  SPANISH_LvItemID_31;
  5881.     LvItemID_32 :=  SPANISH_LvItemID_32;
  5882.     LvItemID_33 :=  SPANISH_LvItemID_33;
  5883.   end
  5884.   else if LvLangID = lnPortuguese then   //873>
  5885.   begin
  5886.     LvItemID_0  :=  BRAZ_PORT_LvItemID_0;
  5887.     LvItemID_1  :=  BRAZ_PORT_LvItemID_1;
  5888.     LvItemID_3  :=  BRAZ_PORT_LvItemID_3;
  5889.     LvItemID_5  :=  BRAZ_PORT_LvItemID_5;
  5890.     LvItemID_6  :=  BRAZ_PORT_LvItemID_6;
  5891.     LvItemID_7  :=  BRAZ_PORT_LvItemID_7;
  5892.     LvItemID_9  :=  BRAZ_PORT_LvItemID_9;
  5893.     LvItemID_10 :=  BRAZ_PORT_LvItemID_10;
  5894.     LvItemID_12 :=  BRAZ_PORT_LvItemID_12;
  5895.     LvItemID_14 :=  BRAZ_PORT_LvItemID_14;
  5896.     LvItemID_30 :=  BRAZ_PORT_LvItemID_30;
  5897.     LvItemID_31 :=  BRAZ_PORT_LvItemID_31;
  5898.     LvItemID_32 :=  BRAZ_PORT_LvItemID_32;
  5899.     LvItemID_33 :=  BRAZ_PORT_LvItemID_33;
  5900.   end;  //873<
  5901.   //Build MenuItems
  5902.   Items.Add(AddNewItem(LvItemID_0, 0, False, True, 0,
  5903.     ItemOnClick, 0, 'ItemOpen', 1, Bmp1)); //Items[0]
  5904.   Items.Add(AddNewItem(LvItemID_1, 0, False, True, 0,
  5905.     ItemOnClick, 0, 'ItemView', 2, Bmp2)); //Items[1]
  5906.   Items.Add(NewLine);
  5907.   Items.Add(AddNewItem(LvItemID_3, 0, False, True, 0,
  5908.     ItemOnClick, 0, 'SubMenuSend', 3, Bmp3)); //Items[3]
  5909.   Items.Add(NewLine);
  5910.   Items.Add(AddNewItem(LvItemID_5, 0, False, True, 0,
  5911.     ItemOnClick, 0, 'ItemOpCut', 4, Bmp4)); //Items[5]
  5912.   Items.Add(AddNewItem(LvItemID_6, 0, False, True, 0,
  5913.     ItemOnClick, 0, 'ItemOpCopy', 5, Bmp5)); //Items[6]
  5914.   Items.Add(AddNewItem(LvItemID_7, 0, False, True, 0,
  5915.     ItemOnClick, 0, 'ItemOpPaste', 6, Bmp6)); //Items[7]
  5916.   Items.Add(NewLine);
  5917.   Items.Add(AddNewItem(LvItemID_9, 0, False, True, 0,
  5918.     ItemOnClick, 0, 'ItemRename', 7, Bmp7)); //Items[9]
  5919.   Items.Add(AddNewItem(LvItemID_10, 0, False, True, 0,
  5920.     ItemOnClick, 0, 'ItemDelete', 8, Bmp8)); //Items[10]
  5921.   Items.Add(NewLine);
  5922.   Items.Add(AddNewItem(LvItemID_12, 0, False, True, 0,
  5923.     ITemOnClick, 0, 'ItemProperty', 9, Bmp9)); //Items[12]
  5924.   Items.Add(NewLine);
  5925.   Items.Add(AddNewItem(LvItemID_14, 0, False, True, 0,
  5926.     ItemOnClick, 0, 'ItemFolder', 10, Bmp10)); //Items[14]
  5927.   // Items[3] SendTo SubItems
  5928.   Items.Items[3].Add(AddNewItem(LvItemID_30, 0, False, True, 0,
  5929.     ItemOnClick, 0, 'Send_To' + IntToStr(0), 30, Bmp11));
  5930.   Items.Items[3].Add(AddNewItem(LvItemID_31, 0, False, True, 0,
  5931.     ItemOnClick, 0, 'Send_To' + IntToStr(1), 31, Bmp12));
  5932.   Items.Items[3].Add(AddNewItem(LvItemID_32, 0, False, True, 0,
  5933.     ItemOnClick, 0, 'Send_To' + IntToStr(2), 32, Bmp12));
  5934.   Items.Items[3].Add(AddNewItem(LvItemID_33, 0, False, True, 0,
  5935.     ItemOnClick, 0, 'Send_To' + IntToStr(3), 33, Bmp13));
  5936.   GetSendToSubMenu;  //872ln<
  5937. end; {BuildItems}
  5938.  
  5939. procedure TLsFilelistView28PopUp.ItemOnClick(Sender: TObject);
  5940. var
  5941.   i: integer;
  5942. begin
  5943.   if (TMenuItem(Sender).Name = '') or (TMenuItem(Sender).Tag = 0) then
  5944.     exit;
  5945.   with Sender as TMenuItem do   //862>>
  5946.   begin
  5947.     Case Tag of
  5948.       1:  FFileListView.OpenItem;
  5949.       2:  FFileListView.ViewFile;
  5950.       4:  FFileListView.CutCopy(2);
  5951.       5:  FFileListView.CutCopy(0);
  5952.       6:  FFileListView.Paste;
  5953.       7:  FFileListView.RenameFile;
  5954.       8:  FFileListView.DeleteItems;
  5955.     {$IFDEF D4_OR_HIGHER}
  5956.       9:  FFileListView.ShowFileProperties;
  5957.     {$ELSE}
  5958.       9:  FFileListView.FileAttr;
  5959.     {$ENDIF}
  5960.       10:  FFileListView.NewFolder;   //862<<
  5961.       else begin
  5962.         if Pos('Send_To', TMenuItem(Sender).Name) = 1 then
  5963.         begin
  5964.           i := StrToIntDef(Copy(TMenuItem(Sender).Name, 8, 2), -1);
  5965.           if (i > -1) and (i < 4) then  //85
  5966.             FFileListView.SendTo(i)
  5967.           else if (i > 3) then  //85
  5968.             FFileListView.SendTo2(SendToList[i - 4]);
  5969.         end;
  5970.       end; //else
  5971.     end; //case
  5972.   end;  //with Sender ...
  5973. end; {ItemOnClick}
  5974.  
  5975. procedure TLsFilelistView28PopUp.PopUp(X, Y: integer);
  5976. var
  5977.   i: integer;
  5978.   Ext: string;
  5979. begin
  5980.   Ext := '';
  5981.   if (FFileListView.Selected <> nil) then
  5982.     Ext := (Uppercase(ExtractFileExt(FFileListView.Selected.SubItems[4]))
  5983.       );
  5984.   Items[0].Enabled := FFileListView.Selected <> nil;
  5985.   Items[1].Enabled := False;
  5986.   if (FFileListView.Selected <> nil) then
  5987.   begin
  5988.     for i := Low(FileExt) to High(FileExt) do
  5989.       if (Ext = FileExt[i]) then
  5990.         Items[1].Enabled := True;
  5991.   end;
  5992.   Items[3].Enabled := FFileListView.Selected <> nil;
  5993.   Items[5].Enabled := FFileListView.Selected <> nil;
  5994.   Items[6].Enabled := FFileListView.Selected <> nil;
  5995.   Items[7].Enabled := FFileListView.FSelectedFiles.Count <> 0;
  5996.   Items[9].Enabled := (FFileListView.Selected <> nil) and
  5997.     (FFileListView.SelCount = 1);
  5998.   Items[10].Enabled := FFileListView.Selected <> nil;
  5999.   Items[12].Enabled := FFileListView.Selected <> nil;
  6000.   Items[14].Enabled := UpperCase(FFileListView.Directory) <> 'DRIVES';
  6001.  
  6002.   Items[3][0].Enabled := FFileListView.Selected <> nil;
  6003.   Items[3][1].Enabled := False;  //85 >>
  6004.   if (FFileListView.Selected <> nil) and (FFileListView.SelCount = 1) then
  6005.   begin
  6006.     for i := Low(FileExt) to (High(FileExt) - 2) do
  6007.       if (Ext = FileExt[i]) or (Ext = '.RTF') or (Ext = '.WMF') then
  6008.         Items[3][1].Enabled := True;
  6009.   end; //85
  6010.   Items[3][2].Enabled := FFileListView.Selected <> nil;
  6011.   Items[3][3].Enabled := FFileListView.Selected <> nil;
  6012.   inherited Popup(X + 10, Y + 10);
  6013. end; {PopUp}
  6014.  
  6015. ///// End of TLsFilelistView28PopUp /////
  6016.  
  6017.  
  6018. { ============================= Register =============================== }
  6019.  
  6020. procedure Register;
  6021. begin
  6022.   RegisterComponents('LsComp', [TLsDirTree21]);
  6023.   RegisterComponents('LsComp', [TLsDirTreeCombo28]);
  6024.   RegisterComponents('LsComp', [TLsFilelistView28]);
  6025. end;
  6026.  
  6027.  
  6028. end.
  6029.  
  6030.  
  6031.  
  6032.