mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-30 13:27:22 +01:00
IDEIntf: added TObjectInspectorDlg.EnableHookGetSelection, IDE: designer selection is now stored in TheControlSelection, as OI does not always exist
git-svn-id: trunk@37450 -
This commit is contained in:
parent
e4298bec55
commit
fb9c855546
@ -240,7 +240,7 @@ type
|
|||||||
cssBoundsNeedsUpdate,
|
cssBoundsNeedsUpdate,
|
||||||
cssBoundsNeedsSaving,
|
cssBoundsNeedsSaving,
|
||||||
cssParentLevelNeedsUpdate,
|
cssParentLevelNeedsUpdate,
|
||||||
cssNotSavingBounds,
|
cssDoNotSaveBounds,
|
||||||
cssSnapping,
|
cssSnapping,
|
||||||
cssChangedDuringLock,
|
cssChangedDuringLock,
|
||||||
cssRubberbandActive,
|
cssRubberbandActive,
|
||||||
@ -377,17 +377,16 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
||||||
|
|
||||||
// items
|
|
||||||
property Items[Index:integer]:TSelectedControl
|
|
||||||
read GetItems write SetItems; default;
|
|
||||||
function Count:integer;
|
|
||||||
procedure Sort(SortProc: TSelectionSortCompare);
|
|
||||||
|
|
||||||
procedure BeginUpdate;
|
procedure BeginUpdate;
|
||||||
procedure EndUpdate;
|
procedure EndUpdate;
|
||||||
procedure DoChange(ForceUpdate: Boolean = False);
|
procedure DoChange(ForceUpdate: Boolean = False);
|
||||||
property UpdateLock: integer read FUpdateLock;
|
property UpdateLock: integer read FUpdateLock;
|
||||||
|
|
||||||
|
// items
|
||||||
|
property Items[Index:integer]: TSelectedControl
|
||||||
|
read GetItems write SetItems; default;
|
||||||
|
function Count: integer;
|
||||||
|
procedure Sort(SortProc: TSelectionSortCompare);
|
||||||
function IndexOf(APersistent: TPersistent): integer;
|
function IndexOf(APersistent: TPersistent): integer;
|
||||||
function Add(APersistent: TPersistent): integer;
|
function Add(APersistent: TPersistent): integer;
|
||||||
procedure Remove(APersistent: TPersistent);
|
procedure Remove(APersistent: TPersistent);
|
||||||
@ -396,7 +395,8 @@ type
|
|||||||
function Equals(const ASelection: TPersistentSelectionList): boolean; reintroduce;
|
function Equals(const ASelection: TPersistentSelectionList): boolean; reintroduce;
|
||||||
function AssignPersistent(APersistent: TPersistent): boolean;
|
function AssignPersistent(APersistent: TPersistent): boolean;
|
||||||
procedure Assign(AControlSelection: TControlSelection); reintroduce;
|
procedure Assign(AControlSelection: TControlSelection); reintroduce;
|
||||||
procedure AssignSelection(const ASelection: TPersistentSelectionList);
|
procedure AssignSelection(const ASelection: TPersistentSelectionList); // set selection
|
||||||
|
procedure GetSelection(const ASelection: TPersistentSelectionList);
|
||||||
function IsSelected(APersistent: TPersistent): Boolean;
|
function IsSelected(APersistent: TPersistent): Boolean;
|
||||||
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
function IsOnlySelected(APersistent: TPersistent): Boolean;
|
||||||
function ParentLevel: integer;
|
function ParentLevel: integer;
|
||||||
@ -1972,7 +1972,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
g: TGrabIndex;
|
g: TGrabIndex;
|
||||||
begin
|
begin
|
||||||
if cssNotSavingBounds in FStates then exit;
|
if cssDoNotSaveBounds in FStates then exit;
|
||||||
//debugln('TControlSelection.SaveBounds');
|
//debugln('TControlSelection.SaveBounds');
|
||||||
if FUpdateLock > 0 then
|
if FUpdateLock > 0 then
|
||||||
begin
|
begin
|
||||||
@ -2092,7 +2092,6 @@ function TControlSelection.Equals(const ASelection: TPersistentSelectionList
|
|||||||
): boolean;
|
): boolean;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
Index: Integer;
|
|
||||||
Instance: TPersistent;
|
Instance: TPersistent;
|
||||||
begin
|
begin
|
||||||
if (ASelection=nil) then begin
|
if (ASelection=nil) then begin
|
||||||
@ -2102,25 +2101,18 @@ begin
|
|||||||
Result:=Count=ASelection.Count;
|
Result:=Count=ASelection.Count;
|
||||||
if not Result then
|
if not Result then
|
||||||
exit;
|
exit;
|
||||||
Index:=0;
|
|
||||||
for i:=0 to ASelection.Count-1 do
|
for i:=0 to ASelection.Count-1 do
|
||||||
begin
|
begin
|
||||||
Instance := ASelection[i];
|
Instance := ASelection[i];
|
||||||
if Instance is TPersistent then begin
|
if Items[i].Persistent<>Instance then exit(false);
|
||||||
if Items[Index].Persistent<>Instance then begin
|
|
||||||
Result:=false;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
inc(Index);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlSelection.Assign(AControlSelection: TControlSelection);
|
procedure TControlSelection.Assign(AControlSelection: TControlSelection);
|
||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
if (AControlSelection=Self) or (cssNotSavingBounds in FStates) then exit;
|
if (AControlSelection=Self) or (cssDoNotSaveBounds in FStates) then exit;
|
||||||
Include(FStates,cssNotSavingBounds);
|
Include(FStates,cssDoNotSaveBounds);
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
FControls.Capacity:=AControlSelection.Count;
|
FControls.Capacity:=AControlSelection.Count;
|
||||||
@ -2128,7 +2120,7 @@ begin
|
|||||||
Add(AControlSelection[i].Persistent);
|
Add(AControlSelection[i].Persistent);
|
||||||
SetCustomForm;
|
SetCustomForm;
|
||||||
UpdateBounds;
|
UpdateBounds;
|
||||||
Exclude(FStates,cssNotSavingBounds);
|
Exclude(FStates,cssDoNotSaveBounds);
|
||||||
SaveBounds;
|
SaveBounds;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
DoChange;
|
DoChange;
|
||||||
@ -2141,8 +2133,8 @@ var
|
|||||||
instance: TPersistent;
|
instance: TPersistent;
|
||||||
begin
|
begin
|
||||||
if Equals(ASelection) then exit;
|
if Equals(ASelection) then exit;
|
||||||
if (cssNotSavingBounds in FStates) then exit;
|
if (cssDoNotSaveBounds in FStates) then exit;
|
||||||
Include(FStates,cssNotSavingBounds);
|
Include(FStates,cssDoNotSaveBounds);
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
FControls.Capacity:=ASelection.Count;
|
FControls.Capacity:=ASelection.Count;
|
||||||
@ -2153,12 +2145,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
SetCustomForm;
|
SetCustomForm;
|
||||||
UpdateBounds;
|
UpdateBounds;
|
||||||
Exclude(FStates,cssNotSavingBounds);
|
Exclude(FStates,cssDoNotSaveBounds);
|
||||||
SaveBounds;
|
SaveBounds;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
DoChange;
|
DoChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TControlSelection.GetSelection(
|
||||||
|
const ASelection: TPersistentSelectionList);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if ASelection=nil then exit;
|
||||||
|
if Equals(ASelection) then exit;
|
||||||
|
ASelection.Clear;
|
||||||
|
for i:=0 to Count-1 do
|
||||||
|
ASelection.Add(Items[i].Persistent);
|
||||||
|
end;
|
||||||
|
|
||||||
function TControlSelection.IsSelected(APersistent: TPersistent): Boolean;
|
function TControlSelection.IsSelected(APersistent: TPersistent): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(IndexOf(APersistent)>=0);
|
Result:=(IndexOf(APersistent)>=0);
|
||||||
|
|||||||
36
ide/main.pp
36
ide/main.pp
@ -551,6 +551,7 @@ type
|
|||||||
procedure OnControlSelectionPropsChanged(Sender: TObject);
|
procedure OnControlSelectionPropsChanged(Sender: TObject);
|
||||||
procedure OnControlSelectionFormChanged(Sender: TObject; OldForm,
|
procedure OnControlSelectionFormChanged(Sender: TObject; OldForm,
|
||||||
NewForm: TCustomForm);
|
NewForm: TCustomForm);
|
||||||
|
procedure OnGetDesignerSelection(const ASelection: TPersistentSelectionList);
|
||||||
|
|
||||||
// project inspector
|
// project inspector
|
||||||
procedure ProjInspectorOpen(Sender: TObject);
|
procedure ProjInspectorOpen(Sender: TObject);
|
||||||
@ -1682,16 +1683,16 @@ begin
|
|||||||
(ObjectInspector1.Selection.Count > 0) then
|
(ObjectInspector1.Selection.Count > 0) then
|
||||||
begin
|
begin
|
||||||
C := ObjectInspector1.Selection[0].ClassType;
|
C := ObjectInspector1.Selection[0].ClassType;
|
||||||
if C.InheritsFrom(TForm) then C := TForm
|
if C.InheritsFrom(TForm) then
|
||||||
else
|
C := TForm
|
||||||
if C.InheritsFrom(TCustomForm) then C := TCustomForm
|
else if C.InheritsFrom(TCustomForm) then
|
||||||
else
|
C := TCustomForm
|
||||||
if C.InheritsFrom(TDataModule) then C := TDataModule
|
else if C.InheritsFrom(TDataModule) then
|
||||||
else
|
C := TDataModule
|
||||||
if C.InheritsFrom(TFrame) then C := TFrame;
|
else if C.InheritsFrom(TFrame) then
|
||||||
|
C := TFrame;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
if ObjectInspector1.GetActivePropertyRow = nil then
|
if ObjectInspector1.GetActivePropertyRow = nil then
|
||||||
begin
|
begin
|
||||||
if C <> nil then
|
if C <> nil then
|
||||||
@ -2186,6 +2187,7 @@ begin
|
|||||||
TheControlSelection.OnChange:=@OnControlSelectionChanged;
|
TheControlSelection.OnChange:=@OnControlSelectionChanged;
|
||||||
TheControlSelection.OnPropertiesChanged:=@OnControlSelectionPropsChanged;
|
TheControlSelection.OnPropertiesChanged:=@OnControlSelectionPropsChanged;
|
||||||
TheControlSelection.OnSelectionFormChanged:=@OnControlSelectionFormChanged;
|
TheControlSelection.OnSelectionFormChanged:=@OnControlSelectionFormChanged;
|
||||||
|
GlobalDesignHook.AddHandlerGetSelection(@OnGetDesignerSelection);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SetupIDECommands;
|
procedure TMainIDE.SetupIDECommands;
|
||||||
@ -14879,6 +14881,13 @@ begin
|
|||||||
UpdateIDEComponentPalette;
|
UpdateIDEComponentPalette;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.OnGetDesignerSelection(
|
||||||
|
const ASelection: TPersistentSelectionList);
|
||||||
|
begin
|
||||||
|
if TheControlSelection=nil then exit;
|
||||||
|
TheControlSelection.GetSelection(ASelection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -17570,11 +17579,9 @@ begin
|
|||||||
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
||||||
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
||||||
ObjectInspector1.OnAutoShow:=@OIOnAutoShow;
|
ObjectInspector1.OnAutoShow:=@OIOnAutoShow;
|
||||||
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
|
ObjectInspector1.EnableHookGetSelection:=false; // the selection is stored in TheControlSelection
|
||||||
if FormEditor1<>nil then
|
|
||||||
FormEditor1.Obj_Inspector := ObjectInspector1;
|
|
||||||
|
|
||||||
// after OI changes the hints needs to be updated
|
// after OI changes the hints need to be updated
|
||||||
// do that after some idle time
|
// do that after some idle time
|
||||||
OIChangedTimer:=TIdleTimer.Create(OwningComponent);
|
OIChangedTimer:=TIdleTimer.Create(OwningComponent);
|
||||||
with OIChangedTimer do begin
|
with OIChangedTimer do begin
|
||||||
@ -17583,6 +17590,11 @@ begin
|
|||||||
OnTimer:=@OIChangedTimerTimer;
|
OnTimer:=@OIChangedTimerTimer;
|
||||||
end;
|
end;
|
||||||
EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
||||||
|
|
||||||
|
// connect to designers
|
||||||
|
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
|
||||||
|
if FormEditor1<>nil then
|
||||||
|
FormEditor1.Obj_Inspector := ObjectInspector1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnApplicationUserInput(Sender: TObject; Msg: Cardinal);
|
procedure TMainIDE.OnApplicationUserInput(Sender: TObject; Msg: Cardinal);
|
||||||
|
|||||||
@ -39,12 +39,12 @@ uses
|
|||||||
// FCL
|
// FCL
|
||||||
SysUtils, Types, Classes, TypInfo,
|
SysUtils, Types, Classes, TypInfo,
|
||||||
// LCL
|
// LCL
|
||||||
InterfaceBase, Forms, Buttons, Graphics, GraphType, LCLProc,
|
InterfaceBase, Forms, Buttons, Graphics, GraphType, LCLProc, StdCtrls,
|
||||||
StdCtrls, LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls,
|
LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LResources,
|
||||||
LMessages, LResources, LazConfigStorage, Menus, Dialogs, Themes,
|
LazConfigStorage, Menus, Dialogs, Themes, TreeFilterEdit, ObjInspStrConsts,
|
||||||
TreeFilterEdit, ObjInspStrConsts,
|
|
||||||
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||||
ComponentTreeView, ComponentEditors, IDEImagesIntf, OIFavouriteProperties;
|
ComponentTreeView, ComponentEditors, IDEImagesIntf, OIFavouriteProperties,
|
||||||
|
PropEditUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
OIOptionsFileVersion = 3;
|
OIOptionsFileVersion = 3;
|
||||||
@ -693,10 +693,12 @@ type
|
|||||||
procedure DoCollectionAddItem(Sender: TObject);
|
procedure DoCollectionAddItem(Sender: TObject);
|
||||||
procedure DoZOrderItemClick(Sender: TObject);
|
procedure DoZOrderItemClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
FEnableHookGetSelection: boolean;
|
||||||
FInSelection: Boolean;
|
FInSelection: Boolean;
|
||||||
FOnAutoShow: TNotifyEvent;
|
FOnAutoShow: TNotifyEvent;
|
||||||
function GetComponentTreeHeight: integer;
|
function GetComponentTreeHeight: integer;
|
||||||
function GetInfoBoxHeight: integer;
|
function GetInfoBoxHeight: integer;
|
||||||
|
procedure SetEnableHookGetSelection(AValue: boolean);
|
||||||
protected
|
protected
|
||||||
function PersistentToString(APersistent: TPersistent): string;
|
function PersistentToString(APersistent: TPersistent): string;
|
||||||
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
|
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
|
||||||
@ -737,49 +739,51 @@ type
|
|||||||
procedure FocusGrid(Grid: TOICustomPropertyGrid = nil);
|
procedure FocusGrid(Grid: TOICustomPropertyGrid = nil);
|
||||||
|
|
||||||
property AutoShow: Boolean read FAutoShow write FAutoShow;
|
property AutoShow: Boolean read FAutoShow write FAutoShow;
|
||||||
|
property ComponentTreeHeight: integer read GetComponentTreeHeight
|
||||||
|
write SetComponentTreeHeight;
|
||||||
property DefaultItemHeight: integer read FDefaultItemHeight
|
property DefaultItemHeight: integer read FDefaultItemHeight
|
||||||
write SetDefaultItemHeight;
|
write SetDefaultItemHeight;
|
||||||
property Selection: TPersistentSelectionList
|
property EnableHookGetSelection: boolean read FEnableHookGetSelection
|
||||||
read FSelection write SetSelection;
|
write SetEnableHookGetSelection;
|
||||||
|
property Favourites: TOIFavouriteProperties read FFavourites write SetFavourites;
|
||||||
|
property GridControl[Page: TObjectInspectorPage]: TOICustomPropertyGrid
|
||||||
|
read GetGridControl;
|
||||||
|
property InfoBoxHeight: integer read GetInfoBoxHeight write SetInfoBoxHeight;
|
||||||
property OnAddAvailPersistent: TOnAddAvailablePersistent
|
property OnAddAvailPersistent: TOnAddAvailablePersistent
|
||||||
read FOnAddAvailablePersistent write FOnAddAvailablePersistent;
|
read FOnAddAvailablePersistent write FOnAddAvailablePersistent;
|
||||||
property OnSelectPersistentsInOI: TNotifyEvent
|
property OnAddToFavourites: TNotifyEvent read FOnAddToFavourites
|
||||||
read FOnSelectPersistentsInOI write FOnSelectPersistentsInOI;
|
write FOnAddToFavourites;
|
||||||
property PropertyEditorHook: TPropertyEditorHook
|
property OnAutoShow: TNotifyEvent read FOnAutoShow write FOnAutoShow;
|
||||||
read FPropertyEditorHook write SetPropertyEditorHook;
|
property OnFindDeclarationOfProperty: TNotifyEvent
|
||||||
|
read FOnFindDeclarationOfProperty write FOnFindDeclarationOfProperty;
|
||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
|
||||||
property OnPropertyHint: TOIPropertyHint read FOnPropertyHint write FOnPropertyHint;
|
property OnPropertyHint: TOIPropertyHint read FOnPropertyHint write FOnPropertyHint;
|
||||||
property OnShowOptions: TNotifyEvent read FOnShowOptions
|
|
||||||
write SetOnShowOptions;
|
|
||||||
property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp
|
|
||||||
write FOnRemainingKeyUp;
|
|
||||||
property OnRemainingKeyDown: TKeyEvent read FOnRemainingKeyDown
|
property OnRemainingKeyDown: TKeyEvent read FOnRemainingKeyDown
|
||||||
write FOnRemainingKeyDown;
|
write FOnRemainingKeyDown;
|
||||||
|
property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp
|
||||||
|
write FOnRemainingKeyUp;
|
||||||
|
property OnRemoveFromFavourites: TNotifyEvent read FOnRemoveFromFavourites
|
||||||
|
write FOnRemoveFromFavourites;
|
||||||
|
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
||||||
|
property OnSelectPersistentsInOI: TNotifyEvent
|
||||||
|
read FOnSelectPersistentsInOI write FOnSelectPersistentsInOI;
|
||||||
|
property OnShowOptions: TNotifyEvent read FOnShowOptions
|
||||||
|
write SetOnShowOptions;
|
||||||
property OnUpdateRestricted: TNotifyEvent read FOnUpdateRestricted
|
property OnUpdateRestricted: TNotifyEvent read FOnUpdateRestricted
|
||||||
write FOnUpdateRestricted;
|
write FOnUpdateRestricted;
|
||||||
|
property OnViewRestricted: TNotifyEvent read FOnViewRestricted write FOnViewRestricted;
|
||||||
|
property PropertyEditorHook: TPropertyEditorHook
|
||||||
|
read FPropertyEditorHook write SetPropertyEditorHook;
|
||||||
|
property RestrictedProps: TOIRestrictedProperties read FRestricted write SetRestricted;
|
||||||
|
property Selection: TPersistentSelectionList
|
||||||
|
read FSelection write SetSelection;
|
||||||
property ShowComponentTree: boolean read FShowComponentTree
|
property ShowComponentTree: boolean read FShowComponentTree
|
||||||
write SetShowComponentTree;
|
write SetShowComponentTree;
|
||||||
property ShowFavorites: Boolean read FShowFavorites write SetShowFavorites;
|
property ShowFavorites: Boolean read FShowFavorites write SetShowFavorites;
|
||||||
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
|
|
||||||
property ComponentTreeHeight: integer read GetComponentTreeHeight
|
|
||||||
write SetComponentTreeHeight;
|
|
||||||
property InfoBoxHeight: integer read GetInfoBoxHeight write SetInfoBoxHeight;
|
|
||||||
property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar;
|
|
||||||
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
|
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
|
||||||
property GridControl[Page: TObjectInspectorPage]: TOICustomPropertyGrid
|
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
|
||||||
read GetGridControl;
|
property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar;
|
||||||
property Favourites: TOIFavouriteProperties read FFavourites write SetFavourites;
|
|
||||||
property RestrictedProps: TOIRestrictedProperties read FRestricted write SetRestricted;
|
|
||||||
property OnAddToFavourites: TNotifyEvent read FOnAddToFavourites
|
|
||||||
write FOnAddToFavourites;
|
|
||||||
property OnRemoveFromFavourites: TNotifyEvent read FOnRemoveFromFavourites
|
|
||||||
write FOnRemoveFromFavourites;
|
|
||||||
property OnViewRestricted: TNotifyEvent read FOnViewRestricted write FOnViewRestricted;
|
|
||||||
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
|
|
||||||
property OnFindDeclarationOfProperty: TNotifyEvent
|
|
||||||
read FOnFindDeclarationOfProperty write FOnFindDeclarationOfProperty;
|
|
||||||
property OnAutoShow: TNotifyEvent read FOnAutoShow write FOnAutoShow;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -3872,6 +3876,7 @@ constructor TObjectInspectorDlg.Create(AnOwner: TComponent);
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
inherited Create(AnOwner);
|
inherited Create(AnOwner);
|
||||||
|
FEnableHookGetSelection:= true;
|
||||||
FPropertyEditorHook:=nil;
|
FPropertyEditorHook:=nil;
|
||||||
FInSelection := False;
|
FInSelection := False;
|
||||||
FSelection:=TPersistentSelectionList.Create;
|
FSelection:=TPersistentSelectionList.Create;
|
||||||
@ -4014,6 +4019,7 @@ end;
|
|||||||
procedure TObjectInspectorDlg.SetPropertyEditorHook(NewValue:TPropertyEditorHook);
|
procedure TObjectInspectorDlg.SetPropertyEditorHook(NewValue:TPropertyEditorHook);
|
||||||
var
|
var
|
||||||
Page: TObjectInspectorPage;
|
Page: TObjectInspectorPage;
|
||||||
|
ASelection: TPersistentSelectionList;
|
||||||
begin
|
begin
|
||||||
if FPropertyEditorHook=NewValue then exit;
|
if FPropertyEditorHook=NewValue then exit;
|
||||||
if FPropertyEditorHook<>nil then begin
|
if FPropertyEditorHook<>nil then begin
|
||||||
@ -4024,13 +4030,23 @@ begin
|
|||||||
FPropertyEditorHook.AddHandlerChangeLookupRoot(@HookLookupRootChange);
|
FPropertyEditorHook.AddHandlerChangeLookupRoot(@HookLookupRootChange);
|
||||||
FPropertyEditorHook.AddHandlerRefreshPropertyValues(
|
FPropertyEditorHook.AddHandlerRefreshPropertyValues(
|
||||||
@HookRefreshPropertyValues);
|
@HookRefreshPropertyValues);
|
||||||
FPropertyEditorHook.AddHandlerGetSelection(@HookGetSelection);
|
|
||||||
FPropertyEditorHook.AddHandlerSetSelection(@HookSetSelection);
|
FPropertyEditorHook.AddHandlerSetSelection(@HookSetSelection);
|
||||||
|
if EnableHookGetSelection then begin
|
||||||
|
FPropertyEditorHook.AddHandlerGetSelection(@HookGetSelection);
|
||||||
// select root component
|
// select root component
|
||||||
FSelection.Clear;
|
FSelection.Clear;
|
||||||
if (FPropertyEditorHook<>nil) and (FPropertyEditorHook.LookupRoot<>nil)
|
if (FPropertyEditorHook<>nil) and (FPropertyEditorHook.LookupRoot<>nil)
|
||||||
and (FPropertyEditorHook.LookupRoot is TComponent) then
|
and (FPropertyEditorHook.LookupRoot is TComponent) then
|
||||||
FSelection.Add(TComponent(FPropertyEditorHook.LookupRoot));
|
FSelection.Add(TComponent(FPropertyEditorHook.LookupRoot));
|
||||||
|
end else begin
|
||||||
|
ASelection:=TPersistentSelectionList.Create;
|
||||||
|
try
|
||||||
|
FPropertyEditorHook.GetSelection(ASelection);
|
||||||
|
Selection := ASelection;
|
||||||
|
finally
|
||||||
|
ASelection.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
FillPersistentComboBox;
|
FillPersistentComboBox;
|
||||||
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
|
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
|
||||||
if GridControl[Page]<>nil then
|
if GridControl[Page]<>nil then
|
||||||
@ -4235,10 +4251,14 @@ procedure TObjectInspectorDlg.SetSelection(const ASelection: TPersistentSelectio
|
|||||||
begin
|
begin
|
||||||
if (not Assigned(ASelection)) then
|
if (not Assigned(ASelection)) then
|
||||||
exit;
|
exit;
|
||||||
if FInSelection and FSelection.IsEqual(ASelection) then
|
if FSelection.IsEqual(ASelection) then
|
||||||
|
begin
|
||||||
|
if FInSelection then
|
||||||
exit; // prevent endless loops
|
exit; // prevent endless loops
|
||||||
if (not ASelection.ForceUpdate) and FSelection.IsEqual(ASelection) then
|
if (not ASelection.ForceUpdate) then
|
||||||
exit; // nothing changed
|
exit; // nothing changed
|
||||||
|
ASelection.ForceUpdate:=false;
|
||||||
|
end;
|
||||||
FInSelection := True;
|
FInSelection := True;
|
||||||
try
|
try
|
||||||
// ToDo: Clear filter only if a selected node is hidden (Visible=False)
|
// ToDo: Clear filter only if a selected node is hidden (Visible=False)
|
||||||
@ -5253,11 +5273,18 @@ end;
|
|||||||
|
|
||||||
function TObjectInspectorDlg.GetInfoBoxHeight: integer;
|
function TObjectInspectorDlg.GetInfoBoxHeight: integer;
|
||||||
begin
|
begin
|
||||||
if Assigned(InfoPanel) then
|
Result := InfoPanel.Height;
|
||||||
Result := InfoPanel.Height
|
end;
|
||||||
else // Will never happen, remove later. JuMa
|
|
||||||
raise Exception.Create('InfoPanel=nil in TObjectInspectorDlg.GetInfoBoxHeight');
|
procedure TObjectInspectorDlg.SetEnableHookGetSelection(AValue: boolean);
|
||||||
//Result := FInfoBoxHeight;
|
begin
|
||||||
|
if FEnableHookGetSelection=AValue then Exit;
|
||||||
|
FEnableHookGetSelection:=AValue;
|
||||||
|
if PropertyEditorHook<>nil then
|
||||||
|
if EnableHookGetSelection then
|
||||||
|
FPropertyEditorHook.AddHandlerGetSelection(@HookGetSelection)
|
||||||
|
else
|
||||||
|
FPropertyEditorHook.RemoveHandlerGetSelection(@HookGetSelection)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
|
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user