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