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

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2018-10-23 21:30+0200\n"
"PO-Revision-Date: 2018-11-09 18:40+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@ -6257,3 +6257,6 @@ msgstr "Error: Could not move \"%s\" to \"%s\" (Error: %s)"
msgid "Scaling font size from %d to %d."
msgstr "Scaling font size from %d to %d."
msgid "Current custom settings"
msgstr "Current custom settings"

View File

@ -810,8 +810,12 @@ object optionsform: Toptionsform
Width = 284
Height = 21
Style = csDropDownList
ItemIndex = 0
TabOrder = 12
Text = 'Current custom settings'
OnChange = comboEditorColorsPresetChange
Items.Strings = (
'Current custom settings')
end
end
end

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;