mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 16:55:55 +02:00
IDE: designer: enable Reset only if there are ancestors
git-svn-id: trunk@59554 -
This commit is contained in:
parent
300fac7486
commit
34dbf4fe70
@ -3999,9 +3999,13 @@ var
|
|||||||
OneControlSelected: Boolean;
|
OneControlSelected: Boolean;
|
||||||
SelectionVisible: Boolean;
|
SelectionVisible: Boolean;
|
||||||
SrcFile: TLazProjectFile;
|
SrcFile: TLazProjectFile;
|
||||||
UnitIsVirtual, DesignerCanCopy, HasChangeParentCandidates: Boolean;
|
UnitIsVirtual, DesignerCanCopy, HasChangeParentCandidates,
|
||||||
|
HasAncestorComponent: Boolean;
|
||||||
PersistentSelection: TPersistentSelectionList;
|
PersistentSelection: TPersistentSelectionList;
|
||||||
ChangeParentCandidates: TFPList;
|
ChangeParentCandidates: TFPList;
|
||||||
|
i: Integer;
|
||||||
|
Item: TSelectedControl;
|
||||||
|
AComponent, AncestorComponent: TComponent;
|
||||||
begin
|
begin
|
||||||
SrcFile:=LazarusIDE.GetProjectFileWithDesigner(Self);
|
SrcFile:=LazarusIDE.GetProjectFileWithDesigner(Self);
|
||||||
ControlSelIsNotEmpty:=(Selection.Count>0)
|
ControlSelIsNotEmpty:=(Selection.Count>0)
|
||||||
@ -4017,9 +4021,23 @@ begin
|
|||||||
PersistentSelection:=TPersistentSelectionList.Create;
|
PersistentSelection:=TPersistentSelectionList.Create;
|
||||||
try
|
try
|
||||||
Selection.GetSelection(PersistentSelection);
|
Selection.GetSelection(PersistentSelection);
|
||||||
|
|
||||||
ChangeParentCandidates:=GetChangeParentCandidates(GlobalDesignHook,PersistentSelection);
|
ChangeParentCandidates:=GetChangeParentCandidates(GlobalDesignHook,PersistentSelection);
|
||||||
HasChangeParentCandidates:=ChangeParentCandidates.Count>0;
|
HasChangeParentCandidates:=ChangeParentCandidates.Count>0;
|
||||||
FreeAndNil(ChangeParentCandidates);
|
FreeAndNil(ChangeParentCandidates);
|
||||||
|
|
||||||
|
HasAncestorComponent:=false;
|
||||||
|
for i:=0 to Selection.Count-1 do
|
||||||
|
begin
|
||||||
|
Item:=Selection[i];
|
||||||
|
AComponent:=TComponent(Item.Persistent);
|
||||||
|
AncestorComponent:=TheFormEditor.GetAncestorInstance(AComponent);
|
||||||
|
if AncestorComponent<>nil then
|
||||||
|
begin
|
||||||
|
HasAncestorComponent:=true;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
FreeAndNil(PersistentSelection);
|
FreeAndNil(PersistentSelection);
|
||||||
end;
|
end;
|
||||||
@ -4031,7 +4049,7 @@ begin
|
|||||||
DesignerMenuMirrorVertical.Enabled := MultiCompsAreSelected and not OnlyNonVisualsAreSelected;
|
DesignerMenuMirrorVertical.Enabled := MultiCompsAreSelected and not OnlyNonVisualsAreSelected;
|
||||||
DesignerMenuScale.Enabled := CompsAreSelected and not OnlyNonVisualsAreSelected;
|
DesignerMenuScale.Enabled := CompsAreSelected and not OnlyNonVisualsAreSelected;
|
||||||
DesignerMenuSize.Enabled := CompsAreSelected and not OnlyNonVisualsAreSelected;
|
DesignerMenuSize.Enabled := CompsAreSelected and not OnlyNonVisualsAreSelected;
|
||||||
DesignerMenuReset.Enabled := CompsAreSelected;
|
DesignerMenuReset.Enabled := HasAncestorComponent;
|
||||||
|
|
||||||
DesignerMenuAnchorEditor.Enabled := (FLookupRoot is TWinControl) and (TWinControl(FLookupRoot).ControlCount > 0);
|
DesignerMenuAnchorEditor.Enabled := (FLookupRoot is TWinControl) and (TWinControl(FLookupRoot).ControlCount > 0);
|
||||||
DesignerMenuTabOrder.Enabled := (FLookupRoot is TWinControl) and (TWinControl(FLookupRoot).ControlCount > 0);
|
DesignerMenuTabOrder.Enabled := (FLookupRoot is TWinControl) and (TWinControl(FLookupRoot).ControlCount > 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user