IDE, synedit: implemented ExtraCharSpacing

git-svn-id: trunk@15559 -
This commit is contained in:
mattias 2008-06-24 08:43:22 +00:00
parent b420930fb2
commit 94a0e34fb6
5 changed files with 1075 additions and 972 deletions

View File

@ -384,6 +384,7 @@ type
fHighlighterNeedsUpdateStartLine: integer; // 1 based, 0 means invalid
fHighlighterNeedsUpdateEndLine: integer; // 1 based, 0 means invalid
fBeautifier: TSynCustomBeautifier;
fExtraCharSpacing: integer;
{$ENDIF}
fLines: TStrings;
fLinesInWindow: Integer;// MG: fully visible lines in window
@ -542,6 +543,7 @@ type
procedure SetInsertMode(const Value: boolean);
procedure SetKeystrokes(const Value: TSynEditKeyStrokes);
{$ifdef SYN_LAZARUS}
procedure SetExtraCharSpacing(const Value: integer);
procedure SetLastMouseCaret(const AValue: TPoint);
{$ENDIF}
procedure SetLeftChar(Value: Integer);
@ -861,6 +863,8 @@ type
default bsSingle;
{$IFDEF SYN_LAZARUS}
property BlockIndent: integer read fBlockIndent write SetBlockIndent default 2;
property ExtraCharSpacing: integer
read fExtraCharSpacing write SetExtraCharSpacing default 0;
{$ENDIF}
property ExtraLineSpacing: integer
read fExtraLineSpacing write SetExtraLineSpacing default 0;
@ -987,6 +991,9 @@ type
// TCustomSynEdit properties
property BookMarkOptions;
property BorderStyle;
{$IFDEF SYN_LAZARUS}
property ExtraCharSpacing;
{$ENDIF}
property ExtraLineSpacing;
property Gutter;
property HideSelection;
@ -7643,6 +7650,13 @@ begin
end;
{$IFDEF SYN_LAZARUS}
procedure TCustomSynEdit.SetExtraCharSpacing(const Value: integer);
begin
if fExtraCharSpacing=Value then exit;
fExtraCharSpacing := Value;
FontChanged(self);
end;
procedure TCustomSynEdit.SetLastMouseCaret(const AValue: TPoint);
begin
if (FLastMouseCaret.X=AValue.X) and (FLastMouseCaret.Y=AValue.Y) then exit;
@ -9091,6 +9105,9 @@ end;
procedure TCustomSynEdit.SetExtraLineSpacing(const Value: integer);
begin
{$IFDEF SYN_LAZARUS}
if fExtraLineSpacing=Value then exit;
{$ENDIF}
fExtraLineSpacing := Value;
FontChanged(self);
end;
@ -9934,7 +9951,7 @@ begin
//debugln('TCustomSynEdit.RecalcCharExtent B CharHeight=',dbgs(CharHeight));
fTextHeight := CharHeight + fExtraLineSpacing;
BaseStyle := BoldStyles[UsesFontStyle(fsBold)];
fCharWidth := CharWidth;
fCharWidth := CharWidth {$IFDEF SYN_LAZARUS}+fExtraCharSpacing{$ENDIF};
end;
{$IFDEF SYN_LAZARUS}
FUseUTF8:=fTextDrawer.UseUTF8;

View File

@ -3,8 +3,6 @@ object EditorOptionsForm: TEditorOptionsForm
Height = 541
Top = 167
Width = 554
HorzScrollBar.Page = 553
VertScrollBar.Page = 540
ActiveControl = MainNotebook
Caption = 'EditorOptionsForm'
ClientHeight = 541
@ -20,12 +18,12 @@ object EditorOptionsForm: TEditorOptionsForm
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 6
PageIndex = 2
PageIndex = 1
TabOrder = 0
object GeneralPage: TPage
Caption = 'GeneralPage'
ClientWidth = 477
ClientHeight = 453
ClientWidth = 550
ClientHeight = 463
object BlockIndentLabel: TLabel
AnchorSideLeft.Control = BlockIndentComboBox
AnchorSideLeft.Side = asrBottom
@ -33,7 +31,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Side = asrCenter
Left = 112
Height = 20
Top = 362
Top = 372
Width = 109
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
@ -47,7 +45,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Side = asrCenter
Left = 112
Height = 20
Top = 393
Top = 403
Width = 100
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
@ -61,7 +59,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Side = asrCenter
Left = 112
Height = 20
Top = 424
Top = 434
Width = 98
Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6
@ -72,9 +70,9 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BlockIndentLabel
Left = 6
Height = 344
Height = 354
Top = 6
Width = 465
Width = 538
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
@ -98,7 +96,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Control = UndoLimitComboBox
Left = 6
Height = 25
Top = 360
Top = 370
Width = 100
Anchors = [akLeft, akBottom]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
@ -119,7 +117,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Control = TabWidthsComboBox
Left = 6
Height = 25
Top = 391
Top = 401
Width = 100
Anchors = [akLeft, akBottom]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
@ -140,7 +138,7 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 25
Top = 422
Top = 432
Width = 100
Anchors = [akLeft, akBottom]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
@ -160,18 +158,18 @@ object EditorOptionsForm: TEditorOptionsForm
end
object DisplayPage: TPage
Caption = 'DisplayPage'
ClientWidth = 477
ClientHeight = 453
ClientWidth = 550
ClientHeight = 463
object MarginAndGutterGroupBox: TGroupBox
Left = 6
Height = 128
Top = 6
Width = 465
Width = 538
Align = alTop
BorderSpacing.Around = 6
Caption = 'MarginAndGutterGroupBox'
ClientHeight = 109
ClientWidth = 461
ClientWidth = 534
TabOrder = 0
object RightMarginLabel: TLabel
Left = 358
@ -264,20 +262,21 @@ object EditorOptionsForm: TEditorOptionsForm
end
object EditorFontGroupBox: TGroupBox
Left = 6
Height = 136
Height = 148
Top = 140
Width = 465
Width = 538
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'EditorFontGroupBox'
ClientHeight = 117
ClientWidth = 461
ClientHeight = 129
ClientWidth = 534
TabOrder = 1
object EditorFontLabel: TLabel
Left = 6
Height = 20
Top = 6
Width = 449
Width = 522
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -286,31 +285,47 @@ object EditorOptionsForm: TEditorOptionsForm
ParentColor = False
end
object EditorFontHeightLabel: TLabel
AnchorSideTop.Control = EditorFontHeightComboBox
AnchorSideTop.Side = asrCenter
Left = 116
Height = 20
Top = 60
Width = 322
Top = 45
Width = 395
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'EditorFontHeightLabel'
ParentColor = False
end
object ExtraLineSpacingLabel: TLabel
AnchorSideTop.Control = ExtraLineSpacingComboBox
AnchorSideTop.Side = asrCenter
Left = 116
Height = 20
Top = 90
Width = 322
Top = 74
Width = 395
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'ExtraLineSpacingLabel'
ParentColor = False
end
object ExtraCharSpacingLabel: TLabel
AnchorSideTop.Control = ExtraCharSpacingComboBox
AnchorSideTop.Side = asrCenter
Left = 116
Height = 20
Top = 103
Width = 395
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'ExtraCharSpacingLabel'
ParentColor = False
end
object EditorFontComboBox: TComboBox
AnchorSideRight.Control = EditorFontButton
Left = 6
Height = 29
Top = 29
Width = 404
Top = 6
Width = 477
Anchors = [akTop, akLeft, akRight]
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
BorderSpacing.Around = 6
@ -320,9 +335,9 @@ object EditorOptionsForm: TEditorOptionsForm
Text = 'EditorFontComboBox'
end
object EditorFontButton: TButton
Left = 416
Left = 489
Height = 25
Top = 29
Top = 6
Width = 25
Anchors = [akTop, akRight]
Caption = '...'
@ -330,9 +345,11 @@ object EditorOptionsForm: TEditorOptionsForm
TabOrder = 1
end
object EditorFontHeightComboBox: TComboBox
AnchorSideTop.Control = EditorFontComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 58
Top = 41
Width = 100
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Items.Strings = (
@ -353,9 +370,30 @@ object EditorOptionsForm: TEditorOptionsForm
TabOrder = 2
end
object ExtraLineSpacingComboBox: TComboBox
AnchorSideTop.Control = EditorFontHeightComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 88
Top = 70
Width = 100
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Items.Strings = (
'0'
'1'
'2'
)
MaxLength = 0
OnChange = ComboBoxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboBoxOnKeyDown
TabOrder = 4
end
object ExtraCharSpacingComboBox: TComboBox
AnchorSideTop.Control = ExtraLineSpacingComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 99
Width = 100
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Items.Strings = (
@ -372,12 +410,11 @@ object EditorOptionsForm: TEditorOptionsForm
end
object DisplayPreview: TSynEdit
Left = 6
Height = 165
Top = 282
Width = 465
Align = alBottom
Height = 163
Top = 294
Width = 538
Align = alClient
BorderSpacing.Around = 6
Anchors = [akTop, akLeft, akRight, akBottom]
Font.Height = -16
Font.Name = 'courier'
ParentColor = False
@ -747,10 +784,10 @@ object EditorOptionsForm: TEditorOptionsForm
AnchorSideTop.Control = KeymappingPage
AnchorSideRight.Control = KeymappingPage
AnchorSideRight.Side = asrBottom
Left = 273
Left = 297
Height = 29
Top = 6
Width = 271
Width = 247
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 6
@ -771,7 +808,7 @@ object EditorOptionsForm: TEditorOptionsForm
Align = alBottom
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Around = 6
DefaultItemHeight = 21
DefaultItemHeight = 23
Images = ImageList
ReadOnly = True
RowSelect = True
@ -1358,24 +1395,24 @@ object EditorOptionsForm: TEditorOptionsForm
end
object CodetoolsPage: TPage
Caption = 'CodetoolsPage'
ClientWidth = 477
ClientHeight = 453
ClientWidth = 550
ClientHeight = 463
object AutomaticFeaturesGroupBox: TGroupBox
Left = 6
Height = 441
Height = 451
Top = 6
Width = 465
Width = 538
Align = alClient
BorderSpacing.Around = 6
Caption = 'AutomaticFeaturesGroupBox'
ClientHeight = 422
ClientWidth = 461
ClientHeight = 432
ClientWidth = 534
TabOrder = 0
object AutoDelayLabel: TLabel
Left = 6
Height = 20
Top = 188
Width = 449
Width = 522
Align = alTop
BorderSpacing.Top = 24
BorderSpacing.Around = 6
@ -1396,7 +1433,7 @@ object EditorOptionsForm: TEditorOptionsForm
object AutoDelayMaxLabel: TLabel
AnchorSideTop.Control = AutoDelayTrackBar
AnchorSideTop.Side = asrBottom
Left = 316
Left = 389
Height = 20
Top = 160
Width = 127
@ -1410,7 +1447,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 22
Top = 6
Width = 449
Width = 522
Align = alTop
BorderSpacing.Around = 6
Caption = 'AutoIdentifierCompletionCheckBox'
@ -1420,7 +1457,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 22
Top = 62
Width = 449
Width = 522
Align = alTop
BorderSpacing.Around = 6
Caption = 'AutoCodeParametersCheckBox'
@ -1431,7 +1468,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 22
Top = 90
Width = 449
Width = 522
Align = alTop
BorderSpacing.Around = 6
Caption = 'AutoToolTipExprEvalCheckBox'
@ -1441,7 +1478,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 22
Top = 34
Width = 449
Width = 522
Align = alTop
BorderSpacing.Around = 6
Caption = 'AutoToolTipSymbToolsCheckBox'
@ -1451,7 +1488,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 40
Top = 118
Width = 449
Width = 522
Frequency = 250
Max = 4000
Min = 500
@ -1467,8 +1504,8 @@ object EditorOptionsForm: TEditorOptionsForm
end
object CodeFolding: TPage
Caption = 'CodeFolding'
ClientWidth = 477
ClientHeight = 453
ClientWidth = 550
ClientHeight = 463
object lblDividerDrawLevel: TLabel
Left = 6
Height = 20
@ -1481,7 +1518,7 @@ object EditorOptionsForm: TEditorOptionsForm
Left = 6
Height = 2
Top = 49
Width = 464
Width = 537
Anchors = [akTop, akLeft, akRight]
end
object chkCodeFoldingEnabled: TCheckBox

File diff suppressed because it is too large Load Diff

View File

@ -362,6 +362,7 @@ type
fRightMarginColor: TColor;
fEditorFont: String;
fEditorFontHeight: Integer;
fExtraCharSpacing: Integer;
fExtraLineSpacing: Integer;
FDoNotWarnForFont: string;
@ -460,8 +461,10 @@ type
property EditorFont: String read fEditorFont write fEditorFont;
property EditorFontHeight: Integer
read fEditorFontHeight write FEditorFontHeight;
property ExtraCharSpacing: Integer
read fExtraCharSpacing write fExtraCharSpacing default 0;
property ExtraLineSpacing: Integer
read fExtraLineSpacing write fExtraLineSpacing default 0;
read fExtraLineSpacing write fExtraLineSpacing default 1;
property DoNotWarnForFont: string read FDoNotWarnForFont write FDoNotWarnForFont;
// Key Mappings
@ -540,6 +543,8 @@ type
EditorFontHeightComboBox: TComboBox;
ExtraLineSpacingLabel: TLabel;
ExtraLineSpacingComboBox: TComboBox;
ExtraCharSpacingLabel: TLabel;
ExtraCharSpacingComboBox: TComboBox;
DisplayPreview: TPreviewEditor;
// Key Mappings
@ -1559,6 +1564,8 @@ begin
XMLConfig.GetValue('EditorOptions/Display/EditorFont', 'courier');
fEditorFontHeight :=
XMLConfig.GetValue('EditorOptions/Display/EditorFontHeight', 12);
fExtraCharSpacing :=
XMLConfig.GetValue('EditorOptions/Display/ExtraCharSpacing', 0);
fExtraLineSpacing :=
XMLConfig.GetValue('EditorOptions/Display/ExtraLineSpacing', 1);
FDoNotWarnForFont :=
@ -1688,6 +1695,8 @@ begin
fEditorFont, 'courier');
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFontHeight'
,fEditorFontHeight, 12);
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraCharSpacing'
,fExtraCharSpacing, 1);
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraLineSpacing'
,fExtraLineSpacing, 1);
XMLConfig.SetDeleteValue('EditorOptions/Display/DoNotWarnForFont'
@ -2184,6 +2193,7 @@ begin
ASynEdit.RightEdgeColor := fRightMarginColor;
ASynEdit.Font.Height := fEditorFontHeight;// set height before name for XLFD !
ASynEdit.Font.Name := fEditorFont;
ASynEdit.ExtraCharSpacing := fExtraCharSpacing;
ASynEdit.ExtraLineSpacing := fExtraLineSpacing;
ASynEdit.MaxUndo := fUndoLimit;
GetLineColors(ASynEdit.Highlighter, ahaTextBlock, FG, BG);
@ -2217,6 +2227,7 @@ begin
fRightMarginColor := ASynEdit.RightEdgeColor;
fEditorFont := ASynEdit.Font.Name;
fEditorFontHeight := ASynEdit.Font.Height;
fExtraCharSpacing := ASynEdit.ExtraCharSpacing;
fExtraLineSpacing := ASynEdit.ExtraLineSpacing;
fUndoLimit := ASynEdit.MaxUndo;
end;
@ -2273,6 +2284,7 @@ begin
ASynEdit.RightEdgeColor := fRightMarginColor;
ASynEdit.Font.Height := fEditorFontHeight; // set height before Name for XLFD !
ASynEdit.Font.Name := fEditorFont;
ASynEdit.ExtraCharSpacing := fExtraCharSpacing;
ASynEdit.ExtraLineSpacing := fExtraLineSpacing;
ASynEdit.ReadOnly := True;
@ -2719,6 +2731,16 @@ begin
PreviewEdits[a].Font.Height := NewVal;
end
else
if Sender = ExtraCharSpacingComboBox then
begin
NewVal := StrToIntDef(ExtraCharSpacingComboBox.Text,
PreviewEdits[1].ExtraCharSpacing);
SetComboBoxText(ExtraCharSpacingComboBox, IntToStr(NewVal));
for a := Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[a] <> Nil then
PreviewEdits[a].ExtraCharSpacing := NewVal;
end
else
if Sender = ExtraLineSpacingComboBox then
begin
NewVal := StrToIntDef(ExtraLineSpacingComboBox.Text,
@ -3547,10 +3569,9 @@ begin
EditorFontHeightLabel.Caption := dlgEditorFontHeight;
with ExtraLineSpacingComboBox do
SetComboBoxText(ExtraLineSpacingComboBox
, IntToStr(EditorOpts.ExtraLineSpacing));
SetComboBoxText(ExtraCharSpacingComboBox,IntToStr(EditorOpts.ExtraCharSpacing));
ExtraCharSpacingLabel.Caption := dlgExtraCharSpacing;
SetComboBoxText(ExtraLineSpacingComboBox,IntToStr(EditorOpts.ExtraLineSpacing));
ExtraLineSpacingLabel.Caption := dlgExtraLineSpacing;
end;

View File

@ -1107,6 +1107,7 @@ resourcestring
dlgEditorFont = 'Editor font';
dlgDefaultEditorFont='Default editor font';
dlgEditorFontHeight = 'Editor font height';
dlgExtraCharSpacing = 'Extra char spacing';
dlgExtraLineSpacing = 'Extra line spacing';
dlgKeyMappingScheme = 'Key Mapping Scheme';
dlgCheckConsistency = 'Check consistency';