Designer: Repaint after changing "BorderSpacing" in AnchorEditor or in OI. Issue #40746, by n7800 and myself.

This commit is contained in:
Juha 2024-02-03 08:18:08 +02:00
parent 311ba77757
commit 1e544fb5b9
3 changed files with 16 additions and 3 deletions

View File

@ -6958,6 +6958,8 @@ begin
if ARoot = nil then Continue; if ARoot = nil then Continue;
if (ARoot <> APersistent) and (List.IndexOf(ARoot) >= 0) then Continue; if (ARoot <> APersistent) and (List.IndexOf(ARoot) >= 0) then Continue;
List.Add(ARoot); List.Add(ARoot);
if ARoot is TControl then
TControl(ARoot).Invalidate;
// ... get the designer ... // ... get the designer ...
AForm := GetDesignerForm(ARoot); AForm := GetDesignerForm(ARoot);
if Assigned(AForm) and Assigned(AForm.Designer) then if Assigned(AForm) and Assigned(AForm.Designer) then

View File

@ -43,7 +43,7 @@ uses
// IdeIntf // IdeIntf
IdeIntfStrConsts, IDECommands, PropEdits, IDEDialogs, IDEImagesIntf, IdeIntfStrConsts, IDECommands, PropEdits, IDEDialogs, IDEImagesIntf,
// IDE // IDE
LazarusIDEStrConsts, IDEOptionDefs, EnvironmentOpts; LazarusIDEStrConsts, IDEOptionDefs, EnvironmentOpts, EnvGuiOptions;
type type
@ -638,6 +638,12 @@ begin
end; end;
GlobalDesignHook.Modified(Self, 'Anchors'); GlobalDesignHook.Modified(Self, 'Anchors');
GlobalDesignHook.RefreshPropertyValues; GlobalDesignHook.RefreshPropertyValues;
// redraw border spacing frame
if EnvironmentGuiOpts.ShowBorderSpacing then
if (GlobalDesignHook.LookupRoot is TCustomForm) or
(GlobalDesignHook.LookupRoot is TCustomFrame)
then
TControl(GlobalDesignHook.LookupRoot).Invalidate;
end; end;
end; end;

View File

@ -846,6 +846,7 @@ type
procedure SetTop(const AValue: TSpacingSize); procedure SetTop(const AValue: TSpacingSize);
protected protected
procedure Change(InnerSpaceChanged: Boolean); virtual; procedure Change(InnerSpaceChanged: Boolean); virtual;
function GetOwner: TPersistent; override;
public public
constructor Create(OwnerControl: TControl; ADefault: PControlBorderSpacingDefault = nil); constructor Create(OwnerControl: TControl; ADefault: PControlBorderSpacingDefault = nil);
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
@ -3844,8 +3845,7 @@ begin
end; end;
end; end;
function TControlBorderSpacing.IsEqual(Spacing: TControlBorderSpacing function TControlBorderSpacing.IsEqual(Spacing: TControlBorderSpacing): Boolean;
): Boolean;
begin begin
Result:=(FAround=Spacing.Around) Result:=(FAround=Spacing.Around)
and (FBottom=Spacing.Bottom) and (FBottom=Spacing.Bottom)
@ -3885,6 +3885,11 @@ begin
if Assigned(OnChange) then OnChange(Self); if Assigned(OnChange) then OnChange(Self);
end; end;
function TControlBorderSpacing.GetOwner: TPersistent;
begin
Result := FControl;
end;
function TControlBorderSpacing.GetAroundBottom: Integer; function TControlBorderSpacing.GetAroundBottom: Integer;
begin begin
Result := Around+Bottom; Result := Around+Bottom;