OK, enough said "Will do when I'll have time". Here are two patches, one
that allows a user to customize the caret's colour, and the other one
that allows a user to force uppercase for keywords.

Comments?


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
From ae9d31106b2a69e9b45faaa372930bc29879b9a5 Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <[email protected]>
Date: Tue, 12 Oct 2010 00:02:02 +0200
Subject: [PATCH] Add an option to put keywords in uppercase

The user can check an option, so that every keyword he enters in a SQL box is
automatically in uppercase.

Implements #250.
---
 pgadmin/ctl/ctlSQLBox.cpp           |    5 +++++
 pgadmin/frm/frmOptions.cpp          |    9 +++++++++
 pgadmin/include/utils/sysSettings.h |    2 ++
 pgadmin/ui/frmOptions.xrc           |    9 ++++++++-
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index 3cd5577..c5b007f 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -114,6 +114,11 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
 		StyleSetFont(i, fntSQLBox);
 	}
 
+    // Keywords in uppercase?
+
+    if (settings->GetSQLKeywordsInUppercase())
+        StyleSetCase(5, wxSTC_CASE_UPPER);
+
 	// Margin style
 	StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour());
 
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index ce28d14..a846aef 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -97,6 +97,7 @@
 #define pickerSQLColour7            CTRL_COLOURPICKER("pickerSQLColour7")
 #define pickerSQLColour10           CTRL_COLOURPICKER("pickerSQLColour10")
 #define pickerSQLColour11           CTRL_COLOURPICKER("pickerSQLColour11")
+#define chkKeywordsInUppercase      CTRL_CHECKBOX("chkKeywordsInUppercase")
 
 BEGIN_EVENT_TABLE(frmOptions, pgDialog)
     EVT_MENU(MNU_HELP,                                            frmOptions::OnHelp)
@@ -269,6 +270,8 @@ frmOptions::frmOptions(frmMain *parent)
 	pickerSQLColour10->SetColour(settings->GetSQLBoxColour(10));
 	pickerSQLColour11->SetColour(settings->GetSQLBoxColour(11));
 
+	chkKeywordsInUppercase->SetValue(settings->GetSQLKeywordsInUppercase());
+
     cbLanguage->Append(_("Default"));
     int sel=0;
     wxLanguage langId=settings->GetCanonicalLanguage();
@@ -693,6 +696,12 @@ void frmOptions::OnOK(wxCommandEvent &ev)
         changed = true;
     settings->SetSQLBoxColour(11, pickerSQLColour11->GetColourString());
 
+	if (settings->GetSQLKeywordsInUppercase() != chkKeywordsInUppercase->GetValue())
+	{
+		changed = true;
+		settings->SetSQLKeywordsInUppercase(chkKeywordsInUppercase->GetValue());
+	}
+	
     // Change the language last, as it will affect our tests for changes
     // in the display object types.
     int langNo=cbLanguage->GetCurrentSelection();
diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h
index 7caae55..f52a3a1 100644
--- a/pgadmin/include/utils/sysSettings.h
+++ b/pgadmin/include/utils/sysSettings.h
@@ -161,6 +161,8 @@ public:
 
     wxString GetSQLMarginBackgroundColour() const { wxString s; Read(wxT("ctlSQLBox/MarginBackgroundColour"), &s, wxT("#dddddd")); return s; }
 	void SetSQLMarginBackgroundColour(const wxString &newval) { Write(wxT("ctlSQLBox/MarginBackgroundColour"), newval); }
+    bool GetSQLKeywordsInUppercase() const { bool b; Read(wxT("KeywordsInUppercase"), &b, false); return b; }
+	void SetSQLKeywordsInUppercase(const bool newval) { Write(wxT("KeywordsInUppercase"), newval); }
 
     // Misc options
     long GetAutoRowCountThreshold() const { long l; Read(wxT("AutoRowCount"), &l, 2000L); return l; }
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index dfbd706..358c9c0 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -810,6 +810,13 @@
                           <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
                           <border>4</border>
                         </object>
+                        <object class="sizeritem">
+                          <object class="wxCheckBox" name="chkKeywordsInUppercase">
+                            <label>Keywords in uppercase</label>
+                          </object>
+                          <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                          <border>4</border>
+                        </object>
                       </object>
                       <flag>wxEXPAND|wxALIGN_CENTRE|wxALL</flag>
                       <border>3</border>
@@ -982,4 +989,4 @@
       </object>
     </object>
   </object>
-</resource>
\ No newline at end of file
+</resource>
-- 
1.7.0.4

From 9a305cac5adfd929b2c2cf5a1db33eea42ff1a3c Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <[email protected]>
Date: Mon, 11 Oct 2010 23:31:19 +0200
Subject: [PATCH] Add an option to set the cursor colour

This option allows the user to set the colour of the cursor. It's really
important if you change the background colour, so that the cursor is still
visible.

Implements #253.
---
 pgadmin/ctl/ctlSQLBox.cpp           |    2 ++
 pgadmin/frm/frmOptions.cpp          |    7 +++++++
 pgadmin/include/utils/sysSettings.h |    3 +++
 pgadmin/ui/frmOptions.xrc           |   35 ++++++++++++++++++++++++++++++++++-
 4 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index 3cd5577..1760d9d 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -99,6 +99,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     SetSelBackground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
     SetSelForeground(true, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
 
+	SetCaretForeground(settings->GetSQLColourCaret());
+
     SetMarginWidth(1, 0);
     SetTabWidth(settings->GetIndentSpaces());
     SetUseTabs(!settings->GetSpacesForTabs());
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index ce28d14..bd570ea 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -97,6 +97,7 @@
 #define pickerSQLColour7            CTRL_COLOURPICKER("pickerSQLColour7")
 #define pickerSQLColour10           CTRL_COLOURPICKER("pickerSQLColour10")
 #define pickerSQLColour11           CTRL_COLOURPICKER("pickerSQLColour11")
+#define pickerSQLCaretColour               CTRL_COLOURPICKER("pickerSQLCaretColour")
 
 BEGIN_EVENT_TABLE(frmOptions, pgDialog)
     EVT_MENU(MNU_HELP,                                            frmOptions::OnHelp)
@@ -395,6 +396,8 @@ void frmOptions::UpdateColourControls()
 		stSQLCustomForegroundColour->Enable(true);
 	}
 
+	pickerSQLCaretColour->SetColour(settings->GetSQLColourCaret());
+
 	pickerSQLMarginBackgroundColour->SetColour(settings->GetSQLMarginBackgroundColour());
 }
 
@@ -665,6 +668,10 @@ void frmOptions::OnOK(wxCommandEvent &ev)
         changed = true;
     settings->SetSQLMarginBackgroundColour(pickerSQLMarginBackgroundColour->GetColourString());
 
+    if (pickerSQLCaretColour->GetColourString() != settings->GetSQLColourCaret())
+        changed = true;
+    settings->SetSQLColourCaret(pickerSQLCaretColour->GetColourString());
+
     if (pickerSQLColour1->GetColourString() != settings->GetSQLBoxColour(1))
         changed = true;
     settings->SetSQLBoxColour(1, pickerSQLColour1->GetColourString());
diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h
index 7caae55..e081c36 100644
--- a/pgadmin/include/utils/sysSettings.h
+++ b/pgadmin/include/utils/sysSettings.h
@@ -156,6 +156,9 @@ public:
     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 GetSQLColourCaret() const { wxString s; Read(wxT("ctlSQLBox/ColourCaret"), &s, wxT("#000000")); return s; }
+	void SetSQLColourCaret(const wxString &newval) { Write(wxT("ctlSQLBox/ColourCaret"), 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); }
 
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index dfbd706..589a2d3 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -675,6 +675,39 @@
                 </object>
                 <object class="sizeritem">
                   <object class="wxStaticBoxSizer">
+                    <label>Caret</label>
+                    <orient>wxVERTICAL</orient>
+                    <object class="sizeritem">
+                      <object class="wxFlexGridSizer">
+                        <cols>2</cols>
+                        <rows>1</rows>
+                        <vgap>5</vgap>
+                        <hgap>5</hgap>
+                        <growablecols>0,2</growablecols>
+                        <object class="sizeritem">
+                          <object class="wxStaticText" name="stSQLCaretColour">
+                            <label>Caret</label>
+                          </object>
+                          <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                          <border>4</border>
+                        </object>
+                        <object class="sizeritem">
+                          <object class="ctlColourPicker" name="pickerSQLCaretColour">
+                            <size>70,12d</size>
+                          </object>
+                          <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                          <border>4</border>
+                        </object>
+                      </object>
+                      <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                      <border>4</border>
+                    </object>
+                  </object>
+                  <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag>
+                  <border>4</border>
+                </object>
+                <object class="sizeritem">
+                  <object class="wxStaticBoxSizer">
                     <label>SQL Syntax Highlighting</label>
                     <orient>wxVERTICAL</orient>
                     <object class="sizeritem">
@@ -982,4 +1015,4 @@
       </object>
     </object>
   </object>
-</resource>
\ No newline at end of file
+</resource>
-- 
1.7.0.4

-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to