cdar
diff unit_Editor_as_BrowseDir.pas @ 0:ef71164288c1
begin of using hg for cdar
author | "Meillo r e t u r n s <meillo@marmaro.de>" |
---|---|
date | Sun, 03 Dec 2006 21:54:43 +0100 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/unit_Editor_as_BrowseDir.pas Sun Dec 03 21:54:43 2006 +0100 1.3 @@ -0,0 +1,150 @@ 1.4 +unit unit_Editor_as_BrowseDir; 1.5 + 1.6 +interface//#################################################################################### 1.7 + 1.8 +uses 1.9 + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 1.10 + Dialogs, StdCtrls, Buttons, FileCtrl; 1.11 + 1.12 +type 1.13 + Tform_Editor_as_BrowseDir = class(TForm) 1.14 + dirlbx_1: TDirectoryListBox; 1.15 + tbx_Path: TEdit; 1.16 + btn_NewDir: TBitBtn; 1.17 + btn_Apply: TButton; 1.18 + btn_Cancel: TButton; 1.19 + dcobx_1: TDriveComboBox; 1.20 + procedure FormCreate(Sender: TObject); 1.21 + procedure FormShow(Sender: TObject); 1.22 + procedure FormClose(Sender: TObject; var Action: TCloseAction); 1.23 + procedure dcobx_1Change(Sender: TObject); 1.24 + procedure btn_NewDirClick(Sender: TObject); 1.25 + procedure btn_ApplyClick(Sender: TObject); 1.26 + procedure dirlbx_1Change(Sender: TObject); 1.27 + procedure btn_CancelClick(Sender: TObject); 1.28 + private 1.29 + { Private declarations } 1.30 + public 1.31 + { Public declarations } 1.32 + end; 1.33 + 1.34 +var 1.35 + form_Editor_as_BrowseDir: Tform_Editor_as_BrowseDir; 1.36 + 1.37 +implementation//############################################################################### 1.38 +uses unit_Editor_as, unit_Start, unit_Editor; 1.39 +{$R *.dfm}//################################################################################### 1.40 + 1.41 +//------------------------------------------------------------------------------ Form Create 1.42 +procedure Tform_Editor_as_BrowseDir.FormCreate(Sender: TObject); 1.43 +begin 1.44 + // disable autorun settings 1.45 + form_editor_as.Enabled := false; 1.46 + 1.47 + // set language 1.48 + if form_editor.englisch = true then 1.49 + begin // English 1.50 + form_editor_as_BrowseDir.Caption := 'Chose Directory'; 1.51 + btn_NewDir.Caption := 'Create new Dir'; 1.52 + btn_Apply.Caption := 'Apply Changes'; 1.53 + btn_Cancel.Caption := 'Cancel Changes'; 1.54 + end 1.55 + else 1.56 + begin // German 1.57 + form_editor_as_BrowseDir.Caption := 'Wähle ein Verzeichnis'; 1.58 + btn_NewDir.Caption := 'Ordner erstellen'; 1.59 + btn_Apply.Caption := 'Übernehmen'; 1.60 + btn_Cancel.Caption := 'Abbrechen'; 1.61 + end; 1.62 +end;//-------------------------------------------------------------------------- 1.63 +//------------------------------------------------------------------------------ Form Show 1.64 +procedure Tform_Editor_as_BrowseDir.FormShow(Sender: TObject); 1.65 + var i : integer; 1.66 + typ : cardinal; 1.67 +begin 1.68 +{ 1.69 + // dont show floppy and cdrom drives 1.70 + for i := 0 to 25 do 1.71 + begin 1.72 + typ := getdrivetype(pchar(chr(i + 65) + ':\')) ; 1.73 + if (typ = Drive_Removable) or (typ = Drive_CDRom) then 1.74 + begin 1.75 + dcobx_1.Drive := chr(i+65); // this must be avoided 1.76 + dcobx_1.Items.Delete(dcobx_1.ItemIndex); // how to delete without setting the item?? 1.77 + end; 1.78 + end; 1.79 +} 1.80 + // Init 1.81 + dcobx_1.Drive := 'c'; 1.82 + dirlbx_1.Drive := 'c'; 1.83 + tbx_path.Text := dirlbx_1.Directory; 1.84 +end;//-------------------------------------------------------------------------- 1.85 +//------------------------------------------------------------------------------ Form Close 1.86 +procedure Tform_Editor_as_BrowseDir.FormClose(Sender: TObject; 1.87 + var Action: TCloseAction); 1.88 +begin 1.89 + // activate autorun settings 1.90 + form_editor_as.enabled := true; 1.91 +end;//-------------------------------------------------------------------------- 1.92 + 1.93 +//############################################################################################# 1.94 + 1.95 +//------------------------------------------------------------------------------ Change Drive 1.96 +procedure Tform_Editor_as_BrowseDir.dcobx_1Change(Sender: TObject); 1.97 +begin 1.98 + dirlbx_1.Drive := dcobx_1.drive ; 1.99 + dirlbx_1.Refresh; 1.100 +end;//-------------------------------------------------------------------------- 1.101 +//------------------------------------------------------------------------------ Change Dir 1.102 +procedure Tform_Editor_as_BrowseDir.dirlbx_1Change(Sender: TObject); 1.103 +begin 1.104 + tbx_path.Text := dirlbx_1.Directory; 1.105 +end;//-------------------------------------------------------------------------- 1.106 + 1.107 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1.108 + 1.109 +//------------------------------------------------------------------------------ New Dir 1.110 +procedure Tform_Editor_as_BrowseDir.btn_NewDirClick(Sender: TObject); 1.111 + var NewDir : string; 1.112 +begin 1.113 + // create new dir 1.114 + if form_editor.englisch = true then 1.115 + begin // english 1.116 + if inputquery('Create new Dir','Enter the name of the new Dir', NewDir) then 1.117 + begin 1.118 + if not directoryexists(dirlbx_1.directory + '\' + NewDir) then 1.119 + begin 1.120 + mkdir(dirlbx_1.directory + '\' + NewDir); 1.121 + end; 1.122 + end; 1.123 + end 1.124 + else 1.125 + begin // German 1.126 + if inputquery('Neuen Ordner erstellen','Name des neuen Ordners', NewDir) then 1.127 + begin 1.128 + if not directoryexists(dirlbx_1.directory + '\' + NewDir) then 1.129 + begin 1.130 + mkdir(dirlbx_1.directory + '\' + NewDir); 1.131 + end; 1.132 + end; 1.133 + end; 1.134 + // go to new dir and refresh 1.135 + dirlbx_1.Directory := dirlbx_1.directory + '\' + NewDir; 1.136 + dirlbx_1.Update; 1.137 +end;//-------------------------------------------------------------------------- 1.138 + 1.139 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1.140 + 1.141 +//------------------------------------------------------------------------------ apply 1.142 +procedure Tform_Editor_as_BrowseDir.btn_ApplyClick(Sender: TObject); 1.143 +begin 1.144 + form_editor_as.tbx_CDRootPath.Text := tbx_path.text; 1.145 + form_editor_as_browsedir.Close; 1.146 +end;//-------------------------------------------------------------------------- 1.147 +//------------------------------------------------------------------------------ cancel 1.148 +procedure Tform_Editor_as_BrowseDir.btn_CancelClick(Sender: TObject); 1.149 +begin 1.150 + form_editor_as_browsedir.Close; 1.151 +end;//-------------------------------------------------------------------------- 1.152 + 1.153 +end.//#########################################################################################