mirror of https://gitlab.com/basile.b/dexed.git
Merge branch 'a12_2_a13'
This commit is contained in:
commit
20bb18b227
|
@ -265,6 +265,7 @@ end;
|
||||||
constructor TSynD2Syn.create(aOwner: TComponent);
|
constructor TSynD2Syn.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
|
SetSubComponent(true);
|
||||||
|
|
||||||
DefaultFilter:= 'D source|*.d|D interface|*.di';
|
DefaultFilter:= 'D source|*.d|D interface|*.di';
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,13 @@ type
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Container for the editor and highlither options.
|
* Container for the editor and highlither options.
|
||||||
* The base class is also used to backup settings
|
* The base class is also used to backup the settings
|
||||||
* to allow settings to be previewed in live and restored
|
* to allow a live preview and to restore them when not accepted.
|
||||||
* when not accepted.
|
|
||||||
*)
|
*)
|
||||||
TCEEditorOptionsBase = class(TWritableLfmTextComponent)
|
TCEEditorOptionsBase = class(TWritableLfmTextComponent)
|
||||||
private
|
private
|
||||||
fDHlOptions: TPersistent;
|
fD2Syn: TPersistent;
|
||||||
fTxtHlOptions: TPersistent;
|
fTxtSyn: TPersistent;
|
||||||
fFont: TFont;
|
fFont: TFont;
|
||||||
//
|
//
|
||||||
fTabWidth: Integer;
|
fTabWidth: Integer;
|
||||||
|
@ -40,6 +39,8 @@ type
|
||||||
fMouseOptions: TSynEditorMouseOptions;
|
fMouseOptions: TSynEditorMouseOptions;
|
||||||
//
|
//
|
||||||
procedure setFont(aFont: TFont);
|
procedure setFont(aFont: TFont);
|
||||||
|
procedure setD2Syn(aValue: TPersistent);
|
||||||
|
procedure setTxtSyn(aValue: TPersistent);
|
||||||
published
|
published
|
||||||
property tabulationWidth: Integer read fTabWidth write fTabWidth;
|
property tabulationWidth: Integer read fTabWidth write fTabWidth;
|
||||||
property blockIdentation: Integer read fBlockIdent write fBlockIdent;
|
property blockIdentation: Integer read fBlockIdent write fBlockIdent;
|
||||||
|
@ -49,11 +50,11 @@ type
|
||||||
property options1: TSynEditorOptions read fOptions1 write fOptions1;
|
property options1: TSynEditorOptions read fOptions1 write fOptions1;
|
||||||
property options2: TSynEditorOptions2 read fOptions2 write fOptions2;
|
property options2: TSynEditorOptions2 read fOptions2 write fOptions2;
|
||||||
property mouseOptions: TSynEditorMouseOptions read fMouseOptions write fMouseOptions;
|
property mouseOptions: TSynEditorMouseOptions read fMouseOptions write fMouseOptions;
|
||||||
|
property D2Highlighter: TPersistent read fD2Syn write setD2Syn;
|
||||||
property D_colorizer: TPersistent read fDHlOptions;
|
property TxtHighlighter: TPersistent read fTxtSyn write setTxtSyn;
|
||||||
property TXT_colorizer: TPersistent read fTxtHlOptions;
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
//
|
//
|
||||||
procedure assign(src: TPersistent); override;
|
procedure assign(src: TPersistent); override;
|
||||||
end;
|
end;
|
||||||
|
@ -77,22 +78,25 @@ type
|
||||||
//
|
//
|
||||||
procedure applyChangesFromSelf;
|
procedure applyChangesFromSelf;
|
||||||
procedure applyChangeToEditor(anEditor: TCESynMemo);
|
procedure applyChangeToEditor(anEditor: TCESynMemo);
|
||||||
|
protected
|
||||||
|
procedure afterLoad; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
const
|
||||||
|
edoptFname = 'editor.txt';
|
||||||
|
|
||||||
var
|
var
|
||||||
EditorOptions: TCEEditorOptions;
|
EditorOptions: TCEEditorOptions;
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{$REGION Standard Comp/Obj -----------------------------------------------------}
|
{$REGION Standard Comp/Obj -----------------------------------------------------}
|
||||||
constructor TCEEditorOptionsBase.Create(AOwner: TComponent);
|
constructor TCEEditorOptionsBase.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
fDHlOptions := D2Syn;
|
|
||||||
fTxtHlOptions := TxtSyn;
|
|
||||||
//
|
//
|
||||||
fFont := TFont.Create;
|
fFont := TFont.Create;
|
||||||
fFont.Size := 10;
|
fFont.Size := 10;
|
||||||
|
@ -101,6 +105,11 @@ begin
|
||||||
fFont.Pitch := fpFixed;
|
fFont.Pitch := fpFixed;
|
||||||
fFont.Size:= 10;
|
fFont.Size:= 10;
|
||||||
//
|
//
|
||||||
|
fD2Syn := TSynD2Syn.create(self);
|
||||||
|
fD2Syn.Assign(D2Syn);
|
||||||
|
fTxtSyn := TSynTxtSyn.create(self);
|
||||||
|
fTxtSyn.Assign(TxtSyn);
|
||||||
|
//
|
||||||
tabulationWidth := 4;
|
tabulationWidth := 4;
|
||||||
blockIdentation := 4;
|
blockIdentation := 4;
|
||||||
//
|
//
|
||||||
|
@ -114,16 +123,9 @@ begin
|
||||||
[emAltSetsColumnMode, emDragDropEditing, emCtrlWheelZoom, emShowCtrlMouseLinks];
|
[emAltSetsColumnMode, emDragDropEditing, emCtrlWheelZoom, emShowCtrlMouseLinks];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCEEditorOptions.Create(AOwner: TComponent);
|
destructor TCEEditorOptionsBase.Destroy;
|
||||||
begin
|
begin
|
||||||
inherited;
|
fFont.Free;
|
||||||
fBackup := TCEEditorOptionsBase.Create(self);
|
|
||||||
EntitiesConnector.addObserver(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TCEEditorOptions.Destroy;
|
|
||||||
begin
|
|
||||||
EntitiesConnector.removeObserver(self);
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -136,6 +138,8 @@ begin
|
||||||
srcopt := TCEEditorOptionsBase(src);
|
srcopt := TCEEditorOptionsBase(src);
|
||||||
//
|
//
|
||||||
font.Assign(srcopt.font);
|
font.Assign(srcopt.font);
|
||||||
|
fD2Syn.Assign(srcopt.fD2Syn);
|
||||||
|
fTxtSyn.Assign(srcopt.fTxtSyn);
|
||||||
tabulationWidth := srcopt.tabulationWidth;
|
tabulationWidth := srcopt.tabulationWidth;
|
||||||
blockIdentation := srcopt.blockIdentation;
|
blockIdentation := srcopt.blockIdentation;
|
||||||
lineSpacing := srcopt.lineSpacing;
|
lineSpacing := srcopt.lineSpacing;
|
||||||
|
@ -151,6 +155,43 @@ procedure TCEEditorOptionsBase.setFont(aFont: TFont);
|
||||||
begin
|
begin
|
||||||
fFont.Assign(aFont);
|
fFont.Assign(aFont);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorOptionsBase.setD2Syn(aValue: TPersistent);
|
||||||
|
begin
|
||||||
|
D2Syn.Assign(aValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorOptionsBase.setTxtSyn(aValue: TPersistent);
|
||||||
|
begin
|
||||||
|
TxtSyn.Assign(aValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TCEEditorOptions.Create(AOwner: TComponent);
|
||||||
|
var
|
||||||
|
fname: string;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fBackup := TCEEditorOptionsBase.Create(self);
|
||||||
|
EntitiesConnector.addObserver(self);
|
||||||
|
//
|
||||||
|
fname := getCoeditDocPath + edoptFname;
|
||||||
|
if fileExists(fname) then loadFromFile(fname);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCEEditorOptions.Destroy;
|
||||||
|
begin
|
||||||
|
saveToFile(getCoeditDocPath + edoptFname);
|
||||||
|
//
|
||||||
|
EntitiesConnector.removeObserver(self);
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorOptions.afterLoad;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
D2Syn.Assign(fD2Syn);
|
||||||
|
TxtSyn.Assign(fTxtSyn);
|
||||||
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION ICEMultiDocObserver ----------------------------------------------------}
|
{$REGION ICEMultiDocObserver ----------------------------------------------------}
|
||||||
|
@ -185,7 +226,11 @@ end;
|
||||||
|
|
||||||
function TCEEditorOptions.optionedWantContainer: TPersistent;
|
function TCEEditorOptions.optionedWantContainer: TPersistent;
|
||||||
begin
|
begin
|
||||||
|
fD2Syn := D2Syn;
|
||||||
|
fTxtSyn := TxtSyn;
|
||||||
fBackup.Assign(self);
|
fBackup.Assign(self);
|
||||||
|
fBackup.fD2Syn.Assign(D2Syn);
|
||||||
|
fBackup.fTxtSyn.Assign(TxtSyn);
|
||||||
exit(self);
|
exit(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -193,12 +238,21 @@ procedure TCEEditorOptions.optionedEvent(anEvent: TOptionEditorEvent);
|
||||||
begin
|
begin
|
||||||
// restores
|
// restores
|
||||||
if anEvent = oeeCancel then
|
if anEvent = oeeCancel then
|
||||||
|
begin
|
||||||
self.assign(fBackup);
|
self.assign(fBackup);
|
||||||
// apply
|
D2Syn.Assign(fBackup.fD2Syn);
|
||||||
|
TxtSyn.Assign(fBackup.fTxtSyn);
|
||||||
|
end;
|
||||||
|
// apply, if change/accept event
|
||||||
|
// to get a live preview
|
||||||
applyChangesFromSelf;
|
applyChangesFromSelf;
|
||||||
// new backup values based on accepted values.
|
// new backup values based on accepted values.
|
||||||
if anEvent = oeeAccept then
|
if anEvent = oeeAccept then
|
||||||
|
begin
|
||||||
fBackup.assign(self);
|
fBackup.assign(self);
|
||||||
|
fBackup.fD2Syn.Assign(D2Syn);
|
||||||
|
fBackup.fTxtSyn.Assign(TxtSyn);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
@ -208,16 +262,16 @@ var
|
||||||
multied: ICEMultiDocHandler;
|
multied: ICEMultiDocHandler;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
// editors
|
|
||||||
multied := getMultiDocHandler;
|
multied := getMultiDocHandler;
|
||||||
for i := 0 to multied.documentCount-1 do
|
for i := 0 to multied.documentCount-1 do
|
||||||
applyChangeToEditor(multied.document[i]);
|
applyChangeToEditor(multied.document[i]);
|
||||||
// highlighter(s)
|
|
||||||
// ...
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEEditorOptions.applyChangeToEditor(anEditor: TCESynMemo);
|
procedure TCEEditorOptions.applyChangeToEditor(anEditor: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
|
anEditor.defaultFontSize := font.Size;
|
||||||
|
// current editor zoom cant be mainainted.
|
||||||
anEditor.Font.Assign(font);
|
anEditor.Font.Assign(font);
|
||||||
anEditor.TabWidth := tabulationWidth;
|
anEditor.TabWidth := tabulationWidth;
|
||||||
anEditor.BlockIndent := blockIdentation;
|
anEditor.BlockIndent := blockIdentation;
|
||||||
|
|
|
@ -670,7 +670,7 @@ begin
|
||||||
if ce_common.dlgOkCancel(
|
if ce_common.dlgOkCancel(
|
||||||
'last project modifications are not saved, quit anyway ?') <> mrOK then
|
'last project modifications are not saved, quit anyway ?') <> mrOK then
|
||||||
exit;
|
exit;
|
||||||
for i := 0 to fMultidoc.documentCount-1 do
|
for i := fMultidoc.documentCount-1 downto 0 do
|
||||||
if not fMultidoc.closeDocument(i) then exit;
|
if not fMultidoc.closeDocument(i) then exit;
|
||||||
canClose := true;
|
canClose := true;
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ destructor TCEEntitiesConnector.destroy;
|
||||||
begin
|
begin
|
||||||
fObservers.Free;
|
fObservers.Free;
|
||||||
fSubjects.Free;
|
fSubjects.Free;
|
||||||
|
fServices.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,8 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
|
||||||
Indent = 16
|
Indent = 16
|
||||||
NameFont.Color = clWindowText
|
NameFont.Color = clWindowText
|
||||||
OnModified = inspectorModified
|
OnModified = inspectorModified
|
||||||
SplitterX = 200
|
PreferredSplitterX = 170
|
||||||
|
SplitterX = 170
|
||||||
ValueFont.Color = clMaroon
|
ValueFont.Color = clMaroon
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -85,20 +86,22 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
|
||||||
ClientWidth = 540
|
ClientWidth = 540
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object btnCancel: TSpeedButton
|
object btnCancel: TSpeedButton
|
||||||
Left = 333
|
Left = 473
|
||||||
Height = 24
|
Height = 24
|
||||||
|
Hint = 'cancel and revert modifications'
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 100
|
Width = 30
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BorderSpacing.Left = 2
|
BorderSpacing.Left = 2
|
||||||
BorderSpacing.Around = 2
|
BorderSpacing.Around = 2
|
||||||
OnClick = btnCancelClick
|
OnClick = btnCancelClick
|
||||||
end
|
end
|
||||||
object btnAccept: TSpeedButton
|
object btnAccept: TSpeedButton
|
||||||
Left = 437
|
Left = 507
|
||||||
Height = 24
|
Height = 24
|
||||||
|
Hint = 'accept modifications'
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 100
|
Width = 30
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BorderSpacing.Left = 2
|
BorderSpacing.Left = 2
|
||||||
BorderSpacing.Around = 2
|
BorderSpacing.Around = 2
|
||||||
|
|
|
@ -83,7 +83,7 @@ type
|
||||||
fIdentifier: string;
|
fIdentifier: string;
|
||||||
fTempFileName: string;
|
fTempFileName: string;
|
||||||
fMultiDocSubject: TCECustomSubject;
|
fMultiDocSubject: TCECustomSubject;
|
||||||
fStoredFontSize: Integer;
|
fDefaultFontSize: Integer;
|
||||||
fPositions: TCESynMemoPositions;
|
fPositions: TCESynMemoPositions;
|
||||||
fMousePos: TPoint;
|
fMousePos: TPoint;
|
||||||
function getMouseStart: Integer;
|
function getMouseStart: Integer;
|
||||||
|
@ -91,6 +91,7 @@ type
|
||||||
procedure identifierToD2Syn;
|
procedure identifierToD2Syn;
|
||||||
procedure saveCache;
|
procedure saveCache;
|
||||||
procedure loadCache;
|
procedure loadCache;
|
||||||
|
procedure setDefaultFontSize(aValue: Integer);
|
||||||
protected
|
protected
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
procedure SetHighlighter(const Value: TSynCustomHighlighter); override;
|
procedure SetHighlighter(const Value: TSynCustomHighlighter); override;
|
||||||
|
@ -99,6 +100,8 @@ type
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:Integer); override;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:Integer); override;
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y:Integer); override;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y:Integer); override;
|
||||||
|
published
|
||||||
|
property defaultFontSize: Integer read fDefaultFontSize write setDefaultFontSize;
|
||||||
public
|
public
|
||||||
constructor Create(aOwner: TComponent); override;
|
constructor Create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -317,7 +320,7 @@ constructor TCESynMemo.Create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
SetDefaultKeystrokes; // not called in inherited if owner = nil !
|
SetDefaultKeystrokes; // not called in inherited if owner = nil !
|
||||||
fStoredFontSize := 10;
|
fDefaultFontSize := 10;
|
||||||
Gutter.LineNumberPart.ShowOnlyLineNumbersMultiplesOf := 5;
|
Gutter.LineNumberPart.ShowOnlyLineNumbersMultiplesOf := 5;
|
||||||
Gutter.LineNumberPart.MarkupInfo.Foreground := clGray;
|
Gutter.LineNumberPart.MarkupInfo.Foreground := clGray;
|
||||||
Gutter.SeparatorPart.LineOffset := 1;
|
Gutter.SeparatorPart.LineOffset := 1;
|
||||||
|
@ -360,6 +363,17 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCESynMemo.setDefaultFontSize(aValue: Integer);
|
||||||
|
var
|
||||||
|
old: Integer;
|
||||||
|
begin
|
||||||
|
old := Font.Size;
|
||||||
|
if aValue < 5 then aValue := 5;
|
||||||
|
fDefaultFontSize:= aValue;
|
||||||
|
if Font.Size = old then
|
||||||
|
Font.Size := fDefaultFontSize;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.setFocus;
|
procedure TCESynMemo.setFocus;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -499,7 +513,7 @@ begin
|
||||||
case Key of
|
case Key of
|
||||||
VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1;
|
VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1;
|
||||||
VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1;
|
VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1;
|
||||||
VK_DECIMAL: Font.Size := fStoredFontSize;
|
VK_DECIMAL: Font.Size := fDefaultFontSize;
|
||||||
end;
|
end;
|
||||||
TCEEditorHintWindow.FontSize := Font.Size;
|
TCEEditorHintWindow.FontSize := Font.Size;
|
||||||
end;
|
end;
|
||||||
|
@ -544,7 +558,7 @@ procedure TCESynMemo.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y:Inte
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
if (Button = mbMiddle) and (Shift = [ssCtrl]) then
|
if (Button = mbMiddle) and (Shift = [ssCtrl]) then
|
||||||
Font.Size := fStoredFontSize
|
Font.Size := fDefaultFontSize
|
||||||
//TODO-cLCL&LAZ-specific: test this feature under gtk2/linux on next release, should work
|
//TODO-cLCL&LAZ-specific: test this feature under gtk2/linux on next release, should work
|
||||||
else if Button = mbExtra1 then
|
else if Button = mbExtra1 then
|
||||||
fPositions.back
|
fPositions.back
|
||||||
|
|
|
@ -59,6 +59,7 @@ uses
|
||||||
constructor TSynTxtSyn.create(aOwner: TComponent);
|
constructor TSynTxtSyn.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
SetSubComponent(true);
|
||||||
//
|
//
|
||||||
fSymAttribs := TSynHighlighterAttributes.Create('Symbols', 'Symbols');
|
fSymAttribs := TSynHighlighterAttributes.Create('Symbols', 'Symbols');
|
||||||
fTxtAttribs := TSynHighlighterAttributes.Create('Text', 'Text');
|
fTxtAttribs := TSynHighlighterAttributes.Create('Text', 'Text');
|
||||||
|
|
Loading…
Reference in New Issue