cdar

view 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 source
1 unit unit_Editor_as_BrowseDir;
3 interface//####################################################################################
5 uses
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, Buttons, FileCtrl;
9 type
10 Tform_Editor_as_BrowseDir = class(TForm)
11 dirlbx_1: TDirectoryListBox;
12 tbx_Path: TEdit;
13 btn_NewDir: TBitBtn;
14 btn_Apply: TButton;
15 btn_Cancel: TButton;
16 dcobx_1: TDriveComboBox;
17 procedure FormCreate(Sender: TObject);
18 procedure FormShow(Sender: TObject);
19 procedure FormClose(Sender: TObject; var Action: TCloseAction);
20 procedure dcobx_1Change(Sender: TObject);
21 procedure btn_NewDirClick(Sender: TObject);
22 procedure btn_ApplyClick(Sender: TObject);
23 procedure dirlbx_1Change(Sender: TObject);
24 procedure btn_CancelClick(Sender: TObject);
25 private
26 { Private declarations }
27 public
28 { Public declarations }
29 end;
31 var
32 form_Editor_as_BrowseDir: Tform_Editor_as_BrowseDir;
34 implementation//###############################################################################
35 uses unit_Editor_as, unit_Start, unit_Editor;
36 {$R *.dfm}//###################################################################################
38 //------------------------------------------------------------------------------ Form Create
39 procedure Tform_Editor_as_BrowseDir.FormCreate(Sender: TObject);
40 begin
41 // disable autorun settings
42 form_editor_as.Enabled := false;
44 // set language
45 if form_editor.englisch = true then
46 begin // English
47 form_editor_as_BrowseDir.Caption := 'Chose Directory';
48 btn_NewDir.Caption := 'Create new Dir';
49 btn_Apply.Caption := 'Apply Changes';
50 btn_Cancel.Caption := 'Cancel Changes';
51 end
52 else
53 begin // German
54 form_editor_as_BrowseDir.Caption := 'Wähle ein Verzeichnis';
55 btn_NewDir.Caption := 'Ordner erstellen';
56 btn_Apply.Caption := 'Übernehmen';
57 btn_Cancel.Caption := 'Abbrechen';
58 end;
59 end;//--------------------------------------------------------------------------
60 //------------------------------------------------------------------------------ Form Show
61 procedure Tform_Editor_as_BrowseDir.FormShow(Sender: TObject);
62 var i : integer;
63 typ : cardinal;
64 begin
65 {
66 // dont show floppy and cdrom drives
67 for i := 0 to 25 do
68 begin
69 typ := getdrivetype(pchar(chr(i + 65) + ':\')) ;
70 if (typ = Drive_Removable) or (typ = Drive_CDRom) then
71 begin
72 dcobx_1.Drive := chr(i+65); // this must be avoided
73 dcobx_1.Items.Delete(dcobx_1.ItemIndex); // how to delete without setting the item??
74 end;
75 end;
76 }
77 // Init
78 dcobx_1.Drive := 'c';
79 dirlbx_1.Drive := 'c';
80 tbx_path.Text := dirlbx_1.Directory;
81 end;//--------------------------------------------------------------------------
82 //------------------------------------------------------------------------------ Form Close
83 procedure Tform_Editor_as_BrowseDir.FormClose(Sender: TObject;
84 var Action: TCloseAction);
85 begin
86 // activate autorun settings
87 form_editor_as.enabled := true;
88 end;//--------------------------------------------------------------------------
90 //#############################################################################################
92 //------------------------------------------------------------------------------ Change Drive
93 procedure Tform_Editor_as_BrowseDir.dcobx_1Change(Sender: TObject);
94 begin
95 dirlbx_1.Drive := dcobx_1.drive ;
96 dirlbx_1.Refresh;
97 end;//--------------------------------------------------------------------------
98 //------------------------------------------------------------------------------ Change Dir
99 procedure Tform_Editor_as_BrowseDir.dirlbx_1Change(Sender: TObject);
100 begin
101 tbx_path.Text := dirlbx_1.Directory;
102 end;//--------------------------------------------------------------------------
104 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
106 //------------------------------------------------------------------------------ New Dir
107 procedure Tform_Editor_as_BrowseDir.btn_NewDirClick(Sender: TObject);
108 var NewDir : string;
109 begin
110 // create new dir
111 if form_editor.englisch = true then
112 begin // english
113 if inputquery('Create new Dir','Enter the name of the new Dir', NewDir) then
114 begin
115 if not directoryexists(dirlbx_1.directory + '\' + NewDir) then
116 begin
117 mkdir(dirlbx_1.directory + '\' + NewDir);
118 end;
119 end;
120 end
121 else
122 begin // German
123 if inputquery('Neuen Ordner erstellen','Name des neuen Ordners', NewDir) then
124 begin
125 if not directoryexists(dirlbx_1.directory + '\' + NewDir) then
126 begin
127 mkdir(dirlbx_1.directory + '\' + NewDir);
128 end;
129 end;
130 end;
131 // go to new dir and refresh
132 dirlbx_1.Directory := dirlbx_1.directory + '\' + NewDir;
133 dirlbx_1.Update;
134 end;//--------------------------------------------------------------------------
136 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
138 //------------------------------------------------------------------------------ apply
139 procedure Tform_Editor_as_BrowseDir.btn_ApplyClick(Sender: TObject);
140 begin
141 form_editor_as.tbx_CDRootPath.Text := tbx_path.text;
142 form_editor_as_browsedir.Close;
143 end;//--------------------------------------------------------------------------
144 //------------------------------------------------------------------------------ cancel
145 procedure Tform_Editor_as_BrowseDir.btn_CancelClick(Sender: TObject);
146 begin
147 form_editor_as_browsedir.Close;
148 end;//--------------------------------------------------------------------------
150 end.//#########################################################################################