📄 main.pas
字号:
end;
procedure TMainForm.Menu_AboutClick(Sender: TObject);
begin
AboutForm.Show;
end;
procedure TMainForm.IconCheckBoxClick(Sender: TObject);
begin
bSysIcon:=IconCheckBox.Checked;
end;
procedure TMainForm.AllListBoxDblClick(Sender: TObject);
var
fn,dn : string;
Exe : TExecuteThread;
begin
//caption:=inttostr(AllListBox.SelCount);
if AllListBox.SelCount >0 then
begin
fn:= AllListBox.Items[AllListbox.ItemIndex];
dn:=extractfilepath(fn);
Exe:=TExecuteThread.Create(true);
Exe.exeFile := fn;
Exe.exeDir := dn;
Exe.FreeOnTerminate := true;
Exe.Resume;
end;
end;
procedure TMainForm.MyBottomListViewClick(ListView:TListView);
var
Exe: TExecuteThread;
begin
if ListView.SelCount <>0 then
begin
Exe:=TExecuteThread.Create(true);
Exe.exeFile := trim(ListView.Selected.SubItems[0])+'\'+ListView.Selected.Caption;
Exe.exeDir := extractfilepath(Exe.exeFile);
//caption:=exe.exeFile;
with ListView.Selected do
begin
if ImageIndex=1 then ImageIndex := 17 else
if ImageIndex=17 then ImageIndex := 1 else
if ImageIndex=0 then ImageIndex:=10;
end;
Exe.FreeOnTerminate := true;
Exe.Resume;
end;
end;
procedure TMainForm.FindListViewDblClick(Sender: TObject);
begin
MyBottomListViewClick(FindListView);
end;
procedure TMainForm.Mp3ListViewDblClick(Sender: TObject);
begin
MyBottomListViewClick(Mp3ListView);
end;
procedure TMainForm.MovieListViewDblClick(Sender: TObject);
begin
MyBottomListViewClick(MovieListView);
end;
procedure TMainForm.BottomPopupMenuPopup(Sender: TObject);
var
i: integer;
begin
N_BottomCopyTo.Enabled := true;
N_SaveAll.Enabled := true;
N_BottomOpen.Enabled := false;
N_BottomCopy.Enabled := true;
N_BottomFileSize.Enabled := true;
N_BottomOpenDir.Enabled := false;
case BottomPageCtrl.ActivePageIndex of
0: begin
CurBottomListView:=nil;
if AllListBox.Items.Count=0 then
begin
N_SaveAll.Enabled := false;
end;
if AllListBox.SelCount <=0 then
begin
N_BottomCopyTo.Enabled := false;
N_BottomCopy.Enabled := false;
N_BottomFileSize.Enabled := false;
end
else
begin
if AllListBox.SelCount=1 then
begin
N_BottomOpen.Enabled := true;
N_BottomOpenDir.Enabled := true;
end;
for i:=1 to AllListBox.Items.Count do
begin
if AllListBox.Selected[i-1] then
if AllListBox.Items[i-1][length(AllListBox.Items[i-1])]='\'
then N_BottomCopyTo.Enabled := false;
end;
end;
end;
1: CurBottomListView:= FindListView;
2: CurBottomListView:= Mp3ListView;
3: CurBottomListView:= MovieListView;
end; //end of case
if CurBottomListView<>nil then
begin
if CurBottomListView.Items.Count=0 then
begin
N_SaveAll.Enabled := false;
end;
if CurBottomListView.SelCount<=0 then
begin
N_BottomCopyTo.Enabled := false;
N_BottomCopy.Enabled := false;
N_BottomFileSize.Enabled := false;
end
else
begin
if CurBottomListView.SelCount=1 then
begin
N_BottomOpen.Enabled := true;
N_BottomOpenDir.Enabled := true;
end;
for i:=1 to CurBottomListView.Items.Count do
if (CurBottomListView.Items[i-1].Selected)and(CurBottomListView.Items[i-1].ImageIndex=0)
then N_BottomCopyTo.Enabled := false;
end;
end;
end;
procedure TMainForm.N_BottomOpenClick(Sender: TObject);
begin
case BottomPageCtrl.ActivePageIndex of
0: AllListBoxDblClick(Self);
1: FindListViewDblClick(Self);
2: Mp3ListViewDblClick(Self);
3: MovieListViewDblClick(Self);
end; //end of case
end;
procedure TMainForm.N_BottomCopyClick(Sender: TObject);
var
FileName : string;
i : integer;
begin
if CurBottomListView=nil
then
begin
FileName:='';
for i:=1 to AllListBox.Items.Count do
if AllListBox.Selected[i-1]
then FileName:=FileName+AllListBox.Items[i-1]+#0;
CopyToClipBoard(FileName, Handle);
end
else
begin
FileName:='';
for i:=1 to CurBottomListView.Items.Count do
if CurBottomListView.Items[i-1].Selected
then FileName:=CurBottomListView.Items[i-1].SubItems[0]+'\'+CurBottomListView.Items[i-1].Caption;
CopyToClipBoard(FileName, Handle);
end;
end;
procedure TMainForm.N_BottomFileSizeClick(Sender: TObject);
var
fulls : string;
i,size,SelCount : integer;
begin
size:=0;
if CurBottomListView<>nil then
begin
SelCount:= CurBottomListView.selcount;
for i:=1 to CurBottomListView.Items.Count do
begin
if CurBottomListView.Items[i-1].Selected
then
begin
fulls:=CurBottomListView.Items[i-1].SubItems[0]+'\'+CurBottomListView.Items[i-1].Caption;
if CurBottomListView.Items[i-1].ImageIndex=1
then size:=size+ GetFileSize(fulls)
else size:=size+ GetDirectorySize(fulls)
end;
end;
end
else // in listbox
begin
SelCount:=AllListBox.SelCount;
for i:=1 to AllListBox.Items.Count do
begin
if AllListBox.Selected[i-1]
then
begin
fulls:=AllListBox.Items[i-1];
if fulls[length(fulls)]<>'\' then size:=size+ GetFileSize(fulls)
else size:=size+ GetDirectorySize(fulls)
end;
end;
end;
ShowMessage(inttostr(SelCount)+' 个文件(夹)'+FormatFloat('#,###" KB"', size/ 1024)
+'('+inttostr(size)+'字节)');
end;
procedure TMainForm.N_BottomCopyToClick(Sender: TObject);
var
i,j : integer;
b : boolean;
tems : string;
TemListItem : TListItem;
begin
with CopyToForm do
begin
for j:=1 to CopyListview.Items.Count do
begin
if CopyListview.Items[j-1].ImageIndex = 24 then CopyListview.Items[j-1].Delete;
end;
Show;
caption:='拷贝文件';
Label2.Caption:='Any Where';
//listview1.Items.Clear;
//caption:=inttostr(CurListView.SelCount);
if CurBottomListView<>nil then
for i:=1 to CurBottomListView.Items.Count do
begin
if CurBottomListView.Items[i-1].Selected
then
begin
tems:= CurBottomListView.Items[i-1].SubItems[0];
if tems[length(tems)]<>'\'
then tems:= CurBottomListView.Items[i-1].SubItems[0]+'\'+CurBottomListView.Items[i-1].Caption
else tems:= CurBottomListView.Items[i-1].SubItems[0]+CurBottomListView.Items[i-1].Caption;
b:=false;
for j:=1 to CopyListview.Items.Count do
begin
if tems = CopyListview.Items[j-1].Caption then b:=true;
//if listview1.Items[j-1].ImageIndex = 24 then listview1.Items[j-1].Delete;
end;
if not b then
begin
temListItem:=CopyListview.Items.Add;
temListItem.ImageIndex := 22;
temListItem.Caption := tems;
temListItem.SubItems.Add('尚未开始');
end;
end;
end
else
for i:=1 to AllListBox.Items.Count do
begin
if AllListBox.Selected[i-1]
then
begin
tems:=AllListBox.Items[i-1];
b:=false;
for j:=1 to CopyListview.Items.Count do
begin
if tems=CopyListview.Items[j-1].Caption then b:=true;
end;
if not b then
begin
temListItem:=CopyListview.Items.Add;
temListItem.ImageIndex := 22;
temListItem.Caption := tems;
temListItem.SubItems.Add('尚未开始');
end;
end;
end;
Combobox1.text:=ExtractFilepath(Combobox1.text);
BtnCancel.Caption := '取消';
//speedbutton3.Enabled := true;
ComboBox1.Items.Add(combobox1.text);
Label4.Caption := '共'+inttostr(CopyListView.Items.Count)+'个文件';
end; //end of with
end;
procedure TMainForm.FormResize(Sender: TObject);
begin
ShareListView.Width := AllFileTabSheet.Width div 2;
with Statusbar do
Panels[2].Width := Width- Panels[0].Width
- Panels[1].Width
- Panels[3].Width;
//- Panels[4].Width;
end;
procedure TMainForm.N_PropertyClick(Sender: TObject);
begin
GetFileProperty(CurDirName+CurListView.Selected.Caption, Handle);
end;
procedure TMainForm.LanTreePopupMenuPopup(Sender: TObject);
const
refresh_img_set= [8,9,10,11,14,15,26,27,28,29,31];
host_set=[7,8,12,15,26,27,28,29];
begin
N_Del.Enabled := false;
N_Begin_Search_With.Enabled := false;
N_Clear.Enabled := false;
N_SaveTree.Enabled := false;
case LeftPageCtrl.ActivePageIndex of
0: begin
case SearchPageCtrl.ActivePageIndex of
0:
begin
CurTree := SearchTree;
if SearchTree.Selected<>nil then
if SearchTree.Selected.ImageIndex = 5 then N_Begin_Search_With.Enabled := true;
end;
1:
begin
CurTree := IpTree;
if IpTree.Selected<>nil then
if IpTree.Selected.ImageIndex = 7 then N_Begin_Search_With.Enabled := true;
end;
end; // end of case
end;
1: begin
CurTree:=FavoTree;
if (FavoTree.Selected <> nil)and(FavoTree.Selected.Level = 1) then
begin
N_Del.Enabled := true;
N_Del.Caption := '删除 '+ FavoTree.Selected.Text;
//TemTreeNode:=FavoTree.Selected;
end;
N_Clear.Enabled := true;
end;
2: CurTree:=FindTree;
3: begin
CurTree := HistoryTree;
if (HistoryTree.Selected <> nil)and
((HistoryTree.Selected.Level = 1)or(HistoryTree.Selected.Level = 2)) then
begin
N_Del.Enabled := true;
N_Del.Caption := '删除 '+ HistoryTree.Selected.Text;
//TemTreeNode:=HistoryTree.Selected;
end;
N_Clear.Enabled := true;
if HistoryTree.Selected.ImageIndex = 7 then N_Begin_Search_With.Enabled := true; ///
end;
end;//end of case
N_LanTreeRefresh.Enabled := false;
N_SaveFavo.Enabled := false;
N_FindIP.Enabled := false;
N_SendMsg.Enabled := false;
if (CurTree.Items.Count <> 0)and(CurTree.Items[0].HasChildren)
then N_SaveTree.Enabled := true;
if CurTree.Selected <> nil then
begin
TemTreeNode:=CurTree.Selected;
TemTreeNode.Selected := true;
if TemTreeNode.level=0 then exit; //!!!
if LeftPageCtrl.ActivePageIndex<>1 then N_SaveFavo.Enabled := true;
if TemTreeNode.ImageIndex in refresh_img_set then N_LanTreeRefresh.Enabled := true;
if (TemTreeNode.ImageIndex in host_set)and(CurTree <> IpTree) then N_FindIP.Enabled := true;
if (TemTreeNode.ImageIndex in host_set) then N_SendMsg.Enabled := true;
end;
end;
procedure TMainForm.N_LanTreeRefreshClick(Sender: TObject);
var
beFolder : boolean;
i : integer;
begin
//ShowMessage(TemTreeNode.Text);
TemTreeNode.Selected := true;
//note:img_set= [8,9,10,11,14,15,26,27,28,29,31];
beFolder:=false;
Case TemTreeNode.ImageIndex of
8,15,26,27,28,29: //host
begin
TemTreeNode.ImageIndex:=7;
if TemTreeNode.Count <> 0 then
for i := 0 to TemTreeNode.Count - 1 do DisposeTreeNodeData(TemTreeNode.Item[i]);
TemTreeNode.DeleteChildren;
end;
9,14: //group
begin
TemTreeNode.ImageIndex:=5;
if TemTreeNode.Count <> 0 then
for i := 0 to TemTreeNode.Count - 1 do DisposeTreeNodeData(TemTreeNode.Item[i]);
TemTreeNode.DeleteChildren;
end;
10,11,31: beFolder:=true;//N_RefreshClick(Self); //folder
end; //end of case
LanTreeClick(CurTree);
if beFolder then
begin
// here may be bugs, tree not refresh...
CurDirName:= pTabData(ClientPageCtrl.ActivePage.Tag).MyDir+'\';
CurGroupName :=pTabData(ClientPageCtrl.ActivePage.Tag).MyGroup;
CurRlistItem :=pTabData(ClientPageCtrl.ActivePage.Tag).MyRListItem;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -