mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 23:08:05 +02:00
IdeInspector: Display unit name of selected Component
git-svn-id: trunk@28662 -
This commit is contained in:
parent
115ae7a5c3
commit
0596f52334
@ -21,7 +21,7 @@ object IdeInspectForm: TIdeInspectForm
|
||||
ShowHint = True
|
||||
TabOrder = 0
|
||||
object btnComponent: TToolButton
|
||||
Left = 32
|
||||
Left = 98
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
DropdownMenu = popComponent
|
||||
@ -29,7 +29,7 @@ object IdeInspectForm: TIdeInspectForm
|
||||
Style = tbsDropDown
|
||||
end
|
||||
object btnSubComponent: TToolButton
|
||||
Left = 75
|
||||
Left = 141
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
DropdownMenu = popSubComponent
|
||||
@ -37,7 +37,7 @@ object IdeInspectForm: TIdeInspectForm
|
||||
Style = tbsDropDown
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 24
|
||||
Left = 90
|
||||
Top = 0
|
||||
Width = 8
|
||||
Caption = 'ToolButton1'
|
||||
@ -50,19 +50,43 @@ object IdeInspectForm: TIdeInspectForm
|
||||
OnClick = btnRemoveSelectedClick
|
||||
end
|
||||
object ToolButton2: TToolButton
|
||||
Left = 67
|
||||
Left = 133
|
||||
Top = 0
|
||||
Width = 8
|
||||
Caption = 'ToolButton2'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object btnControls: TToolButton
|
||||
Left = 110
|
||||
Left = 176
|
||||
Top = 0
|
||||
DropdownMenu = popControls
|
||||
OnClick = btnControlsClick
|
||||
Style = tbsDropDown
|
||||
end
|
||||
object ToolButton3: TToolButton
|
||||
Left = 24
|
||||
Top = 0
|
||||
Width = 8
|
||||
Caption = 'ToolButton3'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButtonFollowActive: TToolButton
|
||||
Left = 32
|
||||
Hint = 'Follow Active Window or Frame'
|
||||
Top = 0
|
||||
ImageIndex = 1
|
||||
OnClick = ToolButtonFollowActiveClick
|
||||
ShowCaption = False
|
||||
Style = tbsCheck
|
||||
end
|
||||
object ToolButtonActiveType: TToolButton
|
||||
Left = 55
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
DropdownMenu = popFollowType
|
||||
OnClick = ToolButtonActiveTypeClick
|
||||
Style = tbsDropDown
|
||||
end
|
||||
end
|
||||
object TreeView1: TTreeView
|
||||
Left = 0
|
||||
@ -99,7 +123,7 @@ object IdeInspectForm: TIdeInspectForm
|
||||
left = 290
|
||||
top = 130
|
||||
Bitmap = {
|
||||
4C69010000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
4C69020000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF006360
|
||||
F80AFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF007774FF1F7774
|
||||
FF2BFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00625FF82B5D5B
|
||||
@ -131,6 +155,38 @@ object IdeInspectForm: TIdeInspectForm
|
||||
EB08FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00211FE3081E1C
|
||||
E241FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00069A4EFF069A4EFFAE7078FFAE7078FFAE7079FFAE7079FFAE70
|
||||
79FFAE7079FFAE7079FFAE7079FFAE7079FFAE7179FFAF7077FFB07682FFB081
|
||||
99FF069A4EFF069A4EFFFFFFFF00E4D0D3FFE3CED1FFE3CDD0FFE3CDD0FFE3CD
|
||||
D0FFE3CDD0FFE3CDD0FFE3CDD0FFE3CDD0FFE1CCD1FFE8D1CDFFBFB0DDFF069A
|
||||
4EFF069A4EFFFFFFFF00FFFFFF00DEC5C9FFE3CED1FFE4D0D3FFE4D0D3FFE4D0
|
||||
D3FFE4D0D3FFE5D0D3FFE4D0D3FFE4D0D3FFE3CFD3FFE8D4D2FF069A4EFF069A
|
||||
4EFFD6BDC9FFFFFFFF00FFFFFF00B9858DFFEBDEDFFFF8F3F3FFF7F1F1FFF8F3
|
||||
F3FFF8F3F3FFF8F3F3FFF8F3F3FFF8F3F3FFF8F3F3FF069A4EFF069A4EFFFBED
|
||||
E0FFB88188FFFFFFFF00FFFFFF00BE8E95FFF3EBECFFFFFFFF00069A4EFF069A
|
||||
4EFFFFFFFF00FFFFFF00FFFFFF00FFFFFF00069A4EFF069A4EFFFFFFFF00F1E9
|
||||
EDFFBB8890FFFFFFFF00FFFFFF00BE8D94FFF1E8E9FFFEFEFEFF069A4EFF069A
|
||||
4EFF069A4EFFFFFFFF00FFFFFF00FFFFFF00069A4EFF069A4EFFFEFEFEFFF2E9
|
||||
EAFFBB878FFFFFFFFF00FFFFFF00BE8D94FFF2E9EAFFFFFFFF00069A4EFF069A
|
||||
4EFF069A4EFF069A4EFFF2E1E5FF069A4EFF069A4EFFF7F1F2FFFFFFFF00F3EA
|
||||
EBFFBB878FFFFFFFFF00FFFFFF00BE8D94FFF2E9EAFFFFFFFF00FEFEFEFF53C3
|
||||
8BFF069A4EFF069A4EFF069A4EFF069A4EFF069A4EFFF5EEEFFFFFFFFF00F3EA
|
||||
EBFFBB878FFFFFFFFF00FFFFFF00BE8D94FFF2E9EAFFFFFFFF00FEFDFEFFF6EF
|
||||
EFFF53C38BFF069A4EFF069A4EFF069A4EFFE5D1D3FFF5EEEFFFFFFFFF00F3EA
|
||||
EBFFBB878FFFFFFFFF00FFFFFF00BE8D94FFF2E9EAFFFFFFFF00FEFEFEFFEFE2
|
||||
E3FFE7D7D8FF53C38BFF069A4EFF069A4EFFE6D2D5FFF9F6F6FFFFFFFF00F3EA
|
||||
EBFFBB878FFFFFFFFF00FFFFFF00BE8D94FFF1E7E8FFFDFCFDFFFCFAFAFFFEFE
|
||||
FEFFFFFFFF00FFFFFF00FFFEFEFFFFFFFF00FFFFFF00FDFBFBFFFDFCFDFFF2E8
|
||||
E9FFBB878FFFFFFFFF00FFFFFF00BD8C93FFF5F0F0FFFFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00F7F1
|
||||
F1FFBA868EFFFFFFFF00FFFFFF00C09097FFDABEC2FFE0C9CCFFE0C8CBFFE0C9
|
||||
CCFFE0C9CCFFE0C9CCFFE0C9CCFFE0C9CCFFE0C9CCFFE0C8CBFFE0C9CCFFDABE
|
||||
C2FFBE8D94FFFFFFFF00FFFFFF00C2939AFFBB878FFFBA848CFFBA858DFFBA84
|
||||
8CFFBA848CFFBA848CFFBA848CFFBA848CFFBA848CFFBA858DFFBA848CFFBB87
|
||||
8FFFC2949BFFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||
}
|
||||
end
|
||||
@ -139,4 +195,16 @@ object IdeInspectForm: TIdeInspectForm
|
||||
left = 326
|
||||
top = 49
|
||||
end
|
||||
object popFollowType: TPopupMenu
|
||||
left = 79
|
||||
top = 129
|
||||
object menuFollowForm: TMenuItem
|
||||
Caption = 'Form'
|
||||
OnClick = menuFollowFormClick
|
||||
end
|
||||
object menuFollowFrame: TMenuItem
|
||||
Caption = 'Frame'
|
||||
OnClick = menuFollowFrameClick
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons,
|
||||
ComCtrls, Menus, MenuIntf, ObjectInspector, types;
|
||||
ComCtrls, Menus, MenuIntf, ObjectInspector, types, typinfo;
|
||||
|
||||
type
|
||||
|
||||
@ -14,9 +14,12 @@ type
|
||||
|
||||
TIdeInspectForm = class(TForm)
|
||||
ImageList1: TImageList;
|
||||
menuFollowForm: TMenuItem;
|
||||
menuFollowFrame: TMenuItem;
|
||||
popComponent: TPopupMenu;
|
||||
popSubComponent: TPopupMenu;
|
||||
popControls: TPopupMenu;
|
||||
popFollowType: TPopupMenu;
|
||||
Splitter1: TSplitter;
|
||||
ToolBar1: TToolBar;
|
||||
btnComponent: TToolButton;
|
||||
@ -25,15 +28,22 @@ type
|
||||
btnRemoveSelected: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
btnControls: TToolButton;
|
||||
ToolButton3: TToolButton;
|
||||
ToolButtonActiveType: TToolButton;
|
||||
ToolButtonFollowActive: TToolButton;
|
||||
TreeView1: TTreeView;
|
||||
procedure btnControlsClick(Sender: TObject);
|
||||
procedure btnSubComponentClick(Sender: TObject);
|
||||
procedure menuFollowFormClick(Sender: TObject);
|
||||
procedure menuFollowFrameClick(Sender: TObject);
|
||||
procedure MenuItem1Click(Sender: TObject);
|
||||
procedure btnComponentClick(Sender: TObject);
|
||||
procedure popComponentPopup(Sender: TObject);
|
||||
procedure popControlsPopup(Sender: TObject);
|
||||
procedure popSubComponentPopup(Sender: TObject);
|
||||
procedure btnRemoveSelectedClick(Sender: TObject);
|
||||
procedure ToolButtonActiveTypeClick(Sender: TObject);
|
||||
procedure ToolButtonFollowActiveClick(Sender: TObject);
|
||||
procedure TreeView1Change(Sender: TObject; Node: TTreeNode);
|
||||
procedure TreeView1Click(Sender: TObject);
|
||||
private
|
||||
@ -41,9 +51,12 @@ type
|
||||
protected
|
||||
FPropertiesGrid: TCustomPropertiesGrid;
|
||||
FSelected: TComponent;
|
||||
FFollowFrames: Boolean;
|
||||
procedure SetSelected(AComp: TComponent);
|
||||
procedure UpdateTree;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure DoActiveFormChanged(Sender: TObject; Form: TCustomForm);
|
||||
procedure DoActiveControChanged(Sender: TObject; LastControl: TControl);
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
@ -61,6 +74,9 @@ resourcestring
|
||||
ideinspComponentsOwned = 'Components (Owned)';
|
||||
ideinspRemoveSelectedItemSFromTree = 'Remove selected item(s) from tree';
|
||||
ideinspControlsChildren = 'Controls (Children)';
|
||||
ideinspInspectingNameClassUnit = 'Inspecting %s: %s (Unit: %s)';
|
||||
ideinspInspectingNameClass = 'Inspecting %s: %s';
|
||||
ideinspIdeInspector = 'Ide Inspector';
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -91,6 +107,18 @@ begin
|
||||
btnSubComponent.CheckMenuDropdown;
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.menuFollowFormClick(Sender: TObject);
|
||||
begin
|
||||
FFollowFrames := False;
|
||||
ToolButtonActiveType.Caption := menuFollowForm.Caption;
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.menuFollowFrameClick(Sender: TObject);
|
||||
begin
|
||||
FFollowFrames := True;
|
||||
ToolButtonActiveType.Caption := menuFollowFrame.Caption;
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.btnControlsClick(Sender: TObject);
|
||||
begin
|
||||
btnControls.CheckMenuDropdown;
|
||||
@ -187,6 +215,17 @@ begin
|
||||
UpdateTree;
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.ToolButtonActiveTypeClick(Sender: TObject);
|
||||
begin
|
||||
ToolButtonActiveType.CheckMenuDropdown;
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.ToolButtonFollowActiveClick(Sender: TObject);
|
||||
begin
|
||||
if ToolButtonFollowActive.Down then
|
||||
SetSelected(Self);
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.TreeView1Change(Sender: TObject; Node: TTreeNode);
|
||||
begin
|
||||
TreeView1Click(nil);
|
||||
@ -200,6 +239,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.SetSelected(AComp: TComponent);
|
||||
var
|
||||
TypeInfo: PTypeData;
|
||||
begin
|
||||
FSelected := AComp;
|
||||
FPropertiesGrid.TIObject := FSelected;
|
||||
@ -207,6 +248,18 @@ begin
|
||||
btnControls.Enabled := (FSelected <> nil) and
|
||||
(FSelected is TWinControl) and (TWinControl(FSelected).ControlCount > 0);
|
||||
UpdateTree;
|
||||
|
||||
if FSelected <> nil then begin
|
||||
TypeInfo := GetTypeData(PTypeInfo(FSelected.ClassType.ClassInfo));
|
||||
if (TypeInfo <> nil) then begin
|
||||
Caption := Format(ideinspInspectingNameClassUnit, [FSelected.Name, FSelected.ClassName,
|
||||
TypeInfo ^ .UnitName]);
|
||||
end
|
||||
else
|
||||
Caption := Format(ideinspInspectingNameClass, [FSelected.Name, FSelected.ClassName]);
|
||||
end
|
||||
else
|
||||
Caption := ideinspIdeInspector
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.UpdateTree;
|
||||
@ -269,8 +322,30 @@ begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.DoActiveFormChanged(Sender: TObject; Form: TCustomForm);
|
||||
begin
|
||||
If not ToolButtonFollowActive.Down then
|
||||
exit;
|
||||
|
||||
if Form <> Self then
|
||||
SetSelected(Form);
|
||||
end;
|
||||
|
||||
procedure TIdeInspectForm.DoActiveControChanged(Sender: TObject; LastControl: TControl);
|
||||
begin
|
||||
If (not ToolButtonFollowActive.Down) or (not FFollowFrames) then
|
||||
exit;
|
||||
if Screen.ActiveForm = Self then
|
||||
exit;
|
||||
|
||||
if (Screen.ActiveControl <> nil) and (Screen.ActiveControl.Owner <> nil) then
|
||||
SetSelected(Screen.ActiveControl.Owner);
|
||||
end;
|
||||
|
||||
constructor TIdeInspectForm.Create(TheOwner: TComponent);
|
||||
begin
|
||||
Screen.AddHandlerActiveFormChanged(@DoActiveFormChanged);
|
||||
Screen.AddHandlerActiveControlChanged(@DoActiveControChanged);
|
||||
inherited Create(TheOwner);
|
||||
FPropertiesGrid := TCustomPropertiesGrid.Create(Self);
|
||||
with FPropertiesGrid do
|
||||
@ -285,11 +360,16 @@ begin
|
||||
btnControls.Caption := ideinspControlsChildren;
|
||||
btnRemoveSelected.Hint := ideinspRemoveSelectedItemSFromTree;
|
||||
|
||||
FFollowFrames := False;
|
||||
ToolButtonActiveType.Caption := menuFollowForm.Caption;
|
||||
|
||||
SetSelected(Application);
|
||||
end;
|
||||
|
||||
destructor TIdeInspectForm.Destroy;
|
||||
begin
|
||||
Screen.RemoveHandlerActiveControlChanged(@DoActiveControChanged);
|
||||
Screen.RemoveHandlerActiveFormChanged(@DoActiveFormChanged);
|
||||
FreeAndNil(TreeView1);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user