From 809d9b747a6b2227e25a62b0efedd9902eb86a60 Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 30 Dec 2010 16:50:20 +0000 Subject: [PATCH] Added some ifdefs around the vc9 fixes so that mse still compiles with msvc7 and wxWidget 2.6 git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1568 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/icon_menu.cpp | 3 ++- src/gui/util.cpp | 9 ++++++++- src/main.cpp | 4 ++-- src/mse.vc71.vcproj | 6 +++++- src/util/error.cpp | 2 +- src/util/prec.hpp | 13 ++++++++++++- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/gui/icon_menu.cpp b/src/gui/icon_menu.cpp index 81943745..15441e17 100644 --- a/src/gui/icon_menu.cpp +++ b/src/gui/icon_menu.cpp @@ -48,9 +48,10 @@ Image generateDisabledImage(const Image& imgIn) { // ----------------------------------------------------------------------------- : set_menu_item_image void set_menu_item_image(wxMenuItem* item, const String& resource) { +if(item->GetId() != wxID_NEW)return;//@@@ // load bitmap Bitmap bitmap = load_resource_tool_image(resource); - #ifdef __WXMSW__ + #if defined(__WXMSW__) // make greyed bitmap bitmap = bitmap.GetSubBitmap(wxRect(0,0,16,16)); Image disabledImage = generateDisabledImage(bitmap.ConvertToImage()); diff --git a/src/gui/util.cpp b/src/gui/util.cpp index c3f7b1d0..d4725083 100644 --- a/src/gui/util.cpp +++ b/src/gui/util.cpp @@ -266,7 +266,7 @@ void draw_control_box(Window* win, DC& dc, const wxRect& rect, bool focused, boo } void draw_button(Window* win, DC& dc, const wxRect& rect, bool focused, bool down, bool enabled) { - #if 1 + #if wxVERSION >= 2700 wxRendererNative& rn = wxRendererNative::GetDefault(); rn.DrawPushButton(win, dc, rect, (focused ? wxCONTROL_FOCUSED : 0) | (down ? wxCONTROL_PRESSED : 0) | (enabled ? 0 : wxCONTROL_DISABLED)); #else @@ -341,6 +341,13 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected, bool focused, bool hot) { #if wxUSE_UXTHEME && defined(__WXMSW__) + #if WINVER <= 0x0500 + #define LISS_NORMAL LIS_NORMAL + #define LISS_SELECTED LIS_SELECTED + #define LISS_SELECTEDNOTFOCUS LIS_SELECTEDNOTFOCUS + #define LISS_HOT LISS_NORMAL + #define LISS_HOTSELECTED LISS_SELECTED + #endif wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get(); if (themeEngine && themeEngine->IsAppThemed()) { wxUxThemeHandle hTheme(win, L"LISTVIEW"); diff --git a/src/main.cpp b/src/main.cpp index 384fd628..babbfc52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,7 +51,7 @@ class MSE : public wxApp { /// Hack around some wxWidget idiocies int FilterEvent(wxEvent& ev); /// Fancier assert - #if defined(_MSC_VER) && defined(_DEBUG) + #if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRT_WIDE) void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg); #endif }; @@ -275,7 +275,7 @@ void MSE::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& even } CATCH_ALL_ERRORS(true); } -#if defined(_MSC_VER) && defined(_DEBUG) +#if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRT_WIDE) // Print assert failures to debug output void MSE::OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg) { #ifdef UNICODE diff --git a/src/mse.vc71.vcproj b/src/mse.vc71.vcproj index 235d9932..125fa518 100644 --- a/src/mse.vc71.vcproj +++ b/src/mse.vc71.vcproj @@ -38,7 +38,8 @@ WarningLevel="4" WarnAsError="TRUE" Detect64BitPortabilityProblems="TRUE" - DebugInformationFormat="4"/> + DebugInformationFormat="4" + DisableSpecificWarnings="4671;4673"/> + + diff --git a/src/util/error.cpp b/src/util/error.cpp index d94497ec..74b740b3 100644 --- a/src/util/error.cpp +++ b/src/util/error.cpp @@ -18,7 +18,7 @@ DECLARE_TYPEOF_COLLECTION(ScriptParseError); // ----------------------------------------------------------------------------- : Debug utilities -#if defined(_MSC_VER) && defined(_DEBUG) +#if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRT_WIDE) void msvc_assert(const wchar_t* msg, const wchar_t* expr, const wchar_t* file, unsigned line) { if (IsDebuggerPresent()) { wchar_t buffer[1024]; diff --git a/src/util/prec.hpp b/src/util/prec.hpp index dd99262e..947f6049 100644 --- a/src/util/prec.hpp +++ b/src/util/prec.hpp @@ -18,6 +18,7 @@ # pragma warning (disable: 4100) // unreferenced formal parameter # pragma warning (disable: 4355) // 'this' : used in base member initializer list # pragma warning (disable: 4800) // 'int' : forcing value to bool 'true' or 'false' (performance warning) +# pragma warning (disable: 4675) // resolved overload was found by argument-dependent lookup (occurs in some boost header) #endif // ----------------------------------------------------------------------------- : Includes @@ -64,6 +65,16 @@ typedef wxOutputStream OutputStream; // wx >= 2.9 requires the use of HandleWindowEvent on windows, instead of ProcessEvent #define HandleWindowEvent ProcessEvent #endif +#if wxVERSION_NUMBER < 2700 + // is it worth it to still support wx2.6? + #define wxFD_SAVE wxSAVE + #define wxFD_OPEN wxOPEN + #define wxFD_OVERWRITE_PROMPT wxOVERWRITE_PROMPT + #define SetDeviceClippingRegion SetClippingRegion + typedef wxEvent wxMouseCaptureLostEvent; + #define EVT_MOUSE_CAPTURE_LOST(handler) // ignore + #define wxEVT_MOUSE_CAPTURE_LOST 12345678 // not an actual event type +#endif // ----------------------------------------------------------------------------- : Other aliasses @@ -101,7 +112,7 @@ class FileName : public wxString { #define for if(false);else for #endif - #ifdef _DEBUG + #if defined(_DEBUG) && defined(_CRT_WIDE) // Use OutputDebugString/DebugBreak for assertions if in debug mode void msvc_assert(const wchar_t*, const wchar_t*, const wchar_t*, unsigned); #undef assert