IDE: Add a link in editor options for Codetools "Max Length" setting. Fix anchors. Issue #36213, patch by n7800.

This commit is contained in:
Juha 2024-06-17 13:17:16 +03:00
parent 1a84469a59
commit 8060c44b3c
3 changed files with 45 additions and 11 deletions

View File

@ -61,8 +61,8 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
Font.Color = clBlue Font.Color = clBlue
ParentFont = False ParentFont = False
OnClick = RightMarginColorLinkClick OnClick = RightMarginColorLinkClick
OnMouseEnter = RightMarginColorLinkMouseEnter OnMouseEnter = LinkLabelMouseEnter
OnMouseLeave = RightMarginColorLinkMouseLeave OnMouseLeave = LinkLabelMouseLeave
end end
object VisibleRightMarginCheckBox: TCheckBox object VisibleRightMarginCheckBox: TCheckBox
AnchorSideLeft.Control = MarginAndGutterGroupBox AnchorSideLeft.Control = MarginAndGutterGroupBox
@ -78,12 +78,14 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
end end
object VisibleGutterCheckBox: TCheckBox object VisibleGutterCheckBox: TCheckBox
AnchorSideLeft.Control = MarginAndGutterGroupBox AnchorSideLeft.Control = MarginAndGutterGroupBox
AnchorSideTop.Control = chkTopInfoView AnchorSideTop.Control = VisibleRightMarginCheckBox
AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 19 Height = 19
Top = 31 Top = 31
Width = 138 Width = 138
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
Caption = 'VisibleGutterCheckBox' Caption = 'VisibleGutterCheckBox'
TabOrder = 1 TabOrder = 1
@ -127,13 +129,12 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
end end
object chkTopInfoView: TCheckBox object chkTopInfoView: TCheckBox
AnchorSideLeft.Control = RightMarginComboBox AnchorSideLeft.Control = RightMarginComboBox
AnchorSideTop.Control = VisibleRightMarginCheckBox AnchorSideTop.Control = RightMarginComboBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 271 Left = 271
Height = 19 Height = 19
Top = 31 Top = 31
Width = 103 Width = 103
BorderSpacing.Around = 6
Caption = 'chkTopInfoView' Caption = 'chkTopInfoView'
TabOrder = 4 TabOrder = 4
end end
@ -292,6 +293,24 @@ object EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
Text = 'cbCurLineMarkup' Text = 'cbCurLineMarkup'
OnChange = spinGutterPartWidthChange OnChange = spinGutterPartWidthChange
end end
object RightMarginMaxLengthLink: TLabel
AnchorSideLeft.Control = RightMarginColorLink
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RightMarginLabel
AnchorSideTop.Side = asrCenter
Cursor = crHandPoint
Left = 535
Height = 13
Top = 10
Width = 128
BorderSpacing.Left = 6
Caption = 'RightMarginMaxLengthLink'
Font.Color = clBlue
ParentFont = False
OnClick = RightMarginMaxLengthLinkClick
OnMouseEnter = LinkLabelMouseEnter
OnMouseLeave = LinkLabelMouseLeave
end
end end
object EditorFontGroupBox: TGroupBox object EditorFontGroupBox: TGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom

View File

@ -35,8 +35,9 @@ uses
// IdeIntf // IdeIntf
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEImagesIntf, IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEImagesIntf,
// IDE // IDE
EditorOptions, LazarusIDEStrConsts, editor_general_options, editor_color_options, EditorOptions, LazarusIDEStrConsts, editor_general_options,
SourceSynEditor, SourceMarks; editor_color_options, codetools_linesplitting_options, SourceSynEditor,
SourceMarks;
type type
{ TEditorDisplayOptionsFrame } { TEditorDisplayOptionsFrame }
@ -62,6 +63,7 @@ type
MarginAndGutterGroupBox: TGroupBox; MarginAndGutterGroupBox: TGroupBox;
rgGutterSite: TRadioGroup; rgGutterSite: TRadioGroup;
RightMarginColorLink: TLabel; RightMarginColorLink: TLabel;
RightMarginMaxLengthLink: TLabel;
RightMarginComboBox: TComboBox; RightMarginComboBox: TComboBox;
RightMarginLabel: TLabel; RightMarginLabel: TLabel;
ShowOnlyLineNumbersMultiplesOfLabel: TLabel; ShowOnlyLineNumbersMultiplesOfLabel: TLabel;
@ -87,8 +89,9 @@ type
procedure rgGutterSiteClick(Sender: TObject); procedure rgGutterSiteClick(Sender: TObject);
procedure FillGutterPartList; procedure FillGutterPartList;
procedure RightMarginColorLinkClick(Sender: TObject); procedure RightMarginColorLinkClick(Sender: TObject);
procedure RightMarginColorLinkMouseEnter(Sender: TObject); procedure RightMarginMaxLengthLinkClick(Sender: TObject);
procedure RightMarginColorLinkMouseLeave(Sender: TObject); procedure LinkLabelMouseEnter(Sender: TObject);
procedure LinkLabelMouseLeave(Sender: TObject);
procedure spinGutterPartWidthChange(Sender: TObject); procedure spinGutterPartWidthChange(Sender: TObject);
private private
FDialog: TAbstractOptionsEditorDialog; FDialog: TAbstractOptionsEditorDialog;
@ -469,13 +472,23 @@ begin
col.SelectAhaColor(ahaRightMargin); col.SelectAhaColor(ahaRightMargin);
end; end;
procedure TEditorDisplayOptionsFrame.RightMarginColorLinkMouseEnter(Sender: TObject); procedure TEditorDisplayOptionsFrame.RightMarginMaxLengthLinkClick(
Sender: TObject);
var
col: TCodetoolsLineSplittingOptionsFrame;
begin
col := TCodetoolsLineSplittingOptionsFrame(FDialog.FindEditor(TCodetoolsLineSplittingOptionsFrame));
if col = nil then exit;
FDialog.OpenEditor(TCodetoolsLineSplittingOptionsFrame);
end;
procedure TEditorDisplayOptionsFrame.LinkLabelMouseEnter(Sender: TObject);
begin begin
(Sender as TLabel).Font.Underline := True; (Sender as TLabel).Font.Underline := True;
(Sender as TLabel).Font.Color := clRed; (Sender as TLabel).Font.Color := clRed;
end; end;
procedure TEditorDisplayOptionsFrame.RightMarginColorLinkMouseLeave(Sender: TObject); procedure TEditorDisplayOptionsFrame.LinkLabelMouseLeave(Sender: TObject);
begin begin
(Sender as TLabel).Font.Underline := False; (Sender as TLabel).Font.Underline := False;
(Sender as TLabel).Font.Color := clBlue; (Sender as TLabel).Font.Color := clBlue;
@ -541,6 +554,7 @@ begin
ExtraLineSpacingLabel.Caption := dlgExtraLineSpacing; ExtraLineSpacingLabel.Caption := dlgExtraLineSpacing;
DisableAntialiasingCheckBox.Caption := dlgDisableAntialiasing; DisableAntialiasingCheckBox.Caption := dlgDisableAntialiasing;
RightMarginColorLink.Caption := dlgColorLink; RightMarginColorLink.Caption := dlgColorLink;
RightMarginMaxLengthLink.Caption := dlgEditMaxLength;
chkTopInfoView.Caption := lisTopInfoView; chkTopInfoView.Caption := lisTopInfoView;
btnGutterUp.Images := IDEImages.Images_16; btnGutterUp.Images := IDEImages.Images_16;

View File

@ -1807,6 +1807,7 @@ resourcestring
dlgMultiCaretMode = 'Navigation keys move all carets'; dlgMultiCaretMode = 'Navigation keys move all carets';
dlgMultiCaretDelSkipCr = 'Skip delete key at EOL (do not join lines)'; dlgMultiCaretDelSkipCr = 'Skip delete key at EOL (do not join lines)';
dlgColorLink = '(Edit Color)'; dlgColorLink = '(Edit Color)';
dlgEditMaxLength = '(Edit Max Length)';
dlgKeyLink = '(Edit Key)'; dlgKeyLink = '(Edit Key)';
dlgBracketHighlight = 'Bracket highlight'; dlgBracketHighlight = 'Bracket highlight';
dlgNoBracketHighlight = 'No Highlight'; dlgNoBracketHighlight = 'No Highlight';