mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-18 20:00:29 +02:00
IDEIntf: OI: when setting PropertyEditorHook use its selection
git-svn-id: trunk@53170 -
This commit is contained in:
parent
ffa60a93df
commit
48275b470f
@ -571,7 +571,7 @@ procedure TComponentTreeView.SetPropertyEditorHook(AValue: TPropertyEditorHook);
|
||||
begin
|
||||
if FPropertyEditorHook=AValue then exit;
|
||||
FPropertyEditorHook:=AValue;
|
||||
//RebuildComponentNodes;
|
||||
RebuildComponentNodes;
|
||||
end;
|
||||
|
||||
function TComponentTreeView.GetSelection: TPersistentSelectionList;
|
||||
|
@ -4341,7 +4341,7 @@ end;
|
||||
procedure TObjectInspectorDlg.SetPropertyEditorHook(NewValue:TPropertyEditorHook);
|
||||
var
|
||||
Page: TObjectInspectorPage;
|
||||
ASelection: TPersistentSelectionList;
|
||||
OldSelection: TPersistentSelectionList;
|
||||
begin
|
||||
if FPropertyEditorHook=NewValue then exit;
|
||||
if FPropertyEditorHook<>nil then begin
|
||||
@ -4356,23 +4356,26 @@ begin
|
||||
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
|
||||
if GridControl[Page]<>nil then
|
||||
GridControl[Page].PropertyEditorHook:=FPropertyEditorHook;
|
||||
if EnableHookGetSelection then begin
|
||||
// the propertyeditorhook gets the selection from the OI
|
||||
FPropertyEditorHook.AddHandlerGetSelection(@HookGetSelection);
|
||||
// select root component
|
||||
FSelection.Clear;
|
||||
if (FPropertyEditorHook<>nil) and (FPropertyEditorHook.LookupRoot<>nil)
|
||||
and (FPropertyEditorHook.LookupRoot is TComponent) then
|
||||
FSelection.Add(TComponent(FPropertyEditorHook.LookupRoot));
|
||||
end else begin
|
||||
// the OI gets the selection from the propertyeditorhook
|
||||
ASelection:=TPersistentSelectionList.Create;
|
||||
try
|
||||
FPropertyEditorHook.GetSelection(ASelection);
|
||||
Selection := ASelection;
|
||||
finally
|
||||
ASelection.Free;
|
||||
OldSelection:=TPersistentSelectionList.Create;
|
||||
try
|
||||
FPropertyEditorHook.GetSelection(OldSelection);
|
||||
if EnableHookGetSelection then begin
|
||||
// the propertyeditorhook gets the selection from the OI
|
||||
if OldSelection.Count>0 then
|
||||
FSelection.Assign(OldSelection); // if propertyeditorhook has a selection use that
|
||||
FPropertyEditorHook.AddHandlerGetSelection(@HookGetSelection);
|
||||
if OldSelection.Count=0 then begin
|
||||
// select root component
|
||||
FSelection.Clear;
|
||||
if FPropertyEditorHook.LookupRoot is TComponent then
|
||||
FSelection.Add(TComponent(FPropertyEditorHook.LookupRoot));
|
||||
end;
|
||||
end else begin
|
||||
// the OI gets the selection from the propertyeditorhook
|
||||
Selection := OldSelection;
|
||||
end;
|
||||
finally
|
||||
OldSelection.Free;
|
||||
end;
|
||||
FillComponentList;
|
||||
ComponentTree.PropertyEditorHook:=FPropertyEditorHook;
|
||||
|
Loading…
Reference in New Issue
Block a user