📄 ulistboxfrm.pas
字号:
for i:=0 to PlugList.Count-1 do
begin
if not ISecPlug(PlugList[i]).DisplayInMenu then
continue;
if (integer(ISecPlug(PlugList[i]).PlugType)=-ID)
or ((ISecPlug(PlugList[i]).PlugType=ptFolder) and (ID>=0)) then
begin
s:=ListWindow.Selected.Caption+#13;
for j:=0 to ListWindow.Selected.SubItems.Count-1 do
s:=s+ListWindow.Selected.SubItems[j]+#13;
ISecPlug(PlugList[i]).MenuPopup(VarArrayOf([s]),PlugName,ItemHeight,ItemWidth);
if ISecPlug(PlugList[i]).DrawMenu then
for j:=0 to PopMenu.Items.Count-1 do
begin
if PopMenu.Items[j].Name=PlugName+'_D' then
begin
TSpTBXItem(PopMenu.Items[j]).Visible:=true;
TSpTBXItem(PopMenu.Items[j]).MinHeight:=ItemHeight;
TSpTBXItem(PopMenu.Items[j]).MinWidth:=ItemWidth;
end;
end;
end;
end;
end;
end;
finally
Screen.Cursor:=crDefault;
end;
end;
procedure TListBoxfrm.FormShow(Sender: TObject);
begin
TBXSetTheme('Aluminum');
PanSearch.Visible:=false;
end;
procedure TListBoxfrm.SpTBXItem14Click(Sender: TObject);
begin
PanSearch.Visible:=not PanSearch.Visible;
SpTBXItem14.Checked:=not SpTBXItem14.Checked;
ListWindow.Arrange(arDefault);
end;
procedure TListBoxfrm.AfterInitData;
begin
inherited;
end;
procedure TListBoxfrm.InitData;
var
i:integer;
begin
inherited;
Caption:=ExpMgr.ITheOprList.Caption;
ExpMgr.RefreshList;
PlugList:=ExpMgr.PlugList;
for i:=0 to PlugList.Count-1 do
begin
if (integer(ISecPlug(PlugList[i]).PlugType)=-ID)
or ((ISecPlug(PlugList[i]).PlugType=ptFolder) and (ID>=0)) then
begin
CreatePlugBtn(ISecPlug(PlugList[i]));
end;
end;
ExpMgr.ITheOprList.CreatewMenu(ID,caption);
for i:=0 to ListWindow.Columns.Count-1 do
begin
VL.Strings.Add(ListWindow.Columns[i].Caption+'=');
end;
end;
procedure TListBoxfrm.FormActivate(Sender: TObject);
begin
if ExpMgr<>nil then
ExpMgr.ITheOprList.RefreshwMenu(ID,ID,caption);
end;
procedure TListBoxfrm.TBXButton1Click(Sender: TObject);
const
reslutcount='(共找到%d个)';
begin
ListView1.Clear;
Search;
Label2.Caption:=format(reslutcount,[ListView1.items.count]);
end;
procedure TListBoxfrm.Search;
var
i,j:integer;
flag:Boolean;
value:string;
Item:TListItem;
ListCaption:string;
begin
for i:=0 to ListWindow.Items.Count-1 do
begin
flag:=true;
for j:=0 to ListWindow.Columns.Count-1 do
begin
value:=AnsiUpperCase(vl.Values[ListWindow.Columns[j].caption]);
if trim(value)='' then
continue;
if j=0 then
ListCaption:=AnsiUpperCase(ListWindow.Items[i].Caption)
else
ListCaption:=AnsiUpperCase(ListWindow.Items[i].SubItems[j-1]);
flag:=(pos(value,ListCaption)>0) and flag;
end;
if flag then
begin
Item:=ListView1.Items.Add;
Item.Assign(ListWindow.Items[i]);
end;
end;
end;
procedure TListBoxfrm.ListView1DblClick(Sender: TObject);
begin
if ListView1.Selected<>nil then
ExpMgr.ExecWhenDBClick(ListView1.Selected.Data);
end;
procedure TListBoxfrm.TBXItem2Click(Sender: TObject);
begin
if ListView1.Selected<>nil then
ExpMgr.ExecWhenDBClick(ListView1.Selected.Data);
end;
procedure TListBoxfrm.TBXItem1Click(Sender: TObject);
begin
if ListView1.Selected<>nil then
if ExpMgr.ITheOprList.Createfrm(ListView1.Selected.Data,cdEdit,ExpMgr.ThefrmType) then
begin
ExpMgr.RefreshList;
end
end;
procedure TListBoxfrm.PanSearchClose(Sender: TObject);
begin
SpTBXItem14.Checked:=false;
end;
procedure TListBoxfrm.SpTBXItem15Click(Sender: TObject);
begin
if ListWindow.Selected<>nil then
ExpMgr.ExecWhenDBClick(ListWindow.Selected.Data);
end;
procedure TListBoxfrm.AddSubMenu;
var
Item:TSpTBXItem;
begin
Item:=TSpTBXItem.Create(imAdd);
Item.Caption:='文件夹';
Item.Tag:=0;
Item.OnClick:=DoOnAddSubMenuClick;
imAdd.Add(Item);
Item:=TSpTBXItem.Create(imAdd);
Item.Caption:='文件';
Item.Tag:=1;
Item.OnClick:=DoOnAddSubMenuClick;
imAdd.Add(Item);
end;
procedure TListBoxfrm.DoOnAddSubMenuClick(sender: TObject);
begin
if ExpMgr is TExpFolderMgr then
begin
ExpMgr.ITheOprList.AddNode(ExpMgr.Params[0],TSpTBXItem(Sender).tag);
ExpMgr.RefreshList;
end;
end;
procedure TListBoxfrm.DoPlugExecute(sender: TObject);
var
i:integer;
begin
if PlugList<>nil then
begin
for i:=0 to PlugList.Count-1 do
begin
if TSpTBXItem(sender).Name=ISecPlug(PlugList[i]).Name then
begin
ISecPlug(PlugList[i]).HostForm:=self;
ISecPlug(PlugList[i]).HostID:=ID;
ISecPlug(PlugList[i]).Execute;
break;
end;
end;
end;
end;
procedure TListBoxfrm.CreatePlugBtn(ASecPlug: ISecPlug);
begin
CreateToolBarBtn(SpTBXDock1,0,100,PlugToolbar,ASecPlug,DoPlugExecute);
PlugToolbar.DockMode:=dmCannotFloat;
CreateToolPopupMenuItem(PopMenu,ASecPlug,DoPlugAction,DoDrawMenuItem);
end;
procedure TListBoxfrm.DeletePlugBtn(AName:widestring);
begin
DeleteToolBarBtn(PlugToolBar,AName);
DeleteToolPopupMenuItem(PopMenu,AName);
end;
procedure TListBoxfrm.ListWindowColumnClick(Sender: TObject;
Column: TListColumn);
begin
ListWindow.CustomSort(nil,Column.Index);
IsAscending:=not IsAscending;
end;
procedure TListBoxfrm.ListWindowCompare(Sender: TObject; Item1,
Item2: TListItem; Data: Integer; var Compare: Integer);
var
s1,s2:string;
begin
if Data=0 then
begin
s1:=Item1.Caption;
s2:=Item2.Caption;
end
else
begin
s1:=Item1.SubItems.Strings[Data-1];
s2:=Item2.SubItems.Strings[Data-1];
end;
if IsAscending then
begin
if (Data=0) and (ExpMgr is TExpFolderMgr) then
begin
if Item1.ImageIndex>Item2.ImageIndex then
Compare:=1
else if Item1.ImageIndex<Item2.ImageIndex then
Compare:=-1
else
Compare:=CompareText(s1,s2);
end
else
Compare:=CompareText(s1,s2);
end
else
begin
if (Data=0) and (ExpMgr is TExpFolderMgr) then
begin
if Item1.ImageIndex>Item2.ImageIndex then
Compare:=-1
else if Item1.ImageIndex<Item2.ImageIndex then
Compare:=1
else
Compare:=CompareText(s2,s1);
end
else
Compare:=CompareText(s2,s1);
end;
end;
procedure TListBoxfrm.DoPlugAction(sender: TObject);
var
i,j:integer;
s:string;
begin
if ListWindow.Selected=nil then
exit;
if PlugList<>nil then
begin
for i:=0 to PlugList.Count-1 do
begin
if TSpTBXItem(sender).Name=ISecPlug(PlugList[i]).Name then
begin
s:=ListWindow.Selected.Caption+#13;
for j:=0 to ListWindow.Selected.SubItems.Count-1 do
begin
s:=s+ListWindow.Selected.SubItems[j]+#13;
end;
ISecPlug(PlugList[i]).Action(VarArrayOf([s]));
break;
end;
end;
end;
end;
procedure TListBoxfrm.DoDrawMenuItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ItemInfo: TTBXItemInfo; const PaintStage: TSpTBXPaintStage;
var PaintDefault: Boolean);
begin
DrawMenuItem(TSpTBXItem(sender).Name,PlugList,ACanvas,ARect);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -