Le 12/10/2010 10:22, Thom Brown a écrit :
> On 12 October 2010 09:16, Dave Page <dp...@pgadmin.org> wrote:
>> 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?
> 
> Or, if you're a bit awesome, implement the ability to use CTRL +
> scrollwheel and CTRL + (+/-) to zoom in/out.
> 

Turns out to be pretty simple. See the attached patch. It "only" handles
Ctrl+MouseWheel. The other part shouldn't be hard to do.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
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
-- 
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