Le 03/03/2010 13:25, Dave Page a écrit :
> On Tue, Mar 2, 2010 at 10:52 PM, Guillaume Lelarge
> <[email protected]> wrote:
>> The color used is #dddddd. Probably I should add the ability to
>> customize it, as we can already customize much of the background and
>> foreground colors.
>
> Yeah, that works. I agree it should be customisable, seeing as
> everything else is.
>
See patch attached (margin.patch).
>>> - The buttons to the right of the recent queries combo are not lined up
>>> with it.
>>>
>>
>> Can you check query.patch? Works OK for me on GTK, and is less ugly on
>> Mac OS X. Is it good enough for you?
>
> Yup, that looks better. Couple of thoughts though...
>
> - 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'.
>
Done too. See miscquery.patch.
--
Guillaume.
http://www.postgresqlfr.org
http://dalibo.com
diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp
index e5ac646..bde0363 100644
--- a/pgadmin/ctl/ctlSQLBox.cpp
+++ b/pgadmin/ctl/ctlSQLBox.cpp
@@ -110,6 +110,8 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
StyleSetFont(i, fntSQLBox);
}
+ // Margin style
+ 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 c9f23ee..5b7dc78 100644
--- a/pgadmin/frm/frmOptions.cpp
+++ b/pgadmin/frm/frmOptions.cpp
@@ -82,6 +82,7 @@
#define pickerSQLForegroundColour CTRL_COLOURPICKER("pickerSQLForegroundColour")
#define stSQLCustomBackgroundColour CTRL_STATIC("stSQLCustomBackgroundColour")
#define stSQLCustomForegroundColour CTRL_STATIC("stSQLCustomForegroundColour")
+#define pickerSQLMarginBackgroundColour CTRL_COLOURPICKER("pickerSQLMarginBackgroundColour")
BEGIN_EVENT_TABLE(frmOptions, pgDialog)
EVT_MENU(MNU_HELP, frmOptions::OnHelp)
@@ -412,6 +413,8 @@ void frmOptions::UpdateColourControls()
pickerSQLForegroundColour->SetColour(settings->GetSQLBoxColourForeground());
stSQLCustomForegroundColour->Enable(true);
}
+
+ pickerSQLMarginBackgroundColour->SetColour(settings->GetSQLMarginBackgroundColour());
}
void frmOptions::OnChangeSQLUseCustomColour(wxCommandEvent &ev)
@@ -660,8 +663,8 @@ void frmOptions::OnOK(wxCommandEvent &ev)
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;
@@ -692,6 +695,12 @@ void frmOptions::OnOK(wxCommandEvent &ev)
settings->SetSQLBoxColourForeground(sColour);
}
+ colour = pickerSQLMarginBackgroundColour->GetColour();
+ sColour = colour.GetAsString(wxC2S_HTML_SYNTAX);
+ if (sColour != settings->GetSQLMarginBackgroundColour())
+ changed = true;
+ settings->SetSQLMarginBackgroundColour(sColour);
+
for (int i = 0; i <= 11; ++i)
{
wxString pickerId = wxString::Format(wxT("pickerSQLColour%i"), i);
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 162423e..917315c 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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="wxColourPickerCtrl" 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());
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers