This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainfrm.pas
167 lines (144 loc) · 3.42 KB
/
mainfrm.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
unit mainfrm;
interface
uses
panelfr,
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Menus, ComCtrls, ExtCtrls, StdCtrls, ToolWin;
type
TfMain = class(TForm)
mmMain: TMainMenu;
Dosya1: TMenuItem;
Duzen1: TMenuItem;
Yardim1: TMenuItem;
PitikareCommanderHakkinda1: TMenuItem;
Biiileryap1: TMenuItem;
N1: TMenuItem;
Programdancik1: TMenuItem;
Bunelan1: TMenuItem;
cbConsole: TCoolBar;
pConsole: TPanel;
memConsole: TMemo;
procedure FormShow(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure PitikareCommanderHakkinda1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
public
procedure RefreshPanels;
procedure AddPanel(const location:string);
function getTargetPanel:TfrPanel;
function askDestination(const title:string; var path:string):boolean;
procedure doCopy;
end;
var
fMain: TfMain;
implementation
uses
fs, destfrm, procs, aboutfrm;
{$R *.DFM}
procedure TfMain.AddPanel;
var
Panel:TfrPanel;
i:integer;
begin
Panel := TfrPanel.Create(Self);
i := Panels.Add(Panel);
with Panel do begin
Name := 'p'+IntToStr(i);
Align := alLeft;
Parent := Self;
Width := ClientWidth div 2;
Go(location);
end;
end;
procedure TfMain.FormShow(Sender: TObject);
begin
AddPanel('C:\');
AddPanel('D:\');
// AddPanel('D:\Delphi5\');
end;
procedure TfMain.RefreshPanels;
var
n:integer;
panel:TfrPanel;
begin
for n:=0 to Panels.Count-1 do begin
panel := Panels[n] as TfrPanel;
panel.Rebuild;
end;
end;
procedure TfMain.FormResize(Sender: TObject);
var
n,cnt:integer;
panel:TfrPanel;
begin
cnt := Panels.Count;
for n:=0 to cnt-1 do begin
panel := Panels[n] as TfrPanel;
panel.Width := ClientWidth div cnt;
end;
end;
procedure TfMain.PitikareCommanderHakkinda1Click(Sender: TObject);
begin
Application.CreateForm(TfAbout,fAbout);
fAbout.ShowModal;
fAbout.Free;
end;
procedure TfMain.FormCreate(Sender: TObject);
begin
debug('Init',cApp+' '+cVersion);
end;
procedure TfMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
ctrl:boolean;
begin
ctrl := ssCtrl in Shift;
case Key of
VK_F10 : debug('MemDump','AllocMemCount='+IntToStr(AllocMemCount));
byte('R') : if ctrl and (activePanel <> NIL) then ActivePanel.Rebuild else exit;
VK_F5 : doCopy;
else exit;
end; {case}
Key := 0;
end;
procedure TfMain.doCopy;
var
destPath:string;
targetPanel:TfrPanel;
n:integer;
item:TFSItem;
begin
targetPanel := getTargetPanel;
if targetPanel <> NIL then destPath := targetPanel.ActiveFS.Location;
if not askDestination('Copy to',destPath) then exit;
with ActivePanel.ActiveFS do begin
for n:=0 to Items.Count-1 do begin
item := Items[n] as TFSItem;
if item.Selected then CopyItem(item,destPath+item.Name);
end;
end;
end;
function TfMain.getTargetPanel: TfrPanel;
var
n:integer;
begin
for n:=0 to Panels.Count-1 do begin
Result := Panels[n] as TfrPanel;
if Result <> ActivePanel then exit;
end;
Result := NIL;
end;
function TfMain.askDestination(const title: string;
var path: string): boolean;
begin
Application.CreateForm(TfDest,fDest);
fDest.setData(path);
if fDest.ShowModal = mrOK then begin
path := fDest.getData;
Result := true;
end else Result := false;
fDest.Free;
end;
end.