diff --git a/components/IdeInspector/maininspector.lfm b/components/IdeInspector/maininspector.lfm index 92c6b36a0d..648954f371 100644 --- a/components/IdeInspector/maininspector.lfm +++ b/components/IdeInspector/maininspector.lfm @@ -3,6 +3,7 @@ object IdeInspectForm: TIdeInspectForm Height = 479 Top = 157 Width = 498 + BorderStyle = bsSizeToolWin Caption = 'IdeInspectForm' ClientHeight = 479 ClientWidth = 498 @@ -192,19 +193,35 @@ object IdeInspectForm: TIdeInspectForm ParentShowHint = False end end + object TabControl1: TTabControl + Left = 222 + Height = 364 + Top = 26 + Width = 276 + Align = alClient + OnChange = TabControl1Change + TabIndex = 0 + TabOrder = 4 + Tabs.Strings = ( + 'Properties' + 'Events' + 'All' + ) + TabStop = False + end object popComponent: TPopupMenu OnPopup = popComponentPopup - left = 80 + left = 16 top = 40 end object popSubComponent: TPopupMenu OnPopup = popSubComponentPopup - left = 192 + left = 120 top = 40 end object ImageList1: TImageList - left = 290 - top = 130 + left = 48 + top = 200 Bitmap = { 4C69020000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF006360 @@ -275,12 +292,12 @@ object IdeInspectForm: TIdeInspectForm end object popControls: TPopupMenu OnPopup = popControlsPopup - left = 326 - top = 49 + left = 136 + top = 120 end object popFollowType: TPopupMenu - left = 79 - top = 129 + left = 24 + top = 112 object menuFollowForm: TMenuItem Caption = 'Form' OnClick = menuFollowFormClick diff --git a/components/IdeInspector/maininspector.pas b/components/IdeInspector/maininspector.pas index 531196b9b0..1498be0c36 100644 --- a/components/IdeInspector/maininspector.pas +++ b/components/IdeInspector/maininspector.pas @@ -6,7 +6,8 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons, - ComCtrls, Menus, StdCtrls, MenuIntf, ObjectInspector, types, LazIDEIntf; + ComCtrls, Menus, StdCtrls, MenuIntf, ObjectInspector, PropEdits, types, typinfo, + LazIDEIntf, LCLProc; type @@ -40,6 +41,7 @@ type popFollowType: TPopupMenu; btnOpenFile: TSpeedButton; Splitter1: TSplitter; + TabControl1: TTabControl; ToolBar1: TToolBar; btnComponent: TToolButton; btnSubComponent: TToolButton; @@ -63,6 +65,7 @@ type procedure popControlsPopup(Sender: TObject); procedure popSubComponentPopup(Sender: TObject); procedure btnRemoveSelectedClick(Sender: TObject); + procedure TabControl1Change(Sender: TObject); procedure ToolButtonActiveTypeClick(Sender: TObject); procedure ToolButtonFollowActiveClick(Sender: TObject); procedure TreeView1Change(Sender: TObject; Node: TTreeNode); @@ -74,6 +77,7 @@ type FHistoryList: TList; FCurEntry: THistoryEntry; FIsUpdatingHistory: Boolean; + procedure DoPropSelChanged(Sender: TObject); protected FPropertiesGrid: TCustomPropertiesGrid; procedure SetSelected(AComp: TComponent); @@ -112,6 +116,9 @@ implementation const MAX_HIST_CNT = 25; +var + OriginalBackTraceStrFunc: TBackTraceStrFunc; + type { TExtMenuItem } @@ -178,6 +185,55 @@ begin UpdateCurrent; end; +procedure TIdeInspectForm.DoPropSelChanged(Sender: TObject); +var + i: LongInt; + Row: TOIPropertyGridRow; + Method: TMethod; + s, s2, OName: string; +begin + Row := FPropertiesGrid.GetActiveRow; + Method.Code := nil;; + if (Row <> nil) and (Row.Editor is TMethodPropertyEditor) then + Method := TMethodPropertyEditor(Row.Editor).GetMethodValue; + + if Method.Code = nil then begin + SetSelected(FSelected); + exit; + end; + + If TObject(Method.Data) is TComponent then + OName := '('+TComponent(Method.Data).Name+')' + else + OName := ''; + + s := TObject(Method.Data).MethodName(Method.Code); + if s = '' then + s := IntToHex(PtrUint(Method.Code), 2*SizeOf(Pointer)); + + s := TObject(Method.Data).ClassName + OName + '.' + s; + + try + s2 := Trim(OriginalBackTraceStrFunc(Method.Code)); + i := pos(' ', s2); + if (s2 <> '') and (s2[1] = '$') and (i > 0) then + s2 := copy(s2, i, length(s)); + if s2<>'' then + s := s + ' ' + s2; + except + end; + + + FCurEntry.Display := s; + FCurEntry.Comp := nil; + FCurEntry.TheUnitName := TObject(Method.Data).ClassType.UnitName; + FCurEntry.FileName := LazarusIDE.FindUnitFile(FCurEntry.TheUnitName); + + //LazarusIDE.DoOpenFileAndJumpToIdentifier(AFile, copy(AName,1,i), -1, -1, [ofOnlyIfExists, ofRegularFile]); + //LazarusIDE.DoOpenFileAndJumpToPos(AFile, Point(1,i), Max(i-1,1), -1, -1, [ofOnlyIfExists, ofRegularFile]); + UpdateHistory; +end; + procedure TIdeInspectForm.menuFollowFormClick(Sender: TObject); begin FFollowFrames := False; @@ -293,6 +349,15 @@ begin UpdateTree; end; +procedure TIdeInspectForm.TabControl1Change(Sender: TObject); +begin + case TabControl1.TabIndex of + 0: FPropertiesGrid.Filter := [low(TTypeKind)..high(TTypeKind)] - [tkMethod]; + 1: FPropertiesGrid.Filter := [tkMethod]; + 2: FPropertiesGrid.Filter := []; + end; +end; + procedure TIdeInspectForm.ToolButtonActiveTypeClick(Sender: TObject); begin ToolButtonActiveType.CheckMenuDropdown; @@ -498,14 +563,16 @@ begin Screen.AddHandlerActiveFormChanged(@DoActiveFormChanged); Screen.AddHandlerActiveControlChanged(@DoActiveControChanged); inherited Create(TheOwner); + FPropertiesGrid := TCustomPropertiesGrid.Create(Self); with FPropertiesGrid do begin Name := 'FPropertiesGrid'; - Parent := self; + Parent := TabControl1; Align := alClient; - BorderSpacing.Around := 6; + OnSelectionChange := @DoPropSelChanged; end; + btnComponent.Caption := ideinspQuickLinks; btnSubComponent.Caption := ideinspComponentsOwned; btnControls.Caption := ideinspControlsChildren; @@ -513,6 +580,7 @@ begin FFollowFrames := True; ToolButtonActiveType.Caption := menuFollowFrame.Caption; + TabControl1Change(nil); SetSelected(Application); end; @@ -544,5 +612,9 @@ begin @IDEMenuClicked); end; +initialization + OriginalBackTraceStrFunc := BackTraceStrFunc; + + end.