mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 10:57:55 +02:00
IDE: In ComponentList show Designer when selecting component or clicking on selection button. Merge request !399 by n7800.
This commit is contained in:
parent
e5f9504c5f
commit
ca8d8b9b84
@ -54,6 +54,7 @@ object ComponentListForm: TComponentListForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnDblClick = ComponentsDblClick
|
OnDblClick = ComponentsDblClick
|
||||||
OnKeyPress = TreeKeyPress
|
OnKeyPress = TreeKeyPress
|
||||||
|
OnMouseDown = TreeMouseDown
|
||||||
OnSelectionChanged = ListTreeSelectionChanged
|
OnSelectionChanged = ListTreeSelectionChanged
|
||||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoToolTips]
|
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoToolTips]
|
||||||
end
|
end
|
||||||
@ -90,6 +91,7 @@ object ComponentListForm: TComponentListForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnDblClick = ComponentsDblClick
|
OnDblClick = ComponentsDblClick
|
||||||
OnKeyPress = TreeKeyPress
|
OnKeyPress = TreeKeyPress
|
||||||
|
OnMouseDown = TreeMouseDown
|
||||||
OnSelectionChanged = ListTreeSelectionChanged
|
OnSelectionChanged = ListTreeSelectionChanged
|
||||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowRoot, tvoToolTips]
|
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowRoot, tvoToolTips]
|
||||||
end
|
end
|
||||||
@ -126,6 +128,7 @@ object ComponentListForm: TComponentListForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnDblClick = ComponentsDblClick
|
OnDblClick = ComponentsDblClick
|
||||||
OnKeyPress = TreeKeyPress
|
OnKeyPress = TreeKeyPress
|
||||||
|
OnMouseDown = TreeMouseDown
|
||||||
OnSelectionChanged = ListTreeSelectionChanged
|
OnSelectionChanged = ListTreeSelectionChanged
|
||||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||||
end
|
end
|
||||||
|
@ -89,6 +89,8 @@ type
|
|||||||
SelectionToolButton: TSpeedButton;
|
SelectionToolButton: TSpeedButton;
|
||||||
procedure chbKeepOpenChange(Sender: TObject);
|
procedure chbKeepOpenChange(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure TreeMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
procedure ListTreeSelectionChanged(Sender: TObject);
|
procedure ListTreeSelectionChanged(Sender: TObject);
|
||||||
procedure miCollapseAllClick(Sender: TObject);
|
procedure miCollapseAllClick(Sender: TObject);
|
||||||
procedure miCollapseClick(Sender: TObject);
|
procedure miCollapseClick(Sender: TObject);
|
||||||
@ -111,6 +113,7 @@ type
|
|||||||
private
|
private
|
||||||
FOnOpenPackage: TNotifyEvent;
|
FOnOpenPackage: TNotifyEvent;
|
||||||
FOnOpenUnit: TNotifyEvent;
|
FOnOpenUnit: TNotifyEvent;
|
||||||
|
FOnClassSelected: TNotifyEvent;
|
||||||
PrevChangeStamp: Integer;
|
PrevChangeStamp: Integer;
|
||||||
FInitialized: Boolean;
|
FInitialized: Boolean;
|
||||||
FIgnoreSelection: Boolean;
|
FIgnoreSelection: Boolean;
|
||||||
@ -138,6 +141,7 @@ type
|
|||||||
function GetSelectedPkgComp: TPkgComponent;
|
function GetSelectedPkgComp: TPkgComponent;
|
||||||
property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
|
property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
|
||||||
property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
|
property OnOpenUnit: TNotifyEvent read FOnOpenUnit write FOnOpenUnit;
|
||||||
|
property OnClassSelected: TNotifyEvent read FOnClassSelected write FOnClassSelected;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -611,6 +615,16 @@ begin
|
|||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TComponentListForm.TreeMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
|
Shift: TShiftState; X, Y: Integer);
|
||||||
|
begin
|
||||||
|
// ignore right click to bring up context menu
|
||||||
|
if (Button <> mbLeft) or IsDocked or chbKeepOpen.Checked then Exit;
|
||||||
|
// show form editor
|
||||||
|
if assigned(OnClassSelected) then
|
||||||
|
OnClassSelected(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char);
|
procedure TComponentListForm.TreeKeyPress(Sender: TObject; var Key: char);
|
||||||
// This is used for all 3 treeviews
|
// This is used for all 3 treeviews
|
||||||
begin
|
begin
|
||||||
@ -748,8 +762,8 @@ begin
|
|||||||
if (OldFocusedControl<>nil) and OldFocusedControl.CanSetFocus then
|
if (OldFocusedControl<>nil) and OldFocusedControl.CanSetFocus then
|
||||||
OldFocusedControl.SetFocus; // AddComponent in docked mode steals focus to designer, get it back
|
OldFocusedControl.SetFocus; // AddComponent in docked mode steals focus to designer, get it back
|
||||||
|
|
||||||
if not IsDocked and not chbKeepOpen.Checked then
|
if IsDocked or chbKeepOpen.Checked then Exit;
|
||||||
Close;
|
Close;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.miCollapseAllClick(Sender: TObject);
|
procedure TComponentListForm.miCollapseAllClick(Sender: TObject);
|
||||||
@ -861,6 +875,10 @@ procedure TComponentListForm.SelectionToolButtonClick(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
SelectionToolButton.Down := True;
|
SelectionToolButton.Down := True;
|
||||||
IDEComponentPalette.SetSelectedComp(nil, False);
|
IDEComponentPalette.SetSelectedComp(nil, False);
|
||||||
|
if IsDocked or chbKeepOpen.Checked then Exit;
|
||||||
|
// show form editor
|
||||||
|
if assigned(OnClassSelected) then
|
||||||
|
OnClassSelected(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -6166,6 +6166,7 @@ begin
|
|||||||
State=iwgfDisabled,OwningComponent);
|
State=iwgfDisabled,OwningComponent);
|
||||||
ComponentListForm.OnOpenPackage:=@PkgBoss.IDEComponentPaletteOpenPackage;
|
ComponentListForm.OnOpenPackage:=@PkgBoss.IDEComponentPaletteOpenPackage;
|
||||||
ComponentListForm.OnOpenUnit:=@PkgBoss.IDEComponentPaletteOpenUnit;
|
ComponentListForm.OnOpenUnit:=@PkgBoss.IDEComponentPaletteOpenUnit;
|
||||||
|
ComponentListForm.OnClassSelected:=@ComponentPaletteClassSelected;
|
||||||
end else if State=iwgfDisabled then
|
end else if State=iwgfDisabled then
|
||||||
ComponentListForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowComponentList'){$ENDIF};
|
ComponentListForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowComponentList'){$ENDIF};
|
||||||
if State>=iwgfShow then
|
if State>=iwgfShow then
|
||||||
|
Loading…
Reference in New Issue
Block a user