Le 19/10/2010 13:29, Thom Brown a écrit :
> On 19 October 2010 21:24, Thom Brown <t...@linux.com> wrote:
>> On 19 October 2010 21:08, Guillaume Lelarge <guilla...@lelarge.info> wrote:
>>> You're right. Done in this new attached patch.
>>
>> Yep, that's excellent :)  One problem is that if you zoom in and
>> scroll down to a high-numbered row, it's cropped and you can't see the
>> whole number, so that would have to adjust too.  Might be unreasonable
>> for me to ask for column widths to also increase proportionately, but
>> it's better than before with your latest patch.
> 
> Oh, something else I've noticed.  The zoom in the SQL Editor is the
> opposite of the grid.  CTRL+scrollwheel up zooms out rather than in.
> 

Both fixed in this new patch. I also fix a BIG issue: my previous patch
doesn't allow the use of the wheel to move rows :)

So, what about this patch? good enough, I hope :)


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
diff --git a/pgadmin/ctl/ctlSQLGrid.cpp b/pgadmin/ctl/ctlSQLGrid.cpp
index 49faf08..553140c 100644
--- a/pgadmin/ctl/ctlSQLGrid.cpp
+++ b/pgadmin/ctl/ctlSQLGrid.cpp
@@ -21,8 +21,12 @@
 #include "frm/frmExport.h"
 
 
+#define EXTRAEXTENT_HEIGHT 6
+#define EXTRAEXTENT_WIDTH  6
+
 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 +59,32 @@ void ctlSQLGrid::OnCopy(wxCommandEvent& ev)
     Copy();
 }
 
+void ctlSQLGrid::OnMouseWheel(wxMouseEvent& event)
+{
+    if (event.ControlDown())
+    {
+        wxFont fontlabel = GetLabelFont();
+        wxFont fontcells = GetDefaultCellFont();
+        if (event.GetWheelRotation() > 0)
+        {
+            fontlabel.SetPointSize(fontlabel.GetPointSize()-1);
+            fontcells.SetPointSize(fontcells.GetPointSize()-1);
+        }
+        else
+        {
+            fontlabel.SetPointSize(fontlabel.GetPointSize()+1);
+            fontcells.SetPointSize(fontcells.GetPointSize()+1);
+        }
+        SetLabelFont(fontlabel);
+        SetDefaultCellFont(fontcells);
+        SetColLabelSize(fontlabel.GetPointSize() *4);
+        SetDefaultRowSize(fontcells.GetPointSize() *2);
+        ForceRefresh();
+    }
+    else
+        event.Skip();
+}
+
 wxString ctlSQLGrid::GetExportLine(int row)
 {
     return GetExportLine(row, 0, GetNumberCols() - 1);
@@ -190,9 +220,6 @@ int ctlSQLGrid::Copy()
     return copied;
 }
 
-#define EXTRAEXTENT_HEIGHT 6
-#define EXTRAEXTENT_WIDTH  6
-
 void ctlSQLGrid::OnLabelDoubleClick(wxGridEvent& event)
 {
     int maxHeight, maxWidth;
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