summaryrefslogtreecommitdiff
path: root/wxWidgets-Fix
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:18:53 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:18:53 +0200
commit32cb97237e7691d31977ab503c6ea4511e8eb3a8 (patch)
tree4e97b53e9f7b74e8cc5d7548507d9e82ae38e36f /wxWidgets-Fix
parent4.6 (diff)
downloadFreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.tar.gz
FreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.tar.bz2
FreeFileSync-32cb97237e7691d31977ab503c6ea4511e8eb3a8.zip
5.0
Diffstat (limited to 'wxWidgets-Fix')
-rw-r--r--wxWidgets-Fix/apply-patches.cmd6
-rw-r--r--wxWidgets-Fix/grid.cpp.patch71
-rw-r--r--wxWidgets-Fix/grid.h.patch10
-rw-r--r--wxWidgets-Fix/settings.cpp.patch54
4 files changed, 32 insertions, 109 deletions
diff --git a/wxWidgets-Fix/apply-patches.cmd b/wxWidgets-Fix/apply-patches.cmd
index 30f88746..e8f6891c 100644
--- a/wxWidgets-Fix/apply-patches.cmd
+++ b/wxWidgets-Fix/apply-patches.cmd
@@ -1,11 +1,5 @@
@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
-pause
-patch "%1\include\wx\generic\grid.h" grid.h.patch
-pause
::Segoe UI font with Vista
patch "%1\src\msw\settings.cpp" settings.cpp.patch
-echo Make sure to add "-luxtheme" to "Standard linker flags" in \wxWidgets\build\msw\config.gcc!!!
pause \ No newline at end of file
diff --git a/wxWidgets-Fix/grid.cpp.patch b/wxWidgets-Fix/grid.cpp.patch
deleted file mode 100644
index af9bd684..00000000
--- a/wxWidgets-Fix/grid.cpp.patch
+++ /dev/null
@@ -1,71 +0,0 @@
---- 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
deleted file mode 100644
index 8ed3a8d0..00000000
--- a/wxWidgets-Fix/grid.h.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- 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? */);
-
diff --git a/wxWidgets-Fix/settings.cpp.patch b/wxWidgets-Fix/settings.cpp.patch
index 1ba9524a..3c48d052 100644
--- a/wxWidgets-Fix/settings.cpp.patch
+++ b/wxWidgets-Fix/settings.cpp.patch
@@ -1,19 +1,15 @@
---- src\msw\settings.cpp.old 2011-03-22 10:36:54.000000000 +0100
-+++ src\msw\settings.cpp 2011-12-14 21:58:59.642200200 +0100
-@@ -40,6 +40,12 @@
+--- settings.cpp.old 2011-03-22 10:36:54.000000000 +0100
++++ settings.cpp 2012-01-23 00:26:06.916105800 +0100
+@@ -40,6 +40,8 @@
#endif
#include "wx/fontutil.h"
+//#include <vssym32.h>
+#include <Uxtheme.h>
-+
-+#ifdef _MSC_VER
-+#pragma comment(lib, "UxTheme.lib")
-+#endif
// ----------------------------------------------------------------------------
// private classes
-@@ -261,6 +267,34 @@
+@@ -261,6 +263,48 @@
return font;
}
@@ -21,26 +17,40 @@
+#define TMT_MSGBOXFONT 805 //why is this constant missing from Uxtheme.h???
+#endif
+
++typedef HTHEME (WINAPI* OpenThemeDataFun )(HWND hwnd, LPCWSTR pszClassList);
++typedef HRESULT (WINAPI* CloseThemeDataFun )(HTHEME hTheme);
++typedef HRESULT (WINAPI* GetThemeSysFontFun)(HTHEME hTheme, int iFontID, LOGFONTW* plf);
++
+struct InitFont //(try to) initialize default font, before wxWidgets gets chance to screw up
+{
+ InitFont()
+ {
-+ HTHEME theme = ::OpenThemeData(NULL, //__in HWND hwnd,
-+ L"WINDOW"); //__in LPCWSTR pszClassList
-+
-+ LOGFONT lfont = {};
-+ if (::GetThemeSysFont(theme, //__in HTHEME hTheme,
-+ TMT_MSGBOXFONT, //__in int iFontID,
-+ &lfont) == S_OK) // __out LOGFONTW *plf
++ //Windows 2000 doesn't ship with this dll so we need to link it dynamically
++ if (HMODULE lib = ::LoadLibrary(L"UxTheme.dll"))
+ {
-+ wxNativeFontInfo native;
-+ native.lf = lfont;
-+ delete gs_fontDefault;
-+ gs_fontDefault = wxFontBase::New(native);
-+ }
++ OpenThemeDataFun OpenThemeData = reinterpret_cast<OpenThemeDataFun >(::GetProcAddress(lib, "OpenThemeData"));
++ CloseThemeDataFun CloseThemeData = reinterpret_cast<CloseThemeDataFun >(::GetProcAddress(lib, "CloseThemeData"));
++ GetThemeSysFontFun GetThemeSysFont = reinterpret_cast<GetThemeSysFontFun>(::GetProcAddress(lib, "GetThemeSysFont"));
+
-+ if (theme != NULL)
-+ ::CloseThemeData(theme);
++ HTHEME theme = (*OpenThemeData)(NULL, //__in HWND hwnd,
++ L"WINDOW"); //__in LPCWSTR pszClassList
++
++ LOGFONT lfont = {};
++ if ((*GetThemeSysFont)(theme, //__in HTHEME hTheme,
++ TMT_MSGBOXFONT, //__in int iFontID,
++ &lfont) == S_OK) // __out LOGFONTW *plf
++ {
++ wxNativeFontInfo native;
++ native.lf = lfont;
++ delete gs_fontDefault;
++ gs_fontDefault = wxFontBase::New(native);
++ }
++
++ if (theme != NULL)
++ (*CloseThemeData)(theme);
++
++ ::FreeLibrary(lib);
++ }
+ }
+} dummy;
+
bgstack15