Hi,
Dave found some issues on the layout of the query tool. They are on a
few mails, so I thought I'll answer to all of them in a new thread.
Here is the list of issues, and my answers:
> I just went to add a server in a pgAdmin build from SVN trunk and
> noticed that the new colour selector doesn't work so well on Mac.
This is an issue with the wxColourPickerCtrl widget I used. So, after
some discussions, I went on to code my own colour picker widget. You'll
find it in the 1_ctlColourPicker.patch file. It adds the new widget and
replace every wxColourPickerCtrl with a ctlColourPicker.
Special thanks to Ashesh who gave me the right solution to an issue. I
was ready to stop working on this.
> The connection drop-down has become rather ugly (the button doesn't
> line up vertically), and requires scrolling even for a tiny list.
Not yet worked on it. I also have the issue on Linux and Mac OS X.
> The left-hand margin is the same colour as the text area now. Can we
> make it gray again please?
Already send a patch for this. I updated it to work with the new
ctlColourPicker widget. See 2_margin.patch.
> The buttons to the right of the recent queries combo are not lined up with it.
Already fixed (revision 8199, http://code.pgadmin.org/trac/changeset/8199).
> The Query tool looks good now, but I get a crash if I try to open the
> Options dialogue:
I suppose this is fixed since your xrcDialogs.cpp commit?
> - Only add a query to the list is it executes without an error,
> otherwise it will get spammed with non-functional queries and typos.
> - You can probably remove the 'Current' from 'Delete Current' and save
> some space. I think current is implied by the fact that the other says
> 'all'.
See 3_miscquery.patch. It didn't need an update since last time.
> BTW, on OSX, the tabset overflows the width of the dialogue now. Can
> we widen the dialogue, and perhaps move all the colour options onto
> one tab?
I need to add 50% of the size of the dialog to get something good
enough. You'll find another patch for this, but I'll need to do better.
The dialog is usable with this patch, but it's not pretty. I'll work
more on this by adding sizers, but I should probably work on more
important items right now (exclusion constraint and other 9.0 new stuff).
To test my code, don't forget to update xrcDialogs.cpp. I don't do it to
keep low the size of my patches.
All the patches were checked on Linux, Mac OS X (obviously), and Windows.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
diff --git a/pgadmin/ctl/ctlColourPicker.cpp b/pgadmin/ctl/ctlColourPicker.cpp
new file mode 100644
index 0000000..f9b9b59
--- /dev/null
+++ b/pgadmin/ctl/ctlColourPicker.cpp
@@ -0,0 +1,113 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// ctlColourPicker.cpp - Colour Picker with a wxBitmapButton
+//
+//////////////////////////////////////////////////////////////////////////
+
+// wxWindows headers
+#include <wx/wx.h>
+#include <wx/colour.h>
+#include <wx/colordlg.h>
+
+// App headers
+#include "pgAdmin3.h"
+#include "ctl/ctlColourPicker.h"
+
+
+void ctlColourPicker::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
+{
+ // Set Default Title
+ m_title = wxT("Choose the colour");
+
+ // Create the wxBitmapButton
+ ((wxBitmapButton *)this)->Create(parent, id, wxNullBitmap, pos, size);
+
+ // Set the handler for a click
+ Connect(id, wxEVT_LEFT_DOWN, wxMouseEventHandler(ctlColourPicker::DoProcessLeftClick) );
+}
+
+
+void ctlColourPicker::DoProcessLeftClick(wxMouseEvent& event)
+{
+ wxColourData clrData;
+
+ // If there is an initial colour, set it for wxColourDialog
+ if (m_colour_clr.IsOk())
+ clrData.SetColour(m_colour_clr);
+
+ // Declare the new dialog
+ wxColourDialog dialog(this, &clrData);
+
+ // and set its title
+ dialog.SetTitle(m_title);
+
+ // Now, show it
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ clrData = dialog.GetColourData();
+ SetColour(clrData.GetColour());
+ }
+}
+
+
+void ctlColourPicker::UpdateColour()
+{
+ if (!m_colour_clr.IsOk())
+ {
+ wxBitmap empty(1,1);
+ SetBitmapLabel(empty);
+ return;
+ }
+
+ wxSize sz = GetSize();
+ sz.x -= 2*GetMarginX();
+ sz.y -= 2*GetMarginY();
+
+ wxPoint topleft;
+ if ( sz.x < 1 )
+ sz.x = 1;
+ else
+ if ( sz.y < 1 )
+ sz.y = 1;
+ wxBitmap bmp(sz.x, sz.y);
+
+ wxMemoryDC dc(bmp);
+ dc.SetBrush(wxBrush(m_colour_clr));
+ dc.DrawRectangle(topleft,sz);
+
+ ((wxBitmapButton *)this)->SetBitmapLabel(bmp);
+}
+
+wxColour ctlColourPicker::GetColour()
+{
+ return m_colour_clr;
+}
+
+wxString ctlColourPicker::GetColourString()
+{
+ if (!m_colour_clr.IsOk())
+ return wxEmptyString;
+ return m_colour_clr.GetAsString();
+}
+
+void ctlColourPicker::SetColour(const wxColour& colour)
+{
+ m_colour_clr = colour;
+ UpdateColour();
+}
+
+void ctlColourPicker::SetColour(const wxString& colour)
+{
+ m_colour_clr = wxColour(colour);
+ UpdateColour();
+}
+
+void ctlColourPicker::SetTitle(const wxString& title)
+{
+ m_title = title;
+}
diff --git a/pgadmin/ctl/module.mk b/pgadmin/ctl/module.mk
index e0cd6d7..4e8246f 100644
--- a/pgadmin/ctl/module.mk
+++ b/pgadmin/ctl/module.mk
@@ -12,6 +12,7 @@
pgadmin3_SOURCES += \
$(srcdir)/ctl/calbox.cpp \
$(srcdir)/ctl/ctlCheckTreeView.cpp \
+ $(srcdir)/ctl/ctlColourPicker.cpp \
$(srcdir)/ctl/ctlComboBox.cpp \
$(srcdir)/ctl/ctlListView.cpp \
$(srcdir)/ctl/ctlMenuToolbar.cpp \
@@ -24,6 +25,7 @@ pgadmin3_SOURCES += \
$(srcdir)/ctl/explainShape.cpp \
$(srcdir)/ctl/timespin.cpp \
$(srcdir)/ctl/xh_calb.cpp \
+ $(srcdir)/ctl/xh_ctlcolourpicker.cpp \
$(srcdir)/ctl/xh_ctlcombo.cpp \
$(srcdir)/ctl/xh_ctlchecktreeview.cpp \
$(srcdir)/ctl/xh_ctltree.cpp \
diff --git a/pgadmin/ctl/xh_ctlcolourpicker.cpp b/pgadmin/ctl/xh_ctlcolourpicker.cpp
new file mode 100644
index 0000000..f6bec1e
--- /dev/null
+++ b/pgadmin/ctl/xh_ctlcolourpicker.cpp
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// xh_ctlcolourpicker.cpp - ctlColourPicker handler
+//
+//////////////////////////////////////////////////////////////////////////
+
+#include "pgAdmin3.h"
+
+#include "wx/wx.h"
+#include "ctl/ctlColourPicker.h"
+#include "ctl/xh_ctlcolourpicker.h"
+
+IMPLEMENT_DYNAMIC_CLASS(ctlColourPickerXmlHandler, wxBitmapButtonXmlHandler)
+
+
+wxObject *ctlColourPickerXmlHandler::DoCreateResource()
+{
+ ctlColourPicker *ctl=new ctlColourPicker(m_parentAsWindow, GetID(), GetPosition(), GetSize());
+
+ SetupWindow(ctl);
+
+ return ctl;
+}
+
+bool ctlColourPickerXmlHandler::CanHandle(wxXmlNode *node)
+{
+ return IsOfClass(node, wxT("ctlColourPicker"));
+}
diff --git a/pgadmin/dlg/dlgServer.cpp b/pgadmin/dlg/dlgServer.cpp
index 8655a17..e7a9741 100644
--- a/pgadmin/dlg/dlgServer.cpp
+++ b/pgadmin/dlg/dlgServer.cpp
@@ -326,8 +326,7 @@ void dlgServer::CheckChange()
sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
// Get new value
- wxColour colour2 = colourPicker->GetColour();
- wxString sColour2 = colour2.GetAsString(wxC2S_HTML_SYNTAX);
+ wxString sColour2 = colourPicker->GetColourString();
enable = name != server->GetName()
|| txtDescription->GetValue() != server->GetDescription()
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index c9f23ee..4e25374 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -27,6 +27,7 @@
#include "utils/sysLogger.h"
#include "utils/misc.h"
#include "frm/menu.h"
+#include "ctl/ctlColourPicker.h"
// Must be after pgAdmin3.h or MSVC++ complains
#include <wx/colordlg.h>
@@ -82,6 +83,15 @@
#define pickerSQLForegroundColour CTRL_COLOURPICKER("pickerSQLForegroundColour")
#define stSQLCustomBackgroundColour CTRL_STATIC("stSQLCustomBackgroundColour")
#define stSQLCustomForegroundColour CTRL_STATIC("stSQLCustomForegroundColour")
+#define pickerSQLColour1 CTRL_COLOURPICKER("pickerSQLColour1")
+#define pickerSQLColour2 CTRL_COLOURPICKER("pickerSQLColour2")
+#define pickerSQLColour3 CTRL_COLOURPICKER("pickerSQLColour3")
+#define pickerSQLColour4 CTRL_COLOURPICKER("pickerSQLColour4")
+#define pickerSQLColour5 CTRL_COLOURPICKER("pickerSQLColour5")
+#define pickerSQLColour6 CTRL_COLOURPICKER("pickerSQLColour6")
+#define pickerSQLColour7 CTRL_COLOURPICKER("pickerSQLColour7")
+#define pickerSQLColour10 CTRL_COLOURPICKER("pickerSQLColour10")
+#define pickerSQLColour11 CTRL_COLOURPICKER("pickerSQLColour11")
BEGIN_EVENT_TABLE(frmOptions, pgDialog)
EVT_MENU(MNU_HELP, frmOptions::OnHelp)
@@ -249,13 +259,15 @@ frmOptions::frmOptions(frmMain *parent)
chkSQLUseSystemForegroundColour->SetValue(settings->GetSQLBoxUseSystemForeground());
UpdateColourControls();
- for (int i = 0; i <= 11; ++i)
- {
- wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
- wxColourPickerCtrl* picker = wxStaticCast(FindWindow(pickerId), wxColourPickerCtrl);
- if (picker != NULL)
- picker->SetColour(settings->GetSQLBoxColour(i));
- }
+ pickerSQLColour1->SetColour(settings->GetSQLBoxColour(1));
+ pickerSQLColour2->SetColour(settings->GetSQLBoxColour(2));
+ pickerSQLColour3->SetColour(settings->GetSQLBoxColour(3));
+ pickerSQLColour4->SetColour(settings->GetSQLBoxColour(4));
+ pickerSQLColour5->SetColour(settings->GetSQLBoxColour(5));
+ pickerSQLColour6->SetColour(settings->GetSQLBoxColour(6));
+ pickerSQLColour7->SetColour(settings->GetSQLBoxColour(7));
+ pickerSQLColour10->SetColour(settings->GetSQLBoxColour(10));
+ pickerSQLColour11->SetColour(settings->GetSQLBoxColour(11));
cbLanguage->Append(_("Default"));
int sel=0;
@@ -630,38 +642,28 @@ void frmOptions::OnOK(wxCommandEvent &ev)
}
// Change the status colours
- wxColour colour;
- wxString sColour;
-
- colour = pickerIdleProcessColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetIdleProcessColour())
+ if (pickerIdleProcessColour->GetColourString() != settings->GetIdleProcessColour())
changed = true;
- settings->SetIdleProcessColour(sColour);
+ settings->SetIdleProcessColour(pickerIdleProcessColour->GetColourString());
- colour = pickerActiveProcessColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetActiveProcessColour())
+ if (pickerActiveProcessColour->GetColourString() != settings->GetActiveProcessColour())
changed = true;
- settings->SetActiveProcessColour(sColour);
+ settings->SetActiveProcessColour(pickerActiveProcessColour->GetColourString());
- colour = pickerSlowProcessColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetSlowProcessColour())
+ if (pickerSlowProcessColour->GetColourString() != settings->GetSlowProcessColour())
changed = true;
- settings->SetSlowProcessColour(sColour);
+ settings->SetSlowProcessColour(pickerSlowProcessColour->GetColourString());
- colour = pickerBlockedProcessColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetBlockedProcessColour())
+ if (pickerBlockedProcessColour->GetColourString() != settings->GetBlockedProcessColour())
changed = true;
- settings->SetBlockedProcessColour(sColour);
+ settings->SetBlockedProcessColour(pickerBlockedProcessColour->GetColourString());
+ // Change files' location
settings->SetFavouritesFile(txtFavouritesFile->GetValue());
settings->SetMacrosFile(txtMacrosFile->GetValue());
settings->SetHistoryFile(txtHistoryFile->GetValue());
- // Change SQL Syntax colours
+ // Change SQL Syntax colours
if (settings->GetSQLBoxUseSystemBackground() != chkSQLUseSystemBackgroundColour->GetValue())
{
changed = true;
@@ -676,35 +678,45 @@ void frmOptions::OnOK(wxCommandEvent &ev)
if (!settings->GetSQLBoxUseSystemBackground())
{
- colour = pickerSQLBackgroundColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetSQLBoxColourBackground())
+ if (pickerSQLBackgroundColour->GetColourString() != settings->GetSQLBoxColourBackground())
changed = true;
- settings->SetSQLBoxColourBackground(sColour);
+ settings->SetSQLBoxColourBackground(pickerSQLBackgroundColour->GetColourString());
}
if (!settings->GetSQLBoxUseSystemForeground())
{
- colour = pickerSQLForegroundColour->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetSQLBoxColourForeground())
+ if (pickerSQLForegroundColour->GetColourString() != settings->GetSQLBoxColourForeground())
changed = true;
- settings->SetSQLBoxColourForeground(sColour);
+ settings->SetSQLBoxColourForeground(pickerSQLForegroundColour->GetColourString());
}
- for (int i = 0; i <= 11; ++i)
- {
- wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
- wxColourPickerCtrl* picker = wxStaticCast(FindWindow(pickerId), wxColourPickerCtrl);
- if (picker != NULL)
- {
- colour = picker->GetColour();
- sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
- if (sColour != settings->GetSQLBoxColour(i))
- changed = true;
- settings->SetSQLBoxColour(i, sColour);
- }
- }
+ if (pickerSQLColour1->GetColourString() != settings->GetSQLBoxColour(1))
+ changed = true;
+ settings->SetSQLBoxColour(1, pickerSQLColour1->GetColourString());
+ if (pickerSQLColour2->GetColourString() != settings->GetSQLBoxColour(2))
+ changed = true;
+ settings->SetSQLBoxColour(2, pickerSQLColour2->GetColourString());
+ if (pickerSQLColour3->GetColourString() != settings->GetSQLBoxColour(3))
+ changed = true;
+ settings->SetSQLBoxColour(3, pickerSQLColour3->GetColourString());
+ if (pickerSQLColour4->GetColourString() != settings->GetSQLBoxColour(4))
+ changed = true;
+ settings->SetSQLBoxColour(4, pickerSQLColour4->GetColourString());
+ if (pickerSQLColour5->GetColourString() != settings->GetSQLBoxColour(5))
+ changed = true;
+ settings->SetSQLBoxColour(5, pickerSQLColour5->GetColourString());
+ if (pickerSQLColour6->GetColourString() != settings->GetSQLBoxColour(6))
+ changed = true;
+ settings->SetSQLBoxColour(6, pickerSQLColour6->GetColourString());
+ if (pickerSQLColour7->GetColourString() != settings->GetSQLBoxColour(7))
+ changed = true;
+ settings->SetSQLBoxColour(7, pickerSQLColour7->GetColourString());
+ if (pickerSQLColour10->GetColourString() != settings->GetSQLBoxColour(10))
+ changed = true;
+ settings->SetSQLBoxColour(10, pickerSQLColour10->GetColourString());
+ if (pickerSQLColour11->GetColourString() != settings->GetSQLBoxColour(11))
+ changed = true;
+ settings->SetSQLBoxColour(11, pickerSQLColour11->GetColourString());
// Change the language last, as it will affect our tests for changes
// in the display object types.
diff --git a/pgadmin/include/ctl/ctlColourPicker.h b/pgadmin/include/ctl/ctlColourPicker.h
new file mode 100644
index 0000000..da46b0c
--- /dev/null
+++ b/pgadmin/include/ctl/ctlColourPicker.h
@@ -0,0 +1,45 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// ctlColourPicker.cpp - TreeView with Checkboxes
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _CTLCOLOURPICKER_H
+#define _CTLCOLOURPICKER_H
+
+// wxWindows headers
+#include <wx/wx.h>
+#include "utils/misc.h"
+
+
+
+class ctlColourPicker : public wxBitmapButton
+{
+public:
+ ctlColourPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize) { Create(parent, id, pos, size); }
+
+ void DoProcessLeftClick(wxMouseEvent& event);
+
+ wxColour GetColour();
+ wxString GetColourString();
+
+ void SetColour(const wxColour& colour);
+ void SetColour(const wxString& colour);
+
+ void SetTitle(const wxString& title);
+
+private:
+ wxString m_title;
+ wxColour m_colour_clr;
+
+ void Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
+ void UpdateColour();
+};
+
+#endif
diff --git a/pgadmin/include/ctl/module.mk b/pgadmin/include/ctl/module.mk
index 5d2be6d..7ab23f8 100644
--- a/pgadmin/include/ctl/module.mk
+++ b/pgadmin/include/ctl/module.mk
@@ -12,6 +12,7 @@
pgadmin3_SOURCES += \
$(srcdir)/include/ctl/calbox.h \
$(srcdir)/include/ctl/ctlCheckTreeView.h \
+ $(srcdir)/include/ctl/ctlColourPicker.h \
$(srcdir)/include/ctl/ctlComboBox.h \
$(srcdir)/include/ctl/ctlListView.h \
$(srcdir)/include/ctl/ctlMenuToolbar.h \
diff --git a/pgadmin/include/ctl/xh_ctlchecktreeview.h b/pgadmin/include/ctl/xh_ctlchecktreeview.h
index 073cce8..8100e6e 100644
--- a/pgadmin/include/ctl/xh_ctlchecktreeview.h
+++ b/pgadmin/include/ctl/xh_ctlchecktreeview.h
@@ -5,7 +5,7 @@
// Copyright (C) 2002 - 2010, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
-// xh_ctltree.h - ctlTree handler
+// xh_ctlchecktreeview.h - ctlCheckTreeView handler
//
//////////////////////////////////////////////////////////////////////////
diff --git a/pgadmin/include/ctl/xh_ctlcolourpicker.h b/pgadmin/include/ctl/xh_ctlcolourpicker.h
new file mode 100644
index 0000000..655c959
--- /dev/null
+++ b/pgadmin/include/ctl/xh_ctlcolourpicker.h
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////
+//
+// pgAdmin III - PostgreSQL Tools
+// RCS-ID: $Id$
+// Copyright (C) 2002 - 2010, The pgAdmin Development Team
+// This software is released under the BSD Licence
+//
+// xh_ctlcolourpicker.h - ctlColourPicker handler
+//
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef _WX_XH_CTLCOLOURPICKER_H_
+#define _WX_XH_CTLCOLOURPICKER_H_
+
+
+#include "wx/xrc/xmlres.h"
+#include "wx/xrc/xh_bmpbt.h"
+
+//class WXDLLIMPEXP_XRC
+class ctlColourPickerXmlHandler : public wxBitmapButtonXmlHandler
+{
+DECLARE_DYNAMIC_CLASS(ctlColourPickerXmlHandler)
+public:
+ ctlColourPickerXmlHandler() : wxBitmapButtonXmlHandler() {}
+ virtual wxObject *DoCreateResource();
+ virtual bool CanHandle(wxXmlNode *node);
+};
+
+
+#endif
diff --git a/pgadmin/include/pgAdmin3.h b/pgadmin/include/pgAdmin3.h
index dc922b1..5b71778 100644
--- a/pgadmin/include/pgAdmin3.h
+++ b/pgadmin/include/pgAdmin3.h
@@ -15,6 +15,7 @@
// wxWindows headers
#include <wx/wx.h>
#include <wx/hashmap.h>
+#include <wx/colordlg.h>
#include <wx/listctrl.h>
#include <wx/xrc/xmlres.h>
@@ -24,6 +25,7 @@
#include "ctl/ctlListView.h"
#include "ctl/ctlComboBox.h"
#include <ctl/ctlCheckTreeView.h>
+#include <ctl/ctlColourPicker.h>
#include "dlg/dlgClasses.h"
#include "db/pgConn.h"
#include "db/pgSet.h"
diff --git a/pgadmin/include/precomp.h b/pgadmin/include/precomp.h
index e3004d0..0277ae4 100644
--- a/pgadmin/include/precomp.h
+++ b/pgadmin/include/precomp.h
@@ -24,6 +24,7 @@
#include "ctl/calbox.h"
#include "ctl/ctlCheckTreeView.h"
+#include "ctl/ctlColourPicker.h"
#include "ctl/ctlComboBox.h"
#include "ctl/ctlListView.h"
#include "ctl/ctlSecurityPanel.h"
@@ -37,6 +38,7 @@
#include "ctl/xh_calb.h"
#include "ctl/xh_ctlcombo.h"
#include "ctl/xh_ctlchecktreeview.h"
+#include "ctl/xh_ctlcolourpicker.h"
#include "ctl/xh_ctltree.h"
#include "ctl/xh_sqlbox.h"
#include "ctl/xh_timespin.h"
diff --git a/pgadmin/include/utils/misc.h b/pgadmin/include/utils/misc.h
index b98f1cb..4a9dad6 100644
--- a/pgadmin/include/utils/misc.h
+++ b/pgadmin/include/utils/misc.h
@@ -87,7 +87,7 @@ extern sysSettings *settings;
#define CTRL_CHECKLISTBOX(id) (XRCCTRL(*this, id, wxCheckListBox))
#define CTRL_DATEPICK(id) (XRCCTRL(*this, id, wxDatePickerCtrl))
#define CTRL_TREE(id) (XRCCTRL(*this, id, ctlTree))
-#define CTRL_COLOURPICKER(id) (XRCCTRL(*this, id, wxColourPickerCtrl))
+#define CTRL_COLOURPICKER(id) (XRCCTRL(*this, id, ctlColourPicker))
#define CTRL_CHECKTREEVIEW(id) (XRCCTRL(*this, id, ctlCheckTreeView))
#endif // PGSCLI
diff --git a/pgadmin/pgAdmin3.cpp b/pgadmin/pgAdmin3.cpp
index 1c12dae..7e742ef 100644
--- a/pgadmin/pgAdmin3.cpp
+++ b/pgadmin/pgAdmin3.cpp
@@ -66,6 +66,7 @@
#include "ctl/xh_ctlcombo.h"
#include "ctl/xh_ctltree.h"
#include "ctl/xh_ctlchecktreeview.h"
+#include "ctl/xh_ctlcolourpicker.h"
#define DOC_DIR wxT("/docs")
#define UI_DIR wxT("/ui")
@@ -379,6 +380,7 @@ bool pgAdmin3::OnInit()
wxXmlResource::Get()->AddHandler(new ctlComboBoxXmlHandler);
wxXmlResource::Get()->AddHandler(new ctlTreeXmlHandler);
wxXmlResource::Get()->AddHandler(new ctlCheckTreeViewXmlHandler);
+ wxXmlResource::Get()->AddHandler(new ctlColourPickerXmlHandler);
InitXml();
diff --git a/pgadmin/pgAdmin3.vcproj b/pgadmin/pgAdmin3.vcproj
index 2fd55bf..8491a99 100644
--- a/pgadmin/pgAdmin3.vcproj
+++ b/pgadmin/pgAdmin3.vcproj
@@ -4561,6 +4561,14 @@
</Filter>
</Filter>
<File
+ RelativePath=".\ctl\ctlColourPicker.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\include\ctl\ctlColourPicker.h"
+ >
+ </File>
+ <File
RelativePath="Makefile.am"
>
</File>
diff --git a/pgadmin/ui/dlgServer.xrc b/pgadmin/ui/dlgServer.xrc
index 9dbb14c..e534149 100644
--- a/pgadmin/ui/dlgServer.xrc
+++ b/pgadmin/ui/dlgServer.xrc
@@ -191,7 +191,7 @@
<border>4</border>
</object>
<object class="sizeritem">
- <object class="wxColourPickerCtrl" name="colourPicker"/>
+ <object class="ctlColourPicker" name="colourPicker"/>
<flag>wxEXPAND|wxALIGN_CENTRE_VERTICAL|wxALL</flag>
<border>4</border>
</object>
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index 162423e..43ba9d3 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -366,7 +366,7 @@
<label>Idle Process Colour</label>
<pos>5,5d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerIdleProcessColour">
+ <object class="ctlColourPicker" name="pickerIdleProcessColour">
<pos>100,5d</pos>
<size>50,12d</size>
</object>
@@ -374,7 +374,7 @@
<label>Active Process Colour</label>
<pos>5,22d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerActiveProcessColour">
+ <object class="ctlColourPicker" name="pickerActiveProcessColour">
<pos>100,22d</pos>
<size>50,12d</size>
</object>
@@ -382,7 +382,7 @@
<label>Slow Process Colour</label>
<pos>5,39d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSlowProcessColour">
+ <object class="ctlColourPicker" name="pickerSlowProcessColour">
<pos>100,39d</pos>
<size>50,12d</size>
</object>
@@ -390,7 +390,7 @@
<label>Blocked Process Colour</label>
<pos>5,56d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerBlockedProcessColour">
+ <object class="ctlColourPicker" name="pickerBlockedProcessColour">
<pos>100,56d</pos>
<size>50,12d</size>
</object>
@@ -479,7 +479,7 @@
<label>Custom background</label>
<pos>5,35d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLBackgroundColour">
+ <object class="ctlColourPicker" name="pickerSQLBackgroundColour">
<pos>80,35d</pos>
<size>25,12d</size>
</object>
@@ -488,7 +488,7 @@
<label>Custom foreground</label>
<pos>5,50d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLForegroundColour">
+ <object class="ctlColourPicker" name="pickerSQLForegroundColour">
<pos>80,50d</pos>
<size>25,12d</size>
</object>
@@ -497,7 +497,7 @@
<label>Multiline comment</label>
<pos>5,75d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour1">
+ <object class="ctlColourPicker" name="pickerSQLColour1">
<pos>80,75d</pos>
<size>25,12d</size>
</object>
@@ -506,7 +506,7 @@
<label>Single line comment</label>
<pos>5,90d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour2">
+ <object class="ctlColourPicker" name="pickerSQLColour2">
<pos>80,90d</pos>
<size>25,12d</size>
</object>
@@ -515,7 +515,7 @@
<label>SQL doc</label>
<pos>5,105d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour3">
+ <object class="ctlColourPicker" name="pickerSQLColour3">
<pos>80,105d</pos>
<size>25,12d</size>
</object>
@@ -524,7 +524,7 @@
<label>Number</label>
<pos>5,120d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour4">
+ <object class="ctlColourPicker" name="pickerSQLColour4">
<pos>80,120d</pos>
<size>25,12d</size>
</object>
@@ -533,7 +533,7 @@
<label>Keyword</label>
<pos>5,135d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour5">
+ <object class="ctlColourPicker" name="pickerSQLColour5">
<pos>80,135d</pos>
<size>25,12d</size>
</object>
@@ -542,7 +542,7 @@
<label>Double quoted string</label>
<pos>5,150d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour6">
+ <object class="ctlColourPicker" name="pickerSQLColour6">
<pos>80,150d</pos>
<size>25,12d</size>
</object>
@@ -551,7 +551,7 @@
<label>Single quoted string</label>
<pos>125,75d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour7">
+ <object class="ctlColourPicker" name="pickerSQLColour7">
<pos>195,75d</pos>
<size>25,12d</size>
</object>
@@ -560,7 +560,7 @@
<label>Operator</label>
<pos>125,90d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour10">
+ <object class="ctlColourPicker" name="pickerSQLColour10">
<pos>195,90d</pos>
<size>25,12d</size>
</object>
@@ -569,7 +569,7 @@
<label>Identifier</label>
<pos>125,105d</pos>
</object>
- <object class="wxColourPickerCtrl" name="pickerSQLColour11">
+ <object class="ctlColourPicker" name="pickerSQLColour11">
<pos>195,105d</pos>
<size>25,12d</size>
</object>
diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index 22778b4..11ab793 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -111,7 +111,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
}
// Margin style
- StyleSetBackground(wxSTC_STYLE_LINENUMBER, wxColour(0xDD, 0xDD, 0xDD));
+ StyleSetBackground(wxSTC_STYLE_LINENUMBER, settings->GetSQLMarginBackgroundColour());
+
// Brace maching styles
StyleSetBackground(34, wxColour(0x99, 0xF9, 0xFF));
StyleSetBackground(35, wxColour(0xFF, 0xCF, 0x27));
diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp
index 4e25374..bfa3c14 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -83,6 +83,7 @@
#define pickerSQLForegroundColour CTRL_COLOURPICKER("pickerSQLForegroundColour")
#define stSQLCustomBackgroundColour CTRL_STATIC("stSQLCustomBackgroundColour")
#define stSQLCustomForegroundColour CTRL_STATIC("stSQLCustomForegroundColour")
+#define pickerSQLMarginBackgroundColour CTRL_COLOURPICKER("pickerSQLMarginBackgroundColour")
#define pickerSQLColour1 CTRL_COLOURPICKER("pickerSQLColour1")
#define pickerSQLColour2 CTRL_COLOURPICKER("pickerSQLColour2")
#define pickerSQLColour3 CTRL_COLOURPICKER("pickerSQLColour3")
@@ -424,6 +425,8 @@ void frmOptions::UpdateColourControls()
pickerSQLForegroundColour->SetColour(settings->GetSQLBoxColourForeground());
stSQLCustomForegroundColour->Enable(true);
}
+
+ pickerSQLMarginBackgroundColour->SetColour(settings->GetSQLMarginBackgroundColour());
}
void frmOptions::OnChangeSQLUseCustomColour(wxCommandEvent &ev)
@@ -690,6 +693,10 @@ void frmOptions::OnOK(wxCommandEvent &ev)
settings->SetSQLBoxColourForeground(pickerSQLForegroundColour->GetColourString());
}
+ if (pickerSQLMarginBackgroundColour->GetColourString() != settings->GetSQLMarginBackgroundColour())
+ changed = true;
+ settings->SetSQLMarginBackgroundColour(pickerSQLMarginBackgroundColour->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 0a68371..4616d42 100644
--- a/pgadmin/include/utils/sysSettings.h
+++ b/pgadmin/include/utils/sysSettings.h
@@ -155,6 +155,9 @@ public:
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); }
+ wxString GetSQLMarginBackgroundColour() const { wxString s; Read(wxT("ctlSQLBox/MarginBackgroundColour"), &s, wxT("#dddddd")); return s; }
+ void SetSQLMarginBackgroundColour(const wxString &newval) { Write(wxT("ctlSQLBox/MarginBackgroundColour"), newval); }
+
// Misc options
long GetAutoRowCountThreshold() const { long l; Read(wxT("AutoRowCount"), &l, 2000L); return l; }
void SetAutoRowCountThreshold(const long newval) { Write(wxT("AutoRowCount"), newval); }
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index 43ba9d3..7ddd641 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -493,84 +493,93 @@
<size>25,12d</size>
</object>
+ <object class="wxStaticText" name="stSQLMarginBackgroundColour">
+ <label>Margin background</label>
+ <pos>5,65d</pos>
+ </object>
+ <object class="ctlColourPicker" name="pickerSQLMarginBackgroundColour">
+ <pos>80,65d</pos>
+ <size>25,12d</size>
+ </object>
+
<object class="wxStaticText" name="stSQLColour1">
<label>Multiline comment</label>
- <pos>5,75d</pos>
+ <pos>5,95d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour1">
- <pos>80,75d</pos>
+ <pos>80,95d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour2">
<label>Single line comment</label>
- <pos>5,90d</pos>
+ <pos>5,110d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour2">
- <pos>80,90d</pos>
+ <pos>80,110d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour3">
<label>SQL doc</label>
- <pos>5,105d</pos>
+ <pos>5,125d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour3">
- <pos>80,105d</pos>
+ <pos>80,125d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour4">
<label>Number</label>
- <pos>5,120d</pos>
+ <pos>5,140d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour4">
- <pos>80,120d</pos>
+ <pos>80,140d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour5">
<label>Keyword</label>
- <pos>5,135d</pos>
+ <pos>5,155d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour5">
- <pos>80,135d</pos>
+ <pos>80,155d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour6">
<label>Double quoted string</label>
- <pos>5,150d</pos>
+ <pos>5,170d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour6">
- <pos>80,150d</pos>
+ <pos>80,170d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour7">
<label>Single quoted string</label>
- <pos>125,75d</pos>
+ <pos>125,95d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour7">
- <pos>195,75d</pos>
+ <pos>195,95d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour10">
<label>Operator</label>
- <pos>125,90d</pos>
+ <pos>125,110d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour10">
- <pos>195,90d</pos>
+ <pos>195,110d</pos>
<size>25,12d</size>
</object>
<object class="wxStaticText" name="stSQLColour11">
<label>Identifier</label>
- <pos>125,105d</pos>
+ <pos>125,125d</pos>
</object>
<object class="ctlColourPicker" name="pickerSQLColour11">
- <pos>195,105d</pos>
+ <pos>195,125d</pos>
<size>25,12d</size>
</object>
diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp
index cc92377..358e496 100644
--- a/pgadmin/frm/frmQuery.cpp
+++ b/pgadmin/frm/frmQuery.cpp
@@ -426,7 +426,7 @@ pgsTimer(new pgScriptTimer(this))
boxHistory->Add(sqlQueries, 1, wxEXPAND | wxALL, 1);
// Delete Current button
- btnDeleteCurrent = new wxButton(pnlQuery, CTL_DELETECURRENTBTN, wxT("Delete Current"));
+ btnDeleteCurrent = new wxButton(pnlQuery, CTL_DELETECURRENTBTN, wxT("Delete"));
btnDeleteCurrent->Enable(false);
boxHistory->Add(btnDeleteCurrent, 0, wxALL | wxALIGN_RIGHT, 1);
@@ -2324,6 +2324,13 @@ void frmQuery::OnQueryComplete(wxCommandEvent &ev)
}
else
{
+ // unsuccessfull queries are deleted of the history
+ histoQueries.RemoveAt(sqlQueries->GetCount()-1);
+ sqlQueries->Delete(sqlQueries->GetCount()-1);
+ btnDeleteCurrent->Enable(sqlQueries->GetValue().Length()>0);
+ btnDeleteAll->Enable(sqlQueries->GetCount() > 0);
+ SaveQueries();
+
pgError err = sqlResult->GetResultError();
wxString errMsg = err.formatted_msg;
wxLogQuietError(wxT("%s"), conn->GetLastError().Trim().c_str());
diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc
index 7ddd641..762ef45 100644
--- a/pgadmin/ui/frmOptions.xrc
+++ b/pgadmin/ui/frmOptions.xrc
@@ -3,7 +3,7 @@
<object class="wxDialog" name="frmOptions">
<title>Options</title>
<pos>0,0d</pos>
- <size>246,280d</size>
+ <size>350,280d</size>
<style>wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxCAPTION|wxSYSTEM_MENU</style>
<object class="wxNotebook" name="nbOptions">
<object class="notebookpage">
@@ -433,7 +433,7 @@
</object>
</object>
<pos>2,3d</pos>
- <size>240,255d</size>
+ <size>344,255d</size>
<object class="notebookpage">
<label>Display</label>
<object class="wxPanel" name="pnlDisplay">
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers