Le 19/10/2010 08:15, Guillaume Lelarge a écrit :
> Le 19/10/2010 00:27, Dave Page a écrit :
>> On Mon, Oct 18, 2010 at 10:59 PM, Guillaume Lelarge
>> <guilla...@lelarge.info> wrote:
>>> Le 12/10/2010 10:16, Dave Page a écrit :
>>>> On Mon, Oct 11, 2010 at 10:37 PM, Guillaume Lelarge
>>>> <guilla...@lelarge.info> wrote:
>>>>> Hi,
>>>>>
>>>>> Le 11/10/2010 20:54, Josh Berkus a écrit :
>>>>>> [...]
>>>>>> I'd like to use pgadmin3 for more demos.  But I find I can't because the
>>>>>> font size of the results grid is fixed as being fairly small, and
>>>>>> there's no way to make it larger.
>>>>>>
>>>>>
>>>>> There is a way. Go in the Options window, select the Preferences tab and
>>>>> change the Font. It will make, among other components the result grid
>>>>> bigger.
>>>>
>>>> Thats what I thought, but I tested it on Mac and found it didn't work.
>>>> wxMac bug?
>>>>
>>>
>>> I think it is more a wxGTK/wxWin bug which changes the font of the cell
>>> when you use the function to change the font of the labels.
>>>
>>> Can someone on Mac tries this patch?
>>
>> It picks up the main UI font, rather than the Query Tool font (which
>> is used by ctlSQLBox). I'm not sure that's the appropriate behaviour.
>> It also forces it to bold, because that's how the column/row headers
>> are shown.
>>
> 
> Yeah, just wanted to make sure we had to use the SetDefaultCellFont()
> method.
> 
> Will use the Query Tool font.
> 

Done.

>> We'd also need to ensure it also affects the edit grid, and other
>> grids we may be using such as those on the debugger.
>>
> 
> +1
> 

If they use the ctlSQLResult, they should be fine. I tried on the edit
grid and it worked.

Two patchs attached: one for the font customization (which could be
commited to 1.12 and master), one for the mousewheel support (which will
only be applied to master).

Any comments before I commit them?


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
>From 40548ebb8a86c1f9e9b83cd75f9ee445d0399456 Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <guilla...@lelarge.info>
Date: Tue, 19 Oct 2010 20:41:18 +0200
Subject: [PATCH] Allow the use of the mouse wheel to change font size

on the result grid.

Implements #263.
---
 pgadmin/ctl/ctlSQLGrid.cpp       |   15 +++++++++++++++
 pgadmin/include/ctl/ctlSQLGrid.h |    1 +
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLGrid.cpp b/pgadmin/ctl/ctlSQLGrid.cpp
index 49faf08..06748d7 100644
--- a/pgadmin/ctl/ctlSQLGrid.cpp
+++ b/pgadmin/ctl/ctlSQLGrid.cpp
@@ -23,6 +23,7 @@
 
 BEGIN_EVENT_TABLE(ctlSQLGrid, wxGrid)
     EVT_MENU(MNU_COPY, ctlSQLGrid::OnCopy)
+    EVT_MOUSEWHEEL(ctlSQLGrid::OnMouseWheel)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(ctlSQLGrid, wxGrid)
@@ -55,6 +56,20 @@ void ctlSQLGrid::OnCopy(wxCommandEvent& ev)
     Copy();
 }
 
+void ctlSQLGrid::OnMouseWheel(wxMouseEvent& event)
+{
+    if (event.ControlDown())
+    {
+        wxFont font = GetDefaultCellFont();
+        if (event.GetWheelRotation() > 0)
+            font.SetPointSize(font.GetPointSize()+1);
+        else
+            font.SetPointSize(font.GetPointSize()-1);
+        SetDefaultCellFont(font);
+        ForceRefresh();
+    }
+}
+
 wxString ctlSQLGrid::GetExportLine(int row)
 {
     return GetExportLine(row, 0, GetNumberCols() - 1);
diff --git a/pgadmin/include/ctl/ctlSQLGrid.h b/pgadmin/include/ctl/ctlSQLGrid.h
index 7b752a7..900d11a 100644
--- a/pgadmin/include/ctl/ctlSQLGrid.h
+++ b/pgadmin/include/ctl/ctlSQLGrid.h
@@ -37,6 +37,7 @@ public:
 
 private:
     void OnCopy(wxCommandEvent& event);
+    void OnMouseWheel(wxMouseEvent& event);
 };
 
 #endif
-- 
1.7.1

>From 4f921680ee3005710c795d86dfc6df371cfead81 Mon Sep 17 00:00:00 2001
From: Guillaume Lelarge <guilla...@lelarge.info>
Date: Tue, 19 Oct 2010 20:36:08 +0200
Subject: [PATCH] Force the query font on the results grid

Asked by Josh Berkus.

Fixes #262.
---
 pgadmin/ctl/ctlSQLGrid.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLGrid.cpp b/pgadmin/ctl/ctlSQLGrid.cpp
index 49faf08..fabbd22 100644
--- a/pgadmin/ctl/ctlSQLGrid.cpp
+++ b/pgadmin/ctl/ctlSQLGrid.cpp
@@ -34,6 +34,10 @@ ctlSQLGrid::ctlSQLGrid()
 ctlSQLGrid::ctlSQLGrid(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
 : wxGrid(parent, id, pos, size, wxWANTS_CHARS|wxVSCROLL|wxHSCROLL)
 {
+    // Set cells font
+    wxFont fntCells(settings->GetSQLFont());
+    SetDefaultCellFont(fntCells);
+    // Set labels font
     wxFont fntLabel(settings->GetSystemFont());
     fntLabel.SetWeight(wxBOLD);
     SetLabelFont(fntLabel);
-- 
1.7.1

-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to