IDE: Allow to change color for "Show BorderSpacing" option. Issue #40201, patch by paweld.

This commit is contained in:
Juha 2023-04-10 10:34:40 +03:00
parent 297dd6bd51
commit 6bfcb9ed0d
5 changed files with 17 additions and 2 deletions

View File

@ -3251,7 +3251,7 @@ begin
if ShowBorderSpacing then
begin
aDDC.Canvas.Brush.Color := clRed;
aDDC.Canvas.Brush.Color := EnvironmentOptions.BorderSpacingColor;
for i := 0 to Count - 1 do
begin
CurControl := AWinControl.Controls[i];

View File

@ -36,6 +36,7 @@ uses
type
TDesignerColor = (
dcGrid,
dcBorderSpacing,
dcGridLinesLeftTop,
dcGridLinesRightBottom,
dcGrabber,
@ -163,6 +164,7 @@ begin
begin
// read colors
ColorsListBox.Items.Objects[Ord(dcGrid)] := TObject(PtrInt(GridColor));
ColorsListBox.Items.Objects[Ord(dcBorderSpacing)] := TObject(PtrInt(BorderSpacingColor));
ColorsListBox.Items.Objects[Ord(dcGridLinesLeftTop)] := TObject(PtrInt(GuideLineColorLeftTop));
ColorsListBox.Items.Objects[Ord(dcGridLinesRightBottom)] := TObject(PtrInt(GuideLineColorRightBottom));
ColorsListBox.Items.Objects[Ord(dcGrabber)] := TObject(PtrInt(GrabberColor));
@ -199,6 +201,7 @@ begin
begin
// write colors
GridColor := ColorsListBox.Colors[Ord(dcGrid)];
BorderSpacingColor := ColorsListBox.Colors[Ord(dcBorderSpacing)];
GuideLineColorLeftTop := ColorsListBox.Colors[Ord(dcGridLinesLeftTop)];
GuideLineColorRightBottom := ColorsListBox.Colors[Ord(dcGridLinesRightBottom)];
GrabberColor := ColorsListBox.Colors[Ord(dcGrabber)];
@ -245,6 +248,7 @@ procedure TFormEditorOptionsFrame.ColorsListBoxGetColors(
Sender: TCustomColorListBox; Items: TStrings);
begin
Items.Add(dlgGridColor);
Items.Add(dlgBorderSpacingColor);
Items.Add(dlgLeftTopClr);
Items.Add(dlgRightBottomClr);
Items.Add(dlgGrabberColor);

View File

@ -1432,7 +1432,7 @@ resourcestring
dlgGridConsistsOfSmallDots = 'Grid consists of small dots which help aligning controls.';
dlgQShowBorderSpacing = 'Show border spacing';
dlgBorderSpaceCanBeSetInAnchorEditor = 'Border space can be set in Anchor editor. '
+'A red line is shown if spacing > 0.';
+'A colored line is shown if spacing > 0.';
dlgQSnapToGrid = 'Snap to grid';
dlgDistanceBetweenGridPointsIsSmallestStep = 'Distance between grid points is '
+'the smallest step when moving a control.';
@ -1451,6 +1451,7 @@ resourcestring
dlgRightBottomClr = 'Guide lines Right,Bottom';
dlgGrabberColor = 'Grabber color';
dlgMarkerColor = 'Marker color';
dlgBorderSpacingColor = 'BorderSpacing frame color';
dlgNonFormBackgroundColor = 'Other Designer background color (e. g. TDataModule)';
dlgRuberbandSelectionColor = 'Rubberband Selection';
dlgRuberbandCreationColor = 'Rubberband Creation';

View File

@ -80,6 +80,7 @@ const
DefaultAutoSaveIntervalInSecs = 300;
DefaultRubberbandSelectsGrandChilds = false;
DefaultBorderSpacingColor = clRed;
DefaultGridColor = clBlack;
DefaultGridSize = 8;
DefaultGuideLineColorLeftTop = clBlue;
@ -577,6 +578,7 @@ type
FCreateComponentFocusNameProperty: boolean;
FSwitchToFavoritesOITab: boolean;
FShowBorderSpacing: boolean;
FBorderSpacingColor: TColor;
FShowGrid: boolean;
FSnapToGrid: boolean;
FGridSizeX: integer;
@ -808,6 +810,7 @@ type
// form editor
property ShowBorderSpacing: boolean read FShowBorderSpacing write FShowBorderSpacing;
property BorderSpacingColor: TColor read FBorderSpacingColor write FBorderSpacingColor;
property ShowGrid: boolean read FShowGrid write FShowGrid;
property SnapToGrid: boolean read FSnapToGrid write FSnapToGrid;
property GridColor: TColor read FGridColor write FGridColor;
@ -1825,6 +1828,7 @@ begin
// EnvironmentOptionsDialog editor
FShowGrid:=true;
FShowBorderSpacing:=false;
FBorderSpacingColor:=DefaultBorderSpacingColor;
FGridColor:=DefaultGridColor;
FSnapToGrid:=true;
FGridSizeX:=DefaultGridSize;
@ -2309,6 +2313,7 @@ begin
// form editor
FShowGrid:=FXMLCfg.GetValue(Path+'FormEditor/ShowGrid',true);
FShowBorderSpacing:=FXMLCfg.GetValue(Path+'FormEditor/ShowBorderSpacing',false);
FBorderSpacingColor:=FXMLCfg.GetValue(Path+'FormEditor/BorderSpacingColor',DefaultBorderSpacingColor);
FGridColor:=FXMLCfg.GetValue(Path+'FormEditor/GridColor',DefaultGridColor);
FSnapToGrid:=FXMLCfg.GetValue(Path+'FormEditor/SnapToGrid',true);
FGridSizeX:=FXMLCfg.GetValue(Path+'FormEditor/GridSizeX',DefaultGridSize);
@ -2686,6 +2691,7 @@ begin
// form editor
FXMLCfg.SetDeleteValue(Path+'FormEditor/ShowBorderSpacing',FShowBorderSpacing,false);
FXMLCfg.SetDeleteValue(Path+'FormEditor/BorderSpacingColor',FBorderSpacingColor,DefaultBorderSpacingColor);
FXMLCfg.SetDeleteValue(Path+'FormEditor/ShowGrid',FShowGrid,true);
FXMLCfg.SetDeleteValue(Path+'FormEditor/GridColor',FGridColor,DefaultGridColor);
FXMLCfg.SetDeleteValue(Path+'FormEditor/SnapToGrid',FSnapToGrid,true);

View File

@ -3450,6 +3450,10 @@ msgstr ""
msgid "Show border spacing"
msgstr ""
#: lazarusidestrconsts.dlgborderspacingcolor
msgid "BorderSpacing frame color"
msgstr ""
#: lazarusidestrconsts.dlgqshowgrid
msgid "Show grid"
msgstr ""