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 if ShowBorderSpacing then
begin begin
aDDC.Canvas.Brush.Color := clRed; aDDC.Canvas.Brush.Color := EnvironmentOptions.BorderSpacingColor;
for i := 0 to Count - 1 do for i := 0 to Count - 1 do
begin begin
CurControl := AWinControl.Controls[i]; CurControl := AWinControl.Controls[i];

View File

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

View File

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

View File

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

View File

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