mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:39:23 +02:00
IDE, Options: Unifying Font-specification to only use Size, instead of mixing Size and Height. Issue #0017694 Patch by cobines
git-svn-id: trunk@32150 -
This commit is contained in:
parent
8bc222bed9
commit
d0d565f788
@ -217,7 +217,7 @@ begin
|
|||||||
Caption := lisDisAssAssembler;
|
Caption := lisDisAssAssembler;
|
||||||
|
|
||||||
EditorOpts.AddHandlerAfterWrite(@DoEditorOptsChanged);
|
EditorOpts.AddHandlerAfterWrite(@DoEditorOptsChanged);
|
||||||
pbAsm.Font.Height := EditorOpts.EditorFontHeight;
|
pbAsm.Font.Size := EditorOpts.EditorFontSize;
|
||||||
pbAsm.Font.Name := EditorOpts.EditorFont;
|
pbAsm.Font.Name := EditorOpts.EditorFont;
|
||||||
Caption := lisMenuViewAssembler;
|
Caption := lisMenuViewAssembler;
|
||||||
CopyToClipboard.Caption := lisDbgAsmCopyToClipboard;
|
CopyToClipboard.Caption := lisDbgAsmCopyToClipboard;
|
||||||
@ -679,7 +679,7 @@ procedure TAssemblerDlg.DoEditorOptsChanged(Sender: TObject; Restore: boolean);
|
|||||||
var
|
var
|
||||||
TM: TTextMetric;
|
TM: TTextMetric;
|
||||||
begin
|
begin
|
||||||
pbAsm.Font.Height := EditorOpts.EditorFontHeight;
|
pbAsm.Font.Size := EditorOpts.EditorFontSize;
|
||||||
pbAsm.Font.Name := EditorOpts.EditorFont;
|
pbAsm.Font.Name := EditorOpts.EditorFont;
|
||||||
if EditorOpts.DisableAntialiasing then
|
if EditorOpts.DisableAntialiasing then
|
||||||
pbAsm.Font.Quality := fqNonAntialiased
|
pbAsm.Font.Quality := fqNonAntialiased
|
||||||
|
@ -570,13 +570,15 @@ const
|
|||||||
);
|
);
|
||||||
|
|
||||||
const
|
const
|
||||||
EditorOptsFormatVersion = 7;
|
EditorOptsFormatVersion = 8;
|
||||||
{ * Changes in Version 6:
|
{ * Changes in Version 6:
|
||||||
- ColorSchemes now have a Global settings part.
|
- ColorSchemes now have a Global settings part.
|
||||||
Language specific changes must save UseSchemeGlobals=False (Default is true)
|
Language specific changes must save UseSchemeGlobals=False (Default is true)
|
||||||
Since Version 5 did not have this setting, in Version 5 the default is false.
|
Since Version 5 did not have this setting, in Version 5 the default is false.
|
||||||
* Changes in Version 7:
|
* Changes in Version 7:
|
||||||
DisableAntialiasing default true to false
|
DisableAntialiasing default true to false
|
||||||
|
* Changes in Version 8:
|
||||||
|
Replaced EditorFontHeight with EditorFontSize.
|
||||||
}
|
}
|
||||||
|
|
||||||
LazSyntaxHighlighterClasses: array[TLazSyntaxHighlighter] of
|
LazSyntaxHighlighterClasses: array[TLazSyntaxHighlighter] of
|
||||||
@ -615,6 +617,8 @@ const
|
|||||||
+ [eoHalfPageScroll];
|
+ [eoHalfPageScroll];
|
||||||
SynEditDefaultOptions2 = SYNEDIT_DEFAULT_OPTIONS2;
|
SynEditDefaultOptions2 = SYNEDIT_DEFAULT_OPTIONS2;
|
||||||
|
|
||||||
|
EditorOptionsMinimumFontSize = 5;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TEditOptLanguageInfo stores lazarus IDE additional information
|
{ TEditOptLanguageInfo stores lazarus IDE additional information
|
||||||
of a highlighter, such as samplesource, which sample lines are special
|
of a highlighter, such as samplesource, which sample lines are special
|
||||||
@ -957,7 +961,7 @@ type
|
|||||||
FGutterSeparatorIndex: Integer;
|
FGutterSeparatorIndex: Integer;
|
||||||
fRightMargin: Integer;
|
fRightMargin: Integer;
|
||||||
fEditorFont: String;
|
fEditorFont: String;
|
||||||
fEditorFontHeight: Integer;
|
fEditorFontSize: Integer;
|
||||||
fExtraCharSpacing: Integer;
|
fExtraCharSpacing: Integer;
|
||||||
fExtraLineSpacing: Integer;
|
fExtraLineSpacing: Integer;
|
||||||
fDisableAntialiasing: Boolean;
|
fDisableAntialiasing: Boolean;
|
||||||
@ -1092,8 +1096,8 @@ type
|
|||||||
property RightMargin: Integer
|
property RightMargin: Integer
|
||||||
read fRightMargin write fRightMargin default 80;
|
read fRightMargin write fRightMargin default 80;
|
||||||
property EditorFont: String read fEditorFont write fEditorFont;
|
property EditorFont: String read fEditorFont write fEditorFont;
|
||||||
property EditorFontHeight: Integer
|
property EditorFontSize: Integer
|
||||||
read fEditorFontHeight write FEditorFontHeight;
|
read fEditorFontSize write fEditorFontSize;
|
||||||
property ExtraCharSpacing: Integer
|
property ExtraCharSpacing: Integer
|
||||||
read fExtraCharSpacing write fExtraCharSpacing default 0;
|
read fExtraCharSpacing write fExtraCharSpacing default 0;
|
||||||
property ExtraLineSpacing: Integer
|
property ExtraLineSpacing: Integer
|
||||||
@ -1210,7 +1214,7 @@ var
|
|||||||
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
|
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
|
||||||
function ExtensionToLazSyntaxHighlighter(Ext: String): TLazSyntaxHighlighter;
|
function ExtensionToLazSyntaxHighlighter(Ext: String): TLazSyntaxHighlighter;
|
||||||
function FilenameToLazSyntaxHighlighter(Filename: String): TLazSyntaxHighlighter;
|
function FilenameToLazSyntaxHighlighter(Filename: String): TLazSyntaxHighlighter;
|
||||||
procedure RepairEditorFontHeight(var FontHeight: integer);
|
procedure RepairEditorFontSize(var FontSize: integer);
|
||||||
|
|
||||||
function BuildBorlandDCIFile(ACustomSynAutoComplete: TCustomSynAutoComplete): Boolean;
|
function BuildBorlandDCIFile(ACustomSynAutoComplete: TCustomSynAutoComplete): Boolean;
|
||||||
function ColorSchemeFactory: TColorSchemeFactory;
|
function ColorSchemeFactory: TColorSchemeFactory;
|
||||||
@ -1254,6 +1258,16 @@ const
|
|||||||
var
|
var
|
||||||
DefaultColorSchemeName: String;
|
DefaultColorSchemeName: String;
|
||||||
|
|
||||||
|
function FontHeightToSize(Height: Integer): Integer;
|
||||||
|
var
|
||||||
|
AFont: TFont;
|
||||||
|
begin
|
||||||
|
AFont := TFont.Create;
|
||||||
|
AFont.Height := Height;
|
||||||
|
Result := AFont.Size;
|
||||||
|
AFont.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TSynEditMouseActionKeyCmdHelper }
|
{ TSynEditMouseActionKeyCmdHelper }
|
||||||
|
|
||||||
function TSynEditMouseActionKeyCmdHelper.GetOptionKeyCmd: TSynEditorCommand;
|
function TSynEditMouseActionKeyCmdHelper.GetOptionKeyCmd: TSynEditorCommand;
|
||||||
@ -1268,11 +1282,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure RepairEditorFontHeight(var FontHeight: integer);
|
procedure RepairEditorFontSize(var FontSize: integer);
|
||||||
begin
|
begin
|
||||||
if ((FontHeight>=0) and (FontHeight<=5))
|
if ((FontSize>=0) and (FontSize<=EditorOptionsMinimumFontSize))
|
||||||
or ((FontHeight<0) and (FontHeight>=-5)) then
|
or ((FontSize<0) and (FontSize>=-EditorOptionsMinimumFontSize)) then
|
||||||
FontHeight := SynDefaultFontHeight;
|
FontSize := SynDefaultFontSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
|
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
|
||||||
@ -3047,7 +3061,7 @@ begin
|
|||||||
|
|
||||||
// Display options
|
// Display options
|
||||||
fEditorFont := SynDefaultFontName;
|
fEditorFont := SynDefaultFontName;
|
||||||
fEditorFontHeight := SynDefaultFontHeight;
|
fEditorFontSize := SynDefaultFontSize;
|
||||||
fDisableAntialiasing := DefaultEditorDisableAntiAliasing;
|
fDisableAntialiasing := DefaultEditorDisableAntiAliasing;
|
||||||
|
|
||||||
// Key Mappings
|
// Key Mappings
|
||||||
@ -3199,10 +3213,17 @@ begin
|
|||||||
XMLConfig.GetValue('EditorOptions/Display/RightMargin', 80);
|
XMLConfig.GetValue('EditorOptions/Display/RightMargin', 80);
|
||||||
fEditorFont :=
|
fEditorFont :=
|
||||||
XMLConfig.GetValue('EditorOptions/Display/EditorFont', SynDefaultFontName);
|
XMLConfig.GetValue('EditorOptions/Display/EditorFont', SynDefaultFontName);
|
||||||
fEditorFontHeight :=
|
if FileVersion < 8 then begin
|
||||||
XMLConfig.GetValue('EditorOptions/Display/EditorFontHeight',
|
fEditorFontSize :=
|
||||||
SynDefaultFontHeight);
|
XMLConfig.GetValue('EditorOptions/Display/EditorFontHeight',
|
||||||
RepairEditorFontHeight(fEditorFontHeight);
|
SynDefaultFontHeight);
|
||||||
|
fEditorFontSize := FontHeightToSize(fEditorFontSize);
|
||||||
|
end else begin
|
||||||
|
fEditorFontSize :=
|
||||||
|
XMLConfig.GetValue('EditorOptions/Display/EditorFontSize',
|
||||||
|
SynDefaultFontSize);
|
||||||
|
end;
|
||||||
|
RepairEditorFontSize(fEditorFontSize);
|
||||||
fExtraCharSpacing :=
|
fExtraCharSpacing :=
|
||||||
XMLConfig.GetValue('EditorOptions/Display/ExtraCharSpacing', 0);
|
XMLConfig.GetValue('EditorOptions/Display/ExtraCharSpacing', 0);
|
||||||
fExtraLineSpacing :=
|
fExtraLineSpacing :=
|
||||||
@ -3391,8 +3412,9 @@ begin
|
|||||||
fRightMargin, 80);
|
fRightMargin, 80);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFont',
|
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFont',
|
||||||
fEditorFont, SynDefaultFontName);
|
fEditorFont, SynDefaultFontName);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFontHeight'
|
XMLConfig.DeleteValue('EditorOptions/Display/EditorFontHeight'); // unused old value
|
||||||
,fEditorFontHeight, SynDefaultFontHeight);
|
XMLConfig.SetDeleteValue('EditorOptions/Display/EditorFontSize'
|
||||||
|
,fEditorFontSize, SynDefaultFontSize);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraCharSpacing'
|
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraCharSpacing'
|
||||||
,fExtraCharSpacing, 0);
|
,fExtraCharSpacing, 0);
|
||||||
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraLineSpacing'
|
XMLConfig.SetDeleteValue('EditorOptions/Display/ExtraLineSpacing'
|
||||||
@ -3922,7 +3944,7 @@ end;
|
|||||||
|
|
||||||
procedure TEditorOptions.ApplyFontSettingsTo(ASynEdit: TSynEdit);
|
procedure TEditorOptions.ApplyFontSettingsTo(ASynEdit: TSynEdit);
|
||||||
begin
|
begin
|
||||||
ASynEdit.Font.Height := fEditorFontHeight;// set height before name for XLFD !
|
ASynEdit.Font.Size := fEditorFontSize;// set size before name for XLFD !
|
||||||
ASynEdit.Font.Name := fEditorFont;
|
ASynEdit.Font.Name := fEditorFont;
|
||||||
if fDisableAntialiasing then
|
if fDisableAntialiasing then
|
||||||
ASynEdit.Font.Quality := fqNonAntialiased
|
ASynEdit.Font.Quality := fqNonAntialiased
|
||||||
|
@ -177,17 +177,17 @@ inherited EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
|
|||||||
ClientHeight = 87
|
ClientHeight = 87
|
||||||
ClientWidth = 497
|
ClientWidth = 497
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object EditorFontHeightLabel: TLabel
|
object EditorFontSizeLabel: TLabel
|
||||||
AnchorSideLeft.Control = EditorFontHeightComboBox
|
AnchorSideLeft.Control = EditorFontSizeSpinEdit
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = EditorFontHeightComboBox
|
AnchorSideTop.Control = EditorFontSizeSpinEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 112
|
Left = 112
|
||||||
Height = 14
|
Height = 14
|
||||||
Top = 36
|
Top = 36
|
||||||
Width = 107
|
Width = 107
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'EditorFontHeightLabel'
|
Caption = 'EditorFontSizeLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object ExtraLineSpacingLabel: TLabel
|
object ExtraLineSpacingLabel: TLabel
|
||||||
@ -248,34 +248,20 @@ inherited EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
|
|||||||
OnClick = EditorFontButtonClick
|
OnClick = EditorFontButtonClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object EditorFontHeightComboBox: TComboBox
|
object EditorFontSizeSpinEdit: TSpinEdit
|
||||||
AnchorSideLeft.Control = EditorFontGroupBox
|
AnchorSideLeft.Control = EditorFontGroupBox
|
||||||
AnchorSideTop.Control = EditorFontComboBox
|
AnchorSideTop.Control = EditorFontComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 29
|
||||||
Top = 33
|
Top = 41
|
||||||
Width = 100
|
Width = 50
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
ItemHeight = 13
|
OnChange = EditorFontSizeSpinEditChange
|
||||||
Items.Strings = (
|
|
||||||
'10'
|
|
||||||
'11'
|
|
||||||
'12'
|
|
||||||
'13'
|
|
||||||
'14'
|
|
||||||
'15'
|
|
||||||
'16'
|
|
||||||
'17'
|
|
||||||
'18'
|
|
||||||
)
|
|
||||||
OnChange = ComboboxOnChange
|
|
||||||
OnExit = ComboboxOnExit
|
|
||||||
OnKeyDown = ComboBoxOnKeyDown
|
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object ExtraLineSpacingComboBox: TComboBox
|
object ExtraLineSpacingComboBox: TComboBox
|
||||||
AnchorSideLeft.Control = EditorFontHeightLabel
|
AnchorSideLeft.Control = EditorFontSizeLabel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = EditorFontComboBox
|
AnchorSideTop.Control = EditorFontComboBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
@ -318,7 +304,7 @@ inherited EditorDisplayOptionsFrame: TEditorDisplayOptionsFrame
|
|||||||
end
|
end
|
||||||
object DisableAntialiasingCheckBox: TCheckBox
|
object DisableAntialiasingCheckBox: TCheckBox
|
||||||
AnchorSideLeft.Control = EditorFontGroupBox
|
AnchorSideLeft.Control = EditorFontGroupBox
|
||||||
AnchorSideTop.Control = EditorFontHeightComboBox
|
AnchorSideTop.Control = EditorFontSizeSpinEdit
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 21
|
Height = 21
|
||||||
|
@ -39,8 +39,8 @@ type
|
|||||||
EditorFontButton: TButton;
|
EditorFontButton: TButton;
|
||||||
EditorFontComboBox: TComboBox;
|
EditorFontComboBox: TComboBox;
|
||||||
EditorFontGroupBox: TGroupBox;
|
EditorFontGroupBox: TGroupBox;
|
||||||
EditorFontHeightComboBox: TComboBox;
|
EditorFontSizeSpinEdit: TSpinEdit;
|
||||||
EditorFontHeightLabel: TLabel;
|
EditorFontSizeLabel: TLabel;
|
||||||
ExtraCharSpacingComboBox: TComboBox;
|
ExtraCharSpacingComboBox: TComboBox;
|
||||||
ExtraCharSpacingLabel: TLabel;
|
ExtraCharSpacingLabel: TLabel;
|
||||||
ExtraLineSpacingComboBox: TComboBox;
|
ExtraLineSpacingComboBox: TComboBox;
|
||||||
@ -58,6 +58,7 @@ type
|
|||||||
VisibleRightMarginCheckBox: TCheckBox;
|
VisibleRightMarginCheckBox: TCheckBox;
|
||||||
procedure EditorFontButtonClick(Sender: TObject);
|
procedure EditorFontButtonClick(Sender: TObject);
|
||||||
procedure EditorFontComboBoxEditingDone(Sender: TObject);
|
procedure EditorFontComboBoxEditingDone(Sender: TObject);
|
||||||
|
procedure EditorFontSizeSpinEditChange(Sender: TObject);
|
||||||
procedure ComboboxOnExit(Sender: TObject);
|
procedure ComboboxOnExit(Sender: TObject);
|
||||||
procedure ComboBoxOnKeyDown(Sender: TObject; var Key: Word;
|
procedure ComboBoxOnKeyDown(Sender: TObject; var Key: Word;
|
||||||
Shift: TShiftState);
|
Shift: TShiftState);
|
||||||
@ -69,7 +70,10 @@ type
|
|||||||
procedure ShowLineNumbersCheckBoxClick(Sender: TObject);
|
procedure ShowLineNumbersCheckBoxClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FDialog: TAbstractOptionsEditorDialog;
|
FDialog: TAbstractOptionsEditorDialog;
|
||||||
|
FUpdatingFontSizeRange: Boolean;
|
||||||
|
function FontSizeNegativeToPositive(NegativeSize: Integer): Integer;
|
||||||
function GeneralPage: TEditorGeneralOptionsFrame; inline;
|
function GeneralPage: TEditorGeneralOptionsFrame; inline;
|
||||||
|
procedure SetEditorFontSizeSpinEditValue(FontSize: Integer);
|
||||||
|
|
||||||
procedure FontDialogApplyClicked(Sender: TObject);
|
procedure FontDialogApplyClicked(Sender: TObject);
|
||||||
function DoSynEditMouse(var AnInfo: TSynEditMouseActionInfo;
|
function DoSynEditMouse(var AnInfo: TSynEditMouseActionInfo;
|
||||||
@ -86,6 +90,20 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
LCLIntf;
|
||||||
|
|
||||||
|
function TEditorDisplayOptionsFrame.FontSizeNegativeToPositive(NegativeSize: Integer): Integer;
|
||||||
|
var
|
||||||
|
tm: TTextMetric;
|
||||||
|
begin
|
||||||
|
DisplayPreview.Canvas.Font.Assign(DisplayPreview.Font);
|
||||||
|
if LCLIntf.GetTextMetrics(DisplayPreview.Canvas.Handle, tm) then
|
||||||
|
Result := -(NegativeSize + MulDiv(tm.tmInternalLeading, 72, DisplayPreview.Font.PixelsPerInch))
|
||||||
|
else
|
||||||
|
Result := -NegativeSize;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEditorDisplayOptionsFrame.FontDialogApplyClicked(Sender: TObject);
|
procedure TEditorDisplayOptionsFrame.FontDialogApplyClicked(Sender: TObject);
|
||||||
var
|
var
|
||||||
a: Integer;
|
a: Integer;
|
||||||
@ -96,7 +114,7 @@ begin
|
|||||||
PreviewEdits[a].Font.Assign(TFontDialog(Sender).Font);
|
PreviewEdits[a].Font.Assign(TFontDialog(Sender).Font);
|
||||||
|
|
||||||
SetComboBoxText(EditorFontComboBox, DisplayPreview.Font.Name,cstCaseInsensitive);
|
SetComboBoxText(EditorFontComboBox, DisplayPreview.Font.Name,cstCaseInsensitive);
|
||||||
SetComboBoxText(EditorFontHeightComboBox, IntToStr(DisplayPreview.Font.Height),cstCaseInsensitive);
|
SetEditorFontSizeSpinEditValue(DisplayPreview.Font.Size);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TEditorDisplayOptionsFrame.DoSynEditMouse(var AnInfo: TSynEditMouseActionInfo;
|
function TEditorDisplayOptionsFrame.DoSynEditMouse(var AnInfo: TSynEditMouseActionInfo;
|
||||||
@ -108,16 +126,20 @@ end;
|
|||||||
procedure TEditorDisplayOptionsFrame.EditorFontButtonClick(Sender: TObject);
|
procedure TEditorDisplayOptionsFrame.EditorFontButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
FontDialog: TFontDialog;
|
FontDialog: TFontDialog;
|
||||||
NewHeight: LongInt;
|
CurFontSize: Integer;
|
||||||
begin
|
begin
|
||||||
FontDialog := TFontDialog.Create(nil);
|
FontDialog := TFontDialog.Create(nil);
|
||||||
try
|
try
|
||||||
with FontDialog do
|
with FontDialog do
|
||||||
begin
|
begin
|
||||||
Font.Name := EditorFontComboBox.Text;
|
Font.Name := EditorFontComboBox.Text;
|
||||||
NewHeight := StrToIntDef(EditorFontHeightComboBox.Text, DisplayPreview.Font.Height);
|
CurFontSize := EditorFontSizeSpinEdit.Value;
|
||||||
RepairEditorFontHeight(NewHeight);
|
if CurFontSize < 0 then
|
||||||
Font.Height := NewHeight;
|
begin
|
||||||
|
CurFontSize := FontSizeNegativeToPositive(CurFontSize);
|
||||||
|
RepairEditorFontSize(CurFontSize);
|
||||||
|
end;
|
||||||
|
Font.Size := CurFontSize;
|
||||||
Options := Options + [fdApplyButton];
|
Options := Options + [fdApplyButton];
|
||||||
OnApplyClicked := @FontDialogApplyClicked;
|
OnApplyClicked := @FontDialogApplyClicked;
|
||||||
if Execute then
|
if Execute then
|
||||||
@ -138,21 +160,32 @@ begin
|
|||||||
PreviewEdits[i].Font.Name := EditorFontComboBox.Text;
|
PreviewEdits[i].Font.Name := EditorFontComboBox.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TEditorDisplayOptionsFrame.EditorFontSizeSpinEditChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
NewVal, a: Integer;
|
||||||
|
begin
|
||||||
|
NewVal := EditorFontSizeSpinEdit.Value;
|
||||||
|
if (NewVal < 0) and (NewVal > -EditorOptionsMinimumFontSize) then
|
||||||
|
begin
|
||||||
|
// Skip to minimum positive value. Will trigger OnChange again.
|
||||||
|
SetEditorFontSizeSpinEditValue(EditorOptionsMinimumFontSize);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (NewVal > 0) and not FUpdatingFontSizeRange then
|
||||||
|
EditorFontSizeSpinEdit.MinValue := EditorOptionsMinimumFontSize;
|
||||||
|
|
||||||
|
with GeneralPage do
|
||||||
|
for a := Low(PreviewEdits) to High(PreviewEdits) do
|
||||||
|
if PreviewEdits[a] <> nil then
|
||||||
|
PreviewEdits[a].Font.Size := NewVal;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEditorDisplayOptionsFrame.ComboboxOnExit(Sender: TObject);
|
procedure TEditorDisplayOptionsFrame.ComboboxOnExit(Sender: TObject);
|
||||||
var
|
var
|
||||||
NewVal, a: Integer;
|
NewVal, a: Integer;
|
||||||
begin
|
begin
|
||||||
if Sender = EditorFontHeightComboBox then
|
|
||||||
begin
|
|
||||||
NewVal := StrToIntDef(EditorFontHeightComboBox.Text, DisplayPreview.Font.Height);
|
|
||||||
RepairEditorFontHeight(NewVal);
|
|
||||||
SetComboBoxText(EditorFontHeightComboBox, IntToStr(NewVal),cstCaseInsensitive);
|
|
||||||
with GeneralPage do
|
|
||||||
for a := Low(PreviewEdits) to High(PreviewEdits) do
|
|
||||||
if PreviewEdits[a] <> nil then
|
|
||||||
PreviewEdits[a].Font.Height := NewVal;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if Sender = ExtraCharSpacingComboBox then
|
if Sender = ExtraCharSpacingComboBox then
|
||||||
begin
|
begin
|
||||||
NewVal := StrToIntDef(ExtraCharSpacingComboBox.Text, DisplayPreview.ExtraCharSpacing);
|
NewVal := StrToIntDef(ExtraCharSpacingComboBox.Text, DisplayPreview.ExtraCharSpacing);
|
||||||
@ -277,6 +310,17 @@ begin
|
|||||||
Result := TEditorGeneralOptionsFrame(FDialog.FindEditor(TEditorGeneralOptionsFrame));
|
Result := TEditorGeneralOptionsFrame(FDialog.FindEditor(TEditorGeneralOptionsFrame));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TEditorDisplayOptionsFrame.SetEditorFontSizeSpinEditValue(FontSize: Integer);
|
||||||
|
begin
|
||||||
|
FUpdatingFontSizeRange := True;
|
||||||
|
if FontSize < 0 then
|
||||||
|
EditorFontSizeSpinEdit.MinValue := -EditorFontSizeSpinEdit.MaxValue
|
||||||
|
else
|
||||||
|
EditorFontSizeSpinEdit.MinValue := EditorOptionsMinimumFontSize;
|
||||||
|
FUpdatingFontSizeRange := False;
|
||||||
|
EditorFontSizeSpinEdit.Value := FontSize;
|
||||||
|
end;
|
||||||
|
|
||||||
function TEditorDisplayOptionsFrame.GetTitle: String;
|
function TEditorDisplayOptionsFrame.GetTitle: String;
|
||||||
begin
|
begin
|
||||||
Result := dlgEdDisplay;
|
Result := dlgEdDisplay;
|
||||||
@ -287,6 +331,7 @@ begin
|
|||||||
// Prevent the caret from moving
|
// Prevent the caret from moving
|
||||||
DisplayPreview.RegisterMouseActionSearchHandler(@DoSynEditMouse);
|
DisplayPreview.RegisterMouseActionSearchHandler(@DoSynEditMouse);
|
||||||
FDialog := ADialog;
|
FDialog := ADialog;
|
||||||
|
FUpdatingFontSizeRange := False;
|
||||||
|
|
||||||
MarginAndGutterGroupBox.Caption := dlgMarginGutter;
|
MarginAndGutterGroupBox.Caption := dlgMarginGutter;
|
||||||
VisibleRightMarginCheckBox.Caption := dlgVisibleRightMargin;
|
VisibleRightMarginCheckBox.Caption := dlgVisibleRightMargin;
|
||||||
@ -296,7 +341,7 @@ begin
|
|||||||
GutterSeparatorIndexLabel.Caption := dlgGutterSeparatorIndex;
|
GutterSeparatorIndexLabel.Caption := dlgGutterSeparatorIndex;
|
||||||
RightMarginLabel.Caption := dlgRightMargin;
|
RightMarginLabel.Caption := dlgRightMargin;
|
||||||
EditorFontGroupBox.Caption := dlgDefaultEditorFont;
|
EditorFontGroupBox.Caption := dlgDefaultEditorFont;
|
||||||
EditorFontHeightLabel.Caption := dlgEditorFontHeight;
|
EditorFontSizeLabel.Caption := dlgEditorFontSize;
|
||||||
ExtraCharSpacingLabel.Caption := dlgExtraCharSpacing;
|
ExtraCharSpacingLabel.Caption := dlgExtraCharSpacing;
|
||||||
ExtraLineSpacingLabel.Caption := dlgExtraLineSpacing;
|
ExtraLineSpacingLabel.Caption := dlgExtraLineSpacing;
|
||||||
DisableAntialiasingCheckBox.Caption := dlgDisableAntialiasing;
|
DisableAntialiasingCheckBox.Caption := dlgDisableAntialiasing;
|
||||||
@ -320,7 +365,7 @@ begin
|
|||||||
VisibleRightMarginCheckBox.Checked := VisibleRightMargin;
|
VisibleRightMarginCheckBox.Checked := VisibleRightMargin;
|
||||||
SetComboBoxText(RightMarginComboBox, IntToStr(RightMargin),cstCaseInsensitive);
|
SetComboBoxText(RightMarginComboBox, IntToStr(RightMargin),cstCaseInsensitive);
|
||||||
SetComboBoxText(EditorFontComboBox, EditorFont,cstCaseInsensitive);
|
SetComboBoxText(EditorFontComboBox, EditorFont,cstCaseInsensitive);
|
||||||
SetComboBoxText(EditorFontHeightComboBox, IntToStr(EditorFontHeight),cstCaseInsensitive);
|
SetEditorFontSizeSpinEditValue(EditorFontSize);
|
||||||
SetComboBoxText(ExtraCharSpacingComboBox, IntToStr(ExtraCharSpacing),cstCaseInsensitive);
|
SetComboBoxText(ExtraCharSpacingComboBox, IntToStr(ExtraCharSpacing),cstCaseInsensitive);
|
||||||
SetComboBoxText(ExtraLineSpacingComboBox, IntToStr(ExtraLineSpacing),cstCaseInsensitive);
|
SetComboBoxText(ExtraLineSpacingComboBox, IntToStr(ExtraLineSpacing),cstCaseInsensitive);
|
||||||
DisableAntialiasingCheckBox.Checked := DisableAntialiasing;
|
DisableAntialiasingCheckBox.Checked := DisableAntialiasing;
|
||||||
@ -342,7 +387,7 @@ begin
|
|||||||
VisibleRightMargin := VisibleRightMarginCheckBox.Checked;
|
VisibleRightMargin := VisibleRightMarginCheckBox.Checked;
|
||||||
RightMargin := StrToIntDef(RightMarginComboBox.Text, 80);
|
RightMargin := StrToIntDef(RightMarginComboBox.Text, 80);
|
||||||
EditorFont := EditorFontComboBox.Text;
|
EditorFont := EditorFontComboBox.Text;
|
||||||
EditorFontHeight := StrToIntDef(EditorFontHeightComboBox.Text, EditorFontHeight);
|
EditorFontSize := EditorFontSizeSpinEdit.Value;
|
||||||
ExtraCharSpacing := StrToIntDef(ExtraCharSpacingComboBox.Text, ExtraCharSpacing);
|
ExtraCharSpacing := StrToIntDef(ExtraCharSpacingComboBox.Text, ExtraCharSpacing);
|
||||||
ExtraLineSpacing := StrToIntDef(ExtraLineSpacingComboBox.Text, ExtraLineSpacing);
|
ExtraLineSpacing := StrToIntDef(ExtraLineSpacingComboBox.Text, ExtraLineSpacing);
|
||||||
DisableAntialiasing := DisableAntialiasingCheckBox.Checked;
|
DisableAntialiasing := DisableAntialiasingCheckBox.Checked;
|
||||||
|
@ -1427,7 +1427,7 @@ resourcestring
|
|||||||
dlgGutterColor = 'Gutter Color';
|
dlgGutterColor = 'Gutter Color';
|
||||||
dlgEditorFont = 'Editor font';
|
dlgEditorFont = 'Editor font';
|
||||||
dlgDefaultEditorFont='Default editor font';
|
dlgDefaultEditorFont='Default editor font';
|
||||||
dlgEditorFontHeight = 'Editor font height';
|
dlgEditorFontSize = 'Editor font size';
|
||||||
dlgExtraCharSpacing = 'Extra char spacing';
|
dlgExtraCharSpacing = 'Extra char spacing';
|
||||||
dlgExtraLineSpacing = 'Extra line spacing';
|
dlgExtraLineSpacing = 'Extra line spacing';
|
||||||
dlgDisableAntialiasing = 'Disable anti-aliasing';
|
dlgDisableAntialiasing = 'Disable anti-aliasing';
|
||||||
|
@ -1728,7 +1728,7 @@ begin
|
|||||||
if (Editor<>nil) then
|
if (Editor<>nil) then
|
||||||
Font := Editor.Font
|
Font := Editor.Font
|
||||||
else begin
|
else begin
|
||||||
Font.Height:=EditorOpts.EditorFontHeight; // set Height before name for XLFD !
|
Font.Size:=EditorOpts.EditorFontSize; // set Size before name for XLFD !
|
||||||
Font.Name:=EditorOpts.EditorFont;
|
Font.Name:=EditorOpts.EditorFont;
|
||||||
end;
|
end;
|
||||||
Font.Style:=[];
|
Font.Style:=[];
|
||||||
@ -1763,7 +1763,7 @@ begin
|
|||||||
if (Editor<>nil) then
|
if (Editor<>nil) then
|
||||||
Font:=Editor.Font
|
Font:=Editor.Font
|
||||||
else begin
|
else begin
|
||||||
Font.Height:=EditorOpts.EditorFontHeight; // set Height before name of XLFD !
|
Font.Size:=EditorOpts.EditorFontSize; // set Size before name of XLFD !
|
||||||
Font.Name:=EditorOpts.EditorFont;
|
Font.Name:=EditorOpts.EditorFont;
|
||||||
end;
|
end;
|
||||||
Font.Style:=[];
|
Font.Style:=[];
|
||||||
|
Loading…
Reference in New Issue
Block a user