Permalink
Browse files

Issue #8: provide two color presets for SQL editors in preferences di…

…alog per dropdown, one for dark themes and one for light ones
  • Loading branch information...
ansgarbecker committed Nov 5, 2018
1 parent 953cce3 commit 2a104223736922afa43ac309be91cfb6bfb13514
View
@@ -124,7 +124,7 @@ object CopyTableForm: TCopyTableForm
Gutter.Font.Style = []
Gutter.LeftOffset = 0
Gutter.ShowLineNumbers = True
Highlighter = MainForm.SynSQLSyn1
Highlighter = MainForm.SynSQLSynUsed
Options = [eoAutoIndent, eoAutoSizeMaxScrollWidth, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabIndent]
WantTabs = True
FontSmoothing = fsmNone
View
@@ -209,7 +209,7 @@ procedure TCopyTableForm.TreeElementsChecked(Sender: TBaseVirtualTree; Node: PVi
MemoFilter.Enabled := Node.CheckState = csCheckedNormal;
btnRecentFilters.Enabled := MemoFilter.Enabled;
if MemoFilter.Enabled then begin
MemoFilter.Highlighter := MainForm.SynSQLSyn1;
MemoFilter.Highlighter := MainForm.SynSQLSynUsed;
MemoFilter.Color := GetThemeColor(clWindow);
end else begin
MemoFilter.Highlighter := nil;
@@ -44,7 +44,7 @@ procedure TCreateDatabaseForm.FormCreate(Sender: TObject);
TranslateComponent(Self);
lblCreateCode.Caption := lblCreateCode.Caption + ':';
// Setup SynMemoPreview
SynMemoCreateCode.Highlighter := Mainform.SynSQLSyn1;
SynMemoCreateCode.Highlighter := Mainform.SynSQLSynUsed;
end;
View
@@ -41,7 +41,7 @@ object frmEventEditor: TfrmEventEditor
Gutter.Font.Style = []
Gutter.LeftOffset = 2
Gutter.ShowLineNumbers = True
Highlighter = MainForm.SynSQLSyn1
Highlighter = MainForm.SynSQLSynUsed
Lines.Strings = (
'SynMemoBody')
Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces]
@@ -329,7 +329,7 @@ object frmEventEditor: TfrmEventEditor
Gutter.Font.Style = []
Gutter.LeftOffset = 2
Gutter.ShowLineNumbers = True
Highlighter = MainForm.SynSQLSyn1
Highlighter = MainForm.SynSQLSynUsed
Lines.Strings = (
'SynMemoCREATEcode')
Options = [eoAutoIndent, eoAutoSizeMaxScrollWidth, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces]
@@ -363,7 +363,7 @@ object frmEventEditor: TfrmEventEditor
Gutter.Font.Style = []
Gutter.LeftOffset = 2
Gutter.ShowLineNumbers = True
Highlighter = MainForm.SynSQLSyn1
Highlighter = MainForm.SynSQLSynUsed
Lines.Strings = (
'SynMemoALTERcode')
Options = [eoAutoIndent, eoAutoSizeMaxScrollWidth, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces]
View
@@ -959,7 +959,7 @@ procedure TfrmExportGrid.btnOKClick(Sender: TObject);
case ExportFormat of
efSQLInsert, efSQLReplace, efSQLDeleteInsert: begin
Exporter := TSynExporterHTML.Create(Self);
Exporter.Highlighter := MainForm.SynSQLSyn1;
Exporter.Highlighter := MainForm.SynSQLSynUsed;
Exporter.ExportAll(Explode(CRLF, S.DataString));
HTML := TMemoryStream.Create;
Exporter.SaveToStream(HTML);
View
@@ -56,7 +56,7 @@ object MainForm: TMainForm
Gutter.Font.Style = []
Gutter.LeftOffset = 2
Gutter.ShowLineNumbers = True
Highlighter = SynSQLSyn1
Highlighter = SynSQLSynUsed
Options = [eoAutoIndent, eoDragDropEditing, eoHideShowScrollbars, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces]
ReadOnly = True
RightEdge = 0
@@ -774,7 +774,7 @@ object MainForm: TMainForm
Gutter.Font.Style = []
Gutter.LeftOffset = 2
Gutter.ShowLineNumbers = True
Highlighter = SynSQLSyn1
Highlighter = SynSQLSynUsed
Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces]
ReadOnly = True
RightEdge = 0
@@ -1188,7 +1188,7 @@ object MainForm: TMainForm
Gutter.ShowLineNumbers = True
Gutter.Visible = False
Gutter.Width = 0
Highlighter = SynSQLSyn1
Highlighter = SynSQLSynUsed
Options = [eoAutoIndent, eoDragDropEditing, eoDropFiles, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoTabIndent]
RightEdge = 0
ScrollBars = ssVertical
@@ -1334,7 +1334,7 @@ object MainForm: TMainForm
Gutter.LeftOffset = 2
Gutter.RightOffset = 0
Gutter.ShowLineNumbers = True
Highlighter = SynSQLSyn1
Highlighter = SynSQLSynUsed
Options = [eoAutoIndent, eoAutoSizeMaxScrollWidth, eoDropFiles, eoGroupUndo, eoHideShowScrollbars, eoKeepCaretX, eoShowScrollHint, eoTabIndent]
RightEdge = 0
TabWidth = 3
@@ -9452,7 +9452,7 @@ object MainForm: TMainForm
Action = actRefresh
end
end
object SynSQLSyn1: TSynSQLSyn
object SynSQLSynUsed: TSynSQLSyn
Options.AutoDetectEnabled = False
Options.AutoDetectLineLimit = 0
Options.Visible = False
View
@@ -300,7 +300,7 @@ TMainForm = class(TForm)
Refresh1: TMenuItem;
pnlDataTop: TPanel;
pnlQueryMemo: TPanel;
SynSQLSyn1: TSynSQLSyn;
SynSQLSynUsed: TSynSQLSyn;
SynMemoQuery: TSynMemo;
spltQuery: TSplitter;
TimerHostUptime: TTimer;
@@ -5908,8 +5908,8 @@ procedure TMainForm.ListTablesNewText(Sender: TBaseVirtualTree; Node:
sql := Format(sql, [Obj.QuotedName(True, False), Obj.Connection.QuoteIdent(NewText)]);
Obj.Connection.Query(sql);
if SynSQLSyn1.TableNames.IndexOf( NewText ) = -1 then begin
SynSQLSyn1.TableNames.Add(NewText);
if SynSQLSynUsed.TableNames.IndexOf( NewText ) = -1 then begin
SynSQLSynUsed.TableNames.Add(NewText);
end;
// Update nodedata
Obj.Name := NewText;
@@ -7388,7 +7388,7 @@ procedure TMainForm.ListProcessesFocusChanged(Sender: TBaseVirtualTree;
SynMemoProcessView.Enabled := enableSQLView;
pnlProcessView.Enabled := enableSQLView;
if enableSQLView then begin
SynMemoProcessView.Highlighter := SynSQLSyn1;
SynMemoProcessView.Highlighter := SynSQLSynUsed;
SynMemoProcessView.Text := ListProcesses.Text[Node, 7];
SynMemoProcessView.Color := GetThemeColor(clWindow);
end else begin
@@ -8123,11 +8123,11 @@ procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualN
RefreshHelperNode(HELPERNODE_HISTORY);
case FActiveDbObj.Connection.Parameters.NetTypeGroup of
ngMySQL:
SynSQLSyn1.SQLDialect := sqlMySQL;
SynSQLSynUsed.SQLDialect := sqlMySQL;
ngMSSQL:
SynSQLSyn1.SQLDialect := sqlMSSQL2K;
SynSQLSynUsed.SQLDialect := sqlMSSQL2K;
ngPgSQL:
SynSQLSyn1.SQLDialect := sqlPostgres;
SynSQLSynUsed.SQLDialect := sqlPostgres;
else
raise Exception.CreateFmt(_(MsgUnhandledNetType), [Integer(FActiveDbObj.Connection.Parameters.NetType)]);
end;
@@ -8262,8 +8262,8 @@ procedure TMainForm.ObjectnamesChanged(Connection: TDBConnection; Database: Stri
TableNames, ProcNames: TStringList;
begin
// Tell SQL highlighter about names of tables and procedures in selected database
SynSQLSyn1.TableNames.Clear;
SynSQLSyn1.ProcNames.Clear;
SynSQLSynUsed.TableNames.Clear;
SynSQLSynUsed.ProcNames.Clear;
if Connection.DbObjectsCached(Database) then begin
DBObjects := Connection.GetDBObjects(Database);
TableNames := TStringList.Create;
@@ -8284,8 +8284,8 @@ procedure TMainForm.ObjectnamesChanged(Connection: TDBConnection; Database: Stri
end;
TableNames.EndUpdate;
ProcNames.EndUpdate;
SynSQLSyn1.TableNames.Text := TableNames.Text;
SynSQLSyn1.ProcNames.Text := ProcNames.Text;
SynSQLSynUsed.TableNames.Text := TableNames.Text;
SynSQLSynUsed.ProcNames.Text := ProcNames.Text;
TableNames.Free;
ProcNames.Free;
end;
@@ -9818,7 +9818,7 @@ procedure TMainForm.actCopyOrCutExecute(Sender: TObject);
Clipboard.Open;
Clipboard.AsText := SynMemo.SelText;
Exporter := TSynExporterRTF.Create(Self);
Exporter.Highlighter := SynSQLSyn1;
Exporter.Highlighter := SynSQLSynUsed;
Exporter.ExportAll(Explode(CRLF, SynMemo.SelText));
if DoCut then SynMemo.CutToClipboard
else SynMemo.CopyToClipboard;
@@ -11005,8 +11005,8 @@ procedure TMainform.SetupSynEditors;
Editor.Keystrokes := BaseEditor.KeyStrokes;
end;
// Highlighting
for i:=0 to SynSQLSyn1.AttrCount - 1 do begin
Attri := SynSQLSyn1.Attribute[i];
for i:=0 to SynSQLSynUsed.AttrCount - 1 do begin
Attri := SynSQLSynUsed.Attribute[i];
Attri.Foreground := AppSettings.ReadInt(asHighlighterForeground, Attri.Name, Attri.Foreground);
Attri.Background := AppSettings.ReadInt(asHighlighterBackground, Attri.Name, Attri.Background);
Attri.IntegerStyle := AppSettings.ReadInt(asHighlighterStyle, Attri.Name, Attri.IntegerStyle);
Oops, something went wrong.

0 comments on commit 2a10422

Please sign in to comment.