Issue #8: show current highlighter colors as "Current custom settings" preset, in preferences dialog

This commit is contained in:
Ansgar Becker
2018-11-09 18:41:12 +01:00
parent 4c75d24b4c
commit 2947bfa09b
3 changed files with 17 additions and 1 deletions

View File

@ -744,14 +744,17 @@ procedure Toptionsform.comboEditorColorsPresetChange(Sender: TObject);
var
i, j: Integer;
Highlighter: TSynSQLSyn;
FoundHighlighter: Boolean;
begin
// Color preset selected
FoundHighlighter := False;
for i:=0 to ComponentCount-1 do begin
if (Components[i] is TSynSQLSyn)
and (Components[i] <> SynMemoSQLSample.Highlighter)
then begin
Highlighter := Components[i] as TSynSQLSyn;
if SynRegExpr.ExecRegExpr('[a-zA-Z]+_'+comboEditorColorsPreset.Text, Highlighter.Name) then begin
FoundHighlighter := True;
for j:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin
SynSQLSynSQLSample.Attribute[j].AssignColorAndStyle(Highlighter.Attribute[j]);
end;
@ -764,6 +767,12 @@ begin
end;
end;
end;
if not FoundHighlighter then begin
// Show current custom settings
for i:=0 to SynSQLSynSQLSample.AttrCount - 1 do begin
SynSQLSynSQLSample.Attribute[i].AssignColorAndStyle(MainForm.SynSQLSynUsed.Attribute[i]);
end;
end;
Modified(Sender);
end;