summaryrefslogtreecommitdiff
path: root/wxWidgets-Fix
diff options
context:
space:
mode:
Diffstat (limited to 'wxWidgets-Fix')
-rw-r--r--wxWidgets-Fix/apply-patches.cmd8
-rw-r--r--wxWidgets-Fix/filepicker.h.patch19
-rw-r--r--wxWidgets-Fix/grid.cpp.patch71
-rw-r--r--wxWidgets-Fix/grid.h.patch10
4 files changed, 108 insertions, 0 deletions
diff --git a/wxWidgets-Fix/apply-patches.cmd b/wxWidgets-Fix/apply-patches.cmd
new file mode 100644
index 00000000..361abedd
--- /dev/null
+++ b/wxWidgets-Fix/apply-patches.cmd
@@ -0,0 +1,8 @@
+@if [%1]==[] echo Please pass wxWidgets installation directory as %%1 parameter, e.g.: C:\Programme\C++\wxWidgets && pause && exit
+
+::fix grid-label double-click to auto-size columns
+patch %1\src\generic\grid.cpp grid.cpp.patch
+patch %1\include\wx\generic\grid.h grid.h.patch
+
+::fix translation of "Browse" text
+patch %1\include\wx\filepicker.h filepicker.h.patch \ No newline at end of file
diff --git a/wxWidgets-Fix/filepicker.h.patch b/wxWidgets-Fix/filepicker.h.patch
new file mode 100644
index 00000000..d72184c4
--- /dev/null
+++ b/wxWidgets-Fix/filepicker.h.patch
@@ -0,0 +1,19 @@
+--- old 2009-03-06 11:00:42.000000000 +0100
++++ include\wx\filepicker.h 2009-10-24 16:55:45.968750000 +0200
+@@ -17,6 +17,7 @@
+ #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
+
+ #include "wx/pickerbase.h"
++#include "wx/intl.h"
+
+ class WXDLLIMPEXP_FWD_CORE wxDialog;
+ class WXDLLIMPEXP_FWD_CORE wxFileDirPickerEvent;
+@@ -326,7 +329,7 @@
+ const wxString& message,
+ const wxString& WXUNUSED(wildcard))
+ {
+- return new wxDirPickerWidget(parent, wxID_ANY, wxDirPickerWidgetLabel,
++ return new wxDirPickerWidget(parent, wxID_ANY, _("Browse"),
+ path, message,
+ wxDefaultPosition, wxDefaultSize,
+ GetPickerStyle(GetWindowStyle()));
diff --git a/wxWidgets-Fix/grid.cpp.patch b/wxWidgets-Fix/grid.cpp.patch
new file mode 100644
index 00000000..af9bd684
--- /dev/null
+++ b/wxWidgets-Fix/grid.cpp.patch
@@ -0,0 +1,71 @@
+--- old 2009-03-06 11:00:48.000000000 +0100
++++ src\generic\grid.cpp 2009-10-24 17:12:24.484375000 +0200
+@@ -5605,6 +5605,59 @@
+ }
+ }
+
++
++void wxGrid::AutoSizeColFast(int col, bool doRefresh)
++{
++ if (col < 0)
++ return;
++
++ int rowMax = -1;
++ size_t lenMax = 0;
++ for (int row = 0; row < GetNumberRows(); ++row)
++ if (GetCellValue(row, col).size() > lenMax)
++ {
++ lenMax = GetCellValue(row, col).size();
++ rowMax = row;
++ }
++
++ wxCoord extentMax = 0;
++
++ //calculate width of (most likely) widest cell
++ wxClientDC dc(GetGridWindow());
++ if (rowMax > -1)
++ {
++ wxGridCellAttr* attr = GetCellAttr(rowMax, col);
++ if (attr)
++ {
++ wxGridCellRenderer* renderer = attr->GetRenderer(this, rowMax, col);
++ if (renderer)
++ {
++ const wxSize size = renderer->GetBestSize(*this, *attr, dc, rowMax, col);
++ extentMax = std::max(extentMax, size.x);
++ renderer->DecRef();
++ }
++ attr->DecRef();
++ }
++ }
++
++ //consider column label
++ dc.SetFont(GetLabelFont());
++ wxCoord w = 0;
++ wxCoord h = 0;
++ dc.GetMultiLineTextExtent(GetColLabelValue(col), &w, &h );
++ if (GetColLabelTextOrientation() == wxVERTICAL)
++ w = h;
++ extentMax = std::max(extentMax, w);
++
++ extentMax += 15; //leave some space around text
++
++ SetColSize(col, extentMax);
++
++ if (doRefresh)
++ Refresh();
++}
++
++
+ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
+ {
+ int x, y, col;
+@@ -5829,7 +5882,7 @@
+ else
+ {
+ // adjust column width depending on label text
+- AutoSizeColLabelSize( col );
++ AutoSizeColFast( col );
+
+ ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL, m_colLabelWin);
+ m_dragLastPos = -1;
diff --git a/wxWidgets-Fix/grid.h.patch b/wxWidgets-Fix/grid.h.patch
new file mode 100644
index 00000000..8ed3a8d0
--- /dev/null
+++ b/wxWidgets-Fix/grid.h.patch
@@ -0,0 +1,10 @@
+--- old 2009-03-06 11:00:50.000000000 +0100
++++ include\wx\generic\grid.h 2009-10-24 16:56:31.062500000 +0200
+@@ -2003,6 +2003,7 @@
+ bool SetModelValues();
+
+ private:
++ void AutoSizeColFast(int col, bool doRefresh = true); //modification by ZenJu
+ // Calculate the minimum acceptable size for labels area
+ wxCoord CalcColOrRowLabelAreaMinSize(bool column /* or row? */);
+
bgstack15