mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 03:10:30 +02:00
* Context menu for treeview. Adapt some action update handlers to treeview
git-svn-id: trunk@51123 -
This commit is contained in:
parent
d72933eb26
commit
0ef7c72e99
@ -129,10 +129,10 @@ object MainForm: TMainForm
|
|||||||
Height = 418
|
Height = 418
|
||||||
Top = 26
|
Top = 26
|
||||||
Width = 458
|
Width = 458
|
||||||
ActivePage = TSConnections
|
ActivePage = TSAll
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Images = ILMain
|
Images = ILMain
|
||||||
TabIndex = 0
|
TabIndex = 2
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object TSConnections: TTabSheet
|
object TSConnections: TTabSheet
|
||||||
Caption = 'Connections'
|
Caption = 'Connections'
|
||||||
@ -220,6 +220,7 @@ object MainForm: TMainForm
|
|||||||
Align = alClient
|
Align = alClient
|
||||||
DefaultItemHeight = 16
|
DefaultItemHeight = 16
|
||||||
Images = ILMain
|
Images = ILMain
|
||||||
|
PopupMenu = PMAll
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnDblClick = TVAllDblClick
|
OnDblClick = TVAllDblClick
|
||||||
end
|
end
|
||||||
@ -1717,7 +1718,7 @@ object MainForm: TMainForm
|
|||||||
Action = AOpenConnection
|
Action = AOpenConnection
|
||||||
end
|
end
|
||||||
object PMINewConnection: TMenuItem
|
object PMINewConnection: TMenuItem
|
||||||
Caption = '&New connection'
|
Action = ANewConnection
|
||||||
end
|
end
|
||||||
object PMIDeleteConnection: TMenuItem
|
object PMIDeleteConnection: TMenuItem
|
||||||
Action = ADeleteConnection
|
Action = ADeleteConnection
|
||||||
@ -1776,4 +1777,31 @@ object MainForm: TMainForm
|
|||||||
OnClick = ADeleteRecentDataDictExecute
|
OnClick = ADeleteRecentDataDictExecute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object PMAll: TPopupMenu
|
||||||
|
Images = ILMain
|
||||||
|
OnPopup = PMAllPopup
|
||||||
|
left = 152
|
||||||
|
top = 256
|
||||||
|
object PMIOpenConnectionA: TMenuItem
|
||||||
|
Action = AOpenConnection
|
||||||
|
end
|
||||||
|
object PMINewConnectionA: TMenuItem
|
||||||
|
Action = ANewConnection
|
||||||
|
end
|
||||||
|
object PMIDeleteConnectionA: TMenuItem
|
||||||
|
Action = ADeleteConnection
|
||||||
|
end
|
||||||
|
object MenuItem10: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object PMIOpenDataDictA: TMenuItem
|
||||||
|
Action = AOpenRecentDatadict
|
||||||
|
end
|
||||||
|
object PMINewDataDictA: TMenuItem
|
||||||
|
Action = ANew
|
||||||
|
end
|
||||||
|
object PMIDeleteDataDictA: TMenuItem
|
||||||
|
Action = ADeleteRecentDataDict
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -76,6 +76,9 @@ type
|
|||||||
ILMain: TImageList;
|
ILMain: TImageList;
|
||||||
LVConnections: TListView;
|
LVConnections: TListView;
|
||||||
LVDicts: TListView;
|
LVDicts: TListView;
|
||||||
|
MenuItem10: TMenuItem;
|
||||||
|
PMIDeleteDataDictA: TMenuItem;
|
||||||
|
PMINewDataDictA: TMenuItem;
|
||||||
MenuItem2: TMenuItem;
|
MenuItem2: TMenuItem;
|
||||||
MenuItem3: TMenuItem;
|
MenuItem3: TMenuItem;
|
||||||
MenuItem4: TMenuItem;
|
MenuItem4: TMenuItem;
|
||||||
@ -83,12 +86,16 @@ type
|
|||||||
MenuItem6: TMenuItem;
|
MenuItem6: TMenuItem;
|
||||||
MenuItem7: TMenuItem;
|
MenuItem7: TMenuItem;
|
||||||
MenuItem8: TMenuItem;
|
MenuItem8: TMenuItem;
|
||||||
|
PMIOpenDataDictA: TMenuItem;
|
||||||
MIListView: TMenuItem;
|
MIListView: TMenuItem;
|
||||||
MView: TMenuItem;
|
MView: TMenuItem;
|
||||||
MICreateCode: TMenuItem;
|
MICreateCode: TMenuItem;
|
||||||
PCItems: TPageControl;
|
PCItems: TPageControl;
|
||||||
|
PMIDeleteConnectionA: TMenuItem;
|
||||||
PMINewConnection: TMenuItem;
|
PMINewConnection: TMenuItem;
|
||||||
|
PMINewConnectionA: TMenuItem;
|
||||||
PMINewDataDict: TMenuItem;
|
PMINewDataDict: TMenuItem;
|
||||||
|
PMIOpenConnectionA: TMenuItem;
|
||||||
PMIOpenDataDict: TMenuItem;
|
PMIOpenDataDict: TMenuItem;
|
||||||
MIDeleteRecentConnection: TMenuItem;
|
MIDeleteRecentConnection: TMenuItem;
|
||||||
MIOpenRecentConnection: TMenuItem;
|
MIOpenRecentConnection: TMenuItem;
|
||||||
@ -113,6 +120,7 @@ type
|
|||||||
MIDataDict: TMenuItem;
|
MIDataDict: TMenuItem;
|
||||||
PMRecentConnections: TPopupMenu;
|
PMRecentConnections: TPopupMenu;
|
||||||
PMDataDict: TPopupMenu;
|
PMDataDict: TPopupMenu;
|
||||||
|
PMAll: TPopupMenu;
|
||||||
PStatus: TPanel;
|
PStatus: TPanel;
|
||||||
PStatusText: TPanel;
|
PStatusText: TPanel;
|
||||||
PBSTatus: TProgressBar;
|
PBSTatus: TProgressBar;
|
||||||
@ -197,6 +205,7 @@ type
|
|||||||
procedure OpenRecentDatadict(Sender: TObject);
|
procedure OpenRecentDatadict(Sender: TObject);
|
||||||
procedure LVDictsKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure LVDictsKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
procedure MIDataDictClick(Sender: TObject);
|
procedure MIDataDictClick(Sender: TObject);
|
||||||
|
procedure PMAllPopup(Sender: TObject);
|
||||||
procedure SaveAsExecute(Sender: TObject);
|
procedure SaveAsExecute(Sender: TObject);
|
||||||
procedure TVAllDblClick(Sender: TObject);
|
procedure TVAllDblClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
@ -1062,15 +1071,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveRecentConnection(Sender: TObject);
|
procedure TMainForm.HaveRecentConnection(Sender: TObject);
|
||||||
|
Var
|
||||||
|
TN : TTreeNode;
|
||||||
|
LI : TListItem;
|
||||||
|
doEnable: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
(Sender as Taction).Enabled:=(LVConnections.Selected<>Nil)
|
if FTreeIntf then
|
||||||
and (LVConnections.Selected.Data<>Nil);
|
begin
|
||||||
|
TN:=TVAll.Selected;
|
||||||
|
doEnable:=Assigned(TN) AND Assigned(TN.Data) AND TObject(TN.Data).InheritsFrom(TRecentConnection)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LI:=LVConnections.Selected;
|
||||||
|
doEnable:=(LI<>Nil) and (LI.Data<>Nil);
|
||||||
|
end;
|
||||||
|
(Sender as Taction).Enabled:=doEnable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveRecentDataDict(Sender: TObject);
|
procedure TMainForm.HaveRecentDataDict(Sender: TObject);
|
||||||
|
|
||||||
|
Var
|
||||||
|
TN : TTreeNode;
|
||||||
|
LI : TListItem;
|
||||||
|
doEnable: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
(Sender as Taction).Enabled:=(LVDicts.Selected<>Nil)
|
if FTreeIntf then
|
||||||
and (LVDicts.Selected.Data<>Nil);
|
begin
|
||||||
|
TN:=TVAll.Selected;
|
||||||
|
doEnable:=Assigned(TN)
|
||||||
|
AND Assigned(TN.Data)
|
||||||
|
AND TObject(TN.Data).InheritsFrom(TRecentDataDict)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LI:=LVDicts.Selected;
|
||||||
|
doEnable:=(LI<>Nil) AND (LI.Data<>Nil);
|
||||||
|
end;
|
||||||
|
(Sender as Taction).Enabled:=doEnable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveTabs(Sender: TObject);
|
procedure TMainForm.HaveTabs(Sender: TObject);
|
||||||
@ -1080,7 +1120,10 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.HaveTab(Sender: TObject);
|
procedure TMainForm.HaveTab(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
(Sender as TAction).Enabled:=(PCDD.PageCount>2);
|
if FTreeIntf then
|
||||||
|
(Sender as TAction).Enabled:=(PCDD.PageCount>0)
|
||||||
|
else
|
||||||
|
(Sender as TAction).Enabled:=(PCDD.PageCount>2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.HaveTables(Sender: TObject);
|
procedure TMainForm.HaveTables(Sender: TObject);
|
||||||
@ -1515,6 +1558,32 @@ begin
|
|||||||
ShowDDImports;
|
ShowDDImports;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.PMAllPopup(Sender: TObject);
|
||||||
|
|
||||||
|
Type
|
||||||
|
TOption = (oConnection,oDataDict);
|
||||||
|
TOptions = Set of TOption;
|
||||||
|
|
||||||
|
Var
|
||||||
|
TN : TTreeNode;
|
||||||
|
S : TOptions;
|
||||||
|
|
||||||
|
begin
|
||||||
|
TN:=TVAll.Selected;
|
||||||
|
S:=[];
|
||||||
|
if Assigned(TN) and Assigned(TN.Data) then
|
||||||
|
if TObject(TN.Data).InheritsFrom(TRecentConnection) then
|
||||||
|
S:=[oConnection]
|
||||||
|
else if TObject(TN.Data).InheritsFrom(TRecentDatadict) then
|
||||||
|
S:=[oDataDict];
|
||||||
|
PMINewConnectionA.Visible:=True;
|
||||||
|
PMIOpenConnectionA.Visible:=oConnection in S;
|
||||||
|
PMIDeleteConnectionA.Visible:=oConnection in S;
|
||||||
|
PMINewDataDictA.Visible:=True;
|
||||||
|
PMIOpenDataDictA.Visible:=oDataDict in S;
|
||||||
|
PMIDeleteDataDictA.Visible:=oDataDict in S;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TMainForm.FindLi(LV: TListView; RI: TRecentItem): TListItem;
|
function TMainForm.FindLi(LV: TListView; RI: TRecentItem): TListItem;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user