diff --git a/3rdparty/wxwidgets3.0/include/wx/any.h b/3rdparty/wxwidgets3.0/include/wx/any.h index c2cd7a79f4..485a2ab734 100644 --- a/3rdparty/wxwidgets3.0/include/wx/any.h +++ b/3rdparty/wxwidgets3.0/include/wx/any.h @@ -164,13 +164,17 @@ private: public: \ static bool IsSameClass(const wxAnyValueType* otherType) \ { \ - return wxTypeId(*sm_instance.get()) == wxTypeId(*otherType); \ + return AreSameClasses(*sm_instance.get(), *otherType); \ } \ virtual bool IsSameType(const wxAnyValueType* otherType) const \ { \ return IsSameClass(otherType); \ } \ private: \ + static bool AreSameClasses(const wxAnyValueType& a, const wxAnyValueType& b) \ + { \ + return wxTypeId(a) == wxTypeId(b); \ + } \ static wxAnyValueTypeScopedPtr sm_instance; \ public: \ static wxAnyValueType* GetInstance() \ diff --git a/3rdparty/wxwidgets3.0/include/wx/cmdargs.h b/3rdparty/wxwidgets3.0/include/wx/cmdargs.h index e4167f0fd6..62e92b7c70 100644 --- a/3rdparty/wxwidgets3.0/include/wx/cmdargs.h +++ b/3rdparty/wxwidgets3.0/include/wx/cmdargs.h @@ -51,9 +51,11 @@ public: if ( !m_argsA ) { const size_t count = m_args.size(); - m_argsA = new char *[count]; + m_argsA = new char *[count + 1]; for ( size_t n = 0; n < count; n++ ) m_argsA[n] = wxStrdup(m_args[n].ToAscii()); + + m_argsA[count] = NULL; } return m_argsA; @@ -64,9 +66,11 @@ public: if ( !m_argsW ) { const size_t count = m_args.size(); - m_argsW = new wchar_t *[count]; + m_argsW = new wchar_t *[count + 1]; for ( size_t n = 0; n < count; n++ ) m_argsW[n] = wxStrdup(m_args[n].wc_str()); + + m_argsW[count] = NULL; } return m_argsW; diff --git a/3rdparty/wxwidgets3.0/include/wx/defs.h b/3rdparty/wxwidgets3.0/include/wx/defs.h index 397ddd7057..255a533d84 100644 --- a/3rdparty/wxwidgets3.0/include/wx/defs.h +++ b/3rdparty/wxwidgets3.0/include/wx/defs.h @@ -357,7 +357,21 @@ typedef short int WXTYPE; #endif #endif -#if defined(__has_include) +/* + Check for C++11 compilers, it is important to do it before the + __has_include() checks because of g++ 4.9.2+ complications below. + */ +#if (defined(__cplusplus) && __cplusplus >= 201103L) || wxCHECK_VISUALC_VERSION(10) + #ifndef HAVE_TYPE_TRAITS + #define HAVE_TYPE_TRAITS + #endif + #ifndef HAVE_STD_UNORDERED_MAP + #define HAVE_STD_UNORDERED_MAP + #endif + #ifndef HAVE_STD_UNORDERED_SET + #define HAVE_STD_UNORDERED_SET + #endif +#elif defined(__has_include) /* Notice that we trust our configure tests more than __has_include(), notably the latter can return true even if the header exists but isn't @@ -365,8 +379,20 @@ typedef short int WXTYPE; So if configure already detected at least one working alternative, just use it. */ + + /* + Since 4.9.2, g++ provides __has_include() but, unlike clang, refuses to + compile the C++11 headers in C++98 mode (and we are sure we use the + latter because we explicitly checked for C++11 above). + */ + #if defined(__GNUC__) && !defined(__clang__) + #define wx_has_cpp11_include(h) 0 + #else + #define wx_has_cpp11_include(h) __has_include(h) + #endif + #if !defined(HAVE_TYPE_TRAITS) && !defined(HAVE_TR1_TYPE_TRAITS) - #if __has_include() + #if wx_has_cpp11_include() #define HAVE_TYPE_TRAITS #elif __has_include() #define HAVE_TR1_TYPE_TRAITS @@ -374,7 +400,7 @@ typedef short int WXTYPE; #endif #if !defined(HAVE_STD_UNORDERED_MAP) && !defined(HAVE_TR1_UNORDERED_MAP) - #if __has_include() + #if wx_has_cpp11_include() #define HAVE_STD_UNORDERED_MAP #elif __has_include() #define HAVE_TR1_UNORDERED_MAP @@ -382,7 +408,7 @@ typedef short int WXTYPE; #endif #if !defined(HAVE_STD_UNORDERED_SET) && !defined(HAVE_TR1_UNORDERED_SET) - #if __has_include() + #if wx_has_cpp11_include() #define HAVE_STD_UNORDERED_SET #elif __has_include() #define HAVE_TR1_UNORDERED_SET @@ -1787,7 +1813,12 @@ enum wxBorder /* * Window (Frame/dialog/subwindow/panel item) style flags */ -#define wxVSCROLL 0x80000000 + +/* The cast is needed to avoid g++ -Wnarrowing warnings when initializing + * values of int type with wxVSCROLL on 32 bit platforms, where its value is + * greater than INT_MAX. + */ +#define wxVSCROLL ((int)0x80000000) #define wxHSCROLL 0x40000000 #define wxCAPTION 0x20000000 @@ -3169,14 +3200,22 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIImage); DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); DECLARE_WXCOCOA_OBJC_CLASS(NSSet); DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); +DECLARE_WXCOCOA_OBJC_CLASS(UIWebView); typedef WX_UIWindow WXWindow; typedef WX_UIView WXWidget; typedef WX_EAGLContext WXGLContext; typedef WX_NSString* WXGLPixelFormat; +typedef WX_UIWebView OSXWebViewPtr; #endif +#if wxOSX_USE_COCOA_OR_CARBON +DECLARE_WXCOCOA_OBJC_CLASS(WebView); +typedef WX_WebView OSXWebViewPtr; +#endif + + #endif /* __WXMAC__ */ /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */ diff --git a/3rdparty/wxwidgets3.0/include/wx/dirdlg.h b/3rdparty/wxwidgets3.0/include/wx/dirdlg.h index b7b7474ab5..f4887051ba 100644 --- a/3rdparty/wxwidgets3.0/include/wx/dirdlg.h +++ b/3rdparty/wxwidgets3.0/include/wx/dirdlg.h @@ -11,6 +11,8 @@ #ifndef _WX_DIRDLG_H_BASE_ #define _WX_DIRDLG_H_BASE_ +#include "wx/defs.h" + #if wxUSE_DIRDLG #include "wx/dialog.h" diff --git a/3rdparty/wxwidgets3.0/include/wx/filefn.h b/3rdparty/wxwidgets3.0/include/wx/filefn.h index 4815807f60..6cf2548880 100644 --- a/3rdparty/wxwidgets3.0/include/wx/filefn.h +++ b/3rdparty/wxwidgets3.0/include/wx/filefn.h @@ -216,8 +216,22 @@ enum wxPosixPermissions #define wxFtell _ftelli64 #elif wxCHECK_MINGW32_VERSION(3, 5) // mingw-runtime version (not gcc) #define wxHAS_HUGE_STDIO_FILES + + wxDECL_FOR_STRICT_MINGW32(int, fseeko64, (FILE*, long long, int)); #define wxFseek fseeko64 - #define wxFtell ftello64 + + #ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + // Unfortunately ftello64() is not defined in the library for + // whatever reason but as an inline function, so define wxFtell() + // here similarly. + inline long long wxFtell(FILE* fp) + { + fpos_t pos; + return fgetpos(fp, &pos) == 0 ? pos : -1LL; + } + #else + #define wxFtell ftello64 + #endif #endif // other Windows compilers (DMC, Watcom, and Borland) don't have huge file @@ -376,7 +390,7 @@ enum wxPosixPermissions // finally the default char-type versions #if wxUSE_UNICODE - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) + #if wxUSE_UNICODE_MSLU // implement the missing file functions in Win9x ourselves WXDLLIMPEXP_BASE int wxMSLU__wopen(const wxChar *name, int flags, int mode); @@ -404,6 +418,9 @@ enum wxPosixPermissions #define wxCRT_MkDir wxCRT_MkDirW #define wxCRT_RmDir wxCRT_RmDirW #define wxCRT_Stat wxCRT_StatW + + wxDECL_FOR_STRICT_MINGW32(int, _wmkdir, (const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrmdir, (const wchar_t*)) #endif // wxUSE_UNICODE_MSLU/!wxUSE_UNICODE_MSLU #else // !wxUSE_UNICODE #define wxCRT_Open wxCRT_OpenA diff --git a/3rdparty/wxwidgets3.0/include/wx/fontutil.h b/3rdparty/wxwidgets3.0/include/wx/fontutil.h index 60bb874640..9e4d0235f9 100644 --- a/3rdparty/wxwidgets3.0/include/wx/fontutil.h +++ b/3rdparty/wxwidgets3.0/include/wx/fontutil.h @@ -227,6 +227,9 @@ public: // init with the parameters of the given font void InitFromFont(const wxFont& font) { +#if wxUSE_PANGO + Init(*font.GetNativeFontInfo()); +#else // translate all font parameters SetStyle((wxFontStyle)font.GetStyle()); SetWeight((wxFontWeight)font.GetWeight()); @@ -252,6 +255,7 @@ public: // deal with encoding now (it may override the font family and facename // so do it after setting them) SetEncoding(font.GetEncoding()); +#endif // !wxUSE_PANGO } // accessors and modifiers for the font elements diff --git a/3rdparty/wxwidgets3.0/include/wx/generic/calctrlg.h b/3rdparty/wxwidgets3.0/include/wx/generic/calctrlg.h index 8e430b6231..9dde9ae80b 100644 --- a/3rdparty/wxwidgets3.0/include/wx/generic/calctrlg.h +++ b/3rdparty/wxwidgets3.0/include/wx/generic/calctrlg.h @@ -179,6 +179,7 @@ private: void OnPaint(wxPaintEvent& event); void OnClick(wxMouseEvent& event); void OnDClick(wxMouseEvent& event); + void OnWheel(wxMouseEvent& event); void OnChar(wxKeyEvent& event); void OnMonthChange(wxCommandEvent& event); diff --git a/3rdparty/wxwidgets3.0/include/wx/generic/private/listctrl.h b/3rdparty/wxwidgets3.0/include/wx/generic/private/listctrl.h index 5cd210f486..f34e293bfc 100644 --- a/3rdparty/wxwidgets3.0/include/wx/generic/private/listctrl.h +++ b/3rdparty/wxwidgets3.0/include/wx/generic/private/listctrl.h @@ -863,6 +863,7 @@ private: DECLARE_EVENT_TABLE() friend class wxGenericListCtrl; + friend class wxListCtrlMaxWidthCalculator; }; #endif // wxUSE_LISTCTRL diff --git a/3rdparty/wxwidgets3.0/include/wx/generic/private/widthcalc.h b/3rdparty/wxwidgets3.0/include/wx/generic/private/widthcalc.h new file mode 100644 index 0000000000..d9549e7d70 --- /dev/null +++ b/3rdparty/wxwidgets3.0/include/wx/generic/private/widthcalc.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/private/widthcalc.h +// Purpose: wxMaxWidthCalculatorBase helper class. +// Author: Václav Slavík, Kinaou Hervé +// Copyright: (c) 2015 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_PRIVATE_WIDTHCALC_H_ +#define _WX_GENERIC_PRIVATE_WIDTHCALC_H_ + +#include "wx/defs.h" + +#if wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#include "wx/log.h" +#include "wx/timer.h" + +// ---------------------------------------------------------------------------- +// wxMaxWidthCalculatorBase: base class for calculating max column width +// ---------------------------------------------------------------------------- + +class wxMaxWidthCalculatorBase +{ +public: + // column of which calculate the width + explicit wxMaxWidthCalculatorBase(size_t column) + : m_column(column), + m_width(0) + { + } + + void UpdateWithWidth(int width) + { + m_width = wxMax(m_width, width); + } + + // Update the max with for the expected row + virtual void UpdateWithRow(int row) = 0; + + int GetMaxWidth() const { return m_width; } + size_t GetColumn() const { return m_column; } + + void + ComputeBestColumnWidth(size_t count, + size_t first_visible, + size_t last_visible) + { + // The code below deserves some explanation. For very large controls, we + // simply can't afford to calculate sizes for all items, it takes too + // long. So the best we can do is to check the first and the last N/2 + // items in the control for some sufficiently large N and calculate best + // sizes from that. That can result in the calculated best width being too + // small for some outliers, but it's better to get slightly imperfect + // result than to wait several seconds after every update. To avoid highly + // visible miscalculations, we also include all currently visible items + // no matter what. Finally, the value of N is determined dynamically by + // measuring how much time we spent on the determining item widths so far. + +#if wxUSE_STOPWATCH + size_t top_part_end = count; + static const long CALC_TIMEOUT = 20/*ms*/; + // don't call wxStopWatch::Time() too often + static const unsigned CALC_CHECK_FREQ = 100; + wxStopWatch timer; +#else + // use some hard-coded limit, that's the best we can do without timer + size_t top_part_end = wxMin(500, count); +#endif // wxUSE_STOPWATCH/!wxUSE_STOPWATCH + + size_t row = 0; + + for ( row = 0; row < top_part_end; row++ ) + { +#if wxUSE_STOPWATCH + if ( row % CALC_CHECK_FREQ == CALC_CHECK_FREQ-1 && + timer.Time() > CALC_TIMEOUT ) + break; +#endif // wxUSE_STOPWATCH + UpdateWithRow(row); + } + + // row is the first unmeasured item now; that's our value of N/2 + if ( row < count ) + { + top_part_end = row; + + // add bottom N/2 items now: + const size_t bottom_part_start = wxMax(row, count - row); + for ( row = bottom_part_start; row < count; row++ ) + { + UpdateWithRow(row); + } + + // finally, include currently visible items in the calculation: + first_visible = wxMax(first_visible, top_part_end); + last_visible = wxMin(bottom_part_start, last_visible); + + for ( row = first_visible; row < last_visible; row++ ) + { + UpdateWithRow(row); + } + + wxLogTrace("items container", + "determined best size from %zu top, %zu bottom " + "plus %zu more visible items out of %zu total", + top_part_end, + count - bottom_part_start, + wxMax(0, last_visible - first_visible), + count); + } + } + +private: + const size_t m_column; + int m_width; + + wxDECLARE_NO_COPY_CLASS(wxMaxWidthCalculatorBase); +}; + +#endif // wxUSE_DATAVIEWCTRL || wxUSE_LISTCTRL + +#endif // _WX_GENERIC_PRIVATE_WIDTHCALC_H_ diff --git a/3rdparty/wxwidgets3.0/include/wx/glcanvas.h b/3rdparty/wxwidgets3.0/include/wx/glcanvas.h index 688d4788b0..b94381ccc1 100644 --- a/3rdparty/wxwidgets3.0/include/wx/glcanvas.h +++ b/3rdparty/wxwidgets3.0/include/wx/glcanvas.h @@ -48,7 +48,10 @@ enum WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits) WX_GL_MIN_ACCUM_ALPHA, // use alpha buffer with most bits (> MIN_ACCUM_ALPHA bits) WX_GL_SAMPLE_BUFFERS, // 1 for multisampling support (antialiasing) - WX_GL_SAMPLES // 4 for 2x2 antialiasing supersampling on most graphics cards + WX_GL_SAMPLES, // 4 for 2x2 antialiasing supersampling on most graphics cards + WX_GL_CORE_PROFILE, // use an OpenGL core profile + WX_GL_MAJOR_VERSION, // major OpenGL version of the core profile + WX_GL_MINOR_VERSION // minor OpenGL version of the core profile }; #define wxGLCanvasName wxT("GLCanvas") diff --git a/3rdparty/wxwidgets3.0/include/wx/log.h b/3rdparty/wxwidgets3.0/include/wx/log.h index be0a245a49..959550ecb3 100644 --- a/3rdparty/wxwidgets3.0/include/wx/log.h +++ b/3rdparty/wxwidgets3.0/include/wx/log.h @@ -1487,7 +1487,7 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0); #define wxDEFINE_EMPTY_LOG_FUNCTION2(level, argclass) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxFormatString&)) \ - WX_WATCOM_OR_MINGW_ONLY_CODE( \ + WX_WATCOM_ONLY_CODE( \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const char*)) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wchar_t*)) \ WX_DEFINE_VARARG_FUNC_NOP(wxLog##level, 2, (argclass, const wxCStrData&)) \ diff --git a/3rdparty/wxwidgets3.0/include/wx/math.h b/3rdparty/wxwidgets3.0/include/wx/math.h index 89a1b94473..bf5b8922a9 100644 --- a/3rdparty/wxwidgets3.0/include/wx/math.h +++ b/3rdparty/wxwidgets3.0/include/wx/math.h @@ -15,6 +15,17 @@ #include "wx/defs.h" +#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + /* + In addition to declaring _finite() ourselves below, we also must work + around a compilation error in MinGW standard header itself, see + https://sourceforge.net/p/mingw/bugs/2250/ + */ + #ifndef __NO_INLINE__ + #define __NO_INLINE__ + #endif +#endif + #include #ifndef M_PI @@ -53,11 +64,18 @@ #ifdef __cplusplus -/* Any C++11 compiler should provide isfinite() */ +/* + Things are simple with C++11: we have everything we need in std. + Eventually we will only have this section and not the legacy stuff below. + */ #if __cplusplus >= 201103 #include + #define wxFinite(x) std::isfinite(x) -#elif defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) + #define wxIsNaN(x) std::isnan(x) +#else /* C++98 */ + +#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) #include #define wxFinite(x) _finite(x) #elif defined(__MINGW64_TOOLCHAIN__) || defined(__clang__) @@ -71,6 +89,10 @@ #else #define wxFinite(x) isfinite(x) #endif +#elif defined(wxNEEDS_STRICT_ANSI_WORKAROUNDS) + wxDECL_FOR_STRICT_MINGW32(int, _finite, (double)); + + #define wxFinite(x) _finite(x) #elif ( defined(__GNUG__)||defined(__GNUWIN32__)||defined(__DJGPP__)|| \ defined(__SGI_CC__)||defined(__SUNCC__)||defined(__XLC__)|| \ defined(__HPUX__) ) && ( !defined(wxOSX_USE_IPHONE) || wxOSX_USE_IPHONE == 0 ) @@ -93,6 +115,8 @@ #define wxIsNaN(x) ((x) != (x)) #endif +#endif /* C++11/C++98 */ + #ifdef __INTELC__ inline bool wxIsSameDouble(double x, double y) diff --git a/3rdparty/wxwidgets3.0/include/wx/msgdlg.h b/3rdparty/wxwidgets3.0/include/wx/msgdlg.h index 8a234ac48f..0466b6da96 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msgdlg.h +++ b/3rdparty/wxwidgets3.0/include/wx/msgdlg.h @@ -101,6 +101,11 @@ public: wxString GetCaption() const { return m_caption; } + // Title and caption are the same thing, GetCaption() mostly exists just + // for compatibility. + virtual void SetTitle(const wxString& title) { m_caption = title; } + virtual wxString GetTitle() const { return m_caption; } + virtual void SetMessage(const wxString& message) { m_message = message; diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/debughlp.h b/3rdparty/wxwidgets3.0/include/wx/msw/debughlp.h index 715814d0ae..d0d289e6a1 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/debughlp.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/debughlp.h @@ -15,7 +15,20 @@ #include "wx/msw/wrapwin.h" #ifndef __WXWINCE__ +#ifdef __VISUALC__ + // Disable a warning that we can do nothing about: we get it at least for + // imagehlp.h from 8.1 Windows kit when using VC14. + #pragma warning(push) + + // 'typedef ': ignored on left of '' when no variable is declared + #pragma warning(disable:4091) +#endif + #include + +#ifdef __VISUALC__ + #pragma warning(pop) +#endif #endif // __WXWINCE__ #include "wx/msw/private.h" diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/gccpriv.h b/3rdparty/wxwidgets3.0/include/wx/msw/gccpriv.h index c1962799a6..c2b4b735c3 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/gccpriv.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/gccpriv.h @@ -156,5 +156,28 @@ #endif #endif +/* + Traditional MinGW (but not MinGW-w64 nor TDM-GCC) omits many POSIX + functions from their headers when compiled with __STRICT_ANSI__ defined. + Unfortunately this means that they are not available when using -std=c++98 + (not very common) or -std=c++11 (much more so), but we still need them even + in this case. As the intention behind using -std=c++11 is probably to get + the new C++11 features and not disable the use of POSIX functions, we just + manually declare the functions we need in this case if necessary. + */ +#if defined(__MINGW32_TOOLCHAIN__) && defined(__STRICT_ANSI__) + #define wxNEEDS_STRICT_ANSI_WORKAROUNDS + + /* + This macro is somewhat unusual as it takes the list of parameters + inside parentheses and includes semicolon inside it as putting the + semicolon outside wouldn't do the right thing when this macro is empty. + */ + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) \ + extern "C" _CRTIMP rettype __cdecl __MINGW_NOTHROW func params ; +#else + #define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) +#endif + #endif /* _WX_MSW_GCCPRIV_H_ */ diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/init.h b/3rdparty/wxwidgets3.0/include/wx/msw/init.h index 014dedbd09..8636890aee 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/init.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/init.h @@ -30,6 +30,10 @@ typedef char *wxCmdLineArgType; #endif +// Call this function to prevent wxMSW from calling SetProcessDPIAware(). +// Must be called before wxEntry(). +extern WXDLLIMPEXP_CORE void wxMSWDisableSettingHighDPIAware(); + // Windows-only overloads of wxEntry() and wxEntryStart() which take the // parameters passed to WinMain() instead of those passed to main() extern WXDLLIMPEXP_CORE bool diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/private.h b/3rdparty/wxwidgets3.0/include/wx/msw/private.h index e50fb68da1..58c89f5d5c 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/private.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/private.h @@ -183,6 +183,8 @@ extern LONG APIENTRY _EXPORT || defined(__MINGW32__) #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd)) #define wxOpenOSFHandle(h, flags) (_open_osfhandle(wxPtrToUInt(h), flags)) + + wxDECL_FOR_STRICT_MINGW32(FILE*, _fdopen, (int, const char*)) #define wx_fdopen _fdopen #endif diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/private/fswatcher.h b/3rdparty/wxwidgets3.0/include/wx/msw/private/fswatcher.h index 38e3b41ee0..083476c205 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/private/fswatcher.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/private/fswatcher.h @@ -312,7 +312,7 @@ protected: virtual ExitCode Entry(); // wait for events to occur, read them and send to interested parties - // returns false it empty status was read, which means we whould exit + // returns false it empty status was read, which means we would exit // true otherwise bool ReadEvents(); diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/registry.h b/3rdparty/wxwidgets3.0/include/wx/msw/registry.h index 20343a540b..2c17d36145 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/registry.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/registry.h @@ -123,7 +123,7 @@ public: // hKey should be opened and will be closed in wxRegKey dtor void SetHkey(WXHKEY hKey); - // get infomation about the key + // get information about the key // get the (full) key name. Abbreviate std root keys if bShortPrefix. wxString GetName(bool bShortPrefix = true) const; // Retrieves the registry view used by this key. @@ -132,7 +132,7 @@ public: bool Exists() const; // get the info about key (any number of these pointers may be NULL) bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys - size_t *pnMaxKeyLen, // max len of subkey name + size_t *pnMaxKeyLen, // max length of subkey name size_t *pnValues, // number of values size_t *pnMaxValueLen) const; // return true if the key is opened diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/subwin.h b/3rdparty/wxwidgets3.0/include/wx/msw/subwin.h index 9e48b9e35f..85fdb68186 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/subwin.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/subwin.h @@ -152,6 +152,7 @@ private: { m_count = 0; m_hwnds = NULL; + m_ids = NULL; } // number of elements in m_hwnds array diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/tls.h b/3rdparty/wxwidgets3.0/include/wx/msw/tls.h index 962490858d..e14fd541ca 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/tls.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/tls.h @@ -39,7 +39,7 @@ public: // here, so explicitly preserve the last error here. const DWORD dwLastError = ::GetLastError(); void* const value = ::TlsGetValue(m_slot); - if (dwLastError) + if ( dwLastError ) ::SetLastError(dwLastError); return value; } diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/webview_missing.h b/3rdparty/wxwidgets3.0/include/wx/msw/webview_missing.h index fc2b8bc045..70143ae7f7 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/webview_missing.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/webview_missing.h @@ -692,7 +692,7 @@ public: virtual HRESULT wxSTDCALL get_onpropertychange(VARIANT *p) = 0; virtual HRESULT wxSTDCALL getClientRects(wxIHTMLRectCollection **pRectCol) = 0; virtual HRESULT wxSTDCALL getBoundingClientRect(wxIHTMLRect **pRect) = 0; - virtual HRESULT wxSTDCALL setExpression(BSTR propname, BSTR expression, BSTR language = L"") = 0; + virtual HRESULT wxSTDCALL setExpression(BSTR propname, BSTR expression, BSTR language) = 0; virtual HRESULT wxSTDCALL getExpression(BSTR propname, VARIANT *expression) = 0; virtual HRESULT wxSTDCALL removeExpression(BSTR propname, VARIANT_BOOL *pfSuccess) = 0; virtual HRESULT wxSTDCALL put_tabIndex(short v) = 0; diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/wrapgdip.h b/3rdparty/wxwidgets3.0/include/wx/msw/wrapgdip.h index 04d4009a67..7b12ea51f9 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/wrapgdip.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/wrapgdip.h @@ -24,8 +24,21 @@ #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +// There are many clashes between the names of the member fields and parameters +// in the standard gdiplus.h header and each of them results in C4458 with +// VC14, so disable this warning for this file as there is no other way to +// avoid it. +#ifdef __VISUALC__ + #pragma warning(push) + #pragma warning(disable:4458) // declaration of 'xxx' hides class member +#endif + #include using namespace Gdiplus; +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + #endif // _WX_MSW_WRAPGDIP_H_ diff --git a/3rdparty/wxwidgets3.0/include/wx/msw/wrapshl.h b/3rdparty/wxwidgets3.0/include/wx/msw/wrapshl.h index 8826a039ba..dbcc612467 100644 --- a/3rdparty/wxwidgets3.0/include/wx/msw/wrapshl.h +++ b/3rdparty/wxwidgets3.0/include/wx/msw/wrapshl.h @@ -20,8 +20,21 @@ #include #endif +#ifdef __VISUALC__ + // Disable a warning that we can do nothing about: we get it for + // shlobj.h at least from 7.1a Windows kit when using VC14. + #pragma warning(push) + + // 'typedef ': ignored on left of '' when no variable is declared + #pragma warning(disable:4091) +#endif + #include +#ifdef __VISUALC__ + #pragma warning(pop) +#endif + #include "wx/msw/winundef.h" #include "wx/log.h" diff --git a/3rdparty/wxwidgets3.0/include/wx/platform.h b/3rdparty/wxwidgets3.0/include/wx/platform.h index d1c18f320d..bb671f0158 100644 --- a/3rdparty/wxwidgets3.0/include/wx/platform.h +++ b/3rdparty/wxwidgets3.0/include/wx/platform.h @@ -310,7 +310,7 @@ */ #elif defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \ - defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \ + defined(__hpux) || defined(__sun) || defined(__SUN__) || defined(_AIX) || \ defined(__EMX__) || defined(__VMS) || defined(__BEOS__) || defined(__MACH__) # define __UNIX_LIKE__ @@ -459,6 +459,7 @@ # define wxCHECK_W32API_VERSION(maj, min) (0) # undef wxCHECK_MINGW32_VERSION # define wxCHECK_MINGW32_VERSION( major, minor ) (0) +# define wxDECL_FOR_STRICT_MINGW32(rettype, func, params) #endif diff --git a/3rdparty/wxwidgets3.0/include/wx/private/socket.h b/3rdparty/wxwidgets3.0/include/wx/private/socket.h index 973b764f7d..362aa61982 100644 --- a/3rdparty/wxwidgets3.0/include/wx/private/socket.h +++ b/3rdparty/wxwidgets3.0/include/wx/private/socket.h @@ -308,6 +308,9 @@ public: protected: wxSocketImpl(wxSocketBase& wxsocket); + // get the associated socket flags + wxSocketFlags GetSocketFlags() const { return m_wxsocket->GetFlags(); } + // true if we're a listening stream socket bool m_server; diff --git a/3rdparty/wxwidgets3.0/include/wx/rawbmp.h b/3rdparty/wxwidgets3.0/include/wx/rawbmp.h index adcf81f398..fa404a1f1b 100644 --- a/3rdparty/wxwidgets3.0/include/wx/rawbmp.h +++ b/3rdparty/wxwidgets3.0/include/wx/rawbmp.h @@ -381,7 +381,7 @@ struct wxPixelDataOut { m_pRGB += data.GetRowStride()*y + PixelFormat::SizePixel*x; if ( m_pAlpha ) - m_pAlpha += data.GetWidth() + x; + m_pAlpha += data.GetWidth()*y + x; } // move x pixels to the right (again, no row wrapping) @@ -397,7 +397,7 @@ struct wxPixelDataOut { m_pRGB += data.GetRowStride()*y; if ( m_pAlpha ) - m_pAlpha += data.GetWidth(); + m_pAlpha += data.GetWidth()*y; } // go to the given position diff --git a/3rdparty/wxwidgets3.0/include/wx/version.h b/3rdparty/wxwidgets3.0/include/wx/version.h index c1c438d2d9..b894928ad9 100644 --- a/3rdparty/wxwidgets3.0/include/wx/version.h +++ b/3rdparty/wxwidgets3.0/include/wx/version.h @@ -27,9 +27,9 @@ /* NB: this file is parsed by automatic tools so don't change its format! */ #define wxMAJOR_VERSION 3 #define wxMINOR_VERSION 0 -#define wxRELEASE_NUMBER 2 +#define wxRELEASE_NUMBER 3 #define wxSUBRELEASE_NUMBER 0 -#define wxVERSION_STRING wxT("wxWidgets 3.0.2") +#define wxVERSION_STRING wxT("wxWidgets 3.0.3") /* nothing to update below this line when updating the version */ /* ---------------------------------------------------------------------------- */ diff --git a/3rdparty/wxwidgets3.0/include/wx/wxcrtbase.h b/3rdparty/wxwidgets3.0/include/wx/wxcrtbase.h index 1c3522ec66..4ebe8c212e 100644 --- a/3rdparty/wxwidgets3.0/include/wx/wxcrtbase.h +++ b/3rdparty/wxwidgets3.0/include/wx/wxcrtbase.h @@ -73,6 +73,9 @@ #ifdef wxNEED_ISASCII inline int isascii(int c) { return (unsigned)c < 0x80; } + + // Avoid further (re)definitions of it. + #define isascii isascii #endif #ifdef _WIN32_WCE @@ -445,7 +448,7 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha #else /* Unicode filenames */ /* special case: these functions are missing under Win9x with Unicows so we have to implement them ourselves */ - #if wxUSE_UNICODE_MSLU || defined(__WX_STRICT_ANSI_GCC__) + #if wxUSE_UNICODE_MSLU WXDLLIMPEXP_BASE FILE* wxMSLU__wfopen(const wchar_t *name, const wchar_t *mode); WXDLLIMPEXP_BASE FILE* wxMSLU__wfreopen(const wchar_t *name, const wchar_t *mode, FILE *stream); WXDLLIMPEXP_BASE int wxMSLU__wrename(const wchar_t *oldname, const wchar_t *newname); @@ -455,6 +458,11 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha #define wxCRT_Remove wxMSLU__wremove #define wxCRT_Rename wxMSLU__wrename #else + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfopen, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(FILE*, _wfreopen, (const wchar_t*, const wchar_t*, FILE*)) + wxDECL_FOR_STRICT_MINGW32(int, _wrename, (const wchar_t*, const wchar_t*)) + wxDECL_FOR_STRICT_MINGW32(int, _wremove, (const wchar_t*)) + /* WinCE CRT doesn't provide these functions so use our own */ #ifdef __WXWINCE__ WXDLLIMPEXP_BASE int wxCRT_Rename(const wchar_t *src, diff --git a/3rdparty/wxwidgets3.0/src/common/accelcmn.cpp b/3rdparty/wxwidgets3.0/src/common/accelcmn.cpp index 003ecbc514..ad48711da3 100644 --- a/3rdparty/wxwidgets3.0/src/common/accelcmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/accelcmn.cpp @@ -38,79 +38,84 @@ wxAcceleratorTable wxNullAcceleratorTable; // wxAcceleratorEntry implementation // ============================================================================ +wxGCC_WARNING_SUPPRESS(missing-field-initializers) + static const struct wxKeyName { wxKeyCode code; const char *name; + const char *display_name; } wxKeyNames[] = { - { WXK_DELETE, wxTRANSLATE("DEL") }, - { WXK_DELETE, wxTRANSLATE("DELETE") }, - { WXK_BACK, wxTRANSLATE("BACK") }, - { WXK_INSERT, wxTRANSLATE("INS") }, - { WXK_INSERT, wxTRANSLATE("INSERT") }, - { WXK_RETURN, wxTRANSLATE("ENTER") }, - { WXK_RETURN, wxTRANSLATE("RETURN") }, - { WXK_PAGEUP, wxTRANSLATE("PGUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PGDN") }, - { WXK_LEFT, wxTRANSLATE("LEFT") }, - { WXK_RIGHT, wxTRANSLATE("RIGHT") }, - { WXK_UP, wxTRANSLATE("UP") }, - { WXK_DOWN, wxTRANSLATE("DOWN") }, - { WXK_HOME, wxTRANSLATE("HOME") }, - { WXK_END, wxTRANSLATE("END") }, - { WXK_SPACE, wxTRANSLATE("SPACE") }, - { WXK_TAB, wxTRANSLATE("TAB") }, - { WXK_ESCAPE, wxTRANSLATE("ESC") }, - { WXK_ESCAPE, wxTRANSLATE("ESCAPE") }, - { WXK_CANCEL, wxTRANSLATE("CANCEL") }, - { WXK_CLEAR, wxTRANSLATE("CLEAR") }, - { WXK_MENU, wxTRANSLATE("MENU") }, - { WXK_PAUSE, wxTRANSLATE("PAUSE") }, - { WXK_CAPITAL, wxTRANSLATE("CAPITAL") }, - { WXK_SELECT, wxTRANSLATE("SELECT") }, - { WXK_PRINT, wxTRANSLATE("PRINT") }, - { WXK_EXECUTE, wxTRANSLATE("EXECUTE") }, - { WXK_SNAPSHOT, wxTRANSLATE("SNAPSHOT") }, - { WXK_HELP, wxTRANSLATE("HELP") }, - { WXK_ADD, wxTRANSLATE("ADD") }, - { WXK_SEPARATOR, wxTRANSLATE("SEPARATOR") }, - { WXK_SUBTRACT, wxTRANSLATE("SUBTRACT") }, - { WXK_DECIMAL, wxTRANSLATE("DECIMAL") }, - { WXK_DIVIDE, wxTRANSLATE("DIVIDE") }, - { WXK_NUMLOCK, wxTRANSLATE("NUM_LOCK") }, - { WXK_SCROLL, wxTRANSLATE("SCROLL_LOCK") }, - { WXK_PAGEUP, wxTRANSLATE("PAGEUP") }, - { WXK_PAGEDOWN, wxTRANSLATE("PAGEDOWN") }, - { WXK_NUMPAD_SPACE, wxTRANSLATE("KP_SPACE") }, - { WXK_NUMPAD_TAB, wxTRANSLATE("KP_TAB") }, - { WXK_NUMPAD_ENTER, wxTRANSLATE("KP_ENTER") }, - { WXK_NUMPAD_HOME, wxTRANSLATE("KP_HOME") }, - { WXK_NUMPAD_LEFT, wxTRANSLATE("KP_LEFT") }, - { WXK_NUMPAD_UP, wxTRANSLATE("KP_UP") }, - { WXK_NUMPAD_RIGHT, wxTRANSLATE("KP_RIGHT") }, - { WXK_NUMPAD_DOWN, wxTRANSLATE("KP_DOWN") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PRIOR") }, - { WXK_NUMPAD_PAGEUP, wxTRANSLATE("KP_PAGEUP") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_NEXT") }, - { WXK_NUMPAD_PAGEDOWN, wxTRANSLATE("KP_PAGEDOWN") }, - { WXK_NUMPAD_END, wxTRANSLATE("KP_END") }, - { WXK_NUMPAD_BEGIN, wxTRANSLATE("KP_BEGIN") }, - { WXK_NUMPAD_INSERT, wxTRANSLATE("KP_INSERT") }, - { WXK_NUMPAD_DELETE, wxTRANSLATE("KP_DELETE") }, - { WXK_NUMPAD_EQUAL, wxTRANSLATE("KP_EQUAL") }, - { WXK_NUMPAD_MULTIPLY, wxTRANSLATE("KP_MULTIPLY") }, - { WXK_NUMPAD_ADD, wxTRANSLATE("KP_ADD") }, - { WXK_NUMPAD_SEPARATOR, wxTRANSLATE("KP_SEPARATOR") }, - { WXK_NUMPAD_SUBTRACT, wxTRANSLATE("KP_SUBTRACT") }, - { WXK_NUMPAD_DECIMAL, wxTRANSLATE("KP_DECIMAL") }, - { WXK_NUMPAD_DIVIDE, wxTRANSLATE("KP_DIVIDE") }, - { WXK_WINDOWS_LEFT, wxTRANSLATE("WINDOWS_LEFT") }, - { WXK_WINDOWS_RIGHT, wxTRANSLATE("WINDOWS_RIGHT") }, - { WXK_WINDOWS_MENU, wxTRANSLATE("WINDOWS_MENU") }, - { WXK_COMMAND, wxTRANSLATE("COMMAND") }, + { WXK_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Delete") }, + { WXK_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Del") }, + { WXK_BACK, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Back"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Backspace") }, + { WXK_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Insert") }, + { WXK_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Ins") }, + { WXK_RETURN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Enter") }, + { WXK_RETURN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Return") }, + { WXK_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PageUp"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Page Up") }, + { WXK_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PageDown"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Page Down") }, + { WXK_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PgUp") }, + { WXK_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("PgDn") }, + { WXK_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Left"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Left") }, + { WXK_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Right"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Right") }, + { WXK_UP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Up"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Up") }, + { WXK_DOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Down"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Down") }, + { WXK_HOME, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Home") }, + { WXK_END, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("End") }, + { WXK_SPACE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Space") }, + { WXK_TAB, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Tab") }, + { WXK_ESCAPE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Esc") }, + { WXK_ESCAPE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Escape") }, + { WXK_CANCEL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Cancel") }, + { WXK_CLEAR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Clear") }, + { WXK_MENU, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Menu") }, + { WXK_PAUSE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Pause") }, + { WXK_CAPITAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Capital") }, + { WXK_SELECT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Select") }, + { WXK_PRINT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Print") }, + { WXK_EXECUTE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Execute") }, + { WXK_SNAPSHOT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Snapshot") }, + { WXK_HELP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Help") }, + { WXK_ADD, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Add") }, + { WXK_SEPARATOR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Separator") }, + { WXK_SUBTRACT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Subtract") }, + { WXK_DECIMAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Decimal") }, + { WXK_DIVIDE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Divide") }, + { WXK_NUMLOCK, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num_lock"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Lock") }, + { WXK_SCROLL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Scroll_lock"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Scroll Lock") }, + { WXK_NUMPAD_SPACE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Space"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Space") }, + { WXK_NUMPAD_TAB, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Tab"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Tab") }, + { WXK_NUMPAD_ENTER, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Enter"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Enter") }, + { WXK_NUMPAD_HOME, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Home"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Home") }, + { WXK_NUMPAD_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Left"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num left") }, + { WXK_NUMPAD_UP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Up"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Up") }, + { WXK_NUMPAD_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Right"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Right") }, + { WXK_NUMPAD_DOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Down"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Down") }, + { WXK_NUMPAD_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_PageUp"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Page Up") }, + { WXK_NUMPAD_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_PageDown"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Page Down") }, + { WXK_NUMPAD_PAGEUP, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Prior") }, + { WXK_NUMPAD_PAGEDOWN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Next") }, + { WXK_NUMPAD_END, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_End"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num End") }, + { WXK_NUMPAD_BEGIN, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Begin"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Begin") }, + { WXK_NUMPAD_INSERT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Insert"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Insert") }, + { WXK_NUMPAD_DELETE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Delete"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num Delete") }, + { WXK_NUMPAD_EQUAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Equal"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num =") }, + { WXK_NUMPAD_MULTIPLY, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Multiply"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num *") }, + { WXK_NUMPAD_ADD, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Add"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num +") }, + { WXK_NUMPAD_SEPARATOR, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Separator"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num ,") }, + { WXK_NUMPAD_SUBTRACT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Subtract"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num -") }, + { WXK_NUMPAD_DECIMAL, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Decimal"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num .") }, + { WXK_NUMPAD_DIVIDE, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("KP_Divide"), /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Num /") }, + { WXK_WINDOWS_LEFT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Left") }, + { WXK_WINDOWS_RIGHT, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Right") }, + { WXK_WINDOWS_MENU, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Windows_Menu") }, + { WXK_COMMAND, /*TRANSLATORS: Name of keyboard key*/ wxTRANSLATE("Command") }, }; +wxGCC_WARNING_RESTORE(missing-field-initializers) + // return true if the 2 strings refer to the same accel // // as accels can be either translated or not, check for both possibilities and @@ -346,7 +351,7 @@ wxString wxAcceleratorEntry::AsPossiblyLocalizedString(bool localized) const const wxKeyName& kn = wxKeyNames[n]; if ( code == kn.code ) { - text << PossiblyLocalize(kn.name, localized); + text << PossiblyLocalize(kn.display_name ? kn.display_name : kn.name, localized); break; } } diff --git a/3rdparty/wxwidgets3.0/src/common/appbase.cpp b/3rdparty/wxwidgets3.0/src/common/appbase.cpp index 68113d9956..0f647519e4 100644 --- a/3rdparty/wxwidgets3.0/src/common/appbase.cpp +++ b/3rdparty/wxwidgets3.0/src/common/appbase.cpp @@ -315,9 +315,9 @@ wxAppTraits *wxAppConsoleBase::GetTraitsIfExists() wxAppTraits& wxAppConsoleBase::GetValidTraits() { static wxConsoleAppTraits s_traitsConsole; - wxAppTraits* const traits = wxTheApp ? wxTheApp->GetTraits() : NULL; + wxAppTraits* const traits = (wxTheApp ? wxTheApp->GetTraits() : NULL); - return traits ? *traits : s_traitsConsole; + return *(traits ? traits : &s_traitsConsole); } // ---------------------------------------------------------------------------- diff --git a/3rdparty/wxwidgets3.0/src/common/cmdline.cpp b/3rdparty/wxwidgets3.0/src/common/cmdline.cpp index 1362a65773..02727ed1c9 100644 --- a/3rdparty/wxwidgets3.0/src/common/cmdline.cpp +++ b/3rdparty/wxwidgets3.0/src/common/cmdline.cpp @@ -690,9 +690,13 @@ int wxCmdLineParser::Parse(bool showUsage) continue; } #ifdef __WXOSX__ - if ( arg == wxT("-ApplePersistenceIgnoreState") ) + if ( arg == wxS("-ApplePersistenceIgnoreState") || + arg == wxS("-AppleTextDirection") || + arg == wxS("-AppleLocale") || + arg == wxS("-AppleLanguages") ) { maybeOption = false; + n++; continue; } diff --git a/3rdparty/wxwidgets3.0/src/common/cmdproc.cpp b/3rdparty/wxwidgets3.0/src/common/cmdproc.cpp index 4534de633e..413c25b994 100644 --- a/3rdparty/wxwidgets3.0/src/common/cmdproc.cpp +++ b/3rdparty/wxwidgets3.0/src/common/cmdproc.cpp @@ -333,7 +333,10 @@ bool wxCommandProcessor::IsDirty() const { // We have never been saved, so we are dirty if and only if we have any // commands at all. - return m_currentCommand; + // + // NB: The ugly "!!" test is needed to avoid warnings both from MSVC in + // non-STL build and g++ in STL build. + return !!m_currentCommand; } if ( !m_currentCommand ) diff --git a/3rdparty/wxwidgets3.0/src/common/datetimefmt.cpp b/3rdparty/wxwidgets3.0/src/common/datetimefmt.cpp index 5084c282ee..6dc2968dae 100644 --- a/3rdparty/wxwidgets3.0/src/common/datetimefmt.cpp +++ b/3rdparty/wxwidgets3.0/src/common/datetimefmt.cpp @@ -343,9 +343,12 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const wxString format = formatp; #ifdef __WXOSX__ - format.Replace("%c",wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT)); - format.Replace("%x",wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT)); - format.Replace("%X",wxLocale::GetInfo(wxLOCALE_TIME_FMT)); + if ( format.Contains("%c") ) + format.Replace("%c", wxLocale::GetInfo(wxLOCALE_DATE_TIME_FMT)); + if ( format.Contains("%x") ) + format.Replace("%x", wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT)); + if ( format.Contains("%X") ) + format.Replace("%X", wxLocale::GetInfo(wxLOCALE_TIME_FMT)); #endif // we have to use our own implementation if the date is out of range of // strftime() @@ -993,7 +996,14 @@ wxDateTime::ParseRfc822Date(const wxString& date, wxString::const_iterator *end) // the spec was correct, construct the date from the values we found Set(day, mon, year, hour, min, sec); - MakeFromTimezone(TimeZone::Make(offset*SEC_PER_MIN)); + + // As always, dealing with the time zone is the most interesting part: we + // can't just use MakeFromTimeZone() here because it wouldn't handle the + // DST correctly because the TZ specified in the string is DST-invariant + // and so we have to manually shift to the UTC first and then convert to + // the local TZ. + *this -= wxTimeSpan::Minutes(offset); + MakeFromUTC(); if ( end ) *end = p; diff --git a/3rdparty/wxwidgets3.0/src/common/dcgraph.cpp b/3rdparty/wxwidgets3.0/src/common/dcgraph.cpp index d27e9cc02f..6a0d9e0ea9 100644 --- a/3rdparty/wxwidgets3.0/src/common/dcgraph.cpp +++ b/3rdparty/wxwidgets3.0/src/common/dcgraph.cpp @@ -646,13 +646,12 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, m_graphicContext->PushState(); m_graphicContext->Translate(dx, dy); m_graphicContext->Scale(factor, 1.0); - wxGraphicsPath path; + wxGraphicsPath path = m_graphicContext->CreatePath(); // since these angles (ea,sa) are measured counter-clockwise, we invert them to // get clockwise angles if ( m_brush.GetStyle() != wxTRANSPARENT ) { - path = m_graphicContext->CreatePath(); path.MoveToPoint( 0, 0 ); path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); path.AddLineToPoint( 0, 0 ); @@ -664,7 +663,6 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h, } else { - wxGraphicsPath path = m_graphicContext->CreatePath(); path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea ); m_graphicContext->DrawPath( path ); } @@ -878,10 +876,9 @@ void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h) CalcBoundingBox(x, y); CalcBoundingBox(x + w, y + h); - if ( m_graphicContext->ShouldOffset() ) + if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 + // outline is one pixel larger than what raster-based wxDC implementations draw w -= 1; h -= 1; } @@ -907,10 +904,9 @@ void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, CalcBoundingBox(x, y); CalcBoundingBox(x + w, y + h); - if ( m_graphicContext->ShouldOffset() ) + if (m_pen.IsOk() && m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT && m_pen.GetWidth() > 0) { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 + // outline is one pixel larger than what raster-based wxDC implementations draw w -= 1; h -= 1; } @@ -927,13 +923,6 @@ void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h) CalcBoundingBox(x, y); CalcBoundingBox(x + w, y + h); - if ( m_graphicContext->ShouldOffset() ) - { - // if we are offsetting the entire rectangle is moved 0.5, so the - // border line gets off by 1 - w -= 1; - h -= 1; - } m_graphicContext->DrawEllipse(x,y,w,h); } @@ -1213,9 +1202,10 @@ void wxGCDCImpl::Clear(void) wxCompositionMode formerMode = m_graphicContext->GetCompositionMode(); m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE); // maximum positive coordinate Cairo can handle is 2^23 - 1 + // Use a value slightly less than this to be sure we avoid the limit DoDrawRectangle( DeviceToLogicalX(0), DeviceToLogicalY(0), - DeviceToLogicalXRel(0x007fffff), DeviceToLogicalYRel(0x007fffff)); + DeviceToLogicalXRel(0x800000 - 64), DeviceToLogicalYRel(0x800000 - 64)); m_graphicContext->SetCompositionMode(formerMode); m_graphicContext->SetPen( m_pen ); m_graphicContext->SetBrush( m_brush ); diff --git a/3rdparty/wxwidgets3.0/src/common/dobjcmn.cpp b/3rdparty/wxwidgets3.0/src/common/dobjcmn.cpp index 5e4d43dcc0..10ba0a267a 100644 --- a/3rdparty/wxwidgets3.0/src/common/dobjcmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/dobjcmn.cpp @@ -284,12 +284,12 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const } bool wxTextDataObject::SetData(const wxDataFormat& format, - size_t WXUNUSED(len), const void *buf) + size_t len, const void *buf) { if ( buf == NULL ) return false; - wxWCharBuffer buffer = GetConv(format).cMB2WX( (const char*)buf ); + wxWCharBuffer buffer = GetConv(format).cMB2WC((const char*)buf, len, NULL); SetText( buffer ); diff --git a/3rdparty/wxwidgets3.0/src/common/docview.cpp b/3rdparty/wxwidgets3.0/src/common/docview.cpp index 8ce279593f..bdabfac7c5 100644 --- a/3rdparty/wxwidgets3.0/src/common/docview.cpp +++ b/3rdparty/wxwidgets3.0/src/common/docview.cpp @@ -532,7 +532,8 @@ bool wxDocument::OnSaveModified() GetUserReadableName() ), wxTheApp->GetAppDisplayName(), - wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE + wxYES_NO | wxCANCEL | wxICON_QUESTION | wxCENTRE, + GetDocumentWindow() ) ) { case wxNO: @@ -1147,17 +1148,21 @@ void wxDocManager::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) void wxDocManager::OnMRUFile(wxCommandEvent& event) { - // Check if the id is in the range assigned to MRU list entries. - const int id = event.GetId(); - if ( id >= wxID_FILE1 && - id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + if ( m_fileHistory ) { - DoOpenMRUFile(id - wxID_FILE1); - } - else - { - event.Skip(); + // Check if the id is in the range assigned to MRU list entries. + const int id = event.GetId(); + if ( id >= wxID_FILE1 && + id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + { + DoOpenMRUFile(id - wxID_FILE1); + + // Don't skip the event below. + return; + } } + + event.Skip(); } void wxDocManager::DoOpenMRUFile(unsigned n) diff --git a/3rdparty/wxwidgets3.0/src/common/event.cpp b/3rdparty/wxwidgets3.0/src/common/event.cpp index d92a4acf0e..b81c173122 100644 --- a/3rdparty/wxwidgets3.0/src/common/event.cpp +++ b/3rdparty/wxwidgets3.0/src/common/event.cpp @@ -179,8 +179,6 @@ wxDEFINE_EVENT( wxEVT_VLBOX, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_COMBOBOX, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_RCLICKED, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_ENTER, wxCommandEvent ); -wxDEFINE_EVENT( wxEVT_SPINCTRL, wxCommandEvent ); -wxDEFINE_EVENT( wxEVT_SPINCTRLDOUBLE, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_TOOL_DROPDOWN, wxCommandEvent ); wxDEFINE_EVENT( wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent); wxDEFINE_EVENT( wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent); diff --git a/3rdparty/wxwidgets3.0/src/common/fileconf.cpp b/3rdparty/wxwidgets3.0/src/common/fileconf.cpp index e626c3c0cc..4e77aa983d 100644 --- a/3rdparty/wxwidgets3.0/src/common/fileconf.cpp +++ b/3rdparty/wxwidgets3.0/src/common/fileconf.cpp @@ -571,7 +571,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) } if ( *pEnd != wxT(']') ) { - wxLogError(_("file '%s': unexpected character %c at line %d."), + wxLogError(_("file '%s': unexpected character %c at line %zu."), buffer.GetName(), *pEnd, n + 1); continue; // skip this line } @@ -607,7 +607,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) break; default: - wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."), + wxLogWarning(_("file '%s', line %zu: '%s' ignored after group header."), buffer.GetName(), n + 1, pEnd); bCont = false; } @@ -636,7 +636,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) pEnd++; if ( *pEnd++ != wxT('=') ) { - wxLogError(_("file '%s', line %d: '=' expected."), + wxLogError(_("file '%s', line %zu: '=' expected."), buffer.GetName(), n + 1); } else { @@ -649,7 +649,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) else { if ( bLocal && pEntry->IsImmutable() ) { // immutable keys can't be changed by user - wxLogWarning(_("file '%s', line %d: value for immutable key '%s' ignored."), + wxLogWarning(_("file '%s', line %zu: value for immutable key '%s' ignored."), buffer.GetName(), n + 1, strKey.c_str()); continue; } @@ -659,8 +659,8 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal) // (c) key from global file now found in local one // which is exactly what we want. else if ( !bLocal || pEntry->IsLocal() ) { - wxLogWarning(_("file '%s', line %d: key '%s' was first found at line %d."), - buffer.GetName(), (int)n + 1, strKey.c_str(), pEntry->Line()); + wxLogWarning(_("file '%s', line %zu: key '%s' was first found at line %d."), + buffer.GetName(), n + 1, strKey.c_str(), pEntry->Line()); } } diff --git a/3rdparty/wxwidgets3.0/src/common/filefn.cpp b/3rdparty/wxwidgets3.0/src/common/filefn.cpp index bfa1efa172..f6e368ee32 100644 --- a/3rdparty/wxwidgets3.0/src/common/filefn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/filefn.cpp @@ -90,6 +90,8 @@ #define HAVE_WGETCWD #endif +wxDECL_FOR_STRICT_MINGW32(int, _fileno, (FILE*)) + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -1090,7 +1092,11 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) return false; } - wxDoCopyFile(fileIn, fbuf, file2, overwrite); + if ( !wxDoCopyFile(fileIn, fbuf, file2, overwrite) ) + { + wxLogError(_("Error copying the file '%s' to '%s'."), file1, file2); + return false; + } #if defined(__WXMAC__) || defined(__WXCOCOA__) // copy the resource fork of the file too if it's present diff --git a/3rdparty/wxwidgets3.0/src/common/filehistorycmn.cpp b/3rdparty/wxwidgets3.0/src/common/filehistorycmn.cpp index c27ed12c0f..f349f44065 100644 --- a/3rdparty/wxwidgets3.0/src/common/filehistorycmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/filehistorycmn.cpp @@ -50,6 +50,14 @@ wxString GetMRUEntryLabel(int n, const wxString& path) wxString pathInMenu(path); pathInMenu.Replace("&", "&&"); +#ifdef __WXMSW__ + // absolute paths always start with Latin characters even in RTL + // environments and should therefore be rendered as LTR text (possibly with + // RTL chunks in it). Ensure this on Windows by prepending + // LEFT-TO-RIGHT EMBEDDING (other platforms detect this automatically) + pathInMenu.insert(0, wchar_t(0x202a)); +#endif + return wxString::Format("&%d %s", n + 1, pathInMenu); } diff --git a/3rdparty/wxwidgets3.0/src/common/filename.cpp b/3rdparty/wxwidgets3.0/src/common/filename.cpp index fcbc0e7206..8dc47fdb44 100644 --- a/3rdparty/wxwidgets3.0/src/common/filename.cpp +++ b/3rdparty/wxwidgets3.0/src/common/filename.cpp @@ -100,7 +100,7 @@ #ifdef __WINDOWS__ #include "wx/msw/private.h" - #include // for CLSID_ShellLink + #include "wx/msw/wrapshl.h" // for CLSID_ShellLink #include "wx/msw/missing.h" #include "wx/msw/ole/oleutils.h" #endif @@ -1832,15 +1832,27 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) m_dirs.Insert(wxT(".."), 0u); } - if ( format == wxPATH_UNIX || format == wxPATH_DOS ) + switch ( GetFormat(format) ) { - // a directory made relative with respect to itself is '.' under Unix - // and DOS, by definition (but we don't have to insert "./" for the - // files) - if ( m_dirs.IsEmpty() && IsDir() ) - { - m_dirs.Add(wxT('.')); - } + case wxPATH_NATIVE: + case wxPATH_MAX: + wxFAIL_MSG( wxS("unreachable") ); + // fall through + + case wxPATH_UNIX: + case wxPATH_DOS: + // a directory made relative with respect to itself is '.' under + // Unix and DOS, by definition (but we don't have to insert "./" + // for the files) + if ( m_dirs.IsEmpty() && IsDir() ) + { + m_dirs.Add(wxT('.')); + } + break; + + case wxPATH_MAC: + case wxPATH_VMS: + break; } m_relative = true; @@ -2595,7 +2607,7 @@ bool wxFileName::SetPermissions(int permissions) { // Don't do anything for a symlink but first make sure it is one. if ( m_dontFollowLinks && - Exists(wxFILE_EXISTS_SYMLINK|wxFILE_EXISTS_NO_FOLLOW) ) + Exists(GetFullPath(), wxFILE_EXISTS_SYMLINK|wxFILE_EXISTS_NO_FOLLOW) ) { // Looks like changing permissions for a symlinc is only supported // on BSD where lchmod is present and correctly implemented. diff --git a/3rdparty/wxwidgets3.0/src/common/fontenumcmn.cpp b/3rdparty/wxwidgets3.0/src/common/fontenumcmn.cpp index 1185a864ab..f0d6f68d7e 100644 --- a/3rdparty/wxwidgets3.0/src/common/fontenumcmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/fontenumcmn.cpp @@ -124,7 +124,8 @@ bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename) for ( size_t n = 0; n < count; n++ ) { - OnFontEncoding(facenames[n], utf8); + if ( !OnFontEncoding(facenames[n], utf8) ) + break; } return true; diff --git a/3rdparty/wxwidgets3.0/src/common/fswatchercmn.cpp b/3rdparty/wxwidgets3.0/src/common/fswatchercmn.cpp index b946f6402c..7d455f207c 100644 --- a/3rdparty/wxwidgets3.0/src/common/fswatchercmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/fswatchercmn.cpp @@ -143,8 +143,8 @@ wxFileSystemWatcherBase::AddAny(const wxFileName& path, } else { - wxFSWatchInfo& watch = it->second; - const int count = watch.IncRef(); + wxFSWatchInfo& watch2 = it->second; + const int count = watch2.IncRef(); wxLogTrace(wxTRACE_FSWATCHER, "'%s' is now watched %d times", canonical, count); diff --git a/3rdparty/wxwidgets3.0/src/common/ftp.cpp b/3rdparty/wxwidgets3.0/src/common/ftp.cpp index cfb59e63d4..59791a3452 100644 --- a/3rdparty/wxwidgets3.0/src/common/ftp.cpp +++ b/3rdparty/wxwidgets3.0/src/common/ftp.cpp @@ -79,8 +79,6 @@ wxFTP::wxFTP() m_username = wxT("anonymous"); m_password << wxGetUserId() << wxT('@') << wxGetFullHostName(); - SetNotify(0); - SetFlags(wxSOCKET_NOWAIT); m_bPassive = true; m_bEncounteredError = false; } @@ -461,20 +459,21 @@ wxString wxFTP::Pwd() { // the result is at least that long if CheckCommand() succeeded wxString::const_iterator p = m_lastResult.begin() + LEN_CODE + 1; - if ( *p != wxT('"') ) + const wxString::const_iterator end = m_lastResult.end(); + if ( p == end || *p != wxT('"') ) { wxLogDebug(wxT("Missing starting quote in reply for PWD: %s"), - wxString(p, m_lastResult.end())); + wxString(p, end)); } else { - for ( ++p; (bool)*p; ++p ) // FIXME-DMARS + for ( ++p; p != end; ++p ) { if ( *p == wxT('"') ) { // check if the quote is doubled ++p; - if ( !*p || *p != wxT('"') ) + if ( p == end || *p != wxT('"') ) { // no, this is the end break; @@ -486,7 +485,7 @@ wxString wxFTP::Pwd() path += *p; } - if ( !*p ) + if ( p != end ) { wxLogDebug(wxT("Missing ending quote in reply for PWD: %s"), m_lastResult.c_str() + LEN_CODE + 1); @@ -782,8 +781,6 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path) return NULL; } - sock->SetFlags(wxSOCKET_WAITALL); - m_streaming = true; wxInputFTPStream *in_stream = new wxInputFTPStream(this, sock); diff --git a/3rdparty/wxwidgets3.0/src/common/http.cpp b/3rdparty/wxwidgets3.0/src/common/http.cpp index 0ecde88c77..cd58f0d9d4 100644 --- a/3rdparty/wxwidgets3.0/src/common/http.cpp +++ b/3rdparty/wxwidgets3.0/src/common/http.cpp @@ -22,7 +22,6 @@ #ifndef WX_PRECOMP #include "wx/string.h" - #include "wx/app.h" #endif #include "wx/tokenzr.h" @@ -48,8 +47,6 @@ wxHTTP::wxHTTP() m_read = false; m_proxy_mode = false; m_http_response = 0; - - SetNotify(wxSOCKET_LOST_FLAG); } wxHTTP::~wxHTTP() @@ -370,16 +367,6 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) SetHeader(wxT("Authorization"), GenerateAuthString(m_username, m_password)); } - SaveState(); - - // we may use non blocking sockets only if we can dispatch events from them - int flags = wxIsMainThread() && wxApp::IsMainLoopRunning() ? wxSOCKET_NONE - : wxSOCKET_BLOCK; - // and we must use wxSOCKET_WAITALL to ensure that all data is sent - flags |= wxSOCKET_WAITALL; - SetFlags(flags); - Notify(false); - wxString buf; buf.Printf(wxT("%s %s HTTP/1.0\r\n"), method, path); const wxWX2MBbuf pathbuf = buf.mb_str(); @@ -395,10 +382,8 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) wxString tmp_str; m_lastError = ReadLine(this, tmp_str); - if (m_lastError != wxPROTO_NOERR) { - RestoreState(); + if (m_lastError != wxPROTO_NOERR) return false; - } if (!tmp_str.Contains(wxT("HTTP/"))) { // TODO: support HTTP v0.9 which can have no header. @@ -441,7 +426,7 @@ bool wxHTTP::BuildRequest(const wxString& path, const wxString& method) m_lastError = wxPROTO_NOERR; ret_value = ParseHeaders(); - RestoreState(); + return ret_value; } @@ -540,9 +525,6 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path) inp_stream->m_read_bytes = 0; - Notify(false); - SetFlags(wxSOCKET_BLOCK | wxSOCKET_WAITALL); - // no error; reset m_lastError m_lastError = wxPROTO_NOERR; return inp_stream; diff --git a/3rdparty/wxwidgets3.0/src/common/image.cpp b/3rdparty/wxwidgets3.0/src/common/image.cpp index b800e58ad8..2120296c56 100644 --- a/3rdparty/wxwidgets3.0/src/common/image.cpp +++ b/3rdparty/wxwidgets3.0/src/common/image.cpp @@ -2040,6 +2040,8 @@ void wxImage::ClearAlpha() { wxCHECK_RET( HasAlpha(), wxT("image already doesn't have an alpha channel") ); + AllocExclusive(); + if ( !M_IMGDATA->m_staticAlpha ) free( M_IMGDATA->m_alpha ); diff --git a/3rdparty/wxwidgets3.0/src/common/init.cpp b/3rdparty/wxwidgets3.0/src/common/init.cpp index e00daeb701..72d6de823b 100644 --- a/3rdparty/wxwidgets3.0/src/common/init.cpp +++ b/3rdparty/wxwidgets3.0/src/common/init.cpp @@ -137,8 +137,8 @@ static struct InitData nInitCount = 0; #if wxUSE_UNICODE - argc = 0; - // argv = NULL; -- not even really needed + argc = argcOrig = 0; + // argv = argvOrig = NULL; -- not even really needed #endif // wxUSE_UNICODE } @@ -157,6 +157,12 @@ static struct InitData // for example), we remember the converted argv here because we'll have to // free it when doing cleanup to avoid memory leaks wchar_t **argv; + + // we also need to keep two copies, one passed to other functions, and one + // unmodified original; somebody may modify the former, so we need to have + // the latter to be able to free everything correctly + int argcOrig; + wchar_t **argvOrig; #endif // wxUSE_UNICODE wxDECLARE_NO_COPY_CLASS(InitData); @@ -174,7 +180,9 @@ static struct InitData static void ConvertArgsToUnicode(int argc, char **argv) { + gs_initData.argvOrig = new wchar_t *[argc + 1]; gs_initData.argv = new wchar_t *[argc + 1]; + int wargc = 0; for ( int i = 0; i < argc; i++ ) { @@ -190,25 +198,28 @@ static void ConvertArgsToUnicode(int argc, char **argv) } else // converted ok { - gs_initData.argv[wargc++] = wxStrdup(buf); + gs_initData.argvOrig[wargc] = gs_initData.argv[wargc] = wxStrdup(buf); + wargc++; } } - gs_initData.argc = wargc; - gs_initData.argv[wargc] = NULL; + gs_initData.argcOrig = gs_initData.argc = wargc; + gs_initData.argvOrig[wargc] =gs_initData.argv[wargc] = NULL; } static void FreeConvertedArgs() { - if ( gs_initData.argv ) + if ( gs_initData.argvOrig ) { - for ( int i = 0; i < gs_initData.argc; i++ ) + for ( int i = 0; i < gs_initData.argcOrig; i++ ) { - free(gs_initData.argv[i]); + free(gs_initData.argvOrig[i]); + // gs_initData.argv[i] normally points to the same data } + wxDELETEA(gs_initData.argvOrig); wxDELETEA(gs_initData.argv); - gs_initData.argc = 0; + gs_initData.argcOrig = gs_initData.argc = 0; } } diff --git a/3rdparty/wxwidgets3.0/src/common/intl.cpp b/3rdparty/wxwidgets3.0/src/common/intl.cpp index f8b011a917..8a77c3d522 100644 --- a/3rdparty/wxwidgets3.0/src/common/intl.cpp +++ b/3rdparty/wxwidgets3.0/src/common/intl.cpp @@ -55,6 +55,7 @@ #endif #ifdef __WIN32__ + #include "wx/dynlib.h" #include "wx/msw/private.h" #endif @@ -480,6 +481,18 @@ bool wxLocale::Init(int language, int flags) // change locale used by Windows functions ::SetThreadLocale(lcid); + + // SetThreadUILanguage() may be available on XP, but with unclear + // behavior, so avoid calling it there. + if ( wxGetWinVersion() >= wxWinVersion_Vista ) + { + wxLoadedDLL dllKernel32(wxS("kernel32.dll")); + typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID); + SetThreadUILanguage_t pfnSetThreadUILanguage = NULL; + wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32); + if (pfnSetThreadUILanguage) + pfnSetThreadUILanguage(LANGIDFROMLCID(lcid)); + } #endif // and also call setlocale() to change locale used by the CRT @@ -541,6 +554,11 @@ bool wxLocale::Init(int language, int flags) { wxLogWarning(_("Cannot set locale to language \"%s\"."), name.c_str()); + // As we failed to change locale, there is no need to restore the + // previous one: it's still valid. + free(const_cast(m_pszOldLocale)); + m_pszOldLocale = NULL; + // continue nevertheless and try to load at least the translations for // this language } @@ -611,11 +629,6 @@ inline bool wxGetNonEmptyEnvVar(const wxString& name, wxString* value) return wxLANGUAGE_ENGLISH_US; } - if ( langFull == wxS("C") || langFull == wxS("POSIX") ) - { - // default C locale is English too - return wxLANGUAGE_ENGLISH_US; - } #endif // the language string has the following form @@ -651,6 +664,12 @@ inline bool wxGetNonEmptyEnvVar(const wxString& name, wxString* value) langFull.Truncate(posEndLang); } + if ( langFull == wxS("C") || langFull == wxS("POSIX") ) + { + // default C locale is English too + return wxLANGUAGE_ENGLISH_US; + } + // do we have just the language (or sublang too)? const bool justLang = langFull.find('_') == wxString::npos; @@ -1035,8 +1054,11 @@ wxLocale::~wxLocale() // restore old locale pointer wxSetLocale(m_pOldLocale); - wxSetlocale(LC_ALL, m_pszOldLocale); - free(const_cast(m_pszOldLocale)); + if ( m_pszOldLocale ) + { + wxSetlocale(LC_ALL, m_pszOldLocale); + free(const_cast(m_pszOldLocale)); + } } @@ -1251,6 +1273,8 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) fmtWX += "%A"; break; case 5: // EEEEE + case 6: // EEEEEE + // no "narrow form" in strftime(), use abbrev. fmtWX += "%a"; break; @@ -1276,6 +1300,11 @@ static wxString TranslateFromUnicodeFormat(const wxString& fmt) fmtWX += "%B"; break; + case 5: + // no "narrow form" in strftime(), use abbrev. + fmtWX += "%b"; + break; + default: wxFAIL_MSG( "too many 'M's" ); } diff --git a/3rdparty/wxwidgets3.0/src/common/languageinfo.cpp b/3rdparty/wxwidgets3.0/src/common/languageinfo.cpp index db69b404fd..1de9d2a5c9 100644 --- a/3rdparty/wxwidgets3.0/src/common/languageinfo.cpp +++ b/3rdparty/wxwidgets3.0/src/common/languageinfo.cpp @@ -118,6 +118,9 @@ #ifndef LANG_FRENCH #define LANG_FRENCH (0) #endif +#ifndef LANG_FRISIAN +#define LANG_FRISIAN (0) +#endif #ifndef LANG_GEORGIAN #define LANG_GEORGIAN (0) #endif @@ -638,7 +641,7 @@ void wxLocale::InitLanguagesDB() LNG(wxLANGUAGE_FRENCH_LUXEMBOURG, "fr_LU", LANG_FRENCH , SUBLANG_FRENCH_LUXEMBOURG , wxLayout_LeftToRight, "French (Luxembourg)") LNG(wxLANGUAGE_FRENCH_MONACO, "fr_MC", LANG_FRENCH , SUBLANG_FRENCH_MONACO , wxLayout_LeftToRight, "French (Monaco)") LNG(wxLANGUAGE_FRENCH_SWISS, "fr_CH", LANG_FRENCH , SUBLANG_FRENCH_SWISS , wxLayout_LeftToRight, "French (Swiss)") - LNG(wxLANGUAGE_FRISIAN, "fy" , 0 , 0 , wxLayout_LeftToRight, "Frisian") + LNG(wxLANGUAGE_FRISIAN, "fy" , LANG_FRISIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Frisian") LNG(wxLANGUAGE_GALICIAN, "gl_ES", 0 , 0 , wxLayout_LeftToRight, "Galician") LNG(wxLANGUAGE_GEORGIAN, "ka_GE", LANG_GEORGIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Georgian") LNG(wxLANGUAGE_GERMAN, "de_DE", LANG_GERMAN , SUBLANG_GERMAN , wxLayout_LeftToRight, "German") diff --git a/3rdparty/wxwidgets3.0/src/common/log.cpp b/3rdparty/wxwidgets3.0/src/common/log.cpp index 3180f46743..9d32a5e6a2 100644 --- a/3rdparty/wxwidgets3.0/src/common/log.cpp +++ b/3rdparty/wxwidgets3.0/src/common/log.cpp @@ -278,13 +278,13 @@ unsigned wxLog::LogLastRepeatIfNeeded() // Notice that we still use wxPLURAL() to ensure that multiple // numbers of times are correctly formatted, even though we never // actually use the singular string. - msg.Printf(wxPLURAL("The previous message repeated %lu time.", - "The previous message repeated %lu times.", + msg.Printf(wxPLURAL("The previous message repeated %u time.", + "The previous message repeated %u times.", gs_prevLog.numRepeated), gs_prevLog.numRepeated); } #else - msg.Printf(wxS("The previous message was repeated %lu time(s)."), + msg.Printf(wxS("The previous message was repeated %u time(s)."), gs_prevLog.numRepeated); #endif gs_prevLog.numRepeated = 0; @@ -306,12 +306,12 @@ wxLog::~wxLog() #if wxUSE_INTL wxPLURAL ( - "Last repeated message (\"%s\", %lu time) wasn't output", - "Last repeated message (\"%s\", %lu times) wasn't output", + "Last repeated message (\"%s\", %u time) wasn't output", + "Last repeated message (\"%s\", %u times) wasn't output", gs_prevLog.numRepeated ), #else - wxS("Last repeated message (\"%s\", %lu time(s)) wasn't output"), + wxS("Last repeated message (\"%s\", %u time(s)) wasn't output"), #endif gs_prevLog.msg, gs_prevLog.numRepeated diff --git a/3rdparty/wxwidgets3.0/src/common/numformatter.cpp b/3rdparty/wxwidgets3.0/src/common/numformatter.cpp index 12de60e842..369ec15b5c 100644 --- a/3rdparty/wxwidgets3.0/src/common/numformatter.cpp +++ b/3rdparty/wxwidgets3.0/src/common/numformatter.cpp @@ -122,20 +122,16 @@ wxChar wxNumberFormatter::GetDecimalSeparator() { const wxString s = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER); - if ( s.empty() ) + if ( s.length() == 1 ) + { + s_decimalSeparator = s[0]; + } + else { // We really must have something for decimal separator, so fall // back to the C locale default. s_decimalSeparator = '.'; } - else - { - // To the best of my knowledge there are no locales like this. - wxASSERT_MSG( s.length() == 1, - "Multi-character decimal separator?" ); - - s_decimalSeparator = s[0]; - } } return s_decimalSeparator; @@ -154,11 +150,8 @@ bool wxNumberFormatter::GetThousandsSeparatorIfUsed(wxChar *sep) { const wxString s = wxLocale::GetInfo(wxLOCALE_THOUSANDS_SEP, wxLOCALE_CAT_NUMBER); - if ( !s.empty() ) + if ( s.length() == 1 ) { - wxASSERT_MSG( s.length() == 1, - "Multi-character thousands separator?" ); - s_thousandsSeparator = s[0]; } //else: Unlike above it's perfectly fine for the thousands separator to @@ -223,6 +216,10 @@ wxString wxNumberFormatter::ToString(double val, int precision, int style) void wxNumberFormatter::AddThousandsSeparators(wxString& s) { + // Thousands separators for numbers in scientific format are not relevant. + if ( s.find_first_of("eE") != wxString::npos ) + return; + wxChar thousandsSep; if ( !GetThousandsSeparatorIfUsed(&thousandsSep) ) return; @@ -254,9 +251,14 @@ void wxNumberFormatter::AddThousandsSeparators(wxString& s) void wxNumberFormatter::RemoveTrailingZeroes(wxString& s) { + // If number is in scientific format, trailing zeroes belong to the exponent and cannot be removed. + if ( s.find_first_of("eE") != wxString::npos ) + return; + const size_t posDecSep = s.find(GetDecimalSeparator()); - wxCHECK_RET( posDecSep != wxString::npos, - wxString::Format("No decimal separator in \"%s\"", s) ); + // No decimal point => removing trailing zeroes irrelevant for integer number. + if ( posDecSep == wxString::npos ) + return; wxCHECK_RET( posDecSep, "Can't start with decimal separator" ); // Find the last character to keep. @@ -267,6 +269,9 @@ void wxNumberFormatter::RemoveTrailingZeroes(wxString& s) posLastNonZero--; s.erase(posLastNonZero + 1); + // Remove sign from orphaned zero. + if ( s.compare("-0") == 0 ) + s = "0"; } // ---------------------------------------------------------------------------- diff --git a/3rdparty/wxwidgets3.0/src/common/prntbase.cpp b/3rdparty/wxwidgets3.0/src/common/prntbase.cpp index ed0d4712f0..553004f7fa 100644 --- a/3rdparty/wxwidgets3.0/src/common/prntbase.cpp +++ b/3rdparty/wxwidgets3.0/src/common/prntbase.cpp @@ -72,6 +72,11 @@ #endif #endif // __WXMSW__ +// The value traditionally used as the default max page number and meaning +// "infinitely many". It should probably be documented and exposed, but for now +// at least use it here instead of hardcoding the number. +static const int DEFAULT_MAX_PAGES = 32000; + //---------------------------------------------------------------------------- // wxPrintFactory //---------------------------------------------------------------------------- @@ -541,7 +546,17 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages, int currentCopy, int totalCopies) { wxString text; - text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + if ( totalPages == DEFAULT_MAX_PAGES ) + { + // This means that the user has not supplied a total number of pages so it + // is better not to show this value. + text.Printf(_("Printing page %d"), currentPage); + } + else + { + // We have a valid total number of pages so we show it. + text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + } if ( totalCopies > 1 ) text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies); m_progress->SetLabel(text); @@ -607,7 +622,7 @@ bool wxPrintout::HasPage(int page) void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage) { *minPage = 1; - *maxPage = 32000; + *maxPage = DEFAULT_MAX_PAGES; *fromPage = 1; *toPage = 1; } diff --git a/3rdparty/wxwidgets3.0/src/common/protocol.cpp b/3rdparty/wxwidgets3.0/src/common/protocol.cpp index 74662adb8a..0560cf9088 100644 --- a/3rdparty/wxwidgets3.0/src/common/protocol.cpp +++ b/3rdparty/wxwidgets3.0/src/common/protocol.cpp @@ -21,6 +21,7 @@ #include "wx/protocol/log.h" #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/module.h" #endif @@ -63,7 +64,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxProtocol, wxObject) wxProtocol::wxProtocol() #if wxUSE_SOCKETS - : wxSocketClient() + // Only use non blocking sockets if we can dispatch events. + : wxSocketClient((wxIsMainThread() && wxApp::IsMainLoopRunning() + ? wxSOCKET_NONE + : wxSOCKET_BLOCK) | wxSOCKET_WAITALL) #endif { m_lastError = wxPROTO_NOERR; diff --git a/3rdparty/wxwidgets3.0/src/common/sckaddr.cpp b/3rdparty/wxwidgets3.0/src/common/sckaddr.cpp index f2adc5634e..a7edf6bd1e 100644 --- a/3rdparty/wxwidgets3.0/src/common/sckaddr.cpp +++ b/3rdparty/wxwidgets3.0/src/common/sckaddr.cpp @@ -136,7 +136,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) } }; #else - typedef char wxGethostBuf[1024]; + typedef char wxGethostBuf[4096]; #endif #ifdef HAVE_FUNC_GETSERVBYNAME_R_4 @@ -148,7 +148,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) } }; #else - typedef char wxGetservBuf[1024]; + typedef char wxGetservBuf[4096]; #endif #if defined(wxHAS_MT_SAFE_GETBY_FUNCS) || !wxUSE_THREADS diff --git a/3rdparty/wxwidgets3.0/src/common/strconv.cpp b/3rdparty/wxwidgets3.0/src/common/strconv.cpp index b2eaa71576..67bbbe6a59 100644 --- a/3rdparty/wxwidgets3.0/src/common/strconv.cpp +++ b/3rdparty/wxwidgets3.0/src/common/strconv.cpp @@ -232,12 +232,6 @@ wxMBConv::ToWChar(wchar_t *dst, size_t dstLen, if ( !srcEnd ) dstWritten++; - if ( !lenChunk ) - { - // nothing left in the input string, conversion succeeded - break; - } - if ( dst ) { if ( dstWritten > dstLen ) @@ -1057,16 +1051,8 @@ wxMBConvStrictUTF8::ToWChar(wchar_t *dst, size_t dstLen, // length: static const unsigned char leadValueMask[] = { 0x7F, 0x1F, 0x0F, 0x07 }; - // mask and value of lead byte's most significant bits, by length: - static const unsigned char leadMarkerMask[] = { 0x80, 0xE0, 0xF0, 0xF8 }; - static const unsigned char leadMarkerVal[] = { 0x00, 0xC0, 0xE0, 0xF0 }; - len--; // it's more convenient to work with 0-based length here - // extract the lead byte's value bits: - if ( (c & leadMarkerMask[len]) != leadMarkerVal[len] ) - break; - code = c & leadValueMask[len]; // all remaining bytes, if any, are handled in the same way @@ -1716,8 +1702,18 @@ wxMBConvUTF16swap::ToWChar(wchar_t *dst, size_t dstLen, wxUint16 tmp[2]; tmp[0] = wxUINT16_SWAP_ALWAYS(*inBuff); - inBuff++; - tmp[1] = wxUINT16_SWAP_ALWAYS(*inBuff); + if ( ++inBuff < inEnd ) + { + // Normal case, we have a next character to decode. + tmp[1] = wxUINT16_SWAP_ALWAYS(*inBuff); + } + else // End of input. + { + // Setting the second character to 0 ensures we correctly return + // wxCONV_FAILED if the first one is the first half of a surrogate + // as the second half can't be 0 in this case. + tmp[1] = 0; + } const size_t numChars = decode_utf16(tmp, ch); if ( numChars == wxCONV_FAILED ) diff --git a/3rdparty/wxwidgets3.0/src/common/tbarbase.cpp b/3rdparty/wxwidgets3.0/src/common/tbarbase.cpp index e36d96eccf..9851b0d8f6 100644 --- a/3rdparty/wxwidgets3.0/src/common/tbarbase.cpp +++ b/3rdparty/wxwidgets3.0/src/common/tbarbase.cpp @@ -447,7 +447,7 @@ void wxToolBarBase::AdjustToolBitmapSize() { const wxBitmap& bmp = (*i)->GetNormalBitmap(); if ( bmp.IsOk() ) - sizeActual.IncTo(bmp.GetSize()); + sizeActual.IncTo(bmp.GetScaledSize()); } if ( sizeActual != sizeOrig ) diff --git a/3rdparty/wxwidgets3.0/src/common/time.cpp b/3rdparty/wxwidgets3.0/src/common/time.cpp index 011b601490..0b6bd35e10 100644 --- a/3rdparty/wxwidgets3.0/src/common/time.cpp +++ b/3rdparty/wxwidgets3.0/src/common/time.cpp @@ -22,6 +22,23 @@ #pragma hdrstop #endif +// This is a horrible hack which only works because we don't currently include +// from wx/wxprec.h. It is needed because we need timezone-related +// stuff from MinGW time.h, but it is not compiled in strict ANSI mode and it +// is too complicated to be dealt with using wxDECL_FOR_STRICT_MINGW32(). So we +// just include the header after undefining __STRICT_ANSI__ to get all the +// declarations we need -- and then define it back to avoid inconsistencies in +// all our other headers. +// +// Note that the same hack is used for "environ" in utilscmn.cpp, so if the +// code here is modified because this hack becomes unnecessary or a better +// solution is found, the code there should be updated as well. +#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + #undef __STRICT_ANSI__ + #include + #define __STRICT_ANSI__ +#endif + #include "wx/time.h" #ifndef WX_PRECOMP diff --git a/3rdparty/wxwidgets3.0/src/common/translation.cpp b/3rdparty/wxwidgets3.0/src/common/translation.cpp index b5b33de9f1..3e221e9972 100644 --- a/3rdparty/wxwidgets3.0/src/common/translation.cpp +++ b/3rdparty/wxwidgets3.0/src/common/translation.cpp @@ -1719,7 +1719,7 @@ wxString wxTranslations::GetHeaderValue(const wxString& header, if ( !trans || trans->empty() ) return wxEmptyString; - size_t found = trans->find(header); + size_t found = trans->find(header + wxS(": ")); if ( found == wxString::npos ) return wxEmptyString; diff --git a/3rdparty/wxwidgets3.0/src/common/utilscmn.cpp b/3rdparty/wxwidgets3.0/src/common/utilscmn.cpp index 6c7d0c351a..a83ab45bf7 100644 --- a/3rdparty/wxwidgets3.0/src/common/utilscmn.cpp +++ b/3rdparty/wxwidgets3.0/src/common/utilscmn.cpp @@ -23,6 +23,14 @@ #pragma hdrstop #endif +// See comment about this hack in time.cpp: here we do it for environ external +// variable which can't be easily declared when using MinGW in strict ANSI mode. +#ifdef wxNEEDS_STRICT_ANSI_WORKAROUNDS + #undef __STRICT_ANSI__ + #include + #define __STRICT_ANSI__ +#endif + #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/string.h" diff --git a/3rdparty/wxwidgets3.0/src/common/wxcrt.cpp b/3rdparty/wxwidgets3.0/src/common/wxcrt.cpp index 29ecbaa552..b58b72830d 100644 --- a/3rdparty/wxwidgets3.0/src/common/wxcrt.cpp +++ b/3rdparty/wxwidgets3.0/src/common/wxcrt.cpp @@ -73,6 +73,10 @@ #include #endif +wxDECL_FOR_STRICT_MINGW32(int, vswprintf, (wchar_t*, const wchar_t*, __VALIST)); +wxDECL_FOR_STRICT_MINGW32(int, _putws, (const wchar_t*)); +wxDECL_FOR_STRICT_MINGW32(void, _wperror, (const wchar_t*)); + WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n) { // assume that we have mbsrtowcs() too if we have wcsrtombs() diff --git a/3rdparty/wxwidgets3.0/src/generic/calctrlg.cpp b/3rdparty/wxwidgets3.0/src/generic/calctrlg.cpp index 40a549fbf4..45202bf416 100644 --- a/3rdparty/wxwidgets3.0/src/generic/calctrlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/calctrlg.cpp @@ -59,6 +59,7 @@ BEGIN_EVENT_TABLE(wxGenericCalendarCtrl, wxControl) EVT_LEFT_DOWN(wxGenericCalendarCtrl::OnClick) EVT_LEFT_DCLICK(wxGenericCalendarCtrl::OnDClick) + EVT_MOUSEWHEEL(wxGenericCalendarCtrl::OnWheel) EVT_SYS_COLOUR_CHANGED(wxGenericCalendarCtrl::OnSysColourChanged) END_EVENT_TABLE() @@ -1512,6 +1513,31 @@ wxCalendarHitTestResult wxGenericCalendarCtrl::HitTest(const wxPoint& pos, } } +void wxGenericCalendarCtrl::OnWheel(wxMouseEvent& event) +{ + wxDateSpan span; + switch ( event.GetWheelAxis() ) + { + case wxMOUSE_WHEEL_VERTICAL: + // For consistency with the native controls, scrolling upwards + // should go to the past, even if the rotation is positive and + // could be normally expected to increase the date. + span = -wxDateSpan::Month(); + break; + + case wxMOUSE_WHEEL_HORIZONTAL: + span = wxDateSpan::Year(); + break; + } + + // Currently we only take into account the rotation direction, not its + // magnitude. + if ( event.GetWheelRotation() < 0 ) + span = -span; + + SetDateAndNotify(m_date + span); +} + // ---------------------------------------------------------------------------- // subcontrols events handling // ---------------------------------------------------------------------------- diff --git a/3rdparty/wxwidgets3.0/src/generic/choicdgg.cpp b/3rdparty/wxwidgets3.0/src/generic/choicdgg.cpp index 6acb6833f9..e80ae70ff3 100644 --- a/3rdparty/wxwidgets3.0/src/generic/choicdgg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/choicdgg.cpp @@ -390,7 +390,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, const long styleBtns = styleDlg & (wxOK | wxCANCEL); styleDlg &= ~styleBtns; - if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) + if ( !wxDialog::Create(GetParentForModalDialog(parent, styleDlg), wxID_ANY, caption, pos, wxDefaultSize, styleDlg) ) return false; wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); diff --git a/3rdparty/wxwidgets3.0/src/generic/datavgen.cpp b/3rdparty/wxwidgets3.0/src/generic/datavgen.cpp index 95ef21a99b..ff21503984 100644 --- a/3rdparty/wxwidgets3.0/src/generic/datavgen.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/datavgen.cpp @@ -48,6 +48,7 @@ #include "wx/dnd.h" #include "wx/stopwatch.h" #include "wx/weakref.h" +#include "wx/generic/private/widthcalc.h" //----------------------------------------------------------------------------- // classes @@ -1790,9 +1791,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) wxDataViewModel *model = GetModel(); wxAutoBufferedPaintDC dc( this ); + const wxSize size = GetClientSize(); + dc.SetBrush(GetOwner()->GetBackgroundColour()); dc.SetPen( *wxTRANSPARENT_PEN ); - dc.DrawRectangle(GetClientSize()); + dc.DrawRectangle(size); if ( IsEmpty() ) { @@ -1878,13 +1881,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(altRowColour)); + // We only need to draw the visible part, so limit the rectangle to it. + const int xRect = m_owner->CalcUnscrolledPosition(wxPoint(0, 0)).x; + const int widthRect = size.x; for (unsigned int item = item_start; item < item_last; item++) { if ( item % 2 ) { - dc.DrawRectangle(x_start, + dc.DrawRectangle(xRect, GetLineStart(item), - GetClientSize().GetWidth(), + widthRect, GetLineHeight(item)); } } @@ -3208,6 +3214,11 @@ void wxDataViewMainWindow::Expand( unsigned int row ) ChangeCurrentRow(m_currentRow + rowAdjustment); m_count = -1; + + // Expanding this item means the previously cached column widths could + // have become invalid as new items are now visible. + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); // Send the expanded event SendExpanderEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,node->GetItem()); @@ -3283,6 +3294,9 @@ void wxDataViewMainWindow::Collapse(unsigned int row) } m_count = -1; + + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); SendExpanderEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,node->GetItem()); } @@ -3992,7 +4006,7 @@ bool wxDataViewMainWindow::TryAdvanceCurrentColumn(wxDataViewTreeNode *node, boo { if ( forward ) { - m_currentCol = GetOwner()->GetColumnAt(1); + m_currentCol = GetOwner()->GetColumnAt(0); m_currentColSetByKeyboard = true; RefreshRow(m_currentRow); return true; @@ -4113,23 +4127,23 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) wxDataViewItem itemDragged = GetItemByRow( drag_item_row ); // Notify cell about drag - wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); - event.SetEventObject( m_owner ); - event.SetItem( itemDragged ); - event.SetModel( model ); - if (!m_owner->HandleWindowEvent( event )) + wxDataViewEvent evt( wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, m_owner->GetId() ); + evt.SetEventObject( m_owner ); + evt.SetItem( itemDragged ); + evt.SetModel( model ); + if (!m_owner->HandleWindowEvent( evt )) return; - if (!event.IsAllowed()) + if (!evt.IsAllowed()) return; - wxDataObject *obj = event.GetDataObject(); + wxDataObject *obj = evt.GetDataObject(); if (!obj) return; wxDataViewDropSource drag( this, drag_item_row ); drag.SetData( *obj ); - /* wxDragResult res = */ drag.DoDragDrop(event.GetDragFlags()); + /* wxDragResult res = */ drag.DoDragDrop(evt.GetDragFlags()); delete obj; } return; @@ -4838,6 +4852,60 @@ int wxDataViewCtrl::GetModelColumnIndex( unsigned int model_column ) const return wxNOT_FOUND; } +class wxDataViewMaxWidthCalculator : public wxMaxWidthCalculatorBase +{ +public: + wxDataViewMaxWidthCalculator(const wxDataViewCtrl *dvc, + wxDataViewMainWindow *clientArea, + wxDataViewRenderer *renderer, + const wxDataViewModel *model, + size_t model_column, + int expanderSize) + : wxMaxWidthCalculatorBase(model_column), + m_dvc(dvc), + m_clientArea(clientArea), + m_renderer(renderer), + m_model(model), + m_expanderSize(expanderSize) + { + int index = dvc->GetModelColumnIndex( model_column ); + wxDataViewColumn* column = index == wxNOT_FOUND ? NULL : dvc->GetColumn(index); + m_isExpanderCol = + !clientArea->IsList() && + (column == 0 || + GetExpanderColumnOrFirstOne(const_cast(dvc)) == column ); + } + + virtual void UpdateWithRow(int row) + { + int indent = 0; + wxDataViewItem item; + + if ( m_isExpanderCol ) + { + wxDataViewTreeNode *node = m_clientArea->GetTreeNodeByRow(row); + item = node->GetItem(); + indent = m_dvc->GetIndent() * node->GetIndentLevel() + m_expanderSize; + } + else + { + item = m_clientArea->GetItemByRow(row); + } + + m_renderer->PrepareForItem(m_model, item, GetColumn()); + UpdateWithWidth(m_renderer->GetSize().x + indent); + } + +private: + const wxDataViewCtrl *m_dvc; + wxDataViewMainWindow *m_clientArea; + wxDataViewRenderer *m_renderer; + const wxDataViewModel *m_model; + bool m_isExpanderCol; + int m_expanderSize; +}; + + unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const { if ( m_colsBestWidths[idx].width != 0 ) @@ -4848,146 +4916,19 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const wxDataViewRenderer *renderer = const_cast(column->GetRenderer()); - class MaxWidthCalculator - { - public: - MaxWidthCalculator(const wxDataViewCtrl *dvc, - wxDataViewMainWindow *clientArea, - wxDataViewRenderer *renderer, - const wxDataViewModel *model, - unsigned int model_column, - int expanderSize) - : m_width(0), - m_dvc(dvc), - m_clientArea(clientArea), - m_renderer(renderer), - m_model(model), - m_model_column(model_column), - m_expanderSize(expanderSize) - - { - int index = dvc->GetModelColumnIndex( model_column ); - wxDataViewColumn* column = index == wxNOT_FOUND ? NULL : dvc->GetColumn(index); - m_isExpanderCol = - !clientArea->IsList() && - (column == 0 || - GetExpanderColumnOrFirstOne(const_cast(dvc)) == column ); - } - - void UpdateWithWidth(int width) - { - m_width = wxMax(m_width, width); - } - - void UpdateWithRow(int row) - { - int indent = 0; - wxDataViewItem item; - - if ( m_isExpanderCol ) - { - wxDataViewTreeNode *node = m_clientArea->GetTreeNodeByRow(row); - item = node->GetItem(); - indent = m_dvc->GetIndent() * node->GetIndentLevel() + m_expanderSize; - } - else - { - item = m_clientArea->GetItemByRow(row); - } - - m_renderer->PrepareForItem(m_model, item, m_model_column); - m_width = wxMax(m_width, m_renderer->GetSize().x + indent); - } - - int GetMaxWidth() const { return m_width; } - - private: - int m_width; - const wxDataViewCtrl *m_dvc; - wxDataViewMainWindow *m_clientArea; - wxDataViewRenderer *m_renderer; - const wxDataViewModel *m_model; - unsigned m_model_column; - bool m_isExpanderCol; - int m_expanderSize; - }; - - MaxWidthCalculator calculator(this, m_clientArea, renderer, - GetModel(), column->GetModelColumn(), - m_clientArea->GetRowHeight()); + wxDataViewMaxWidthCalculator calculator(this, m_clientArea, renderer, + GetModel(), column->GetModelColumn(), + m_clientArea->GetRowHeight()); calculator.UpdateWithWidth(column->GetMinWidth()); if ( m_headerArea ) calculator.UpdateWithWidth(m_headerArea->GetColumnTitleWidth(*column)); - // The code below deserves some explanation. For very large controls, we - // simply can't afford to calculate sizes for all items, it takes too - // long. So the best we can do is to check the first and the last N/2 - // items in the control for some sufficiently large N and calculate best - // sizes from that. That can result in the calculated best width being too - // small for some outliers, but it's better to get slightly imperfect - // result than to wait several seconds after every update. To avoid highly - // visible miscalculations, we also include all currently visible items - // no matter what. Finally, the value of N is determined dynamically by - // measuring how much time we spent on the determining item widths so far. - -#if wxUSE_STOPWATCH - int top_part_end = count; - static const long CALC_TIMEOUT = 20/*ms*/; - // don't call wxStopWatch::Time() too often - static const unsigned CALC_CHECK_FREQ = 100; - wxStopWatch timer; -#else - // use some hard-coded limit, that's the best we can do without timer - int top_part_end = wxMin(500, count); -#endif // wxUSE_STOPWATCH/!wxUSE_STOPWATCH - - int row = 0; - - for ( row = 0; row < top_part_end; row++ ) - { -#if wxUSE_STOPWATCH - if ( row % CALC_CHECK_FREQ == CALC_CHECK_FREQ-1 && - timer.Time() > CALC_TIMEOUT ) - break; -#endif // wxUSE_STOPWATCH - calculator.UpdateWithRow(row); - } - - // row is the first unmeasured item now; that's our value of N/2 - - if ( row < count ) - { - top_part_end = row; - - // add bottom N/2 items now: - const int bottom_part_start = wxMax(row, count - row); - for ( row = bottom_part_start; row < count; row++ ) - { - calculator.UpdateWithRow(row); - } - - // finally, include currently visible items in the calculation: - const wxPoint origin = CalcUnscrolledPosition(wxPoint(0, 0)); - int first_visible = m_clientArea->GetLineAt(origin.y); - int last_visible = m_clientArea->GetLineAt(origin.y + GetClientSize().y); - - first_visible = wxMax(first_visible, top_part_end); - last_visible = wxMin(bottom_part_start, last_visible); - - for ( row = first_visible; row < last_visible; row++ ) - { - calculator.UpdateWithRow(row); - } - - wxLogTrace("dataview", - "determined best size from %d top, %d bottom plus %d more visible items out of %d total", - top_part_end, - count - bottom_part_start, - wxMax(0, last_visible - first_visible), - count); - } + const wxPoint origin = CalcUnscrolledPosition(wxPoint(0, 0)); + calculator.ComputeBestColumnWidth(count, + m_clientArea->GetLineAt(origin.y), + m_clientArea->GetLineAt(origin.y + GetClientSize().y)); int max_width = calculator.GetMaxWidth(); if ( max_width > 0 ) @@ -5293,20 +5234,14 @@ void wxDataViewCtrl::Expand( const wxDataViewItem & item ) int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Expand(row); - InvalidateColBestWidths(); - } } void wxDataViewCtrl::Collapse( const wxDataViewItem & item ) { int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Collapse(row); - InvalidateColBestWidths(); - } } bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const diff --git a/3rdparty/wxwidgets3.0/src/generic/filectrlg.cpp b/3rdparty/wxwidgets3.0/src/generic/filectrlg.cpp index 1dfba4421c..0ce58f6600 100644 --- a/3rdparty/wxwidgets3.0/src/generic/filectrlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/filectrlg.cpp @@ -1064,9 +1064,14 @@ wxFileName wxGenericFileCtrl::DoGetFileName() const wxListItem item; item.m_itemId = m_list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); - m_list->GetItem(item); - fn.Assign(m_list->GetDir(), item.m_text); + // ... if anything is selected in the list + if ( item.m_itemId != wxNOT_FOUND ) + { + m_list->GetItem(item); + + fn.Assign(m_list->GetDir(), item.m_text); + } } else // user entered the value { diff --git a/3rdparty/wxwidgets3.0/src/generic/filedlgg.cpp b/3rdparty/wxwidgets3.0/src/generic/filedlgg.cpp index 9ec0842c64..0a9ff601dc 100644 --- a/3rdparty/wxwidgets3.0/src/generic/filedlgg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/filedlgg.cpp @@ -339,14 +339,40 @@ bool wxGenericFileDialog::Show( bool show ) void wxGenericFileDialog::OnOk( wxCommandEvent &WXUNUSED(event) ) { wxArrayString selectedFiles; - m_filectrl->GetFilenames(selectedFiles); + m_filectrl->GetPaths(selectedFiles); if (selectedFiles.Count() == 0) return; + const wxString& path = selectedFiles[0]; + if (selectedFiles.Count() == 1) { - SetPath( selectedFiles[0] ); + SetPath(path); + } + + // check that the file [doesn't] exist if necessary + if ( HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OVERWRITE_PROMPT) && + wxFileExists(path) ) + { + if ( wxMessageBox + ( + wxString::Format + ( + _("File '%s' already exists, do you really want to overwrite it?"), + path + ), + _("Confirm"), + wxYES_NO + ) != wxYES) + return; + } + else if ( HasFdFlag(wxFD_OPEN) && HasFdFlag(wxFD_FILE_MUST_EXIST) && + !wxFileExists(path) ) + { + wxMessageBox(_("Please choose an existing file."), _("Error"), + wxOK | wxICON_ERROR ); + return; } EndModal(wxID_OK); diff --git a/3rdparty/wxwidgets3.0/src/generic/graphicc.cpp b/3rdparty/wxwidgets3.0/src/generic/graphicc.cpp index 2d715e8ccf..aa81261ab6 100644 --- a/3rdparty/wxwidgets3.0/src/generic/graphicc.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/graphicc.cpp @@ -499,6 +499,11 @@ public: } virtual ~wxCairoImageContext() + { + Flush(); + } + + virtual void Flush() { m_image = m_data.ConvertToImage(); } @@ -1549,6 +1554,7 @@ wxImage wxCairoBitmapData::ConvertToImage() const } // Prepare for copying data. + cairo_surface_flush(m_surface); const wxUint32* src = (wxUint32*)cairo_image_surface_get_data(m_surface); wxCHECK_MSG( src, wxNullImage, wxS("Failed to get Cairo surface data.") ); diff --git a/3rdparty/wxwidgets3.0/src/generic/grid.cpp b/3rdparty/wxwidgets3.0/src/generic/grid.cpp index 6d7815a3ab..19595c2389 100644 --- a/3rdparty/wxwidgets3.0/src/generic/grid.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/grid.cpp @@ -1067,7 +1067,8 @@ void wxGridTableBase::SetRowAttr(wxGridCellAttr *attr, int row) { if ( m_attrProvider ) { - attr->SetKind(wxGridCellAttr::Row); + if ( attr ) + attr->SetKind(wxGridCellAttr::Row); m_attrProvider->SetRowAttr(attr, row); } else @@ -1082,7 +1083,8 @@ void wxGridTableBase::SetColAttr(wxGridCellAttr *attr, int col) { if ( m_attrProvider ) { - attr->SetKind(wxGridCellAttr::Col); + if ( attr ) + attr->SetKind(wxGridCellAttr::Col); m_attrProvider->SetColAttr(attr, col); } else @@ -2114,7 +2116,8 @@ void wxGridWindow::OnFocus(wxFocusEvent& event) m_owner->GetGridCursorCol()); const wxRect cursor = m_owner->BlockToDeviceRect(cursorCoords, cursorCoords); - Refresh(true, &cursor); + if (cursor != wxGridNoCellRect) + Refresh(true, &cursor); } if ( !m_owner->GetEventHandler()->ProcessEvent( event ) ) @@ -2725,7 +2728,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = pos; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2770,7 +2773,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) for ( i = oldNumRows; i < m_numRows; i++ ) { - bottom += m_rowHeights[i]; + bottom += GetRowHeight(i); m_rowBottoms[i] = bottom; } } @@ -2806,7 +2809,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) int h = 0; for ( i = 0; i < m_numRows; i++ ) { - h += m_rowHeights[i]; + h += GetRowHeight(i); m_rowBottoms[i] = h; } } @@ -2890,7 +2893,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -2948,7 +2951,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - right += m_colWidths[i]; + right += GetColWidth(i); m_colRights[i] = right; } } @@ -3009,7 +3012,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) { i = GetColAt( colPos ); - w += m_colWidths[i]; + w += GetColWidth(i); m_colRights[i] = w; } } @@ -3952,7 +3955,9 @@ wxGrid::DoGridCellDrag(wxMouseEvent& event, case wxMOD_CONTROL: if ( m_selectedBlockCorner == wxGridNoCellCoords) m_selectedBlockCorner = coords; - UpdateBlockBeingSelected(m_selectedBlockCorner, coords); + if ( isFirstDrag ) + SetGridCursor(coords); + UpdateBlockBeingSelected(m_currentCellCoords, coords); break; case wxMOD_NONE: diff --git a/3rdparty/wxwidgets3.0/src/generic/listctrl.cpp b/3rdparty/wxwidgets3.0/src/generic/listctrl.cpp index 771c400bb4..de2b17e258 100644 --- a/3rdparty/wxwidgets3.0/src/generic/listctrl.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/listctrl.cpp @@ -39,6 +39,7 @@ #include "wx/imaglist.h" #include "wx/renderer.h" #include "wx/generic/private/listctrl.h" +#include "wx/generic/private/widthcalc.h" #ifdef __WXMAC__ #include "wx/osx/private.h" @@ -1935,6 +1936,13 @@ void wxListMainWindow::RefreshLines( size_t lineFrom, size_t lineTo ) size_t visibleFrom, visibleTo; GetVisibleLinesRange(&visibleFrom, &visibleTo); + if ( lineFrom > visibleTo || lineTo < visibleFrom ) + { + // None of these lines are currently visible at all, don't bother + // doing anything. + return; + } + if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; if ( lineTo > visibleTo ) @@ -2433,7 +2441,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event ) evtCtx.SetEventObject(GetParent()); GetParent()->GetEventHandler()->ProcessEvent(evtCtx); } - else + else if (event.LeftDown()) { // reset the selection and bail out HighlightAll(false); @@ -2986,6 +2994,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event ) SetItemState(item, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); + EnsureVisible(item); // Reset the bell flag if it had been temporarily disabled // before. @@ -3186,6 +3195,35 @@ void wxListMainWindow::SetColumn( int col, const wxListItem &item ) m_headerWidth = 0; } +class wxListCtrlMaxWidthCalculator : public wxMaxWidthCalculatorBase +{ +public: + wxListCtrlMaxWidthCalculator(wxListMainWindow *listmain, unsigned int column) + : wxMaxWidthCalculatorBase(column), + m_listmain(listmain) + { + } + + virtual void UpdateWithRow(int row) + { + wxListLineData *line = m_listmain->GetLine( row ); + wxListItemDataList::compatibility_iterator n = line->m_items.Item( GetColumn() ); + + wxCHECK_RET( n, wxS("no subitem?") ); + + wxListItemData* const itemData = n->GetData(); + + wxListItem item; + itemData->GetItem(item); + + UpdateWithWidth(m_listmain->GetItemWidthWithImage(&item)); + } + +private: + wxListMainWindow* const m_listmain; +}; + + void wxListMainWindow::SetColumnWidth( int col, int width ) { wxCHECK_RET( col >= 0 && col < GetColumnCount(), @@ -3207,48 +3245,42 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) size_t count = GetItemCount(); - if (width == wxLIST_AUTOSIZE_USEHEADER) + if ( width == wxLIST_AUTOSIZE_USEHEADER || width == wxLIST_AUTOSIZE ) { - width = ComputeMinHeaderWidth(column); - } - else if ( width == wxLIST_AUTOSIZE ) - { - width = ComputeMinHeaderWidth(column); + wxListCtrlMaxWidthCalculator calculator(this, col); - if ( !IsVirtual() ) + calculator.UpdateWithWidth(AUTOSIZE_COL_MARGIN); + + if ( width == wxLIST_AUTOSIZE_USEHEADER ) + calculator.UpdateWithWidth(ComputeMinHeaderWidth(column)); + + // if the cached column width isn't valid then recalculate it + wxColWidthInfo* const pWidthInfo = m_aColWidths.Item(col); + if ( pWidthInfo->bNeedsUpdate ) { - wxClientDC dc(this); - dc.SetFont( GetFont() ); + size_t first_visible, last_visible; + GetVisibleLinesRange(&first_visible, &last_visible); - int max = AUTOSIZE_COL_MARGIN; - - // if the cached column width isn't valid then recalculate it - if (m_aColWidths.Item(col)->bNeedsUpdate) - { - for (size_t i = 0; i < count; i++) - { - wxListLineData *line = GetLine( i ); - wxListItemDataList::compatibility_iterator n = line->m_items.Item( col ); - - wxCHECK_RET( n, wxT("no subitem?") ); - - wxListItemData *itemData = n->GetData(); - wxListItem item; - - itemData->GetItem(item); - int itemWidth = GetItemWidthWithImage(&item); - if (itemWidth > max) - max = itemWidth; - } - - m_aColWidths.Item(col)->bNeedsUpdate = false; - m_aColWidths.Item(col)->nMaxWidth = max; - } - - max = m_aColWidths.Item(col)->nMaxWidth + AUTOSIZE_COL_MARGIN; - if ( width < max ) - width = max; + calculator.ComputeBestColumnWidth(count, first_visible, last_visible); + pWidthInfo->nMaxWidth = calculator.GetMaxWidth(); + pWidthInfo->bNeedsUpdate = false; } + else + { + calculator.UpdateWithWidth(pWidthInfo->nMaxWidth); + } + + // expand the last column to fit the client size + // only for AUTOSIZE_USEHEADER to mimic MSW behaviour + int margin = 0; + if ( (width == wxLIST_AUTOSIZE_USEHEADER) && (col == GetColumnCount() - 1) ) + { + margin = GetClientSize().GetX(); + for ( int i = 0; i < col && margin > 0; ++i ) + margin -= m_columns.Item(i)->GetData()->GetWidth(); + } + + width = wxMax(margin, calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN); } column->SetWidth( width ); @@ -3315,8 +3347,12 @@ void wxListMainWindow::SetItem( wxListItem &item ) // update the Max Width Cache if needed int width = GetItemWidthWithImage(&item); - if (width > m_aColWidths.Item(item.m_col)->nMaxWidth) - m_aColWidths.Item(item.m_col)->nMaxWidth = width; + wxColWidthInfo* const pWidthInfo = m_aColWidths.Item(item.m_col); + if ( width > pWidthInfo->nMaxWidth ) + { + pWidthInfo->nMaxWidth = width; + pWidthInfo->bNeedsUpdate = true; + } } } @@ -3959,8 +3995,9 @@ void wxListMainWindow::DeleteItem( long lindex ) itemWidth = GetItemWidthWithImage(&item); - if (itemWidth >= m_aColWidths.Item(i)->nMaxWidth) - m_aColWidths.Item(i)->bNeedsUpdate = true; + wxColWidthInfo *pWidthInfo = m_aColWidths.Item(i); + if ( itemWidth >= pWidthInfo->nMaxWidth ) + pWidthInfo->bNeedsUpdate = true; } ResetVisibleLinesRange(); @@ -4033,6 +4070,13 @@ void wxListMainWindow::DeleteColumn( int col ) void wxListMainWindow::DoDeleteAllItems() { + // We will need to update all columns if any items are inserted again. + if ( InReportView() ) + { + for ( size_t i = 0; i < m_aColWidths.GetCount(); i++ ) + m_aColWidths.Item(i)->bNeedsUpdate = true; + } + if ( IsEmpty() ) // nothing to do - in particular, don't send the event return; @@ -4055,13 +4099,7 @@ void wxListMainWindow::DoDeleteAllItems() } if ( InReportView() ) - { ResetVisibleLinesRange(); - for (size_t i = 0; i < m_aColWidths.GetCount(); i++) - { - m_aColWidths.Item(i)->bNeedsUpdate = true; - } - } m_lines.Clear(); } @@ -4225,7 +4263,10 @@ void wxListMainWindow::InsertItem( wxListItem &item ) int width = GetItemWidthWithImage(&item); item.SetWidth(width); if (width > pWidthInfo->nMaxWidth) + { pWidthInfo->nMaxWidth = width; + pWidthInfo->bNeedsUpdate = true; + } } wxListLineData *line = new wxListLineData(this); @@ -4271,7 +4312,7 @@ long wxListMainWindow::InsertColumn( long col, const wxListItem &item ) if (item.m_width == wxLIST_AUTOSIZE_USEHEADER) column->SetWidth(ComputeMinHeaderWidth(column)); - wxColWidthInfo *colWidthInfo = new wxColWidthInfo(); + wxColWidthInfo *colWidthInfo = new wxColWidthInfo(0, IsVirtual()); bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount()); if ( insert ) diff --git a/3rdparty/wxwidgets3.0/src/generic/preferencesg.cpp b/3rdparty/wxwidgets3.0/src/generic/preferencesg.cpp index 45b311de64..09318ed7ab 100644 --- a/3rdparty/wxwidgets3.0/src/generic/preferencesg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/preferencesg.cpp @@ -52,7 +52,7 @@ public: wxSizer *sizer = new wxBoxSizer(wxVERTICAL); - m_notebook = new wxNotebook(this, wxID_ANY); + m_notebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_MULTILINE); sizer->Add(m_notebook, wxSizerFlags(1).Expand().DoubleBorder()); #ifdef __WXGTK__ diff --git a/3rdparty/wxwidgets3.0/src/generic/scrlwing.cpp b/3rdparty/wxwidgets3.0/src/generic/scrlwing.cpp index 6291815209..4fcb6a17bf 100644 --- a/3rdparty/wxwidgets3.0/src/generic/scrlwing.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/scrlwing.cpp @@ -39,8 +39,6 @@ #include "wx/scrolbar.h" #endif -#include "wx/recguard.h" - #ifdef __WXMSW__ #include // for DLGC_WANTARROWS #include "wx/msw/winundef.h" @@ -58,6 +56,58 @@ #endif #endif +typedef wxVector wxScrollHelperRecGuardFlags; +class wxScrollHelperRecGuard +{ +public: + wxScrollHelperRecGuard(wxScrollHelper *instance, wxScrollHelperRecGuardFlags& flags) + : m_flags(flags), m_instance(instance), m_inside(false) + { + // Determine if our instance is already inside a guard + for ( wxScrollHelperRecGuardFlags::iterator iter = flags.begin(); + iter != flags.end(); + ++iter ) + { + if ( *iter == instance ) + { + m_inside = true; + return; + } + } + + // Not inside so add it to the back + flags.push_back(instance); + } + + ~wxScrollHelperRecGuard() + { + if ( IsInside() ) + return; + + for ( wxScrollHelperRecGuardFlags::iterator iter = m_flags.begin(); + iter != m_flags.end(); + ++iter ) + { + if ( *iter == m_instance ) + { + m_flags.erase(iter); + break; + } + } + } + + bool IsInside() const { return m_inside; } + +private: + wxScrollHelperRecGuardFlags& m_flags; + wxScrollHelper* m_instance; + + // true if the flag had been already set when we were created + bool m_inside; + + wxDECLARE_NO_COPY_CLASS(wxScrollHelperRecGuard); +}; + /* TODO PROPERTIES style wxHSCROLL | wxVSCROLL @@ -214,9 +264,6 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } - if ( processed && event.IsCommandEvent()) - return true; - // For wxEVT_PAINT the user code can either handle this event as usual or // override virtual OnDraw(), so if the event hasn't been handled we need // to call this virtual function ourselves. @@ -235,6 +282,11 @@ bool wxScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } + // If the user code handled this event, it should prevent the default + // handling from taking place, so don't do anything else in this case. + if ( processed ) + return true; + if ( evType == wxEVT_CHILD_FOCUS ) { m_scrollHelper->HandleOnChildFocus((wxChildFocusEvent &)event); @@ -1303,8 +1355,8 @@ wxScrollHelper::DoAdjustScrollbar(int orient, void wxScrollHelper::AdjustScrollbars() { - static wxRecursionGuardFlag s_flagReentrancy; - wxRecursionGuard guard(s_flagReentrancy); + static wxScrollHelperRecGuardFlags s_flagReentrancy; + wxScrollHelperRecGuard guard(this, s_flagReentrancy); if ( guard.IsInside() ) { // don't reenter AdjustScrollbars() while another call to diff --git a/3rdparty/wxwidgets3.0/src/generic/spinctlg.cpp b/3rdparty/wxwidgets3.0/src/generic/spinctlg.cpp index 3da88c9404..8209a30ae4 100644 --- a/3rdparty/wxwidgets3.0/src/generic/spinctlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/spinctlg.cpp @@ -210,16 +210,6 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, m_max = max; m_increment = increment; - m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style); - m_spinButton = new wxSpinCtrlButtonGeneric(this, style); - -#if wxUSE_TOOLTIPS - m_textCtrl->SetToolTip(GetToolTipText()); - m_spinButton->SetToolTip(GetToolTipText()); -#endif // wxUSE_TOOLTIPS - - m_spin_value = m_spinButton->GetValue(); - // the string value overrides the numeric one (for backwards compatibility // reasons and also because it is simpler to satisfy the string value which // comes much sooner in the list of arguments and leave the initial @@ -228,12 +218,19 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, { double d; if ( DoTextToValue(value, &d) ) - { m_value = d; - m_textCtrl->ChangeValue(DoValueToText(m_value)); - } } + m_textCtrl = new wxSpinCtrlTextGeneric(this, DoValueToText(m_value), style); + m_spinButton = new wxSpinCtrlButtonGeneric(this, style); + +#if wxUSE_TOOLTIPS + m_textCtrl->SetToolTip(GetToolTipText()); + m_spinButton->SetToolTip(GetToolTipText()); +#endif // wxUSE_TOOLTIPS + + m_spin_value = m_spinButton->GetValue(); + SetInitialSize(size); Move(pos); diff --git a/3rdparty/wxwidgets3.0/src/generic/splitter.cpp b/3rdparty/wxwidgets3.0/src/generic/splitter.cpp index 826b92a7d8..fce272f564 100644 --- a/3rdparty/wxwidgets3.0/src/generic/splitter.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/splitter.cpp @@ -192,21 +192,15 @@ void wxSplitterWindow::OnInternalIdle() { wxWindow::OnInternalIdle(); - // We may need to update the children sizes in two cases: either because - // we're in the middle of a live update as indicated by m_needUpdating or - // because we have a requested but not yet set sash position as indicated - // by m_requestedSashPosition having a valid value. + // We may need to update the children sizes if we're in the middle of + // a live update as indicated by m_needUpdating. The other possible case, + // when we have a requested but not yet set sash position (as indicated + // by m_requestedSashPosition having a valid value) is handled by OnSize. if ( m_needUpdating ) { m_needUpdating = false; + SizeWindows(); } - else if ( m_requestedSashPosition == INT_MAX ) - { - // We don't need to resize the children. - return; - } - - SizeWindows(); } void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) diff --git a/3rdparty/wxwidgets3.0/src/generic/srchctlg.cpp b/3rdparty/wxwidgets3.0/src/generic/srchctlg.cpp index 758a195cc9..34cde02264 100644 --- a/3rdparty/wxwidgets3.0/src/generic/srchctlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/srchctlg.cpp @@ -456,7 +456,12 @@ wxSize wxSearchCtrl::DoGetBestSize() const // buttons are square and equal to the height of the text control int height = sizeText.y; return wxSize(sizeSearch.x + searchMargin + sizeText.x + cancelMargin + sizeCancel.x + 2*horizontalBorder, - height) + DoGetBorderSize(); +#ifdef __WXMSW__ + // Border is already added in wxSearchTextCtrl::DoGetBestSize() + height); +#else + height) + DoGetBorderSize(); +#endif } void wxSearchCtrl::DoMoveWindow(int x, int y, int width, int height) @@ -521,7 +526,17 @@ void wxSearchCtrl::DoLayoutControls() x += sizeSearch.x; x += searchMargin; - m_text->SetSize(x, 0, textWidth, height); +#ifdef __WXMSW__ + // The text control is too high up on Windows; normally a text control looks OK because + // of the white border that's part of the theme border. We can also remove a pixel from + // the height to fit the text control in, because the padding in EDIT_HEIGHT_FROM_CHAR_HEIGHT + // is already generous. + int textY = 1; +#else + int textY = 0; +#endif + + m_text->SetSize(x, textY, textWidth, height-textY); x += textWidth; x += cancelMargin; diff --git a/3rdparty/wxwidgets3.0/src/generic/timectrlg.cpp b/3rdparty/wxwidgets3.0/src/generic/timectrlg.cpp index 71867c2f35..b60a1d7ae6 100644 --- a/3rdparty/wxwidgets3.0/src/generic/timectrlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/timectrlg.cpp @@ -26,6 +26,7 @@ #ifndef WX_PRECOMP #include "wx/textctrl.h" + #include "wx/utils.h" // wxMax() #endif // WX_PRECOMP #include "wx/timectrl.h" @@ -657,7 +658,7 @@ void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height) return; const int widthBtn = m_impl->m_btn->GetSize().x; - const int widthText = width - widthBtn - HMARGIN_TEXT_SPIN; + const int widthText = wxMax(width - widthBtn - HMARGIN_TEXT_SPIN, 0); m_impl->m_text->SetSize(0, 0, widthText, height); m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height); diff --git a/3rdparty/wxwidgets3.0/src/generic/treectlg.cpp b/3rdparty/wxwidgets3.0/src/generic/treectlg.cpp index b81a0b4f09..870f0ded05 100644 --- a/3rdparty/wxwidgets3.0/src/generic/treectlg.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/treectlg.cpp @@ -515,6 +515,13 @@ void wxTreeTextCtrl::Finish( bool setfocus ) { m_owner->ResetTextControl(); +#ifdef __WXMAC__ + // On wxMac, modal event loops avoid deleting pending objects. + // Hide control so it does not remain visible e.g. if the tree + // control is used in a dialog. + Hide(); +#endif + wxPendingDelete.Append(this); if (setfocus) diff --git a/3rdparty/wxwidgets3.0/src/generic/treelist.cpp b/3rdparty/wxwidgets3.0/src/generic/treelist.cpp index 73fbe6c466..663a17f2dc 100644 --- a/3rdparty/wxwidgets3.0/src/generic/treelist.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/treelist.cpp @@ -170,10 +170,15 @@ public: wxScopedArray oldTexts(m_columnsTexts); m_columnsTexts = new wxString[numColumns - 2]; + + // As above, n is the index in the new column texts array and m is the + // index in the old one. for ( unsigned n = 1, m = 1; n < numColumns - 1; n++, m++ ) { - if ( n == col ) + if ( m == col ) { + // Skip copying the deleted column and keep the new index the + // same (so compensate for "n++" done in the loop). n--; } else // Not the deleted column. @@ -738,7 +743,10 @@ void wxTreeListModel::DeleteItem(Node* item) previous->DeleteNext(); } - ItemDeleted(ToDVI(parent), ToDVI(item)); + // Note that the item is already deleted by now, so we can't use it in any + // way, e.g. by calling ToDVI(item) which does dereference the pointer, but + // ToNonRootDVI() that we use here does not. + ItemDeleted(ToDVI(parent), ToNonRootDVI(item)); } void wxTreeListModel::DeleteAllItems() diff --git a/3rdparty/wxwidgets3.0/src/generic/vscroll.cpp b/3rdparty/wxwidgets3.0/src/generic/vscroll.cpp index 10afddad01..38e882bbb0 100644 --- a/3rdparty/wxwidgets3.0/src/generic/vscroll.cpp +++ b/3rdparty/wxwidgets3.0/src/generic/vscroll.cpp @@ -89,9 +89,6 @@ bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } - if ( processed && event.IsCommandEvent()) - return true; - // For wxEVT_PAINT the user code can either handle this event as usual or // override virtual OnDraw(), so if the event hasn't been handled we need // to call this virtual function ourselves. @@ -110,6 +107,11 @@ bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event) return true; } + // If the user code handled this event, it should prevent the default + // handling from taking place, so don't do anything else in this case. + if ( processed ) + return true; + // reset the skipped flag (which might have been set to true in // ProcessEvent() above) to be able to test it below bool wasSkipped = event.GetSkipped(); diff --git a/3rdparty/wxwidgets3.0/src/msw/anybutton.cpp b/3rdparty/wxwidgets3.0/src/msw/anybutton.cpp index b5d6dc84c0..2ee28d1e57 100644 --- a/3rdparty/wxwidgets3.0/src/msw/anybutton.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/anybutton.cpp @@ -519,8 +519,9 @@ void wxAnyButton::AdjustForBitmapSize(wxSize &size) const { wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") ); - // account for the bitmap size - const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize(); + // account for the bitmap size, including the user-specified margins + const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize() + + 2*m_imageData->GetBitmapMargins(); const wxDirection dirBmp = m_imageData->GetBitmapPosition(); if ( dirBmp == wxLEFT || dirBmp == wxRIGHT ) { @@ -535,9 +536,6 @@ void wxAnyButton::AdjustForBitmapSize(wxSize &size) const size.x = sizeBmp.x; } - // account for the user-specified margins - size += 2*m_imageData->GetBitmapMargins(); - // and also for the margins we always add internally (unless we have no // border at all in which case the button has exactly the same size as // bitmap and so no margins should be used) diff --git a/3rdparty/wxwidgets3.0/src/msw/app.cpp b/3rdparty/wxwidgets3.0/src/msw/app.cpp index aaaefc038f..c3e3cfe1e5 100644 --- a/3rdparty/wxwidgets3.0/src/msw/app.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/app.cpp @@ -630,9 +630,9 @@ private: }; //// Initialize -bool wxApp::Initialize(int& argc, wxChar **argv) +bool wxApp::Initialize(int& argc_, wxChar **argv_) { - if ( !wxAppBase::Initialize(argc, argv) ) + if ( !wxAppBase::Initialize(argc_, argv_) ) return false; // ensure that base cleanup is done if we return too early diff --git a/3rdparty/wxwidgets3.0/src/msw/artmsw.cpp b/3rdparty/wxwidgets3.0/src/msw/artmsw.cpp index 04885e3d6b..404648effd 100644 --- a/3rdparty/wxwidgets3.0/src/msw/artmsw.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/artmsw.cpp @@ -197,7 +197,7 @@ wxBitmap wxWindowsArtProvider::CreateBitmap(const wxArtID& id, wxIcon icon; icon.CreateFromHICON( (WXHICON)sii.hIcon ); - wxBitmap bitmap( icon ); + bitmap = wxBitmap(icon); ::DestroyIcon(sii.hIcon); if ( bitmap.IsOk() ) diff --git a/3rdparty/wxwidgets3.0/src/msw/bitmap.cpp b/3rdparty/wxwidgets3.0/src/msw/bitmap.cpp index a0abcad045..8a79c82d6f 100644 --- a/3rdparty/wxwidgets3.0/src/msw/bitmap.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/bitmap.cpp @@ -573,7 +573,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) unsigned char val = *src++; unsigned char reversed = 0; - for ( int bits = 0; bits < 8; bits++) + for ( int bit = 0; bit < 8; bit++) { reversed <<= 1; reversed |= (unsigned char)(val & 0x01); diff --git a/3rdparty/wxwidgets3.0/src/msw/bmpcbox.cpp b/3rdparty/wxwidgets3.0/src/msw/bmpcbox.cpp index 469ddace63..7cf13208b6 100644 --- a/3rdparty/wxwidgets3.0/src/msw/bmpcbox.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/bmpcbox.cpp @@ -449,9 +449,9 @@ bool wxBitmapComboBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) LPMEASUREITEMSTRUCT lpMeasureItem = (LPMEASUREITEMSTRUCT) item; int pos = lpMeasureItem->itemID; - // Measure item height if item list is not empty, + // Measure edit field height if item list is not empty, // otherwise leave default system value. - if ( pos >= 0 ) + if ( m_usedImgSize.y >= 0 || pos >= 0 ) { lpMeasureItem->itemHeight = wxBitmapComboBoxBase::MeasureItem(pos); } diff --git a/3rdparty/wxwidgets3.0/src/msw/checklst.cpp b/3rdparty/wxwidgets3.0/src/msw/checklst.cpp index 36484a73a9..591957ab6e 100644 --- a/3rdparty/wxwidgets3.0/src/msw/checklst.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/checklst.cpp @@ -157,7 +157,14 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, int y = rc.GetY() + (rc.GetHeight() - size.GetHeight()) / 2; UINT uState = stat & wxOwnerDrawn::wxODSelected ? wxDSB_SELECTED : wxDSB_NORMAL; + + // checkmarks should not be mirrored in RTL layout + DWORD oldLayout = impl->GetLayoutDirection() == wxLayout_RightToLeft ? LAYOUT_RTL : 0; + if ( oldLayout & LAYOUT_RTL ) + ::SetLayout(hdc, oldLayout | LAYOUT_BITMAPORIENTATIONPRESERVED); wxDrawStateBitmap(hdc, hBmpCheck, x, y, uState); + if ( oldLayout & LAYOUT_RTL ) + ::SetLayout(hdc, oldLayout); return true; } diff --git a/3rdparty/wxwidgets3.0/src/msw/dc.cpp b/3rdparty/wxwidgets3.0/src/msw/dc.cpp index abd8956f34..d85187d91d 100644 --- a/3rdparty/wxwidgets3.0/src/msw/dc.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/dc.cpp @@ -2007,7 +2007,7 @@ void wxMSWDCImpl::RealizeScaleAndOrigin() // Becaue only devExtX/logExtX ratio and devExtY/logExtY ratio are counted // we can reduce the fractions to avoid large absolute numbers // and possible arithmetic overflows. - unsigned int gcd = CalcGCD(abs(devExtX), abs(logExtX)); + int gcd = CalcGCD(abs(devExtX), abs(logExtX)); devExtX /= gcd; logExtX /= gcd; gcd = CalcGCD(abs(devExtY), abs(logExtY)); @@ -2127,6 +2127,8 @@ void wxMSWDCImpl::SetLogicalScale(double x, double y) WXMICROWIN_CHECK_HDC wxDCImpl::SetLogicalScale(x,y); + + RealizeScaleAndOrigin(); } void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y) diff --git a/3rdparty/wxwidgets3.0/src/msw/dirdlg.cpp b/3rdparty/wxwidgets3.0/src/msw/dirdlg.cpp index 4f2c898d8e..e5c174d4aa 100644 --- a/3rdparty/wxwidgets3.0/src/msw/dirdlg.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/dirdlg.cpp @@ -222,7 +222,7 @@ int wxDirDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); - wxWindow* const parent = GetParent(); + wxWindow* const parent = GetParentForModalDialog(); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; // Use IFileDialog under new enough Windows, it's more user-friendly. diff --git a/3rdparty/wxwidgets3.0/src/msw/filedlg.cpp b/3rdparty/wxwidgets3.0/src/msw/filedlg.cpp index 4529cd25e1..ac08a7559e 100644 --- a/3rdparty/wxwidgets3.0/src/msw/filedlg.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/filedlg.cpp @@ -664,7 +664,7 @@ int wxFileDialog::ShowModal() const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; - for( int i = 0; i < maxFilter; i++ ) // get extension + for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; // use dummy name a to avoid assert in AppendExtension @@ -676,23 +676,30 @@ int wxFileDialog::ShowModal() } } + // Create a temporary struct to restore the CWD when we exit this function // store off before the standard windows dialog can possibly change it - const wxString cwdOrig = wxGetCwd(); - - //== Execute FileDialog >>================================================= - - if ( !ShowCommFileDialog(&of, m_windowStyle) ) - return wxID_CANCEL; + struct CwdRestore + { + wxString value; + ~CwdRestore() + { + if (!value.empty()) + wxSetWorkingDirectory(value); + } + } cwdOrig; // GetOpenFileName will always change the current working directory on // (according to MSDN) "Windows NT 4.0/2000/XP" because the flag // OFN_NOCHANGEDIR has no effect. If the user did not specify // wxFD_CHANGE_DIR let's restore the current working directory to what it // was before the dialog was shown. - if ( msw_flags & OFN_NOCHANGEDIR ) - { - wxSetWorkingDirectory(cwdOrig); - } + if (msw_flags & OFN_NOCHANGEDIR) + cwdOrig.value = wxGetCwd(); + + //== Execute FileDialog >>================================================= + + if ( !ShowCommFileDialog(&of, m_windowStyle) ) + return wxID_CANCEL; m_fileNames.Empty(); @@ -726,11 +733,11 @@ int wxFileDialog::ShowModal() m_fileNames.Add(toke.GetNextToken()); #endif // OFN_EXPLORER - wxString dir(m_dir); + m_path = m_dir; if ( m_dir.Last() != wxT('\\') ) - dir += wxT('\\'); + m_path += wxT('\\'); - m_path = dir + m_fileName; + m_path += m_fileName; m_filterIndex = (int)of.nFilterIndex - 1; } else @@ -746,7 +753,7 @@ int wxFileDialog::ShowModal() const wxChar* extension = filterBuffer.t_str(); int maxFilter = (int)(of.nFilterIndex*2L) - 1; - for( int i = 0; i < maxFilter; i++ ) // get extension + for( int j = 0; j < maxFilter; j++ ) // get extension extension = extension + wxStrlen( extension ) + 1; m_fileName = AppendExtension(fileNameBuffer, extension); diff --git a/3rdparty/wxwidgets3.0/src/msw/font.cpp b/3rdparty/wxwidgets3.0/src/msw/font.cpp index 78786d142d..c70a5dc1d6 100644 --- a/3rdparty/wxwidgets3.0/src/msw/font.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/font.cpp @@ -386,7 +386,8 @@ void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont) m_hFont = (HFONT)hFont; m_nativeFontInfo = info; - // TODO: m_sizeUsingPixels? + // size of native fonts is expressed in pixels + m_sizeUsingPixels = true; } wxFontRefData::~wxFontRefData() diff --git a/3rdparty/wxwidgets3.0/src/msw/fontutil.cpp b/3rdparty/wxwidgets3.0/src/msw/fontutil.cpp index 010ce5dc84..71231fd899 100644 --- a/3rdparty/wxwidgets3.0/src/msw/fontutil.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/fontutil.cpp @@ -258,6 +258,10 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs) fontEncoding = wxFONTENCODING_CP1361; break; + case MAC_CHARSET: + fontEncoding = wxFONTENCODING_MACROMAN; + break; + #endif // Win32 case OEM_CHARSET: diff --git a/3rdparty/wxwidgets3.0/src/msw/frame.cpp b/3rdparty/wxwidgets3.0/src/msw/frame.cpp index 113420452e..6afeb7794a 100644 --- a/3rdparty/wxwidgets3.0/src/msw/frame.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/frame.cpp @@ -286,16 +286,6 @@ void wxFrame::PositionStatusBar() int w, h; GetClientSize(&w, &h); - // Resize the status bar to its default height, as it could have been set - // to a wrong value before by WM_SIZE sent during the frame creation and - // our status bars preserve their programmatically set size to avoid being - // resized by DefWindowProc() to the full window width, so if we didn't do - // this here, the status bar would retain the possibly wrong current height. - m_frameStatusBar->SetSize(wxDefaultSize, wxSIZE_AUTO_HEIGHT); - - int sw, sh; - m_frameStatusBar->GetSize(&sw, &sh); - int x = 0; #if wxUSE_TOOLBAR wxToolBar * const toolbar = GetToolBar(); @@ -319,6 +309,16 @@ void wxFrame::PositionStatusBar() //else: no adjustments necessary for the toolbar on top #endif // wxUSE_TOOLBAR + // Resize the status bar to its default height, as it could have been set + // to a wrong value before by WM_SIZE sent during the frame creation and + // our status bars preserve their programmatically set size to avoid being + // resized by DefWindowProc() to the full window width, so if we didn't do + // this here, the status bar would retain the possibly wrong current height. + m_frameStatusBar->SetSize(x, h, w, wxDefaultCoord, wxSIZE_AUTO_HEIGHT); + + int sw, sh; + m_frameStatusBar->GetSize(&sw, &sh); + // Since we wish the status bar to be directly under the client area, // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. m_frameStatusBar->SetSize(x, h, w, sh); diff --git a/3rdparty/wxwidgets3.0/src/msw/fswatcher.cpp b/3rdparty/wxwidgets3.0/src/msw/fswatcher.cpp index 7269112f52..b9803efc45 100644 --- a/3rdparty/wxwidgets3.0/src/msw/fswatcher.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/fswatcher.cpp @@ -217,7 +217,7 @@ wxThread::ExitCode wxIOCPThread::Entry() } // wait for events to occur, read them and send to interested parties -// returns false it empty status was read, which means we whould exit +// returns false it empty status was read, which means we would exit // true otherwise bool wxIOCPThread::ReadEvents() { diff --git a/3rdparty/wxwidgets3.0/src/msw/glcanvas.cpp b/3rdparty/wxwidgets3.0/src/msw/glcanvas.cpp index 7beb05c47c..58a3658c7c 100644 --- a/3rdparty/wxwidgets3.0/src/msw/glcanvas.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/glcanvas.cpp @@ -45,7 +45,7 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, #endif // ---------------------------------------------------------------------------- -// define possibly missing WGL constants +// define possibly missing WGL constants and types // ---------------------------------------------------------------------------- #ifndef WGL_ARB_pixel_format @@ -76,6 +76,49 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, #define WGL_SAMPLES_ARB 0x2042 #endif +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#endif + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif +#endif + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_EXT_create_context_es2_profile +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef WGL_EXT_create_context_es_profile +#define WGL_EXT_create_context_es_profile +#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif + +typedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) + (HDC hDC, HGLRC hShareContext, const int *attribList); + // ---------------------------------------------------------------------------- // libraries // ---------------------------------------------------------------------------- @@ -108,10 +151,44 @@ LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, IMPLEMENT_CLASS(wxGLContext, wxObject) +// The window will always be created first so the array will be initialized +// and then the window will be assigned to the context. +// max 8 attributes plus terminator +// if first is 0, create legacy context +static int s_wglContextAttribs[9] = {0}; + wxGLContext::wxGLContext(wxGLCanvas *win, const wxGLContext* other) { - m_glContext = wglCreateContext(win->GetHDC()); - wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGL context") ); + if ( s_wglContextAttribs[0] == 0 ) // create legacy context + { + m_glContext = wglCreateContext(win->GetHDC()); + wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGL context") ); + } + else // create a context using attributes + { + // We need to create a temporary context to get the + // wglCreateContextAttribsARB function + HGLRC tempContext = wglCreateContext(win->GetHDC()); + wxCHECK_RET( tempContext, wxT("Couldn't create OpenGL context") ); + + wglMakeCurrent(win->GetHDC(), tempContext); + PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB + = (PFNWGLCREATECONTEXTATTRIBSARBPROC) + wglGetProcAddress("wglCreateContextAttribsARB"); + wglMakeCurrent(win->GetHDC(), NULL); + wglDeleteContext(tempContext); + + if ( !wglCreateContextAttribsARB ) + { + wxLogError(_("Core OpenGL profile is not supported by the OpenGL driver.")); + return; + } + + m_glContext = wglCreateContextAttribsARB( + win->GetHDC(), 0, s_wglContextAttribs); + wxCHECK_RET( m_glContext, + wxT("Couldn't create core profile OpenGL context") ); + } if ( other ) { @@ -235,6 +312,58 @@ bool wxGLCanvas::Create(wxWindow *parent, if ( !CreateWindow(parent, id, pos, size, style, name) ) return false; + // these will be used for the context creation attributes + // if a core profile is requested + bool useGLCoreProfile = false; + + // the minimum gl core version is 3.0 + int glVersionMajor = 3, + glVersionMinor = 0; + + // Check for a core profile request + if ( attribList ) + { + for ( int i = 0; attribList[i]; ) + { + switch ( attribList[i++] ) + { + case WX_GL_CORE_PROFILE: + useGLCoreProfile = true; + break; + + case WX_GL_MAJOR_VERSION: + glVersionMajor = attribList[i++]; + break; + + case WX_GL_MINOR_VERSION: + glVersionMinor = attribList[i++]; + break; + + default: + // ignore all other flags for now + break; + } + } + } + + if ( useGLCoreProfile ) + { + s_wglContextAttribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB; + s_wglContextAttribs[1] = glVersionMajor; + s_wglContextAttribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB; + s_wglContextAttribs[3] = glVersionMinor; + s_wglContextAttribs[4] = WGL_CONTEXT_FLAGS_ARB; + s_wglContextAttribs[5] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + s_wglContextAttribs[6] = WGL_CONTEXT_PROFILE_MASK_ARB; + s_wglContextAttribs[7] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + s_wglContextAttribs[8] = 0; // terminate + } + else // create legacy/compatibility context + { + s_wglContextAttribs[0] = 0; + } + + PIXELFORMATDESCRIPTOR pfd; const int setupVal = DoSetup(pfd, attribList); if ( setupVal == 0 ) // PixelFormat error diff --git a/3rdparty/wxwidgets3.0/src/msw/graphics.cpp b/3rdparty/wxwidgets3.0/src/msw/graphics.cpp index c0ce6da157..c02c65d4c2 100644 --- a/3rdparty/wxwidgets3.0/src/msw/graphics.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/graphics.cpp @@ -459,6 +459,11 @@ public: } virtual ~wxGDIPlusImageContext() + { + Flush(); + } + + virtual void Flush() { m_image = m_bitmap.ConvertToImage(); } @@ -1754,11 +1759,11 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD interim.GetPixelFormat(),&data); bool hasAlpha = false; - for ( size_t y = 0 ; y < height && !hasAlpha ; ++y) + for ( size_t yy = 0 ; yy < height && !hasAlpha ; ++yy) { - for( size_t x = 0 ; x < width && !hasAlpha; ++x) + for( size_t xx = 0 ; xx < width && !hasAlpha; ++xx) { - ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*y + x*4); + ARGB *dest = (ARGB*)((BYTE*)data.Scan0 + data.Stride*yy + xx*4); if ( ( *dest & Color::AlphaMask ) != 0 ) hasAlpha = true; } diff --git a/3rdparty/wxwidgets3.0/src/msw/listbox.cpp b/3rdparty/wxwidgets3.0/src/msw/listbox.cpp index aa1a3ef367..2b6254b9d3 100644 --- a/3rdparty/wxwidgets3.0/src/msw/listbox.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/listbox.cpp @@ -745,7 +745,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) if ( pStruct->itemID == (UINT)-1 ) return false; - wxListBoxItem *pItem = (wxListBoxItem *)m_aItems[pStruct->itemID]; + wxOwnerDrawn *pItem = m_aItems[pStruct->itemID]; wxDCTemp dc((WXHDC)pStruct->hDC); diff --git a/3rdparty/wxwidgets3.0/src/msw/listctrl.cpp b/3rdparty/wxwidgets3.0/src/msw/listctrl.cpp index 0772db7a25..008146c9f1 100644 --- a/3rdparty/wxwidgets3.0/src/msw/listctrl.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/listctrl.cpp @@ -620,7 +620,15 @@ bool wxListCtrl::SetColumnWidth(int col, int width) else if ( width == wxLIST_AUTOSIZE_USEHEADER) width = LVSCW_AUTOSIZE_USEHEADER; - return ListView_SetColumnWidth(GetHwnd(), col, width) != 0; + if ( !ListView_SetColumnWidth(GetHwnd(), col, width) ) + return false; + + // Failure to explicitly refresh the control with horizontal rules results + // in corrupted rules display. + if ( HasFlag(wxLC_HRULES) ) + Refresh(); + + return true; } // ---------------------------------------------------------------------------- diff --git a/3rdparty/wxwidgets3.0/src/msw/main.cpp b/3rdparty/wxwidgets3.0/src/msw/main.cpp index 65b4fc1750..c6bd7a6329 100644 --- a/3rdparty/wxwidgets3.0/src/msw/main.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/main.cpp @@ -297,8 +297,23 @@ void wxSetProcessDPIAware() #endif // wxUSE_DYNLIB_CLASS } +// It is sometimes undesirable to force DPI awareness on appplications, e.g. +// when they are artwork heavy and don't have appropriately scaled bitmaps, or +// when they are using non-wx, DPI-unaware code. Allow disabling +// SetProcessDPIAware() call. +// +// Further discussion: +// http://trac.wxwidgets.org/ticket/16116 +// https://groups.google.com/d/topic/wx-dev/Z0VpgzCY34U/discussion +bool gs_allowChangingDPIAwareness = true; + } //anonymous namespace +void wxMSWDisableSettingHighDPIAware() +{ + gs_allowChangingDPIAwareness = false; +} + // ---------------------------------------------------------------------------- // Windows-specific wxEntry // ---------------------------------------------------------------------------- @@ -405,7 +420,9 @@ WXDLLEXPORT int wxEntry(HINSTANCE hInstance, // http://msdn.microsoft.com/en-us/library/dd464659%28VS.85%29.aspx). // Note that we intentionally do it here and not in wxApp, so that it // doesn't happen if wx code is hosted in another app (e.g. a plugin). - wxSetProcessDPIAware(); + // It can be disabled by calling wxMSWAllowChangingDPIAwareness(). + if ( gs_allowChangingDPIAwareness ) + wxSetProcessDPIAware(); if ( !wxMSWEntryCommon(hInstance, nCmdShow) ) return -1; diff --git a/3rdparty/wxwidgets3.0/src/msw/mediactrl_qt.cpp b/3rdparty/wxwidgets3.0/src/msw/mediactrl_qt.cpp index 9ba2a63902..46f9d53b55 100644 --- a/3rdparty/wxwidgets3.0/src/msw/mediactrl_qt.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/mediactrl_qt.cpp @@ -625,7 +625,7 @@ wxQTMediaBackend::~wxQTMediaBackend() //--------------------------------------------------------------------------- // wxQTMediaBackend::CreateControl // -// 1) Intializes QuickTime +// 1) Initializes QuickTime // 2) Creates the control window //--------------------------------------------------------------------------- bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, diff --git a/3rdparty/wxwidgets3.0/src/msw/menu.cpp b/3rdparty/wxwidgets3.0/src/msw/menu.cpp index 88682ec440..0f610c3965 100644 --- a/3rdparty/wxwidgets3.0/src/msw/menu.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/menu.cpp @@ -746,7 +746,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) { // we must use position in SetOwnerDrawnMenuItem because // all separators have the same id - int pos = 0; + int position = 0; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); while (node) { @@ -755,14 +755,14 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( !item->IsOwnerDrawn()) { item->SetOwnerDrawn(true); - SetOwnerDrawnMenuItem(GetHmenu(), pos, + SetOwnerDrawnMenuItem(GetHmenu(), position, reinterpret_cast(item), TRUE); } item->SetMarginWidth(m_maxBitmapWidth); node = node->GetNext(); - pos++; + position++; } // set menu as ownerdrawn diff --git a/3rdparty/wxwidgets3.0/src/msw/menuitem.cpp b/3rdparty/wxwidgets3.0/src/msw/menuitem.cpp index 7d10a044ac..2d53e1576d 100644 --- a/3rdparty/wxwidgets3.0/src/msw/menuitem.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/menuitem.cpp @@ -557,11 +557,12 @@ void wxMenuItem::Enable(bool enable) if ( m_isEnabled == enable ) return; - if ( m_parentMenu ) + const int itemPos = MSGetMenuItemPos(); + if ( itemPos != -1 ) { long rc = EnableMenuItem(GetHMenuOf(m_parentMenu), - GetMSWId(), - MF_BYCOMMAND | + itemPos, + MF_BYPOSITION | (enable ? MF_ENABLED : MF_GRAYED)); if ( rc == -1 ) @@ -872,7 +873,8 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, data->SeparatorMargin.ApplyTo(rcSeparator); RECT rcGutter = rcSelection; - rcGutter.right = data->ItemMargin.cxLeftWidth + rcGutter.right = rcGutter.left + + data->ItemMargin.cxLeftWidth + data->CheckBgMargin.cxLeftWidth + data->CheckMargin.cxLeftWidth + imgWidth @@ -993,13 +995,13 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, SIZE accelSize; ::GetTextExtentPoint32(hdc, accel.c_str(), accel.length(), &accelSize); - int flags = DST_TEXT; + flags = DST_TEXT; // themes menu is using specified color for disabled labels if ( data->MenuLayout() == MenuDrawData::Classic && (stat & wxODDisabled) && !(stat & wxODSelected) ) flags |= DSS_DISABLED; - int x = rcText.right - data->ArrowMargin.GetTotalX() + x = rcText.right - data->ArrowMargin.GetTotalX() - data->ArrowSize.cx - data->ArrowBorder; @@ -1009,7 +1011,7 @@ bool wxMenuItem::OnDrawItem(wxDC& dc, const wxRect& rc, else x -= m_parentMenu->GetMaxAccelWidth(); - int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; + y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2; ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel), accel.length(), x, y, 0, 0, flags); @@ -1271,7 +1273,7 @@ int wxMenuItem::MSGetMenuItemPos() const if ( state & MF_POPUP ) { - if ( ::GetSubMenu(hMenu, i) == (HMENU)id ) + if ( ::GetSubMenu(hMenu, i) == (HMENU)wxUIntToPtr(id) ) return i; } else if ( !(state & MF_SEPARATOR) ) diff --git a/3rdparty/wxwidgets3.0/src/msw/mimetype.cpp b/3rdparty/wxwidgets3.0/src/msw/mimetype.cpp index 84ff99912a..49900edef1 100644 --- a/3rdparty/wxwidgets3.0/src/msw/mimetype.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/mimetype.cpp @@ -66,6 +66,17 @@ class WXDLLIMPEXP_FWD_CORE wxIcon; // to open/print the file (the positional parameters are introduced by %1, // %2, ... in these strings, we change them to %s ourselves) +// Notice that HKCR can be used only when reading from the registry, when +// writing to it, we need to write to HKCU\Software\Classes instead as HKCR is +// a merged view of that location and HKLM\Software\Classes that we generally +// wouldn't have the write permissions to but writing to HKCR will try writing +// to the latter unless the key being written to already exists under the +// former, resulting in a "Permission denied" error without administrative +// permissions. So the right thing to do is to use HKCR when reading, to +// respect both per-user and machine-global associations, but only write under +// HKCU. +static const wxStringCharType *CLASSES_ROOT_KEY = wxS("Software\\Classes\\"); + // although I don't know of any official documentation which mentions this // location, uses it, so it isn't likely to change static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\"); @@ -190,7 +201,7 @@ size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs, bool wxFileTypeImpl::EnsureExtKeyExists() { - wxRegKey rkey(wxRegKey::HKCR, m_ext); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_ext); if ( !rkey.Exists() ) { if ( !rkey.Create() || !rkey.SetValue(wxEmptyString, m_strFileType) ) @@ -514,20 +525,6 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) return CreateFileType(wxEmptyString, ext); } -/* -wxFileType * -wxMimeTypesManagerImpl::GetOrAllocateFileTypeFromExtension(const wxString& ext) -{ - wxFileType *fileType = GetFileTypeFromExtension(ext); - if ( !fileType ) - { - fileType = CreateFileType(wxEmptyString, ext); - } - - return fileType; -} -*/ - // MIME type -> extension -> file type wxFileType * wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) @@ -591,11 +588,11 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) extWithDot = wxT('.'); extWithDot += ext; - // start by setting the HKCR\\.ext entries + // start by setting the entries under ".ext" // default is filetype; content type is mimetype const wxString& filetypeOrig = ftInfo.GetShortDesc(); - wxRegKey key(wxRegKey::HKCR, extWithDot); + wxRegKey key(wxRegKey::HKCU, CLASSES_ROOT_KEY + extWithDot); if ( !key.Exists() ) { // create the mapping from the extension to the filetype @@ -643,7 +640,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) // create the MIME key wxString strKey = MIME_DATABASE_KEY; strKey << mimetype; - wxRegKey keyMIME(wxRegKey::HKCR, strKey); + wxRegKey keyMIME(wxRegKey::HKCU, CLASSES_ROOT_KEY + strKey); ok = keyMIME.Create(); if ( ok ) @@ -664,7 +661,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) extWithDot = wxT('.'); extWithDot += ext; - wxRegKey key2(wxRegKey::HKCR, extWithDot); + wxRegKey key2(wxRegKey::HKCU, CLASSES_ROOT_KEY + extWithDot); if ( !key2.Exists() ) key2.Create(); key2.SetValue(wxEmptyString, filetype); @@ -681,7 +678,7 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) // create the MIME key wxString strKey = MIME_DATABASE_KEY; strKey << mimetype2; - wxRegKey keyMIME(wxRegKey::HKCR, strKey); + wxRegKey keyMIME(wxRegKey::HKCU, CLASSES_ROOT_KEY + strKey); ok = keyMIME.Create(); if ( ok ) @@ -692,11 +689,11 @@ wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) } } - } // end of for loop; all extensions now point to HKCR\.ext\Default + } // end of for loop; all extensions now point to .ext\Default // create the filetype key itself (it will be empty for now, but // SetCommand(), SetDefaultIcon() &c will use it later) - wxRegKey keyFT(wxRegKey::HKCR, filetype); + wxRegKey keyFT(wxRegKey::HKCU, CLASSES_ROOT_KEY + filetype); keyFT.Create(); wxFileType *ft = CreateFileType(filetype, extWithDot); @@ -724,66 +721,14 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd, if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); -#if 0 - if ( rkey.Exists() && overwriteprompt ) - { -#if wxUSE_GUI - wxString old; - rkey.QueryValue(wxEmptyString, old); - if ( wxMessageBox - ( - wxString::Format( - _("Do you want to overwrite the command used to %s " - "files with extension \"%s\" ?\nCurrent value is \n%s, " - "\nNew value is \n%s %1"), // bug here FIX need %1 ?? - verb.c_str(), - m_ext.c_str(), - old.c_str(), - cmd.c_str()), - _("Confirm registry update"), - wxYES_NO | wxICON_QUESTION - ) != wxYES ) -#endif // wxUSE_GUI - { - // cancelled by user - return false; - } - } -#endif + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + GetVerbPath(verb)); + // TODO: // 1. translate '%s' to '%1' instead of always adding it // 2. create DDEExec value if needed (undo GetCommand) return rkey.Create() && rkey.SetValue(wxEmptyString, cmd + wxT(" \"%1\"") ); } -/* // no longer used -bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig) -{ - wxCHECK_MSG( !m_ext.empty(), false, wxT("SetMimeType() needs extension") ); - - if ( !EnsureExtKeyExists() ) - return false; - - // VZ: is this really useful? (FIXME) - wxString mimeType; - if ( !mimeTypeOrig ) - { - // make up a default value for it - wxString cmd; - wxFileName::SplitPath(GetCommand(wxT("open")), NULL, &cmd, NULL); - mimeType << wxT("application/x-") << cmd; - } - else - { - mimeType = mimeTypeOrig; - } - - wxRegKey rkey(wxRegKey::HKCR, m_ext); - return rkey.Create() && rkey.SetValue(wxT("Content Type"), mimeType); -} -*/ - bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) { wxCHECK_MSG( !m_ext.empty(), false, wxT("SetDefaultIcon() needs extension") ); @@ -794,7 +739,8 @@ bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, m_strFileType + wxT("\\DefaultIcon")); + wxRegKey rkey(wxRegKey::HKCU, + CLASSES_ROOT_KEY + m_strFileType + wxT("\\DefaultIcon")); return rkey.Create() && rkey.SetValue(wxEmptyString, @@ -809,7 +755,7 @@ bool wxFileTypeImpl::SetDescription (const wxString& desc) if ( !EnsureExtKeyExists() ) return false; - wxRegKey rkey(wxRegKey::HKCR, m_strFileType ); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_strFileType ); return rkey.Create() && rkey.SetValue(wxEmptyString, desc); @@ -831,16 +777,6 @@ bool wxFileTypeImpl::Unassociate() if ( !RemoveDescription() ) result = false; -/* - //this might hold other keys, eg some have CSLID keys - if ( result ) - { - // delete the root key - wxRegKey key(wxRegKey::HKCR, m_ext); - if ( key.Exists() ) - result = key.DeleteSelf(); - } -*/ return result; } @@ -854,7 +790,7 @@ bool wxFileTypeImpl::RemoveCommand(const wxString& verb) wxCHECK_MSG( !m_ext.empty() && !verb.empty(), false, wxT("RemoveCommand() needs an extension and a verb") ); - wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + GetVerbPath(verb)); // if the key already doesn't exist, it's a success return !rkey.Exists() || rkey.DeleteSelf(); @@ -864,7 +800,7 @@ bool wxFileTypeImpl::RemoveMimeType() { wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveMimeType() needs extension") ); - wxRegKey rkey(wxRegKey::HKCR, m_ext); + wxRegKey rkey(wxRegKey::HKCU, CLASSES_ROOT_KEY + m_ext); return !rkey.Exists() || rkey.DeleteSelf(); } @@ -873,7 +809,8 @@ bool wxFileTypeImpl::RemoveDefaultIcon() wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveDefaultIcon() needs extension") ); - wxRegKey rkey (wxRegKey::HKCR, m_strFileType + wxT("\\DefaultIcon")); + wxRegKey rkey (wxRegKey::HKCU, + CLASSES_ROOT_KEY + m_strFileType + wxT("\\DefaultIcon")); return !rkey.Exists() || rkey.DeleteSelf(); } @@ -882,7 +819,7 @@ bool wxFileTypeImpl::RemoveDescription() wxCHECK_MSG( !m_ext.empty(), false, wxT("RemoveDescription() needs extension") ); - wxRegKey rkey (wxRegKey::HKCR, m_strFileType ); + wxRegKey rkey (wxRegKey::HKCU, CLASSES_ROOT_KEY + m_strFileType ); return !rkey.Exists() || rkey.DeleteSelf(); } diff --git a/3rdparty/wxwidgets3.0/src/msw/msgdlg.cpp b/3rdparty/wxwidgets3.0/src/msw/msgdlg.cpp index 1ad42ad427..526dacc405 100644 --- a/3rdparty/wxwidgets3.0/src/msw/msgdlg.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/msgdlg.cpp @@ -300,7 +300,7 @@ void wxMessageDialog::ReplaceStaticWithEdit() if ( !hwndBtn ) continue; // it's ok, not all buttons are always present - RECT rc = wxGetWindowRect(hwndBtn); + rc = wxGetWindowRect(hwndBtn); rc.top -= dh; rc.bottom -= dh; rc.left += dw/2; diff --git a/3rdparty/wxwidgets3.0/src/msw/notebook.cpp b/3rdparty/wxwidgets3.0/src/msw/notebook.cpp index 7b7848b100..59cee1addf 100644 --- a/3rdparty/wxwidgets3.0/src/msw/notebook.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/notebook.cpp @@ -1201,9 +1201,26 @@ WXHBRUSH wxNotebook::QueryBgBitmap() if ( r.IsEmpty() ) return 0; + wxUxThemeHandle theme(this, L"TAB"); + if ( !theme ) + return 0; + + RECT rc; + wxCopyRectToRECT(r, rc); + WindowHDC hDC(GetHwnd()); + wxUxThemeEngine::Get()->GetThemeBackgroundExtent + ( + theme, + (HDC) hDC, + 9 /* TABP_PANE */, + 0, + &rc, + &rc + ); + MemoryHDC hDCMem(hDC); - CompatibleBitmap hBmp(hDC, r.x + r.width, r.y + r.height); + CompatibleBitmap hBmp(hDC, rc.right, rc.bottom); SelectInHDC selectBmp(hDCMem, hBmp); @@ -1316,8 +1333,8 @@ wxColour wxNotebook::GetThemeBackgroundColour() const WCHAR szwThemeColor[256]; if (S_OK == wxUxThemeEngine::Get()->GetCurrentThemeName(szwThemeFile, 1024, szwThemeColor, 256, NULL, 0)) { - wxString themeFile(szwThemeFile), themeColor(szwThemeColor); - if (themeFile.Find(wxT("Aero")) != -1 && themeColor == wxT("NormalColor")) + wxString themeFile(szwThemeFile); + if (themeFile.Find(wxT("Aero")) != -1 && wxString(szwThemeColor) == wxT("NormalColor")) s_AeroStatus = 1; else s_AeroStatus = 0; diff --git a/3rdparty/wxwidgets3.0/src/msw/ole/activex.cpp b/3rdparty/wxwidgets3.0/src/msw/ole/activex.cpp index 654fe80c3a..293b31f8b3 100644 --- a/3rdparty/wxwidgets3.0/src/msw/ole/activex.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/ole/activex.cpp @@ -1007,13 +1007,13 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) // wxAutoOleInterface<> assumes a ref has already been added // TYPEATTR - TYPEATTR *ta = NULL; - hret = ti->GetTypeAttr(&ta); + TYPEATTR *ta2 = NULL; + hret = ti->GetTypeAttr(&ta2); CHECK_HR(hret); - if (ta->typekind == TKIND_DISPATCH) + if (ta2->typekind == TKIND_DISPATCH) { - // WXOLE_TRACEOUT("GUID = " << GetIIDName(ta->guid).c_str()); + // WXOLE_TRACEOUT("GUID = " << GetIIDName(ta2->guid).c_str()); if (defEventSink) { wxAutoIConnectionPoint cp; @@ -1022,8 +1022,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) wxAutoIConnectionPointContainer cpContainer(IID_IConnectionPointContainer, m_ActiveX); wxASSERT( cpContainer.IsOk()); - HRESULT hret = - cpContainer->FindConnectionPoint(ta->guid, cp.GetRef()); + hret = cpContainer->FindConnectionPoint(ta2->guid, cp.GetRef()); // Notice that the return value of CONNECT_E_NOCONNECTION is // expected if the interface doesn't support connection points. @@ -1035,7 +1034,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) if ( cp ) { wxActiveXEvents * const - events = new wxActiveXEvents(this, ta->guid); + events = new wxActiveXEvents(this, ta2->guid); hret = cp->Advise(events, &adviseCookie); // We don't need this object any more and cp will keep a @@ -1048,7 +1047,7 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk) } } - ti->ReleaseTypeAttr(ta); + ti->ReleaseTypeAttr(ta2); } // free diff --git a/3rdparty/wxwidgets3.0/src/msw/ole/dataobj.cpp b/3rdparty/wxwidgets3.0/src/msw/ole/dataobj.cpp index 2055a0a0de..20a37970ad 100644 --- a/3rdparty/wxwidgets3.0/src/msw/ole/dataobj.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/ole/dataobj.cpp @@ -48,7 +48,7 @@ #endif #include -#include +#include "wx/msw/wrapshl.h" #include "wx/msw/ole/oleutils.h" diff --git a/3rdparty/wxwidgets3.0/src/msw/ole/droptgt.cpp b/3rdparty/wxwidgets3.0/src/msw/ole/droptgt.cpp index 45b67c3c16..ba5aa41775 100644 --- a/3rdparty/wxwidgets3.0/src/msw/ole/droptgt.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/ole/droptgt.cpp @@ -39,7 +39,7 @@ #ifdef __WIN32__ #if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS - #include // for DROPFILES structure + #include "wx/msw/wrapshl.h" // for DROPFILES structure #endif #else #include diff --git a/3rdparty/wxwidgets3.0/src/msw/printwin.cpp b/3rdparty/wxwidgets3.0/src/msw/printwin.cpp index 6929bbfe39..cc7bcde400 100644 --- a/3rdparty/wxwidgets3.0/src/msw/printwin.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/printwin.cpp @@ -356,13 +356,13 @@ void wxWindowsPrintPreview::DetermineScaling() if ( printerDC.IsOk() ) { wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl(); - HDC dc = GetHdcOf(*impl); - printerWidthMM = ::GetDeviceCaps(dc, HORZSIZE); - printerHeightMM = ::GetDeviceCaps(dc, VERTSIZE); - printerXRes = ::GetDeviceCaps(dc, HORZRES); - printerYRes = ::GetDeviceCaps(dc, VERTRES); - logPPIPrinterX = ::GetDeviceCaps(dc, LOGPIXELSX); - logPPIPrinterY = ::GetDeviceCaps(dc, LOGPIXELSY); + HDC hdc = GetHdcOf(*impl); + printerWidthMM = ::GetDeviceCaps(hdc, HORZSIZE); + printerHeightMM = ::GetDeviceCaps(hdc, VERTSIZE); + printerXRes = ::GetDeviceCaps(hdc, HORZRES); + printerYRes = ::GetDeviceCaps(hdc, VERTRES); + logPPIPrinterX = ::GetDeviceCaps(hdc, LOGPIXELSX); + logPPIPrinterY = ::GetDeviceCaps(hdc, LOGPIXELSY); paperRect = printerDC.GetPaperRect(); diff --git a/3rdparty/wxwidgets3.0/src/msw/radiobox.cpp b/3rdparty/wxwidgets3.0/src/msw/radiobox.cpp index 053da03797..1f9132b627 100644 --- a/3rdparty/wxwidgets3.0/src/msw/radiobox.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/radiobox.cpp @@ -245,7 +245,9 @@ bool wxRadioBox::Create(wxWindow *parent, #endif SetMajorDim(majorDim == 0 ? n : majorDim, style); - SetSelection(0); + // Select the first radio button if we have any buttons at all. + if ( n > 0 ) + SetSelection(0); SetSize(pos.x, pos.y, size.x, size.y); // Now that we have items determine what is the best size and set it. diff --git a/3rdparty/wxwidgets3.0/src/msw/slider.cpp b/3rdparty/wxwidgets3.0/src/msw/slider.cpp index 992497c498..b4f5c2330d 100644 --- a/3rdparty/wxwidgets3.0/src/msw/slider.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/slider.cpp @@ -544,10 +544,8 @@ wxSize wxSlider::DoGetBestSize() const { int labelSize = GetLabelsSize(); - // Min/max labels are compensated by the ticks so we don't need - // extra space for them if we're also showing ticks. - if ( HasFlag(wxSL_MIN_MAX_LABELS) && !HasFlag(wxSL_TICKS) ) - size.y += labelSize; + // Min/max labels are compensated by the thumb so we don't need + // extra space for them // The value label is always on top of the control and so does need // extra space in any case. diff --git a/3rdparty/wxwidgets3.0/src/msw/spinbutt.cpp b/3rdparty/wxwidgets3.0/src/msw/spinbutt.cpp index b5f99d3853..c74360b00f 100644 --- a/3rdparty/wxwidgets3.0/src/msw/spinbutt.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/spinbutt.cpp @@ -79,11 +79,11 @@ bool wxSpinButton::Create(wxWindow *parent, // get the right size for the control if ( width <= 0 || height <= 0 ) { - wxSize size = DoGetBestSize(); + wxSize bestSize = DoGetBestSize(); if ( width <= 0 ) - width = size.x; + width = bestSize.x; if ( height <= 0 ) - height = size.y; + height = bestSize.y; } if ( x < 0 ) diff --git a/3rdparty/wxwidgets3.0/src/msw/spinctrl.cpp b/3rdparty/wxwidgets3.0/src/msw/spinctrl.cpp index 4610eef008..63fd43be1b 100644 --- a/3rdparty/wxwidgets3.0/src/msw/spinctrl.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/spinctrl.cpp @@ -196,12 +196,12 @@ void wxSpinCtrl::OnChar(wxKeyEvent& event) { case WXK_RETURN: { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); - InitCommandEvent(event); + wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId); + InitCommandEvent(evt); wxString val = wxGetWindowText(m_hwndBuddy); - event.SetString(val); - event.SetInt(GetValue()); - if ( HandleWindowEvent(event) ) + evt.SetString(val); + evt.SetInt(GetValue()); + if ( HandleWindowEvent(evt) ) return; break; } @@ -670,7 +670,7 @@ void wxSpinCtrl::DoSetToolTip(wxToolTip *tip) void wxSpinCtrl::SendSpinUpdate(int value) { - wxCommandEvent event(wxEVT_SPINCTRL, GetId()); + wxSpinEvent event(wxEVT_SPINCTRL, GetId()); event.SetEventObject(this); event.SetInt(value); diff --git a/3rdparty/wxwidgets3.0/src/msw/statbox.cpp b/3rdparty/wxwidgets3.0/src/msw/statbox.cpp index 9a5637c01b..940f8e7091 100644 --- a/3rdparty/wxwidgets3.0/src/msw/statbox.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/statbox.cpp @@ -479,8 +479,7 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&) // the label: this is consistent with the behaviour under pre-XP // systems (i.e. without visual themes) and generally makes sense wxBrush brush = wxBrush(GetBackgroundColour()); - wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); - ::FillRect(GetHdcOf(*impl), &dimensions, GetHbrushOf(brush)); + ::FillRect(hdc, &dimensions, GetHbrushOf(brush)); } else // paint parent background { diff --git a/3rdparty/wxwidgets3.0/src/msw/stattext.cpp b/3rdparty/wxwidgets3.0/src/msw/stattext.cpp index 1eb8b24acd..2574cfdb3b 100644 --- a/3rdparty/wxwidgets3.0/src/msw/stattext.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/stattext.cpp @@ -68,7 +68,7 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const // // note that both wxALIGN_LEFT and SS_LEFT are equal to 0 so we shouldn't // test for them using & operator - if ( style & wxALIGN_CENTRE ) + if ( style & wxALIGN_CENTRE_HORIZONTAL ) msStyle |= SS_CENTER; else if ( style & wxALIGN_RIGHT ) msStyle |= SS_RIGHT; diff --git a/3rdparty/wxwidgets3.0/src/msw/textctrl.cpp b/3rdparty/wxwidgets3.0/src/msw/textctrl.cpp index bf3b3b2f4e..aac039ae30 100644 --- a/3rdparty/wxwidgets3.0/src/msw/textctrl.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/textctrl.cpp @@ -169,7 +169,7 @@ class wxTextCtrlOleCallback : public IRichEditOleCallback { public: wxTextCtrlOleCallback(wxTextCtrl *text) : m_textCtrl(text), m_menu(NULL) {} - ~wxTextCtrlOleCallback() { DeleteContextMenuObject(); } + virtual ~wxTextCtrlOleCallback() { DeleteContextMenuObject(); } STDMETHODIMP ContextSensitiveHelp(BOOL WXUNUSED(enterMode)) { return E_NOTIMPL; } STDMETHODIMP DeleteObject(LPOLEOBJECT WXUNUSED(oleobj)) { return E_NOTIMPL; } @@ -1989,10 +1989,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) { case WXK_RETURN: { - wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId); - InitCommandEvent(event); - event.SetString(GetValue()); - if ( HandleWindowEvent(event) ) + wxCommandEvent evt(wxEVT_TEXT_ENTER, m_windowId); + InitCommandEvent(evt); + evt.SetString(GetValue()); + if ( HandleWindowEvent(evt) ) if ( !HasFlag(wxTE_MULTILINE) ) return; //else: multiline controls need Enter for themselves diff --git a/3rdparty/wxwidgets3.0/src/msw/textentry.cpp b/3rdparty/wxwidgets3.0/src/msw/textentry.cpp index e0467ec219..2d19794ae0 100644 --- a/3rdparty/wxwidgets3.0/src/msw/textentry.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/textentry.cpp @@ -81,9 +81,6 @@ // above. #include -namespace -{ - // Normally this interface and its IID are defined in shobjidl.h header file // included in the platform SDK but MinGW and Cygwin don't have it so redefine // the interface ourselves and, as long as we do it all, do it for all @@ -96,6 +93,9 @@ public: virtual HRESULT wxSTDCALL ResetEnumerator() = 0; }; +namespace +{ + DEFINE_GUID(wxIID_IAutoCompleteDropDown, 0x3cd141f4, 0x3c6a, 0x11d2, 0xbc, 0xaa, 0x00, 0xc0, 0x4f, 0xd9, 0x29, 0xdb); diff --git a/3rdparty/wxwidgets3.0/src/msw/thread.cpp b/3rdparty/wxwidgets3.0/src/msw/thread.cpp index 06e4da5024..0f2bb413a1 100644 --- a/3rdparty/wxwidgets3.0/src/msw/thread.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/thread.cpp @@ -27,7 +27,9 @@ #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/app.h" + #include "wx/log.h" #include "wx/module.h" + #include "wx/msgout.h" #endif #include "wx/apptrait.h" @@ -1417,8 +1419,17 @@ void WXDLLIMPEXP_BASE wxWakeUpMainThread() // sending any message would do - hopefully WM_NULL is harmless enough if ( !::PostThreadMessage(wxThread::GetMainId(), WM_NULL, 0, 0) ) { - // should never happen - wxLogLastError(wxT("PostThreadMessage(WM_NULL)")); + // should never happen, but log an error if it does, however do not use + // wxLog here as it would result in reentrancy because logging from a + // thread calls wxWakeUpIdle() which calls this function itself again + const unsigned long ec = wxSysErrorCode(); + wxMessageOutputDebug().Printf + ( + wxS("Failed to wake up main thread: PostThreadMessage(WM_NULL) ") + wxS("failed with error 0x%08lx (%s)."), + ec, + wxSysErrorMsg(ec) + ); } } diff --git a/3rdparty/wxwidgets3.0/src/msw/toolbar.cpp b/3rdparty/wxwidgets3.0/src/msw/toolbar.cpp index 6a4e23eef9..d15066127f 100644 --- a/3rdparty/wxwidgets3.0/src/msw/toolbar.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/toolbar.cpp @@ -235,7 +235,7 @@ public: } } - void ToBeDeleted() { m_toBeDeleted = true; } + void ToBeDeleted(bool toBeDeleted = true) { m_toBeDeleted = toBeDeleted; } bool IsToBeDeleted() const { return m_toBeDeleted; } private: @@ -296,6 +296,23 @@ static RECT wxGetTBItemRect(HWND hwnd, int index, int id = wxID_NONE) return r; } +static bool MSWShouldBeChecked(const wxToolBarToolBase *tool) +{ + // Apparently, "checked" state image overrides the "disabled" image + // so we need to enforce our custom "disabled" image (if there is any) + // to be drawn for checked and disabled button tool. + // Note: We believe this erroneous overriding is fixed in MSW 8. + if ( wxGetWinVersion() <= wxWinVersion_7 && + tool->GetKind() == wxITEM_CHECK && + tool->GetDisabledBitmap().IsOk() && + !tool->IsEnabled() ) + { + return false; + } + + return tool->IsToggled(); +} + // ============================================================================ // implementation // ============================================================================ @@ -561,8 +578,13 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const // ---------------------------------------------------------------------------- bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), - wxToolBarToolBase * WXUNUSED(tool)) + wxToolBarToolBase *tool) { + // We might be inserting back a tool previously removed from the toolbar, + // make sure to reset its "to be deleted" flag to ensure that we do take it + // into account during our layout even in this case. + static_cast(tool)->ToBeDeleted(false); + // nothing special to do here - we really create the toolbar buttons in // Realize() later InvalidateBestSize(); @@ -821,10 +843,10 @@ bool wxToolBar::Realize() // MapBitmap() to work correctly for ( int y = 0; y < h; y++ ) { - for ( int x = 0; x < w; x++ ) + for ( int xx = 0; xx < w; xx++ ) { - if ( imgGreyed.IsTransparent(x, y) ) - imgGreyed.SetRGB(x, y, + if ( imgGreyed.IsTransparent(xx, y) ) + imgGreyed.SetRGB(xx, y, wxLIGHT_GREY->Red(), wxLIGHT_GREY->Green(), wxLIGHT_GREY->Blue()); @@ -907,11 +929,11 @@ bool wxToolBar::Realize() if ( addBitmap ) // no old bitmap or we can't replace it { - TBADDBITMAP addBitmap; - addBitmap.hInst = 0; - addBitmap.nID = (UINT_PTR)hBitmap; + TBADDBITMAP tbAddBitmap; + tbAddBitmap.hInst = 0; + tbAddBitmap.nID = (UINT_PTR)hBitmap; if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP, - (WPARAM) nButtons, (LPARAM)&addBitmap) == -1 ) + (WPARAM) nButtons, (LPARAM)&tbAddBitmap) == -1 ) { wxFAIL_MSG(wxT("Could not add bitmap to toolbar")); } @@ -1006,7 +1028,7 @@ bool wxToolBar::Realize() if ( tool->IsEnabled() ) button.fsState |= TBSTATE_ENABLED; - if ( tool->IsToggled() ) + if ( MSWShouldBeChecked(tool) ) button.fsState |= TBSTATE_CHECKED; switch ( tool->GetKind() ) @@ -1033,12 +1055,12 @@ bool wxToolBar::Realize() while ( nodePrev ) { TBBUTTON& prevButton = buttons[prevIndex]; - wxToolBarToolBase *tool = nodePrev->GetData(); - if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) + wxToolBarToolBase *toolPrev = nodePrev->GetData(); + if ( !toolPrev->IsButton() || toolPrev->GetKind() != wxITEM_RADIO ) break; - if ( tool->Toggle(false) ) - DoToggleTool(tool, false); + if ( toolPrev->Toggle(false) ) + DoToggleTool(toolPrev, false); prevButton.fsState &= ~TBSTATE_CHECKED; nodePrev = nodePrev->GetPrevious(); @@ -1069,11 +1091,12 @@ bool wxToolBar::Realize() // Instead of using fixed widths for all buttons, size them // automatically according to the size of their bitmap and text - // label, if present. This particularly matters for toolbars - // with the wxTB_HORZ_LAYOUT style: they look hideously ugly - // without autosizing when the labels have even slightly - // different lengths. - button.fsStyle |= TBSTYLE_AUTOSIZE; + // label, if present. They look hideously ugly without autosizing + // when the labels have even slightly different lengths. + if ( HasFlag(wxTB_HORZ_LAYOUT) ) + { + button.fsStyle |= TBSTYLE_AUTOSIZE; + } bitmapId++; break; @@ -1393,13 +1416,24 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) bool allowLeftClick = OnLeftClick(id, toggled); + // Check if the tool hasn't been deleted in the event handler (notice that + // it's also possible that this tool was deleted and a new tool with the + // same ID was created, so we really need to check if the pointer to the + // tool with the given ID didn't change, not just that it's non null). + if ( FindById(id) != tool ) + { + // The rest of this event handler deals with updating the tool and must + // not be executed if the tool doesn't exist any more. + return true; + } + // Restore the unpressed state. Enabled/toggled state might have been // changed since so take care of it. if (tool->IsEnabled()) state |= TBSTATE_ENABLED; else state &= ~TBSTATE_ENABLED; - if (tool->IsToggled()) + if ( MSWShouldBeChecked(tool) ) state |= TBSTATE_CHECKED; else state &= ~TBSTATE_CHECKED; @@ -1412,7 +1446,8 @@ bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_) // revert back tool->Toggle(!toggled); - ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0)); + ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, + MAKELONG(MSWShouldBeChecked(tool), 0)); } return true; @@ -1654,14 +1689,34 @@ void wxToolBar::SetWindowStyleFlag(long style) void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable) { - ::SendMessage(GetHwnd(), TB_ENABLEBUTTON, - (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); + if ( tool->IsButton() ) + { + ::SendMessage(GetHwnd(), TB_ENABLEBUTTON, + (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); + + // Adjust displayed checked state -- it could have changed if the tool is + // disabled and has a custom "disabled state" bitmap. + DoToggleTool(tool, tool->IsToggled()); + } + else if ( tool->IsControl() ) + { + wxToolBarTool* tbTool = static_cast(tool); + + tbTool->GetControl()->Enable(enable); + wxStaticText* text = tbTool->GetStaticText(); + if ( text ) + text->Enable(enable); + } } -void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle) +void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, + bool WXUNUSED_UNLESS_DEBUG(toggle)) { + wxASSERT_MSG( tool->IsToggled() == toggle, wxT("Inconsistent tool state") ); + ::SendMessage(GetHwnd(), TB_CHECKBUTTON, - (WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0)); + (WPARAM)tool->GetId(), + (LPARAM)MAKELONG(MSWShouldBeChecked(tool), 0)); } void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) @@ -2056,11 +2111,7 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam #ifdef wxHAS_MSW_BACKGROUND_ERASE_HOOK case WM_PAINT: - // refreshing the controls in the toolbar inside a composite window - // results in an endless stream of WM_PAINT messages -- and seems - // to be unnecessary anyhow as everything works just fine without - // any special workarounds in this case - if ( !IsDoubleBuffered() && HandlePaint(wParam, lParam) ) + if ( HandlePaint(wParam, lParam) ) return 0; break; #endif // wxHAS_MSW_BACKGROUND_ERASE_HOOK diff --git a/3rdparty/wxwidgets3.0/src/msw/toplevel.cpp b/3rdparty/wxwidgets3.0/src/msw/toplevel.cpp index 962d84e654..28ee5a182f 100644 --- a/3rdparty/wxwidgets3.0/src/msw/toplevel.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/toplevel.cpp @@ -613,10 +613,11 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, memset(dlgTemplate, 0, dlgsize); // these values are arbitrary, they won't be used normally anyhow - dlgTemplate->x = 34; + const LONG baseUnits = ::GetDialogBaseUnits(); + dlgTemplate->x = 34; dlgTemplate->y = 22; - dlgTemplate->cx = 144; - dlgTemplate->cy = 75; + dlgTemplate->cx = ::MulDiv(sizeReal.x, 4, LOWORD(baseUnits)); + dlgTemplate->cy = ::MulDiv(sizeReal.y, 8, HIWORD(baseUnits)); // reuse the code in MSWGetStyle() but correct the results slightly for // the dialog diff --git a/3rdparty/wxwidgets3.0/src/msw/treectrl.cpp b/3rdparty/wxwidgets3.0/src/msw/treectrl.cpp index 754ea316c3..88149c29be 100644 --- a/3rdparty/wxwidgets3.0/src/msw/treectrl.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/treectrl.cpp @@ -1526,10 +1526,10 @@ wxTreeItemId wxTreeCtrl::DoInsertAfter(const wxTreeItemId& parent, // need this to make the "[+]" appear if ( firstChild ) { - TVGetItemRectParam param; + TVGetItemRectParam param2; - wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param, FALSE); - ::InvalidateRect(GetHwnd(), ¶m.rect, FALSE); + wxTreeView_GetItemRect(GetHwnd(), HITEM(parent), param2, FALSE); + ::InvalidateRect(GetHwnd(), ¶m2.rect, FALSE); } // associate the application tree item with Win32 tree item handle @@ -3639,8 +3639,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) { DWORD pos = GetMessagePos(); POINT point; - point.x = LOWORD(pos); - point.y = HIWORD(pos); + point.x = GET_X_LPARAM(pos); + point.y = GET_Y_LPARAM(pos); ::MapWindowPoints(HWND_DESKTOP, GetHwnd(), &point, 1); int htFlags = 0; wxTreeItemId item = HitTest(wxPoint(point.x, point.y), htFlags); @@ -3665,7 +3665,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( MSWIsOnItem(tvhti.flags) ) { event.m_item = tvhti.hItem; - eventType = (int)hdr->code == NM_DBLCLK + eventType = hdr->code == NM_DBLCLK ? wxEVT_TREE_ITEM_ACTIVATED : wxEVT_TREE_ITEM_RIGHT_CLICK; diff --git a/3rdparty/wxwidgets3.0/src/msw/utils.cpp b/3rdparty/wxwidgets3.0/src/msw/utils.cpp index 74a9991073..ab46c2d963 100644 --- a/3rdparty/wxwidgets3.0/src/msw/utils.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/utils.cpp @@ -384,9 +384,9 @@ const wxChar* wxGetHomeDir(wxString *pstr) // Cygwin returns unix type path but that does not work well static wxChar windowsPath[MAX_PATH]; #if CYGWIN_VERSION_DLL_MAJOR >= 1007 - cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir, windowsPath, MAX_PATH); + cygwin_conv_path(CCP_POSIX_TO_WIN_W, strDir.c_str(), windowsPath, MAX_PATH); #else - cygwin_conv_to_full_win32_path(strDir, windowsPath); + cygwin_conv_to_full_win32_path(strDir.c_str(), windowsPath); #endif strDir = windowsPath; #endif @@ -1336,7 +1336,7 @@ wxString wxGetOsDescription() case 10: str = wxIsWindowsServer() == 1 - ? _("Windows Server 10") + ? _("Windows Server 2016") : _("Windows 10"); break; } diff --git a/3rdparty/wxwidgets3.0/src/msw/uxtheme.cpp b/3rdparty/wxwidgets3.0/src/msw/uxtheme.cpp index ee30955555..18f8a867fa 100644 --- a/3rdparty/wxwidgets3.0/src/msw/uxtheme.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/uxtheme.cpp @@ -55,7 +55,7 @@ public: // something like this wxUxThemeEngine *themeEngine = wxUxThemeEngine::ms_themeEngine; wxUxThemeEngine::ms_themeEngine = NULL; - wxUxThemeEngine::ms_isThemeEngineAvailable = false; + wxUxThemeEngine::ms_isThemeEngineAvailable = -1; delete themeEngine; } diff --git a/3rdparty/wxwidgets3.0/src/msw/volume.cpp b/3rdparty/wxwidgets3.0/src/msw/volume.cpp index 2b38bc7310..a2932bf3d4 100644 --- a/3rdparty/wxwidgets3.0/src/msw/volume.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/volume.cpp @@ -44,7 +44,7 @@ // even if this is not necessary with most of them #include "wx/msw/wrapwin.h" #include -#include +#include "wx/msw/wrapshl.h" #include "wx/msw/missing.h" #if wxUSE_BASE @@ -614,11 +614,14 @@ wxIcon wxFSVolume::GetIcon(wxFSIconType type) const SHFILEINFO fi; long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags); - m_icons[type].SetHICON((WXHICON)fi.hIcon); if (!rc || !fi.hIcon) { wxLogError(_("Cannot load icon from '%s'."), m_volName.c_str()); } + else + { + m_icons[type].CreateFromHICON((WXHICON)fi.hIcon); + } } return m_icons[type]; diff --git a/3rdparty/wxwidgets3.0/src/msw/webview_ie.cpp b/3rdparty/wxwidgets3.0/src/msw/webview_ie.cpp index 74d1236cb3..714f411b7d 100644 --- a/3rdparty/wxwidgets3.0/src/msw/webview_ie.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/webview_ie.cpp @@ -26,6 +26,8 @@ #include "wx/msw/missing.h" #include "wx/filesys.h" #include "wx/dynlib.h" +#include "wx/scopeguard.h" + #include #include @@ -141,18 +143,89 @@ void wxWebViewIE::LoadURL(const wxString& url) m_ie.CallMethod("Navigate", wxConvertStringToOle(url)); } -void wxWebViewIE::DoSetPage(const wxString& html, const wxString& baseUrl) +namespace { - BSTR bstr = SysAllocString(OLESTR("")); - SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); - if (psaStrings != NULL) + +// Simple RAII wrapper for accessing SAFEARRAY. This class is not specific +// to wxWebView at all and could be extended to work for any type and extracted +// into a header later if it is ever needed elsewhere, but for now keep it here +// as it is only used in MakeOneElementVariantSafeArray() which, itself, is +// only used by DoSetPage() below. +class wxSafeArrayVariantAccessor +{ +public: + explicit wxSafeArrayVariantAccessor(SAFEARRAY* sa) + : m_sa(sa), + m_data(DoAccessData(sa)) + { + } + + VARIANT* GetData() const + { + return m_data; + } + + ~wxSafeArrayVariantAccessor() + { + if ( m_data ) + SafeArrayUnaccessData(m_sa); + } + +private: + static VARIANT* DoAccessData(SAFEARRAY* sa) { VARIANT *param; - HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m); - param->vt = VT_BSTR; - param->bstrVal = bstr; + HRESULT hr = SafeArrayAccessData(sa, (LPVOID*)¶m); + if ( FAILED(hr) ) + { + wxLogLastError(wxT("SafeArrayAccessData")); + return NULL; + } - hr = SafeArrayUnaccessData(psaStrings); + return param; + } + + SAFEARRAY* const m_sa; + VARIANT* const m_data; + + wxDECLARE_NO_COPY_CLASS(wxSafeArrayVariantAccessor); +}; + +// Helper function: wrap the given string in a SAFEARRAY of size 1. +SAFEARRAY* MakeOneElementVariantSafeArray(const wxString& str) +{ + SAFEARRAY* const sa = SafeArrayCreateVector(VT_VARIANT, 0, 1); + if ( !sa ) + { + wxLogLastError(wxT("SafeArrayCreateVector")); + return NULL; + } + + wxSafeArrayVariantAccessor access(sa); + + VARIANT* const param = access.GetData(); + if ( !param ) + { + SafeArrayDestroy(sa); + return NULL; + } + + param->vt = VT_BSTR; + param->bstrVal = SysAllocString(str.wc_str()); + + return sa; +} + +} // anonymous namespace + +void wxWebViewIE::DoSetPage(const wxString& html, const wxString& baseUrl) +{ + { + SAFEARRAY* const psaStrings = MakeOneElementVariantSafeArray(wxString()); + if ( !psaStrings ) + return; + + wxON_BLOCK_EXIT1(SafeArrayDestroy, psaStrings); wxCOMPtr document(GetDocument()); @@ -161,50 +234,34 @@ void wxWebViewIE::DoSetPage(const wxString& html, const wxString& baseUrl) document->write(psaStrings); document->close(); - - SafeArrayDestroy(psaStrings); - - bstr = SysAllocString(html.wc_str()); - - // Creates a new one-dimensional array - psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1); - if (psaStrings != NULL) - { - hr = SafeArrayAccessData(psaStrings, (LPVOID*)¶m); - param->vt = VT_BSTR; - param->bstrVal = bstr; - hr = SafeArrayUnaccessData(psaStrings); - - document = GetDocument(); - - if(!document) - return; - - document->write(psaStrings); - - // SafeArrayDestroy calls SysFreeString for each BSTR - SafeArrayDestroy(psaStrings); - - //We send the events when we are done to mimic webkit - //Navigated event - wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED, - GetId(), baseUrl, ""); - event.SetEventObject(this); - HandleWindowEvent(event); - - //Document complete event - event.SetEventType(wxEVT_WEBVIEW_LOADED); - event.SetEventObject(this); - HandleWindowEvent(event); - } - else - { - wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL"); - } } - else + { - wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL during clear"); + SAFEARRAY* const psaStrings = MakeOneElementVariantSafeArray(html); + + if ( !psaStrings ) + return; + + wxON_BLOCK_EXIT1(SafeArrayDestroy, psaStrings); + + wxCOMPtr document(GetDocument()); + + if(!document) + return; + + document->write(psaStrings); + + //We send the events when we are done to mimic webkit + //Navigated event + wxWebViewEvent event(wxEVT_WEBVIEW_NAVIGATED, + GetId(), baseUrl, ""); + event.SetEventObject(this); + HandleWindowEvent(event); + + //Document complete event + event.SetEventType(wxEVT_WEBVIEW_LOADED); + event.SetEventObject(this); + HandleWindowEvent(event); } } @@ -224,8 +281,8 @@ wxString wxWebViewIE::GetPageSource() const if(SUCCEEDED(hr)) { BSTR bstr; - htmlTag->get_outerHTML(&bstr); - source = wxString(bstr); + if ( htmlTag->get_outerHTML(&bstr) == S_OK ) + source = wxString(bstr); } } return source; @@ -565,16 +622,15 @@ wxString wxWebViewIE::GetCurrentTitle() const { wxCOMPtr document(GetDocument()); + wxString s; if(document) { BSTR title; - document->get_nameProp(&title); - return wxString(title); - } - else - { - return ""; + if ( document->get_nameProp(&title) == S_OK ) + s = title; } + + return s; } bool wxWebViewIE::CanCut() const @@ -699,16 +755,13 @@ bool wxWebViewIE::IsEditable() const if(document) { BSTR mode; - document->get_designMode(&mode); - if(wxString(mode) == "On") - return true; - else - return false; - } - else - { - return false; + if ( document->get_designMode(&mode) == S_OK ) + { + if ( wxString(mode) == "On" ) + return true; + } } + return false; } void wxWebViewIE::SelectAll() @@ -728,8 +781,8 @@ bool wxWebViewIE::HasSelection() const if(SUCCEEDED(hr)) { BSTR type; - selection->get_type(&type); - sel = wxString(type); + if ( selection->get_type(&type) == S_OK ) + sel = wxString(type); } return sel != "None"; } @@ -764,8 +817,8 @@ wxString wxWebViewIE::GetSelectedText() const if(SUCCEEDED(hr)) { BSTR text; - range->get_text(&text); - selected = wxString(text); + if ( range->get_text(&text) == S_OK ) + selected = wxString(text); } } } @@ -797,8 +850,8 @@ wxString wxWebViewIE::GetSelectedSource() const if(SUCCEEDED(hr)) { BSTR text; - range->get_htmlText(&text); - selected = wxString(text); + if ( range->get_htmlText(&text) == S_OK ) + selected = wxString(text); } } } @@ -838,8 +891,8 @@ wxString wxWebViewIE::GetPageText() const if(SUCCEEDED(hr)) { BSTR out; - body->get_innerText(&out); - text = wxString(out); + if ( body->get_innerText(&out) == S_OK ) + text = wxString(out); } return text; } diff --git a/3rdparty/wxwidgets3.0/src/msw/window.cpp b/3rdparty/wxwidgets3.0/src/msw/window.cpp index 55e8e948d3..584116a34d 100644 --- a/3rdparty/wxwidgets3.0/src/msw/window.cpp +++ b/3rdparty/wxwidgets3.0/src/msw/window.cpp @@ -1937,6 +1937,26 @@ wxWindowMSW::DoMoveSibling(WXHWND hwnd, int x, int y, int width, int height) // otherwise (or if deferring failed) move the window in place immediately #endif // wxUSE_DEFERRED_SIZING + + // toplevel window's coordinates are mirrored if the TLW is a child of another + // RTL window and changing width without moving the position would enlarge the + // window in the wrong direction, so we need to adjust for it + if ( IsTopLevel() ) + { + // note that this may be different from GetParent() for wxDialogs + HWND tlwParent = ::GetParent((HWND)hwnd); + if ( tlwParent && (::GetWindowLong(tlwParent, GWL_EXSTYLE) & WS_EX_LAYOUTRTL) != 0 ) + { + RECT old; + ::GetWindowRect((HWND) hwnd, &old); + if ( old.left == x && old.right - old.left != width ) + { + x -= width - (old.right - old.left); + } + // else: not a simple resize + } + } + if ( !::MoveWindow((HWND)hwnd, x, y, width, height, IsShown()) ) { wxLogLastError(wxT("MoveWindow")); @@ -2082,10 +2102,25 @@ void wxWindowMSW::DoSetClientSize(int width, int height) const int widthWin = rectWin.right - rectWin.left, heightWin = rectWin.bottom - rectWin.top; - // MoveWindow positions the child windows relative to the parent, so - // adjust if necessary - if ( !IsTopLevel() ) + if ( IsTopLevel() ) { + // toplevel window's coordinates are mirrored if the TLW is a child of another + // RTL window and changing width without moving the position would enlarge the + // window in the wrong direction, so we need to adjust for it + + // note that this may be different from GetParent() for wxDialogs + HWND tlwParent = ::GetParent(GetHwnd()); + if ( tlwParent && (::GetWindowLong(tlwParent, GWL_EXSTYLE) & WS_EX_LAYOUTRTL) != 0 ) + { + const int diffWidth = width - (rectClient.right - rectClient.left); + rectWin.left -= diffWidth; + rectWin.right -= diffWidth; + } + } + else + { + // MoveWindow positions the child windows relative to the parent, so + // adjust if necessary wxWindow *parent = GetParent(); if ( parent ) { @@ -2769,17 +2804,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_MOVING: { LPRECT pRect = (LPRECT)lParam; - wxRect rc; - rc.SetLeft(pRect->left); - rc.SetTop(pRect->top); - rc.SetRight(pRect->right); - rc.SetBottom(pRect->bottom); - processed = HandleMoving(rc); + wxRect rect; + rect.SetLeft(pRect->left); + rect.SetTop(pRect->top); + rect.SetRight(pRect->right); + rect.SetBottom(pRect->bottom); + processed = HandleMoving(rect); if (processed) { - pRect->left = rc.GetLeft(); - pRect->top = rc.GetTop(); - pRect->right = rc.GetRight(); - pRect->bottom = rc.GetBottom(); + pRect->left = rect.GetLeft(); + pRect->top = rect.GetTop(); + pRect->right = rect.GetRight(); + pRect->bottom = rect.GetBottom(); } } break; @@ -2799,17 +2834,17 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, case WM_SIZING: { LPRECT pRect = (LPRECT)lParam; - wxRect rc; - rc.SetLeft(pRect->left); - rc.SetTop(pRect->top); - rc.SetRight(pRect->right); - rc.SetBottom(pRect->bottom); - processed = HandleSizing(rc); + wxRect rect; + rect.SetLeft(pRect->left); + rect.SetTop(pRect->top); + rect.SetRight(pRect->right); + rect.SetBottom(pRect->bottom); + processed = HandleSizing(rect); if (processed) { - pRect->left = rc.GetLeft(); - pRect->top = rc.GetTop(); - pRect->right = rc.GetRight(); - pRect->bottom = rc.GetBottom(); + pRect->left = rect.GetLeft(); + pRect->top = rect.GetTop(); + pRect->right = rect.GetRight(); + pRect->bottom = rect.GetBottom(); } } break; @@ -3245,7 +3280,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, #if wxUSE_HOTKEY case WM_HOTKEY: - processed = HandleHotKey((WORD)wParam, lParam); + processed = HandleHotKey(wParam, lParam); break; #endif // wxUSE_HOTKEY @@ -3386,7 +3421,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, if (dwObjId == (LPARAM)OBJID_CLIENT && GetOrCreateAccessible()) { - return LresultFromObject(IID_IAccessible, wParam, (IUnknown*) GetAccessible()->GetIAccessible()); + processed = true; + rc.result = LresultFromObject(IID_IAccessible, wParam, (IUnknown*) GetAccessible()->GetIAccessible()); } break; } @@ -5015,7 +5051,13 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child) RECT rc; ::GetWindowRect(GetHwndOf(child), &rc); - ::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1); + // It is important to pass both points to MapWindowPoints() as in + // addition to converting them to our coordinate system, this function + // will also exchange the left and right coordinates if this window + // uses RTL layout, which is exactly what we need here as the child + // window origin is its _right_ top corner in this case and not the + // left one. + ::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 2); int x = rc.left, y = rc.top;