Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Pgadmin Hackers > A fix and a new...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 4656 of 4873
Post > Topic >>

A fix and a new functionnality for the colour patch

by guillaume@[EMAIL PROTECTED] (Guillaume Lelarge) Jun 14, 2008 at 05:21 PM

This is a multi-part message in MIME format.
--------------020405040904010500010700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

The colour patch commited by Dave during pgCon2008 allows a user to add 
a background color to the treeview for each specific registered server.

When a user deletes the colour in the server's property, pgAdmin will 
use a black (#000000) background. The treeview node's text will be 
unreadable. What the patch does is impliying white colour when the user 
doesn't spécify a colour.

The new functionality adds a colour button that opens the standard 
colour dialog. The user doesn't new to know the HTML colour coding.

Comments?

Regards.


-- 
Guillaume.
  http://www.postgresqlfr.org
  http://dalibo.com

--------------020405040904010500010700
Content-Type: text/x-patch;
 name="color.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="color.patch"

Index: pgadmin/include/schema/pgServer.h
===================================================================
--- pgadmin/include/schema/pgServer.h	(revision 7373)
+++ pgadmin/include/schema/pgServer.h	(working copy)
@[EMAIL PROTECTED]
 -110,7 +110,7 @[EMAIL PROTECTED]
     bool SetPassword(const wxString& newVal);
     wxDateTime GetUpSince() { return upSince; }
     void iSetUpSince(const wxDateTime &d) { upSince = d; }
-	void iSetColour(const wxString &s) { colour = wxColour(s); }
+	void iSetColour(const wxString &s) { colour = s.Length() == 0 ?
wxColour(wxT("#ffffff")) : wxColour(s); }
 	wxColour GetColour() { return colour; }
 
     bool HasPrivilege(const wxString &objTyp, const wxString &objName,
const wxString &priv) { return conn->HasPrivilege(objTyp, objName, priv);
}
Index: pgadmin/include/dlg/dlgServer.h
===================================================================
--- pgadmin/include/dlg/dlgServer.h	(revision 7373)
+++ pgadmin/include/dlg/dlgServer.h	(working copy)
@[EMAIL PROTECTED]
 -42,6 +42,7 @[EMAIL PROTECTED]
     void OnChangeRestr(wxCommandEvent &ev);
     void OnChangeTryConnect(wxCommandEvent &ev);
     void OnPageSelect(wxNotebookEvent &event);
+    void OnChooseColor(wxCommandEvent &ev);
 
     DECLARE_EVENT_TABLE()
 };
Index: pgadmin/dlg/dlgServer.cpp
===================================================================
--- pgadmin/dlg/dlgServer.cpp	(revision 7373)
+++ pgadmin/dlg/dlgServer.cpp	(working copy)
@[EMAIL PROTECTED]
 -11,6 +11,7 @[EMAIL PROTECTED]
 
 // wxWindows headers
 #include <wx/wx.h>
+#include <wx/colordlg.h>
 
 // App headers
 #include "pgAdmin3.h"
@[EMAIL PROTECTED]
 -37,6 +38,7 @[EMAIL PROTECTED]
 #define txtPassword     CTRL_TEXT("txtPassword")
 #define txtDbRestriction CTRL_TEXT("txtDbRestriction")
 #define txtColour       CTRL_TEXT("txtColour")
+#define btnColor        CTRL_BUTTON("btnColor")
 
 
 BEGIN_EVENT_TABLE(dlgServer, dlgProperty)
@[EMAIL PROTECTED]
 -53,6 +55,7 @[EMAIL PROTECTED]
     EVT_CHECKBOX(XRCID("chkRestore"),              
dlgProperty::OnChange)
     EVT_CHECKBOX(XRCID("chkTryConnect"),           
dlgServer::OnChangeTryConnect)
 	EVT_TEXT(XRCID("txtColour"),                    dlgProperty::OnChange)
+    EVT_BUTTON(XRCID("btnColor"),                  
dlgServer::OnChooseColor)
     EVT_BUTTON(wxID_OK,                             dlgServer::OnOK)
 END_EVENT_TABLE();
 
@[EMAIL PROTECTED]
 -232,7 +235,7 @[EMAIL PROTECTED]
         chkStorePwd->SetValue(server->GetStorePwd());
         chkRestore->SetValue(server->GetRestore());
         txtDbRestriction->SetValue(server->GetDbRestriction());
-		txtColour->SetValue(server->GetColour().GetAsString(wxC2S_HTML_SYNTAX));
+       
txtColour->SetValue(server->GetColour().GetAsString(wxC2S_HTML_SYNTAX));
 
         stPassword->Disable();
         txtPassword->Disable();
@[EMAIL PROTECTED]
 -290,6 +293,16 @[EMAIL PROTECTED]
 }
 
 
+void dlgServer::OnChooseColor(wxCommandEvent &ev)
+{
+    wxColourDialog dlg( NULL );
+    if ( dlg.ShowModal() == wxID_OK )
+    {
+       
txtColour->SetValue(dlg.GetColourData().GetColour().GetAsString(wxC2S_HTML_SYNTAX));
+    }
+}
+
+
 void dlgServer::CheckChange()
 {
     wxString name=GetName();
Index: pgadmin/ui/dlgServer.xrc
===================================================================
--- pgadmin/ui/dlgServer.xrc	(revision 7373)
+++ pgadmin/ui/dlgServer.xrc	(working copy)
@[EMAIL PROTECTED]
 -122,6 +122,10 @[EMAIL PROTECTED]
             <pos>70,169d</pos>
             <size>75,-1d</size>
           </object>
+          <object class="wxButton" name="btnColor">
+            <label>Choose Color...</label>
+            <pos>150,169d</pos>
+          </object>
         </object>
         <selected>1</selected>
       </object>
@[EMAIL PROTECTED]
 -144,4 +148,4 @[EMAIL PROTECTED]
     <size>218,225d</size>
     <style></style>
   </object>
-</resource>
\ No newline at end of file
+</resource>

--------------020405040904010500010700
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


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

--------------020405040904010500010700--
 




 5 Posts in Topic:
A fix and a new functionnality for the colour patch
guillaume@[EMAIL PROTECTE  2008-06-14 17:21:24 
Re: A fix and a new functionnality for the colour patch
dpage@[EMAIL PROTECTED]   2008-06-14 17:43:56 
Re: A fix and a new functionnality for the colour
guillaume@[EMAIL PROTECTE  2008-06-14 18:53:55 
Re: A fix and a new functionnality for the colour
guillaume@[EMAIL PROTECTE  2008-06-16 22:03:37 
Re: A fix and a new functionnality for the colour patch
dpage@[EMAIL PROTECTED]   2008-06-16 21:15:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 23:01:56 CST 2008.