Index: ctl/ctlSQLBox.cpp
===================================================================
--- ctl/ctlSQLBox.cpp (revision 8173)
+++ ctl/ctlSQLBox.cpp (working copy)
@@ -80,6 +80,21 @@
extern sysSettings *settings;
wxFont fntSQLBox = settings->GetSQLFont();
+ wxColour bgColor = settings->GetSQLBoxColourBackground();
+ if (settings->GetSQLBoxUseSystemBackground())
+ {
+ bgColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
+ }
+
+ wxColour frColor = settings->GetSQLBoxColourForeground();
+ if (settings->GetSQLBoxUseSystemForeground())
+ {
+ frColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ }
+
+ StyleSetBackground(wxSTC_STYLE_DEFAULT, bgColor);
+ StyleSetForeground(wxSTC_STYLE_DEFAULT, frColor);
+
StyleSetFont(wxSTC_STYLE_DEFAULT, fntSQLBox);
StyleSetFont(0, fntSQLBox);
StyleSetFont(1, fntSQLBox);
@@ -99,18 +114,11 @@
SetUseTabs(!settings->GetSpacesForTabs());
// Setup the different highlight colurs
- StyleSetForeground(0, wxColour(0x80, 0x80, 0x80));
- StyleSetForeground(1, wxColour(0x00, 0x7f, 0x00));
- StyleSetForeground(2, wxColour(0x00, 0x7f, 0x00));
- StyleSetForeground(3, wxColour(0x7f, 0x7f, 0x7f));
- StyleSetForeground(4, wxColour(0x00, 0x7f, 0x7f));
- StyleSetForeground(5, wxColour(0x00, 0x00, 0x7f));
- StyleSetForeground(6, wxColour(0x7f, 0x00, 0x7f));
- StyleSetForeground(7, wxColour(0x7f, 0x00, 0x7f));
- StyleSetForeground(8, wxColour(0x00, 0x7f, 0x7f));
- StyleSetForeground(9, wxColour(0x7f, 0x7f, 0x7f));
- StyleSetForeground(10, wxColour(0x00, 0x00, 0x00));
- StyleSetForeground(11, wxColour(0x00, 0x00, 0x00));
+ for (int i = 0; i <= 11; ++ i )
+ {
+ StyleSetForeground(i, settings->GetSQLBoxColour(i));
+ StyleSetBackground(i, bgColor);
+ }
// Brace maching styles
StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF));
Index: frm/frmOptions.cpp
===================================================================
--- frm/frmOptions.cpp (revision 8173)
+++ frm/frmOptions.cpp (working copy)
@@ -73,6 +73,10 @@
#define pickerActiveProcessColour CTRL_COLOURPICKER("pickerActiveProcessColour")
#define pickerSlowProcessColour CTRL_COLOURPICKER("pickerSlowProcessColour")
#define pickerBlockedProcessColour CTRL_COLOURPICKER("pickerBlockedProcessColour")
+#define chkSQLUseSystemBackgroundColour CTRL_CHECKBOX("chkSQLUseSystemBackgroundColour")
+#define chkSQLUseSystemForegroundColour CTRL_CHECKBOX("chkSQLUseSystemForegroundColour")
+#define pickerSQLBackgroundColour CTRL_COLOURPICKER("pickerSQLBackgroundColour")
+#define pickerSQLForegroundColour CTRL_COLOURPICKER("pickerSQLForegroundColour")
BEGIN_EVENT_TABLE(frmOptions, pgDialog)
EVT_MENU(MNU_HELP, frmOptions::OnHelp)
@@ -227,6 +231,18 @@
pickerSlowProcessColour->SetColour(settings->GetSlowProcessColour());
pickerBlockedProcessColour->SetColour(settings->GetBlockedProcessColour());
+ chkSQLUseSystemBackgroundColour->SetValue(settings->GetSQLBoxUseSystemBackground());
+ chkSQLUseSystemForegroundColour->SetValue(settings->GetSQLBoxUseSystemForeground());
+ pickerSQLBackgroundColour->SetColour(settings->GetSQLBoxColourBackground());
+ pickerSQLForegroundColour->SetColour(settings->GetSQLBoxColourForeground());
+
+ for (int i = 0; i <= 11; ++i)
+ {
+ wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
+ wxColourPickerCtrl* picker = wxStaticCast(FindWindow(pickerId), wxColourPickerCtrl);
+ picker->SetColour(settings->GetSQLBoxColour(i));
+ }
+
cbLanguage->Append(_("Default"));
int sel=0;
wxLanguage langId=settings->GetCanonicalLanguage();
@@ -594,6 +610,42 @@
changed = true;
settings->SetBlockedProcessColour(sColour);
+ // Change SQL Syntax colours
+ if (settings->GetSQLBoxUseSystemBackground() != chkSQLUseSystemBackgroundColour->GetValue())
+ {
+ changed = true;
+ settings->SetSQLBoxUseSystemBackground(chkSQLUseSystemBackgroundColour->GetValue());
+ }
+
+ if (settings->GetSQLBoxUseSystemForeground() != chkSQLUseSystemForegroundColour->GetValue())
+ {
+ changed = true;
+ settings->SetSQLBoxUseSystemForeground(chkSQLUseSystemForegroundColour->GetValue());
+ }
+
+ colour = pickerSQLBackgroundColour->GetColour();
+ sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
+ if (sColour != settings->GetSQLBoxColourBackground())
+ changed = true;
+ settings->SetSQLBoxColourBackground(sColour);
+
+ colour = pickerSQLForegroundColour->GetColour();
+ sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
+ if (sColour != settings->GetSQLBoxColourForeground())
+ changed = true;
+ settings->SetSQLBoxColourForeground(sColour);
+
+ for (int i = 0; i <= 11; ++i)
+ {
+ wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
+ wxColourPickerCtrl* picker = wxStaticCast(FindWindow(pickerId), wxColourPickerCtrl);
+ colour = picker->GetColour();
+ sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
+ if (sColour != settings->GetSQLBoxColour(i))
+ changed = true;
+ settings->SetSQLBoxColour(i, sColour);
+ }
+
// Change the language last, as it will affect our tests for changes
// in the display object types.
int langNo=cbLanguage->GetCurrentSelection();
Index: include/utils/sysSettings.h
===================================================================
--- include/utils/sysSettings.h (revision 8173)
+++ include/utils/sysSettings.h (working copy)
@@ -133,6 +133,20 @@
wxString GetBlockedProcessColour() const { wxString s; Read(wxT("BlockedProcessColour"), &s, wxT("#d96e5f")); return s; }
void SetBlockedProcessColour(const wxString &newval) { Write(wxT("BlockedProcessColour"), newval); }
+ // SQL Editor Colours options
+ bool GetSQLBoxUseSystemBackground() const { bool b; Read(wxT("ctlSQLBox/UseSystemBackground"), &b, false); return b; }
+ void SetSQLBoxUseSystemBackground(const bool newval) { Write(wxT("ctlSQLBox/UseSystemBackground"), newval); }
+ bool GetSQLBoxUseSystemForeground() const { bool b; Read(wxT("ctlSQLBox/UseSystemForeground"), &b, false); return b; }
+ void SetSQLBoxUseSystemForeground(const bool newval) { Write(wxT("ctlSQLBox/UseSystemForeground"), newval); }
+
+ wxString GetSQLBoxColourBackground() const { wxString s; Read(wxT("ctlSQLBox/ColourBackground"), &s, wxT("#ffffff")); return s; }
+ void SetSQLBoxColourBackground(const wxString &newval) { Write(wxT("ctlSQLBox/ColourBackground"), newval); }
+ wxString GetSQLBoxColourForeground() const { wxString s; Read(wxT("ctlSQLBox/ColourForeground"), &s, wxT("#000000")); return s; }
+ void SetSQLBoxColourForeground(const wxString &newval) { Write(wxT("ctlSQLBox/ColourForeground"), newval); }
+
+ wxString GetSQLBoxColour(int index) const { wxString s; Read(wxString::Format(wxT("ctlSQLBox/Colour%i"), index), &s, getDefaultElementColor(index)); return s; }
+ void SetSQLBoxColour(int index, const wxString &newval) { Write(wxString::Format(wxT("ctlSQLBox/Colour%i"), index), newval); }
+
// Misc options
long GetAutoRowCountThreshold() const { long l; Read(wxT("AutoRowCount"), &l, 2000L); return l; }
void SetAutoRowCountThreshold(const long newval) { Write(wxT("AutoRowCount"), newval); }
@@ -187,6 +201,17 @@
private:
+ static const wxString& getDefaultElementColor(int index)
+ {
+ static const wxString colors[] =
+ {
+ wxT("#808080"), wxT("#007f00"), wxT("#007f00"), wxT("#7f7f7f"),
+ wxT("#007f7f"), wxT("#00007f"), wxT("#7f007f"), wxT("#7f007f"),
+ wxT("#007f7f"), wxT("#7f7f7f"), wxT("#000000"), wxT("#000000")
+ };
+ return colors[index];
+ }
+
bool moveStringValue(const wxChar *oldKey, const wxChar *newKey, int index=-1);
bool moveLongValue(const wxChar *oldKey, const wxChar *newKey, int index=-1);
Index: ui/frmOptions.xrc
===================================================================
--- ui/frmOptions.xrc (revision 8173)
+++ ui/frmOptions.xrc (working copy)
@@ -419,6 +419,151 @@
+