(view as text)
diff --git a/Externals/wxWidgets3/CMakeLists.txt b/Externals/wxWidgets3/CMakeLists.txt
index 6629d08..b2a74d4 100644
--- a/Externals/wxWidgets3/CMakeLists.txt
+++ b/Externals/wxWidgets3/CMakeLists.txt
@@ -1,4 +1,4 @@
-# gtk, msw, osx and shared files as of r74856
+# gtk, msw, osx and shared files as of r75363
set(SRCS_AUI
"src/aui/auibar.cpp"
@@ -906,6 +906,7 @@ add_definitions(-Wno-shadow)
add_definitions(-Wno-parentheses-equality)
add_definitions(-Wno-self-assign)
add_definitions(-Wno-null-conversion)
+add_definitions(-Wno-sign-compare)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
enable_precompiled_headers(include/wx/wxprec.h src/common/dummy.cpp SRCS)
diff --git a/Externals/wxWidgets3/build_wx.sh b/Externals/wxWidgets3/build_wx.sh
index 39c7d97..89281b4 100755
--- a/Externals/wxWidgets3/build_wx.sh
+++ b/Externals/wxWidgets3/build_wx.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-svn co -r 74856 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets
+svn co -r 75363 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets
cd wxWidgets
case $OSTYPE in
diff --git a/Externals/wxWidgets3/include/msvc/wx/setup.h b/Externals/wxWidgets3/include/msvc/wx/setup.h
index 31c5efc..7a8d472 100644
--- a/Externals/wxWidgets3/include/msvc/wx/setup.h
+++ b/Externals/wxWidgets3/include/msvc/wx/setup.h
@@ -148,6 +148,9 @@
#pragma comment(lib, wxWX_LIB_NAME("base", ""))
#ifndef wxNO_NET_LIB
+ #ifndef WXUSINGDLL
+ #pragma comment(lib, "wsock32")
+ #endif
#pragma comment(lib, wxBASE_LIB_NAME("net"))
#endif
#ifndef wxNO_XML_LIB
@@ -235,7 +238,6 @@
#pragma comment(lib, "uuid")
#pragma comment(lib, "rpcrt4")
#pragma comment(lib, "advapi32")
- #pragma comment(lib, "wsock32")
#if wxUSE_URL_NATIVE
#pragma comment(lib, "wininet")
#endif
diff --git a/Externals/wxWidgets3/include/wx/bitmap.h b/Externals/wxWidgets3/include/wx/bitmap.h
index 506ef69..bcb189c 100644
--- a/Externals/wxWidgets3/include/wx/bitmap.h
+++ b/Externals/wxWidgets3/include/wx/bitmap.h
@@ -175,7 +175,7 @@ public:
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) = 0;
virtual bool CreateScaled(int w, int h, int d, double logicalScale)
- { return Create(w*logicalScale,h*logicalScale,d); }
+ { return Create(wxRound(w*logicalScale), wxRound(h*logicalScale), d); }
virtual int GetHeight() const = 0;
virtual int GetWidth() const = 0;
@@ -189,7 +189,7 @@ public:
virtual double GetScaledWidth() const { return GetWidth() / GetScaleFactor(); }
virtual double GetScaledHeight() const { return GetHeight() / GetScaleFactor(); }
virtual wxSize GetScaledSize() const
- { return wxSize(GetScaledWidth(), GetScaledHeight()); }
+ { return wxSize(wxRound(GetScaledWidth()), wxRound(GetScaledHeight())); }
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const = 0;
diff --git a/Externals/wxWidgets3/include/wx/buffer.h b/Externals/wxWidgets3/include/wx/buffer.h
index c88e160..9891494 100644
--- a/Externals/wxWidgets3/include/wx/buffer.h
+++ b/Externals/wxWidgets3/include/wx/buffer.h
@@ -268,9 +268,22 @@ public:
wxCharTypeBuffer(size_t len)
{
- this->m_data =
- new Data((CharType *)malloc((len + 1)*sizeof(CharType)), len);
- this->m_data->Get()[len] = (CharType)0;
+ CharType* const str = (CharType *)malloc((len + 1)*sizeof(CharType));
+ if ( str )
+ {
+ str[len] = (CharType)0;
+
+ // There is a potential memory leak here if new throws because it
+ // fails to allocate Data, we ought to use new(nothrow) here, but
+ // this might fail to compile under some platforms so until this
+ // can be fully tested, just live with this (rather unlikely, as
+ // Data is a small object) potential leak.
+ this->m_data = new Data(str, len);
+ }
+ else
+ {
+ this->m_data = this->GetNullData();
+ }
}
wxCharTypeBuffer(const wxCharTypeBuffer& src)
diff --git a/Externals/wxWidgets3/include/wx/choicdlg.h b/Externals/wxWidgets3/include/wx/choicdlg.h
index 863b880..0ab4c07 100644
--- a/Externals/wxWidgets3/include/wx/choicdlg.h
+++ b/Externals/wxWidgets3/include/wx/choicdlg.h
@@ -11,11 +11,12 @@
#ifndef _WX_CHOICDLG_H_BASE_
#define _WX_CHOICDLG_H_BASE_
+#include "wx/defs.h"
+
#if wxUSE_CHOICEDLG
#include "wx/generic/choicdgg.h"
#endif
-#endif
- // _WX_CHOICDLG_H_BASE_
+#endif // _WX_CHOICDLG_H_BASE_
diff --git a/Externals/wxWidgets3/include/wx/combo.h b/Externals/wxWidgets3/include/wx/combo.h
index 4bae2cf..6a040b3 100644
--- a/Externals/wxWidgets3/include/wx/combo.h
+++ b/Externals/wxWidgets3/include/wx/combo.h
@@ -560,7 +560,7 @@ protected:
// just recalculate.
void CalculateAreas( int btnWidth = 0 );
- // Standard textctrl positioning routine. Just give it platform-dependant
+ // Standard textctrl positioning routine. Just give it platform-dependent
// textctrl coordinate adjustment.
virtual void PositionTextCtrl( int textCtrlXAdjust = 0,
int textCtrlYAdjust = 0);
@@ -701,7 +701,7 @@ protected:
// area used by the button
wxSize m_btnSize;
- // platform-dependant customization and other flags
+ // platform-dependent customization and other flags
wxUint32 m_iFlags;
// custom style for m_text
diff --git a/Externals/wxWidgets3/include/wx/compiler.h b/Externals/wxWidgets3/include/wx/compiler.h
index e633ca1..5ad4df8 100644
--- a/Externals/wxWidgets3/include/wx/compiler.h
+++ b/Externals/wxWidgets3/include/wx/compiler.h
@@ -19,7 +19,7 @@
/*
Notice that Intel compiler can be used as Microsoft Visual C++ add-on and
so we should define both __INTELC__ and __VISUALC__ for it.
- */
+*/
#ifdef __INTEL_COMPILER
# define __INTELC__
#endif
@@ -135,15 +135,40 @@
#endif
/*
- This macro can be used to check that the version of mingw32 compiler is
- at least maj.min
+ This macro can be used to check that the version of mingw32 CRT is at least
+ maj.min
*/
/* Check for Mingw runtime version: */
-#if defined(__MINGW32_MAJOR_VERSION) && defined(__MINGW32_MINOR_VERSION)
+#ifdef __MINGW32__
+ /* Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION */
+ #include <_mingw.h>
+
#define wxCHECK_MINGW32_VERSION( major, minor ) \
( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
|| ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
+
+/*
+ MinGW-w64 project provides compilers for both Win32 and Win64 but only
+ defines the same __MINGW32__ symbol for the former as MinGW32 toolchain
+ which is quite different (notably doesn't provide many SDK headers that
+ MinGW-w64 does include). So we define a separate symbol which, unlike the
+ predefined __MINGW64__, can be used to detect this toolchain in both 32 and
+ 64 bit builds.
+
+ And define __MINGW32_TOOLCHAIN__ for consistency and also because it's
+ convenient as we often want to have some workarounds only for the (old)
+ MinGW32 but not (newer) MinGW-w64, which still predefines __MINGW32__.
+ */
+# ifdef __MINGW64_VERSION_MAJOR
+# ifndef __MINGW64_TOOLCHAIN__
+# define __MINGW64_TOOLCHAIN__
+# endif
+# else
+# ifndef __MINGW32_TOOLCHAIN__
+# define __MINGW32_TOOLCHAIN__
+# endif
+# endif
#else
#define wxCHECK_MINGW32_VERSION( major, minor ) (0)
#endif
diff --git a/Externals/wxWidgets3/include/wx/dataview.h b/Externals/wxWidgets3/include/wx/dataview.h
index 298ab7f..2aa4a60 100644
--- a/Externals/wxWidgets3/include/wx/dataview.h
+++ b/Externals/wxWidgets3/include/wx/dataview.h
@@ -972,6 +972,7 @@ public:
void InsertItem( unsigned int row, const wxVector<wxVariant> &values, wxUIntPtr data = 0 );
void DeleteItem( unsigned int pos );
void DeleteAllItems();
+ void ClearColumns();
unsigned int GetItemCount() const;
@@ -1040,6 +1041,7 @@ public:
virtual bool PrependColumn( wxDataViewColumn *col );
virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
virtual bool AppendColumn( wxDataViewColumn *col );
+ virtual bool ClearColumns();
wxDataViewColumn *AppendTextColumn( const wxString &label,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
diff --git a/Externals/wxWidgets3/include/wx/defs.h b/Externals/wxWidgets3/include/wx/defs.h
index 00c6427..a15f7cc 100644
--- a/Externals/wxWidgets3/include/wx/defs.h
+++ b/Externals/wxWidgets3/include/wx/defs.h
@@ -310,8 +310,10 @@ typedef short int WXTYPE;
inline T wx_truncate_cast_impl(X x)
{
#pragma warning(push)
- /* conversion from 'X' to 'T', possible loss of data */
+ /* conversion from 'size_t' to 'type', possible loss of data */
#pragma warning(disable: 4267)
+ /* conversion from 'type1' to 'type2', possible loss of data */
+ #pragma warning(disable: 4242)
return x;
@@ -951,6 +953,10 @@ typedef wxUint16 wxWord;
#define SIZEOF_LONG 4
#endif
+ #ifndef SIZEOF_LONG_LONG
+ #define SIZEOF_LONG_LONG 8
+ #endif
+
#ifndef SIZEOF_WCHAR_T
/* Windows uses UTF-16 */
#define SIZEOF_WCHAR_T 2
@@ -2287,8 +2293,13 @@ enum wxStandardID
wxID_OSX_HIDE = wxID_OSX_MENU_FIRST,
wxID_OSX_HIDEOTHERS,
wxID_OSX_SHOWALL,
+#if wxABI_VERSION >= 30001
+ wxID_OSX_SERVICES,
+ wxID_OSX_MENU_LAST = wxID_OSX_SERVICES,
+#else
wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL,
-
+#endif
+
/* IDs used by generic file dialog (13 consecutive starting from this value) */
wxID_FILEDLGG = 5900,
diff --git a/Externals/wxWidgets3/include/wx/dialog.h b/Externals/wxWidgets3/include/wx/dialog.h
index e32cabb..7110151 100644
--- a/Externals/wxWidgets3/include/wx/dialog.h
+++ b/Externals/wxWidgets3/include/wx/dialog.h
@@ -13,6 +13,7 @@
#include "wx/toplevel.h"
#include "wx/containr.h"
+#include "wx/sharedptr.h"
class WXDLLIMPEXP_FWD_CORE wxSizer;
class WXDLLIMPEXP_FWD_CORE wxStdDialogButtonSizer;
@@ -402,24 +403,29 @@ class wxWindowModalDialogEventFunctor
{
public:
wxWindowModalDialogEventFunctor(const Functor& f)
- : m_f(f), m_wasCalled(false)
+ : m_f(new Functor(f))
{}
void operator()(wxWindowModalDialogEvent& event)
{
- if ( m_wasCalled )
+ if ( m_f )
+ {
+ // We only want to call this handler once. Also, by deleting
+ // the functor here, its data (such as wxWindowPtr pointing to
+ // the dialog) are freed immediately after exiting this operator().
+ wxSharedPtr<Functor> functor(m_f);
+ m_f.reset();
+
+ (*functor)(event.GetReturnCode());
+ }
+ else // was already called once
{
event.Skip();
- return;
}
-
- m_wasCalled = true;
- m_f(event.GetReturnCode());
}
private:
- Functor m_f;
- bool m_wasCalled;
+ wxSharedPtr<Functor> m_f;
};
template<typename Functor>
@@ -428,7 +434,7 @@ void wxDialogBase::ShowWindowModalThenDo(const Functor& onEndModal)
Bind(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,
wxWindowModalDialogEventFunctor<Functor>(onEndModal));
ShowWindowModal();
-};
+}
#endif // wxHAS_EVENT_BIND
#endif
diff --git a/Externals/wxWidgets3/include/wx/docview.h b/Externals/wxWidgets3/include/wx/docview.h
index 44fbe90..78bf44d 100644
--- a/Externals/wxWidgets3/include/wx/docview.h
+++ b/Externals/wxWidgets3/include/wx/docview.h
@@ -279,6 +279,9 @@ public:
// destroyed
void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame);
+ // get the associated frame, may be NULL during destruction
+ wxDocChildFrameAnyBase* GetDocChildFrame() const { return m_docChildFrame; }
+
protected:
// hook the document into event handlers chain here
virtual bool TryBefore(wxEvent& event);
@@ -597,9 +600,10 @@ public:
m_childDocument = NULL;
m_childView = NULL;
m_win = NULL;
+ m_lastEvent = NULL;
}
- // full ctor equivalent to using the default one and Create(0
+ // full ctor equivalent to using the default one and Create()
wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win)
{
Create(doc, view, win);
@@ -638,6 +642,14 @@ public:
wxWindow *GetWindow() const { return m_win; }
+ // implementation only
+
+ // Check if this event had been just processed in this frame.
+ bool HasAlreadyProcessed(wxEvent& event) const
+ {
+ return m_lastEvent == &event;
+ }
+
protected:
// we're not a wxEvtHandler but we provide this wxEvtHandler-like function
// which is called from TryBefore() of the derived classes to give our view
@@ -656,6 +668,10 @@ protected:
// allows us to avoid having any virtual functions in this class
wxWindow* m_win;
+private:
+ // Pointer to the last processed event used to avoid sending the same event
+ // twice to wxDocManager, from here and from wxDocParentFrameAnyBase.
+ wxEvent* m_lastEvent;
wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase);
};
@@ -894,7 +910,11 @@ protected:
// hook the document manager into event handling chain here
virtual bool TryBefore(wxEvent& event)
{
- return TryProcessEvent(event) || BaseFrame::TryBefore(event);
+ // It is important to send the event to the base class first as
+ // wxMDIParentFrame overrides its TryBefore() to send the menu events
+ // to the currently active child frame and the child must get them
+ // before our own TryProcessEvent() is executed, not afterwards.
+ return BaseFrame::TryBefore(event) || TryProcessEvent(event);
}
private:
diff --git a/Externals/wxWidgets3/include/wx/dvrenderers.h b/Externals/wxWidgets3/include/wx/dvrenderers.h
index 3f623cf..775bc1a 100644
--- a/Externals/wxWidgets3/include/wx/dvrenderers.h
+++ b/Externals/wxWidgets3/include/wx/dvrenderers.h
@@ -163,9 +163,7 @@ public:
virtual bool IsCustomRenderer() const { return false; }
-protected:
- // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
- void DestroyEditControl();
+ // Implementation only from now on.
// Return the alignment of this renderer if it's specified (i.e. has value
// different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of
@@ -176,6 +174,10 @@ protected:
// wxDVR_DEFAULT_ALIGNMENT.
int GetEffectiveAlignment() const;
+protected:
+ // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
+ void DestroyEditControl();
+
wxString m_variantType;
wxDataViewColumn *m_owner;
wxWeakRef<wxWindow> m_editorCtrl;
diff --git a/Externals/wxWidgets3/include/wx/event.h b/Externals/wxWidgets3/include/wx/event.h
index 1dcdf33..61ec19c 100644
--- a/Externals/wxWidgets3/include/wx/event.h
+++ b/Externals/wxWidgets3/include/wx/event.h
@@ -2275,19 +2275,36 @@ private:
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
{
public:
- wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0)
- : wxEvent(Id, type)
- { m_active = active; }
+ // Type of activation. For now we can only detect if it was by mouse or by
+ // some other method and even this is only available under wxMSW.
+ enum Reason
+ {
+ Reason_Mouse,
+ Reason_Unknown
+ };
+
+ wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true,
+ int Id = 0, Reason activationReason = Reason_Unknown)
+ : wxEvent(Id, type),
+ m_activationReason(activationReason)
+ {
+ m_active = active;
+ }
wxActivateEvent(const wxActivateEvent& event)
: wxEvent(event)
- { m_active = event.m_active; }
+ {
+ m_active = event.m_active;
+ m_activationReason = event.m_activationReason;
+ }
bool GetActive() const { return m_active; }
+ Reason GetActivationReason() const { return m_activationReason;}
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
private:
bool m_active;
+ Reason m_activationReason;
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
diff --git a/Externals/wxWidgets3/include/wx/features.h b/Externals/wxWidgets3/include/wx/features.h
index 84a6c35..765f0f7 100644
--- a/Externals/wxWidgets3/include/wx/features.h
+++ b/Externals/wxWidgets3/include/wx/features.h
@@ -116,7 +116,8 @@
*/
#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) \
|| (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \
- || (defined(__xlC__) && __xlC__ >= 0x700)
+ || (defined(__xlC__) && __xlC__ >= 0x700) \
+ || defined(__INTELC__)
#define wxHAS_EVENT_BIND
#endif
diff --git a/Externals/wxWidgets3/include/wx/filefn.h b/Externals/wxWidgets3/include/wx/filefn.h
index a5bcd7e..95b3051 100644
--- a/Externals/wxWidgets3/include/wx/filefn.h
+++ b/Externals/wxWidgets3/include/wx/filefn.h
@@ -77,7 +77,7 @@
// constants
// ----------------------------------------------------------------------------
-#if defined(__VISUALC__) || defined(__INTELC__) || defined(__DIGITALMARS__)
+#if defined(__VISUALC__) || defined(__DIGITALMARS__)
typedef int mode_t;
#endif
@@ -204,7 +204,7 @@ enum wxPosixPermissions
#if defined(__VISUALC__)
#define wxHAS_HUGE_FILES 1
#elif defined(__MINGW32__) || defined(__MINGW64__)
- #define wxHAS_HUGE_FILES 1
+ #define wxHAS_HUGE_FILES 1f
#elif defined(_LARGE_FILES)
#define wxHAS_HUGE_FILES 1
#endif
@@ -476,7 +476,6 @@ enum wxPosixPermissions
#define wxSeek lseek
#define wxFsync fsync
#define wxEof eof
-
#define wxCRT_MkDir mkdir
#define wxCRT_RmDir rmdir
diff --git a/Externals/wxWidgets3/include/wx/fontutil.h b/Externals/wxWidgets3/include/wx/fontutil.h
index caad365..a4e0a7d 100644
--- a/Externals/wxWidgets3/include/wx/fontutil.h
+++ b/Externals/wxWidgets3/include/wx/fontutil.h
@@ -142,9 +142,7 @@ public:
return *this;
}
-#if wxOSX_USE_CORE_TEXT
void Init(CTFontDescriptorRef descr);
-#endif
void Init(const wxNativeFontInfo& info);
void Init(int size,
wxFontFamily family,
diff --git a/Externals/wxWidgets3/include/wx/fswatcher.h b/Externals/wxWidgets3/include/wx/fswatcher.h
index 2955407..056780d 100644
--- a/Externals/wxWidgets3/include/wx/fswatcher.h
+++ b/Externals/wxWidgets3/include/wx/fswatcher.h
@@ -66,6 +66,13 @@ enum wxFSWPathType
wxFSWPath_Tree // Watch a directory and all its children recursively.
};
+// Type of the warning for the events notifying about them.
+enum wxFSWWarningType
+{
+ wxFSW_WARNING_NONE,
+ wxFSW_WARNING_GENERAL,
+ wxFSW_WARNING_OVERFLOW
+};
/**
* Event containing information about file system change.
@@ -77,24 +84,36 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_FSWATCHER,
class WXDLLIMPEXP_BASE wxFileSystemWatcherEvent: public wxEvent
{
public:
+ // Constructor for any kind of events, also used as default ctor.
wxFileSystemWatcherEvent(int changeType = 0, int watchid = wxID_ANY) :
wxEvent(watchid, wxEVT_FSWATCHER),
- m_changeType(changeType)
+ m_changeType(changeType),
+ m_warningType(wxFSW_WARNING_NONE)
{
}
- wxFileSystemWatcherEvent(int changeType, const wxString& errorMsg,
+ // Constructor for the error or warning events.
+ wxFileSystemWatcherEvent(int changeType,
+ wxFSWWarningType warningType,
+ const wxString& errorMsg = wxString(),
int watchid = wxID_ANY) :
wxEvent(watchid, wxEVT_FSWATCHER),
- m_changeType(changeType), m_errorMsg(errorMsg)
+ m_changeType(changeType),
+ m_warningType(warningType),
+ m_errorMsg(errorMsg)
{
}
+ // Constructor for the normal events carrying information about the changes.
wxFileSystemWatcherEvent(int changeType,
const wxFileName& path, const wxFileName& newPath,
int watchid = wxID_ANY) :
wxEvent(watchid, wxEVT_FSWATCHER),
- m_changeType(changeType), m_path(path), m_newPath(newPath)
+ m_changeType(changeType),
+ m_warningType(wxFSW_WARNING_NONE),
+ m_path(path),
+ m_newPath(newPath)
+
{
}
@@ -146,6 +165,7 @@ public:
evt->m_errorMsg = m_errorMsg.Clone();
evt->m_path = wxFileName(m_path.GetFullPath().Clone());
evt->m_newPath = wxFileName(m_newPath.GetFullPath().Clone());
+ evt->m_warningType = m_warningType;
return evt;
}
@@ -168,6 +188,11 @@ public:
return m_errorMsg;
}
+ wxFSWWarningType GetWarningType() const
+ {
+ return m_warningType;
+ }
+
/**
* Returns a wxString describing an event useful for debugging or testing
*/
@@ -175,6 +200,7 @@ public:
protected:
int m_changeType;
+ wxFSWWarningType m_warningType;
wxFileName m_path;
wxFileName m_newPath;
wxString m_errorMsg;
diff --git a/Externals/wxWidgets3/include/wx/generic/dataview.h b/Externals/wxWidgets3/include/wx/generic/dataview.h
index 396c81b..f3ac8ee 100644
--- a/Externals/wxWidgets3/include/wx/generic/dataview.h
+++ b/Externals/wxWidgets3/include/wx/generic/dataview.h
@@ -227,6 +227,9 @@ public: // utility functions not part of the API
// return the index of the given column in m_cols
int GetColumnIndex(const wxDataViewColumn *column) const;
+ // Return the index of the column having the given model index.
+ int GetModelColumnIndex(unsigned int model_column) const;
+
// return the column displayed at the given position in the control
wxDataViewColumn *GetColumnAt(unsigned int pos) const;
diff --git a/Externals/wxWidgets3/include/wx/generic/grideditors.h b/Externals/wxWidgets3/include/wx/generic/grideditors.h
index a81ab84..c45106d 100644
--- a/Externals/wxWidgets3/include/wx/generic/grideditors.h
+++ b/Externals/wxWidgets3/include/wx/generic/grideditors.h
@@ -15,6 +15,8 @@
#if wxUSE_GRID
+#include "wx/scopedptr.h"
+
class wxGridCellEditorEvtHandler : public wxEvtHandler
{
public:
diff --git a/Externals/wxWidgets3/include/wx/generic/infobar.h b/Externals/wxWidgets3/include/wx/generic/infobar.h
index 781698c..4a6bf2b 100644
--- a/Externals/wxWidgets3/include/wx/generic/infobar.h
+++ b/Externals/wxWidgets3/include/wx/generic/infobar.h
@@ -79,6 +79,9 @@ public:
// (default font is a larger and bold version of the normal one)
virtual bool SetFont(const wxFont& font);
+ // same thing with the colour: this affects the text colour
+ virtual bool SetForegroundColour(const wxColor& colour);
+
protected:
// info bar shouldn't have any border by default, the colour difference
// between it and the main window separates it well enough
diff --git a/Externals/wxWidgets3/include/wx/generic/statbmpg.h b/Externals/wxWidgets3/include/wx/generic/statbmpg.h
index 8a8fa15..f3d198d 100644
--- a/Externals/wxWidgets3/include/wx/generic/statbmpg.h
+++ b/Externals/wxWidgets3/include/wx/generic/statbmpg.h
@@ -60,8 +60,8 @@ public:
private:
wxSize GetBitmapSize()
{
- return m_bitmap.IsOk() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight())
- : wxSize(16, 16); // this is completely arbitrary
+ return m_bitmap.IsOk() ? m_bitmap.GetScaledSize()
+ : wxSize(16, 16); // this is completely arbitrary
}
void OnPaint(wxPaintEvent& event);
diff --git a/Externals/wxWidgets3/include/wx/gtk/bitmap.h b/Externals/wxWidgets3/include/wx/gtk/bitmap.h
index 42e2d4d..d035f2c 100644
--- a/Externals/wxWidgets3/include/wx/gtk/bitmap.h
+++ b/Externals/wxWidgets3/include/wx/gtk/bitmap.h
@@ -103,7 +103,6 @@ public:
wxMask *GetMask() const;
void SetMask( wxMask *mask );
- wxBitmap GetMaskBitmap() const;
wxBitmap GetSubBitmap( const wxRect& rect ) const;
diff --git a/Externals/wxWidgets3/include/wx/gtk/dialog.h b/Externals/wxWidgets3/include/wx/gtk/dialog.h
index bc6e862..fcd7cd3 100644
--- a/Externals/wxWidgets3/include/wx/gtk/dialog.h
+++ b/Externals/wxWidgets3/include/wx/gtk/dialog.h
@@ -39,15 +39,13 @@ public:
virtual void EndModal( int retCode );
virtual bool IsModal() const;
- // implementation
- // --------------
-
- bool m_modalShowing;
-
private:
// common part of all ctors
void Init();
+
+ bool m_modalShowing;
wxGUIEventLoop *m_modalLoop;
+
DECLARE_DYNAMIC_CLASS(wxDialog)
};
diff --git a/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h b/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h
index 21ee1b0..e69de29 100644
--- a/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h
+++ b/Externals/wxWidgets3/include/wx/gtk/gnome/gprint.h
@@ -1,351 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: wx/gtk/gnome/gprint.h
-// Author: Robert Roebling
-// Purpose: GNOME printing support
-// Created: 09/20/04
-// Copyright: Robert Roebling
-// Licence: wxWindows Licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_GTK_GPRINT_H_
-#define _WX_GTK_GPRINT_H_
-
-#include "wx/defs.h"
-
-#if wxUSE_LIBGNOMEPRINT
-
-#include "wx/print.h"
-#include "wx/printdlg.h"
-#include "wx/dc.h"
-#include "wx/module.h"
-
-typedef struct _GnomePrintJob GnomePrintJob;
-typedef struct _GnomePrintContext GnomePrintContext;
-typedef struct _GnomePrintConfig GnomePrintConfig;
-
-// ----------------------------------------------------------------------------
-// wxGnomePrintModule
-// ----------------------------------------------------------------------------
-
-class wxGnomePrintModule: public wxModule
-{
-public:
- wxGnomePrintModule() {}
- bool OnInit();
- void OnExit();
-
-private:
- DECLARE_DYNAMIC_CLASS(wxGnomePrintModule)
-};
-
-//----------------------------------------------------------------------------
-// wxGnomePrintNativeData
-//----------------------------------------------------------------------------
-
-class wxGnomePrintNativeData: public wxPrintNativeDataBase
-{
-public:
- wxGnomePrintNativeData();
- virtual ~wxGnomePrintNativeData();
-
- virtual bool TransferTo( wxPrintData &data );
- virtual bool TransferFrom( const wxPrintData &data );
-
- virtual bool Ok() const { return IsOk(); }
- virtual bool IsOk() const { return true; }
-
- GnomePrintConfig* GetPrintConfig() { return m_config; }
- void SetPrintJob( GnomePrintJob *job ) { m_job = job; }
- GnomePrintJob* GetPrintJob() { return m_job; }
-
-
-private:
- GnomePrintConfig *m_config;
- GnomePrintJob *m_job;
-
- DECLARE_DYNAMIC_CLASS(wxGnomePrintNativeData)
-};
-
-//----------------------------------------------------------------------------
-// wxGnomePrintFactory
-//----------------------------------------------------------------------------
-
-class wxGnomePrintFactory: public wxPrintFactory
-{
-public:
- virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
-
- virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
- wxPrintout *printout = NULL,
- wxPrintDialogData *data = NULL );
- virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
- wxPrintout *printout,
- wxPrintData *data );
-
- virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
- wxPrintDialogData *data = NULL );
- virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
- wxPrintData *data );
-
- virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
- wxPageSetupDialogData * data = NULL );
-
-#if wxUSE_NEW_DC
- virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
-#else
- virtual wxDC* CreatePrinterDC( const wxPrintData& data );
-#endif
-
- virtual bool HasPrintSetupDialog();
- virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
- virtual bool HasOwnPrintToFile();
- virtual bool HasPrinterLine();
- virtual wxString CreatePrinterLine();
- virtual bool HasStatusLine();
- virtual wxString CreateStatusLine();
-
- virtual wxPrintNativeDataBase *CreatePrintNativeData();
-};
-
-//----------------------------------------------------------------------------
-// wxGnomePrintDialog
-//----------------------------------------------------------------------------
-
-class wxGnomePrintDialog: public wxPrintDialogBase
-{
-public:
- wxGnomePrintDialog( wxWindow *parent,
- wxPrintDialogData* data = NULL );
- wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
- virtual ~wxGnomePrintDialog();
-
- wxPrintData& GetPrintData()
- { return m_printDialogData.GetPrintData(); }
- wxPrintDialogData& GetPrintDialogData()
- { return m_printDialogData; }
-
- wxDC *GetPrintDC();
-
- virtual int ShowModal();
-
- virtual bool Validate();
- virtual bool TransferDataToWindow();
- virtual bool TransferDataFromWindow();
-
-protected:
- // Implement some base class methods to do nothing to avoid asserts and
- // GTK warnings, since this is not a real wxDialog.
- virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
- int WXUNUSED(width), int WXUNUSED(height),
- int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
- virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
- int WXUNUSED(width), int WXUNUSED(height)) {}
-
-private:
- void Init();
- wxPrintDialogData m_printDialogData;
-
- DECLARE_DYNAMIC_CLASS(wxGnomePrintDialog)
-};
-
-//----------------------------------------------------------------------------
-// wxGnomePageSetupDialog
-//----------------------------------------------------------------------------
-
-class wxGnomePageSetupDialog: public wxPageSetupDialogBase
-{
-public:
- wxGnomePageSetupDialog( wxWindow *parent,
- wxPageSetupDialogData* data = NULL );
- virtual ~wxGnomePageSetupDialog();
-
- virtual wxPageSetupDialogData& GetPageSetupDialogData();
-
- virtual int ShowModal();
-
- virtual bool Validate();
- virtual bool TransferDataToWindow();
- virtual bool TransferDataFromWindow();
-
-protected:
- // Implement some base class methods to do nothing to avoid asserts and
- // GTK warnings, since this is not a real wxDialog.
- virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
- int WXUNUSED(width), int WXUNUSED(height),
- int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
- virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
- int WXUNUSED(width), int WXUNUSED(height)) {}
-
-private:
- wxPageSetupDialogData m_pageDialogData;
-
- DECLARE_DYNAMIC_CLASS(wxGnomePageSetupDialog)
-};
-
-//----------------------------------------------------------------------------
-// wxGnomePrinter
-//----------------------------------------------------------------------------
-
-class wxGnomePrinter: public wxPrinterBase
-{
-public:
- wxGnomePrinter(wxPrintDialogData *data = NULL);
- virtual ~wxGnomePrinter();
-
- virtual bool Print(wxWindow *parent,
- wxPrintout *printout,
- bool prompt = true);
- virtual wxDC* PrintDialog(wxWindow *parent);
- virtual bool Setup(wxWindow *parent);
-
-private:
- bool m_native_preview;
-
-private:
- DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
- wxDECLARE_NO_COPY_CLASS(wxGnomePrinter);
-};
-
-//-----------------------------------------------------------------------------
-// wxGnomePrinterDC
-//-----------------------------------------------------------------------------
-
-#if wxUSE_NEW_DC
-class wxGnomePrinterDCImpl : public wxDCImpl
-#else
-#define wxGnomePrinterDCImpl wxGnomePrinterDC
-class wxGnomePrinterDC : public wxDC
-#endif
-{
-public:
-#if wxUSE_NEW_DC
- wxGnomePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
-#else
- wxGnomePrinterDC( const wxPrintData& data );
-#endif
- virtual ~wxGnomePrinterDCImpl();
-
- bool Ok() const { return IsOk(); }
- bool IsOk() const;
-
- bool CanDrawBitmap() const { return true; }
- void Clear();
- void SetFont( const wxFont& font );
- void SetPen( const wxPen& pen );
- void SetBrush( const wxBrush& brush );
- void SetLogicalFunction( wxRasterOperationMode function );
- void SetBackground( const wxBrush& brush );
- void DestroyClippingRegion();
- bool StartDoc(const wxString& message);
- void EndDoc();
- void StartPage();
- void EndPage();
- wxCoord GetCharHeight() const;
- wxCoord GetCharWidth() const;
- bool CanGetTextExtent() const { return true; }
- wxSize GetPPI() const;
- virtual int GetDepth() const { return 24; }
- void SetBackgroundMode(int WXUNUSED(mode)) { }
- void SetPalette(const wxPalette& WXUNUSED(palette)) { }
-
-protected:
- bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
- wxFloodFillStyle style=wxFLOOD_SURFACE );
- bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
- void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
- void DoCrossHair(wxCoord x, wxCoord y);
- void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
- void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
- void DoDrawPoint(wxCoord x, wxCoord y);
- void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
- void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
- void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
- void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
- void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
- void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
-#if wxUSE_SPLINES
- void DoDrawSpline(const wxPointList *points);
-#endif
- bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc,
- wxRasterOperationMode = wxCOPY, bool useMask = false,
- wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
- void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
- void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
- void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
- void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
- void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
- void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) )
- {
- wxFAIL_MSG( "not implemented" );
- }
- void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
- wxCoord *descent = NULL,
- wxCoord *externalLeading = NULL,
- const wxFont *theFont = NULL ) const;
- void DoGetSize(int* width, int* height) const;
- void DoGetSizeMM(int *width, int *height) const;
-
- void SetPrintData(const wxPrintData& data);
- wxPrintData& GetPrintData() { return m_printData; }
-
- // overridden for wxPrinterDC Impl
- virtual wxRect GetPaperRect() const;
- virtual int GetResolution() const;
-
- virtual void* GetHandle() const { return (void*)m_gpc; }
-
-private:
- wxPrintData m_printData;
- PangoContext *m_context;
- PangoLayout *m_layout;
- PangoFontDescription *m_fontdesc;
-
- unsigned char m_currentRed;
- unsigned char m_currentGreen;
- unsigned char m_currentBlue;
-
- double m_pageHeight;
-
- GnomePrintContext *m_gpc;
- GnomePrintJob* m_job;
-
- void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
-
-private:
- DECLARE_DYNAMIC_CLASS(wxGnomePrinterDCImpl)
- wxDECLARE_NO_COPY_CLASS(wxGnomePrinterDCImpl);
-};
-
-// ----------------------------------------------------------------------------
-// wxGnomePrintPreview: programmer creates an object of this class to preview a
-// wxPrintout.
-// ----------------------------------------------------------------------------
-
-class wxGnomePrintPreview : public wxPrintPreviewBase
-{
-public:
- wxGnomePrintPreview(wxPrintout *printout,
- wxPrintout *printoutForPrinting = NULL,
- wxPrintDialogData *data = NULL);
- wxGnomePrintPreview(wxPrintout *printout,
- wxPrintout *printoutForPrinting,
- wxPrintData *data);
-
- virtual ~wxGnomePrintPreview();
-
- virtual bool Print(bool interactive);
- virtual void DetermineScaling();
-
-private:
- void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
-
-private:
- DECLARE_CLASS(wxGnomePrintPreview)
-};
-
-
-#endif
- // wxUSE_LIBGNOMEPRINT
-
-#endif
diff --git a/Externals/wxWidgets3/include/wx/gtk/private.h b/Externals/wxWidgets3/include/wx/gtk/private.h
index dfe8889..4c52f53 100644
--- a/Externals/wxWidgets3/include/wx/gtk/private.h
+++ b/Externals/wxWidgets3/include/wx/gtk/private.h
@@ -16,6 +16,11 @@
#include "wx/gtk/private/string.h"
#include "wx/gtk/private/gtk2-compat.h"
+#ifndef G_VALUE_INIT
+ // introduced in GLib 2.30
+ #define G_VALUE_INIT { 0, { { 0 } } }
+#endif
+
// pango_version_check symbol is quite recent ATM (4/2007)... so we
// use our own wrapper which implements a smart trick.
// Use this function as you'd use pango_version_check:
diff --git a/Externals/wxWidgets3/include/wx/gtk/spinbutt.h b/Externals/wxWidgets3/include/wx/gtk/spinbutt.h
index 4a9d204..4bd71f4 100644
--- a/Externals/wxWidgets3/include/wx/gtk/spinbutt.h
+++ b/Externals/wxWidgets3/include/wx/gtk/spinbutt.h
@@ -47,8 +47,6 @@ public:
virtual bool Enable( bool enable = true );
// implementation
- void OnSize( wxSizeEvent &event );
-
int m_pos;
protected:
@@ -61,9 +59,7 @@ protected:
private:
typedef wxSpinButtonBase base_type;
- DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxSpinButton)
};
-#endif
- // _WX_GTK_SPINBUTT_H_
+#endif // _WX_GTK_SPINBUTT_H_
diff --git a/Externals/wxWidgets3/include/wx/gtk/textentry.h b/Externals/wxWidgets3/include/wx/gtk/textentry.h
index 5df686c..3d9da82 100644
--- a/Externals/wxWidgets3/include/wx/gtk/textentry.h
+++ b/Externals/wxWidgets3/include/wx/gtk/textentry.h
@@ -48,6 +48,11 @@ public:
virtual void SetMaxLength(unsigned long len);
+#ifdef __WXGTK3__
+ virtual bool SetHint(const wxString& hint);
+ virtual wxString GetHint() const;
+#endif
+
// implementation only from now on
void SendMaxLenEvent();
bool GTKEntryOnInsertText(const char* text);
diff --git a/Externals/wxWidgets3/include/wx/listbase.h b/Externals/wxWidgets3/include/wx/listbase.h
index 80f65f2..5e6fb7c 100644
--- a/Externals/wxWidgets3/include/wx/listbase.h
+++ b/Externals/wxWidgets3/include/wx/listbase.h
@@ -510,7 +510,7 @@ public:
const wxString& GetLabel() const { return m_item.m_text; }
const wxString& GetText() const { return m_item.m_text; }
int GetImage() const { return m_item.m_image; }
- long GetData() const { return static_cast<long>(m_item.m_data); }
+ wxUIntPtr GetData() const { return m_item.m_data; }
long GetMask() const { return m_item.m_mask; }
const wxListItem& GetItem() const { return m_item; }
diff --git a/Externals/wxWidgets3/include/wx/math.h b/Externals/wxWidgets3/include/wx/math.h
index 2787163..89a1b94 100644
--- a/Externals/wxWidgets3/include/wx/math.h
+++ b/Externals/wxWidgets3/include/wx/math.h
@@ -60,7 +60,7 @@
#elif defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
#include <float.h>
#define wxFinite(x) _finite(x)
-#elif defined(__MINGW64__) || defined(__clang__)
+#elif defined(__MINGW64_TOOLCHAIN__) || defined(__clang__)
/*
add more compilers with C99 support here: using C99 isfinite() is
preferable to using BSD-ish finite()
diff --git a/Externals/wxWidgets3/include/wx/msw/combobox.h b/Externals/wxWidgets3/include/wx/msw/combobox.h
index 8649187..5fc7cc5 100644
--- a/Externals/wxWidgets3/include/wx/msw/combobox.h
+++ b/Externals/wxWidgets3/include/wx/msw/combobox.h
@@ -133,6 +133,9 @@ protected:
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
+ // Override this one to avoid eating events from our popup listbox.
+ virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const;
+
// this is the implementation of GetEditHWND() which can also be used when
// we don't have the edit control, it simply returns NULL then
//
diff --git a/Externals/wxWidgets3/include/wx/msw/control.h b/Externals/wxWidgets3/include/wx/msw/control.h
index 29897ad..35bf74e 100644
--- a/Externals/wxWidgets3/include/wx/msw/control.h
+++ b/Externals/wxWidgets3/include/wx/msw/control.h
@@ -121,6 +121,9 @@ protected:
// one
virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd);
+ // Look in our GetSubcontrols() for the windows with the given ID.
+ virtual wxWindow *MSWFindItem(long id, WXHWND hWnd) const;
+
// for controls like radiobuttons which are really composite this array
// holds the ids (not HWNDs!) of the sub controls
wxArrayLong m_subControls;
diff --git a/Externals/wxWidgets3/include/wx/msw/datectrl.h b/Externals/wxWidgets3/include/wx/msw/datectrl.h
index e3f95e8..7ec52f0 100644
--- a/Externals/wxWidgets3/include/wx/msw/datectrl.h
+++ b/Externals/wxWidgets3/include/wx/msw/datectrl.h
@@ -54,7 +54,9 @@ public:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
protected:
+#if wxUSE_INTL
virtual wxLocaleInfo MSWGetFormat() const;
+#endif // wxUSE_INTL
virtual bool MSWAllowsNone() const { return HasFlag(wxDP_ALLOWNONE); }
virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch);
diff --git a/Externals/wxWidgets3/include/wx/msw/datetimectrl.h b/Externals/wxWidgets3/include/wx/msw/datetimectrl.h
index eb93f26..dcb4d4e 100644
--- a/Externals/wxWidgets3/include/wx/msw/datetimectrl.h
+++ b/Externals/wxWidgets3/include/wx/msw/datetimectrl.h
@@ -55,12 +55,14 @@ protected:
// override these methods anyhow, it does work -- but is definitely ugly
// and need to be changed (but how?) in the future.
+#if wxUSE_INTL
// Override to return the date/time format used by this control.
virtual wxLocaleInfo MSWGetFormat() const /* = 0 */
{
wxFAIL_MSG( "Unreachable" );
return wxLOCALE_TIME_FMT;
}
+#endif // wxUSE_INTL
// Override to indicate whether we can have no date at all.
virtual bool MSWAllowsNone() const /* = 0 */
diff --git a/Externals/wxWidgets3/include/wx/msw/genrcdefs.h b/Externals/wxWidgets3/include/wx/msw/genrcdefs.h
index 8bab95b..809419b 100644
--- a/Externals/wxWidgets3/include/wx/msw/genrcdefs.h
+++ b/Externals/wxWidgets3/include/wx/msw/genrcdefs.h
@@ -19,7 +19,7 @@ EMIT(#define wxUSE_RC_MANIFEST 1)
EMIT(#define wxUSE_RC_MANIFEST 1)
#endif
-#ifdef _M_AMD64
+#if defined _M_AMD64 || defined __x86_64__
EMIT(#define WX_CPU_AMD64)
#endif
@@ -27,7 +27,7 @@ EMIT(#define WX_CPU_AMD64)
EMIT(#define WX_CPU_ARM)
#endif
-#ifdef _M_IA64
+#if defined _M_IA64 || defined __ia64__
EMIT(#define WX_CPU_IA64)
#endif
diff --git a/Externals/wxWidgets3/include/wx/msw/missing.h b/Externals/wxWidgets3/include/wx/msw/missing.h
index d2782ef..e7522ee 100644
--- a/Externals/wxWidgets3/include/wx/msw/missing.h
+++ b/Externals/wxWidgets3/include/wx/msw/missing.h
@@ -664,7 +664,7 @@ typedef struct
#include <_mingw.h>
#endif
-#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
+#ifdef __MINGW32_TOOLCHAIN__
typedef enum CommandStateChangeConstants {
CSC_UPDATECOMMANDS = (int) 0xFFFFFFFF,
CSC_NAVIGATEFORWARD = 0x1,
diff --git a/Externals/wxWidgets3/include/wx/msw/msvcrt.h b/Externals/wxWidgets3/include/wx/msw/msvcrt.h
index 692f19e..e92a88d 100644
--- a/Externals/wxWidgets3/include/wx/msw/msvcrt.h
+++ b/Externals/wxWidgets3/include/wx/msw/msvcrt.h
@@ -37,7 +37,12 @@
#endif
#include <stdlib.h>
- #ifndef _CRTBLD
+
+ // Defining _CRTBLD should never be necessary at all, but keep it for now
+ // as there is no time to retest all the compilers before 3.0 release.
+ // Definitely do not use it with MSVS 2013 as defining it results in errors
+ // if the standard <assert.h> is included afterwards.
+ #if !defined(_CRTBLD) && !wxCHECK_VISUALC_VERSION(12)
// Needed when building with pure MS SDK
#define _CRTBLD
#endif
diff --git a/Externals/wxWidgets3/include/wx/msw/ole/automtn.h b/Externals/wxWidgets3/include/wx/msw/ole/automtn.h
index a7c5f62..1d1eb33 100644
--- a/Externals/wxWidgets3/include/wx/msw/ole/automtn.h
+++ b/Externals/wxWidgets3/include/wx/msw/ole/automtn.h
@@ -115,11 +115,22 @@ public:
// this object. The default is LOCALE_SYSTEM_DEFAULT.
void SetLCID(WXLCID lcid);
+ // Returns the flags used for conversions between wxVariant and OLE
+ // VARIANT, see wxOleConvertVariantFlags. The default value is
+ // wxOleConvertVariant_Default but all the objects obtained by GetObject()
+ // inherit the flags from the one that created them.
+ long GetConvertVariantFlags() const;
+
+ // Sets the flags used for conversions between wxVariant and OLE VARIANT,
+ // see wxOleConvertVariantFlags (default is wxOleConvertVariant_Default.
+ void SetConvertVariantFlags(long flags);
+
public: // public for compatibility only, don't use m_dispatchPtr directly.
WXIDISPATCH* m_dispatchPtr;
private:
WXLCID m_lcid;
+ long m_convertVariantFlags;
wxDECLARE_NO_COPY_CLASS(wxAutomationObject);
};
diff --git a/Externals/wxWidgets3/include/wx/msw/ole/dataform.h b/Externals/wxWidgets3/include/wx/msw/ole/dataform.h
index 8ad6454..2695909 100644
--- a/Externals/wxWidgets3/include/wx/msw/ole/dataform.h
+++ b/Externals/wxWidgets3/include/wx/msw/ole/dataform.h
@@ -39,14 +39,10 @@ public:
// default copy ctor/assignment operators ok
// comparison (must have both versions)
- bool operator==(wxDataFormatId format) const
- { return m_format == (NativeFormat)format; }
- bool operator!=(wxDataFormatId format) const
- { return m_format != (NativeFormat)format; }
- bool operator==(const wxDataFormat& format) const
- { return m_format == format.m_format; }
- bool operator!=(const wxDataFormat& format) const
- { return m_format != format.m_format; }
+ bool operator==(wxDataFormatId format) const;
+ bool operator!=(wxDataFormatId format) const;
+ bool operator==(const wxDataFormat& format) const;
+ bool operator!=(const wxDataFormat& format) const;
// explicit and implicit conversions to NativeFormat which is one of
// standard data types (implicit conversion is useful for preserving the
diff --git a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h
index 1c25d36..c9f7eb8 100644
--- a/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h
+++ b/Externals/wxWidgets3/include/wx/msw/ole/oleutils.h
@@ -316,9 +316,25 @@ private:
SAFEARRAY* m_value;
};
+// Used by wxAutomationObject for its wxConvertOleToVariant() calls.
+enum wxOleConvertVariantFlags
+{
+ wxOleConvertVariant_Default = 0,
+
+ // If wxOleConvertVariant_ReturnSafeArrays flag is set, SAFEARRAYs
+ // contained in OLE VARIANTs will be returned as wxVariants
+ // with wxVariantDataSafeArray type instead of wxVariants
+ // with the list type containing the (flattened) SAFEARRAY's elements.
+ wxOleConvertVariant_ReturnSafeArrays = 1
+};
+
+WXDLLIMPEXP_CORE
+bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant);
+
+WXDLLIMPEXP_CORE
+bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant,
+ long flags = wxOleConvertVariant_Default);
-WXDLLIMPEXP_CORE bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant);
-WXDLLIMPEXP_CORE bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant);
#endif // wxUSE_VARIANT
// Convert string to Unicode
diff --git a/Externals/wxWidgets3/include/wx/msw/timectrl.h b/Externals/wxWidgets3/include/wx/msw/timectrl.h
index e39528a..c5bc83a 100644
--- a/Externals/wxWidgets3/include/wx/msw/timectrl.h
+++ b/Externals/wxWidgets3/include/wx/msw/timectrl.h
@@ -50,7 +50,9 @@ public:
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
protected:
+#if wxUSE_INTL
virtual wxLocaleInfo MSWGetFormat() const;
+#endif // wxUSE_INTL
virtual bool MSWAllowsNone() const { return false; }
virtual bool MSWOnDateTimeChange(const tagNMDATETIMECHANGE& dtch);
diff --git a/Externals/wxWidgets3/include/wx/msw/treectrl.h b/Externals/wxWidgets3/include/wx/msw/treectrl.h
index 5eeede8..341f31b 100644
--- a/Externals/wxWidgets3/include/wx/msw/treectrl.h
+++ b/Externals/wxWidgets3/include/wx/msw/treectrl.h
@@ -304,6 +304,9 @@ private:
// item visually spans the entire breadth of the window then
bool MSWIsOnItem(unsigned flags) const;
+ // Delete the given item from the native control.
+ bool MSWDeleteItem(const wxTreeItemId& item);
+
// the hash storing the items attributes (indexed by item ids)
wxMapTreeAttr m_attrs;
diff --git a/Externals/wxWidgets3/include/wx/msw/window.h b/Externals/wxWidgets3/include/wx/msw/window.h
index 3475f3d..bd793e1 100644
--- a/Externals/wxWidgets3/include/wx/msw/window.h
+++ b/Externals/wxWidgets3/include/wx/msw/window.h
@@ -206,7 +206,7 @@ public:
// to understand why does it work, look at SubclassWin() code and comments
bool IsOfStandardClass() const { return m_oldWndProc != NULL; }
- wxWindow *FindItem(long id) const;
+ wxWindow *FindItem(long id, WXHWND hWnd = NULL) const;
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = false) const;
// MSW only: true if this control is part of the main control
@@ -663,6 +663,15 @@ protected:
bool MSWEnableHWND(WXHWND hWnd, bool enable);
+ // Return the pointer to this window or one of its sub-controls if this ID
+ // and HWND combination belongs to one of them.
+ //
+ // This is used by FindItem() and is overridden in wxControl, see there.
+ virtual wxWindow* MSWFindItem(long WXUNUSED(id), WXHWND WXUNUSED(hWnd)) const
+ {
+ return NULL;
+ }
+
private:
// common part of all ctors
void Init();
diff --git a/Externals/wxWidgets3/include/wx/osx/app.h b/Externals/wxWidgets3/include/wx/osx/app.h
index 7238419..0eba951 100644
--- a/Externals/wxWidgets3/include/wx/osx/app.h
+++ b/Externals/wxWidgets3/include/wx/osx/app.h
@@ -129,18 +129,24 @@ public:
virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ;
#endif
// in response of an openFiles message with Cocoa and an
- // open-document apple event with Carbon
+ // open-document apple event
virtual void MacOpenFiles(const wxArrayString &fileNames) ;
// called by MacOpenFiles for each file.
virtual void MacOpenFile(const wxString &fileName) ;
// in response of a get-url apple event
virtual void MacOpenURL(const wxString &url) ;
// in response of a print-document apple event
+ virtual void MacPrintFiles(const wxArrayString &fileNames) ;
+ // called by MacPrintFiles for each file
virtual void MacPrintFile(const wxString &fileName) ;
// in response of a open-application apple event
virtual void MacNewFile() ;
// in response of a reopen-application apple event
virtual void MacReopenApp() ;
+
+ // override this to return false from a non-bundled console app in order to stay in background ...
+ virtual bool OSXIsGUIApplication() { return true; }
+
#if wxOSX_USE_COCOA_OR_IPHONE
// immediately before the native event loop launches
virtual void OSXOnWillFinishLaunching();
@@ -153,9 +159,16 @@ public:
private:
bool m_onInitResult;
+ bool m_inited;
+ wxArrayString m_openFiles;
+ wxArrayString m_printFiles;
+ wxString m_getURL;
public:
-
+ bool OSXInitWasCalled() { return m_inited; }
+ void OSXStoreOpenFiles(const wxArrayString &files ) { m_openFiles = files ; }
+ void OSXStorePrintFiles(const wxArrayString &files ) { m_printFiles = files ; }
+ void OSXStoreOpenURL(const wxString &url ) { m_getURL = url ; }
#endif
// Hide the application windows the same as the system hide command would do it.
diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h b/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h
index 68e3954..9c6bc30 100644
--- a/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h
+++ b/Externals/wxWidgets3/include/wx/osx/carbon/chkconf.h
@@ -30,22 +30,7 @@
* text rendering system
*/
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
-
- #define wxOSX_USE_CORE_TEXT 1
- // MLTE-TextControl uses ATSU
- #define wxOSX_USE_ATSU_TEXT 1
-
-#else // platform < 10.5
-
- #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- #define wxOSX_USE_CORE_TEXT 1
- #else
- #define wxOSX_USE_CORE_TEXT 0
- #endif
- #define wxOSX_USE_ATSU_TEXT 1
-
-#endif
+#define wxOSX_USE_ATSU_TEXT 1
/*
* Audio System
diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h b/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h
index 6f7b05a..75185b0 100644
--- a/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h
+++ b/Externals/wxWidgets3/include/wx/osx/carbon/dataview.h
@@ -155,9 +155,7 @@ public:
OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false)
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
OSStatus GetAttributes (OptionBits* attributes);
-#endif
OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels
OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels
OSStatus GetDefaultRowHeight (UInt16 * height ) const;
@@ -166,9 +164,7 @@ public:
OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const;
OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
OSStatus SetAttributes (OptionBits attributes);
-#endif
OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels
OSStatus SetDefaultColumnWidth( UInt16 width );
OSStatus SetDefaultRowHeight( UInt16 height );
diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h b/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h
index b20c9dd..6edb392 100644
--- a/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h
+++ b/Externals/wxWidgets3/include/wx/osx/carbon/drawer.h
@@ -22,8 +22,6 @@
// near future
//
-#if ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
-
class WXDLLIMPEXP_ADV wxDrawerWindow : public wxTopLevelWindow
{
DECLARE_DYNAMIC_CLASS(wxDrawerWindow)
@@ -64,7 +62,4 @@ public:
wxDirection GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints
};
-#endif // defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
-
-#endif
- // _WX_DRAWERWINDOW_H_
+#endif // _WX_DRAWERWINDOW_H_
diff --git a/Externals/wxWidgets3/include/wx/osx/carbon/private.h b/Externals/wxWidgets3/include/wx/osx/carbon/private.h
index 82db9b9..64fa447 100644
--- a/Externals/wxWidgets3/include/wx/osx/carbon/private.h
+++ b/Externals/wxWidgets3/include/wx/osx/carbon/private.h
@@ -13,11 +13,6 @@
#ifndef _WX_PRIVATE_H_
#define _WX_PRIVATE_H_
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-typedef UInt32 URefCon;
-typedef SInt32 SRefCon;
-#endif
-
#if wxUSE_GUI
#include "wx/osx/uma.h"
@@ -29,10 +24,6 @@ typedef SInt32 SRefCon;
// app.h
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec);
-#endif
-
#endif // wxUSE_GUI
// filefn.h
@@ -269,12 +260,6 @@ ControlActionUPP GetwxMacLiveScrollbarActionProc();
// additional optional event defines
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-enum {
- kEventControlFocusPartChanged = 164
-};
-#endif
-
class WXDLLIMPEXP_CORE wxMacControl : public wxWidgetImpl
{
public :
diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h
index 9789e77..03fd501 100644
--- a/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h
+++ b/Externals/wxWidgets3/include/wx/osx/cocoa/chkconf.h
@@ -41,33 +41,14 @@
* text rendering system
*/
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
-
- #define wxOSX_USE_CORE_TEXT 1
- #define wxOSX_USE_ATSU_TEXT 0
-
-#else // platform < 10.5
-
- #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- #define wxOSX_USE_CORE_TEXT 1
- #else
- #define wxOSX_USE_CORE_TEXT 0
- #endif
- #define wxOSX_USE_ATSU_TEXT 1
-
-#endif
+#define wxOSX_USE_ATSU_TEXT 0
/*
* Audio System
*/
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
- #define wxOSX_USE_QUICKTIME 0
- #define wxOSX_USE_AUDIOTOOLBOX 1
-#else // platform < 10.5
- #define wxOSX_USE_QUICKTIME 1
- #define wxOSX_USE_AUDIOTOOLBOX 0
-#endif
+#define wxOSX_USE_QUICKTIME 0
+#define wxOSX_USE_AUDIOTOOLBOX 1
/*
* turning off capabilities that don't work under cocoa yet
diff --git a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h
index 9dcbf36..e92df39 100644
--- a/Externals/wxWidgets3/include/wx/osx/cocoa/private.h
+++ b/Externals/wxWidgets3/include/wx/osx/cocoa/private.h
@@ -19,12 +19,6 @@
#import <Cocoa/Cocoa.h>
#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-// available in 10.4 but not in the headers
-enum {
- kEventMouseScroll = 11
-};
-#endif
//
// shared between Cocoa and Carbon
//
@@ -160,6 +154,7 @@ public :
virtual void cursorUpdate(WX_NSEvent event, WXWidget slf, void* _cmd);
virtual void keyEvent(WX_NSEvent event, WXWidget slf, void* _cmd);
virtual void insertText(NSString* text, WXWidget slf, void* _cmd);
+ virtual void doCommandBySelector(void* sel, WXWidget slf, void* _cmd);
virtual bool performKeyEquivalent(WX_NSEvent event, WXWidget slf, void* _cmd);
virtual bool acceptsFirstResponder(WXWidget slf, void* _cmd);
virtual bool becomeFirstResponder(WXWidget slf, void* _cmd);
diff --git a/Externals/wxWidgets3/include/wx/osx/config_xcode.h b/Externals/wxWidgets3/include/wx/osx/config_xcode.h
index e293e90..510eb9f 100644
--- a/Externals/wxWidgets3/include/wx/osx/config_xcode.h
+++ b/Externals/wxWidgets3/include/wx/osx/config_xcode.h
@@ -45,11 +45,7 @@
#define WX_GMTOFF_IN_TM 1
#define HAVE_PW_GECOS 1
#define HAVE_DLOPEN 1
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-/* #undef HAVE_CXA_DEMANGLE */
-#else
#define HAVE_CXA_DEMANGLE 1
-#endif
#define HAVE_GETTIMEOFDAY 1
#define HAVE_FSYNC 1
#define HAVE_ROUND 1
@@ -108,11 +104,7 @@
#define HAVE_WCHAR_H 1
/* better to use the built-in CF conversions, also avoid iconv versioning problems */
/* #undef HAVE_ICONV */
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-#define ICONV_CONST const
-#else
#define ICONV_CONST
-#endif
#define HAVE_LANGINFO_H 1
#define HAVE_WCSRTOMBS 1
#define HAVE_FPUTWS 1
@@ -131,9 +123,9 @@
#define WXWIN_OS_DESCRIPTION "Darwin 7.9.0 Power Macintosh"
#define PACKAGE_BUGREPORT "wx-dev@lists.wxwidgets.org"
#define PACKAGE_NAME "wxWidgets"
-#define PACKAGE_STRING "wxWidgets 3.0.0"
+#define PACKAGE_STRING "wxWidgets 3.1.0"
#define PACKAGE_TARNAME "wxwidgets"
-#define PACKAGE_VERSION "3.0.0"
+#define PACKAGE_VERSION "3.1.0"
// for regex
#define WX_NO_REGEX_ADVANCED 1
diff --git a/Externals/wxWidgets3/include/wx/osx/evtloop.h b/Externals/wxWidgets3/include/wx/osx/evtloop.h
index 995a713..98772dd 100644
--- a/Externals/wxWidgets3/include/wx/osx/evtloop.h
+++ b/Externals/wxWidgets3/include/wx/osx/evtloop.h
@@ -30,7 +30,9 @@ public:
#ifdef __WXOSX_COCOA__
// skip wxGUIEventLoop to avoid missing Enter/Exit notifications
- int Run() { return wxCFEventLoop::Run(); }
+ virtual int Run() { return wxCFEventLoop::Run(); }
+
+ virtual bool ProcessIdle();
#endif
protected:
virtual void OSXDoRun();
diff --git a/Externals/wxWidgets3/include/wx/osx/font.h b/Externals/wxWidgets3/include/wx/osx/font.h
index 3bec30a..2c31c2d 100644
--- a/Externals/wxWidgets3/include/wx/osx/font.h
+++ b/Externals/wxWidgets3/include/wx/osx/font.h
@@ -152,9 +152,7 @@ public:
CGFontRef OSXGetCGFont() const;
#endif
-#if wxOSX_USE_CORE_TEXT
CTFontRef OSXGetCTFont() const;
-#endif
#if wxOSX_USE_ATSU_TEXT
// Returns an ATSUStyle not ATSUStyle*
diff --git a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h
index ffdc6b9..cd86c72 100644
--- a/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h
+++ b/Externals/wxWidgets3/include/wx/osx/iphone/chkconf.h
@@ -19,7 +19,6 @@
* under a certain platform
*/
-#define wxOSX_USE_CORE_TEXT 1
#define wxOSX_USE_ATSU_TEXT 0
#define wxHAS_OPENGL_ES
@@ -362,6 +361,11 @@
#define wxUSE_RICHTOOLTIP 0
#endif
+#if wxUSE_WEBVIEW
+#undef wxUSE_WEBVIEW
+#define wxUSE_WEBVIEW 0
+#endif
+
#endif
/* _WX_OSX_IPHONE_CHKCONF_H_ */
diff --git a/Externals/wxWidgets3/include/wx/osx/menu.h b/Externals/wxWidgets3/include/wx/osx/menu.h
index 3ef7699..9eded85 100644
--- a/Externals/wxWidgets3/include/wx/osx/menu.h
+++ b/Externals/wxWidgets3/include/wx/osx/menu.h
@@ -146,6 +146,10 @@ public:
// call this function to update it (m_menuBarFrame should be !NULL)
void Refresh(bool eraseBackground = true, const wxRect *rect = NULL);
+#if wxABI_VERSION >= 30001
+ wxMenu *OSXGetAppleMenu() const { return m_appleMenu; }
+#endif
+
static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; }
static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; }
diff --git a/Externals/wxWidgets3/include/wx/osx/textctrl.h b/Externals/wxWidgets3/include/wx/osx/textctrl.h
index 53604ba..a52620b 100644
--- a/Externals/wxWidgets3/include/wx/osx/textctrl.h
+++ b/Externals/wxWidgets3/include/wx/osx/textctrl.h
@@ -74,10 +74,6 @@ public:
virtual void MarkDirty();
virtual void DiscardEdits();
- // set the grayed out hint text
- virtual bool SetHint(const wxString& hint);
- virtual wxString GetHint() const;
-
// text control under some platforms supports the text styles: these
// methods apply the given text style to the given selection or to
// set/get the style which will be used for all appended text
@@ -151,7 +147,6 @@ protected:
private :
wxMenu *m_privateContextMenu;
- wxString m_hintString;
DECLARE_EVENT_TABLE()
};
diff --git a/Externals/wxWidgets3/include/wx/osx/textentry.h b/Externals/wxWidgets3/include/wx/osx/textentry.h
index 2362cae..12d7807 100644
--- a/Externals/wxWidgets3/include/wx/osx/textentry.h
+++ b/Externals/wxWidgets3/include/wx/osx/textentry.h
@@ -81,6 +81,10 @@ public:
virtual bool SendMaxLenEvent();
+ // set the grayed out hint text
+ virtual bool SetHint(const wxString& hint);
+ virtual wxString GetHint() const;
+
// Implementation
// --------------
@@ -102,6 +106,8 @@ protected:
// need to make this public because of the current implementation via callbacks
unsigned long m_maxLength;
+private:
+ wxString m_hintString;
};
#endif // _WX_OSX_TEXTENTRY_H_
diff --git a/Externals/wxWidgets3/include/wx/platform.h b/Externals/wxWidgets3/include/wx/platform.h
index 53b04e5..97c669f 100644
--- a/Externals/wxWidgets3/include/wx/platform.h
+++ b/Externals/wxWidgets3/include/wx/platform.h
@@ -95,8 +95,13 @@
# endif
#endif /* __WINDOWS__ */
-/* Don't use widget toolkit specific code in non-GUI code */
-#if defined(wxUSE_GUI) && !wxUSE_GUI
+/*
+ Don't use widget toolkit specific code in non-GUI code in the library
+ itself to ensure that the same base library is used for both MSW and GTK
+ ports. But keep __WXMSW__ defined for (console) applications using
+ wxWidgets for compatibility.
+ */
+#if defined(WXBUILDING) && defined(wxUSE_GUI) && !wxUSE_GUI
# ifdef __WXMSW__
# undef __WXMSW__
# endif
diff --git a/Externals/wxWidgets3/include/wx/private/textmeasure.h b/Externals/wxWidgets3/include/wx/private/textmeasure.h
index 69fbf85..a4db67c 100644
--- a/Externals/wxWidgets3/include/wx/private/textmeasure.h
+++ b/Externals/wxWidgets3/include/wx/private/textmeasure.h
@@ -156,7 +156,7 @@ protected:
wxDECLARE_NO_COPY_CLASS(wxTextMeasureBase);
};
-// Include the platform dependant class declaration, if any.
+// Include the platform dependent class declaration, if any.
#if defined(__WXGTK20__)
#include "wx/gtk/private/textmeasure.h"
#elif defined(__WXMSW__)
diff --git a/Externals/wxWidgets3/include/wx/selstore.h b/Externals/wxWidgets3/include/wx/selstore.h
index 4361a11..62ff229 100644
--- a/Externals/wxWidgets3/include/wx/selstore.h
+++ b/Externals/wxWidgets3/include/wx/selstore.h
@@ -80,7 +80,7 @@ public:
private:
// (re)init
- void Init() { m_defaultState = false; }
+ void Init() { m_count = 0; m_defaultState = false; }
// the total number of items we handle
unsigned m_count;
diff --git a/Externals/wxWidgets3/include/wx/stringops.h b/Externals/wxWidgets3/include/wx/stringops.h
index 301a7bf..21c6121 100644
--- a/Externals/wxWidgets3/include/wx/stringops.h
+++ b/Externals/wxWidgets3/include/wx/stringops.h
@@ -79,8 +79,6 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8
template<typename Iterator>
static void DecIter(Iterator& i)
{
- wxASSERT( IsValidUtf8LeadByte(*i) );
-
// Non-lead bytes are all in the 0x80..0xBF range (i.e. 10xxxxxx in
// binary), so we just have to go back until we hit a byte that is
// either < 0x80 (i.e. 0xxxxxxx in binary) or 0xC0..0xFF (11xxxxxx in
diff --git a/Externals/wxWidgets3/include/wx/strvararg.h b/Externals/wxWidgets3/include/wx/strvararg.h
index dc566e9..6562ee3 100644
--- a/Externals/wxWidgets3/include/wx/strvararg.h
+++ b/Externals/wxWidgets3/include/wx/strvararg.h
@@ -748,7 +748,7 @@ struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t>
{
wxArgNormalizer(const wxUniChar& s,
const wxFormatString *fmt, unsigned index)
- : wxArgNormalizer<wchar_t>(s.GetValue(), fmt, index) {}
+ : wxArgNormalizer<wchar_t>(wx_truncate_cast(wchar_t, s.GetValue()), fmt, index) {}
};
// for wchar_t, default handler does the right thing
diff --git a/Externals/wxWidgets3/include/wx/textctrl.h b/Externals/wxWidgets3/include/wx/textctrl.h
index 83634e1..ce922bb 100644
--- a/Externals/wxWidgets3/include/wx/textctrl.h
+++ b/Externals/wxWidgets3/include/wx/textctrl.h
@@ -205,6 +205,9 @@ enum wxTextAttrFlags
wxTEXT_ATTR_EFFECTS = 0x00800000,
wxTEXT_ATTR_OUTLINE_LEVEL = 0x01000000,
+ wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE = 0x20000000,
+ wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER = 0x40000000,
+
/*!
* Character and paragraph combined styles
*/
@@ -216,7 +219,8 @@ enum wxTextAttrFlags
wxTEXT_ATTR_PARAGRAPH = \
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
- wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|wxTEXT_ATTR_PAGE_BREAK),
+ wxTEXT_ATTR_BULLET|wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL|\
+ wxTEXT_ATTR_PAGE_BREAK|wxTEXT_ATTR_AVOID_PAGE_BREAK_BEFORE|wxTEXT_ATTR_AVOID_PAGE_BREAK_AFTER),
wxTEXT_ATTR_ALL = (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
};
@@ -262,7 +266,9 @@ enum wxTextAttrEffects
wxTEXT_ATTR_EFFECT_OUTLINE = 0x00000040,
wxTEXT_ATTR_EFFECT_ENGRAVE = 0x00000080,
wxTEXT_ATTR_EFFECT_SUPERSCRIPT = 0x00000100,
- wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200
+ wxTEXT_ATTR_EFFECT_SUBSCRIPT = 0x00000200,
+ wxTEXT_ATTR_EFFECT_RTL = 0x00000400,
+ wxTEXT_ATTR_EFFECT_SUPPRESS_HYPHENATION = 0x00001000
};
/*!
diff --git a/Externals/wxWidgets3/include/wx/unichar.h b/Externals/wxWidgets3/include/wx/unichar.h
index a661e5a..e972694 100644
--- a/Externals/wxWidgets3/include/wx/unichar.h
+++ b/Externals/wxWidgets3/include/wx/unichar.h
@@ -161,7 +161,7 @@ private:
return ToHi8bit(c);
#else
- return c;
+ return wx_truncate_cast(char, c);
#endif
}
diff --git a/Externals/wxWidgets3/include/wx/vector.h b/Externals/wxWidgets3/include/wx/vector.h
index dffb19f..e81cafb 100644
--- a/Externals/wxWidgets3/include/wx/vector.h
+++ b/Externals/wxWidgets3/include/wx/vector.h
@@ -327,7 +327,7 @@ public:
if ( m_capacity + increment > n )
n = m_capacity + increment;
- m_values = Ops::Realloc(m_values, n * sizeof(value_type), m_size);
+ m_values = Ops::Realloc(m_values, n, m_size);
m_capacity = n;
}
diff --git a/Externals/wxWidgets3/include/wx/version.h b/Externals/wxWidgets3/include/wx/version.h
index c762d9a..16578dc 100644
--- a/Externals/wxWidgets3/include/wx/version.h
+++ b/Externals/wxWidgets3/include/wx/version.h
@@ -26,10 +26,10 @@
/* NB: this file is parsed by automatic tools so don't change its format! */
#define wxMAJOR_VERSION 3
-#define wxMINOR_VERSION 0
+#define wxMINOR_VERSION 1
#define wxRELEASE_NUMBER 0
#define wxSUBRELEASE_NUMBER 0
-#define wxVERSION_STRING wxT("wxWidgets 3.0.0 RC1")
+#define wxVERSION_STRING wxT("wxWidgets 3.1.0")
/* nothing to update below this line when updating the version */
/* ---------------------------------------------------------------------------- */
diff --git a/Externals/wxWidgets3/include/wx/wxcrtbase.h b/Externals/wxWidgets3/include/wx/wxcrtbase.h
index 16f6499..1c3522e 100644
--- a/Externals/wxWidgets3/include/wx/wxcrtbase.h
+++ b/Externals/wxWidgets3/include/wx/wxcrtbase.h
@@ -565,24 +565,6 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name);
/* wcstoi doesn't exist */
#endif
-#ifdef __DARWIN__
- #if !defined(__WXOSX_IPHONE__) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
- #define wxNEED_WX_MBSTOWCS
- #endif
-#endif
-
-#ifdef wxNEED_WX_MBSTOWCS
- /* even though they are defined and "implemented", they are bad and just
- stubs so we need our own - we need these even in ANSI builds!! */
- WXDLLIMPEXP_BASE size_t wxMbstowcs(wchar_t *, const char *, size_t);
- WXDLLIMPEXP_BASE size_t wxWcstombs(char *, const wchar_t *, size_t);
-#else
- #define wxMbstowcs mbstowcs
- #define wxWcstombs wcstombs
-#endif
-
-
-
/* -------------------------------------------------------------------------
time.h
------------------------------------------------------------------------- */
diff --git a/Externals/wxWidgets3/include/wx/wxcrtvararg.h b/Externals/wxWidgets3/include/wx/wxcrtvararg.h
index c3a306b..08d6981 100644
--- a/Externals/wxWidgets3/include/wx/wxcrtvararg.h
+++ b/Externals/wxWidgets3/include/wx/wxcrtvararg.h
@@ -238,7 +238,17 @@
#define wxCRT_ScanfA scanf
#define wxCRT_SscanfA sscanf
#define wxCRT_FscanfA fscanf
-#define wxCRT_VsscanfA vsscanf
+
+/* vsscanf() may have a wrong declaration with non-const first parameter, fix
+ * this by wrapping it if necessary. */
+#if defined __cplusplus && defined HAVE_BROKEN_VSSCANF_DECL
+ inline int wxCRT_VsscanfA(const char *str, const char *format, va_list ap)
+ {
+ return vsscanf(const_cast<char *>(str), format, ap);
+ }
+#else
+ #define wxCRT_VsscanfA vsscanf
+#endif
#if defined(wxNEED_WPRINTF)
int wxCRT_ScanfW(const wchar_t *format, ...);
diff --git a/Externals/wxWidgets3/src/common/appbase.cpp b/Externals/wxWidgets3/src/common/appbase.cpp
index da6f294..68113d9 100644
--- a/Externals/wxWidgets3/src/common/appbase.cpp
+++ b/Externals/wxWidgets3/src/common/appbase.cpp
@@ -173,6 +173,10 @@ wxAppConsoleBase::~wxAppConsoleBase()
bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc), wxChar **WXUNUSED(argv))
{
+#if defined(__WINDOWS__) && !defined(__WXWINCE__)
+ SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+#endif
+
return true;
}
diff --git a/Externals/wxWidgets3/src/common/cmdproc.cpp b/Externals/wxWidgets3/src/common/cmdproc.cpp
index 54f14ea..4534de6 100644
--- a/Externals/wxWidgets3/src/common/cmdproc.cpp
+++ b/Externals/wxWidgets3/src/common/cmdproc.cpp
@@ -329,16 +329,11 @@ void wxCommandProcessor::ClearCommands()
bool wxCommandProcessor::IsDirty() const
{
- if ( m_commands.empty() )
- {
- // If we have never been modified, we can't be dirty.
- return false;
- }
-
if ( !m_lastSavedCommand )
{
- // If we have been modified but have never been saved, we're dirty.
- return true;
+ // We have never been saved, so we are dirty if and only if we have any
+ // commands at all.
+ return m_currentCommand;
}
if ( !m_currentCommand )
diff --git a/Externals/wxWidgets3/src/common/ctrlcmn.cpp b/Externals/wxWidgets3/src/common/ctrlcmn.cpp
index 32bce06..dbfbc9f 100644
--- a/Externals/wxWidgets3/src/common/ctrlcmn.cpp
+++ b/Externals/wxWidgets3/src/common/ctrlcmn.cpp
@@ -584,7 +584,7 @@ wxSize wxStaticBitmapBase::DoGetBestSize() const
wxSize best;
wxBitmap bmp = GetBitmap();
if ( bmp.IsOk() )
- best = wxSize(bmp.GetWidth(), bmp.GetHeight());
+ best = bmp.GetScaledSize();
else
// this is completely arbitrary
best = wxSize(16, 16);
diff --git a/Externals/wxWidgets3/src/common/datavcmn.cpp b/Externals/wxWidgets3/src/common/datavcmn.cpp
index 2cad362..fd74121 100644
--- a/Externals/wxWidgets3/src/common/datavcmn.cpp
+++ b/Externals/wxWidgets3/src/common/datavcmn.cpp
@@ -330,29 +330,50 @@ int wxDataViewModel::Compare( const wxDataViewItem &item1, const wxDataViewItem
{
long l1 = value1.GetLong();
long l2 = value2.GetLong();
- long res = l1-l2;
- if (res)
- return res;
+ if (l1 < l2)
+ return -1;
+ else if (l1 > l2)
+ return 1;
}
else if (value1.GetType() == wxT("double"))
{
double d1 = value1.GetDouble();
double d2 = value2.GetDouble();
if (d1 < d2)
- return 1;
- if (d1 > d2)
return -1;
+ else if (d1 > d2)
+ return 1;
}
else if (value1.GetType() == wxT("datetime"))
{
wxDateTime dt1 = value1.GetDateTime();
wxDateTime dt2 = value2.GetDateTime();
if (dt1.IsEarlierThan(dt2))
- return 1;
- if (dt2.IsEarlierThan(dt1))
return -1;
+ if (dt2.IsEarlierThan(dt1))
+ return 1;
+ }
+ else if (value1.GetType() == wxT("bool"))
+ {
+ bool b1 = value1.GetBool();
+ bool b2 = value2.GetBool();
+
+ if (b1 != b2)
+ return b1 ? 1 : -1;
+ }
+ else if (value1.GetType() == wxT("wxDataViewIconText"))
+ {
+ wxDataViewIconText iconText1, iconText2;
+
+ iconText1 << value1;
+ iconText2 << value2;
+
+ int res = iconText1.GetText().Cmp(iconText2.GetText());
+ if (res != 0)
+ return res;
}
+
// items must be different
wxUIntPtr id1 = wxPtrToUInt(item1.GetID()),
id2 = wxPtrToUInt(item2.GetID());
@@ -1769,6 +1790,11 @@ void wxDataViewListStore::DeleteAllItems()
Reset( 0 );
}
+void wxDataViewListStore::ClearColumns()
+{
+ m_cols.clear();
+}
+
void wxDataViewListStore::SetItemData( const wxDataViewItem& item, wxUIntPtr data )
{
wxDataViewListStoreLine* line = m_data[GetRow(item)];
@@ -1780,7 +1806,7 @@ void wxDataViewListStore::SetItemData( const wxDataViewItem& item, wxUIntPtr dat
wxUIntPtr wxDataViewListStore::GetItemData( const wxDataViewItem& item ) const
{
wxDataViewListStoreLine* line = m_data[GetRow(item)];
- if (!line) return static_cast<wxUIntPtr>(NULL);
+ if (!line) return 0;
return line->GetData();
}
@@ -1872,6 +1898,12 @@ bool wxDataViewListCtrl::AppendColumn( wxDataViewColumn *col )
return AppendColumn( col, "string" );
}
+bool wxDataViewListCtrl::ClearColumns()
+{
+ GetStore()->ClearColumns();
+ return wxDataViewCtrl::ClearColumns();
+}
+
wxDataViewColumn *wxDataViewListCtrl::AppendTextColumn( const wxString &label,
wxDataViewCellMode mode, int width, wxAlignment align, int flags )
{
diff --git a/Externals/wxWidgets3/src/common/dcbufcmn.cpp b/Externals/wxWidgets3/src/common/dcbufcmn.cpp
index ee50d23..3bc2e27 100644
--- a/Externals/wxWidgets3/src/common/dcbufcmn.cpp
+++ b/Externals/wxWidgets3/src/common/dcbufcmn.cpp
@@ -148,7 +148,7 @@ void wxBufferedDC::UnMask()
int width = m_area.GetWidth(),
height = m_area.GetHeight();
- if (! m_style & wxBUFFER_VIRTUAL_AREA)
+ if (!(m_style & wxBUFFER_VIRTUAL_AREA))
{
int widthDC,
heightDC;
@@ -157,7 +157,8 @@ void wxBufferedDC::UnMask()
height = wxMin(height, heightDC);
}
- m_dc->Blit(0, 0, width, height, this, -x, -y);
+ const wxPoint origin = GetLogicalOrigin();
+ m_dc->Blit(-origin.x, -origin.y, width, height, this, -x, -y);
m_dc = NULL;
if ( m_style & wxBUFFER_USES_SHARED_BUFFER )
diff --git a/Externals/wxWidgets3/src/common/dcsvg.cpp b/Externals/wxWidgets3/src/common/dcsvg.cpp
index 6fd0c2a..5c55a0b 100644
--- a/Externals/wxWidgets3/src/common/dcsvg.cpp
+++ b/Externals/wxWidgets3/src/common/dcsvg.cpp
@@ -27,6 +27,8 @@
#include "wx/wfstream.h"
#include "wx/filename.h"
+#include "wx/private/markupparser.h"
+
// ----------------------------------------------------------
// Global utilities
// ----------------------------------------------------------
@@ -293,7 +295,7 @@ void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor
//text will be solid, unless alpha value isn't opaque in the foreground colour
s += wxBrushString(m_textForegroundColour) + wxPenString(m_textForegroundColour);
sTmp.Printf ( wxT("stroke-width:0;\" transform=\"rotate( %s %d %d ) \" >"), NumStr(-angle), x,y );
- s += sTmp + sText + wxT("</text> ") + wxT("\n");
+ s += sTmp + wxMarkupParser::Quote(sText) + wxT("</text> ") + wxT("\n");
if (m_OK)
{
write(s);
diff --git a/Externals/wxWidgets3/src/common/dlgcmn.cpp b/Externals/wxWidgets3/src/common/dlgcmn.cpp
index df7ecdf..3f73371 100644
--- a/Externals/wxWidgets3/src/common/dlgcmn.cpp
+++ b/Externals/wxWidgets3/src/common/dlgcmn.cpp
@@ -517,7 +517,13 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindowModalDialogEvent, wxCommandEvent)
void wxDialogBase::ShowWindowModal ()
{
- ShowModal();
+ int retval = ShowModal();
+ // wxWindowModalDialogEvent relies on GetReturnCode() returning correct
+ // code. Rather than doing it manually in all ShowModal() overrides for
+ // native dialogs (and getting accidentally broken again), set it here.
+ // The worst that can happen is that it will be set twice to the same
+ // value.
+ SetReturnCode(retval);
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
}
diff --git a/Externals/wxWidgets3/src/common/docview.cpp b/Externals/wxWidgets3/src/common/docview.cpp
index 45205f0..b646d9e 100644
--- a/Externals/wxWidgets3/src/common/docview.cpp
+++ b/Externals/wxWidgets3/src/common/docview.cpp
@@ -2027,11 +2027,16 @@ bool wxDocChildFrameAnyBase::TryProcessEvent(wxEvent& event)
return false;
}
+ // Store a (non-owning) pointer to the last processed event here to be able
+ // to recognize this event again if it bubbles up to the parent frame, see
+ // the code in wxDocParentFrameAnyBase::TryProcessEvent().
+ m_lastEvent = &event;
+
// Forward the event to the document manager which will, in turn, forward
// it to its active view which must be our m_childView.
//
// Notice that we do things in this roundabout way to guarantee the correct
- // event handlers call order: first the document, then the new and then the
+ // event handlers call order: first the document, then the view and then the
// document manager itself. And if we forwarded the event directly to the
// view, then the document manager would do it once again when we forwarded
// it to it.
@@ -2079,28 +2084,13 @@ bool wxDocParentFrameAnyBase::TryProcessEvent(wxEvent& event)
// already forwarded the event to wxDocManager, check for this:
if ( wxView* const view = m_docManager->GetAnyUsableView() )
{
- wxWindow* win = view->GetFrame();
- if ( win && win != m_frame )
- {
- // Notice that we intentionally don't use wxGetTopLevelParent()
- // here because we want to check both for the case of a child
- // "frame" (e.g. MDI child frame or notebook page) inside this TLW
- // and a separate child TLW frame (as used in the SDI mode) here.
- for ( win = win->GetParent(); win; win = win->GetParent() )
- {
- if ( win == m_frame )
- return false;
- }
- }
- //else: This view is directly associated with the parent frame (which
- // can happen in the so called "single" mode in which only one
- // document can be opened and so is managed by the parent frame
- // itself), there can be no child frame in play so we must forward
- // the event to wxDocManager ourselves.
+ wxDocChildFrameAnyBase* const childFrame = view->GetDocChildFrame();
+ if ( childFrame && childFrame->HasAlreadyProcessed(event) )
+ return false;
}
// But forward the event to wxDocManager ourselves if there are no views at
- // all or if we are the frame's view ourselves.
+ // all or if this event hadn't been sent to the child frame previously.
return m_docManager->ProcessEventLocally(event);
}
diff --git a/Externals/wxWidgets3/src/common/filename.cpp b/Externals/wxWidgets3/src/common/filename.cpp
index d538ebc..6acde76 100644
--- a/Externals/wxWidgets3/src/common/filename.cpp
+++ b/Externals/wxWidgets3/src/common/filename.cpp
@@ -315,14 +315,20 @@ static bool IsUNCPath(const wxString& path, wxPathFormat format)
!IsDOSPathSep(path[2u]);
}
-#ifndef __WIN32__
+// Under Unix-ish systems (basically everything except Windows but we can't
+// just test for non-__WIN32__ because Cygwin defines it, yet we want to use
+// lstat() under it, so test for all the rest explicitly) we may work either
+// with the file itself or its target if it's a symbolic link and we should
+// dereference it, as determined by wxFileName::ShouldFollowLink() and the
+// absence of the wxFILE_EXISTS_NO_FOLLOW flag. StatAny() can be used to stat
+// the appropriate file with an extra twist that it also works when there is no
+// wxFileName object at all, as is the case in static methods.
+
+#if defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__OS2__) || (defined(__DOS__) && defined(__WATCOMC__))
+ #define wxHAVE_LSTAT
+#endif
-// Under Unix-ish systems (basically everything except Windows) we may work
-// either with the file itself or its target if it's a symbolic link and we
-// should dereference it, as determined by wxFileName::ShouldFollowLink() and
-// the absence of the wxFILE_EXISTS_NO_FOLLOW flag. StatAny() can be used to
-// stat the appropriate file with an extra twist that it also works when there
-// is no wxFileName object at all, as is the case in static methods.
+#ifdef wxHAVE_LSTAT
// Private implementation, don't call directly, use one of the overloads below.
bool DoStatAny(wxStructStat& st, wxString path, bool dereference)
@@ -363,7 +369,7 @@ bool StatAny(wxStructStat& st, const wxFileName& fn)
return DoStatAny(st, fn.GetFullPath(), fn.ShouldFollowLink());
}
-#endif // !__WIN32__
+#endif // wxHAVE_LSTAT
// ----------------------------------------------------------------------------
// private constants
@@ -1851,7 +1857,7 @@ bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const
if ( fn1.GetFullPath() == fn2.GetFullPath() )
return true;
-#if defined(__UNIX__)
+#ifdef wxHAVE_LSTAT
wxStructStat st1, st2;
if ( StatAny(st1, fn1) && StatAny(st2, fn2) )
{
@@ -1859,7 +1865,7 @@ bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const
return true;
}
//else: It's not an error if one or both files don't exist.
-#endif // defined __UNIX__
+#endif // wxHAVE_LSTAT
return false;
}
@@ -2752,7 +2758,7 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess,
return true;
}
-#elif defined(__UNIX_LIKE__) || defined(__WXMAC__) || defined(__OS2__) || (defined(__DOS__) && defined(__WATCOMC__))
+#elif defined(wxHAVE_LSTAT)
// no need to test for IsDir() here
wxStructStat stBuf;
if ( StatAny(stBuf, *this) )
diff --git a/Externals/wxWidgets3/src/common/fldlgcmn.cpp b/Externals/wxWidgets3/src/common/fldlgcmn.cpp
index 12ca3a4..0b02b78 100644
--- a/Externals/wxWidgets3/src/common/fldlgcmn.cpp
+++ b/Externals/wxWidgets3/src/common/fldlgcmn.cpp
@@ -67,6 +67,24 @@ bool wxFileDialogBase::Create(wxWindow *parent,
m_wildCard = wildCard;
m_parent = parent;
+
+#ifdef __WXOSX__
+ /*
+ [DS]
+ Remove the (for OS X unnecessary) wxFD_FILE_MUST_EXIST flag. Using it
+ causes problems when having an extra panel (either a custom one or
+ by showing the filetype filters through calling
+ wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1) ).
+ Presumably the style flag conflicts with other style flags and an
+ assert in wxRegion::DoOffset is triggered later on.
+ Another solution was to override GetWindowStyleFlag() to not include
+ wxFD_FILE_MUST_EXIST in its return value, but as other wxFileDialog
+ style flags (that are actually used) dont't seem to cause problems
+ this seemed an easier solution.
+ */
+ style &= ~wxFD_FILE_MUST_EXIST;
+#endif
+
m_windowStyle = style;
m_filterIndex = 0;
diff --git a/Externals/wxWidgets3/src/common/fswatchercmn.cpp b/Externals/wxWidgets3/src/common/fswatchercmn.cpp
index 1de2422..66fb869 100644
--- a/Externals/wxWidgets3/src/common/fswatchercmn.cpp
+++ b/Externals/wxWidgets3/src/common/fswatchercmn.cpp
@@ -65,6 +65,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileSystemWatcherEvent, wxEvent);
wxString wxFileSystemWatcherEvent::ToString() const
{
+ if (IsError())
+ {
+ return wxString::Format("FSW_EVT type=%d (%s) message='%s'", m_changeType,
+ GetFSWEventChangeTypeName(m_changeType), GetErrorDescription());
+ }
return wxString::Format("FSW_EVT type=%d (%s) path='%s'", m_changeType,
GetFSWEventChangeTypeName(m_changeType), GetPath().GetFullPath());
}
diff --git a/Externals/wxWidgets3/src/common/gdicmn.cpp b/Externals/wxWidgets3/src/common/gdicmn.cpp
index 2928d1d..4938977 100644
--- a/Externals/wxWidgets3/src/common/gdicmn.cpp
+++ b/Externals/wxWidgets3/src/common/gdicmn.cpp
@@ -333,7 +333,7 @@ void wxColourDatabase::Initialize()
{wxT("LIGHT GREY"), 192, 192, 192},
{wxT("LIGHT STEEL BLUE"), 143, 143, 188},
{wxT("LIME GREEN"), 50, 204, 50},
- {wxT("LIGHT MAGENTA"), 255, 0, 255},
+ {wxT("LIGHT MAGENTA"), 255, 119, 255},
{wxT("MAGENTA"), 255, 0, 255},
{wxT("MAROON"), 142, 35, 107},
{wxT("MEDIUM AQUAMARINE"), 50, 204, 153},
diff --git a/Externals/wxWidgets3/src/common/menucmn.cpp b/Externals/wxWidgets3/src/common/menucmn.cpp
index e92a047..bce29b6 100644
--- a/Externals/wxWidgets3/src/common/menucmn.cpp
+++ b/Externals/wxWidgets3/src/common/menucmn.cpp
@@ -423,21 +423,25 @@ wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
{
wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Remove") );
- return DoRemove(item);
-}
-
-wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item)
-{
wxMenuItemList::compatibility_iterator node = m_items.Find(item);
// if we get here, the item is valid or one of Remove() functions is broken
- wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
+ wxCHECK_MSG( node, NULL, wxT("removing item not in the menu?") );
+
+ // call DoRemove() before removing the item from the list of items as the
+ // existing code in port-specific implementation may rely on the item still
+ // being there (this is the case for at least wxMSW)
+ wxMenuItem* const item2 = DoRemove(item);
// we detach the item, but we do delete the list node (i.e. don't call
// DetachNode() here!)
m_items.Erase(node);
- // item isn't attached to anything any more
+ return item2;
+}
+
+wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item)
+{
item->SetMenu(NULL);
wxMenu *submenu = item->GetSubMenu();
if ( submenu )
@@ -459,7 +463,7 @@ bool wxMenuBase::Delete(wxMenuItem *item)
bool wxMenuBase::DoDelete(wxMenuItem *item)
{
- wxMenuItem *item2 = DoRemove(item);
+ wxMenuItem *item2 = Remove(item);
wxCHECK_MSG( item2, false, wxT("failed to delete menu item") );
// don't delete the submenu
@@ -479,7 +483,7 @@ bool wxMenuBase::Destroy(wxMenuItem *item)
bool wxMenuBase::DoDestroy(wxMenuItem *item)
{
- wxMenuItem *item2 = DoRemove(item);
+ wxMenuItem *item2 = Remove(item);
wxCHECK_MSG( item2, false, wxT("failed to delete menu item") );
delete item2;
diff --git a/Externals/wxWidgets3/src/common/socket.cpp b/Externals/wxWidgets3/src/common/socket.cpp
index a793e35..bcb331f 100644
--- a/Externals/wxWidgets3/src/common/socket.cpp
+++ b/Externals/wxWidgets3/src/common/socket.cpp
@@ -1357,7 +1357,25 @@ wxSocketEventFlags wxSocketImpl::Select(wxSocketEventFlags flags,
wxSocketEventFlags detected = 0;
if ( preadfds && wxFD_ISSET(m_fd, preadfds) )
- detected |= wxSOCKET_INPUT_FLAG;
+ {
+ // check for the case of a server socket waiting for connection
+ if ( m_server && (flags & wxSOCKET_CONNECTION_FLAG) )
+ {
+ int error;
+ SOCKOPTLEN_T len = sizeof(error);
+ m_establishing = false;
+ getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len);
+
+ if ( error )
+ detected = wxSOCKET_LOST_FLAG;
+ else
+ detected |= wxSOCKET_CONNECTION_FLAG;
+ }
+ else // not called to get non-blocking accept() status
+ {
+ detected |= wxSOCKET_INPUT_FLAG;
+ }
+ }
if ( pwritefds && wxFD_ISSET(m_fd, pwritefds) )
{
diff --git a/Externals/wxWidgets3/src/common/textcmn.cpp b/Externals/wxWidgets3/src/common/textcmn.cpp
index 22d5b72..4cba1de 100644
--- a/Externals/wxWidgets3/src/common/textcmn.cpp
+++ b/Externals/wxWidgets3/src/common/textcmn.cpp
@@ -227,42 +227,43 @@ bool wxTextAttr::operator== (const wxTextAttr& attr) const
{
return GetFlags() == attr.GetFlags() &&
- GetTextColour() == attr.GetTextColour() &&
- GetBackgroundColour() == attr.GetBackgroundColour() &&
-
- GetAlignment() == attr.GetAlignment() &&
- GetLeftIndent() == attr.GetLeftIndent() &&
- GetLeftSubIndent() == attr.GetLeftSubIndent() &&
- GetRightIndent() == attr.GetRightIndent() &&
- TabsEq(GetTabs(), attr.GetTabs()) &&
-
- GetParagraphSpacingAfter() == attr.GetParagraphSpacingAfter() &&
- GetParagraphSpacingBefore() == attr.GetParagraphSpacingBefore() &&
- GetLineSpacing() == attr.GetLineSpacing() &&
- GetCharacterStyleName() == attr.GetCharacterStyleName() &&
- GetParagraphStyleName() == attr.GetParagraphStyleName() &&
- GetListStyleName() == attr.GetListStyleName() &&
-
- GetBulletStyle() == attr.GetBulletStyle() &&
- GetBulletText() == attr.GetBulletText() &&
- GetBulletNumber() == attr.GetBulletNumber() &&
- GetBulletFont() == attr.GetBulletFont() &&
- GetBulletName() == attr.GetBulletName() &&
-
- GetTextEffects() == attr.GetTextEffects() &&
- GetTextEffectFlags() == attr.GetTextEffectFlags() &&
-
- GetOutlineLevel() == attr.GetOutlineLevel() &&
-
- GetFontSize() == attr.GetFontSize() &&
- GetFontStyle() == attr.GetFontStyle() &&
- GetFontWeight() == attr.GetFontWeight() &&
- GetFontUnderlined() == attr.GetFontUnderlined() &&
- GetFontFaceName() == attr.GetFontFaceName() &&
- GetFontEncoding() == attr.GetFontEncoding() &&
- GetFontFamily() == attr.GetFontFamily() &&
-
- GetURL() == attr.GetURL();
+ (!HasTextColour() || (GetTextColour() == attr.GetTextColour())) &&
+ (!HasBackgroundColour() || (GetBackgroundColour() == attr.GetBackgroundColour())) &&
+
+ (!HasAlignment() || (GetAlignment() == attr.GetAlignment())) &&
+ (!HasLeftIndent() || (GetLeftIndent() == attr.GetLeftIndent() &&
+ GetLeftSubIndent() == attr.GetLeftSubIndent())) &&
+ (!HasRightIndent() || (GetRightIndent() == attr.GetRightIndent())) &&
+ (!HasTabs() || (TabsEq(GetTabs(), attr.GetTabs()))) &&
+
+ (!HasParagraphSpacingAfter() || (GetParagraphSpacingAfter() == attr.GetParagraphSpacingAfter())) &&
+ (!HasParagraphSpacingBefore() || (GetParagraphSpacingBefore() == attr.GetParagraphSpacingBefore())) &&
+ (!HasLineSpacing() || (GetLineSpacing() == attr.GetLineSpacing())) &&
+ (!HasCharacterStyleName() || (GetCharacterStyleName() == attr.GetCharacterStyleName())) &&
+ (!HasParagraphStyleName() || (GetParagraphStyleName() == attr.GetParagraphStyleName())) &&
+ (!HasListStyleName() || (GetListStyleName() == attr.GetListStyleName())) &&
+
+ (!HasBulletStyle() || (GetBulletStyle() == attr.GetBulletStyle())) &&
+ (!HasBulletText() || (GetBulletText() == attr.GetBulletText())) &&
+ (!HasBulletNumber() || (GetBulletNumber() == attr.GetBulletNumber())) &&
+ (GetBulletFont() == attr.GetBulletFont()) &&
+ (!HasBulletName() || (GetBulletName() == attr.GetBulletName())) &&
+
+ (!HasTextEffects() || (GetTextEffects() == attr.GetTextEffects() &&
+ GetTextEffectFlags() == attr.GetTextEffectFlags())) &&
+
+ (!HasOutlineLevel() || (GetOutlineLevel() == attr.GetOutlineLevel())) &&
+
+ (!HasFontSize() || (GetFontSize() == attr.GetFontSize())) &&
+ (!HasFontItalic() || (GetFontStyle() == attr.GetFontStyle())) &&
+ (!HasFontWeight() || (GetFontWeight() == attr.GetFontWeight())) &&
+ (!HasFontUnderlined() || (GetFontUnderlined() == attr.GetFontUnderlined())) &&
+ (!HasFontStrikethrough() || (GetFontStrikethrough() == attr.GetFontStrikethrough())) &&
+ (!HasFontFaceName() || (GetFontFaceName() == attr.GetFontFaceName())) &&
+ (!HasFontEncoding() || (GetFontEncoding() == attr.GetFontEncoding())) &&
+ (!HasFontFamily() || (GetFontFamily() == attr.GetFontFamily())) &&
+
+ (!HasURL() || (GetURL() == attr.GetURL()));
}
// Partial equality test. Only returns false if an attribute doesn't match.
@@ -393,7 +394,7 @@ bool wxTextAttr::EqPartial(const wxTextAttr& attr, bool weakTest) const
if (HasTextEffects() && attr.HasTextEffects())
{
- if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), attr.GetTextEffectFlags()))
+ if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), GetTextEffectFlags()))
return false;
}
@@ -817,6 +818,19 @@ bool wxTextAttr::RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style)
int flags = style.GetFlags();
int destFlags = destStyle.GetFlags();
+ // We must treat text effects specially, since we must remove only some.
+ if (style.HasTextEffects() && (style.GetTextEffectFlags() != 0))
+ {
+ int newTextEffectFlags = destStyle.GetTextEffectFlags() & ~style.GetTextEffectFlags();
+ int newTextEffects = destStyle.GetTextEffects() & ~style.GetTextEffectFlags();
+ destStyle.SetTextEffects(newTextEffects);
+ destStyle.SetTextEffectFlags(newTextEffectFlags);
+
+ // Don't remove wxTEXT_ATTR_EFFECTS unless the resulting flags are zero
+ if (newTextEffectFlags != 0)
+ flags &= ~wxTEXT_ATTR_EFFECTS;
+ }
+
destStyle.SetFlags(destFlags & ~flags);
return true;
@@ -927,7 +941,7 @@ bool wxTextAreaBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType)
{
#if wxUSE_FFILE
wxFFile file(filename, wxT("w"));
- if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) )
+ if ( file.IsOpened() && file.Write(GetValue()) )
{
// if it worked, save for future calls
m_filename = filename;
diff --git a/Externals/wxWidgets3/src/common/textfile.cpp b/Externals/wxWidgets3/src/common/textfile.cpp
index 4c7d4c3..ddf88c9 100644
--- a/Externals/wxWidgets3/src/common/textfile.cpp
+++ b/Externals/wxWidgets3/src/common/textfile.cpp
@@ -208,8 +208,8 @@ bool wxTextFile::OnRead(const wxMBConv& conv)
// now break the buffer in lines
- // last processed character, we need to know if it was a CR or not
- wxChar chLast = '\0';
+ // was the last processed character a CR?
+ bool lastWasCR = false;
// the beginning of the current line, changes inside the loop
wxString::const_iterator lineStart = str.begin();
@@ -221,7 +221,7 @@ bool wxTextFile::OnRead(const wxMBConv& conv)
{
case '\n':
// could be a DOS or Unix EOL
- if ( chLast == '\r' )
+ if ( lastWasCR )
{
if ( p - 1 >= lineStart )
{
@@ -239,10 +239,11 @@ bool wxTextFile::OnRead(const wxMBConv& conv)
}
lineStart = p + 1;
+ lastWasCR = false;
break;
case '\r':
- if ( chLast == '\r' )
+ if ( lastWasCR )
{
// Mac empty line
AddLine(wxEmptyString, wxTextFileType_Mac);
@@ -250,10 +251,12 @@ bool wxTextFile::OnRead(const wxMBConv& conv)
}
//else: we don't know what this is yet -- could be a Mac EOL or
// start of DOS EOL so wait for next char
+
+ lastWasCR = true;
break;
default:
- if ( chLast == '\r' )
+ if ( lastWasCR )
{
// Mac line termination
if ( p - 1 >= lineStart )
@@ -267,16 +270,31 @@ bool wxTextFile::OnRead(const wxMBConv& conv)
}
lineStart = p;
}
+ lastWasCR = false;
}
-
- chLast = ch;
}
// anything in the last line?
if ( lineStart != end )
{
- // add unterminated last line
- AddLine(wxString(lineStart, end), wxTextFileType_None);
+ // add the last line, notice that it may have been terminated with CR
+ // as we don't end the line immediately when we see a CR, as it could
+ // be followed by a LF.
+ wxString lastLine(lineStart, end);
+ wxTextFileType lastType;
+ if ( lastWasCR )
+ {
+ // last line had Mac EOL, exclude it from the string
+ lastLine.RemoveLast();
+ lastType = wxTextFileType_Mac;
+ }
+ else
+ {
+ // last line wasn't terminated at all
+ lastType = wxTextFileType_None;
+ }
+
+ AddLine(lastLine, lastType);
}
return true;
diff --git a/Externals/wxWidgets3/src/common/threadinfo.cpp b/Externals/wxWidgets3/src/common/threadinfo.cpp
index 8ef745f..be07847 100644
--- a/Externals/wxWidgets3/src/common/threadinfo.cpp
+++ b/Externals/wxWidgets3/src/common/threadinfo.cpp
@@ -28,11 +28,26 @@ namespace
// All thread info objects are stored in a global list so that they are
// freed when global objects are destroyed and no memory leaks are reported.
-wxCriticalSection g_csAllThreadInfos;
+
+// Notice that we must be using accessor functions instead of simple global
+// variables here as this code could be executed during global initialization
+// time, i.e. before any globals in this module were initialzied.
+inline wxCriticalSection& GetAllThreadInfosCS()
+{
+ static wxCriticalSection s_csAllThreadInfos;
+
+ return s_csAllThreadInfos;
+}
+
typedef wxVector< wxSharedPtr<wxThreadSpecificInfo> > wxAllThreadInfos;
-wxAllThreadInfos g_allThreadInfos;
+inline wxAllThreadInfos& GetAllThreadInfos()
+{
+ static wxAllThreadInfos s_allThreadInfos;
+
+ return s_allThreadInfos;
+}
-// Pointer to currenct thread's instance
+// Pointer to the current thread's instance
wxTLS_TYPE(wxThreadSpecificInfo*) g_thisThreadInfo;
} // anonymous namespace
@@ -43,8 +58,8 @@ wxThreadSpecificInfo& wxThreadSpecificInfo::Get()
if ( !wxTLS_VALUE(g_thisThreadInfo) )
{
wxTLS_VALUE(g_thisThreadInfo) = new wxThreadSpecificInfo;
- wxCriticalSectionLocker lock(g_csAllThreadInfos);
- g_allThreadInfos.push_back(
+ wxCriticalSectionLocker lock(GetAllThreadInfosCS());
+ GetAllThreadInfos().push_back(
wxSharedPtr<wxThreadSpecificInfo>(wxTLS_VALUE(g_thisThreadInfo)));
}
return *wxTLS_VALUE(g_thisThreadInfo);
@@ -55,15 +70,15 @@ void wxThreadSpecificInfo::ThreadCleanUp()
if ( !wxTLS_VALUE(g_thisThreadInfo) )
return; // nothing to do, not used by this thread at all
- // find this thread's instance in g_allThreadInfos and destroy it
- wxCriticalSectionLocker lock(g_csAllThreadInfos);
- for ( wxAllThreadInfos::iterator i = g_allThreadInfos.begin();
- i != g_allThreadInfos.end();
+ // find this thread's instance in GetAllThreadInfos() and destroy it
+ wxCriticalSectionLocker lock(GetAllThreadInfosCS());
+ for ( wxAllThreadInfos::iterator i = GetAllThreadInfos().begin();
+ i != GetAllThreadInfos().end();
++i )
{
if ( i->get() == wxTLS_VALUE(g_thisThreadInfo) )
{
- g_allThreadInfos.erase(i);
+ GetAllThreadInfos().erase(i);
wxTLS_VALUE(g_thisThreadInfo) = NULL;
break;
}
diff --git a/Externals/wxWidgets3/src/common/toplvcmn.cpp b/Externals/wxWidgets3/src/common/toplvcmn.cpp
index b5d3e5e..03504cc 100644
--- a/Externals/wxWidgets3/src/common/toplvcmn.cpp
+++ b/Externals/wxWidgets3/src/common/toplvcmn.cpp
@@ -76,7 +76,7 @@ wxTopLevelWindowBase::~wxTopLevelWindowBase()
)
{
wxWindow * const win = wxDynamicCast(*i, wxWindow);
- if ( win && win->GetParent() == this )
+ if ( win && wxGetTopLevelParent(win->GetParent()) == this )
{
wxPendingDelete.erase(i);
diff --git a/Externals/wxWidgets3/src/common/utilscmn.cpp b/Externals/wxWidgets3/src/common/utilscmn.cpp
index 6c59707..0d30b02 100644
--- a/Externals/wxWidgets3/src/common/utilscmn.cpp
+++ b/Externals/wxWidgets3/src/common/utilscmn.cpp
@@ -630,7 +630,14 @@ static bool ReadAll(wxInputStream *is, wxArrayString& output)
// the stream could be already at EOF or in wxSTREAM_BROKEN_PIPE state
is->Reset();
- wxTextInputStream tis(*is);
+ // Notice that wxTextInputStream doesn't work correctly with wxConvAuto
+ // currently, see #14720, so use the current locale conversion explicitly
+ // under assumption that any external program should be using it too.
+ wxTextInputStream tis(*is, " \t"
+#if wxUSE_UNICODE
+ , wxConvLibc
+#endif
+ );
for ( ;; )
{
@@ -1198,6 +1205,7 @@ wxString wxStripMenuCodes(const wxString& in, int flags)
if ( ++it == in.end() )
{
wxLogDebug(wxT("Invalid menu string '%s'"), in.c_str());
+ break;
}
else
{
@@ -1414,7 +1422,7 @@ wxVersionInfo wxGetLibraryVersionInfo()
wxMINOR_VERSION,
wxRELEASE_NUMBER,
msg,
- wxS("Copyright (c) 1995-2011 wxWidgets team"));
+ wxS("Copyright (c) 1995-2013 wxWidgets team"));
}
void wxInfoMessageBox(wxWindow* parent)
diff --git a/Externals/wxWidgets3/src/common/wxcrt.cpp b/Externals/wxWidgets3/src/common/wxcrt.cpp
index d46c08b..819700c 100644
--- a/Externals/wxWidgets3/src/common/wxcrt.cpp
+++ b/Externals/wxWidgets3/src/common/wxcrt.cpp
@@ -89,7 +89,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n)
#ifdef HAVE_WCSRTOMBS
return mbsrtowcs(buf, &psz, n, &mbstate);
#else
- return wxMbstowcs(buf, psz, n);
+ return mbstowcs(buf, psz, n);
#endif
}
@@ -102,7 +102,7 @@ WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n)
#ifdef HAVE_WCSRTOMBS
return mbsrtowcs(NULL, &psz, 0, &mbstate);
#else
- return wxMbstowcs(NULL, psz, 0);
+ return mbstowcs(NULL, psz, 0);
#endif
}
@@ -122,14 +122,14 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *pwz, size_t n)
#ifdef HAVE_WCSRTOMBS
return wcsrtombs(buf, &pwz, n, &mbstate);
#else
- return wxWcstombs(buf, pwz, n);
+ return wcstombs(buf, pwz, n);
#endif
}
#ifdef HAVE_WCSRTOMBS
return wcsrtombs(NULL, &pwz, 0, &mbstate);
#else
- return wxWcstombs(NULL, pwz, 0);
+ return wcstombs(NULL, pwz, 0);
#endif
}
@@ -737,54 +737,6 @@ int wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argpt
// ctype.h stuff (currently unused)
// ----------------------------------------------------------------------------
-#ifdef wxNEED_WX_MBSTOWCS
-
-WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t * out, const char * in, size_t outlen)
-{
- if (!out)
- {
- size_t outsize = 0;
- while(*in++)
- outsize++;
- return outsize;
- }
-
- const char* origin = in;
-
- while (outlen-- && *in)
- {
- *out++ = (wchar_t) *in++;
- }
-
- *out = '\0';
-
- return in - origin;
-}
-
-WXDLLIMPEXP_BASE size_t wxWcstombs (char * out, const wchar_t * in, size_t outlen)
-{
- if (!out)
- {
- size_t outsize = 0;
- while(*in++)
- outsize++;
- return outsize;
- }
-
- const wchar_t* origin = in;
-
- while (outlen-- && *in)
- {
- *out++ = (char) *in++;
- }
-
- *out = '\0';
-
- return in - origin;
-}
-
-#endif // wxNEED_WX_MBSTOWCS
-
#ifndef wxCRT_StrdupA
WXDLLIMPEXP_BASE char *wxCRT_StrdupA(const char *s)
{
diff --git a/Externals/wxWidgets3/src/common/xlocale.cpp b/Externals/wxWidgets3/src/common/xlocale.cpp
index 37bc129..26ac4df 100644
--- a/Externals/wxWidgets3/src/common/xlocale.cpp
+++ b/Externals/wxWidgets3/src/common/xlocale.cpp
@@ -76,9 +76,10 @@ wxXLocale& wxXLocale::GetCLocale()
{
if ( !gs_cLocale )
{
- // NOTE: bcc551 has trouble doing static_cast with incomplete
- // type definition. reinterpret_cast used as workaround
- gs_cLocale = new wxXLocale( reinterpret_cast<wxXLocaleCTag *>(NULL) );
+ // Notice that we need a separate variable because clang 3.1 refuses to
+ // cast nullptr (which is how NULL is defined in it) to anything.
+ static wxXLocaleCTag* const tag = NULL;
+ gs_cLocale = new wxXLocale(tag);
}
return *gs_cLocale;
diff --git a/Externals/wxWidgets3/src/cwcopysetup.bat b/Externals/wxWidgets3/src/cwcopysetup.bat
index a918a7b..e69de29 100755
--- a/Externals/wxWidgets3/src/cwcopysetup.bat
+++ b/Externals/wxWidgets3/src/cwcopysetup.bat
@@ -1,32 +0,0 @@
-if exist ..\include\wx\msw\setup.h (
- echo include\wx\msw\setup.h already exists
-) else (
- copy /y ..\include\wx\msw\setup0.h ..\include\wx\msw\setup.h
-)
-
-if exist ..\lib\cw7msw (
- echo lib\cw7msw already exists
-) else (
- mkdir ..\lib\cw7msw
-)
-
-if exist ..\lib\cw7msw\include (
- echo lib\cw7msw\include already exists
-) else (
- mkdir ..\lib\cw7msw\include
-)
-
-if exist ..\lib\cw7msw\include\wx (
- echo lib\cw7msw\include\wx already exists
-) else (
- mkdir ..\lib\cw7msw\include\wx
-)
-
-if exist ..\lib\cw7msw\include\wx\setup.h (
- echo lib\cw7msw\include\wx\setup.h already exists
-) else (
- copy /y ..\include\wx\msw\setup.h ..\lib\cw7msw\include\wx\setup.h
-)
-
-rem pause
-
diff --git a/Externals/wxWidgets3/src/cwdcopysetup.bat b/Externals/wxWidgets3/src/cwdcopysetup.bat
index b902913..e69de29 100755
--- a/Externals/wxWidgets3/src/cwdcopysetup.bat
+++ b/Externals/wxWidgets3/src/cwdcopysetup.bat
@@ -1,32 +0,0 @@
-if exist ..\include\wx\msw\setup.h (
- echo include\wx\msw\setup.h already exists
-) else (
- copy /y ..\include\wx\msw\setup0.h ..\include\wx\msw\setup.h
-)
-
-if exist ..\lib\cw7mswd (
- echo lib\cw7mswd already exists
-) else (
- mkdir ..\lib\cw7mswd
-)
-
-if exist ..\lib\cw7mswd\include (
- echo lib\cw7mswd\include already exists
-) else (
- mkdir ..\lib\cw7mswd\include
-)
-
-if exist ..\lib\cw7mswd\include\wx (
- echo lib\cw7mswd\include\wx already exists
-) else (
- mkdir ..\lib\cw7mswd\include\wx
-)
-
-if exist ..\lib\cw7mswd\include\wx\setup.h (
- echo lib\cw7mswd\include\wx\setup.h already exists
-) else (
- copy /y ..\include\wx\msw\setup.h ..\lib\cw7mswd\include\wx\setup.h
-)
-
-rem pause
-
diff --git a/Externals/wxWidgets3/src/generic/aboutdlgg.cpp b/Externals/wxWidgets3/src/generic/aboutdlgg.cpp
index 2fe35a2..9cb1753 100644
--- a/Externals/wxWidgets3/src/generic/aboutdlgg.cpp
+++ b/Externals/wxWidgets3/src/generic/aboutdlgg.cpp
@@ -277,16 +277,24 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title,
void wxGenericAboutDialog::OnCloseWindow(wxCloseEvent& event)
{
- Destroy();
+ // safeguards in case the window is still shown using ShowModal
+ if ( !IsModal() )
+ Destroy();
event.Skip();
}
-void wxGenericAboutDialog::OnOK(wxCommandEvent& WXUNUSED(event))
+void wxGenericAboutDialog::OnOK(wxCommandEvent& event)
{
- // By default a modeless dialog would be just hidden, destroy this one
- // instead.
- Destroy();
+ // safeguards in case the window is still shown using ShowModal
+ if ( !IsModal() )
+ {
+ // By default a modeless dialog would be just hidden, destroy this one
+ // instead.
+ Destroy();
+ }
+ else
+ event.Skip();
}
#endif // !wxUSE_MODAL_ABOUT_DIALOG
diff --git a/Externals/wxWidgets3/src/generic/datavgen.cpp b/Externals/wxWidgets3/src/generic/datavgen.cpp
index d5c0614..9966400 100644
--- a/Externals/wxWidgets3/src/generic/datavgen.cpp
+++ b/Externals/wxWidgets3/src/generic/datavgen.cpp
@@ -119,6 +119,34 @@ wxDataViewColumn* GetExpanderColumnOrFirstOne(wxDataViewCtrl* dataview)
return expander;
}
+wxTextCtrl *CreateEditorTextCtrl(wxWindow *parent, const wxRect& labelRect, const wxString& value)
+{
+ wxTextCtrl* ctrl = new wxTextCtrl(parent, wxID_ANY, value,
+ wxPoint(labelRect.x,labelRect.y),
+ wxSize(labelRect.width,labelRect.height),
+ wxTE_PROCESS_ENTER);
+
+ // Adjust size of wxTextCtrl editor to fit text, even if it means being
+ // wider than the corresponding column (this is how Explorer behaves).
+ const int fitting = ctrl->GetSizeFromTextSize(ctrl->GetTextExtent(ctrl->GetValue())).x;
+ const int current = ctrl->GetSize().x;
+ const int maxwidth = ctrl->GetParent()->GetSize().x - ctrl->GetPosition().x;
+
+ // Adjust size so that it fits all content. Don't change anything if the
+ // allocated space is already larger than needed and don't extend wxDVC's
+ // boundaries.
+ int width = wxMin(wxMax(current, fitting), maxwidth);
+
+ if ( width != current )
+ ctrl->SetSize(wxSize(width, -1));
+
+ // select the text in the control an place the cursor at the end
+ ctrl->SetInsertionPointEnd();
+ ctrl->SelectAll();
+
+ return ctrl;
+}
+
} // anonymous namespace
//-----------------------------------------------------------------------------
@@ -229,6 +257,8 @@ protected:
}
private:
+ void FinishEditing();
+
bool SendEvent(wxEventType type, unsigned int n)
{
wxDataViewCtrl * const owner = GetOwner();
@@ -246,6 +276,8 @@ private:
void OnClick(wxHeaderCtrlEvent& event)
{
+ FinishEditing();
+
const unsigned idx = event.GetColumn();
if ( SendEvent(wxEVT_DATAVIEW_COLUMN_HEADER_CLICK, idx) )
@@ -290,6 +322,8 @@ private:
void OnResize(wxHeaderCtrlEvent& event)
{
+ FinishEditing();
+
wxDataViewCtrl * const owner = GetOwner();
const unsigned col = event.GetColumn();
@@ -299,6 +333,8 @@ private:
void OnEndReorder(wxHeaderCtrlEvent& event)
{
+ FinishEditing();
+
wxDataViewCtrl * const owner = GetOwner();
owner->ColumnMoved(owner->GetColumn(event.GetColumn()),
event.GetNewOrder());
@@ -766,9 +802,13 @@ public:
void OnColumnsCountChanged();
+ // Adjust last column to window size
+ void UpdateColumnSizes();
+
// Called by wxDataViewCtrl and our own OnRenameTimer() to start edit the
// specified item in the given column.
void StartEditing(const wxDataViewItem& item, const wxDataViewColumn* col);
+ void FinishEditing();
private:
int RecalculateCount() const;
@@ -958,16 +998,7 @@ bool wxDataViewTextRenderer::HasEditorCtrl() const
wxWindow* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent,
wxRect labelRect, const wxVariant &value )
{
- wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, value,
- wxPoint(labelRect.x,labelRect.y),
- wxSize(labelRect.width,labelRect.height),
- wxTE_PROCESS_ENTER );
-
- // select the text in the control an place the cursor at the end
- ctrl->SetInsertionPointEnd();
- ctrl->SelectAll();
-
- return ctrl;
+ return CreateEditorTextCtrl(parent, labelRect, value);
}
bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant &value )
@@ -1167,7 +1198,11 @@ wxDataViewProgressRenderer::Render(wxRect rect, wxDC *dc, int WXUNUSED(state))
wxSize wxDataViewProgressRenderer::GetSize() const
{
- return wxSize(40,12);
+ // Return -1 width because a progress bar fits any width; unlike most
+ // renderers, it doesn't have a "good" width for the content. This makes it
+ // grow to the whole column, which is pretty much always the desired
+ // behaviour. Keep the height fixed so that the progress bar isn't too fat.
+ return wxSize(-1, 12);
}
// ---------------------------------------------------------
@@ -1239,16 +1274,7 @@ wxWindow* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect
labelRect.width -= w;
}
- wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, text,
- wxPoint(labelRect.x,labelRect.y),
- wxSize(labelRect.width,labelRect.height),
- wxTE_PROCESS_ENTER );
-
- // select the text in the control an place the cursor at the end
- ctrl->SetInsertionPointEnd();
- ctrl->SelectAll();
-
- return ctrl;
+ return CreateEditorTextCtrl(parent, labelRect, text);
}
bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant& value )
@@ -2194,6 +2220,20 @@ wxDataViewMainWindow::StartEditing(const wxDataViewItem& item,
}
}
+void wxDataViewMainWindow::FinishEditing()
+{
+ if ( m_editorCtrl )
+ {
+ m_editorRenderer->FinishEditing();
+ }
+}
+
+void wxDataViewHeaderWindow::FinishEditing()
+{
+ wxDataViewMainWindow *win = static_cast<wxDataViewMainWindow*>(GetOwner()->GetMainWindow());
+ win->FinishEditing();
+}
+
//-----------------------------------------------------------------------------
// Helper class for do operation on the tree node
//-----------------------------------------------------------------------------
@@ -2489,18 +2529,8 @@ bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item)
bool wxDataViewMainWindow::ValueChanged( const wxDataViewItem & item, unsigned int model_column )
{
- int view_column = -1;
- unsigned int n_col = m_owner->GetColumnCount();
- for (unsigned i = 0; i < n_col; i++)
- {
- wxDataViewColumn *column = m_owner->GetColumn( i );
- if (column->GetModelColumn() == model_column)
- {
- view_column = (int) i;
- break;
- }
- }
- if (view_column == -1)
+ int view_column = m_owner->GetModelColumnIndex(model_column);
+ if ( view_column == wxNOT_FOUND )
return false;
// NOTE: to be valid, we cannot use e.g. INT_MAX - 1
@@ -2564,6 +2594,7 @@ void wxDataViewMainWindow::OnInternalIdle()
if (m_dirty)
{
+ UpdateColumnSizes();
RecalculateDisplay();
m_dirty = false;
}
@@ -4389,9 +4420,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
// see #12270.
// adjust the rectangle ourselves to account for the alignment
- int align = cell->GetAlignment();
- if ( align == wxDVR_DEFAULT_ALIGNMENT )
- align = wxALIGN_CENTRE;
+ const int align = cell->GetEffectiveAlignment();
wxRect rectItem = cell_rect;
const wxSize size = cell->GetSize();
@@ -4464,11 +4493,44 @@ void wxDataViewMainWindow::OnColumnsCountChanged()
editableCount++;
}
- m_useCellFocus = (editableCount > 1);
+ m_useCellFocus = (editableCount > 0);
UpdateDisplay();
}
+void wxDataViewMainWindow::UpdateColumnSizes()
+{
+ int colsCount = GetOwner()->GetColumnCount();
+ if ( !colsCount )
+ return;
+
+ wxDataViewCtrl *owner = GetOwner();
+
+ int fullWinWidth = GetSize().x;
+
+ wxDataViewColumn *lastCol = owner->GetColumn(colsCount - 1);
+ int colswidth = GetEndOfLastCol();
+ int lastColX = colswidth - lastCol->GetWidth();
+ if ( lastColX < fullWinWidth )
+ {
+ int desiredWidth = wxMax(fullWinWidth - lastColX, lastCol->GetMinWidth());
+ lastCol->SetWidth(desiredWidth);
+
+ // All columns fit on screen, so we don't need horizontal scrolling.
+ // To prevent flickering scrollbar when resizing the window to be
+ // narrower, force-set the virtual width to 0 here. It will eventually
+ // be corrected at idle time.
+ SetVirtualSize(0, m_virtualSize.y);
+
+ RefreshRect(wxRect(lastColX, 0, fullWinWidth - lastColX, GetSize().y));
+ }
+ else
+ {
+ // else: don't bother, the columns won't fit anyway
+ SetVirtualSize(colswidth, m_virtualSize.y);
+ }
+}
+
//-----------------------------------------------------------------------------
// wxDataViewCtrl
//-----------------------------------------------------------------------------
@@ -4584,6 +4646,9 @@ wxSize wxDataViewCtrl::GetSizeAvailableForScrollTarget(const wxSize& size)
void wxDataViewCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
{
+ if ( m_clientArea && GetColumnCount() )
+ m_clientArea->UpdateColumnSizes();
+
// We need to override OnSize so that our scrolled
// window a) does call Layout() to use sizers for
// positioning the controls but b) does not query
@@ -4730,6 +4795,14 @@ void wxDataViewCtrl::OnColumnsCountChanged()
void wxDataViewCtrl::DoSetExpanderColumn()
{
+ wxDataViewColumn* column = GetExpanderColumn();
+ if ( column )
+ {
+ int index = GetColumnIndex(column);
+ if ( index != wxNOT_FOUND )
+ InvalidateColBestWidth(index);
+ }
+
m_clientArea->UpdateDisplay();
}
@@ -4780,6 +4853,18 @@ int wxDataViewCtrl::GetColumnIndex(const wxDataViewColumn *column) const
return wxNOT_FOUND;
}
+int wxDataViewCtrl::GetModelColumnIndex( unsigned int model_column ) const
+{
+ const int count = GetColumnCount();
+ for ( int index = 0; index < count; index++ )
+ {
+ wxDataViewColumn* column = GetColumn(index);
+ if ( column->GetModelColumn() == model_column )
+ return index;
+ }
+ return wxNOT_FOUND;
+}
+
unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
{
if ( m_colsBestWidths[idx].width != 0 )
@@ -4797,21 +4882,23 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
wxDataViewMainWindow *clientArea,
wxDataViewRenderer *renderer,
const wxDataViewModel *model,
- unsigned column,
+ unsigned int model_column,
int expanderSize)
: m_width(0),
m_dvc(dvc),
m_clientArea(clientArea),
m_renderer(renderer),
m_model(model),
- m_column(column),
+ 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<wxDataViewCtrl*>(dvc)) == dvc->GetColumnAt(column));
+ GetExpanderColumnOrFirstOne(const_cast<wxDataViewCtrl*>(dvc)) == column );
}
void UpdateWithWidth(int width)
@@ -4835,7 +4922,7 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
item = m_clientArea->GetItemByRow(row);
}
- m_renderer->PrepareForItem(m_model, item, m_column);
+ m_renderer->PrepareForItem(m_model, item, m_model_column);
m_width = wxMax(m_width, m_renderer->GetSize().x + indent);
}
@@ -4847,7 +4934,7 @@ unsigned int wxDataViewCtrl::GetBestColumnWidth(int idx) const
wxDataViewMainWindow *m_clientArea;
wxDataViewRenderer *m_renderer;
const wxDataViewModel *m_model;
- unsigned m_column;
+ unsigned m_model_column;
bool m_isExpanderCol;
int m_expanderSize;
};
diff --git a/Externals/wxWidgets3/src/generic/editlbox.cpp b/Externals/wxWidgets3/src/generic/editlbox.cpp
index 6502d4b..a236e62 100644
--- a/Externals/wxWidgets3/src/generic/editlbox.cpp
+++ b/Externals/wxWidgets3/src/generic/editlbox.cpp
@@ -378,10 +378,10 @@ void wxEditableListBox::SwapItems(long i1, long i2)
m_listCtrl->SetItemText(i2, t1);
// swap the item data
- long d1 = m_listCtrl->GetItemData(i1);
- long d2 = m_listCtrl->GetItemData(i2);
- m_listCtrl->SetItemData(i1, d2);
- m_listCtrl->SetItemData(i2, d1);
+ wxUIntPtr d1 = m_listCtrl->GetItemData(i1);
+ wxUIntPtr d2 = m_listCtrl->GetItemData(i2);
+ m_listCtrl->SetItemPtrData(i1, d2);
+ m_listCtrl->SetItemPtrData(i2, d1);
}
diff --git a/Externals/wxWidgets3/src/generic/infobar.cpp b/Externals/wxWidgets3/src/generic/infobar.cpp
index 49cdefc..3ae9262 100644
--- a/Externals/wxWidgets3/src/generic/infobar.cpp
+++ b/Externals/wxWidgets3/src/generic/infobar.cpp
@@ -69,9 +69,7 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid)
return false;
// use special, easy to notice, colours
- const wxColour colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK);
- SetBackgroundColour(colBg);
- SetOwnForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOBK));
// create the controls: icon, text and the button to dismiss the
// message.
@@ -80,6 +78,7 @@ bool wxInfoBarGeneric::Create(wxWindow *parent, wxWindowID winid)
m_icon = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap);
m_text = new wxStaticText(this, wxID_ANY, "");
+ m_text->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_INFOTEXT));
m_button = wxBitmapButton::NewCloseButton(this, wxID_ANY);
m_button->SetToolTip(_("Hide this notification message."));
@@ -111,6 +110,17 @@ bool wxInfoBarGeneric::SetFont(const wxFont& font)
return true;
}
+bool wxInfoBarGeneric::SetForegroundColour(const wxColor& colour)
+{
+ if ( !wxInfoBarBase::SetForegroundColour(colour) )
+ return false;
+
+ if ( m_text )
+ m_text->SetForegroundColour(colour);
+
+ return true;
+}
+
wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const
{
wxSizer * const sizer = GetContainingSizer();
diff --git a/Externals/wxWidgets3/src/generic/listctrl.cpp b/Externals/wxWidgets3/src/generic/listctrl.cpp
index 58a5c73..bbe22e4 100644
--- a/Externals/wxWidgets3/src/generic/listctrl.cpp
+++ b/Externals/wxWidgets3/src/generic/listctrl.cpp
@@ -3496,6 +3496,12 @@ size_t wxListMainWindow::GetItemCount() const
void wxListMainWindow::SetItemCount(long count)
{
+ // Update the current item if it's not valid any longer (notice that this
+ // invalidates it completely if the control is becoming empty, which is the
+ // right thing to do).
+ if ( HasCurrent() && m_current >= (size_t)count )
+ ChangeCurrent(count - 1);
+
m_selStore.SetItemCount(count);
m_countVirt = count;
@@ -5191,6 +5197,9 @@ void wxGenericListCtrl::OnInternalIdle()
bool wxGenericListCtrl::SetBackgroundColour( const wxColour &colour )
{
+ if ( !wxWindow::SetBackgroundColour( colour ) )
+ return false;
+
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
@@ -5211,9 +5220,6 @@ bool wxGenericListCtrl::SetForegroundColour( const wxColour &colour )
m_mainWin->m_dirty = true;
}
- if (m_headerWin)
- m_headerWin->SetForegroundColour( colour );
-
return true;
}
diff --git a/Externals/wxWidgets3/src/generic/prntdlgg.cpp b/Externals/wxWidgets3/src/generic/prntdlgg.cpp
index 61104b8..41d3dda 100644
--- a/Externals/wxWidgets3/src/generic/prntdlgg.cpp
+++ b/Externals/wxWidgets3/src/generic/prntdlgg.cpp
@@ -63,11 +63,6 @@
#ifndef __WXUNIVERSAL__
-#if wxUSE_LIBGNOMEPRINT
- #include "wx/link.h"
- wxFORCE_LINK_MODULE(gnome_print)
-#endif
-
#if wxUSE_GTKPRINT
#include "wx/link.h"
wxFORCE_LINK_MODULE(gtk_print)
diff --git a/Externals/wxWidgets3/src/generic/scrlwing.cpp b/Externals/wxWidgets3/src/generic/scrlwing.cpp
index 6291815..c14ab53 100644
--- a/Externals/wxWidgets3/src/generic/scrlwing.cpp
+++ b/Externals/wxWidgets3/src/generic/scrlwing.cpp
@@ -214,9 +214,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 +232,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);
diff --git a/Externals/wxWidgets3/src/generic/treelist.cpp b/Externals/wxWidgets3/src/generic/treelist.cpp
index 4d249c2..73fbe6c 100644
--- a/Externals/wxWidgets3/src/generic/treelist.cpp
+++ b/Externals/wxWidgets3/src/generic/treelist.cpp
@@ -716,8 +716,6 @@ void wxTreeListModel::DeleteItem(Node* item)
Node* const parent = item->GetParent();
- ItemDeleted(ToDVI(parent), ToDVI(item));
-
Node* previous = parent->GetChild();
if ( previous == item )
{
@@ -739,6 +737,8 @@ void wxTreeListModel::DeleteItem(Node* item)
previous->DeleteNext();
}
+
+ ItemDeleted(ToDVI(parent), ToDVI(item));
}
void wxTreeListModel::DeleteAllItems()
diff --git a/Externals/wxWidgets3/src/generic/vscroll.cpp b/Externals/wxWidgets3/src/generic/vscroll.cpp
index efbef67..38e882b 100644
--- a/Externals/wxWidgets3/src/generic/vscroll.cpp
+++ b/Externals/wxWidgets3/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();
@@ -142,6 +144,7 @@ bool wxVarScrollHelperEvtHandler::ProcessEvent(wxEvent& event)
else if ( evType == wxEVT_MOUSEWHEEL )
{
m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event);
+ return true;
}
#endif
#endif // wxUSE_MOUSEWHEEL
diff --git a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp
index dc1e889..127b50d 100644
--- a/Externals/wxWidgets3/src/gtk/bmpcbox.cpp
+++ b/Externals/wxWidgets3/src/gtk/bmpcbox.cpp
@@ -202,7 +202,7 @@ void wxBitmapComboBox::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
if ( gtk_tree_model_iter_nth_child( model, &iter, NULL, n ) )
{
- GValue value0 = { 0, };
+ GValue value0 = G_VALUE_INIT;
g_value_init( &value0, G_TYPE_OBJECT );
g_value_set_object( &value0, bitmap.GetPixbuf() );
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter,
@@ -222,7 +222,7 @@ wxBitmap wxBitmapComboBox::GetItemBitmap(unsigned int n) const
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
gtk_tree_model_get_value( model, &iter,
m_bitmapCellIndex, &value );
GdkPixbuf* pixbuf = (GdkPixbuf*) g_value_get_object( &value );
@@ -300,7 +300,7 @@ void wxBitmapComboBox::GTKInsertComboBoxTextItem( unsigned int n, const wxString
gtk_list_store_insert( store, &iter, n );
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
g_value_init( &value, G_TYPE_STRING );
g_value_set_string( &value, wxGTK_CONV( text ) );
gtk_list_store_set_value( store, &iter, m_stringCellIndex, &value );
diff --git a/Externals/wxWidgets3/src/gtk/checklst.cpp b/Externals/wxWidgets3/src/gtk/checklst.cpp
index 0a9d318..9c5e706 100644
--- a/Externals/wxWidgets3/src/gtk/checklst.cpp
+++ b/Externals/wxWidgets3/src/gtk/checklst.cpp
@@ -15,6 +15,7 @@
#include "wx/checklst.h"
#include <gtk/gtk.h>
+#include "wx/gtk/private.h"
//-----------------------------------------------------------------------------
// "toggled"
@@ -111,7 +112,7 @@ bool wxCheckListBox::IsChecked(unsigned int index) const
if(!res)
return false;
- GValue value = {0, };
+ GValue value = G_VALUE_INIT;
gtk_tree_model_get_value(GTK_TREE_MODEL(m_liststore),
&iter,
0, //column
diff --git a/Externals/wxWidgets3/src/gtk/choice.cpp b/Externals/wxWidgets3/src/gtk/choice.cpp
index d8819a2..c30e031 100644
--- a/Externals/wxWidgets3/src/gtk/choice.cpp
+++ b/Externals/wxWidgets3/src/gtk/choice.cpp
@@ -208,7 +208,7 @@ int wxChoice::FindString( const wxString &item, bool bCase ) const
int count = 0;
do
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value );
@@ -239,7 +239,7 @@ void wxChoice::SetString(unsigned int n, const wxString &text)
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
g_value_init( &value, G_TYPE_STRING );
g_value_set_string( &value, wxGTK_CONV( text ) );
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, m_stringCellIndex, &value );
@@ -260,7 +260,7 @@ wxString wxChoice::GetString(unsigned int n) const
GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value );
@@ -305,10 +305,7 @@ void wxChoice::SetColumns(int n)
int wxChoice::GetColumns() const
{
- // gtk_combo_box_get_wrap_width() was added in gtk 2.6
- gint intval;
- g_object_get(G_OBJECT(m_widget), "wrap-width", &intval, NULL);
- return intval;
+ return gtk_combo_box_get_wrap_width(GTK_COMBO_BOX(m_widget));
}
void wxChoice::GTKDisableEvents()
diff --git a/Externals/wxWidgets3/src/gtk/control.cpp b/Externals/wxWidgets3/src/gtk/control.cpp
index b63b370..c263377 100644
--- a/Externals/wxWidgets3/src/gtk/control.cpp
+++ b/Externals/wxWidgets3/src/gtk/control.cpp
@@ -254,9 +254,9 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
gtk_style_context_get_background_color(sc, stateFlag, &c);
attr.colBg = wxColour(c);
wxNativeFontInfo info;
- info.description = const_cast<PangoFontDescription*>(gtk_style_context_get_font(sc, stateFlag));
+ gtk_style_context_get(
+ sc, stateFlag, GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
attr.font = wxFont(info);
- info.description = NULL;
#else
GtkStyle* style;
diff --git a/Externals/wxWidgets3/src/gtk/dataview.cpp b/Externals/wxWidgets3/src/gtk/dataview.cpp
index c58858a..7a181fd 100644
--- a/Externals/wxWidgets3/src/gtk/dataview.cpp
+++ b/Externals/wxWidgets3/src/gtk/dataview.cpp
@@ -608,6 +608,7 @@ gtk_wx_tree_model_get_type (void)
sizeof (GtkWxTreeModel),
0,
wxgtk_tree_model_init,
+ NULL
};
static const GInterfaceInfo tree_model_iface_info =
@@ -1114,6 +1115,7 @@ gtk_wx_cell_renderer_text_get_type (void)
sizeof (GtkWxCellRendererText),
0, /* n_preallocs */
gtk_wx_cell_renderer_text_init,
+ NULL
};
cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER_TEXT,
@@ -1264,6 +1266,7 @@ gtk_wx_cell_renderer_get_type (void)
sizeof (GtkWxCellRenderer),
0, /* n_preallocs */
gtk_wx_cell_renderer_init,
+ NULL
};
cell_wx_type = g_type_register_static( GTK_TYPE_CELL_RENDERER,
@@ -1875,7 +1878,7 @@ void wxDataViewRenderer::SetMode( wxDataViewCellMode mode )
m_mode = mode;
// This value is most often ignored in GtkTreeView
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, gtk_cell_renderer_mode_get_type() );
g_value_set_enum( &gvalue, gtkMode );
g_object_set_property( G_OBJECT(m_renderer), "mode", &gvalue );
@@ -1936,7 +1939,7 @@ void wxDataViewRenderer::GtkApplyAlignment(GtkCellRenderer *renderer)
else if (align & wxALIGN_CENTER_HORIZONTAL)
xalign = 0.5;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_FLOAT );
g_value_set_float( &gvalue, xalign );
g_object_set_property( G_OBJECT(renderer), "xalign", &gvalue );
@@ -1950,7 +1953,7 @@ void wxDataViewRenderer::GtkApplyAlignment(GtkCellRenderer *renderer)
else if (align & wxALIGN_CENTER_VERTICAL)
yalign = 0.5;
- GValue gvalue2 = { 0, };
+ GValue gvalue2 = G_VALUE_INIT;
g_value_init( &gvalue2, G_TYPE_FLOAT );
g_value_set_float( &gvalue2, yalign );
g_object_set_property( G_OBJECT(renderer), "yalign", &gvalue2 );
@@ -1976,7 +1979,7 @@ void wxDataViewRenderer::EnableEllipsize(wxEllipsizeMode mode)
// we use the same values in wxEllipsizeMode as PangoEllipsizeMode so we
// can just cast between them
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, PANGO_TYPE_ELLIPSIZE_MODE );
g_value_set_enum( &gvalue, static_cast<PangoEllipsizeMode>(mode) );
g_object_set_property( G_OBJECT(rend), "ellipsize", &gvalue );
@@ -1989,7 +1992,7 @@ wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const
if ( !rend )
return wxELLIPSIZE_NONE;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, PANGO_TYPE_ELLIPSIZE_MODE );
g_object_get_property( G_OBJECT(rend), "ellipsize", &gvalue );
wxEllipsizeMode
@@ -2052,7 +2055,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
{
const GdkColor * const gcol = attr.GetColour().GetColor();
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, GDK_TYPE_COLOR );
g_value_set_boxed( &gvalue, gcol );
g_object_set_property( G_OBJECT(renderer), "foreground_gdk", &gvalue );
@@ -2062,7 +2065,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
}
else
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, FALSE );
g_object_set_property( G_OBJECT(renderer), "foreground-set", &gvalue );
@@ -2071,7 +2074,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
if (attr.GetItalic())
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, PANGO_TYPE_STYLE );
g_value_set_enum( &gvalue, PANGO_STYLE_ITALIC );
g_object_set_property( G_OBJECT(renderer), "style", &gvalue );
@@ -2081,7 +2084,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
}
else
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, FALSE );
g_object_set_property( G_OBJECT(renderer), "style-set", &gvalue );
@@ -2091,7 +2094,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
if (attr.GetBold())
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, PANGO_TYPE_WEIGHT );
g_value_set_enum( &gvalue, PANGO_WEIGHT_BOLD );
g_object_set_property( G_OBJECT(renderer), "weight", &gvalue );
@@ -2101,7 +2104,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
}
else
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, FALSE );
g_object_set_property( G_OBJECT(renderer), "weight-set", &gvalue );
@@ -2114,7 +2117,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
wxColour colour = attr.GetBackgroundColour();
const GdkColor * const gcol = colour.GetColor();
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, GDK_TYPE_COLOR );
g_value_set_boxed( &gvalue, gcol );
g_object_set_property( G_OBJECT(renderer), "cell-background_gdk", &gvalue );
@@ -2122,7 +2125,7 @@ bool GtkApplyAttr(GtkCellRendererText *renderer, const wxDataViewItemAttr& attr)
}
else
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, FALSE );
g_object_set_property( G_OBJECT(renderer), "cell-background-set", &gvalue );
@@ -2147,7 +2150,7 @@ wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype, wxD
if (mode & wxDATAVIEW_CELL_EDITABLE)
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, true );
g_object_set_property( G_OBJECT(m_renderer), "editable", &gvalue );
@@ -2164,7 +2167,7 @@ wxDataViewTextRenderer::wxDataViewTextRenderer( const wxString &varianttype, wxD
bool wxDataViewTextRenderer::SetTextValue(const wxString& str)
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
g_value_set_string( &gvalue, wxGTK_CONV_FONT( str, GetOwner()->GetOwner()->GetFont() ) );
g_object_set_property( G_OBJECT(m_renderer), "text", &gvalue );
@@ -2175,7 +2178,7 @@ bool wxDataViewTextRenderer::SetTextValue(const wxString& str)
bool wxDataViewTextRenderer::GetTextValue(wxString& str) const
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
str = wxGTK_CONV_BACK_FONT( g_value_get_string( &gvalue ), const_cast<wxDataViewTextRenderer*>(this)->GetOwner()->GetOwner()->GetFont() );
@@ -2200,7 +2203,7 @@ void wxDataViewTextRenderer::SetAlignment( int align )
else if (align & wxALIGN_CENTER_HORIZONTAL)
pangoAlign = PANGO_ALIGN_CENTER;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, gtk_cell_renderer_mode_get_type() );
g_value_set_enum( &gvalue, pangoAlign );
g_object_set_property( G_OBJECT(m_renderer), "alignment", &gvalue );
@@ -2227,7 +2230,7 @@ namespace
// set "pixbuf" property on the given renderer
void SetPixbufProp(GtkCellRenderer *renderer, GdkPixbuf *pixbuf)
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_OBJECT );
g_value_set_object( &gvalue, pixbuf );
g_object_set_property( G_OBJECT(renderer), "pixbuf", &gvalue );
@@ -2294,7 +2297,7 @@ static void wxGtkToggleRendererToggledCallback( GtkCellRendererToggle *renderer,
wxDataViewToggleRenderer *cell = (wxDataViewToggleRenderer*) user_data;
// get old value
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_object_get_property( G_OBJECT(renderer), "active", &gvalue );
// invert it
@@ -2329,7 +2332,7 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString &varianttype,
}
else
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, false );
g_object_set_property( G_OBJECT(m_renderer), "activatable", &gvalue );
@@ -2344,7 +2347,7 @@ bool wxDataViewToggleRenderer::SetValue( const wxVariant &value )
{
bool tmp = value;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, tmp );
g_object_set_property( G_OBJECT(m_renderer), "active", &gvalue );
@@ -2355,7 +2358,7 @@ bool wxDataViewToggleRenderer::SetValue( const wxVariant &value )
bool wxDataViewToggleRenderer::GetValue( wxVariant &value ) const
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_object_get_property( G_OBJECT(m_renderer), "active", &gvalue );
value = g_value_get_boolean( &gvalue ) != 0;
@@ -2451,7 +2454,7 @@ void wxDataViewCustomRenderer::RenderText( const wxString &text,
GtkCellRendererText * const textRenderer = GtkGetTextRenderer();
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
g_value_set_string( &gvalue, wxGTK_CONV_FONT( text, GetOwner()->GetOwner()->GetFont() ) );
g_object_set_property( G_OBJECT(textRenderer), "text", &gvalue );
@@ -2562,7 +2565,7 @@ wxDataViewProgressRenderer::~wxDataViewProgressRenderer()
void wxDataViewProgressRenderer::GTKSetLabel()
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
// Take care to not use GetOwner() here if the label is empty, we can be
@@ -2590,7 +2593,7 @@ bool wxDataViewProgressRenderer::SetValue( const wxVariant &value )
#endif // !wxUSE_UNICODE
gint tmp = (long) value;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_INT );
g_value_set_int( &gvalue, tmp );
g_object_set_property( G_OBJECT(m_renderer), "value", &gvalue );
@@ -2672,7 +2675,7 @@ wxSize wxDataViewChoiceRenderer::GetSize() const
bool wxDataViewChoiceRenderer::SetValue( const wxVariant &value )
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
g_value_set_string(&gvalue,
wxGTK_CONV_FONT(value.GetString(),
@@ -2685,7 +2688,7 @@ bool wxDataViewChoiceRenderer::SetValue( const wxVariant &value )
bool wxDataViewChoiceRenderer::GetValue( wxVariant &value ) const
{
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_STRING );
g_object_get_property( G_OBJECT(m_renderer), "text", &gvalue );
wxString temp = wxGTK_CONV_BACK_FONT(g_value_get_string(&gvalue),
@@ -2712,7 +2715,7 @@ void wxDataViewChoiceRenderer::SetAlignment( int align )
else if (align & wxALIGN_CENTER_HORIZONTAL)
pangoAlign = PANGO_ALIGN_CENTER;
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, gtk_cell_renderer_mode_get_type() );
g_value_set_enum( &gvalue, pangoAlign );
g_object_set_property( G_OBJECT(m_renderer), "alignment", &gvalue );
@@ -2894,7 +2897,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
visible = true;
}
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, visible );
g_object_set_property( G_OBJECT(renderer), "visible", &gvalue );
@@ -2920,7 +2923,7 @@ static void wxGtkTreeCellDataFunc( GtkTreeViewColumn *WXUNUSED(column),
bool enabled = wx_model->IsEnabled( item, cell->GetOwner()->GetModelColumn() );
// a) this sets the appearance to disabled grey
- GValue gvalue = { 0, };
+ GValue gvalue = G_VALUE_INIT;
g_value_init( &gvalue, G_TYPE_BOOLEAN );
g_value_set_boolean( &gvalue, enabled );
g_object_set_property( G_OBJECT(renderer), "sensitive", &gvalue );
@@ -4260,6 +4263,7 @@ wxdataview_selection_changed_callback( GtkTreeSelection* WXUNUSED(selection), wx
return;
wxDataViewEvent event( wxEVT_DATAVIEW_SELECTION_CHANGED, dv->GetId() );
+ event.SetEventObject( dv );
event.SetItem( dv->GetSelection() );
event.SetModel( dv->GetModel() );
dv->HandleWindowEvent( event );
@@ -4437,6 +4441,16 @@ gtk_dataview_button_press_callback( GtkWidget *WXUNUSED(widget),
&cell_y
);
+ // If the right click is on an item that isn't selected, select it, as is
+ // commonly done. Do not do it if the item under mouse is already selected,
+ // because it could be a part of multi-item selection.
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dv->GtkGetTreeView()));
+ if ( !gtk_tree_selection_path_is_selected(selection, path) )
+ {
+ gtk_tree_selection_unselect_all(selection);
+ gtk_tree_selection_select_path(selection, path);
+ }
+
wxDataViewEvent event( wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, dv->GetId() );
if (path)
event.SetItem(dv->GTKPathToItem(path));
@@ -4594,6 +4608,9 @@ void wxDataViewCtrl::OnInternalIdle()
{
wxWindow::OnInternalIdle();
+ if ( !m_internal )
+ return;
+
m_internal->OnInternalIdle();
unsigned int cols = GetColumnCount();
@@ -4625,18 +4642,21 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model )
bool fixed = (((GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) == 0) || (model->IsVirtualListModel()));
gtk_tree_view_set_fixed_height_mode( GTK_TREE_VIEW(m_treeview), fixed );
- m_internal = new wxDataViewCtrlInternal( this, model );
+ if ( model )
+ m_internal = new wxDataViewCtrlInternal( this, model );
return true;
}
bool wxDataViewCtrl::EnableDragSource( const wxDataFormat &format )
{
+ wxCHECK_MSG( m_internal, false, "model must be associated before calling EnableDragSource" );
return m_internal->EnableDragSource( format );
}
bool wxDataViewCtrl::EnableDropTarget( const wxDataFormat &format )
{
+ wxCHECK_MSG( m_internal, false, "model must be associated before calling EnableDragTarget" );
return m_internal->EnableDropTarget( format );
}
@@ -4765,6 +4785,7 @@ int wxDataViewCtrl::GetColumnPosition( const wxDataViewColumn *column ) const
wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
{
+ wxCHECK_MSG( m_internal, NULL, "model must be associated before calling GetSortingColumn" );
return m_internal->GetDataViewSortColumn();
}
@@ -4778,6 +4799,8 @@ void wxDataViewCtrl::Expand( const wxDataViewItem & item )
void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
{
+ wxCHECK_RET( m_internal, "model must be associated before calling Collapse" );
+
GtkTreeIter iter;
iter.user_data = item.GetID();
wxGtkTreePath path(m_internal->get_path( &iter ));
@@ -4786,6 +4809,8 @@ void wxDataViewCtrl::Collapse( const wxDataViewItem & item )
bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
{
+ wxCHECK_MSG( m_internal, false, "model must be associated before calling IsExpanded" );
+
GtkTreeIter iter;
iter.user_data = item.GetID();
wxGtkTreePath path(m_internal->get_path( &iter ));
@@ -4797,7 +4822,7 @@ wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
// The tree doesn't have any current item if it hadn't been created yet but
// it's arguably not an error to call this function in this case so just
// return an invalid item without asserting.
- if ( !m_treeview )
+ if ( !m_treeview || !m_internal )
return wxDataViewItem();
wxGtkTreePath path;
@@ -4810,6 +4835,7 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
{
wxCHECK_RET( m_treeview,
"Current item can't be set before creating the control." );
+ wxCHECK_RET( m_internal, "model must be associated before setting current item" );
// We need to make sure the model knows about this item or the path would
// be invalid and gtk_tree_view_set_cursor() would silently do nothing.
@@ -4845,7 +4871,8 @@ wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const
void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
{
wxCHECK_RET( m_treeview,
- "Current item can't be set before creating the control." );
+ "item can't be edited before creating the control." );
+ wxCHECK_RET( m_internal, "model must be associated before editing an item" );
wxCHECK_RET( item.IsOk(), "invalid item" );
wxCHECK_RET( column, "no column provided" );
@@ -4878,6 +4905,8 @@ int wxDataViewCtrl::GetSelectedItemsCount() const
int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
{
+ wxCHECK_MSG( m_internal, 0, "model must be associated before calling GetSelections" );
+
sel.Clear();
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
@@ -4907,6 +4936,8 @@ int wxDataViewCtrl::GetSelections( wxDataViewItemArray & sel ) const
void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
{
+ wxCHECK_RET( m_internal, "model must be associated before calling SetSelections" );
+
GtkDisableSelectionEvents();
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
@@ -4938,6 +4969,8 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
void wxDataViewCtrl::Select( const wxDataViewItem & item )
{
+ wxCHECK_RET( m_internal, "model must be associated before calling Select" );
+
ExpandAncestors(item);
GtkDisableSelectionEvents();
@@ -4954,6 +4987,8 @@ void wxDataViewCtrl::Select( const wxDataViewItem & item )
void wxDataViewCtrl::Unselect( const wxDataViewItem & item )
{
+ wxCHECK_RET( m_internal, "model must be associated before calling Unselect" );
+
GtkDisableSelectionEvents();
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
@@ -4968,6 +5003,8 @@ void wxDataViewCtrl::Unselect( const wxDataViewItem & item )
bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const
{
+ wxCHECK_MSG( m_internal, false, "model must be associated before calling IsSelected" );
+
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
GtkTreeIter iter;
@@ -5002,6 +5039,8 @@ void wxDataViewCtrl::UnselectAll()
void wxDataViewCtrl::EnsureVisible(const wxDataViewItem& item,
const wxDataViewColumn *WXUNUSED(column))
{
+ wxCHECK_RET( m_internal, "model must be associated before calling EnsureVisible" );
+
m_ensureVisibleDefered = item;
ExpandAncestors(item);
@@ -5015,6 +5054,8 @@ void wxDataViewCtrl::HitTest(const wxPoint& point,
wxDataViewItem& item,
wxDataViewColumn *& column) const
{
+ wxCHECK_RET( m_internal, "model must be associated before calling HitTest" );
+
// gtk_tree_view_get_dest_row_at_pos() is the right one. But it does not tell the column.
// gtk_tree_view_get_path_at_pos() is the wrong function. It doesn't mind the header but returns column.
// See http://mail.gnome.org/archives/gtkmm-list/2005-January/msg00080.html
diff --git a/Externals/wxWidgets3/src/gtk/font.cpp b/Externals/wxWidgets3/src/gtk/font.cpp
index 734b722..9cd46ba 100644
--- a/Externals/wxWidgets3/src/gtk/font.cpp
+++ b/Externals/wxWidgets3/src/gtk/font.cpp
@@ -487,6 +487,7 @@ bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const
PangoAttrList* attrs = pango_attr_list_new();
PangoAttribute* a;
+#ifndef __WXGTK3__
if (wx_pango_version_check(1,16,0))
{
// a PangoLayout which has leading/trailing spaces with underlined font
@@ -525,6 +526,8 @@ bool wxFont::GTKSetPangoAttrs(PangoLayout* layout) const
pango_attr_list_insert(attrs, a);
}
}
+#endif // !__WXGTK3__
+
if (GetUnderlined())
{
a = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
diff --git a/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp b/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp
index c7b28d6..e69de29 100644
--- a/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp
+++ b/Externals/wxWidgets3/src/gtk/gnome/gprint.cpp
@@ -1,2121 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name: src/gtk/gnome/gprint.cpp
-// Author: Robert Roebling
-// Purpose: Implement GNOME printing support
-// Created: 09/20/04
-// Copyright: Robert Roebling
-// Licence: wxWindows Licence
-/////////////////////////////////////////////////////////////////////////////
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-#if wxUSE_LIBGNOMEPRINT
-
-#include "wx/gtk/gnome/gprint.h"
-
-#ifndef WX_PRECOMP
- #include "wx/log.h"
- #include "wx/dcmemory.h"
- #include "wx/icon.h"
- #include "wx/math.h"
- #include "wx/image.h"
- #include "wx/module.h"
- #include "wx/crt.h"
-#endif
-
-#include "wx/fontutil.h"
-#include "wx/gtk/private.h"
-#include "wx/dynlib.h"
-#include "wx/paper.h"
-#include "wx/dcprint.h"
-#include "wx/modalhook.h"
-
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-print-pango.h>
-#include <libgnomeprint/gnome-print-config.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
-#include <libgnomeprintui/gnome-print-job-preview.h>
-#include <libgnomeprintui/gnome-print-paper-selector.h>
-
-#include "wx/link.h"
-wxFORCE_LINK_THIS_MODULE(gnome_print)
-
-//----------------------------------------------------------------------------
-// wxGnomePrintLibrary
-//----------------------------------------------------------------------------
-
-class wxGnomePrintLibrary
-{
-public:
- wxGnomePrintLibrary();
- ~wxGnomePrintLibrary();
-
- bool IsOk();
-private:
- bool InitializeMethods();
-
- wxDynamicLibrary m_libGnomePrint;
- wxDynamicLibrary m_libGnomePrintUI;
-
- // only true if we successfully loaded both libraries
- //
- // don't rename this field, it's used by wxDL_XXX macros internally
- bool m_ok;
-
-public:
- wxDL_METHOD_DEFINE( gint, gnome_print_newpath,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_moveto,
- (GnomePrintContext *pc, gdouble x, gdouble y), (pc, x, y), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_lineto,
- (GnomePrintContext *pc, gdouble x, gdouble y), (pc, x, y), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_arcto,
- (GnomePrintContext *pc, gdouble x, gdouble y, gdouble radius, gdouble angle1, gdouble angle2, gint direction ), (pc, x, y, radius, angle1, angle2, direction), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_curveto,
- (GnomePrintContext *pc, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3), (pc, x1, y1, x2, y2, x3, y3), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_closepath,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_stroke,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_fill,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_setrgbcolor,
- (GnomePrintContext *pc, gdouble r, gdouble g, gdouble b), (pc, r, g, b), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_setlinewidth,
- (GnomePrintContext *pc, gdouble width), (pc, width), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_setdash,
- (GnomePrintContext *pc, gint n_values, const gdouble *values, gdouble offset), (pc, n_values, values, offset), 0 )
-
- wxDL_METHOD_DEFINE( gint, gnome_print_rgbimage,
- (GnomePrintContext *pc, const guchar *data, gint width, gint height, gint rowstride), (pc, data, width, height, rowstride ), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_rgbaimage,
- (GnomePrintContext *pc, const guchar *data, gint width, gint height, gint rowstride), (pc, data, width, height, rowstride ), 0 )
-
- wxDL_METHOD_DEFINE( gint, gnome_print_concat,
- (GnomePrintContext *pc, const gdouble *matrix), (pc, matrix), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_scale,
- (GnomePrintContext *pc, gdouble sx, gdouble sy), (pc, sx, sy), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_rotate,
- (GnomePrintContext *pc, gdouble theta), (pc, theta), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_translate,
- (GnomePrintContext *pc, gdouble x, gdouble y), (pc, x, y), 0 )
-
- wxDL_METHOD_DEFINE( gint, gnome_print_gsave,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_grestore,
- (GnomePrintContext *pc), (pc), 0 )
-
- wxDL_METHOD_DEFINE( gint, gnome_print_clip,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_eoclip,
- (GnomePrintContext *pc), (pc), 0 )
-
- wxDL_METHOD_DEFINE( gint, gnome_print_beginpage,
- (GnomePrintContext *pc, const guchar* name), (pc, name), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_showpage,
- (GnomePrintContext *pc), (pc), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_end_doc,
- (GnomePrintContext *pc), (pc), 0 )
-
- wxDL_METHOD_DEFINE( PangoLayout*, gnome_print_pango_create_layout,
- (GnomePrintContext *gpc), (gpc), NULL )
- wxDL_VOIDMETHOD_DEFINE( gnome_print_pango_layout,
- (GnomePrintContext *gpc, PangoLayout *layout), (gpc, layout) )
-
- wxDL_METHOD_DEFINE( GnomePrintJob*, gnome_print_job_new,
- (GnomePrintConfig *config), (config), NULL )
- wxDL_METHOD_DEFINE( GnomePrintContext*, gnome_print_job_get_context,
- (GnomePrintJob *job), (job), NULL )
- wxDL_METHOD_DEFINE( gint, gnome_print_job_close,
- (GnomePrintJob *job), (job), 0 )
- wxDL_METHOD_DEFINE( gint, gnome_print_job_print,
- (GnomePrintJob *job), (job), 0 )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_job_get_page_size,
- (GnomePrintJob *job, gdouble *width, gdouble *height), (job, width, height), 0 )
-
- wxDL_METHOD_DEFINE( GnomePrintUnit*, gnome_print_unit_get_by_abbreviation,
- (const guchar *abbreviation), (abbreviation), NULL )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_convert_distance,
- (gdouble *distance, const GnomePrintUnit *from, const GnomePrintUnit *to), (distance, from, to), false )
-
- wxDL_METHOD_DEFINE( GnomePrintConfig*, gnome_print_config_default,
- (void), (), NULL )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_set,
- (GnomePrintConfig *config, const guchar *key, const guchar *value), (config, key, value), false )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_set_double,
- (GnomePrintConfig *config, const guchar *key, gdouble value), (config, key, value), false )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_set_int,
- (GnomePrintConfig *config, const guchar *key, gint value), (config, key, value), false )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_set_boolean,
- (GnomePrintConfig *config, const guchar *key, gboolean value), (config, key, value), false )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_set_length,
- (GnomePrintConfig *config, const guchar *key, gdouble value, const GnomePrintUnit *unit), (config, key, value, unit), false )
-
- wxDL_METHOD_DEFINE( guchar*, gnome_print_config_get,
- (GnomePrintConfig *config, const guchar *key), (config, key), NULL )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_length,
- (GnomePrintConfig *config, const guchar *key, gdouble *val, const GnomePrintUnit **unit), (config, key, val, unit), false )
- wxDL_METHOD_DEFINE( gboolean, gnome_print_config_get_boolean,
- (GnomePrintConfig *config, const guchar *key, gboolean *val), (config, key, val), false )
-
- wxDL_METHOD_DEFINE( GtkWidget*, gnome_print_dialog_new,
- (GnomePrintJob *gpj, const guchar *title, gint flags), (gpj, title, flags), NULL )
- wxDL_VOIDMETHOD_DEFINE( gnome_print_dialog_construct_range_page,
- (GnomePrintDialog *gpd, gint flags, gint start, gint end,
- const guchar *currentlabel, const guchar *rangelabel),
- (gpd, flags, start, end, currentlabel, rangelabel) )
- wxDL_VOIDMETHOD_DEFINE( gnome_print_dialog_get_copies,
- (GnomePrintDialog *gpd, gint *copies, gboolean *collate), (gpd, copies, collate) )
- wxDL_VOIDMETHOD_DEFINE( gnome_print_dialog_set_copies,
- (GnomePrintDialog *gpd, gint copies, gint collate), (gpd, copies, collate) )
- wxDL_METHOD_DEFINE( GnomePrintRangeType, gnome_print_dialog_get_range,
- (GnomePrintDialog *gpd), (gpd), GNOME_PRINT_RANGETYPE_NONE )
- wxDL_METHOD_DEFINE( int, gnome_print_dialog_get_range_page,
- (GnomePrintDialog *gpd, gint *start, gint *end), (gpd, start, end), 0 )
-
- wxDL_METHOD_DEFINE( GtkWidget*, gnome_paper_selector_new_with_flags,
- (GnomePrintConfig *config, gint flags), (config, flags), NULL )
-
- wxDL_METHOD_DEFINE( GtkWidget*, gnome_print_job_preview_new,
- (GnomePrintJob *gpm, const guchar *title), (gpm, title), NULL )
-
- wxDECLARE_NO_COPY_CLASS(wxGnomePrintLibrary);
-};
-
-wxGnomePrintLibrary::wxGnomePrintLibrary()
-{
- wxLogNull log;
-
- m_libGnomePrint.Load("libgnomeprint-2-2.so.0");
- m_ok = m_libGnomePrint.IsLoaded();
- if ( !m_ok )
- return;
-
- m_libGnomePrintUI.Load("libgnomeprintui-2-2.so.0");
- m_ok = m_libGnomePrintUI.IsLoaded();
- if ( !m_ok )
- {
- m_libGnomePrint.Unload();
- return;
- }
-
- m_ok = InitializeMethods();
-}
-
-wxGnomePrintLibrary::~wxGnomePrintLibrary()
-{
-}
-
-bool wxGnomePrintLibrary::IsOk()
-{
- return m_ok;
-}
-
-bool wxGnomePrintLibrary::InitializeMethods()
-{
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_newpath );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_moveto );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_lineto );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_curveto );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_arcto );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_closepath );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_stroke );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_fill );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_setrgbcolor );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_setlinewidth );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_setdash );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_rgbimage );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_rgbaimage );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_concat );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_scale );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_rotate );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_translate );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_gsave );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_grestore );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_clip );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_eoclip );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_beginpage );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_showpage );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_end_doc );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_pango_create_layout );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_pango_layout );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_job_new );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_job_get_context );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_job_close );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_job_print );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_job_get_page_size );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_unit_get_by_abbreviation );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_convert_distance );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_default );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_set );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_set_boolean );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_set_double );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_set_int );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_set_length );
-
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get_length );
- wxDL_METHOD_LOAD( m_libGnomePrint, gnome_print_config_get_boolean );
-
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_new );
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_construct_range_page );
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_get_copies );
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_set_copies );
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_get_range );
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_dialog_get_range_page );
-
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_paper_selector_new_with_flags );
-
- wxDL_METHOD_LOAD( m_libGnomePrintUI, gnome_print_job_preview_new );
-
- return true;
-}
-
-static wxGnomePrintLibrary* gs_libGnomePrint = NULL;
-
-//----------------------------------------------------------------------------
-// wxGnomePrintNativeData
-//----------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGnomePrintNativeData, wxPrintNativeDataBase)
-
-wxGnomePrintNativeData::wxGnomePrintNativeData()
-{
- m_config = gs_libGnomePrint->gnome_print_config_default();
- m_job = gs_libGnomePrint->gnome_print_job_new( m_config );
-}
-
-wxGnomePrintNativeData::~wxGnomePrintNativeData()
-{
- g_object_unref (m_config);
-}
-
-bool wxGnomePrintNativeData::TransferTo( wxPrintData &data )
-{
- guchar *res = gs_libGnomePrint->gnome_print_config_get( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAGE_ORIENTATION );
- if (g_ascii_strcasecmp((const gchar *)res,"R90") == 0)
- data.SetOrientation( wxLANDSCAPE );
- else
- data.SetOrientation( wxPORTRAIT );
- g_free( res );
-
- res = gs_libGnomePrint->gnome_print_config_get( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_OUTPUT_FILENAME );
- if (res)
- {
- data.SetFilename( wxConvFile.cMB2WX( (const char*) res ) );
- wxPrintf( "filename %s\n", data.GetFilename() );
- g_free( res );
- }
- else
- {
- data.SetFilename( wxEmptyString );
- }
-
- gboolean ret;
- if (gs_libGnomePrint->gnome_print_config_get_boolean( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_COLLATE, &ret))
- {
- data.SetCollate( ret );
- }
-
- // gnome_print_v
-
- return true;
-}
-
-bool wxGnomePrintNativeData::TransferFrom( const wxPrintData &data )
-{
- if (data.GetOrientation() == wxLANDSCAPE)
- {
- gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAGE_ORIENTATION,
- (guchar*)(char*)"R90" );
- }
- else
- {
- gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAGE_ORIENTATION,
- (guchar*)(char*)"R0" );
- }
-
- if (data.GetCollate())
- {
- gs_libGnomePrint->gnome_print_config_set_boolean( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_COLLATE,
- TRUE );
- }
- else
- {
- gs_libGnomePrint->gnome_print_config_set_boolean( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_COLLATE,
- FALSE );
- }
-
- switch (data.GetPaperId())
- {
- case wxPAPER_A3: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"A3" );
- break;
- case wxPAPER_A5: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"A5" );
- break;
- case wxPAPER_B4: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"B4" );
- break;
- case wxPAPER_B5: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"B5" );
- break;
- case wxPAPER_LETTER: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"USLetter" );
- break;
- case wxPAPER_LEGAL: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"USLegal" );
- break;
- case wxPAPER_EXECUTIVE: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"Executive" );
- break;
- case wxPAPER_ENV_C5: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"C5" );
- break;
- case wxPAPER_ENV_C6: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"C6" );
- break;
- case wxPAPER_NONE: break;
-
- default:
- case wxPAPER_A4: gs_libGnomePrint->gnome_print_config_set( m_config,
- (guchar*)(char*)GNOME_PRINT_KEY_PAPER_SIZE,
- (guchar*)(char*)"A4" );
- break;
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------------
-// wxGnomePrintFactory
-//----------------------------------------------------------------------------
-
-wxPrinterBase* wxGnomePrintFactory::CreatePrinter( wxPrintDialogData *data )
-{
- return new wxGnomePrinter( data );
-}
-
-wxPrintPreviewBase *wxGnomePrintFactory::CreatePrintPreview( wxPrintout *preview,
- wxPrintout *printout,
- wxPrintDialogData *data )
-{
- return new wxGnomePrintPreview( preview, printout, data );
-}
-
-wxPrintPreviewBase *wxGnomePrintFactory::CreatePrintPreview( wxPrintout *preview,
- wxPrintout *printout,
- wxPrintData *data )
-{
- return new wxGnomePrintPreview( preview, printout, data );
-}
-
-wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent,
- wxPrintDialogData *data )
-{
- return new wxGnomePrintDialog( parent, data );
-}
-
-wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent,
- wxPrintData *data )
-{
- return new wxGnomePrintDialog( parent, data );
-}
-
-wxPageSetupDialogBase *wxGnomePrintFactory::CreatePageSetupDialog( wxWindow *parent,
- wxPageSetupDialogData * data )
-{
-// The native page setup dialog is broken. It
-// miscalculates newly entered values for the
-// margins if you have not chose "points" but
-// e.g. centimerters.
-// This has been fixed in GNOME CVS (maybe
-// fixed in libgnomeprintui 2.8.1)
-
- return new wxGnomePageSetupDialog( parent, data );
-}
-
-bool wxGnomePrintFactory::HasPrintSetupDialog()
-{
- return false;
-}
-
-wxDialog *
-wxGnomePrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent),
- wxPrintData * WXUNUSED(data))
-{
- return NULL;
-}
-
-
-#if wxUSE_NEW_DC
-
-wxDCImpl* wxGnomePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
-{
- return new wxGnomePrinterDCImpl( owner, data );
-}
-
-#else
-
-wxDC* wxGnomePrintFactory::CreatePrinterDC( const wxPrintData& data )
-{
- return new wxGnomePrinterDC(data);
-}
-
-#endif
-
-bool wxGnomePrintFactory::HasOwnPrintToFile()
-{
- return true;
-}
-
-bool wxGnomePrintFactory::HasPrinterLine()
-{
- return true;
-}
-
-wxString wxGnomePrintFactory::CreatePrinterLine()
-{
- // redundant now
- return wxEmptyString;
-}
-
-bool wxGnomePrintFactory::HasStatusLine()
-{
- // redundant now
- return true;
-}
-
-wxString wxGnomePrintFactory::CreateStatusLine()
-{
- // redundant now
- return wxEmptyString;
-}
-
-wxPrintNativeDataBase *wxGnomePrintFactory::CreatePrintNativeData()
-{
- return new wxGnomePrintNativeData;
-}
-
-//----------------------------------------------------------------------------
-// wxGnomePrintSetupDialog
-//----------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGnomePrintDialog, wxPrintDialogBase)
-
-wxGnomePrintDialog::wxGnomePrintDialog( wxWindow *parent, wxPrintDialogData *data )
- : wxPrintDialogBase(parent, wxID_ANY, _("Print"),
- wxPoint(0, 0), wxSize(600, 600),
- wxDEFAULT_DIALOG_STYLE |
- wxTAB_TRAVERSAL)
-{
- if (data)
- m_printDialogData = *data;
-
- Init();
-}
-
-wxGnomePrintDialog::wxGnomePrintDialog( wxWindow *parent, wxPrintData *data )
- : wxPrintDialogBase(parent, wxID_ANY, _("Print"),
- wxPoint(0, 0), wxSize(600, 600),
- wxDEFAULT_DIALOG_STYLE |
- wxTAB_TRAVERSAL)
-{
- if (data)
- m_printDialogData = *data;
-
- Init();
-}
-
-void wxGnomePrintDialog::Init()
-{
- wxPrintData data = m_printDialogData.GetPrintData();
-
- data.ConvertToNative();
-
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) data.GetNativeData();
-
- m_widget = gs_libGnomePrint->gnome_print_dialog_new( native->GetPrintJob(),
- (guchar*)"Print",
- GNOME_PRINT_DIALOG_RANGE|GNOME_PRINT_DIALOG_COPIES );
-
- int flag = 0;
- if (m_printDialogData.GetEnableSelection())
- flag |= GNOME_PRINT_RANGE_SELECTION;
- if (m_printDialogData.GetEnablePageNumbers())
- flag |= GNOME_PRINT_RANGE_ALL|GNOME_PRINT_RANGE_RANGE;
-
- gs_libGnomePrint->gnome_print_dialog_construct_range_page( (GnomePrintDialog*) m_widget,
- flag,
- m_printDialogData.GetMinPage(),
- m_printDialogData.GetMaxPage(),
- NULL,
- NULL );
-}
-
-wxGnomePrintDialog::~wxGnomePrintDialog()
-{
- m_widget = NULL;
-}
-
-int wxGnomePrintDialog::ShowModal()
-{
- WX_HOOK_MODAL_DIALOG();
-
- int response = gtk_dialog_run (GTK_DIALOG (m_widget));
-
- if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL)
- {
- gtk_widget_destroy(m_widget);
- m_widget = NULL;
-
- return wxID_CANCEL;
- }
-
- m_printDialogData.GetPrintData().ConvertFromNative();
-
- gint copies = 1;
- gboolean collate = false;
- gs_libGnomePrint->gnome_print_dialog_get_copies( (GnomePrintDialog*) m_widget, &copies, &collate );
- m_printDialogData.SetNoCopies( copies );
- m_printDialogData.SetCollate( collate );
-
- // Cast needed to avoid warnings because the gnome_print_dialog_get_range()
- // is declared as returning a wrong enum type.
- switch ( static_cast<int>( gs_libGnomePrint->gnome_print_dialog_get_range( (GnomePrintDialog*) m_widget )))
- {
- case GNOME_PRINT_RANGE_SELECTION:
- m_printDialogData.SetSelection( true );
- break;
- case GNOME_PRINT_RANGE_ALL:
- m_printDialogData.SetAllPages( true );
- m_printDialogData.SetFromPage( 0 );
- m_printDialogData.SetToPage( 9999 );
- break;
- case GNOME_PRINT_RANGE_RANGE:
- default:
- gint start,end;
- gs_libGnomePrint->gnome_print_dialog_get_range_page( (GnomePrintDialog*) m_widget, &start, &end );
- m_printDialogData.SetFromPage( start );
- m_printDialogData.SetToPage( end );
- break;
- }
-
- gtk_widget_destroy(m_widget);
- m_widget = NULL;
-
- if (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW)
- return wxID_PREVIEW;
-
- return wxID_OK;
-}
-
-wxDC *wxGnomePrintDialog::GetPrintDC()
-{
- // Later
- return NULL;
-}
-
-bool wxGnomePrintDialog::Validate()
-{
- return true;
-}
-
-bool wxGnomePrintDialog::TransferDataToWindow()
-{
- return true;
-}
-
-bool wxGnomePrintDialog::TransferDataFromWindow()
-{
- return true;
-}
-
-//----------------------------------------------------------------------------
-// wxGnomePageSetupDialog
-//----------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGnomePageSetupDialog, wxPageSetupDialogBase)
-
-wxGnomePageSetupDialog::wxGnomePageSetupDialog(wxWindow * WXUNUSED(parent),
- wxPageSetupDialogData *data)
-{
- if (data)
- m_pageDialogData = *data;
-
- m_pageDialogData.GetPrintData().ConvertToNative();
-
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
-
- // This *was* required as the page setup dialog
- // calculates wrong values otherwise.
-#if 0
- gs_libGnomePrint->gnome_print_config_set( native->GetPrintConfig(),
- (const guchar*) GNOME_PRINT_KEY_PREFERED_UNIT,
- (const guchar*) "Pts" );
-#endif
-
- GnomePrintConfig *config = native->GetPrintConfig();
-
- const GnomePrintUnit *mm_unit = gs_libGnomePrint->gnome_print_unit_get_by_abbreviation( (const guchar*) "mm" );
-
- double ml = (double) m_pageDialogData.GetMarginTopLeft().x;
- double mt = (double) m_pageDialogData.GetMarginTopLeft().y;
- double mr = (double) m_pageDialogData.GetMarginBottomRight().x;
- double mb = (double) m_pageDialogData.GetMarginBottomRight().y;
-
- gs_libGnomePrint->gnome_print_config_set_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, ml, mm_unit );
- gs_libGnomePrint->gnome_print_config_set_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, mr, mm_unit );
- gs_libGnomePrint->gnome_print_config_set_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, mt, mm_unit );
- gs_libGnomePrint->gnome_print_config_set_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, mb, mm_unit );
-
- m_widget = gtk_dialog_new();
-
- gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( _("Page setup") ) );
-
- GtkWidget *main = gs_libGnomePrint->gnome_paper_selector_new_with_flags( native->GetPrintConfig(),
- GNOME_PAPER_SELECTOR_MARGINS|GNOME_PAPER_SELECTOR_FEED_ORIENTATION );
- gtk_container_set_border_width (GTK_CONTAINER (main), 8);
- gtk_widget_show (main);
-
- gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
-
- gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
-
- gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
- GTK_RESPONSE_OK);
-}
-
-wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
-{
-}
-
-wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData()
-{
- return m_pageDialogData;
-}
-
-int wxGnomePageSetupDialog::ShowModal()
-{
- WX_HOOK_MODAL_DIALOG();
-
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
-
- GnomePrintConfig *config = native->GetPrintConfig();
-
-
- int ret = gtk_dialog_run( GTK_DIALOG(m_widget) );
-
- if (ret == GTK_RESPONSE_OK)
- {
- // Transfer data back to m_pageDialogData
- m_pageDialogData.GetPrintData().ConvertFromNative();
-
- // I don't know how querying the last parameter works
- double ml,mr,mt,mb,pw,ph;
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &ml, NULL);
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &mr, NULL);
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &mt, NULL);
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &mb, NULL);
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAPER_WIDTH, &pw, NULL);
- gs_libGnomePrint->gnome_print_config_get_length (config,
- (const guchar*) GNOME_PRINT_KEY_PAPER_HEIGHT, &ph, NULL);
-
- // This code converts correctly from what the user chose
- // as the unit although I query Pts here
- const GnomePrintUnit *mm_unit = gs_libGnomePrint->gnome_print_unit_get_by_abbreviation( (const guchar*) "mm" );
- const GnomePrintUnit *pts_unit = gs_libGnomePrint->gnome_print_unit_get_by_abbreviation( (const guchar*) "Pts" );
- gs_libGnomePrint->gnome_print_convert_distance( &ml, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &mr, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &mt, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &mb, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &pw, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &ph, pts_unit, mm_unit );
-
- m_pageDialogData.SetMarginTopLeft( wxPoint( (int)(ml+0.5), (int)(mt+0.5)) );
- m_pageDialogData.SetMarginBottomRight( wxPoint( (int)(mr+0.5), (int)(mb+0.5)) );
-
- m_pageDialogData.SetPaperSize( wxSize( (int)(pw+0.5), (int)(ph+0.5) ) );
-
- ret = wxID_OK;
- }
- else
- {
- ret = wxID_CANCEL;
- }
-
- gtk_widget_destroy( m_widget );
- m_widget = NULL;
-
- return ret;
-}
-
-bool wxGnomePageSetupDialog::Validate()
-{
- return true;
-}
-
-bool wxGnomePageSetupDialog::TransferDataToWindow()
-{
- return true;
-}
-
-bool wxGnomePageSetupDialog::TransferDataFromWindow()
-{
- return true;
-}
-
-//----------------------------------------------------------------------------
-// wxGnomePrinter
-//----------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGnomePrinter, wxPrinterBase)
-
-wxGnomePrinter::wxGnomePrinter( wxPrintDialogData *data ) :
- wxPrinterBase( data )
-{
- m_native_preview = false;
-}
-
-wxGnomePrinter::~wxGnomePrinter()
-{
-}
-
-bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
-{
- if (!printout)
- {
- sm_lastError = wxPRINTER_ERROR;
- return false;
- }
-
- wxPrintData printdata = GetPrintDialogData().GetPrintData();
-
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) printdata.GetNativeData();
-
- GnomePrintJob *job = gs_libGnomePrint->gnome_print_job_new( native->GetPrintConfig() );
-
- // The GnomePrintJob is temporarily stored in the
- // native print data as the native print dialog
- // needs to access it.
- native->SetPrintJob( job );
-
-
- if (m_printDialogData.GetMinPage() < 1)
- m_printDialogData.SetMinPage(1);
- if (m_printDialogData.GetMaxPage() < 1)
- m_printDialogData.SetMaxPage(9999);
-
- wxDC *dc;
- if (prompt)
- dc = PrintDialog( parent );
- else
-#if wxUSE_NEW_DC
- dc = new wxPrinterDC( printdata ); // TODO: check that this works
-#else
- dc = new wxGnomePrinterDC( printdata ); // TODO: check that this works
-#endif
-
- if (!dc)
- {
- gs_libGnomePrint->gnome_print_job_close( job );
- g_object_unref (job);
- if (sm_lastError != wxPRINTER_CANCELLED)
- sm_lastError = wxPRINTER_ERROR;
- return false;
- }
-
- printout->SetPPIScreen(wxGetDisplayPPI());
- printout->SetPPIPrinter( dc->GetResolution(),
- dc->GetResolution() );
-
- printout->SetDC(dc);
-
- int w, h;
- dc->GetSize(&w, &h);
- printout->SetPageSizePixels((int)w, (int)h);
- printout->SetPaperRectPixels(wxRect(0, 0, w, h));
- int mw, mh;
- dc->GetSizeMM(&mw, &mh);
- printout->SetPageSizeMM((int)mw, (int)mh);
- printout->OnPreparePrinting();
-
- // Get some parameters from the printout, if defined
- int fromPage, toPage;
- int minPage, maxPage;
- printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
- if (maxPage == 0)
- {
- gs_libGnomePrint->gnome_print_job_close( job );
- g_object_unref (job);
- sm_lastError = wxPRINTER_ERROR;
- return false;
- }
-
- printout->OnBeginPrinting();
-
- int minPageNum = minPage, maxPageNum = maxPage;
-
- if ( !m_printDialogData.GetAllPages() )
- {
- minPageNum = m_printDialogData.GetFromPage();
- maxPageNum = m_printDialogData.GetToPage();
- }
-
-
- int copyCount;
- for ( copyCount = 1;
- copyCount <= m_printDialogData.GetNoCopies();
- copyCount++ )
- {
- if (!printout->OnBeginDocument(minPageNum, maxPageNum))
- {
- wxLogError(_("Could not start printing."));
- sm_lastError = wxPRINTER_ERROR;
- break;
- }
-
- int pn;
- for ( pn = minPageNum;
- pn <= maxPageNum && printout->HasPage(pn);
- pn++ )
- {
- dc->StartPage();
- printout->OnPrintPage(pn);
- dc->EndPage();
- }
-
- printout->OnEndDocument();
- printout->OnEndPrinting();
- }
-
- gs_libGnomePrint->gnome_print_job_close( job );
- if (m_native_preview)
- {
- const wxCharBuffer title(wxGTK_CONV_SYS(_("Print preview")));
- GtkWidget *preview = gs_libGnomePrint->gnome_print_job_preview_new
- (
- job,
- (const guchar *)title.data()
- );
- gtk_widget_show(preview);
- }
- else
- {
- gs_libGnomePrint->gnome_print_job_print( job );
- }
-
- g_object_unref (job);
- delete dc;
-
- return (sm_lastError == wxPRINTER_NO_ERROR);
-}
-
-wxDC* wxGnomePrinter::PrintDialog( wxWindow *parent )
-{
- wxGnomePrintDialog dialog( parent, &m_printDialogData );
- int ret = dialog.ShowModal();
- if (ret == wxID_CANCEL)
- {
- sm_lastError = wxPRINTER_CANCELLED;
- return NULL;
- }
-
- m_native_preview = ret == wxID_PREVIEW;
-
- m_printDialogData = dialog.GetPrintDialogData();
-#if wxUSE_NEW_DC
- return new wxPrinterDC( m_printDialogData.GetPrintData() );
-#else
- return new wxGnomePrinterDC( m_printDialogData.GetPrintData() );
-#endif
-}
-
-bool wxGnomePrinter::Setup(wxWindow * WXUNUSED(parent))
-{
- return false;
-}
-
-//-----------------------------------------------------------------------------
-// wxGnomePrinterDC
-//-----------------------------------------------------------------------------
-
-// conversion
-static const double RAD2DEG = 180.0 / M_PI;
-
-// we don't want to use only 72 dpi from GNOME print
-static const int DPI = 600;
-static const double PS2DEV = 600.0 / 72.0;
-static const double DEV2PS = 72.0 / 600.0;
-
-#define XLOG2DEV(x) ((double)(LogicalToDeviceX(x)) * DEV2PS)
-#define XLOG2DEVREL(x) ((double)(LogicalToDeviceXRel(x)) * DEV2PS)
-#define YLOG2DEV(x) ((m_pageHeight - (double)LogicalToDeviceY(x)) * DEV2PS)
-#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS)
-
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGnomePrinterDCImpl, wxDCImpl)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxGnomePrinterDC, wxDC)
-#endif
-
-#if wxUSE_NEW_DC
-wxGnomePrinterDCImpl::wxGnomePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) :
- wxDCImpl( owner )
-#else
-wxGnomePrinterDC::wxGnomePrinterDC( const wxPrintData& data )
-#endif
-{
- m_printData = data;
-
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) m_printData.GetNativeData();
-
- m_job = native->GetPrintJob();
- m_gpc = gs_libGnomePrint->gnome_print_job_get_context (m_job);
-
- m_layout = gs_libGnomePrint->gnome_print_pango_create_layout( m_gpc );
- m_fontdesc = pango_font_description_from_string( "Sans 12" );
- m_context = NULL;
-
- m_currentRed = 0;
- m_currentBlue = 0;
- m_currentGreen = 0;
-
- // Query page size. This seems to omit the margins
- double pw,ph;
- gs_libGnomePrint->gnome_print_job_get_page_size( native->GetPrintJob(), &pw, &ph );
-
- m_pageHeight = ph * PS2DEV;
-}
-
-wxGnomePrinterDCImpl::~wxGnomePrinterDCImpl()
-{
-}
-
-bool wxGnomePrinterDCImpl::IsOk() const
-{
- return true;
-}
-
-bool
-wxGnomePrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1),
- wxCoord WXUNUSED(y1),
- const wxColour& WXUNUSED(col),
- wxFloodFillStyle WXUNUSED(style))
-{
- return false;
-}
-
-bool
-wxGnomePrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1),
- wxCoord WXUNUSED(y1),
- wxColour * WXUNUSED(col)) const
-{
- return false;
-}
-
-void wxGnomePrinterDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
-{
- if ( m_pen.IsTransparent() )
- return;
-
- SetPen( m_pen );
-
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, XLOG2DEV(x1), YLOG2DEV(y1) );
- gs_libGnomePrint->gnome_print_lineto ( m_gpc, XLOG2DEV(x2), YLOG2DEV(y2) );
- gs_libGnomePrint->gnome_print_stroke ( m_gpc);
-
- CalcBoundingBox( x1, y1 );
- CalcBoundingBox( x2, y2 );
-}
-
-void wxGnomePrinterDCImpl::DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
-{
-}
-
-void wxGnomePrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
-{
- double dx = x1 - xc;
- double dy = y1 - yc;
- double radius = sqrt((double)(dx*dx+dy*dy));
- double alpha1, alpha2;
- if (x1 == x2 && y1 == y2)
- {
- alpha1 = 0.0;
- alpha2 = 360.0;
- }
- else if ( wxIsNullDouble(radius) )
- {
- alpha1 =
- alpha2 = 0.0;
- }
- else
- {
- alpha1 = (x1 - xc == 0) ?
- (y1 - yc < 0) ? 90.0 : -90.0 :
- -atan2(double(y1-yc), double(x1-xc)) * RAD2DEG;
- alpha2 = (x2 - xc == 0) ?
- (y2 - yc < 0) ? 90.0 : -90.0 :
- -atan2(double(y2-yc), double(x2-xc)) * RAD2DEG;
-
- while (alpha1 <= 0) alpha1 += 360;
- while (alpha2 <= 0) alpha2 += 360; // adjust angles to be between
- while (alpha1 > 360) alpha1 -= 360; // 0 and 360 degree
- while (alpha2 > 360) alpha2 -= 360;
- }
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush( m_brush );
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) );
- gs_libGnomePrint->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 );
-
- gs_libGnomePrint->gnome_print_fill( m_gpc );
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen (m_pen);
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) );
- gs_libGnomePrint->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 );
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
-
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
- }
-
- CalcBoundingBox (x1, y1);
- CalcBoundingBox (x2, y2);
- CalcBoundingBox (xc, yc);
-}
-
-void wxGnomePrinterDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
-{
- x += w/2;
- y += h/2;
-
- double xx = XLOG2DEV(x);
- double yy = YLOG2DEV(y);
-
- gs_libGnomePrint->gnome_print_gsave( m_gpc );
-
- gs_libGnomePrint->gnome_print_translate( m_gpc, xx, yy );
- double scale = (double)YLOG2DEVREL(h) / (double) XLOG2DEVREL(w);
- gs_libGnomePrint->gnome_print_scale( m_gpc, 1.0, scale );
-
- xx = 0.0;
- yy = 0.0;
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush( m_brush );
-
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, xx, yy );
- gs_libGnomePrint->gnome_print_arcto( m_gpc, xx, yy,
- XLOG2DEVREL(w)/2, sa, ea, 0 );
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, xx, yy );
-
- gs_libGnomePrint->gnome_print_fill( m_gpc );
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen (m_pen);
-
- gs_libGnomePrint->gnome_print_arcto( m_gpc, xx, yy,
- XLOG2DEVREL(w)/2, sa, ea, 0 );
-
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
- }
-
- gs_libGnomePrint->gnome_print_grestore( m_gpc );
-
- CalcBoundingBox( x, y );
- CalcBoundingBox( x+w, y+h );
-}
-
-void wxGnomePrinterDCImpl::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
-{
-}
-
-void wxGnomePrinterDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
-{
- if (n <= 0) return;
-
- if ( m_pen.IsTransparent() )
- return;
-
- SetPen (m_pen);
-
- int i;
- for ( i =0; i<n ; i++ )
- CalcBoundingBox( points[i].x+xoffset, points[i].y+yoffset);
-
- gs_libGnomePrint->gnome_print_moveto ( m_gpc, XLOG2DEV(points[0].x+xoffset), YLOG2DEV(points[0].y+yoffset) );
-
- for (i = 1; i < n; i++)
- gs_libGnomePrint->gnome_print_lineto ( m_gpc, XLOG2DEV(points[i].x+xoffset), YLOG2DEV(points[i].y+yoffset) );
-
- gs_libGnomePrint->gnome_print_stroke ( m_gpc);
-}
-
-void wxGnomePrinterDCImpl::DoDrawPolygon(int n, const wxPoint points[],
- wxCoord xoffset, wxCoord yoffset,
- wxPolygonFillMode WXUNUSED(fillStyle))
-{
- if (n==0) return;
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush( m_brush );
-
- int x = points[0].x + xoffset;
- int y = points[0].y + yoffset;
- CalcBoundingBox( x, y );
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- int i;
- for (i = 1; i < n; i++)
- {
- x = points[i].x + xoffset;
- y = points[i].y + yoffset;
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- CalcBoundingBox( x, y );
- }
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
- gs_libGnomePrint->gnome_print_fill( m_gpc );
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen (m_pen);
-
- int x = points[0].x + xoffset;
- int y = points[0].y + yoffset;
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- int i;
- for (i = 1; i < n; i++)
- {
- x = points[i].x + xoffset;
- y = points[i].y + yoffset;
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- CalcBoundingBox( x, y );
- }
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
- }
-}
-
-void wxGnomePrinterDCImpl::DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode fillStyle)
-{
-#if wxUSE_NEW_DC
- wxDCImpl::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
-#else
- wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
-#endif
-}
-
-void wxGnomePrinterDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
-{
- width--;
- height--;
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush( m_brush );
-
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
- gs_libGnomePrint->gnome_print_fill( m_gpc );
-
- CalcBoundingBox( x, y );
- CalcBoundingBox( x + width, y + height );
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen (m_pen);
-
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
-
- CalcBoundingBox( x, y );
- CalcBoundingBox( x + width, y + height );
- }
-}
-
-void wxGnomePrinterDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
-{
- width--;
- height--;
-
- wxCoord rad = wxRound( radius );
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush(m_brush);
- gs_libGnomePrint->gnome_print_newpath(m_gpc);
- gs_libGnomePrint->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + rad),YLOG2DEV(y),
- XLOG2DEV(x),YLOG2DEV(y),
- XLOG2DEV(x),YLOG2DEV(y + rad));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x),YLOG2DEV(y + height - rad),
- XLOG2DEV(x),YLOG2DEV(y + height),
- XLOG2DEV(x + rad),YLOG2DEV(y + height));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
- XLOG2DEV(x + width),YLOG2DEV(y + height),
- XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + width),YLOG2DEV(y + rad),
- XLOG2DEV(x + width),YLOG2DEV(y),
- XLOG2DEV(x + width - rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_closepath(m_gpc);
- gs_libGnomePrint->gnome_print_fill(m_gpc);
-
- CalcBoundingBox(x,y);
- CalcBoundingBox(x+width,y+height);
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen(m_pen);
- gs_libGnomePrint->gnome_print_newpath(m_gpc);
- gs_libGnomePrint->gnome_print_moveto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + rad),YLOG2DEV(y),
- XLOG2DEV(x),YLOG2DEV(y),
- XLOG2DEV(x),YLOG2DEV(y + rad));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x),YLOG2DEV(y + height - rad));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x),YLOG2DEV(y + height - rad),
- XLOG2DEV(x),YLOG2DEV(y + height),
- XLOG2DEV(x + rad),YLOG2DEV(y + height));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + width - rad),YLOG2DEV(y + height));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + width - rad),YLOG2DEV(y + height),
- XLOG2DEV(x + width),YLOG2DEV(y + height),
- XLOG2DEV(x + width),YLOG2DEV(y + height - rad));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + width),YLOG2DEV(y + rad));
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV(x + width),YLOG2DEV(y + rad),
- XLOG2DEV(x + width),YLOG2DEV(y),
- XLOG2DEV(x + width - rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_lineto(m_gpc,XLOG2DEV(x + rad),YLOG2DEV(y));
- gs_libGnomePrint->gnome_print_closepath(m_gpc);
- gs_libGnomePrint->gnome_print_stroke(m_gpc);
-
- CalcBoundingBox(x,y);
- CalcBoundingBox(x+width,y+height);
- }
-}
-
-void wxGnomePrinterDCImpl::makeEllipticalPath(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height)
-{
- double r = 4 * (sqrt(2.) - 1) / 3;
- double halfW = 0.5 * width,
- halfH = 0.5 * height,
- halfWR = r * halfW,
- halfHR = r * halfH;
- wxCoord halfWI = (wxCoord) halfW,
- halfHI = (wxCoord) halfH;
-
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
-
- // Approximate an ellipse using four cubic splines, clockwise from 0 deg */
- gs_libGnomePrint->gnome_print_moveto( m_gpc,
- XLOG2DEV(x + width),
- YLOG2DEV(y + halfHI) );
- gs_libGnomePrint->gnome_print_curveto( m_gpc,
- XLOG2DEV(x + width),
- YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
- XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
- YLOG2DEV(y + height),
- XLOG2DEV(x + halfWI),
- YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_curveto( m_gpc,
- XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)),
- YLOG2DEV(y + height),
- XLOG2DEV(x),
- YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
- XLOG2DEV(x), YLOG2DEV(y+halfHI) );
- gs_libGnomePrint->gnome_print_curveto( m_gpc,
- XLOG2DEV(x),
- YLOG2DEV(y + (wxCoord) rint (halfH - halfHR)),
- XLOG2DEV(x + (wxCoord) rint (halfW - halfWR)),
- YLOG2DEV(y),
- XLOG2DEV(x+halfWI), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_curveto( m_gpc,
- XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
- YLOG2DEV(y),
- XLOG2DEV(x + width),
- YLOG2DEV(y + (wxCoord) rint(halfH - halfHR)),
- XLOG2DEV(x + width), YLOG2DEV(y + halfHI) );
-
- gs_libGnomePrint->gnome_print_closepath(m_gpc);
-}
-
-void wxGnomePrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
-{
- width--;
- height--;
-
- if ( m_brush.IsNonTransparent() )
- {
- SetBrush( m_brush );
- makeEllipticalPath( x, y, width, height );
- gs_libGnomePrint->gnome_print_fill( m_gpc );
- CalcBoundingBox( x, y );
- CalcBoundingBox( x + width, y + height );
- }
-
- if ( m_pen.IsNonTransparent() )
- {
- SetPen (m_pen);
- makeEllipticalPath( x, y, width, height );
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
- CalcBoundingBox( x, y );
- CalcBoundingBox( x + width, y + height );
- }
-}
-
-#if wxUSE_SPLINES
-void wxGnomePrinterDCImpl::DoDrawSpline(const wxPointList *points)
-{
- SetPen (m_pen);
-
- double c, d, x1, y1, x2, y2, x3, y3;
- wxPoint *p, *q;
-
- wxPointList::compatibility_iterator node = points->GetFirst();
- p = node->GetData();
- x1 = p->x;
- y1 = p->y;
-
- node = node->GetNext();
- p = node->GetData();
- c = p->x;
- d = p->y;
- x3 =
- (double)(x1 + c) / 2;
- y3 =
- (double)(y1 + d) / 2;
-
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV((wxCoord)x1), YLOG2DEV((wxCoord)y1) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV((wxCoord)x3), YLOG2DEV((wxCoord)y3) );
-
- CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 );
- CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 );
-
- node = node->GetNext();
- while (node)
- {
- q = node->GetData();
-
- x1 = x3;
- y1 = y3;
- x2 = c;
- y2 = d;
- c = q->x;
- d = q->y;
- x3 = (double)(x2 + c) / 2;
- y3 = (double)(y2 + d) / 2;
-
- gs_libGnomePrint->gnome_print_curveto(m_gpc,
- XLOG2DEV((wxCoord)x1), YLOG2DEV((wxCoord)y1),
- XLOG2DEV((wxCoord)x2), YLOG2DEV((wxCoord)y2),
- XLOG2DEV((wxCoord)x3), YLOG2DEV((wxCoord)y3) );
-
- CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 );
- CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 );
-
- node = node->GetNext();
- }
-
- gs_libGnomePrint->gnome_print_lineto ( m_gpc, XLOG2DEV((wxCoord)c), YLOG2DEV((wxCoord)d) );
-
- gs_libGnomePrint->gnome_print_stroke( m_gpc );
-}
-#endif // wxUSE_SPLINES
-
-bool
-wxGnomePrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
- wxCoord width, wxCoord height,
- wxDC *source,
- wxCoord xsrc, wxCoord ysrc,
- wxRasterOperationMode rop,
- bool WXUNUSED(useMask),
- wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask))
-{
- wxCHECK_MSG( source, false, wxT("invalid source dc") );
-
- // blit into a bitmap
- wxBitmap bitmap( width, height );
- wxMemoryDC memDC;
- memDC.SelectObject(bitmap);
- memDC.Blit(0, 0, width, height, source, xsrc, ysrc, rop); /* TODO: Blit transparently? */
- memDC.SelectObject(wxNullBitmap);
-
- // draw bitmap. scaling and positioning is done there
- GetOwner()->DrawBitmap( bitmap, xdest, ydest );
-
- return true;
-}
-
-void wxGnomePrinterDCImpl::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
-{
- DoDrawBitmap( icon, x, y, true );
-}
-
-void
-wxGnomePrinterDCImpl::DoDrawBitmap(const wxBitmap& bitmap,
- wxCoord x, wxCoord y,
- bool WXUNUSED(useMask))
-{
- if (!bitmap.IsOk()) return;
-
- if (bitmap.HasPixbuf())
- {
- GdkPixbuf *pixbuf = bitmap.GetPixbuf();
- guchar *raw_image = gdk_pixbuf_get_pixels( pixbuf );
- bool has_alpha = gdk_pixbuf_get_has_alpha( pixbuf );
- int rowstride = gdk_pixbuf_get_rowstride( pixbuf );
- int height = gdk_pixbuf_get_height( pixbuf );
- int width = gdk_pixbuf_get_width( pixbuf );
-
- gs_libGnomePrint->gnome_print_gsave( m_gpc );
- double matrix[6];
- matrix[0] = XLOG2DEVREL(width);
- matrix[1] = 0;
- matrix[2] = 0;
- matrix[3] = YLOG2DEVREL(height);
- matrix[4] = XLOG2DEV(x);
- matrix[5] = YLOG2DEV(y+height);
- gs_libGnomePrint->gnome_print_concat( m_gpc, matrix );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, 0, 0 );
- if (has_alpha)
- gs_libGnomePrint->gnome_print_rgbaimage( m_gpc, (guchar *)raw_image, width, height, rowstride );
- else
- gs_libGnomePrint->gnome_print_rgbimage( m_gpc, (guchar *)raw_image, width, height, rowstride );
- gs_libGnomePrint->gnome_print_grestore( m_gpc );
- }
- else
- {
- wxImage image = bitmap.ConvertToImage();
-
- if (!image.IsOk()) return;
-
- gs_libGnomePrint->gnome_print_gsave( m_gpc );
- double matrix[6];
- matrix[0] = XLOG2DEVREL(image.GetWidth());
- matrix[1] = 0;
- matrix[2] = 0;
- matrix[3] = YLOG2DEVREL(image.GetHeight());
- matrix[4] = XLOG2DEV(x);
- matrix[5] = YLOG2DEV(y+image.GetHeight());
- gs_libGnomePrint->gnome_print_concat( m_gpc, matrix );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, 0, 0 );
- gs_libGnomePrint->gnome_print_rgbimage( m_gpc, (guchar*) image.GetData(), image.GetWidth(), image.GetHeight(), image.GetWidth()*3 );
- gs_libGnomePrint->gnome_print_grestore( m_gpc );
- }
-}
-
-void wxGnomePrinterDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
-{
- DoDrawRotatedText( text, x, y, 0.0 );
-}
-
-void wxGnomePrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
-{
- double xx = XLOG2DEV(x);
- double yy = YLOG2DEV(y);
-
- const wxScopedCharBuffer data(text.utf8_str());
-
- pango_layout_set_text(m_layout, data, data.length());
- const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout);
-
- if (m_textForegroundColour.IsOk())
- {
- unsigned char red = m_textForegroundColour.Red();
- unsigned char blue = m_textForegroundColour.Blue();
- unsigned char green = m_textForegroundColour.Green();
-
- if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue))
- {
- double redPS = (double)(red) / 255.0;
- double bluePS = (double)(blue) / 255.0;
- double greenPS = (double)(green) / 255.0;
-
- gs_libGnomePrint->gnome_print_setrgbcolor( m_gpc, redPS, greenPS, bluePS );
-
- m_currentRed = red;
- m_currentBlue = blue;
- m_currentGreen = green;
- }
- }
-
-#if 0
- if ( m_backgroundMode == wxSOLID )
- {
- gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
- gdk_draw_rectangle(m_window, m_textGC, TRUE, xx, yy, w, h);
- gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
- }
-#endif
-
- // Draw layout.
- gs_libGnomePrint->gnome_print_moveto (m_gpc, xx, yy);
-
- gs_libGnomePrint->gnome_print_gsave( m_gpc );
-
- gs_libGnomePrint->gnome_print_scale( m_gpc, m_scaleX * DEV2PS, m_scaleY * DEV2PS );
-
- if (fabs(angle) > 0.00001)
- gs_libGnomePrint->gnome_print_rotate( m_gpc, angle );
-
- gs_libGnomePrint->gnome_print_pango_layout( m_gpc, m_layout );
-
- int w,h;
- pango_layout_get_pixel_size( m_layout, &w, &h );
-
- gs_libGnomePrint->gnome_print_grestore( m_gpc );
-
- if (setAttrs)
- {
- // undo underline attributes setting:
- pango_layout_set_attributes(m_layout, NULL);
- }
-
- CalcBoundingBox(x, y);
- CalcBoundingBox(x + w, y + h);
-}
-
-void wxGnomePrinterDCImpl::Clear()
-{
-}
-
-void wxGnomePrinterDCImpl::SetFont( const wxFont& font )
-{
- m_font = font;
-
- if (m_font.IsOk())
- {
- if (m_fontdesc)
- pango_font_description_free( m_fontdesc );
-
- m_fontdesc = pango_font_description_copy( m_font.GetNativeFontInfo()->description );
-
- float size = pango_font_description_get_size( m_fontdesc );
- size = size * GetFontPointSizeAdjustment(72.0);
- pango_font_description_set_size( m_fontdesc, (gint)size );
-
- pango_layout_set_font_description( m_layout, m_fontdesc );
- }
-}
-
-void wxGnomePrinterDCImpl::SetPen( const wxPen& pen )
-{
- if (!pen.IsOk()) return;
-
- m_pen = pen;
-
- double width;
-
- if (m_pen.GetWidth() <= 0)
- width = 0.1;
- else
- width = (double) m_pen.GetWidth();
-
- gs_libGnomePrint->gnome_print_setlinewidth( m_gpc, width * DEV2PS * m_scaleX );
-
- static const double dotted[] = {2.0, 5.0};
- static const double short_dashed[] = {4.0, 4.0};
- static const double wxCoord_dashed[] = {4.0, 8.0};
- static const double dotted_dashed[] = {6.0, 6.0, 2.0, 6.0};
-
- switch (m_pen.GetStyle())
- {
- case wxPENSTYLE_DOT: gs_libGnomePrint->gnome_print_setdash( m_gpc, 2, dotted, 0 ); break;
- case wxPENSTYLE_SHORT_DASH: gs_libGnomePrint->gnome_print_setdash( m_gpc, 2, short_dashed, 0 ); break;
- case wxPENSTYLE_LONG_DASH: gs_libGnomePrint->gnome_print_setdash( m_gpc, 2, wxCoord_dashed, 0 ); break;
- case wxPENSTYLE_DOT_DASH: gs_libGnomePrint->gnome_print_setdash( m_gpc, 4, dotted_dashed, 0 ); break;
- case wxPENSTYLE_USER_DASH:
- {
- // It may be noted that libgnomeprint between at least
- // versions 2.8.0 and 2.12.1 makes a copy of the dashes
- // and then leak the memory since it doesn't set the
- // internal flag "privatedash" to 0.
- wxDash *wx_dashes;
- int num = m_pen.GetDashes (&wx_dashes);
- gdouble *g_dashes = g_new( gdouble, num );
- int i;
- for (i = 0; i < num; ++i)
- g_dashes[i] = (gdouble) wx_dashes[i];
- gs_libGnomePrint -> gnome_print_setdash( m_gpc, num, g_dashes, 0);
- g_free( g_dashes );
- }
- break;
- case wxPENSTYLE_SOLID:
- case wxPENSTYLE_TRANSPARENT:
- default: gs_libGnomePrint->gnome_print_setdash( m_gpc, 0, NULL, 0 ); break;
- }
-
-
- unsigned char red = m_pen.GetColour().Red();
- unsigned char blue = m_pen.GetColour().Blue();
- unsigned char green = m_pen.GetColour().Green();
-
- if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue))
- {
- double redPS = (double)(red) / 255.0;
- double bluePS = (double)(blue) / 255.0;
- double greenPS = (double)(green) / 255.0;
-
- gs_libGnomePrint->gnome_print_setrgbcolor( m_gpc, redPS, greenPS, bluePS );
-
- m_currentRed = red;
- m_currentBlue = blue;
- m_currentGreen = green;
- }
-}
-
-void wxGnomePrinterDCImpl::SetBrush( const wxBrush& brush )
-{
- if (!brush.IsOk()) return;
-
- m_brush = brush;
-
- // Brush colour
- unsigned char red = m_brush.GetColour().Red();
- unsigned char blue = m_brush.GetColour().Blue();
- unsigned char green = m_brush.GetColour().Green();
-
- if (!m_colour)
- {
- // Anything not white is black
- if (! (red == (unsigned char) 255 &&
- blue == (unsigned char) 255 &&
- green == (unsigned char) 255) )
- {
- red = (unsigned char) 0;
- green = (unsigned char) 0;
- blue = (unsigned char) 0;
- }
- // setgray here ?
- }
-
- if (!(red == m_currentRed && green == m_currentGreen && blue == m_currentBlue))
- {
- double redPS = (double)(red) / 255.0;
- double bluePS = (double)(blue) / 255.0;
- double greenPS = (double)(green) / 255.0;
-
- gs_libGnomePrint->gnome_print_setrgbcolor( m_gpc, redPS, greenPS, bluePS );
-
- m_currentRed = red;
- m_currentBlue = blue;
- m_currentGreen = green;
- }
-}
-
-void wxGnomePrinterDCImpl::SetLogicalFunction(wxRasterOperationMode WXUNUSED(function))
-{
-}
-
-void wxGnomePrinterDCImpl::SetBackground(const wxBrush& WXUNUSED(brush))
-{
-}
-
-void wxGnomePrinterDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
-{
-#if wxUSE_NEW_DC
- m_clipping = TRUE; // TODO move somewhere else
- m_clipX1 = x;
- m_clipY1 = y;
- m_clipX2 = x + width;
- m_clipY2 = y + height;
-#else
- wxDC::DoSetClippingRegion( x, y, width, height );
-#endif
-
- gs_libGnomePrint->gnome_print_gsave( m_gpc );
-
- gs_libGnomePrint->gnome_print_newpath( m_gpc );
- gs_libGnomePrint->gnome_print_moveto( m_gpc, XLOG2DEV(x), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x + width), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_lineto( m_gpc, XLOG2DEV(x), YLOG2DEV(y + height) );
- gs_libGnomePrint->gnome_print_closepath( m_gpc );
- gs_libGnomePrint->gnome_print_clip( m_gpc );
-}
-
-void wxGnomePrinterDCImpl::DestroyClippingRegion()
-{
-#if wxUSE_NEW_DC
- wxDCImpl::DestroyClippingRegion();
-#else
- wxDC::DestroyClippingRegion();
-#endif
-
- gs_libGnomePrint->gnome_print_grestore( m_gpc );
-
-#if 0
- // not needed, we set the values in each
- // drawing method anyways
- SetPen( m_pen );
- SetBrush( m_brush );
- SetFont( m_font );
-#endif
-}
-
-bool wxGnomePrinterDCImpl::StartDoc(const wxString& WXUNUSED(message))
-{
- return true;
-}
-
-void wxGnomePrinterDCImpl::EndDoc()
-{
- gs_libGnomePrint->gnome_print_end_doc( m_gpc );
-}
-
-void wxGnomePrinterDCImpl::StartPage()
-{
- gs_libGnomePrint->gnome_print_beginpage( m_gpc, (const guchar*) "page" );
-}
-
-void wxGnomePrinterDCImpl::EndPage()
-{
- gs_libGnomePrint->gnome_print_showpage( m_gpc );
-}
-
-wxCoord wxGnomePrinterDCImpl::GetCharHeight() const
-{
- pango_layout_set_text( m_layout, "H", 1 );
-
- int w,h;
- pango_layout_get_pixel_size( m_layout, &w, &h );
-
- return h;
-}
-
-wxCoord wxGnomePrinterDCImpl::GetCharWidth() const
-{
- pango_layout_set_text( m_layout, "H", 1 );
-
- int w,h;
- pango_layout_get_pixel_size( m_layout, &w, &h );
-
- return w;
-}
-
-void wxGnomePrinterDCImpl::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
- wxCoord *descent,
- wxCoord *externalLeading,
- const wxFont *theFont ) const
-{
- if ( width )
- *width = 0;
- if ( height )
- *height = 0;
- if ( descent )
- *descent = 0;
- if ( externalLeading )
- *externalLeading = 0;
-
- if (string.empty())
- {
- return;
- }
-
- // Set layout's text
-
- const wxScopedCharBuffer dataUTF8(string.utf8_str());
-
- gint oldSize = 0;
- if ( theFont )
- {
- // scale the font and apply it
- PangoFontDescription *desc = theFont->GetNativeFontInfo()->description;
- oldSize = pango_font_description_get_size(desc);
- float size = oldSize * GetFontPointSizeAdjustment(72.0);
- pango_font_description_set_size(desc, (gint)size);
-
- pango_layout_set_font_description(m_layout, desc);
- }
-
- pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
-
- int h;
- pango_layout_get_pixel_size( m_layout, width, &h );
- if ( height )
- *height = h;
-
- if (descent)
- {
- PangoLayoutIter *iter = pango_layout_get_iter(m_layout);
- int baseline = pango_layout_iter_get_baseline(iter);
- pango_layout_iter_free(iter);
- *descent = h - PANGO_PIXELS(baseline);
- }
-
- if ( theFont )
- {
- // restore font and reset font's size back
- pango_layout_set_font_description(m_layout, m_fontdesc);
-
- PangoFontDescription *desc = theFont->GetNativeFontInfo()->description;
- pango_font_description_set_size(desc, oldSize);
- }
-}
-
-void wxGnomePrinterDCImpl::DoGetSize(int* width, int* height) const
-{
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) m_printData.GetNativeData();
-
- // Query page size. This seems to omit the margins
- double pw,ph;
- gs_libGnomePrint->gnome_print_job_get_page_size( native->GetPrintJob(), &pw, &ph );
-
- if (width)
- *width = wxRound( pw * PS2DEV );
-
- if (height)
- *height = wxRound( ph * PS2DEV );
-}
-
-void wxGnomePrinterDCImpl::DoGetSizeMM(int *width, int *height) const
-{
- wxGnomePrintNativeData *native =
- (wxGnomePrintNativeData*) m_printData.GetNativeData();
-
- // This code assumes values in Pts.
-
- double pw,ph;
- gs_libGnomePrint->gnome_print_job_get_page_size( native->GetPrintJob(), &pw, &ph );
-
- // Convert to mm.
-
- const GnomePrintUnit *mm_unit = gs_libGnomePrint->gnome_print_unit_get_by_abbreviation( (const guchar*) "mm" );
- const GnomePrintUnit *pts_unit = gs_libGnomePrint->gnome_print_unit_get_by_abbreviation( (const guchar*) "Pts" );
- gs_libGnomePrint->gnome_print_convert_distance( &pw, pts_unit, mm_unit );
- gs_libGnomePrint->gnome_print_convert_distance( &ph, pts_unit, mm_unit );
-
- if (width)
- *width = (int) (pw + 0.5);
- if (height)
- *height = (int) (ph + 0.5);
-}
-
-wxSize wxGnomePrinterDCImpl::GetPPI() const
-{
- return wxSize(DPI,DPI);
-}
-
-void wxGnomePrinterDCImpl::SetPrintData(const wxPrintData& data)
-{
- m_printData = data;
-
- int height;
- if (m_printData.GetOrientation() == wxPORTRAIT)
- GetOwner()->GetSize( NULL, &height );
- else
- GetOwner()->GetSize( &height, NULL );
- m_deviceLocalOriginY = height;
-}
-
-// overridden for wxPrinterDC Impl
-
-int wxGnomePrinterDCImpl::GetResolution() const
-{
- return DPI;
-}
-
-wxRect wxGnomePrinterDCImpl::GetPaperRect() const
-{
- // GNOME print doesn't support printer margins
- int w = 0;
- int h = 0;
- DoGetSize( &w, &h );
- return wxRect( 0, 0, w, h );
-}
-
-// ----------------------------------------------------------------------------
-// wxGnomePrintModule
-// ----------------------------------------------------------------------------
-
-bool wxGnomePrintModule::OnInit()
-{
- gs_libGnomePrint = new wxGnomePrintLibrary;
- if (gs_libGnomePrint->IsOk())
- wxPrintFactory::SetPrintFactory( new wxGnomePrintFactory );
- return true;
-}
-
-void wxGnomePrintModule::OnExit()
-{
- wxDELETE(gs_libGnomePrint);
-}
-
-IMPLEMENT_DYNAMIC_CLASS(wxGnomePrintModule, wxModule)
-
-// ----------------------------------------------------------------------------
-// Print preview
-// ----------------------------------------------------------------------------
-
-IMPLEMENT_CLASS(wxGnomePrintPreview, wxPrintPreviewBase)
-
-void wxGnomePrintPreview::Init(wxPrintout * WXUNUSED(printout),
- wxPrintout * WXUNUSED(printoutForPrinting))
-{
- DetermineScaling();
-}
-
-wxGnomePrintPreview::wxGnomePrintPreview(wxPrintout *printout,
- wxPrintout *printoutForPrinting,
- wxPrintDialogData *data)
- : wxPrintPreviewBase(printout, printoutForPrinting, data)
-{
- Init(printout, printoutForPrinting);
-}
-
-wxGnomePrintPreview::wxGnomePrintPreview(wxPrintout *printout,
- wxPrintout *printoutForPrinting,
- wxPrintData *data)
- : wxPrintPreviewBase(printout, printoutForPrinting, data)
-{
- Init(printout, printoutForPrinting);
-}
-
-wxGnomePrintPreview::~wxGnomePrintPreview()
-{
-}
-
-bool wxGnomePrintPreview::Print(bool interactive)
-{
- if (!m_printPrintout)
- return false;
-
- wxPrinter printer(& m_printDialogData);
- return printer.Print(m_previewFrame, m_printPrintout, interactive);
-}
-
-void wxGnomePrintPreview::DetermineScaling()
-{
- wxPaperSize paperType = m_printDialogData.GetPrintData().GetPaperId();
- if (paperType == wxPAPER_NONE)
- paperType = wxPAPER_NONE;
-
- wxPrintPaperType *paper = wxThePrintPaperDatabase->FindPaperType(paperType);
- if (!paper)
- paper = wxThePrintPaperDatabase->FindPaperType(wxPAPER_A4);
-
- if (paper)
- {
- m_previewPrintout->SetPPIScreen(wxGetDisplayPPI());
-
- int resolution = DPI;
- m_previewPrintout->SetPPIPrinter( resolution, resolution );
-
- wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
-
- // TODO: get better resolution information from wxGnomePrinterDCImpl, if possible.
-
- sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0);
- sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0);
- wxSize sizeTenthsMM(paper->GetSize());
- wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
-
- // If in landscape mode, we need to swap the width and height.
- if ( m_printDialogData.GetPrintData().GetOrientation() == wxLANDSCAPE )
- {
- m_pageWidth = sizeDevUnits.y;
- m_pageHeight = sizeDevUnits.x;
- m_previewPrintout->SetPageSizeMM(sizeMM.y, sizeMM.x);
- }
- else
- {
- m_pageWidth = sizeDevUnits.x;
- m_pageHeight = sizeDevUnits.y;
- m_previewPrintout->SetPageSizeMM(sizeMM.x, sizeMM.y);
- }
- m_previewPrintout->SetPageSizePixels(m_pageWidth, m_pageHeight);
- m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight));
-
- // At 100%, the page should look about page-size on the screen.
- m_previewScaleX = (double)0.8 * 72.0 / (double)resolution;
- m_previewScaleY = m_previewScaleX;
- }
-}
-
-#endif
- // wxUSE_LIBGNOMEPRINT
diff --git a/Externals/wxWidgets3/src/gtk/minifram.cpp b/Externals/wxWidgets3/src/gtk/minifram.cpp
index 6d07a6d..24c32ac 100644
--- a/Externals/wxWidgets3/src/gtk/minifram.cpp
+++ b/Externals/wxWidgets3/src/gtk/minifram.cpp
@@ -392,6 +392,7 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
gtk_container_add(GTK_CONTAINER(m_widget), eventbox);
m_gdkDecor = 0;
+ gtk_window_set_decorated(GTK_WINDOW(m_widget), false);
m_gdkFunc = 0;
if (style & wxRESIZE_BORDER)
m_gdkFunc = GDK_FUNC_RESIZE;
diff --git a/Externals/wxWidgets3/src/gtk/print.cpp b/Externals/wxWidgets3/src/gtk/print.cpp
index d309ffd..a7f7595 100644
--- a/Externals/wxWidgets3/src/gtk/print.cpp
+++ b/Externals/wxWidgets3/src/gtk/print.cpp
@@ -51,10 +51,6 @@
#include "wx/link.h"
wxFORCE_LINK_THIS_MODULE(gtk_print)
-#if wxUSE_LIBGNOMEPRINT
-#include "wx/gtk/gnome/gprint.h"
-#endif
-
#include "wx/gtk/private/object.h"
// Useful to convert angles from/to Rad to/from Deg.
@@ -64,8 +60,7 @@ static const double DEG2RAD = M_PI / 180.0;
//----------------------------------------------------------------------------
// wxGtkPrintModule
// Initialized when starting the app : if it successfully load the gtk-print framework,
-// it uses it. If not, it falls back to gnome print (see /gtk/gnome/gprint.cpp) then
-// to postscript if gnomeprint is not available.
+// it uses it. If not, it falls back to Postscript.
//----------------------------------------------------------------------------
class wxGtkPrintModule: public wxModule
@@ -73,10 +68,6 @@ class wxGtkPrintModule: public wxModule
public:
wxGtkPrintModule()
{
-#if wxUSE_LIBGNOMEPRINT
- // This module must be initialized AFTER gnomeprint's one
- AddDependency(wxCLASSINFO(wxGnomePrintModule));
-#endif
}
bool OnInit();
void OnExit() {}
@@ -1366,47 +1357,43 @@ void wxGtkPrinterDCImpl::DoCrossHair(wxCoord x, wxCoord y)
void wxGtkPrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
{
- double dx = x1 - xc;
- double dy = y1 - yc;
- double radius = sqrt((double)(dx*dx+dy*dy));
+ const double dx1 = x1 - xc;
+ const double dy1 = y1 - yc;
+ const double radius = sqrt(dx1*dx1 + dy1*dy1);
+
+ if ( radius == 0.0 )
+ return;
double alpha1, alpha2;
- if (x1 == x2 && y1 == y2)
+ if ( x1 == x2 && y1 == y2 )
{
alpha1 = 0.0;
- alpha2 = 360.0;
- }
- else
- if (radius == 0.0)
- {
- alpha1 = alpha2 = 0.0;
+ alpha2 = 2*M_PI;
+
}
else
{
- alpha1 = (x1 - xc == 0) ?
- (y1 - yc < 0) ? 90.0 : -90.0 :
- atan2(double(y1-yc), double(x1-xc)) * RAD2DEG;
- alpha2 = (x2 - xc == 0) ?
- (y2 - yc < 0) ? 90.0 : -90.0 :
- atan2(double(y2-yc), double(x2-xc)) * RAD2DEG;
-
- while (alpha1 <= 0) alpha1 += 360;
- while (alpha2 <= 0) alpha2 += 360; // adjust angles to be between.
- while (alpha1 > 360) alpha1 -= 360; // 0 and 360 degree.
- while (alpha2 > 360) alpha2 -= 360;
+ alpha1 = atan2(dy1, dx1);
+ alpha2 = atan2(double(y2-yc), double(x2-xc));
}
- alpha1 *= DEG2RAD;
- alpha2 *= DEG2RAD;
-
cairo_new_path(m_cairo);
- cairo_arc_negative ( m_cairo, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2);
- cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc));
- cairo_close_path (m_cairo);
+ // We use the "negative" variant because the arc should go counterclockwise
+ // while in the default coordinate system, with Y axis going down, Cairo
+ // counts angles in the direction from positive X axis direction to
+ // positive Y axis direction, i.e. clockwise.
+ cairo_arc_negative(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc),
+ XLOG2DEVREL(wxRound(radius)), alpha1, alpha2);
- SetBrush( m_brush );
- cairo_fill_preserve( m_cairo );
+ if ( m_brush.IsNonTransparent() )
+ {
+ cairo_line_to(m_cairo, XLOG2DEV(xc), YLOG2DEV(yc));
+ cairo_close_path (m_cairo);
+
+ SetBrush( m_brush );
+ cairo_fill_preserve( m_cairo );
+ }
SetPen (m_pen);
cairo_stroke( m_cairo );
diff --git a/Externals/wxWidgets3/src/gtk/settings.cpp b/Externals/wxWidgets3/src/gtk/settings.cpp
index 89353c0..98efe96 100644
--- a/Externals/wxWidgets3/src/gtk/settings.cpp
+++ b/Externals/wxWidgets3/src/gtk/settings.cpp
@@ -428,8 +428,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
wxNativeFontInfo info;
#ifdef __WXGTK3__
GtkStyleContext* sc = gtk_widget_get_style_context(ButtonWidget());
- info.description = const_cast<PangoFontDescription*>(
- gtk_style_context_get_font(sc, GTK_STATE_FLAG_NORMAL));
+ gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_FONT, &info.description, NULL);
#else
info.description = ButtonStyle()->font_desc;
#endif
@@ -440,10 +440,14 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
// it's "Sans Serif" but the real font is called "Sans"):
if (!wxFontEnumerator::IsValidFacename(gs_fontSystem.GetFaceName()) &&
gs_fontSystem.GetFaceName() == "Sans Serif")
+ {
gs_fontSystem.SetFaceName("Sans");
+ }
#endif // wxUSE_FONTENUM
+#ifndef __WXGTK3__
info.description = NULL;
+#endif
}
font = gs_fontSystem;
break;
diff --git a/Externals/wxWidgets3/src/gtk/spinbutt.cpp b/Externals/wxWidgets3/src/gtk/spinbutt.cpp
index e7c5595..fd1ee2c 100644
--- a/Externals/wxWidgets3/src/gtk/spinbutt.cpp
+++ b/Externals/wxWidgets3/src/gtk/spinbutt.cpp
@@ -14,10 +14,6 @@
#include "wx/spinbutt.h"
-#ifndef WX_PRECOMP
- #include "wx/utils.h"
-#endif
-
#include <gtk/gtk.h>
//-----------------------------------------------------------------------------
@@ -71,10 +67,6 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win)
// wxSpinButton
//-----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
- EVT_SIZE(wxSpinButton::OnSize)
-END_EVENT_TABLE()
-
wxSpinButton::wxSpinButton()
{
m_pos = 0;
@@ -87,14 +79,8 @@ bool wxSpinButton::Create(wxWindow *parent,
long style,
const wxString& name)
{
- wxSize new_size = size,
- sizeBest = DoGetBestSize();
- new_size.x = sizeBest.x; // override width always
- if (new_size.y == -1)
- new_size.y = sizeBest.y;
-
- if (!PreCreation( parent, pos, new_size ) ||
- !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name ))
+ if (!PreCreation(parent, pos, size) ||
+ !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name))
{
wxFAIL_MSG( wxT("wxSpinButton creation failed") );
return false;
@@ -105,6 +91,7 @@ bool wxSpinButton::Create(wxWindow *parent,
m_widget = gtk_spin_button_new_with_range(0, 100, 1);
g_object_ref(m_widget);
+ gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0);
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget),
(int)(m_windowStyle & wxSP_WRAP) );
@@ -113,7 +100,7 @@ bool wxSpinButton::Create(wxWindow *parent,
m_parent->DoAddChild( this );
- PostCreation(new_size);
+ PostCreation(size);
return true;
}
@@ -163,14 +150,6 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
GtkEnableEvents();
}
-void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )
-{
- wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
-
- m_width = DoGetBestSize().x;
- gtk_widget_set_size_request( m_widget, m_width, m_height );
-}
-
bool wxSpinButton::Enable( bool enable )
{
if (!base_type::Enable(enable))
@@ -207,7 +186,20 @@ GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) cons
wxSize wxSpinButton::DoGetBestSize() const
{
- wxSize best(15, 26); // FIXME
+ wxSize best = base_type::DoGetBestSize();
+#ifdef __WXGTK3__
+ GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);
+ GtkBorder pad = { 0, 0, 0, 0 };
+ gtk_style_context_get_padding(sc, GtkStateFlags(0), &pad);
+ best.x -= pad.left + pad.right;
+#else
+ gtk_widget_ensure_style(m_widget);
+ int w = PANGO_PIXELS(pango_font_description_get_size(m_widget->style->font_desc));
+ w &= ~1;
+ if (w < 6)
+ w = 6;
+ best.x = w + 2 * m_widget->style->xthickness;
+#endif
CacheBestSize(best);
return best;
}
@@ -219,4 +211,4 @@ wxSpinButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return GetDefaultAttributesFromGTKWidget(gtk_spin_button_new_with_range(0, 100, 1));
}
-#endif
+#endif // wxUSE_SPINBTN
diff --git a/Externals/wxWidgets3/src/gtk/textentry.cpp b/Externals/wxWidgets3/src/gtk/textentry.cpp
index 0c15570..03a6867 100644
--- a/Externals/wxWidgets3/src/gtk/textentry.cpp
+++ b/Externals/wxWidgets3/src/gtk/textentry.cpp
@@ -514,4 +514,31 @@ wxPoint wxTextEntry::DoGetMargins() const
#endif
}
+#ifdef __WXGTK3__
+bool wxTextEntry::SetHint(const wxString& hint)
+{
+#if GTK_CHECK_VERSION(3,2,0)
+ GtkEntry *entry = GetEntry();
+ if ( entry )
+ {
+ gtk_entry_set_placeholder_text(entry, wxGTK_CONV(hint));
+ return true;
+ }
+ else
+#endif
+ return wxTextEntryBase::SetHint(hint);
+}
+
+wxString wxTextEntry::GetHint() const
+{
+#if GTK_CHECK_VERSION(3,2,0)
+ GtkEntry *entry = GetEntry();
+ if ( entry )
+ return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry));
+ else
+#endif
+ return wxTextEntryBase::GetHint();
+}
+#endif // __WXGTK3__
+
#endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX
diff --git a/Externals/wxWidgets3/src/gtk/toplevel.cpp b/Externals/wxWidgets3/src/gtk/toplevel.cpp
index 9e2a417..19af5b8 100644
--- a/Externals/wxWidgets3/src/gtk/toplevel.cpp
+++ b/Externals/wxWidgets3/src/gtk/toplevel.cpp
@@ -39,6 +39,9 @@
#include <X11/Xatom.h> // XA_CARDINAL
#include "wx/unix/utilsx11.h"
#endif
+#ifdef GDK_WINDOWING_WAYLAND
+ #include <gdk/gdkwayland.h>
+#endif
#include "wx/gtk/private.h"
#include "wx/gtk/private/gtk2-compat.h"
@@ -549,7 +552,9 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
long style,
const wxString &name )
{
- const wxSize size(WidthDefault(sizeOrig.x), HeightDefault(sizeOrig.y));
+ wxSize size(sizeOrig);
+ if (!size.IsFullySpecified())
+ size.SetDefaults(GetDefaultSize());
wxTopLevelWindows.Append( this );
@@ -718,6 +723,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
if ( (style & wxSIMPLE_BORDER) || (style & wxNO_BORDER) )
{
m_gdkDecor = 0;
+ gtk_window_set_decorated(GTK_WINDOW(m_widget), false);
}
else // have border
{
@@ -725,6 +731,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
if ( style & wxCAPTION )
m_gdkDecor |= GDK_DECOR_TITLE;
+#if defined(GDK_WINDOWING_WAYLAND) && GTK_CHECK_VERSION(3,10,0)
+ else if (
+ GDK_IS_WAYLAND_DISPLAY(gtk_widget_get_display(m_widget)) &&
+ gtk_check_version(3,10,0) == NULL)
+ {
+ gtk_window_set_titlebar(GTK_WINDOW(m_widget), gtk_header_bar_new());
+ }
+#endif
if ( style & wxSYSTEM_MENU )
m_gdkDecor |= GDK_DECOR_MENU;
@@ -742,17 +756,25 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
}
}
- if ((style & wxRESIZE_BORDER) == 0)
- gtk_window_set_resizable(GTK_WINDOW(m_widget), false);
-#ifndef __WXGTK3__
- else
- gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
-#endif
-
m_decorSize = GetCachedDecorSize();
int w, h;
GTKDoGetSize(&w, &h);
- gtk_window_set_default_size(GTK_WINDOW(m_widget), w, h);
+
+ if (style & wxRESIZE_BORDER)
+ {
+ gtk_window_set_default_size(GTK_WINDOW(m_widget), w, h);
+#ifndef __WXGTK3__
+ gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
+#endif
+ }
+ else
+ {
+ gtk_window_set_resizable(GTK_WINDOW(m_widget), false);
+ // gtk_window_set_default_size() does not work for un-resizable windows,
+ // unless you set the size hints, but that causes Ubuntu's WM to make
+ // the window resizable even though GDK_FUNC_RESIZE is not set.
+ gtk_widget_set_size_request(m_widget, w, h);
+ }
return true;
}
@@ -1118,6 +1140,8 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
int w, h;
GTKDoGetSize(&w, &h);
gtk_window_resize(GTK_WINDOW(m_widget), w, h);
+ if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
+ gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);
DoGetClientSize(&m_clientWidth, &m_clientHeight);
wxSizeEvent event(GetSize(), GetId());
@@ -1231,6 +1255,8 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
h >= m_minHeight - (decorSize.top + decorSize.bottom))
{
gtk_window_resize(GTK_WINDOW(m_widget), w, h);
+ if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
+ gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);
resized = true;
}
}
diff --git a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp
index 3843449..34a1610 100644
--- a/Externals/wxWidgets3/src/gtk/utilsgtk.cpp
+++ b/Externals/wxWidgets3/src/gtk/utilsgtk.cpp
@@ -418,11 +418,11 @@ wxGUIAppTraits::GetStandardCmdLineOptions(wxArrayString& names,
{
wxString usage;
- // check whether GLib version is greater than 2.6 but also lower than 2.33
+ // check whether GLib version is lower than 2.39
// because, as we use the undocumented _GOptionGroup struct, we don't want
- // to run this code with future versions which might change it (2.32 is the
+ // to run this code with future versions which might change it (2.38 is the
// latest one at the time of this writing)
- if (glib_check_version(2,33,0))
+ if (glib_check_version(2,39,0))
{
usage << _("The following standard GTK+ options are also supported:\n");
diff --git a/Externals/wxWidgets3/src/gtk/webview_webkit.cpp b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp
index faaf4be..d1f19f9 100644
--- a/Externals/wxWidgets3/src/gtk/webview_webkit.cpp
+++ b/Externals/wxWidgets3/src/gtk/webview_webkit.cpp
@@ -414,7 +414,7 @@ wxgtk_webview_webkit_context_menu(WebKitWebView *,
static WebKitWebView*
wxgtk_webview_webkit_create_webview(WebKitWebView *web_view,
- WebKitWebFrame *frame,
+ WebKitWebFrame*,
wxWebViewWebKit *webKitCtrl)
{
//As we do not know the uri being loaded at this point allow the load to
diff --git a/Externals/wxWidgets3/src/gtk/window.cpp b/Externals/wxWidgets3/src/gtk/window.cpp
index e163078..a167434 100644
--- a/Externals/wxWidgets3/src/gtk/window.cpp
+++ b/Externals/wxWidgets3/src/gtk/window.cpp
@@ -1614,112 +1614,125 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget),
// "scroll_event" (mouse wheel event)
//-----------------------------------------------------------------------------
-// Compute lines/columns per action the same way as private GTK+ function
-// _gtk_range_get_wheel_delta()
-static inline int GetWheelScrollActionDelta(GtkRange* range)
+static void AdjustRangeValue(GtkRange* range, double step)
{
- int delta = 3;
- if (range)
+ if (range && gtk_widget_get_visible(GTK_WIDGET(range)))
{
GtkAdjustment* adj = gtk_range_get_adjustment(range);
- const double page_size = gtk_adjustment_get_page_size(adj);
- delta = wxRound(pow(page_size, 2.0 / 3.0));
+ double value = gtk_adjustment_get_value(adj);
+ value += step * gtk_adjustment_get_step_increment(adj);
+ gtk_range_set_value(range, value);
}
- return delta;
}
static gboolean
-window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
+scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win)
{
wxMouseEvent event(wxEVT_MOUSEWHEEL);
InitMouseEvent(win, event, gdk_event);
event.m_wheelDelta = 120;
+ event.m_linesPerAction = 3;
+ event.m_columnsPerAction = 3;
-#if GTK_CHECK_VERSION(3,4,0)
- if (gdk_event->direction == GDK_SCROLL_SMOOTH)
+ GtkRange* range_h = win->m_scrollBar[wxWindow::ScrollDir_Horz];
+ GtkRange* range_v = win->m_scrollBar[wxWindow::ScrollDir_Vert];
+ const bool is_range_h = (void*)widget == range_h;
+ const bool is_range_v = (void*)widget == range_v;
+ GdkScrollDirection direction = gdk_event->direction;
+ switch (direction)
{
- bool processed_x = false;
- if (gdk_event->delta_x)
- {
- event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
- event.m_wheelRotation = int(event.m_wheelDelta * gdk_event->delta_x);
- GtkRange* range = win->m_scrollBar[wxWindow::ScrollDir_Horz];
- event.m_linesPerAction = GetWheelScrollActionDelta(range);
- event.m_columnsPerAction = event.m_linesPerAction;
- processed_x = win->GTKProcessEvent(event);
- }
- bool processed_y = false;
- if (gdk_event->delta_y)
- {
- event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
- event.m_wheelRotation = int(event.m_wheelDelta * -gdk_event->delta_y);
- GtkRange* range = win->m_scrollBar[wxWindow::ScrollDir_Vert];
- event.m_linesPerAction = GetWheelScrollActionDelta(range);
- event.m_columnsPerAction = event.m_linesPerAction;
- processed_y = win->GTKProcessEvent(event);
- }
- return processed_x || processed_y;
- }
+ case GDK_SCROLL_UP:
+ if (is_range_h)
+ direction = GDK_SCROLL_LEFT;
+ break;
+ case GDK_SCROLL_DOWN:
+ if (is_range_h)
+ direction = GDK_SCROLL_RIGHT;
+ break;
+ case GDK_SCROLL_LEFT:
+ if (is_range_v)
+ direction = GDK_SCROLL_UP;
+ break;
+ case GDK_SCROLL_RIGHT:
+ if (is_range_v)
+ direction = GDK_SCROLL_DOWN;
+ break;
+ default:
+ break;
+#if GTK_CHECK_VERSION(3,4,0)
+ case GDK_SCROLL_SMOOTH:
+ double delta_x = gdk_event->delta_x;
+ double delta_y = gdk_event->delta_y;
+ if (delta_x == 0)
+ {
+ if (is_range_h)
+ {
+ delta_x = delta_y;
+ delta_y = 0;
+ }
+ }
+ else if (delta_y == 0)
+ {
+ if (is_range_v)
+ {
+ delta_y = delta_x;
+ delta_x = 0;
+ }
+ }
+ if (delta_x)
+ {
+ event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
+ event.m_wheelRotation = int(event.m_wheelDelta * delta_x);
+ if (!win->GTKProcessEvent(event))
+ AdjustRangeValue(range_h, event.m_columnsPerAction * delta_x);
+ }
+ if (delta_y)
+ {
+ event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
+ event.m_wheelRotation = int(event.m_wheelDelta * -delta_y);
+ if (!win->GTKProcessEvent(event))
+ AdjustRangeValue(range_v, event.m_linesPerAction * delta_y);
+ }
+ return true;
#endif // GTK_CHECK_VERSION(3,4,0)
+ }
GtkRange *range;
- switch (gdk_event->direction)
+ double step;
+ switch (direction)
{
case GDK_SCROLL_UP:
case GDK_SCROLL_DOWN:
- range = win->m_scrollBar[wxWindow::ScrollDir_Vert];
+ range = range_v;
event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
+ step = event.m_linesPerAction;
break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_RIGHT:
- range = win->m_scrollBar[wxWindow::ScrollDir_Horz];
+ range = range_h;
event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
+ step = event.m_columnsPerAction;
break;
default:
return false;
}
event.m_wheelRotation = event.m_wheelDelta;
- if (gdk_event->direction == GDK_SCROLL_DOWN ||
- gdk_event->direction == GDK_SCROLL_LEFT)
- {
+ if (direction == GDK_SCROLL_DOWN || direction == GDK_SCROLL_LEFT)
event.m_wheelRotation = -event.m_wheelRotation;
- }
- event.m_linesPerAction = GetWheelScrollActionDelta(range);
- event.m_columnsPerAction = event.m_linesPerAction;
- return win->GTKProcessEvent(event);
-}
-
-#if GTK_CHECK_VERSION(3,4,0)
-static gboolean
-hscrollbar_scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win)
-{
- GdkEventScroll event2;
- if (gdk_event->direction == GDK_SCROLL_SMOOTH && gdk_event->delta_x == 0)
+ if (!win->GTKProcessEvent(event))
{
- memcpy(&event2, gdk_event, sizeof(event2));
- event2.delta_x = event2.delta_y;
- event2.delta_y = 0;
- gdk_event = &event2;
- }
- return window_scroll_event(widget, gdk_event, win);
-}
+ if (!range)
+ return false;
-static gboolean
-vscrollbar_scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win)
-{
- GdkEventScroll event2;
- if (gdk_event->direction == GDK_SCROLL_SMOOTH && gdk_event->delta_y == 0)
- {
- memcpy(&event2, gdk_event, sizeof(event2));
- event2.delta_y = event2.delta_x;
- event2.delta_x = 0;
- gdk_event = &event2;
+ if (direction == GDK_SCROLL_UP || direction == GDK_SCROLL_LEFT)
+ step = -step;
+ AdjustRangeValue(range, step);
}
- return window_scroll_event(widget, gdk_event, win);
+
+ return true;
}
-#endif // GTK_CHECK_VERSION(3,4,0)
//-----------------------------------------------------------------------------
// "popup-menu"
@@ -2647,23 +2660,13 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget )
g_signal_connect (widget, "motion_notify_event",
G_CALLBACK (gtk_window_motion_notify_callback), this);
- g_signal_connect (widget, "scroll_event",
- G_CALLBACK (window_scroll_event), this);
- for (int i = 0; i < 2; i++)
- {
- GtkRange* range = m_scrollBar[i];
- if (range)
- {
-#if GTK_CHECK_VERSION(3,4,0)
- GCallback cb = GCallback(i == ScrollDir_Horz
- ? hscrollbar_scroll_event
- : vscrollbar_scroll_event);
-#else
- GCallback cb = GCallback(window_scroll_event);
-#endif
- g_signal_connect(range, "scroll_event", cb, this);
- }
- }
+ g_signal_connect(widget, "scroll_event", G_CALLBACK(scroll_event), this);
+ GtkRange* range = m_scrollBar[ScrollDir_Horz];
+ if (range)
+ g_signal_connect(range, "scroll_event", G_CALLBACK(scroll_event), this);
+ range = m_scrollBar[ScrollDir_Vert];
+ if (range)
+ g_signal_connect(range, "scroll_event", G_CALLBACK(scroll_event), this);
g_signal_connect (widget, "popup_menu",
G_CALLBACK (wxgtk_window_popup_menu_callback), this);
diff --git a/Externals/wxWidgets3/src/msw/app.cpp b/Externals/wxWidgets3/src/msw/app.cpp
index cadcdaa..9d9b1ce 100644
--- a/Externals/wxWidgets3/src/msw/app.cpp
+++ b/Externals/wxWidgets3/src/msw/app.cpp
@@ -646,12 +646,6 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
SHInitExtraControls();
#endif
-#ifndef __WXWINCE__
- // Don't show a message box if a function such as SHGetFileInfo
- // fails to find a device.
- SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
-#endif
-
wxOleInitialize();
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
diff --git a/Externals/wxWidgets3/src/msw/choice.cpp b/Externals/wxWidgets3/src/msw/choice.cpp
index 26e4a8e..6699e1e 100644
--- a/Externals/wxWidgets3/src/msw/choice.cpp
+++ b/Externals/wxWidgets3/src/msw/choice.cpp
@@ -436,7 +436,16 @@ void wxChoice::DoSetItemClientData(unsigned int n, void* clientData)
void* wxChoice::DoGetItemClientData(unsigned int n) const
{
+ // Before using GetLastError() below, ensure that we don't have a stale
+ // error code from a previous API call as CB_GETITEMDATA doesn't reset it
+ // in case of success, it only sets it if an error occurs.
+ SetLastError(ERROR_SUCCESS);
+
LPARAM rc = SendMessage(GetHwnd(), CB_GETITEMDATA, n, 0);
+
+ // Notice that we must call GetLastError() to distinguish between a real
+ // error and successfully retrieving a previously stored client data value
+ // of CB_ERR (-1).
if ( rc == CB_ERR && GetLastError() != ERROR_SUCCESS )
{
wxLogLastError(wxT("CB_GETITEMDATA"));
diff --git a/Externals/wxWidgets3/src/msw/combobox.cpp b/Externals/wxWidgets3/src/msw/combobox.cpp
index cb08858..692c546 100644
--- a/Externals/wxWidgets3/src/msw/combobox.cpp
+++ b/Externals/wxWidgets3/src/msw/combobox.cpp
@@ -228,36 +228,55 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
case WM_CHAR:
// for compatibility with wxTextCtrl, generate a special message
// when Enter is pressed
- if ( wParam == VK_RETURN )
+ switch ( wParam )
{
- if (SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0))
- return false;
-
- wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
-
- const int sel = GetSelection();
- event.SetInt(sel);
- event.SetString(GetValue());
- InitCommandEventWithItems(event, sel);
+ case VK_RETURN:
+ {
+ if (SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0))
+ return false;
+
+ wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
+
+ const int sel = GetSelection();
+ event.SetInt(sel);
+ event.SetString(GetValue());
+ InitCommandEventWithItems(event, sel);
+
+ if ( ProcessCommand(event) )
+ {
+ // don't let the event through to the native control
+ // because it doesn't need it and may generate an annoying
+ // beep if it gets it
+ return true;
+ }
+ }
+ break;
- if ( ProcessCommand(event) )
- {
- // don't let the event through to the native control
- // because it doesn't need it and may generate an annoying
- // beep if it gets it
- return true;
- }
+ case VK_TAB:
+ // If we have wxTE_PROCESS_ENTER style, we get all char
+ // events, including those for TAB which are usually used
+ // for keyboard navigation, but we should not process them
+ // unless we also have wxTE_PROCESS_TAB style.
+ if ( !HasFlag(wxTE_PROCESS_TAB) )
+ {
+ int flags = 0;
+ if ( !wxIsShiftDown() )
+ flags |= wxNavigationKeyEvent::IsForward;
+ if ( wxIsCtrlDown() )
+ flags |= wxNavigationKeyEvent::WinChange;
+ if ( Navigate(flags) )
+ return true;
+ }
+ break;
}
- // fall through, WM_CHAR is one of the message we should forward.
+ }
- default:
- if ( ShouldForwardFromEditToCombo(msg) )
- {
- // For all the messages forward from the edit control the
- // result is not used.
- WXLRESULT result;
- return MSWHandleMessage(&result, msg, wParam, lParam);
- }
+ if ( ShouldForwardFromEditToCombo(msg) )
+ {
+ // For all the messages forward from the edit control the
+ // result is not used.
+ WXLRESULT result;
+ return MSWHandleMessage(&result, msg, wParam, lParam);
}
return false;
@@ -674,4 +693,22 @@ wxSize wxComboBox::DoGetSizeFromTextSize(int xlen, int ylen) const
return tsize;
}
+wxWindow *wxComboBox::MSWFindItem(long id, WXHWND hWnd) const
+{
+ // The base class version considers that any window with the same ID as
+ // this one must be this window itself, but this is not the case for the
+ // comboboxes where the native control seems to always use the ID of 1000
+ // for the popup listbox that it creates -- and this ID may be the same as
+ // our own one. So we must explicitly check the HWND value too here and
+ // avoid eating the events from the listbox as otherwise it is rendered
+ // inoperative, see #15647.
+ if ( id == GetId() && hWnd && hWnd != GetHWND() )
+ {
+ // Must be the case described above.
+ return NULL;
+ }
+
+ return wxChoice::MSWFindItem(id, hWnd);
+}
+
#endif // wxUSE_COMBOBOX
diff --git a/Externals/wxWidgets3/src/msw/control.cpp b/Externals/wxWidgets3/src/msw/control.cpp
index 1fe94ba..4bb6ae8 100644
--- a/Externals/wxWidgets3/src/msw/control.cpp
+++ b/Externals/wxWidgets3/src/msw/control.cpp
@@ -442,6 +442,15 @@ WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)
GetHWND());
}
+wxWindow* wxControl::MSWFindItem(long id, WXHWND hWnd) const
+{
+ // is it us or one of our "internal" children?
+ if ( id == GetId() || (GetSubcontrols().Index(id) != wxNOT_FOUND) )
+ return const_cast<wxControl *>(this);
+
+ return wxControlBase::MSWFindItem(id, hWnd);
+}
+
// ----------------------------------------------------------------------------
// wxControlWithItems
// ----------------------------------------------------------------------------
diff --git a/Externals/wxWidgets3/src/msw/crashrpt.cpp b/Externals/wxWidgets3/src/msw/crashrpt.cpp
index c9d45cb..8f97402 100644
--- a/Externals/wxWidgets3/src/msw/crashrpt.cpp
+++ b/Externals/wxWidgets3/src/msw/crashrpt.cpp
@@ -226,7 +226,9 @@ bool wxCrashReportImpl::Generate(int flags, EXCEPTION_POINTERS *ep)
}
else // dbghelp.dll couldn't be loaded
{
- Output(wxT("%s"), wxDbgHelpDLL::GetErrorMessage().c_str());
+ Output(wxT("%s"), static_cast<const wxChar*>(
+ wxDbgHelpDLL::GetErrorMessage().c_str()
+ ));
}
#else // !wxUSE_DBGHELP
wxUnusedVar(flags);
diff --git a/Externals/wxWidgets3/src/msw/datectrl.cpp b/Externals/wxWidgets3/src/msw/datectrl.cpp
index cf85692..987edd1 100644
--- a/Externals/wxWidgets3/src/msw/datectrl.cpp
+++ b/Externals/wxWidgets3/src/msw/datectrl.cpp
@@ -91,11 +91,15 @@ WXDWORD wxDatePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
// TODO: handle WM_WININICHANGE
+#if wxUSE_INTL
+
wxLocaleInfo wxDatePickerCtrl::MSWGetFormat() const
{
return wxLOCALE_SHORT_DATE_FMT;
}
+#endif // wxUSE_INTL
+
// ----------------------------------------------------------------------------
// wxDatePickerCtrl operations
// ----------------------------------------------------------------------------
diff --git a/Externals/wxWidgets3/src/msw/datetimectrl.cpp b/Externals/wxWidgets3/src/msw/datetimectrl.cpp
index c9b4449..408feab 100644
--- a/Externals/wxWidgets3/src/msw/datetimectrl.cpp
+++ b/Externals/wxWidgets3/src/msw/datetimectrl.cpp
@@ -110,8 +110,12 @@ wxSize wxDateTimePickerCtrl::DoGetBestSize() const
{
wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));
- // Use the same native format as this as the underlying native control.
+ // Use the same native format as the underlying native control.
+#if wxUSE_INTL
wxString s = wxDateTime::Now().Format(wxLocale::GetInfo(MSWGetFormat()));
+#else // !wxUSE_INTL
+ wxString s("XXX-YYY-ZZZZ");
+#endif // wxUSE_INTL/!wxUSE_INTL
// the best size for the control is bigger than just the string
// representation of the current value because the control must accommodate
diff --git a/Externals/wxWidgets3/src/msw/dc.cpp b/Externals/wxWidgets3/src/msw/dc.cpp
index 779e750..97a4da0 100644
--- a/Externals/wxWidgets3/src/msw/dc.cpp
+++ b/Externals/wxWidgets3/src/msw/dc.cpp
@@ -148,7 +148,7 @@ wxAlphaBlend(HDC hdcDst, int xDst, int yDst,
#endif // wxHAS_RAW_BITMAP
-namespace wxMSW
+namespace wxMSWImpl
{
// Wrappers for the dynamically loaded {Set,Get}Layout() functions. They work
@@ -162,7 +162,7 @@ DWORD SetLayout(HDC hdc, DWORD dwLayout);
// temporary compatible memory DC to the real target DC) using the same layout.
HDC CreateCompatibleDCWithLayout(HDC hdc);
-} // namespace wxMSW
+} // namespace wxMSWImpl
// ----------------------------------------------------------------------------
// private classes
@@ -1341,7 +1341,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool
#endif // wxUSE_SYSTEM_OPTIONS
{
HDC cdc = GetHdc();
- HDC hdcMem = wxMSW::CreateCompatibleDCWithLayout(cdc);
+ HDC hdcMem = wxMSWImpl::CreateCompatibleDCWithLayout(cdc);
HGDIOBJ hOldBitmap = ::SelectObject(hdcMem, GetHbitmapOf(bmp));
#if wxUSE_PALETTE
wxPalette *pal = bmp.GetPalette();
@@ -1382,7 +1382,7 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool
else // no mask, just use BitBlt()
{
HDC cdc = GetHdc();
- HDC memdc = wxMSW::CreateCompatibleDCWithLayout( cdc );
+ HDC memdc = wxMSWImpl::CreateCompatibleDCWithLayout( cdc );
HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
@@ -2281,8 +2281,8 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
buffer_bmap = (HBITMAP) bitmapCacheEntry->m_bitmap;
#else // !wxUSE_DC_CACHEING
// create a temp buffer bitmap and DCs to access it and the mask
- dc_mask = wxMSW::CreateCompatibleDCWithLayout(hdcSrc);
- dc_buffer = wxMSW::CreateCompatibleDCWithLayout(GetHdc());
+ dc_mask = wxMSWImpl::CreateCompatibleDCWithLayout(hdcSrc);
+ dc_buffer = wxMSWImpl::CreateCompatibleDCWithLayout(GetHdc());
buffer_bmap = ::CreateCompatibleBitmap(GetHdc(), dstWidth, dstHeight);
#endif // wxUSE_DC_CACHEING/!wxUSE_DC_CACHEING
HGDIOBJ hOldMaskBitmap = ::SelectObject(dc_mask, (HBITMAP) mask->GetMaskBitmap());
@@ -2595,7 +2595,7 @@ wxDCCacheEntry* wxMSWDCImpl::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc)
node = node->GetNext();
}
- WXHDC hDC = (WXHDC) wxMSW::CreateCompatibleDCWithLayout((HDC) dc);
+ WXHDC hDC = (WXHDC) wxMSWImpl::CreateCompatibleDCWithLayout((HDC) dc);
if ( !hDC)
{
wxLogLastError(wxT("CreateCompatibleDC"));
@@ -2827,7 +2827,7 @@ void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect,
#if wxUSE_DYNLIB_CLASS
-namespace wxMSW
+namespace wxMSWImpl
{
DWORD GetLayout(HDC hdc)
@@ -2853,19 +2853,19 @@ HDC CreateCompatibleDCWithLayout(HDC hdc)
HDC hdcNew = ::CreateCompatibleDC(hdc);
if ( hdcNew )
{
- DWORD dwLayout = wxMSW::GetLayout(hdc);
+ DWORD dwLayout = wxMSWImpl::GetLayout(hdc);
if ( dwLayout != GDI_ERROR )
- wxMSW::SetLayout(hdcNew, dwLayout);
+ wxMSWImpl::SetLayout(hdcNew, dwLayout);
}
return hdcNew;
}
-} // namespace wxMSW
+} // namespace wxMSWImpl
wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const
{
- DWORD layout = wxMSW::GetLayout(GetHdc());
+ DWORD layout = wxMSWImpl::GetLayout(GetHdc());
if ( layout == GDI_ERROR )
return wxLayout_Default;
@@ -2882,7 +2882,7 @@ void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection dir)
return;
}
- DWORD layout = wxMSW::GetLayout(GetHdc());
+ DWORD layout = wxMSWImpl::GetLayout(GetHdc());
if ( layout == GDI_ERROR )
return;
@@ -2891,13 +2891,13 @@ void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection dir)
else
layout &= ~LAYOUT_RTL;
- wxMSW::SetLayout(GetHdc(), layout);
+ wxMSWImpl::SetLayout(GetHdc(), layout);
}
#else // !wxUSE_DYNLIB_CLASS
// Provide stubs to avoid ifdefs in the code using these functions.
-namespace wxMSW
+namespace wxMSWImpl
{
DWORD GetLayout(HDC WXUNUSED(hdc))
@@ -2915,7 +2915,7 @@ HDC CreateCompatibleDCWithLayout(HDC hdc)
return ::CreateCompatibleDC(hdc);
}
-} // namespace wxMSW
+} // namespace wxMSWImpl
// we can't provide RTL support without dynamic loading, so stub it out
wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const
diff --git a/Externals/wxWidgets3/src/msw/dirdlg.cpp b/Externals/wxWidgets3/src/msw/dirdlg.cpp
index 620d74b..cec2c85 100644
--- a/Externals/wxWidgets3/src/msw/dirdlg.cpp
+++ b/Externals/wxWidgets3/src/msw/dirdlg.cpp
@@ -105,11 +105,11 @@ struct IModalWindow : public IUnknown
#define FOS_FORCEFILESYSTEM 0x40
#endif
-struct COMDLG_FILTERSPEC;
+struct _COMDLG_FILTERSPEC;
struct IFileDialog : public IModalWindow
{
- virtual HRESULT wxSTDCALL SetFileTypes(UINT, const COMDLG_FILTERSPEC*) = 0;
+ virtual HRESULT wxSTDCALL SetFileTypes(UINT, const _COMDLG_FILTERSPEC*) = 0;
virtual HRESULT wxSTDCALL SetFileTypeIndex(UINT) = 0;
virtual HRESULT wxSTDCALL GetFileTypeIndex(UINT*) = 0;
virtual HRESULT wxSTDCALL Advise(IFileDialogEvents*, DWORD*) = 0;
diff --git a/Externals/wxWidgets3/src/msw/dlmsw.cpp b/Externals/wxWidgets3/src/msw/dlmsw.cpp
index 5957086..a83e477 100644
--- a/Externals/wxWidgets3/src/msw/dlmsw.cpp
+++ b/Externals/wxWidgets3/src/msw/dlmsw.cpp
@@ -236,51 +236,7 @@ wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
if (flags & wxDL_GET_LOADED)
return ::GetModuleHandle(libname.t_str());
- // Explicitly look in the same path as where the main wx HINSTANCE module
- // is located (usually the executable or the DLL that uses wx). Normally
- // this is automatically part of the default search path but in some cases
- // it may not be, such as when the wxPython extension modules need to load
- // a DLL, but the intperpreter executable is located elsewhere. Doing
- // this allows us to always be able to dynamically load a DLL that is
- // located at the same place as the wx modules.
- wxString modpath, path;
- ::GetModuleFileName(wxGetInstance(),
- wxStringBuffer(modpath, MAX_PATH+1),
- MAX_PATH);
-
- wxFileName::SplitPath(modpath, &path, NULL, NULL);
-
- typedef BOOL (WINAPI *SetDllDirectory_t)(LPCTSTR lpPathName);
-
- static SetDllDirectory_t s_pfnSetDllDirectory = (SetDllDirectory_t) -1;
-
- if ( s_pfnSetDllDirectory == (SetDllDirectory_t) -1 )
- {
- /*
- Should wxLoadedDLL ever not be used here (or rather, the
- wxDL_GET_LOADED flag isn't used), infinite recursion will take
- place (unless s_pfnSetDllDirectory is set to NULL here right
- before loading the DLL).
- */
- wxLoadedDLL dllKernel("kernel32.dll");
-
- wxDL_INIT_FUNC_AW(s_pfn, SetDllDirectory, dllKernel);
- }
-
- if (s_pfnSetDllDirectory)
- {
- s_pfnSetDllDirectory(path.t_str());
- }
-
- wxDllType handle = ::LoadLibrary(libname.t_str());
-
- // reset the search path
- if (s_pfnSetDllDirectory)
- {
- s_pfnSetDllDirectory(NULL);
- }
-
- return handle;
+ return ::LoadLibrary(libname.t_str());
}
/* static */
@@ -294,7 +250,7 @@ void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
{
return (void *)::GetProcAddress(handle,
#ifdef __WXWINCE__
- name.c_str()
+ name.t_str()
#else
name.ToAscii()
#endif // __WXWINCE__
diff --git a/Externals/wxWidgets3/src/msw/fswatcher.cpp b/Externals/wxWidgets3/src/msw/fswatcher.cpp
index 7546f03..d179f67 100644
--- a/Externals/wxWidgets3/src/msw/fswatcher.cpp
+++ b/Externals/wxWidgets3/src/msw/fswatcher.cpp
@@ -231,6 +231,29 @@ bool wxIOCPThread::ReadEvents()
if (!count && !watch && !overlapped)
return false;
+ // if the thread got woken up but we got an empty packet it means that
+ // there was an overflow, too many events and not all could fit in
+ // the watch buffer. In this case, ReadDirectoryChangesW dumps the
+ // buffer.
+ if (!count && watch)
+ {
+ wxLogTrace(wxTRACE_FSWATCHER, "[iocp] Event queue overflowed: path=\"%s\"",
+ watch->GetPath());
+
+ if (watch->GetFlags() & wxFSW_EVENT_WARNING)
+ {
+ wxFileSystemWatcherEvent
+ overflowEvent(wxFSW_EVENT_WARNING, wxFSW_WARNING_OVERFLOW);
+ overflowEvent.SetPath(watch->GetPath());
+ SendEvent(overflowEvent);
+ }
+
+ // overflow is not a fatal error, we still want to get future events
+ // reissue the watch
+ (void) m_service->SetUpWatch(*watch);
+ return true;
+ }
+
// in case of spurious wakeup
if (!count || !watch)
return true;
@@ -283,9 +306,10 @@ void wxIOCPThread::ProcessNativeEvents(wxVector<wxEventProcessingData>& events)
int flags = Native2WatcherFlags(nativeFlags);
if (flags & wxFSW_EVENT_WARNING || flags & wxFSW_EVENT_ERROR)
{
- // TODO think about this...do we ever have any errors to report?
- wxString errMsg = "Error occurred";
- wxFileSystemWatcherEvent event(flags, errMsg);
+ wxFileSystemWatcherEvent
+ event(flags,
+ flags & wxFSW_EVENT_ERROR ? wxFSW_WARNING_NONE
+ : wxFSW_WARNING_GENERAL);
SendEvent(event);
}
// filter out ignored events and those not asked for.
diff --git a/Externals/wxWidgets3/src/msw/listbox.cpp b/Externals/wxWidgets3/src/msw/listbox.cpp
index e0f34e3..4a452a1 100644
--- a/Externals/wxWidgets3/src/msw/listbox.cpp
+++ b/Externals/wxWidgets3/src/msw/listbox.cpp
@@ -304,6 +304,10 @@ bool wxListBox::IsSelected(int N) const
void *wxListBox::DoGetItemClientData(unsigned int n) const
{
+ // This is done here for the same reasons as in wxChoice method with the
+ // same name.
+ SetLastError(ERROR_SUCCESS);
+
LPARAM rc = SendMessage(GetHwnd(), LB_GETITEMDATA, n, 0);
if ( rc == LB_ERR && GetLastError() != ERROR_SUCCESS )
{
diff --git a/Externals/wxWidgets3/src/msw/mdi.cpp b/Externals/wxWidgets3/src/msw/mdi.cpp
index 0645e4b..5a1aae5 100644
--- a/Externals/wxWidgets3/src/msw/mdi.cpp
+++ b/Externals/wxWidgets3/src/msw/mdi.cpp
@@ -374,15 +374,19 @@ void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
{
if ( menu != m_windowMenu )
{
- // notice that Remove/AddWindowMenu() are safe to call even when
- // m_windowMenu is NULL
- RemoveWindowMenu();
+ // We may not be showing the window menu currently if we don't have any
+ // children, and in this case we shouldn't remove/add it back right now.
+ const bool hasWindowMenu = GetActiveChild() != NULL;
+
+ if ( hasWindowMenu )
+ RemoveWindowMenu();
delete m_windowMenu;
m_windowMenu = menu;
- AddWindowMenu();
+ if ( hasWindowMenu )
+ AddWindowMenu();
}
#if wxUSE_ACCEL
diff --git a/Externals/wxWidgets3/src/msw/menu.cpp b/Externals/wxWidgets3/src/msw/menu.cpp
index f2bcc20..2b65c01 100644
--- a/Externals/wxWidgets3/src/msw/menu.cpp
+++ b/Externals/wxWidgets3/src/msw/menu.cpp
@@ -558,7 +558,13 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
pItem->GetBackgroundColour().IsOk() ||
pItem->GetFont().IsOk();
- if ( !mustUseOwnerDrawn )
+ // Windows XP or earlier don't display menu bitmaps bigger than
+ // standard size correctly (they're truncated), so we must use
+ // owner-drawn items to show them correctly there. OTOH Win7
+ // doesn't seem to have any problems with even very large bitmaps
+ // so don't use owner-drawn items unnecessarily there (Vista wasn't
+ // actually tested but I assume it works as 7 rather than as XP).
+ if ( !mustUseOwnerDrawn && winver < wxWinVersion_Vista )
{
const wxBitmap& bmpUnchecked = pItem->GetBitmap(false),
bmpChecked = pItem->GetBitmap(true);
@@ -731,11 +737,13 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
return false;
}
+#if wxUSE_OWNER_DRAWN
if ( makeItemOwnerDrawn )
{
SetOwnerDrawnMenuItem(GetHmenu(), pos,
reinterpret_cast<ULONG_PTR>(pItem), TRUE);
}
+#endif
}
@@ -785,9 +793,6 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
node = node->GetNext();
}
- // DoRemove() (unlike Remove) can only be called for an existing item!
- wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
-
#if wxUSE_ACCEL
// remove the corresponding accel from the accel table
int n = FindAccel(item->GetId());
@@ -1359,10 +1364,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
(GetHmenu() != 0);
#endif
- int mswpos = (!isAttached || (pos == m_menus.GetCount()))
- ? -1 // append the menu
- : MSWPositionForWxMenu(GetMenu(pos),pos);
-
if ( !wxMenuBarBase::Insert(pos, menu, title) )
return false;
@@ -1390,9 +1391,33 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
wxLogLastError(wxT("TB_INSERTBUTTON"));
return false;
}
- wxUnusedVar(mswpos);
#else
- if ( !::InsertMenu(GetHmenu(), mswpos,
+ // We have a problem with the index if there is an extra "Window" menu
+ // in this menu bar, which is added by wxMDIParentFrame to it directly
+ // using Windows API (so that it remains invisible to the user code),
+ // but which does affect the indices of the items we insert after it.
+ // So we check if any of the menus before the insertion position is a
+ // foreign one and adjust the insertion index accordingly.
+ int mswExtra = 0;
+
+ // Skip all this if the total number of menus matches (notice that the
+ // internal menu count has already been incremented by wxMenuBarBase::
+ // Insert() call above, hence -1).
+ int mswCount = ::GetMenuItemCount(GetHmenu());
+ if ( mswCount != -1 &&
+ static_cast<unsigned>(mswCount) != GetMenuCount() - 1 )
+ {
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
+ for ( size_t n = 0; n < pos; n++ )
+ {
+ if ( ::GetSubMenu(GetHmenu(), n) != GetHmenuOf(node->GetData()) )
+ mswExtra++;
+ else
+ node = node->GetNext();
+ }
+ }
+
+ if ( !::InsertMenu(GetHmenu(), pos + mswExtra,
MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT_PTR)GetHmenuOf(menu), title.t_str()) )
{
diff --git a/Externals/wxWidgets3/src/msw/msgdlg.cpp b/Externals/wxWidgets3/src/msw/msgdlg.cpp
index e44ca16..02da8a9 100644
--- a/Externals/wxWidgets3/src/msw/msgdlg.cpp
+++ b/Externals/wxWidgets3/src/msw/msgdlg.cpp
@@ -586,9 +586,7 @@ int wxMessageDialog::ShowMessageBox()
// do show the dialog
int msAns = MessageBox(hWnd, message.t_str(), m_caption.t_str(), msStyle);
- int ret = MSWTranslateReturnCode(msAns);
- SetReturnCode(ret);
- return ret;
+ return MSWTranslateReturnCode(msAns);
}
int wxMessageDialog::ShowModal()
@@ -623,9 +621,7 @@ int wxMessageDialog::ShowModal()
msAns = IDOK;
}
- int ret = MSWTranslateReturnCode(msAns);
- SetReturnCode(ret);
- return ret;
+ return MSWTranslateReturnCode( msAns );
}
#endif // wxHAS_MSW_TASKDIALOG
diff --git a/Externals/wxWidgets3/src/msw/ole/automtn.cpp b/Externals/wxWidgets3/src/msw/ole/automtn.cpp
index b3f5f72..1c3bd0a 100644
--- a/Externals/wxWidgets3/src/msw/ole/automtn.cpp
+++ b/Externals/wxWidgets3/src/msw/ole/automtn.cpp
@@ -70,6 +70,7 @@ wxAutomationObject::wxAutomationObject(WXIDISPATCH* dispatchPtr)
{
m_dispatchPtr = dispatchPtr;
m_lcid = LOCALE_SYSTEM_DEFAULT;
+ m_convertVariantFlags = wxOleConvertVariant_Default;
}
wxAutomationObject::~wxAutomationObject()
@@ -214,7 +215,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action,
if (vReturnPtr)
{
// Convert result to wxVariant form
- if (!wxConvertOleToVariant(vReturn, retValue))
+ if (!wxConvertOleToVariant(vReturn, retValue, m_convertVariantFlags))
return false;
// Mustn't release the dispatch pointer
if (vReturn.vt == VT_DISPATCH)
@@ -474,6 +475,7 @@ bool wxAutomationObject::GetObject(wxAutomationObject& obj, const wxString& prop
{
obj.SetDispatchPtr(dispatch);
obj.SetLCID(GetLCID());
+ obj.SetConvertVariantFlags(GetConvertVariantFlags());
return true;
}
else
@@ -488,6 +490,7 @@ bool wxAutomationObject::GetObject(wxAutomationObject& obj, const wxString& prop
{
obj.SetDispatchPtr(dispatch);
obj.SetLCID(GetLCID());
+ obj.SetConvertVariantFlags(GetConvertVariantFlags());
return true;
}
else
@@ -607,6 +610,17 @@ void wxAutomationObject::SetLCID(LCID lcid)
m_lcid = lcid;
}
+long wxAutomationObject::GetConvertVariantFlags() const
+{
+ return m_convertVariantFlags;
+}
+
+void wxAutomationObject::SetConvertVariantFlags(long flags)
+{
+ m_convertVariantFlags = flags;
+}
+
+
static void
ShowException(const wxString& member,
HRESULT hr,
diff --git a/Externals/wxWidgets3/src/msw/ole/dataobj.cpp b/Externals/wxWidgets3/src/msw/ole/dataobj.cpp
index 510aa9d..2055a0a 100644
--- a/Externals/wxWidgets3/src/msw/ole/dataobj.cpp
+++ b/Externals/wxWidgets3/src/msw/ole/dataobj.cpp
@@ -77,12 +77,19 @@ wxDataFormat HtmlFormatFixup(wxDataFormat format)
// format does not match the native constant in the way other formats do,
// so for the format checks below to work, we must change the native
// id to the wxDF_HTML constant.
- wxChar s_szBuf[256];
- if (::GetClipboardFormatName(format, s_szBuf, WXSIZEOF(s_szBuf)))
+ //
+ // But skip this for the standard constants which are never going to match
+ // wxDF_HTML anyhow.
+ if ( !format.IsStandard() )
{
- if (s_szBuf == wxString("HTML Format"))
- format = wxDF_HTML;
+ wxChar szBuf[256];
+ if ( ::GetClipboardFormatName(format, szBuf, WXSIZEOF(szBuf)) )
+ {
+ if ( wxStrcmp(szBuf, wxT("HTML Format")) == 0 )
+ format = wxDF_HTML;
+ }
}
+
return format;
}
@@ -342,6 +349,26 @@ wxIDataObject::SaveSystemData(FORMATETC *pformatetc,
// wxDataFormat
// ----------------------------------------------------------------------------
+bool wxDataFormat::operator==(wxDataFormatId format) const
+{
+ return HtmlFormatFixup(*this).m_format == (NativeFormat)format;
+}
+
+bool wxDataFormat::operator!=(wxDataFormatId format) const
+{
+ return !(*this == format);
+}
+
+bool wxDataFormat::operator==(const wxDataFormat& format) const
+{
+ return HtmlFormatFixup(*this).m_format == HtmlFormatFixup(format).m_format;
+}
+
+bool wxDataFormat::operator!=(const wxDataFormat& format) const
+{
+ return !(*this == format);
+}
+
void wxDataFormat::SetId(const wxString& format)
{
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.t_str());
diff --git a/Externals/wxWidgets3/src/msw/ole/oleutils.cpp b/Externals/wxWidgets3/src/msw/ole/oleutils.cpp
index 57a7a6c..ab4122e 100644
--- a/Externals/wxWidgets3/src/msw/ole/oleutils.cpp
+++ b/Externals/wxWidgets3/src/msw/ole/oleutils.cpp
@@ -414,57 +414,53 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole
#endif
WXDLLEXPORT bool
-wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
+wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant, long flags)
{
bool ok = true;
if ( oleVariant.vt & VT_ARRAY )
{
- // TODO: We currently return arrays as wxVariant of the list type
- // containing the flattened form of array but we should allow
- // getting it as wxVariantDataSafeArray instead. Doing this is
- // simple, we'd just need to do something like this:
- //
- // if ( oleVariant.parray && SafeArrayGetDim(oleVariant.parray) > 1 )
- // {
- // variant.SetData(new wxVariantDataSafeArray(oleVariant.parray));
- // }
- //
- // but currently we don't do it for compatibility reasons.
- switch (oleVariant.vt & VT_TYPEMASK)
+ if ( flags & wxOleConvertVariant_ReturnSafeArrays )
{
- case VT_I2:
- ok = wxSafeArray<VT_I2>::ConvertToVariant(oleVariant.parray, variant);
- break;
- case VT_I4:
- ok = wxSafeArray<VT_I4>::ConvertToVariant(oleVariant.parray, variant);
- break;
- case VT_R4:
- ok = wxSafeArray<VT_R4>::ConvertToVariant(oleVariant.parray, variant);
- break;
- case VT_R8:
- ok = wxSafeArray<VT_R8>::ConvertToVariant(oleVariant.parray, variant);
- break;
- case VT_VARIANT:
- ok = wxSafeArray<VT_VARIANT>::ConvertToVariant(oleVariant.parray, variant);
- break;
- case VT_BSTR:
- {
- wxArrayString strings;
- if ( wxSafeArray<VT_BSTR>::ConvertToArrayString(oleVariant.parray, strings) )
- variant = strings;
- else
- ok = false;
- }
- break;
- default:
- ok = false;
- break;
+ variant.SetData(new wxVariantDataSafeArray(oleVariant.parray));
}
- if ( !ok )
+ else
{
- wxLogDebug(wxT("unhandled VT_ARRAY type %x in wxConvertOleToVariant"),
- oleVariant.vt & VT_TYPEMASK);
- variant = wxVariant();
+ switch (oleVariant.vt & VT_TYPEMASK)
+ {
+ case VT_I2:
+ ok = wxSafeArray<VT_I2>::ConvertToVariant(oleVariant.parray, variant);
+ break;
+ case VT_I4:
+ ok = wxSafeArray<VT_I4>::ConvertToVariant(oleVariant.parray, variant);
+ break;
+ case VT_R4:
+ ok = wxSafeArray<VT_R4>::ConvertToVariant(oleVariant.parray, variant);
+ break;
+ case VT_R8:
+ ok = wxSafeArray<VT_R8>::ConvertToVariant(oleVariant.parray, variant);
+ break;
+ case VT_VARIANT:
+ ok = wxSafeArray<VT_VARIANT>::ConvertToVariant(oleVariant.parray, variant);
+ break;
+ case VT_BSTR:
+ {
+ wxArrayString strings;
+ if ( wxSafeArray<VT_BSTR>::ConvertToArrayString(oleVariant.parray, strings) )
+ variant = strings;
+ else
+ ok = false;
+ }
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ if ( !ok )
+ {
+ wxLogDebug(wxT("unhandled VT_ARRAY type %x in wxConvertOleToVariant"),
+ oleVariant.vt & VT_TYPEMASK);
+ variant = wxVariant();
+ }
}
}
else if ( oleVariant.vt & VT_BYREF )
diff --git a/Externals/wxWidgets3/src/msw/region.cpp b/Externals/wxWidgets3/src/msw/region.cpp
index d8523a0..846fff1 100644
--- a/Externals/wxWidgets3/src/msw/region.cpp
+++ b/Externals/wxWidgets3/src/msw/region.cpp
@@ -164,8 +164,7 @@ void wxRegion::Clear()
bool wxRegion::DoOffset(wxCoord x, wxCoord y)
{
- const HRGN hrgn = GetHrgn();
- wxCHECK_MSG( hrgn, false, wxT("invalid wxRegion") );
+ wxCHECK_MSG( GetHrgn(), false, wxT("invalid wxRegion") );
if ( !x && !y )
{
@@ -175,7 +174,7 @@ bool wxRegion::DoOffset(wxCoord x, wxCoord y)
AllocExclusive();
- if ( ::OffsetRgn(hrgn, x, y) == ERROR )
+ if ( ::OffsetRgn(GetHrgn(), x, y) == ERROR )
{
wxLogLastError(wxT("OffsetRgn"));
diff --git a/Externals/wxWidgets3/src/msw/sockmsw.cpp b/Externals/wxWidgets3/src/msw/sockmsw.cpp
index 7bad1d4..58557e4 100644
--- a/Externals/wxWidgets3/src/msw/sockmsw.cpp
+++ b/Externals/wxWidgets3/src/msw/sockmsw.cpp
@@ -191,7 +191,7 @@ wxDynamicLibrary wxSocketMSWManager::gs_wsock32dll;
bool wxSocketMSWManager::OnInit()
{
- static LPCTSTR pclassname = NULL;
+ LPCTSTR pclassname = NULL;
int i;
/* Create internal window for event notifications */
diff --git a/Externals/wxWidgets3/src/msw/stattext.cpp b/Externals/wxWidgets3/src/msw/stattext.cpp
index de04f20..1eb8b24 100644
--- a/Externals/wxWidgets3/src/msw/stattext.cpp
+++ b/Externals/wxWidgets3/src/msw/stattext.cpp
@@ -110,24 +110,20 @@ wxSize wxStaticText::DoGetBestClientSize() const
widthTextMax += 2;
#endif // __WXWINCE__
- // It looks like the static control needs "slightly" more vertical space
- // than the character height and while the text isn't actually truncated if
- // we use just the minimal height, it is positioned differently than when
- // the control has enough space and this result in the text in edit and
- // static controls not being aligned when the controls themselves are. As
- // this is something you really should be able to count on, increase the
- // space allocated for the control so that the base lines do align
- // correctly. Notice that while the above is true at least for the single
- // line controls, there doesn't seem to do any harm to allocate two extra
- // pixels in multi-line case neither so do it always for consistency.
+ // This extra pixel is a hack we use to ensure that a wxStaticText
+ // vertically centered around the same position as a wxTextCtrl shows its
+ // text on exactly the same baseline. It is not clear why is this needed
+ // nor even whether this works in all cases, but it does work, at least
+ // with the default fonts, under Windows XP, 7 and 8, so just use it for
+ // now.
//
- // I still have no idea why exactly is this needed nor why should we use 2
- // and not something else. This seems to work in all the configurations
- // though (small/large fonts, different OS versions, ...) so just hard code
- // it for now. If we need something better later it might be worth looking
- // at the height of the text control returned by ::GetComboBoxInfo() as it
- // seems to be the "minimal acceptable" height.
- heightTextTotal += 2;
+ // In the future we really ought to provide a way for each of the controls
+ // to provide information about the position of the baseline for the text
+ // it shows and use this information in the sizer code when centering the
+ // controls vertically, otherwise we simply can't ensure that the text is
+ // always on the same line, e.g. even with this hack wxComboBox text is
+ // still not aligned to the same position.
+ heightTextTotal += 1;
return wxSize(widthTextMax, heightTextTotal);
}
diff --git a/Externals/wxWidgets3/src/msw/textentry.cpp b/Externals/wxWidgets3/src/msw/textentry.cpp
index 3577581..d8a411e 100644
--- a/Externals/wxWidgets3/src/msw/textentry.cpp
+++ b/Externals/wxWidgets3/src/msw/textentry.cpp
@@ -916,7 +916,7 @@ void wxTextEntry::SetMaxLength(unsigned long len)
bool wxTextEntry::SetHint(const wxString& hint)
{
- if ( wxUxThemeEngine::GetIfActive() )
+ if ( wxGetWinVersion() >= wxWinVersion_Vista && wxUxThemeEngine::GetIfActive() )
{
// notice that this message always works with Unicode strings
//
diff --git a/Externals/wxWidgets3/src/msw/timectrl.cpp b/Externals/wxWidgets3/src/msw/timectrl.cpp
index e87e1e0..1a39cb4c 100644
--- a/Externals/wxWidgets3/src/msw/timectrl.cpp
+++ b/Externals/wxWidgets3/src/msw/timectrl.cpp
@@ -45,11 +45,15 @@ WXDWORD wxTimePickerCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
return styleMSW;
}
+#if wxUSE_INTL
+
wxLocaleInfo wxTimePickerCtrl::MSWGetFormat() const
{
return wxLOCALE_TIME_FMT;
}
+#endif // wxUSE_INTL
+
bool wxTimePickerCtrl::MSWOnDateTimeChange(const NMDATETIMECHANGE& dtch)
{
m_date.SetFromMSWSysTime(dtch.st);
diff --git a/Externals/wxWidgets3/src/msw/treectrl.cpp b/Externals/wxWidgets3/src/msw/treectrl.cpp
index 5421159..8f664ff 100644
--- a/Externals/wxWidgets3/src/msw/treectrl.cpp
+++ b/Externals/wxWidgets3/src/msw/treectrl.cpp
@@ -1598,6 +1598,18 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent,
return DoInsertAfter(parent, idPrev, text, image, selectedImage, data);
}
+bool wxTreeCtrl::MSWDeleteItem(const wxTreeItemId& item)
+{
+ TempSetter set(m_changingSelection);
+ if ( !TreeView_DeleteItem(GetHwnd(), HITEM(item)) )
+ {
+ wxLogLastError(wxT("TreeView_DeleteItem"));
+ return false;
+ }
+
+ return true;
+}
+
void wxTreeCtrl::Delete(const wxTreeItemId& item)
{
// unlock tree selections on vista, without this the
@@ -1619,14 +1631,8 @@ void wxTreeCtrl::Delete(const wxTreeItemId& item)
}
}
- {
- TempSetter set(m_changingSelection);
- if ( !TreeView_DeleteItem(GetHwnd(), HITEM(item)) )
- {
- wxLogLastError(wxT("TreeView_DeleteItem"));
- return;
- }
- }
+ if ( !MSWDeleteItem(item) )
+ return;
if ( !selected )
{
@@ -1657,10 +1663,7 @@ void wxTreeCtrl::Delete(const wxTreeItemId& item)
}
else
{
- if ( !TreeView_DeleteItem(GetHwnd(), HITEM(item)) )
- {
- wxLogLastError(wxT("TreeView_DeleteItem"));
- }
+ MSWDeleteItem(item);
}
}
diff --git a/Externals/wxWidgets3/src/msw/utils.cpp b/Externals/wxWidgets3/src/msw/utils.cpp
index 0610186..59adbbe 100644
--- a/Externals/wxWidgets3/src/msw/utils.cpp
+++ b/Externals/wxWidgets3/src/msw/utils.cpp
@@ -1301,6 +1301,18 @@ wxString wxGetOsDescription()
? _("Windows Server 2008 R2")
: _("Windows 7");
break;
+
+ case 2:
+ str = wxIsWindowsServer() == 1
+ ? _("Windows Server 2012")
+ : _("Windows 8");
+ break;
+
+ case 3:
+ str = wxIsWindowsServer() == 1
+ ? _("Windows Server 2012 R2")
+ : _("Windows 8.1");
+ break;
}
break;
}
diff --git a/Externals/wxWidgets3/src/msw/utilsexc.cpp b/Externals/wxWidgets3/src/msw/utilsexc.cpp
index 5eb38a2..82c7649 100644
--- a/Externals/wxWidgets3/src/msw/utilsexc.cpp
+++ b/Externals/wxWidgets3/src/msw/utilsexc.cpp
@@ -51,7 +51,6 @@
#endif
#if defined(__GNUWIN32__)
- #include <sys/unistd.h>
#include <sys/stat.h>
#endif
diff --git a/Externals/wxWidgets3/src/msw/window.cpp b/Externals/wxWidgets3/src/msw/window.cpp
index a08d1fa..225e13d 100644
--- a/Externals/wxWidgets3/src/msw/window.cpp
+++ b/Externals/wxWidgets3/src/msw/window.cpp
@@ -365,30 +365,21 @@ END_EVENT_TABLE()
// ---------------------------------------------------------------------------
// Find an item given the MS Windows id
-wxWindow *wxWindowMSW::FindItem(long id) const
+wxWindow *wxWindowMSW::FindItem(long id, WXHWND hWnd) const
{
-#if wxUSE_CONTROLS
- wxControl *item = wxDynamicCastThis(wxControl);
- if ( item )
- {
- // is it us or one of our "internal" children?
- if ( item->GetId() == id
-#ifndef __WXUNIVERSAL__
- || (item->GetSubcontrols().Index(id) != wxNOT_FOUND)
-#endif // __WXUNIVERSAL__
- )
- {
- return item;
- }
- }
-#endif // wxUSE_CONTROLS
+ // First check for the control itself and its Windows-level children which
+ // are mapped to the same wxWindow at wx level.
+ wxWindow *wnd = MSWFindItem(id, hWnd);
+ if ( wnd )
+ return wnd;
+ // Then check wx level children.
wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
while (current)
{
wxWindow *childWin = current->GetData();
- wxWindow *wnd = childWin->FindItem(id);
+ wnd = childWin->FindItem(id, hWnd);
if ( wnd )
return wnd;
@@ -675,7 +666,8 @@ wxWindowMSW::MSWShowWithEffect(bool show,
unsigned timeout)
{
#if wxUSE_DYNLIB_CLASS
- if ( effect == wxSHOW_EFFECT_NONE )
+ if ( effect == wxSHOW_EFFECT_NONE ||
+ (GetParent() && !GetParent()->IsShownOnScreen()) )
return Show(show);
if ( !wxWindowBase::Show(show) )
@@ -2303,12 +2295,14 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
{
// wxUniversal implements tab traversal itself
#ifndef __WXUNIVERSAL__
- // Notice that we check for WS_EX_CONTROLPARENT and not wxTAB_TRAVERSAL
- // here. While usually they are both set or both unset, doing it like this
- // also works if there is ever a bug that results in wxTAB_TRAVERSAL being
- // set but not WS_EX_CONTROLPARENT as we must not call IsDialogMessage() in
- // this case, it would simply hang (see #15458).
- if ( m_hWnd != 0 && (wxGetWindowExStyle(this) & WS_EX_CONTROLPARENT) )
+ // Notice that we check for both wxTAB_TRAVERSAL and WS_EX_CONTROLPARENT
+ // being set here. While normally the latter should always be set if the
+ // former is, doing it like this also works if there is ever a bug that
+ // results in wxTAB_TRAVERSAL being set but not WS_EX_CONTROLPARENT as we
+ // must not call IsDialogMessage() then, it would simply hang (see #15458).
+ if ( m_hWnd &&
+ HasFlag(wxTAB_TRAVERSAL) &&
+ (wxGetWindowExStyle(this) & WS_EX_CONTROLPARENT) )
{
// intercept dialog navigation keys
MSG *msg = (MSG *)pMsg;
@@ -4049,7 +4043,10 @@ bool wxWindowMSW::HandleActivate(int state,
{
wxActivateEvent event(wxEVT_ACTIVATE,
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
- m_windowId);
+ m_windowId,
+ state == WA_CLICKACTIVE
+ ? wxActivateEvent::Reason_Mouse
+ : wxActivateEvent::Reason_Unknown);
event.SetEventObject(this);
return HandleWindowEvent(event);
@@ -5318,7 +5315,7 @@ bool wxWindowMSW::HandleCommand(WXWORD id_, WXWORD cmd, WXHWND control)
// try the id
if ( !win )
{
- win = FindItem(id);
+ win = FindItem(id, control);
}
if ( win )
diff --git a/Externals/wxWidgets3/src/osx/bmpbuttn_osx.cpp b/Externals/wxWidgets3/src/osx/bmpbuttn_osx.cpp
index 581ddd0..fcc4b9c 100644
--- a/Externals/wxWidgets3/src/osx/bmpbuttn_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/bmpbuttn_osx.cpp
@@ -66,7 +66,7 @@ wxSize wxBitmapButton::DoGetBestSize() const
if ( GetBitmapLabel().IsOk() )
{
- best += GetBitmapLabel().GetSize();
+ best += GetBitmapLabel().GetScaledSize();
}
return best;
diff --git a/Externals/wxWidgets3/src/osx/carbon/app.cpp b/Externals/wxWidgets3/src/osx/carbon/app.cpp
index 30e3ba4..1a3d426 100644
--- a/Externals/wxWidgets3/src/osx/carbon/app.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/app.cpp
@@ -229,6 +229,8 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
wxString fName ;
FSRef theRef ;
+
+ wxArrayString fileNames;
for (i = 1; i <= itemsInList; i++)
{
@@ -240,9 +242,10 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply)
return err;
fName = wxMacFSRefToPath( &theRef ) ;
-
- MacPrintFile(fName);
+ fileNames.Add( fName );
}
+
+ MacPrintFiles(fileNames);
return noErr;
}
@@ -307,6 +310,16 @@ void wxApp::MacOpenURL(const wxString & WXUNUSED(url) )
{
}
+void wxApp::MacPrintFiles(const wxArrayString & fileNames )
+{
+ size_t i;
+ const size_t fileCount = fileNames.GetCount();
+ for (i = 0; i < fileCount; i++)
+ {
+ MacPrintFile(fileNames[i]);
+ }
+}
+
void wxApp::MacPrintFile(const wxString & fileName )
{
#if wxUSE_DOC_VIEW_ARCHITECTURE
@@ -403,7 +416,6 @@ void wxApp::MacReopenApp()
#if wxOSX_USE_COCOA_OR_IPHONE
void wxApp::OSXOnWillFinishLaunching()
{
- m_onInitResult = OnInit();
}
void wxApp::OSXOnDidFinishLaunching()
diff --git a/Externals/wxWidgets3/src/osx/carbon/dataview.cpp b/Externals/wxWidgets3/src/osx/carbon/dataview.cpp
index 72edcc6..66781a9 100644
--- a/Externals/wxWidgets3/src/osx/carbon/dataview.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/dataview.cpp
@@ -155,9 +155,7 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
(columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) ||
(columnDescription.propertyDesc.propertyType == kDataBrowserTextType))
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton;
-#endif
// set header's properties:
columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
columnDescription.headerBtnDesc.titleOffset = 0;
diff --git a/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp b/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp
index 81761d3..e738a13 100644
--- a/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/dcscreen.cpp
@@ -91,7 +91,7 @@ wxBitmap wxScreenDCImpl::DoGetAsBitmap(const wxRect *subrect) const
CGImageRef image = NULL;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- if ( UMAGetSystemVersion() >= 10.6)
+ if ( UMAGetSystemVersion() >= 0x1060)
{
image = CGDisplayCreateImage(kCGDirectMainDisplay);
}
diff --git a/Externals/wxWidgets3/src/osx/carbon/font.cpp b/Externals/wxWidgets3/src/osx/carbon/font.cpp
index ce2de44..c3ad61e 100644
--- a/Externals/wxWidgets3/src/osx/carbon/font.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/font.cpp
@@ -50,11 +50,9 @@ public:
wxFontRefData(wxOSXSystemFont font, int size);
-#if wxOSX_USE_CORE_TEXT
wxFontRefData( wxUint32 coreTextFontType );
wxFontRefData( CTFontRef font );
wxFontRefData( CTFontDescriptorRef fontdescriptor, int size );
-#endif
virtual ~wxFontRefData();
@@ -146,9 +144,6 @@ public:
protected:
// common part of all ctors
void Init();
-#if wxOSX_USE_CORE_TEXT
- // void Init( CTFontRef font );
-#endif
public:
bool m_fontValid;
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
@@ -156,9 +151,7 @@ public:
// information here, as this speeds up and optimizes rendering
ThemeFontID m_macThemeFontID ;
#endif
-#if wxOSX_USE_CORE_TEXT
wxCFRef<CTFontRef> m_ctFont;
-#endif
#if wxOSX_USE_ATSU_TEXT
void CreateATSUFont();
@@ -184,9 +177,7 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData()
#if wxOSX_USE_CARBON && wxOSX_USE_ATSU_TEXT
m_macThemeFontID = data.m_macThemeFontID;
#endif
-#if wxOSX_USE_CORE_TEXT
m_ctFont = data.m_ctFont;
-#endif
m_cgFont = data.m_cgFont;
#if wxOSX_USE_ATSU_TEXT
if ( data.m_macATSUStyle != NULL )
@@ -236,9 +227,7 @@ wxFontRefData::~wxFontRefData()
void wxFontRefData::Free()
{
-#if wxOSX_USE_CORE_TEXT
m_ctFont.reset();
-#endif
m_cgFont.reset();
#if wxOSX_USE_ATSU_TEXT
#if wxOSX_USE_CARBON
@@ -272,7 +261,6 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
wxASSERT( font != wxOSX_SYSTEM_FONT_NONE );
Init();
-#if wxOSX_USE_CORE_TEXT
{
CTFontUIFontType uifont = kCTFontSystemFontType;
switch( font )
@@ -309,7 +297,6 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
descr.reset( CTFontCopyFontDescriptor( m_ctFont ) );
m_info.Init(descr);
}
-#endif
#if wxOSX_USE_ATSU_TEXT
{
#if !wxOSX_USE_CARBON
@@ -464,7 +451,6 @@ void wxFontRefData::MacFindFont()
m_info.EnsureValid();
-#if wxOSX_USE_CORE_TEXT
{
CTFontSymbolicTraits traits = 0;
@@ -527,8 +513,6 @@ void wxFontRefData::MacFindFont()
m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
}
-
-#endif
#if wxOSX_USE_ATSU_TEXT
CreateATSUFont();
#endif
@@ -543,12 +527,8 @@ void wxFontRefData::MacFindFont()
bool wxFontRefData::IsFixedWidth() const
{
-#if wxOSX_USE_CORE_TEXT
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(m_ctFont);
return (traits & kCTFontMonoSpaceTrait) != 0;
-#else
- return false;
-#endif
}
// ----------------------------------------------------------------------------
@@ -852,8 +832,6 @@ wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
}
#endif
-#if wxOSX_USE_CORE_TEXT
-
CTFontRef wxFont::OSXGetCTFont() const
{
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
@@ -864,8 +842,6 @@ CTFontRef wxFont::OSXGetCTFont() const
return (CTFontRef)(M_FONTDATA->m_ctFont);
}
-#endif
-
#if wxOSX_USE_COCOA_OR_CARBON
CGFontRef wxFont::OSXGetCGFont() const
@@ -1005,7 +981,6 @@ void wxNativeFontInfo::Init()
m_descriptorValid = false;
}
-#if wxOSX_USE_CORE_TEXT
void wxNativeFontInfo::Init(CTFontDescriptorRef descr)
{
Init();
@@ -1028,7 +1003,6 @@ void wxNativeFontInfo::Init(CTFontDescriptorRef descr)
wxCFStringRef familyName( (CFStringRef) CTFontDescriptorCopyAttribute(descr, kCTFontFamilyNameAttribute));
m_faceName = familyName.AsString();
}
-#endif
void wxNativeFontInfo::EnsureValid()
{
diff --git a/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp b/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp
index 57c8ab4..b2a4013 100644
--- a/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/fontdlg.cpp
@@ -76,7 +76,6 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
case kEventFontSelection :
{
bool setup = false ;
-#if wxOSX_USE_CORE_TEXT
if ( !setup )
{
CTFontDescriptorRef descr;
@@ -90,7 +89,6 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
setup = true;
}
}
-#endif
#if wxOSX_USE_ATSU_TEXT
ATSUFontID fontId = 0 ;
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
@@ -240,24 +238,10 @@ int wxFontDialog::ShowModal()
font = m_fontData.m_initialFont ;
}
- bool setup = false;
-#if wxOSX_USE_CORE_TEXT
- if ( !setup )
- {
- CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() );
- err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL);
- CFRelease( descr );
- setup = true;
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
- if ( !setup )
- {
- ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle();
- err = SetFontInfoForSelection (kFontSelectionATSUIType,1, &style , NULL);
- setup = true;
- }
-#endif
+ CTFontDescriptorRef descr = (CTFontDescriptorRef) CTFontCopyFontDescriptor( (CTFontRef) font.OSXGetCTFont() );
+ err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL);
+ CFRelease( descr );
+
// just clicking on ENTER will not send us any font setting event, therefore we have to make sure
// that field is already correct
m_fontData.m_chosenFont = font ;
diff --git a/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp b/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp
index cf8dd6b..7006d5e 100644
--- a/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/glcanvas.cpp
@@ -262,24 +262,7 @@ bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
const_cast<wxGLCanvas&>(win).SetViewport();
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if ( UMAGetSystemVersion() >= 0x1050 )
- {
- aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef());
- }
- else
-#endif
- {
- AGLDrawable drawable = (AGLDrawable)GetWindowPort(
- MAC_WXHWND(win.MacGetTopLevelWindowRef()));
-
- if ( !aglSetDrawable(m_glContext, drawable) )
- {
- wxLogAGLError("aglSetDrawable");
- return false;
- }
- }
+ aglSetWindowRef(m_glContext, win.MacGetTopLevelWindowRef());
return WXGLSetCurrentContext(m_glContext);
}
@@ -354,17 +337,7 @@ bool wxGLCanvas::Create(wxWindow *parent,
m_bufferName = gCurrentBufferName++;
aglSetInteger (m_dummyContext, AGL_BUFFER_NAME, &m_bufferName);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if ( UMAGetSystemVersion() >= 0x1050 )
- {
- aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef());
- }
- else
-#endif
- {
- AGLDrawable drawable = (AGLDrawable)GetWindowPort(MAC_WXHWND(MacGetTopLevelWindowRef()));
- aglSetDrawable(m_dummyContext, drawable);
- }
+ aglSetWindowRef(m_dummyContext, MacGetTopLevelWindowRef());
m_macCanvasIsShown = true;
diff --git a/Externals/wxWidgets3/src/osx/carbon/graphics.cpp b/Externals/wxWidgets3/src/osx/carbon/graphics.cpp
index ff015c2..0fb0c50 100644
--- a/Externals/wxWidgets3/src/osx/carbon/graphics.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/graphics.cpp
@@ -66,8 +66,6 @@ int UMAGetSystemVersion()
}
-#define wxOSX_USE_CORE_TEXT 1
-
#endif
#if wxOSX_USE_COCOA_OR_IPHONE
@@ -78,10 +76,6 @@ extern void wxOSXUnlockFocus( WXWidget view) ;
#endif
#endif
-#if 1 // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-
-// TODO test whether this private API also works under 10.3
-
// copying values from NSCompositingModes (see also webkit and cairo sources)
typedef enum CGCompositeOperation {
@@ -106,8 +100,6 @@ extern "C"
CG_EXTERN void CGContextSetCompositeOperation (CGContextRef context, int operation);
} ;
-#endif
-
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
@@ -152,8 +144,6 @@ CGColorRef wxMacCreateCGColor( const wxColour& col )
return retval;
}
-#if wxOSX_USE_CORE_TEXT
-
CTFontRef wxMacCreateCTFont( const wxFont& font )
{
#ifdef __WXMAC__
@@ -163,8 +153,6 @@ CTFontRef wxMacCreateCTFont( const wxFont& font )
#endif
}
-#endif
-
// CGPattern wrapper class: always allocate on heap, never call destructor
class wxMacCoreGraphicsPattern
@@ -866,9 +854,7 @@ public:
#if wxOSX_USE_ATSU_TEXT
virtual ATSUStyle GetATSUStyle() { return m_macATSUIStyle; }
#endif
-#if wxOSX_USE_CORE_TEXT
CTFontRef OSXGetCTFont() const { return m_ctFont ; }
-#endif
wxColour GetColour() const { return m_colour ; }
bool GetUnderlined() const { return m_underlined ; }
@@ -881,9 +867,7 @@ private :
#if wxOSX_USE_ATSU_TEXT
ATSUStyle m_macATSUIStyle;
#endif
-#if wxOSX_USE_CORE_TEXT
wxCFRef< CTFontRef > m_ctFont;
-#endif
#if wxOSX_USE_IPHONE
UIFont* m_uiFont;
#endif
@@ -894,9 +878,7 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
m_colour = col;
m_underlined = font.GetUnderlined();
-#if wxOSX_USE_CORE_TEXT
m_ctFont.reset( wxMacCreateCTFont( font ) );
-#endif
#if wxOSX_USE_IPHONE
m_uiFont = CreateUIFont(font);
wxMacCocoaRetain( m_uiFont );
@@ -940,8 +922,6 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
{
-#if wxOSX_USE_CORE_TEXT
-#endif
#if wxOSX_USE_ATSU_TEXT
if ( m_macATSUIStyle )
{
@@ -2309,79 +2289,51 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo
if (m_composition == wxCOMPOSITION_DEST)
return;
-#if wxOSX_USE_CORE_TEXT
- {
- wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
- wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
- CTFontRef font = fref->OSXGetCTFont();
- CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
+ wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
+ wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
+ CTFontRef font = fref->OSXGetCTFont();
+ CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
#if 0
- // right now there's no way to get continuous underlines, only words, so we emulate it
- CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
- wxCFRef<CFNumberRef> underlined( CFNumberCreate(NULL, kCFNumberSInt32Type, &ustyle) );
- CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName, kCTUnderlineStyleAttributeName };
- CFTypeRef values[] = { font, col, underlined };
+ // right now there's no way to get continuous underlines, only words, so we emulate it
+ CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
+ wxCFRef<CFNumberRef> underlined( CFNumberCreate(NULL, kCFNumberSInt32Type, &ustyle) );
+ CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName, kCTUnderlineStyleAttributeName };
+ CFTypeRef values[] = { font, col, underlined };
#else
- CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName };
- CFTypeRef values[] = { font, col };
+ CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName };
+ CFTypeRef values[] = { font, col };
#endif
- wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
- WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
- wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
- wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
+ wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
+ WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
+ wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
+ wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
- y += CTFontGetAscent(font);
-
- CGContextSaveGState(m_cgContext);
- CGAffineTransform textMatrix = CGContextGetTextMatrix(m_cgContext);
-
- CGContextTranslateCTM(m_cgContext, (CGFloat) x, (CGFloat) y);
- CGContextScaleCTM(m_cgContext, 1, -1);
- CGContextSetTextMatrix(m_cgContext, CGAffineTransformIdentity);
-
- CTLineDraw( line, m_cgContext );
-
- if ( fref->GetUnderlined() ) {
- //AKT: draw horizontal line 1 pixel thick and with 1 pixel gap under baseline
- CGFloat width = CTLineGetTypographicBounds(line, NULL, NULL, NULL);
-
- CGPoint points[] = { {0.0, -2.0}, {width, -2.0} };
-
- CGContextSetStrokeColorWithColor(m_cgContext, col);
- CGContextSetShouldAntialias(m_cgContext, false);
- CGContextSetLineWidth(m_cgContext, 1.0);
- CGContextStrokeLineSegments(m_cgContext, points, 2);
- }
-
- CGContextRestoreGState(m_cgContext);
- CGContextSetTextMatrix(m_cgContext, textMatrix);
- CGColorRelease( col );
- CheckInvariants();
- return;
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
- {
- DrawText(str, x, y, 0.0);
- return;
- }
-#endif
-#if wxOSX_USE_IPHONE
- wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
+ y += CTFontGetAscent(font);
CGContextSaveGState(m_cgContext);
+ CGAffineTransform textMatrix = CGContextGetTextMatrix(m_cgContext);
- CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
- CGContextSetTextDrawingMode (m_cgContext, kCGTextFill);
- CGContextSetFillColorWithColor( m_cgContext, col );
+ CGContextTranslateCTM(m_cgContext, (CGFloat) x, (CGFloat) y);
+ CGContextScaleCTM(m_cgContext, 1, -1);
+ CGContextSetTextMatrix(m_cgContext, CGAffineTransformIdentity);
- wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
- DrawTextInContext( m_cgContext, CGPointMake( x, y ), fref->GetUIFont() , text.AsNSString() );
+ CTLineDraw( line, m_cgContext );
+
+ if ( fref->GetUnderlined() ) {
+ //AKT: draw horizontal line 1 pixel thick and with 1 pixel gap under baseline
+ CGFloat width = CTLineGetTypographicBounds(line, NULL, NULL, NULL);
+
+ CGPoint points[] = { {0.0, -2.0}, {width, -2.0} };
+
+ CGContextSetStrokeColorWithColor(m_cgContext, col);
+ CGContextSetShouldAntialias(m_cgContext, false);
+ CGContextSetLineWidth(m_cgContext, 1.0);
+ CGContextStrokeLineSegments(m_cgContext, points, 2);
+ }
CGContextRestoreGState(m_cgContext);
- CFRelease( col );
-#endif
-
+ CGContextSetTextMatrix(m_cgContext, textMatrix);
+ CGColorRelease( col );
CheckInvariants();
}
@@ -2397,103 +2349,9 @@ void wxMacCoreGraphicsContext::DoDrawRotatedText(const wxString &str,
if (m_composition == wxCOMPOSITION_DEST)
return;
-#if wxOSX_USE_CORE_TEXT
- {
- // default implementation takes care of rotation and calls non rotated DrawText afterwards
- wxGraphicsContext::DoDrawRotatedText( str, x, y, angle );
- return;
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
- {
- OSStatus status = noErr;
- ATSUTextLayout atsuLayout;
- wxMacUniCharBuffer unibuf( str );
- UniCharCount chars = unibuf.GetChars();
-
- ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
- status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
- &chars , &style , &atsuLayout );
-
- wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the rotated text") );
-
- status = ::ATSUSetTransientFontMatching( atsuLayout , true );
- wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
-
- int iAngle = int( angle * RAD2DEG );
- if ( abs(iAngle) > 0 )
- {
- Fixed atsuAngle = IntToFixed( iAngle );
- ATSUAttributeTag atsuTags[] =
- {
- kATSULineRotationTag ,
- };
- ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
- {
- sizeof( Fixed ) ,
- };
- ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
- {
- &atsuAngle ,
- };
- status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
- atsuTags, atsuSizes, atsuValues );
- }
-
- {
- ATSUAttributeTag atsuTags[] =
- {
- kATSUCGContextTag ,
- };
- ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
- {
- sizeof( CGContextRef ) ,
- };
- ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
- {
- &m_cgContext ,
- };
- status = ::ATSUSetLayoutControls(atsuLayout , WXSIZEOF(atsuTags),
- atsuTags, atsuSizes, atsuValues );
- }
-
- ATSUTextMeasurement textBefore, textAfter;
- ATSUTextMeasurement ascent, descent;
-
- status = ::ATSUGetUnjustifiedBounds( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
- &textBefore , &textAfter, &ascent , &descent );
-
- wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
-
- Rect rect;
- x += (int)(sin(angle) * FixedToFloat(ascent));
- y += (int)(cos(angle) * FixedToFloat(ascent));
-
- status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
- IntToFixed(x) , IntToFixed(y) , &rect );
- wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
-
- CGContextSaveGState(m_cgContext);
- CGContextTranslateCTM(m_cgContext, (CGFloat) x, (CGFloat) y);
- CGContextScaleCTM(m_cgContext, 1, -1);
- status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
- IntToFixed(0) , IntToFixed(0) );
-
- wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
-
- CGContextRestoreGState(m_cgContext);
-
- ::ATSUDisposeTextLayout(atsuLayout);
- CheckInvariants();
-
- return;
- }
-#endif
-#if wxOSX_USE_IPHONE
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DoDrawRotatedText( str, x, y, angle );
-#endif
-
+
CheckInvariants();
}
@@ -2518,100 +2376,33 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
if (str.empty())
strToMeasure = wxS(" ");
-#if wxOSX_USE_CORE_TEXT
- {
- wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
- CTFontRef font = fref->OSXGetCTFont();
-
- wxCFStringRef text(strToMeasure, wxLocale::GetSystemEncoding() );
- CFStringRef keys[] = { kCTFontAttributeName };
- CFTypeRef values[] = { font };
- wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
- WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
- wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
- wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
-
- CGFloat a, d, l, w;
- w = CTLineGetTypographicBounds(line, &a, &d, &l);
-
- if ( !str.empty() )
- {
- if ( width )
- *width = w;
- if ( height )
- *height = a+d+l;
- }
-
- if ( descent )
- *descent = d;
- if ( externalLeading )
- *externalLeading = l;
- return;
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
- {
- OSStatus status = noErr;
-
- ATSUTextLayout atsuLayout;
- wxMacUniCharBuffer unibuf( strToMeasure );
- UniCharCount chars = unibuf.GetChars();
-
- ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
- status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
- &chars , &style , &atsuLayout );
-
- wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") );
-
- status = ::ATSUSetTransientFontMatching( atsuLayout , true );
- wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
-
- ATSUTextMeasurement textBefore, textAfter;
- ATSUTextMeasurement textAscent, textDescent;
-
- status = ::ATSUGetUnjustifiedBounds( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
- &textBefore , &textAfter, &textAscent , &textDescent );
-
- if ( !str.empty() )
- {
- if ( width )
- *width = FixedToFloat(textAfter - textBefore);
- if ( height )
- *height = FixedToFloat(textAscent + textDescent);
- }
-
- if ( descent )
- *descent = FixedToFloat(textDescent);
- if ( externalLeading )
- *externalLeading = 0;
-
- ::ATSUDisposeTextLayout(atsuLayout);
-
- return;
- }
-#endif
-#if wxOSX_USE_IPHONE
wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
+ CTFontRef font = fref->OSXGetCTFont();
wxCFStringRef text(strToMeasure, wxLocale::GetSystemEncoding() );
- CGSize sz = MeasureTextInContext( fref->GetUIFont() , text.AsNSString() );
+ CFStringRef keys[] = { kCTFontAttributeName };
+ CFTypeRef values[] = { font };
+ wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
+ WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
+ wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
+ wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
+
+ CGFloat a, d, l, w;
+ w = CTLineGetTypographicBounds(line, &a, &d, &l);
if ( !str.empty() )
{
if ( width )
- *width = sz.width;
+ *width = w;
if ( height )
- *height = sz.height;
+ *height = a+d+l;
}
- /*
if ( descent )
- *descent = FixedToFloat(textDescent);
+ *descent = d;
if ( externalLeading )
- *externalLeading = 0;
- */
-#endif
-
+ *externalLeading = l;
+
CheckInvariants();
}
@@ -2625,93 +2416,23 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
if (text.empty())
return;
-#if wxOSX_USE_CORE_TEXT
- {
- wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
- CTFontRef font = fref->OSXGetCTFont();
-
- wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
- CFStringRef keys[] = { kCTFontAttributeName };
- CFTypeRef values[] = { font };
- wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
- WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
- wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, t, attributes) );
- wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
+ wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
+ CTFontRef font = fref->OSXGetCTFont();
- int chars = text.length();
- for ( int pos = 0; pos < (int)chars; pos ++ )
- {
- widths[pos] = CTLineGetOffsetForStringIndex( line, pos+1 , NULL );
- }
+ wxCFStringRef t(text, wxLocale::GetSystemEncoding() );
+ CFStringRef keys[] = { kCTFontAttributeName };
+ CFTypeRef values[] = { font };
+ wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
+ WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
+ wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, t, attributes) );
+ wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
- return;
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
+ int chars = text.length();
+ for ( int pos = 0; pos < (int)chars; pos ++ )
{
- OSStatus status = noErr;
- ATSUTextLayout atsuLayout;
- wxMacUniCharBuffer unibuf( text );
- UniCharCount chars = unibuf.GetChars();
-
- ATSUStyle style = (((wxMacCoreGraphicsFontData*)m_font.GetRefData())->GetATSUStyle());
- status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
- &chars , &style , &atsuLayout );
-
- wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") );
-
- status = ::ATSUSetTransientFontMatching( atsuLayout , true );
- wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
-
-// new implementation from JS, keep old one just in case
-#if 0
- for ( int pos = 0; pos < (int)chars; pos ++ )
- {
- unsigned long actualNumberOfBounds = 0;
- ATSTrapezoid glyphBounds;
-
- // We get a single bound, since the text should only require one. If it requires more, there is an issue
- OSStatus result;
- result = ATSUGetGlyphBounds( atsuLayout, 0, 0, kATSUFromTextBeginning, pos + 1,
- kATSUseDeviceOrigins, 1, &glyphBounds, &actualNumberOfBounds );
- if (result != noErr || actualNumberOfBounds != 1 )
- return;
-
- widths[pos] = FixedToFloat( glyphBounds.upperRight.x - glyphBounds.upperLeft.x );
- //unsigned char uch = s[i];
- }
-#else
- ATSLayoutRecord *layoutRecords = NULL;
- ItemCount glyphCount = 0;
-
- // Get the glyph extents
- OSStatus err = ::ATSUDirectGetLayoutDataArrayPtrFromTextLayout(atsuLayout,
- 0,
- kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void **)
- &layoutRecords,
- &glyphCount);
- wxASSERT(glyphCount == (text.length()+1));
-
- if ( err == noErr && glyphCount == (text.length()+1))
- {
- for ( int pos = 1; pos < (int)glyphCount ; pos ++ )
- {
- widths[pos-1] = FixedToFloat( layoutRecords[pos].realPos );
- }
- }
-
- ::ATSUDirectReleaseLayoutDataArrayPtr(NULL,
- kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void **) &layoutRecords);
-#endif
- ::ATSUDisposeTextLayout(atsuLayout);
+ widths[pos] = CTLineGetOffsetForStringIndex( line, pos+1 , NULL );
}
-#endif
-#if wxOSX_USE_IPHONE
- // TODO core graphics text implementation here
-#endif
-
+
CheckInvariants();
}
diff --git a/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp b/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp
index c9084e0..d87a96e 100644
--- a/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/listctrl_mac.cpp
@@ -2853,35 +2853,14 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
HIThemeTextInfo info;
- bool setup = false;
-#if wxOSX_USE_CORE_TEXT
- if ( UMAGetSystemVersion() >= 0x1050 )
- {
- info.version = kHIThemeTextInfoVersionOne;
- info.fontID = kThemeViewsFont;
- if (font.IsOk())
- {
- info.fontID = kThemeSpecifiedFont;
- info.font = (CTFontRef) font.OSXGetCTFont();
- setup = true;
- }
- }
-#endif
-#if wxOSX_USE_ATSU_TEXT
- if ( !setup )
- {
- info.version = kHIThemeTextInfoVersionZero;
- info.fontID = kThemeViewsFont;
- if (font.IsOk())
- {
- info.fontID = font.MacGetThemeFontID();
-
- ::TextSize( (short)(font.GetPointSize()) ) ;
- ::TextFace( font.MacGetFontStyle() ) ;
- }
+ info.version = kHIThemeTextInfoVersionOne;
+ info.fontID = kThemeViewsFont;
+ if (font.IsOk())
+ {
+ info.fontID = kThemeSpecifiedFont;
+ info.font = (CTFontRef) font.OSXGetCTFont();
}
-#endif
wxListItem item;
list->GetColumn(listColumn, item);
diff --git a/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp b/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp
index 881083c..f9acf7e 100644
--- a/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/nonownedwnd.cpp
@@ -1522,18 +1522,11 @@ void wxNonOwnedWindowCarbonImpl::Maximize(bool maximize)
Point idealSize = { 0 , 0 } ;
if ( maximize )
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
HIRect bounds ;
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
&bounds);
idealSize.h = bounds.size.width;
idealSize.v = bounds.size.height;
-#else
- Rect rect ;
- GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
- idealSize.h = rect.right - rect.left ;
- idealSize.v = rect.bottom - rect.top ;
-#endif
}
ZoomWindowIdeal( (WindowRef)GetWXWindow() , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
}
diff --git a/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp b/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp
index 02ba93a..53a0f90 100644
--- a/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/textctrl.cpp
@@ -369,41 +369,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
long style,
long WXUNUSED(extraStyle))
{
- bool forceMLTE = false ;
-
-#if wxUSE_SYSTEM_OPTIONS
- if (wxSystemOptions::HasOption( wxMAC_TEXTCONTROL_USE_MLTE ) && (wxSystemOptions::GetOptionInt( wxMAC_TEXTCONTROL_USE_MLTE ) == 1))
- {
- forceMLTE = true ;
- }
-#endif
-
- if ( UMAGetSystemVersion() >= 0x1050 )
- forceMLTE = false;
-
- wxMacControl* peer = NULL;
-
- if ( !forceMLTE )
- {
- if ( style & wxTE_MULTILINE || ( UMAGetSystemVersion() >= 0x1050 ) )
- peer = new wxMacMLTEHIViewControl( wxpeer , str , pos , size , style ) ;
- }
-
- if ( !peer )
- {
- if ( !(style & wxTE_MULTILINE) && !forceMLTE )
- {
- peer = new wxMacUnicodeTextControl( wxpeer , str , pos , size , style ) ;
- }
- }
-
- // the horizontal single line scrolling bug that made us keep the classic implementation
- // is fixed in 10.5
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- if ( !peer )
- peer = new wxMacMLTEClassicControl( wxpeer , str , pos , size , style ) ;
-#endif
- return peer;
+ return new wxMacMLTEHIViewControl( wxpeer , str , pos , size , style ) ;
}
// ----------------------------------------------------------------------------
@@ -1467,674 +1433,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
return theLength ;
}
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-
-// ----------------------------------------------------------------------------
-// MLTE control implementation (classic part)
-// ----------------------------------------------------------------------------
-
-// OS X Notes : We still don't have a full replacement for MLTE, so this implementation
-// has to live on. We have different problems coming from outdated implementations on the
-// various OS X versions. Most deal with the scrollbars: they are not correctly embedded
-// while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is
-// no way out, therefore we are using our own implementation and our own scrollbars ....
-
-TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
-ControlActionUPP gTXNScrollActionProc = NULL ;
-
-pascal void wxMacMLTEClassicControl::TXNScrollInfoProc(
- SInt32 iValue, SInt32 iMaximumValue,
- TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon )
-{
- wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ;
- SInt32 value = wxMax( iValue , 0 ) ;
- SInt32 maximum = wxMax( iMaximumValue , 0 ) ;
-
- if ( iScrollBarOrientation == kTXNHorizontal )
- {
- if ( mlte->m_sbHorizontal )
- {
- SetControl32BitValue( mlte->m_sbHorizontal , value ) ;
- SetControl32BitMaximum( mlte->m_sbHorizontal , maximum ) ;
- mlte->m_lastHorizontalValue = value ;
- }
- }
- else if ( iScrollBarOrientation == kTXNVertical )
- {
- if ( mlte->m_sbVertical )
- {
- SetControl32BitValue( mlte->m_sbVertical , value ) ;
- SetControl32BitMaximum( mlte->m_sbVertical , maximum ) ;
- mlte->m_lastVerticalValue = value ;
- }
- }
-}
-
-pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode )
-{
- wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ;
- if ( mlte == NULL )
- return ;
-
- if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal )
- return ;
-
- OSStatus err ;
- bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
-
- SInt32 minimum = 0 ;
- SInt32 maximum = GetControl32BitMaximum( controlRef ) ;
- SInt32 value = GetControl32BitValue( controlRef ) ;
- SInt32 delta = 0;
-
- switch ( partCode )
- {
- case kControlDownButtonPart :
- delta = 10 ;
- break ;
-
- case kControlUpButtonPart :
- delta = -10 ;
- break ;
-
- case kControlPageDownPart :
- delta = GetControlViewSize( controlRef ) ;
- break ;
-
- case kControlPageUpPart :
- delta = -GetControlViewSize( controlRef ) ;
- break ;
-
- case kControlIndicatorPart :
- delta = value - (isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue) ;
- break ;
-
- default :
- break ;
- }
-
- if ( delta != 0 )
- {
- SInt32 newValue = value ;
-
- if ( partCode != kControlIndicatorPart )
- {
- if ( value + delta < minimum )
- delta = minimum - value ;
- if ( value + delta > maximum )
- delta = maximum - value ;
-
- SetControl32BitValue( controlRef , value + delta ) ;
- newValue = value + delta ;
- }
-
- SInt32 verticalDelta = isHorizontal ? 0 : delta ;
- SInt32 horizontalDelta = isHorizontal ? delta : 0 ;
-
- err = TXNScroll(
- mlte->m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels,
- &verticalDelta, &horizontalDelta );
- verify_noerr( err );
-
- if ( isHorizontal )
- mlte->m_lastHorizontalValue = newValue ;
- else
- mlte->m_lastVerticalValue = newValue ;
- }
-}
-
-// make correct activations
-void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
-{
- wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
-
- wxMacWindowClipper clipper( textctrl ) ;
- TXNActivate( m_txn, m_txnFrameID, setActive );
-
- ControlRef controlFocus = 0 ;
- GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
- if ( controlFocus == m_controlRef )
- TXNFocus( m_txn, setActive );
-}
-
-void wxMacMLTEClassicControl::MacFocusPaneText(bool setFocus)
-{
- TXNFocus( m_txn, setFocus );
-}
-
-// guards against inappropriate redraw (hidden objects drawing onto window)
-
-void wxMacMLTEClassicControl::MacSetObjectVisibility(bool vis)
-{
- ControlRef controlFocus = 0 ;
- GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
-
- if ( !vis && (controlFocus == m_controlRef ) )
- SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
-
- TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
- TXNControlData iControlData[1] = { { (UInt32)false } };
-
- verify_noerr( TXNGetTXNObjectControls( m_txn , 1, iControlTags, iControlData ) ) ;
-
- if ( iControlData[0].uValue != vis )
- {
- iControlData[0].uValue = vis ;
- verify_noerr( TXNSetTXNObjectControls( m_txn, false , 1, iControlTags, iControlData ) ) ;
- }
-
- // currently, we always clip as partial visibility (overlapped) visibility is also a problem,
- // if we run into further problems we might set the FrameBounds to an empty rect here
-}
-
-// make sure that the TXNObject is at the right position
-
-void wxMacMLTEClassicControl::MacUpdatePosition()
-{
- wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
- if ( textctrl == NULL )
- return ;
-
- Rect bounds ;
- GetRectInWindowCoords( &bounds );
-
- wxRect visRect = textctrl->MacGetClippedClientRect() ;
- Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ;
- int x , y ;
- x = y = 0 ;
- textctrl->MacWindowToRootWindow( &x , &y ) ;
- OffsetRect( &visBounds , x , y ) ;
-
- if ( !EqualRect( &bounds, &m_txnControlBounds ) || !EqualRect( &visBounds, &m_txnVisBounds ) )
- {
- m_txnControlBounds = bounds ;
- m_txnVisBounds = visBounds ;
- wxMacWindowClipper cl( textctrl ) ;
-
- if ( m_sbHorizontal || m_sbVertical )
- {
- int w = bounds.right - bounds.left ;
- int h = bounds.bottom - bounds.top ;
-
- if ( m_sbHorizontal )
- {
- Rect sbBounds ;
-
- sbBounds.left = -1 ;
- sbBounds.top = h - 14 ;
- sbBounds.right = w + 1 ;
- sbBounds.bottom = h + 1 ;
-
- SetControlBounds( m_sbHorizontal , &sbBounds ) ;
- SetControlViewSize( m_sbHorizontal , w ) ;
- }
-
- if ( m_sbVertical )
- {
- Rect sbBounds ;
-
- sbBounds.left = w - 14 ;
- sbBounds.top = -1 ;
- sbBounds.right = w + 1 ;
- sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ;
-
- SetControlBounds( m_sbVertical , &sbBounds ) ;
- SetControlViewSize( m_sbVertical , h ) ;
- }
- }
-
- Rect oldviewRect ;
- TXNLongRect olddestRect ;
- TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
-
- Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
- m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
- m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
- TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
- m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) ,
- m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
-
- if ( olddestRect.right >= 10000 )
- destRect.right = destRect.left + 32000 ;
-
- if ( olddestRect.bottom >= 0x20000000 )
- destRect.bottom = destRect.top + 0x40000000 ;
-
- SectRect( &viewRect , &visBounds , &viewRect ) ;
- TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
-
-#if 0
- TXNSetFrameBounds(
- m_txn,
- m_txnControlBounds.top,
- m_txnControlBounds.left,
- m_txnControlBounds.bottom - (m_sbHorizontal ? 14 : 0),
- m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
- m_txnFrameID );
-#endif
-
- // the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
- // movement, therefore we have to force it
-
- // this problem has been reported in OSX as well, so we use this here once again
-
- TXNLongRect textRect ;
- TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
- if ( textRect.left < m_txnControlBounds.left )
- TXNShowSelection( m_txn , kTXNShowStart ) ;
- }
-}
-
-void wxMacMLTEClassicControl::Move(int x, int y, int width, int height)
-{
- wxMacControl::Move(x,y,width,height) ;
- MacUpdatePosition() ;
-}
-
-void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 WXUNUSED(thePart))
-{
- wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
- if ( textctrl == NULL )
- return ;
-
- if ( textctrl->IsShownOnScreen() )
- {
- wxMacWindowClipper clipper( textctrl ) ;
- TXNDraw( m_txn , NULL ) ;
- }
-}
-
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
-{
- Point where = { y , x } ;
- ControlPartCode result = kControlNoPart;
-
- wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference( m_controlRef );
- if ( (textctrl != NULL) && textctrl->IsShownOnScreen() )
- {
- if (PtInRect( where, &m_txnControlBounds ))
- {
- result = kControlEditTextPart ;
- }
- else
- {
- // sometimes we get the coords also in control local coordinates, therefore test again
- int x = 0 , y = 0 ;
- textctrl->MacClientToRootWindow( &x , &y ) ;
- where.h += x ;
- where.v += y ;
-
- if (PtInRect( where, &m_txnControlBounds ))
- result = kControlEditTextPart ;
- }
- }
-
- return result;
-}
-
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* WXUNUSED(actionProc) )
-{
- ControlPartCode result = kControlNoPart;
-
- wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference( m_controlRef );
- if ( (textctrl != NULL) && textctrl->IsShownOnScreen() )
- {
- Point startPt = { y , x } ;
-
- // for compositing, we must convert these into toplevel window coordinates, because hittesting expects them
- int x = 0 , y = 0 ;
- textctrl->MacClientToRootWindow( &x , &y ) ;
- startPt.h += x ;
- startPt.v += y ;
-
- switch (MacControlUserPaneHitTestProc( startPt.h , startPt.v ))
- {
- case kControlEditTextPart :
- {
- wxMacWindowClipper clipper( textctrl ) ;
- EventRecord rec ;
-
- ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
- TXNClick( m_txn, &rec );
- }
- break;
-
- default :
- break;
- }
- }
-
- return result;
-}
-
-void wxMacMLTEClassicControl::MacControlUserPaneIdleProc()
-{
- wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
- if ( textctrl == NULL )
- return ;
-
- if (textctrl->IsShownOnScreen())
- {
- if (IsControlActive(m_controlRef))
- {
- Point mousep;
-
- wxMacWindowClipper clipper( textctrl ) ;
- GetMouse(&mousep);
-
- TXNIdle(m_txn);
-
- if (PtInRect(mousep, &m_txnControlBounds))
- {
- RgnHandle theRgn = NewRgn();
- RectRgn(theRgn, &m_txnControlBounds);
- TXNAdjustCursor(m_txn, theRgn);
- DisposeRgn(theRgn);
- }
- }
- }
-}
-
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
-{
- wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
- if ( textctrl == NULL )
- return kControlNoPart;
-
- wxMacWindowClipper clipper( textctrl ) ;
-
- EventRecord ev ;
- memset( &ev , 0 , sizeof( ev ) ) ;
- ev.what = keyDown ;
- ev.modifiers = modifiers ;
- ev.message = ((keyCode << 8) & keyCodeMask) | (charCode & charCodeMask);
- TXNKeyDown( m_txn , &ev );
-
- return kControlEntireControl;
-}
-
-void wxMacMLTEClassicControl::MacControlUserPaneActivateProc(bool activating)
-{
- MacActivatePaneText( activating );
-}
-
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
-{
- ControlPartCode focusResult = kControlFocusNoPart;
-
- wxTextCtrl* textctrl = (wxTextCtrl*)GetControlReference( m_controlRef );
- if ( textctrl == NULL )
- return focusResult;
-
- wxMacWindowClipper clipper( textctrl ) ;
-
- ControlRef controlFocus = NULL ;
- GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
- bool wasFocused = ( controlFocus == m_controlRef ) ;
-
- switch (action)
- {
- case kControlFocusPrevPart:
- case kControlFocusNextPart:
- MacFocusPaneText( !wasFocused );
- focusResult = (!wasFocused ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart);
- break;
-
- case kControlFocusNoPart:
- default:
- MacFocusPaneText( false );
- focusResult = kControlFocusNoPart;
- break;
- }
-
- return focusResult;
-}
-
-void wxMacMLTEClassicControl::MacControlUserPaneBackgroundProc( void *WXUNUSED(info) )
-{
-}
-
-wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
- const wxString& str,
- const wxPoint& pos,
- const wxSize& size, long style )
- : wxMacMLTEControl( wxPeer )
-{
- m_font = wxPeer->GetFont() ;
- m_windowStyle = style ;
- Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
-
- short featureSet =
- kControlSupportsEmbedding | kControlSupportsFocus | kControlWantsIdle
- | kControlWantsActivate | kControlHandlesTracking
-// | kControlHasSpecialBackground
- | kControlGetsFocusOnClick | kControlSupportsLiveFeedback;
-
- OSStatus err = ::CreateUserPaneControl(
- MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
- &bounds, featureSet, &m_controlRef );
- verify_noerr( err );
- SetControlReference( m_controlRef , (URefCon) wxPeer );
-
- DoCreate();
-
- AdjustCreationAttributes( *wxWHITE , true ) ;
-
- MacSetObjectVisibility( wxPeer->IsShownOnScreen() ) ;
-
- {
- wxString st = str ;
- wxMacConvertNewlines10To13( &st ) ;
- wxMacWindowClipper clipper( GetWXPeer() ) ;
- SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
- TXNSetSelection( m_txn, 0, 0 ) ;
- }
-}
-
-wxMacMLTEClassicControl::~wxMacMLTEClassicControl()
-{
- TXNDeleteObject( m_txn );
- m_txn = NULL ;
-}
-
-void wxMacMLTEClassicControl::VisibilityChanged(bool shown)
-{
- MacSetObjectVisibility( shown ) ;
- wxMacControl::VisibilityChanged( shown ) ;
-}
-
-void wxMacMLTEClassicControl::SuperChangedPosition()
-{
- MacUpdatePosition() ;
- wxMacControl::SuperChangedPosition() ;
-}
-
-ControlUserPaneDrawUPP gTPDrawProc = NULL;
-ControlUserPaneHitTestUPP gTPHitProc = NULL;
-ControlUserPaneTrackingUPP gTPTrackProc = NULL;
-ControlUserPaneIdleUPP gTPIdleProc = NULL;
-ControlUserPaneKeyDownUPP gTPKeyProc = NULL;
-ControlUserPaneActivateUPP gTPActivateProc = NULL;
-ControlUserPaneFocusUPP gTPFocusProc = NULL;
-
-static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- win->MacControlUserPaneDrawProc( part ) ;
-}
-
-static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- return win->MacControlUserPaneHitTestProc( where.h , where.v ) ;
- else
- return kControlNoPart ;
-}
-
-static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- return win->MacControlUserPaneTrackingProc( startPt.h , startPt.v , (void*) actionProc ) ;
- else
- return kControlNoPart ;
-}
-
-static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- win->MacControlUserPaneIdleProc() ;
-}
-
-static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- return win->MacControlUserPaneKeyDownProc( keyCode, charCode, modifiers ) ;
- else
- return kControlNoPart ;
-}
-
-static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget)control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- win->MacControlUserPaneActivateProc( activating ) ;
-}
-
-static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- return win->MacControlUserPaneFocusProc( action ) ;
- else
- return kControlNoPart ;
-}
-
-#if 0
-static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
-{
- wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget(control) , wxTextCtrl ) ;
- wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
- if ( win )
- win->MacControlUserPaneBackgroundProc(info) ;
-}
-#endif
-
-// TXNRegisterScrollInfoProc
-
-OSStatus wxMacMLTEClassicControl::DoCreate()
-{
- Rect bounds;
- OSStatus err = noErr ;
-
- // set up our globals
- if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
- if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
- if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc);
- if (gTPIdleProc == NULL) gTPIdleProc = NewControlUserPaneIdleUPP(wxMacControlUserPaneIdleProc);
- if (gTPKeyProc == NULL) gTPKeyProc = NewControlUserPaneKeyDownUPP(wxMacControlUserPaneKeyDownProc);
- if (gTPActivateProc == NULL) gTPActivateProc = NewControlUserPaneActivateUPP(wxMacControlUserPaneActivateProc);
- if (gTPFocusProc == NULL) gTPFocusProc = NewControlUserPaneFocusUPP(wxMacControlUserPaneFocusProc);
-
- if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ;
- if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
-
- // set the initial settings for our private data
-
- m_txnWindow = GetControlOwner(m_controlRef);
- m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
-
- // set up the user pane procedures
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneTrackingProcTag, sizeof(gTPTrackProc), &gTPTrackProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneIdleProcTag, sizeof(gTPIdleProc), &gTPIdleProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
- SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
-
- // calculate the rectangles used by the control
- GetRectInWindowCoords( &bounds );
-
- m_txnControlBounds = bounds ;
- m_txnVisBounds = bounds ;
-
- CGrafPtr origPort ;
- GDHandle origDev ;
-
- GetGWorld( &origPort, &origDev ) ;
- SetPort( m_txnPort );
-
- // create the new edit field
- TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
-
- // the scrollbars are not correctly embedded but are inserted at the root:
- // this gives us problems as we have erratic redraws even over the structure area
-
- m_sbHorizontal = 0 ;
- m_sbVertical = 0 ;
- m_lastHorizontalValue = 0 ;
- m_lastVerticalValue = 0 ;
-
- Rect sb = { 0 , 0 , 0 , 0 } ;
- if ( frameOptions & kTXNWantVScrollBarMask )
- {
- CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbVertical );
- SetControlReference( m_sbVertical, (SInt32)this );
- SetControlAction( m_sbVertical, gTXNScrollActionProc );
- ShowControl( m_sbVertical );
- EmbedControl( m_sbVertical , m_controlRef );
- frameOptions &= ~kTXNWantVScrollBarMask;
- }
-
- if ( frameOptions & kTXNWantHScrollBarMask )
- {
- CreateScrollBarControl( m_txnWindow, &sb, 0, 0, 100, 1, true, gTXNScrollActionProc, &m_sbHorizontal );
- SetControlReference( m_sbHorizontal, (SInt32)this );
- SetControlAction( m_sbHorizontal, gTXNScrollActionProc );
- ShowControl( m_sbHorizontal );
- EmbedControl( m_sbHorizontal, m_controlRef );
- frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
- }
-
- err = TXNNewObject(
- NULL, m_txnWindow, &bounds, frameOptions,
- kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
- &m_txn, &m_txnFrameID, NULL );
- verify_noerr( err );
-
-#if 0
- TXNControlTag iControlTags[] = { kTXNUseCarbonEvents };
- TXNControlData iControlData[] = { { (UInt32)&cInfo } };
- int toptag = WXSIZEOF( iControlTags ) ;
- TXNCarbonEventInfo cInfo ;
- cInfo.useCarbonEvents = false ;
- cInfo.filler = 0 ;
- cInfo.flags = 0 ;
- cInfo.fDictionary = NULL ;
-
- verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );
-#endif
-
- TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this );
-
- SetGWorld( origPort , origDev ) ;
-
- return err;
-}
-#endif
-
// ----------------------------------------------------------------------------
// MLTE control implementation (OSX part)
// ----------------------------------------------------------------------------
diff --git a/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp b/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp
index a44e23b..07121fb 100644
--- a/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/toolbar.cpp
@@ -113,14 +113,6 @@ public:
if ( m_toolbarItemRef )
{
CFIndex count = CFGetRetainCount( m_toolbarItemRef ) ;
- // different behaviour under Leopard
- if ( UMAGetSystemVersion() < 0x1050 )
- {
- if ( count != 1 )
- {
- wxFAIL_MSG("Reference count of native tool was not 1 in wxToolBarTool destructor");
- }
- }
wxTheApp->MacAddToAutorelease(m_toolbarItemRef);
CFRelease(m_toolbarItemRef);
m_toolbarItemRef = NULL;
@@ -941,14 +933,6 @@ wxToolBar::~wxToolBar()
}
CFIndex count = CFGetRetainCount( m_macToolbar ) ;
- // Leopard seems to have one refcount more, so we cannot check reliably at the moment
- if ( UMAGetSystemVersion() < 0x1050 )
- {
- if ( count != 1 )
- {
- wxFAIL_MSG("Reference count of native control was not 1 in wxToolBar destructor");
- }
- }
CFRelease( (HIToolbarRef)m_macToolbar );
m_macToolbar = NULL;
#endif // wxOSX_USE_NATIVE_TOOLBAR
@@ -1616,26 +1600,12 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
case wxTOOL_STYLE_BUTTON:
{
wxASSERT( tool->GetControlHandle() == NULL );
- ControlButtonContentInfo info;
- wxMacCreateBitmapButton( &info, tool->GetNormalBitmap() );
- if ( UMAGetSystemVersion() >= 0x1000)
- {
- // contrary to the docs this control only works with iconrefs
- ControlButtonContentInfo info;
- wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
- CreateIconControl( window, &toolrect, &info, false, &controlHandle );
- wxMacReleaseBitmapButton( &info );
- }
- else
- {
- SInt16 behaviour = kControlBehaviorOffsetContents;
- if ( tool->CanBeToggled() )
- behaviour |= kControlBehaviorToggles;
- err = CreateBevelButtonControl( window,
- &toolrect, CFSTR(""), kControlBevelButtonNormalBevel,
- behaviour, &info, 0, 0, 0, &controlHandle );
- }
+ // contrary to the docs this control only works with iconrefs
+ ControlButtonContentInfo info;
+ wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
+ CreateIconControl( window, &toolrect, &info, false, &controlHandle );
+ wxMacReleaseBitmapButton( &info );
#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macToolbar != NULL)
diff --git a/Externals/wxWidgets3/src/osx/carbon/utils.cpp b/Externals/wxWidgets3/src/osx/carbon/utils.cpp
index 8598ad1..9653ee4 100644
--- a/Externals/wxWidgets3/src/osx/carbon/utils.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/utils.cpp
@@ -33,9 +33,7 @@
// #include "MoreFilesX.h"
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- #include <AudioToolbox/AudioServices.h>
-#endif
+#include <AudioToolbox/AudioServices.h>
#include "wx/osx/private.h"
#if wxUSE_GUI
@@ -49,17 +47,8 @@
// Emit a beeeeeep
void wxBell()
{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( AudioServicesPlayAlertSound != NULL )
AudioServicesPlayAlertSound(kUserPreferredAlert);
- else
-#endif
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- AlertSoundPlay();
-#else
- {
- }
-#endif
}
wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
@@ -156,7 +145,6 @@ void wxGetMousePosition( int* x, int* y )
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
HIRect bounds ;
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
&bounds);
@@ -168,18 +156,6 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
*width = bounds.size.width;
if ( height )
*height = bounds.size.height;
-#else
- Rect r;
- GetAvailableWindowPositioningBounds( GetMainDevice() , &r );
- if ( x )
- *x = r.left;
- if ( y )
- *y = r.top;
- if ( width )
- *width = r.right - r.left;
- if ( height )
- *height = r.bottom - r.top;
-#endif
}
#endif // wxUSE_GUI
diff --git a/Externals/wxWidgets3/src/osx/carbon/window.cpp b/Externals/wxWidgets3/src/osx/carbon/window.cpp
index 5a4a0bf..f7085d2 100644
--- a/Externals/wxWidgets3/src/osx/carbon/window.cpp
+++ b/Externals/wxWidgets3/src/osx/carbon/window.cpp
@@ -299,11 +299,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
case kEventControlFocusPartChanged :
// the event is emulated by wxmac for systems lower than 10.5
{
- if ( UMAGetSystemVersion() < 0x1050 )
- {
- // as it is synthesized here, we have to manually avoid propagation
- result = noErr;
- }
ControlPartCode previousControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPreviousPart , typeControlPartCode );
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlCurrentPart , typeControlPartCode );
@@ -387,76 +382,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
}
else
result = CallNextEventHandler(handler, event);
-
- if ( UMAGetSystemVersion() < 0x1050 )
- {
-// set back to 0 if problems arise
-#if 1
- if ( result == noErr )
- {
- ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
- // synthesize the event focus changed event
- EventRef evRef = NULL ;
-
- OSStatus err = MacCreateEvent(
- NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
- kEventAttributeUserEvent , &evRef );
- verify_noerr( err );
-
- wxMacCarbonEvent iEvent( evRef ) ;
- iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef );
- iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
- iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
- iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
-
-#if 1
- // TODO test this first, avoid double posts etc...
- PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
-#else
- wxMacWindowControlEventHandler( NULL , evRef , data ) ;
-#endif
- ReleaseEvent( evRef ) ;
- }
-#else
- // old implementation, to be removed if the new one works
- if ( controlPart == kControlFocusNoPart )
- {
-#if wxUSE_CARET
- if ( thisWindow->GetCaret() )
- thisWindow->GetCaret()->OnKillFocus();
-#endif
-
- wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast<void*>(thisWindow));
-
- static bool inKillFocusEvent = false ;
-
- if ( !inKillFocusEvent )
- {
- inKillFocusEvent = true ;
- wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
- event.SetEventObject(thisWindow);
- thisWindow->HandleWindowEvent(event) ;
- inKillFocusEvent = false ;
- }
- }
- else
- {
- // panel wants to track the window which was the last to have focus in it
- wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast<void*>(thisWindow));
- wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
- thisWindow->HandleWindowEvent(eventFocus);
-
- #if wxUSE_CARET
- if ( thisWindow->GetCaret() )
- thisWindow->GetCaret()->OnSetFocus();
- #endif
-
- wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
- event.SetEventObject(thisWindow);
- thisWindow->HandleWindowEvent(event) ;
- }
-#endif
- }
}
break ;
@@ -1136,19 +1061,10 @@ void wxMacControl::SetCursor(const wxCursor& cursor)
ControlPartCode part ;
ControlRef control ;
Point pt ;
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
HIPoint hiPoint ;
HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
pt.h = hiPoint.x;
pt.v = hiPoint.y;
-#else
- GetGlobalMouse( &pt );
- int x = pt.h;
- int y = pt.v;
- tlwwx->ScreenToClient(&x, &y);
- pt.h = x;
- pt.v = y;
-#endif
control = FindControlUnderMouse( pt , window , &part ) ;
if ( control )
mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ;
@@ -1262,27 +1178,22 @@ void wxMacControl::SuperChangedPosition()
void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack )
{
m_font = font;
-#if wxOSX_USE_CORE_TEXT
- if ( UMAGetSystemVersion() >= 0x1050 )
+ HIViewPartCode part = 0;
+ HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault;
+ if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL )
+ flush = kHIThemeTextHorizontalFlushCenter;
+ else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT )
+ flush = kHIThemeTextHorizontalFlushRight;
+ HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() );
+ HIViewSetTextHorizontalFlush( m_controlRef, part, flush );
+
+ if ( foreground != *wxBLACK || ignoreBlack == false )
{
- HIViewPartCode part = 0;
- HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault;
- if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL )
- flush = kHIThemeTextHorizontalFlushCenter;
- else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT )
- flush = kHIThemeTextHorizontalFlushRight;
- HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() );
- HIViewSetTextHorizontalFlush( m_controlRef, part, flush );
-
- if ( foreground != *wxBLACK || ignoreBlack == false )
- {
- ControlFontStyleRec fontStyle;
- foreground.GetRGBColor( &fontStyle.foreColor );
- fontStyle.flags = kControlUseForeColorMask;
- ::SetControlFontStyle( m_controlRef , &fontStyle );
- }
+ ControlFontStyleRec fontStyle;
+ foreground.GetRGBColor( &fontStyle.foreColor );
+ fontStyle.flags = kControlUseForeColorMask;
+ ::SetControlFontStyle( m_controlRef , &fontStyle );
}
-#endif
#if wxOSX_USE_ATSU_TEXT
ControlFontStyleRec fontStyle;
if ( font.MacGetThemeFontID() != kThemeCurrentPortFont )
diff --git a/Externals/wxWidgets3/src/osx/cocoa/combobox.mm b/Externals/wxWidgets3/src/osx/cocoa/combobox.mm
index e817c64..112b37b 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/combobox.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/combobox.mm
@@ -248,6 +248,7 @@ wxWidgetImplType* wxWidgetImpl::CreateComboBox( wxComboBox* wxpeer,
{
NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
wxNSComboBox* v = [[wxNSComboBox alloc] initWithFrame:r];
+ [v setNumberOfVisibleItems:13];
if (style & wxCB_READONLY)
[v setEditable:NO];
wxNSComboBoxControl* c = new wxNSComboBoxControl( wxpeer, v );
diff --git a/Externals/wxWidgets3/src/osx/cocoa/dataview.mm b/Externals/wxWidgets3/src/osx/cocoa/dataview.mm
index d2d219d..e9df8f2 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/dataview.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/dataview.mm
@@ -351,7 +351,7 @@ NSTableColumn* CreateNativeColumn(const wxDataViewColumn *column)
int resizingMask;
if (column->IsResizeable())
{
- resizingMask = NSTableColumnUserResizingMask;
+ resizingMask = NSTableColumnUserResizingMask | NSTableColumnAutoresizingMask;
[nativeColumn setMinWidth:column->GetMinWidth()];
[nativeColumn setMaxWidth:column->GetMaxWidth()];
}
@@ -367,10 +367,8 @@ NSTableColumn* CreateNativeColumn(const wxDataViewColumn *column)
}
[nativeColumn setResizingMask:resizingMask];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
// setting the visibility:
[nativeColumn setHidden:static_cast<BOOL>(column->IsHidden())];
-#endif
wxDataViewRendererNativeData * const renderData = renderer->GetNativeData();
@@ -1486,7 +1484,6 @@ outlineView:(NSOutlineView*)outlineView
[super editWithFrame:textFrame inView:controlView editor:textObj delegate:anObject event:theEvent];
}
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-(NSUInteger) hitTestForEvent:(NSEvent*)event inRect:(NSRect)cellFrame ofView:(NSView*)controlView
{
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
@@ -1528,7 +1525,6 @@ outlineView:(NSOutlineView*)outlineView
return [super hitTestForEvent:event inRect:textFrame ofView:controlView];
}
-#endif
-(NSRect) imageRectForBounds:(NSRect)cellFrame
{
@@ -1975,7 +1971,7 @@ wxCocoaDataViewControl::wxCocoaDataViewControl(wxWindow* peer,
void wxCocoaDataViewControl::InitOutlineView(long style)
{
[m_OutlineView setImplementation:this];
- [m_OutlineView setColumnAutoresizingStyle:NSTableViewSequentialColumnAutoresizingStyle];
+ [m_OutlineView setColumnAutoresizingStyle:NSTableViewLastColumnOnlyAutoresizingStyle];
[m_OutlineView setIndentationPerLevel:GetDataViewCtrl()->GetIndent()];
NSUInteger maskGridStyle(NSTableViewGridNone);
if (style & wxDV_HORIZ_RULES)
@@ -2060,7 +2056,6 @@ bool wxCocoaDataViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* co
void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
const int count = GetCount();
NSTableColumn *column = GetColumn(pos)->GetNativeData()->GetNativeColumnPtr();
@@ -2173,7 +2168,6 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos)
}
[column setWidth:calculator.GetMaxWidth()];
-#endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
}
//
@@ -3158,6 +3152,7 @@ wxDataViewColumn::wxDataViewColumn(const wxString& title,
if (renderer && !renderer->IsCustomRenderer() &&
(renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT))
renderer->SetAlignment(align);
+ SetResizeable((flags & wxDATAVIEW_COL_RESIZABLE) != 0);
}
wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap,
@@ -3242,7 +3237,7 @@ void wxDataViewColumn::SetResizeable(bool resizable)
{
wxDataViewColumnBase::SetResizeable(resizable);
if (resizable)
- [m_NativeDataPtr->GetNativeColumnPtr() setResizingMask:NSTableColumnUserResizingMask];
+ [m_NativeDataPtr->GetNativeColumnPtr() setResizingMask:NSTableColumnUserResizingMask | NSTableColumnAutoresizingMask];
else
[m_NativeDataPtr->GetNativeColumnPtr() setResizingMask:NSTableColumnNoResizing];
}
@@ -3295,15 +3290,13 @@ void wxDataViewColumn::SetWidth(int width)
switch ( width )
{
case wxCOL_WIDTH_AUTOSIZE:
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
if ( GetOwner() )
{
wxCocoaDataViewControl *peer = static_cast<wxCocoaDataViewControl*>(GetOwner()->GetPeer());
peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this));
break;
}
-#endif
- // fall through if unsupported (OSX < 10.5) or not yet settable
+ // fall through if not yet settable
case wxCOL_WIDTH_DEFAULT:
width = wxDVC_DEFAULT_WIDTH;
diff --git a/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm b/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm
index 2a27139..3e43d77 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/evtloop.mm
@@ -66,10 +66,8 @@ static NSUInteger CalculateNSEventMaskFromEventCategory(wxEventCategory cat)
NSMouseEnteredMask |
NSMouseExitedMask |
NSScrollWheelMask |
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
NSTabletPointMask |
NSTabletProximityMask |
-#endif
NSOtherMouseDownMask |
NSOtherMouseUpMask |
NSOtherMouseDraggedMask |
@@ -77,14 +75,12 @@ static NSUInteger CalculateNSEventMaskFromEventCategory(wxEventCategory cat)
NSKeyDownMask |
NSKeyUpMask |
NSFlagsChangedMask |
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
NSEventMaskGesture |
NSEventMaskMagnify |
NSEventMaskSwipe |
NSEventMaskRotate |
NSEventMaskBeginGesture |
NSEventMaskEndGesture |
-#endif
0;
}
@@ -425,6 +421,45 @@ void wxModalEventLoop::OSXDoStop()
[NSApp abortModal];
}
+// we need our own version of ProcessIdle here in order to
+// avoid deletion of pending objects, because ProcessIdle is running
+// to soon and ends up in destroying the object too early, ie before
+// a stack allocated instance is removed resulting in double deletes
+bool wxModalEventLoop::ProcessIdle()
+{
+ bool needMore = false;
+ if ( wxTheApp )
+ {
+ // synthesize an idle event and check if more of them are needed
+ wxIdleEvent event;
+ event.SetEventObject(wxTheApp);
+ wxTheApp->ProcessEvent(event);
+
+#if wxUSE_LOG
+ // flush the logged messages if any (do this after processing the events
+ // which could have logged new messages)
+ wxLog::FlushActive();
+#endif
+ needMore = event.MoreRequested();
+
+ wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
+ while (node)
+ {
+ wxWindow* win = node->GetData();
+
+ // Don't send idle events to the windows that are about to be destroyed
+ // anyhow, this is wasteful and unexpected.
+ if ( !wxPendingDelete.Member(win) && win->SendIdleEvents(event) )
+ needMore = true;
+ node = node->GetNext();
+ }
+
+ wxUpdateUIEvent::ResetUpdateTime();
+
+ }
+ return needMore;
+}
+
void wxGUIEventLoop::BeginModalSession( wxWindow* modalWindow )
{
WXWindow nsnow = nil;
diff --git a/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm b/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm
index c1f80b8..9f73bfe 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/glcanvas.mm
@@ -88,6 +88,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8,
NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0,
NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8,
+ NSOpenGLPFAAccelerated, // use hardware accelerated context
(NSOpenGLPixelFormatAttribute)nil
};
@@ -100,6 +101,7 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
{
unsigned p = 0;
data[p++] = NSOpenGLPFAMinimumPolicy; // make _SIZE tags behave more like GLX
+ data[p++] = NSOpenGLPFAAccelerated; // use hardware accelerated context
for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); )
{
diff --git a/Externals/wxWidgets3/src/osx/cocoa/listbox.mm b/Externals/wxWidgets3/src/osx/cocoa/listbox.mm
index 0cc4509..95d36c3 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/listbox.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/listbox.mm
@@ -302,8 +302,6 @@ protected:
wxListBox *list = static_cast<wxListBox*> ( impl->GetWXPeer());
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
- wxCommandEvent event( wxEVT_LISTBOX, list->GetId() );
-
if ((row < 0) || (row > (int) list->GetCount())) // OS X can select an item below the last item
return;
diff --git a/Externals/wxWidgets3/src/osx/cocoa/menu.mm b/Externals/wxWidgets3/src/osx/cocoa/menu.mm
index 9733bc5..d5fdc23 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/menu.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/menu.mm
@@ -140,6 +140,9 @@
@interface NSApplication(MissingAppleMenuCall)
- (void)setAppleMenu:(NSMenu *)menu;
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
+- (void)setHelpMenu:(NSMenu* )menu;
+#endif
@end
class wxMenuCocoaImpl : public wxMenuImpl
@@ -192,8 +195,35 @@ public :
virtual void MakeRoot()
{
+ wxMenu* peer = GetWXPeer();
+
[NSApp setMainMenu:m_osxMenu];
[NSApp setAppleMenu:[[m_osxMenu itemAtIndex:0] submenu]];
+
+ wxMenuItem *services = peer->FindItem(wxID_OSX_SERVICES);
+ if ( services )
+ [NSApp setServicesMenu:services->GetSubMenu()->GetHMenu()];
+#if 0
+ // should we reset this just to be sure we don't leave a dangling ref ?
+ else
+ [NSApp setServicesMenu:nil];
+#endif
+
+ NSMenu* helpMenu = nil;
+ int helpid = peer->FindItem(wxApp::s_macHelpMenuTitleName);
+ if ( helpid == wxNOT_FOUND )
+ helpid = peer->FindItem(_("&Help"));
+
+ if ( helpid != wxNOT_FOUND )
+ {
+ wxMenuItem* helpMenuItem = peer->FindItem(helpid);
+
+ if ( helpMenuItem->IsSubMenu() )
+ helpMenu = helpMenuItem->GetSubMenu()->GetHMenu();
+ }
+ if ( [NSApp respondsToSelector:@selector(setHelpMenu:)])
+ [NSApp setHelpMenu:helpMenu];
+
}
virtual void Enable( bool WXUNUSED(enable) )
diff --git a/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm b/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm
index eadec5c..578fcef 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/menuitem.mm
@@ -153,7 +153,6 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
unichar shortcut = 0;
if ( key >= WXK_F1 && key <= WXK_F15 )
{
- modifiers |= NSFunctionKeyMask ;
shortcut = NSF1FunctionKey + ( key - WXK_F1 );
}
else
@@ -161,47 +160,50 @@ void wxMacCocoaMenuItemSetAccelerator( NSMenuItem* menuItem, wxAcceleratorEntry*
switch ( key )
{
case WXK_CLEAR :
- modifiers |= NSFunctionKeyMask;
shortcut = NSDeleteCharacter ;
break ;
case WXK_PAGEUP :
- modifiers |= NSFunctionKeyMask;
shortcut = NSPageUpFunctionKey ;
break ;
case WXK_PAGEDOWN :
- modifiers |= NSFunctionKeyMask;
shortcut = NSPageDownFunctionKey ;
break ;
+ case WXK_NUMPAD_LEFT :
+ modifiers |= NSNumericPadKeyMask;
+ // pass through
case WXK_LEFT :
- modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask;
shortcut = NSLeftArrowFunctionKey ;
break ;
+ case WXK_NUMPAD_UP :
+ modifiers |= NSNumericPadKeyMask;
+ // pass through
case WXK_UP :
- modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask;
shortcut = NSUpArrowFunctionKey ;
break ;
+ case WXK_NUMPAD_RIGHT :
+ modifiers |= NSNumericPadKeyMask;
+ // pass through
case WXK_RIGHT :
- modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask;
shortcut = NSRightArrowFunctionKey ;
break ;
+ case WXK_NUMPAD_DOWN :
+ modifiers |= NSNumericPadKeyMask;
+ // pass through
case WXK_DOWN :
- modifiers |= NSNumericPadKeyMask | NSFunctionKeyMask;
shortcut = NSDownArrowFunctionKey ;
break ;
case WXK_HOME :
- modifiers |= NSFunctionKeyMask;
shortcut = NSHomeFunctionKey ;
break ;
case WXK_END :
- modifiers |= NSFunctionKeyMask;
shortcut = NSEndFunctionKey ;
break ;
diff --git a/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm b/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm
index 6559a8d..a93ae41 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/scrolbar.mm
@@ -57,12 +57,8 @@ public :
{
double v = ((double) value)/m_maximum;
double t = ((double) thumbSize)/(m_maximum+thumbSize);
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- [(wxNSScroller*) m_osxView setFloatValue:v knobProportion:t];
-#else
[(wxNSScroller*) m_osxView setDoubleValue:v];
[(wxNSScroller*) m_osxView setKnobProportion:t];
-#endif
}
virtual wxInt32 GetValue() const
diff --git a/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm b/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm
index 6c38fdf..bec0c44 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/textctrl.mm
@@ -89,8 +89,18 @@ public :
ms_viewCurrentlyEdited = m_viewPreviouslyEdited;
}
- // Returns the last view we were instantiated for or NULL.
- static NSView *GetCurrentlyEditedView() { return ms_viewCurrentlyEdited; }
+ // Returns true if this view is the one currently being changed by the
+ // program.
+ static bool IsCurrentlyEditedView(NSView* v)
+ {
+ return v == ms_viewCurrentlyEdited;
+ }
+
+ // Returns true if this editor is the one currently being modified.
+ static bool IsCurrentEditor(wxNSTextFieldEditor* e)
+ {
+ return e == [(NSTextField*)ms_viewCurrentlyEdited currentEditor];
+ }
protected :
BOOL m_formerEditable ;
@@ -282,11 +292,16 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
- (void) insertText:(id) str
{
- wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] );
- if ( impl == NULL || lastKeyDownEvent==nil || !impl->DoHandleCharEvent(lastKeyDownEvent, str) )
+ // We should never generate char events for the text being inserted
+ // programmatically.
+ if ( !wxMacEditHelper::IsCurrentEditor(self) )
{
- [super insertText:str];
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] );
+ if ( impl && lastKeyDownEvent && impl->DoHandleCharEvent(lastKeyDownEvent, str) )
+ return;
}
+
+ [super insertText:str];
}
@end
@@ -334,7 +349,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
{
wxUnusedVar(aNotification);
- if ( self == wxMacEditHelper::GetCurrentlyEditedView() )
+ if ( wxMacEditHelper::IsCurrentlyEditedView(self) )
{
// This notification is generated as the result of calling our own
// wxTextCtrl method (e.g. WriteText()) and doesn't correspond to any
diff --git a/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm b/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm
index ebca4f4..701f3f4 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/toolbar.mm
@@ -254,7 +254,6 @@ public:
#endif // wxOSX_USE_NATIVE_TOOLBAR
private:
-#if wxOSX_USE_NATIVE_TOOLBAR
wxFontEncoding GetToolBarFontEncoding() const
{
wxFont f;
@@ -262,7 +261,6 @@ private:
f = GetToolBar()->GetFont();
return f.IsOk() ? f.GetEncoding() : wxFont::GetDefaultEncoding();
}
-#endif // wxOSX_USE_NATIVE_TOOLBAR
void Init()
{
@@ -689,9 +687,11 @@ wxToolBar::~wxToolBar()
frame->SetToolBar(NULL);
}
+#if wxOSX_USE_NATIVE_TOOLBAR
[(NSToolbar*)m_macToolbar setDelegate:nil];
[(NSToolbar*)m_macToolbar release];
m_macToolbar = NULL;
+#endif // wxOSX_USE_NATIVE_TOOLBAR
}
bool wxToolBar::Show( bool show )
diff --git a/Externals/wxWidgets3/src/osx/cocoa/utils.mm b/Externals/wxWidgets3/src/osx/cocoa/utils.mm
index 3e07d7d..664ed51 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/utils.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/utils.mm
@@ -80,15 +80,29 @@ void wxBell()
fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) );
}
- wxTheApp->MacOpenFiles(fileList);
+ if ( wxTheApp->OSXInitWasCalled() )
+ wxTheApp->MacOpenFiles(fileList);
+ else
+ wxTheApp->OSXStoreOpenFiles(fileList);
}
-- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename
+- (NSApplicationPrintReply)application:(NSApplication *)sender printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings showPrintPanels:(BOOL)showPrintPanels
{
wxUnusedVar(sender);
- wxCFStringRef cf(wxCFRetain(filename));
- wxTheApp->MacPrintFile(cf.AsString()) ;
- return YES;
+ wxArrayString fileList;
+ size_t i;
+ const size_t count = [fileNames count];
+ for (i = 0; i < count; i++)
+ {
+ fileList.Add( wxCFStringRef::AsStringWithNormalizationFormC([fileNames objectAtIndex:i]) );
+ }
+
+ if ( wxTheApp->OSXInitWasCalled() )
+ wxTheApp->MacPrintFiles(fileList);
+ else
+ wxTheApp->OSXStorePrintFiles(fileList);
+
+ return NSPrintingSuccess;
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
@@ -105,14 +119,16 @@ void wxBell()
wxUnusedVar(replyEvent);
NSString* url = [[event descriptorAtIndex:1] stringValue];
wxCFStringRef cf(wxCFRetain(url));
- wxTheApp->MacOpenURL(cf.AsString()) ;
+ if ( wxTheApp->OSXInitWasCalled() )
+ wxTheApp->MacOpenURL(cf.AsString()) ;
+ else
+ wxTheApp->OSXStoreOpenURL(cf.AsString());
}
- (void)handleOpenAppEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
wxUnusedVar(replyEvent);
- wxTheApp->MacNewFile() ;
}
/*
@@ -239,6 +255,50 @@ void wxBell()
}
@end
+
+// more on bringing non-bundled apps to the foreground
+// https://devforums.apple.com/thread/203753
+
+#if 0
+
+// one possible solution is also quoted here
+// from http://stackoverflow.com/questions/7596643/when-calling-transformprocesstype-the-app-menu-doesnt-show-up
+
+@interface wxNSNonBundledAppHelper : NSObject {
+
+}
+
++ (void)transformToForegroundApplication;
+
+@end
+
+@implementation wxNSNonBundledAppHelper
+
++ (void)transformToForegroundApplication {
+ for (NSRunningApplication * app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.finder"]) {
+ [app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
+ break;
+ }
+ [self performSelector:@selector(transformStep2) withObject:nil afterDelay:0.1];
+}
+
++ (void)transformStep2
+{
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ (void) TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+
+ [self performSelector:@selector(transformStep3) withObject:nil afterDelay:0.1];
+}
+
++ (void)transformStep3
+{
+ [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
+}
+
+@end
+
+#endif
+
// here we subclass NSApplication, for the purpose of being able to override sendEvent.
@interface wxNSApplication : NSApplication
{
@@ -260,6 +320,26 @@ void wxBell()
return self;
}
+- (void) transformToForegroundApplication {
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ if ( UMAGetSystemVersion() >= 0x1090 )
+ {
+ [[NSRunningApplication currentApplication] activateWithOptions:
+ (NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
+ }
+ else
+#endif
+ {
+ [self deactivate];
+ [self activateIgnoringOtherApps:YES];
+ }
+}
+
+
+
/* This is needed because otherwise we don't receive any key-up events for command-key
combinations (an AppKit bug, apparently) */
- (void)sendEvent:(NSEvent *)anEvent
@@ -295,6 +375,20 @@ bool wxApp::DoInitGui()
if (!sm_isEmbedded)
{
[wxNSApplication sharedApplication];
+
+ if ( OSXIsGUIApplication() )
+ {
+ CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle() ) ;
+ CFStringRef path = CFURLCopyFileSystemPath ( url , kCFURLPOSIXPathStyle ) ;
+ CFRelease( url ) ;
+ wxString app = wxCFStringRef(path).AsString(wxLocale::GetSystemEncoding());
+
+ // workaround is only needed for non-bundled apps
+ if ( !app.EndsWith(".app") )
+ {
+ [(wxNSApplication*) [wxNSApplication sharedApplication] transformToForegroundApplication];
+ }
+ }
appcontroller = OSXCreateAppController();
[NSApp setDelegate:appcontroller];
@@ -315,8 +409,36 @@ bool wxApp::CallOnInit()
{
wxMacAutoreleasePool autoreleasepool;
m_onInitResult = false;
+ m_inited = false;
+
+ // Feed the upcoming event loop with a dummy event. Without this,
+ // [NSApp run] below wouldn't return, as we expect it to, if the
+ // application was launched without being activated and would block
+ // until the dock icon was clicked - delaying OnInit() call too.
+ NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined
+ location:NSMakePoint(0.0, 0.0)
+ modifierFlags:0
+ timestamp:0
+ windowNumber:0
+ context:nil
+ subtype:0 data1:0 data2:0];
+ [NSApp postEvent:event atStart:FALSE];
[NSApp run];
- return m_onInitResult;
+
+ m_onInitResult = OnInit();
+ m_inited = true;
+ if ( m_onInitResult )
+ {
+ if ( m_openFiles.GetCount() > 0 )
+ MacOpenFiles(m_openFiles);
+ else if ( m_printFiles.GetCount() > 0 )
+ MacPrintFiles(m_printFiles);
+ else if ( m_getURL.Len() > 0 )
+ MacOpenURL(m_getURL);
+ else
+ MacNewFile();
+ }
+ return m_onInitResult;
}
void wxApp::DoCleanUp()
diff --git a/Externals/wxWidgets3/src/osx/cocoa/window.mm b/Externals/wxWidgets3/src/osx/cocoa/window.mm
index 78cd6f9..1dc97c5 100644
--- a/Externals/wxWidgets3/src/osx/cocoa/window.mm
+++ b/Externals/wxWidgets3/src/osx/cocoa/window.mm
@@ -869,7 +869,9 @@ void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text);
- (void)doCommandBySelector:(SEL)aSelector
{
- // these are already caught in the keyEvent handler
+ wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
+ if (impl)
+ impl->doCommandBySelector(aSelector, self, _cmd);
}
- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
@@ -1366,13 +1368,82 @@ void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd)
{
- if ( m_lastKeyDownEvent==NULL || m_hasEditor || !DoHandleCharEvent(m_lastKeyDownEvent, text) )
+ bool result = false;
+ if ( IsUserPane() && !m_hasEditor && [text length] > 0)
+ {
+ if ( m_lastKeyDownEvent!=NULL && [text isEqualToString:[m_lastKeyDownEvent characters]])
+ {
+ // If we have a corresponding key event, send wxEVT_KEY_DOWN now.
+ // (see also: wxWidgetCocoaImpl::DoHandleKeyEvent)
+ {
+ wxKeyEvent wxevent(wxEVT_KEY_DOWN);
+ SetupKeyEvent( wxevent, m_lastKeyDownEvent );
+ result = GetWXPeer()->OSXHandleKeyEvent(wxevent);
+ }
+
+ // ...and wxEVT_CHAR.
+ result = result || DoHandleCharEvent(m_lastKeyDownEvent, text);
+ }
+ else
+ {
+ // If we don't have a corresponding key event (e.g. IME-composed
+ // characters), send wxEVT_CHAR without sending wxEVT_KEY_DOWN.
+ for (NSUInteger i = 0; i < [text length]; ++i)
+ {
+ wxKeyEvent wxevent(wxEVT_CHAR);
+ wxevent.m_shiftDown = wxevent.m_controlDown = wxevent.m_altDown = wxevent.m_metaDown = false;
+ wxevent.m_rawCode = 0;
+ wxevent.m_rawFlags = 0;
+ wxevent.SetTimestamp();
+ unichar aunichar = [text characterAtIndex:i];
+#if wxUSE_UNICODE
+ wxevent.m_uniChar = aunichar;
+#endif
+ wxevent.m_keyCode = aunichar < 0x80 ? aunichar : WXK_NONE;
+ wxWindowMac* peer = GetWXPeer();
+ if ( peer )
+ {
+ wxevent.SetEventObject(peer);
+ wxevent.SetId(peer->GetId());
+ }
+ result = GetWXPeer()->OSXHandleKeyEvent(wxevent) || result;
+ }
+ }
+ }
+ if ( !result )
{
wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, text);
}
}
+void wxWidgetCocoaImpl::doCommandBySelector(void* sel, WXWidget slf, void* _cmd)
+{
+ if ( m_lastKeyDownEvent!=NULL )
+ {
+ // If we have a corresponding key event, send wxEVT_KEY_DOWN now.
+ // (see also: wxWidgetCocoaImpl::DoHandleKeyEvent)
+ wxKeyEvent wxevent(wxEVT_KEY_DOWN);
+ SetupKeyEvent( wxevent, m_lastKeyDownEvent );
+ bool result = GetWXPeer()->OSXHandleKeyEvent(wxevent);
+
+ if (!result)
+ {
+ // Generate wxEVT_CHAR if wxEVT_KEY_DOWN is not handled.
+
+ long keycode = wxOSXTranslateCocoaKey( m_lastKeyDownEvent, wxEVT_CHAR );
+
+ wxKeyEvent wxevent2(wxevent) ;
+ wxevent2.SetEventType(wxEVT_CHAR);
+ SetupKeyEvent( wxevent2, m_lastKeyDownEvent );
+ if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START )
+ {
+ wxevent2.m_keyCode = keycode;
+ }
+ GetWXPeer()->OSXHandleKeyEvent(wxevent2);
+ }
+ }
+}
bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, void *_cmd)
{
@@ -2665,48 +2736,23 @@ bool wxWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event)
return true;
}
- bool result = GetWXPeer()->OSXHandleKeyEvent(wxevent);
-
- // this will fire higher level events, like insertText, to help
- // us handle EVT_CHAR, etc.
+ if ( IsUserPane() && [event type] == NSKeyDown)
+ {
+ // Don't fire wxEVT_KEY_DOWN here in order to allow IME to intercept
+ // some key events. If the event is not handled by IME, either
+ // insertText: or doCommandBySelector: is called, so we send
+ // wxEVT_KEY_DOWN and wxEVT_CHAR there.
- if ( !result )
+ if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
+ [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]];
+ else
+ [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
+ return true;
+ }
+ else
{
- if ( [event type] == NSKeyDown)
- {
- long keycode = wxOSXTranslateCocoaKey( event, wxEVT_CHAR );
-
- if ( (keycode > 0 && keycode < WXK_SPACE) || keycode == WXK_DELETE || keycode >= WXK_START )
- {
- // eventually we could setup a doCommandBySelector catcher and retransform this into the wx key chars
- wxKeyEvent wxevent2(wxevent) ;
- wxevent2.SetEventType(wxEVT_CHAR);
- SetupKeyEvent( wxevent2, event );
- wxevent2.m_keyCode = keycode;
- result = GetWXPeer()->OSXHandleKeyEvent(wxevent2);
- }
- else if (wxevent.CmdDown())
- {
- wxKeyEvent wxevent2(wxevent) ;
- wxevent2.SetEventType(wxEVT_CHAR);
- SetupKeyEvent( wxevent2, event );
- result = GetWXPeer()->OSXHandleKeyEvent(wxevent2);
- }
- else
- {
- if ( IsUserPane() && !wxevent.CmdDown() )
- {
- if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
- [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]];
- else
- [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
- result = true;
- }
- }
- }
+ return GetWXPeer()->OSXHandleKeyEvent(wxevent);
}
-
- return result;
}
bool wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent *event)
diff --git a/Externals/wxWidgets3/src/osx/core/bitmap.cpp b/Externals/wxWidgets3/src/osx/core/bitmap.cpp
index 2edc5ed..8ee6127 100644
--- a/Externals/wxWidgets3/src/osx/core/bitmap.cpp
+++ b/Externals/wxWidgets3/src/osx/core/bitmap.cpp
@@ -1225,8 +1225,6 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
{
UnRef();
- // XXX comex: how exactly is this supposed to work!? @2x support isn't used in this case
- /*
wxBitmapHandler *handler = FindHandler(type);
if ( handler )
@@ -1236,7 +1234,6 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
return handler->LoadFile(this, filename, type, -1, -1);
}
else
- */
{
#if wxUSE_IMAGE
double scale = 1.0;
diff --git a/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp b/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp
index e3e0752..37b22b5 100644
--- a/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp
+++ b/Externals/wxWidgets3/src/osx/core/evtloop_cf.cpp
@@ -71,14 +71,14 @@ wxCFEventLoopSource::~wxCFEventLoopSource()
void wxCFEventLoop::OSXCommonModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info)
{
wxCFEventLoop * eventloop = static_cast<wxCFEventLoop *>(info);
- if ( eventloop )
+ if ( eventloop && eventloop->IsRunning() )
eventloop->CommonModeObserverCallBack(observer, activity);
}
void wxCFEventLoop::OSXDefaultModeObserverCallBack(CFRunLoopObserverRef observer, int activity, void *info)
{
wxCFEventLoop * eventloop = static_cast<wxCFEventLoop *>(info);
- if ( eventloop )
+ if ( eventloop && eventloop->IsRunning() )
eventloop->DefaultModeObserverCallBack(observer, activity);
}
diff --git a/Externals/wxWidgets3/src/osx/core/fontenum.cpp b/Externals/wxWidgets3/src/osx/core/fontenum.cpp
index 658701b..74bf803 100644
--- a/Externals/wxWidgets3/src/osx/core/fontenum.cpp
+++ b/Externals/wxWidgets3/src/osx/core/fontenum.cpp
@@ -40,8 +40,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
wxArrayString fontFamilies ;
wxUint32 macEncoding = wxMacGetSystemEncFromFontEnc(encoding) ;
-
-#if wxOSX_USE_CORE_TEXT
+
{
CFArrayRef cfFontFamilies = nil;
@@ -127,7 +126,6 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
CFRelease(cfFontFamilies);
}
-#endif
for ( size_t i = 0 ; i < fontFamilies.Count() ; ++i )
{
if ( OnFacename( fontFamilies[i] ) == false )
diff --git a/Externals/wxWidgets3/src/osx/core/sound.cpp b/Externals/wxWidgets3/src/osx/core/sound.cpp
index 815ba16..cc6185a 100644
--- a/Externals/wxWidgets3/src/osx/core/sound.cpp
+++ b/Externals/wxWidgets3/src/osx/core/sound.cpp
@@ -50,7 +50,7 @@ protected:
};
wxOSXAudioToolboxSoundData::wxOSXAudioToolboxSoundData(const wxString& fileName) :
- m_soundID(0)
+ m_soundID(NULL)
{
m_sndname = fileName;
}
diff --git a/Externals/wxWidgets3/src/osx/iphone/evtloop.mm b/Externals/wxWidgets3/src/osx/iphone/evtloop.mm
index f928274..4e179b6 100644
--- a/Externals/wxWidgets3/src/osx/iphone/evtloop.mm
+++ b/Externals/wxWidgets3/src/osx/iphone/evtloop.mm
@@ -54,10 +54,8 @@ static int CalculateUIEventMaskFromEventCategory(wxEventCategory cat)
NSMouseEnteredMask = 1 << NSMouseEntered,
NSMouseExitedMask = 1 << NSMouseExited,
NSScrollWheelMask = 1 << NSScrollWheel,
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
NSTabletPointMask = 1 << NSTabletPoint,
NSTabletProximityMask = 1 << NSTabletProximity,
-#endif
NSOtherMouseDownMask = 1 << NSOtherMouseDown,
NSOtherMouseUpMask = 1 << NSOtherMouseUp,
NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged,
diff --git a/Externals/wxWidgets3/src/osx/menu_osx.cpp b/Externals/wxWidgets3/src/osx/menu_osx.cpp
index 2bf5ced..97685d3 100644
--- a/Externals/wxWidgets3/src/osx/menu_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/menu_osx.cpp
@@ -588,76 +588,67 @@ wxMenu* emptyMenuBar = NULL;
const int firstMenuPos = 1; // to account for the 0th application menu on mac
-void wxMenuBar::Init()
+static wxMenu *CreateAppleMenu()
{
- if ( emptyMenuBar == NULL )
- {
- emptyMenuBar = new wxMenu();
-
- wxMenu* appleMenu = new wxMenu();
- appleMenu->SetAllowRearrange(false);
-#if !wxOSX_USE_CARBON
- // standard menu items, handled in wxMenu::HandleCommandProcess(), see above:
- wxString hideLabel;
- hideLabel = wxString::Format(_("Hide %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application"));
- appleMenu->Append( wxID_OSX_HIDE, hideLabel + "\tCtrl+H" );
- appleMenu->Append( wxID_OSX_HIDEOTHERS, _("Hide Others")+"\tAlt+Ctrl+H" );
- appleMenu->Append( wxID_OSX_SHOWALL, _("Show All") );
- appleMenu->AppendSeparator();
-
- // Do always add "Quit" item unconditionally however, it can't be disabled.
- wxString quitLabel;
- quitLabel = wxString::Format(_("Quit %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application"));
- appleMenu->Append( wxApp::s_macExitMenuItemId, quitLabel + "\tCtrl+Q" );
-#endif // !wxOSX_USE_CARBON
-
- emptyMenuBar->AppendSubMenu(appleMenu, "\x14") ;
- }
-
- m_eventHandler = this;
- m_menuBarFrame = NULL;
- m_rootMenu = new wxMenu();
- m_rootMenu->Attach(this);
-
- m_appleMenu = new wxMenu();
- m_appleMenu->SetAllowRearrange(false);
+ wxMenu *appleMenu = new wxMenu();
+ appleMenu->SetAllowRearrange(false);
// Create standard items unless the application explicitly disabled this by
// setting the corresponding ids to wxID_NONE: although this is not
// recommended, sometimes these items really don't make sense.
if ( wxApp::s_macAboutMenuItemId != wxID_NONE )
{
- wxString aboutLabel(_("About"));
+ wxString aboutLabel;
if ( wxTheApp )
- aboutLabel << ' ' << wxTheApp->GetAppDisplayName();
+ aboutLabel.Printf(_("About %s"), wxTheApp->GetAppDisplayName());
else
- aboutLabel << "...";
- m_appleMenu->Append( wxApp::s_macAboutMenuItemId, aboutLabel);
- m_appleMenu->AppendSeparator();
+ aboutLabel = _("About...");
+ appleMenu->Append( wxApp::s_macAboutMenuItemId, aboutLabel);
+ appleMenu->AppendSeparator();
}
#if !wxOSX_USE_CARBON
if ( wxApp::s_macPreferencesMenuItemId != wxID_NONE )
{
- m_appleMenu->Append( wxApp::s_macPreferencesMenuItemId,
- _("Preferences...") + "\tCtrl+," );
- m_appleMenu->AppendSeparator();
+ appleMenu->Append( wxApp::s_macPreferencesMenuItemId,
+ _("Preferences...") + "\tCtrl+," );
+ appleMenu->AppendSeparator();
}
+ appleMenu->Append(wxID_OSX_SERVICES, _("Services"), new wxMenu());
+ appleMenu->AppendSeparator();
+
// standard menu items, handled in wxMenu::HandleCommandProcess(), see above:
wxString hideLabel;
hideLabel = wxString::Format(_("Hide %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application"));
- m_appleMenu->Append( wxID_OSX_HIDE, hideLabel + "\tCtrl+H" );
- m_appleMenu->Append( wxID_OSX_HIDEOTHERS, _("Hide Others")+"\tAlt+Ctrl+H" );
- m_appleMenu->Append( wxID_OSX_SHOWALL, _("Show All") );
- m_appleMenu->AppendSeparator();
+ appleMenu->Append( wxID_OSX_HIDE, hideLabel + "\tCtrl+H" );
+ appleMenu->Append( wxID_OSX_HIDEOTHERS, _("Hide Others")+"\tAlt+Ctrl+H" );
+ appleMenu->Append( wxID_OSX_SHOWALL, _("Show All") );
+ appleMenu->AppendSeparator();
// Do always add "Quit" item unconditionally however, it can't be disabled.
wxString quitLabel;
quitLabel = wxString::Format(_("Quit %s"), wxTheApp ? wxTheApp->GetAppDisplayName() : _("Application"));
- m_appleMenu->Append( wxApp::s_macExitMenuItemId, quitLabel + "\tCtrl+Q" );
+ appleMenu->Append( wxApp::s_macExitMenuItemId, quitLabel + "\tCtrl+Q" );
#endif // !wxOSX_USE_CARBON
+ return appleMenu;
+}
+
+void wxMenuBar::Init()
+{
+ if ( emptyMenuBar == NULL )
+ {
+ emptyMenuBar = new wxMenu();
+ emptyMenuBar->AppendSubMenu(CreateAppleMenu(), "\x14") ;
+ }
+
+ m_eventHandler = this;
+ m_menuBarFrame = NULL;
+ m_rootMenu = new wxMenu();
+ m_rootMenu->Attach(this);
+
+ m_appleMenu = CreateAppleMenu();
m_rootMenu->AppendSubMenu(m_appleMenu, "\x14") ;
}
diff --git a/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp b/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp
index 9e7f1e1..0e57c7f 100644
--- a/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/nonownedwnd_osx.cpp
@@ -496,10 +496,12 @@ WXWindow wxNonOwnedWindow::GetWXWindow() const
return m_nowpeer ? m_nowpeer->GetWXWindow() : NULL;
}
+#if wxOSX_USE_COCOA_OR_IPHONE
void *wxNonOwnedWindow::OSXGetViewOrWindow() const
{
return GetWXWindow();
}
+#endif
// ---------------------------------------------------------------------------
// Shape implementation
diff --git a/Externals/wxWidgets3/src/osx/radiobox_osx.cpp b/Externals/wxWidgets3/src/osx/radiobox_osx.cpp
index d728bd8..2aba6e1 100644
--- a/Externals/wxWidgets3/src/osx/radiobox_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/radiobox_osx.cpp
@@ -432,7 +432,13 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
totHeight = GetRowCount() * maxHeight + (GetRowCount() - 1) * space;
totWidth = GetColumnCount() * (maxWidth + charWidth);
- wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
+ // Determine the full size in case we need to use it as fallback.
+ wxSize sz;
+ if ( (width == wxDefaultCoord && (sizeFlags & wxSIZE_AUTO_WIDTH)) ||
+ (height == wxDefaultCoord && (sizeFlags & wxSIZE_AUTO_HEIGHT)) )
+ {
+ sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
+ }
// change the width / height only when specified
if ( width == wxDefaultCoord )
@@ -453,6 +459,11 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
wxControl::DoSetSize( x_offset, y_offset, width, height, wxSIZE_AUTO );
+ // But now recompute the full size again because it could have changed.
+ // This notably happens if the previous full size was too small to fully
+ // fit the box margins.
+ sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
+
// arrange radio buttons
int x_start, y_start;
diff --git a/Externals/wxWidgets3/src/osx/textctrl_osx.cpp b/Externals/wxWidgets3/src/osx/textctrl_osx.cpp
index dcfc0e1..08346e5 100644
--- a/Externals/wxWidgets3/src/osx/textctrl_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/textctrl_osx.cpp
@@ -599,21 +599,6 @@ bool wxTextCtrl::MacSetupCursor( const wxPoint& pt )
return true ;
}
-bool wxTextCtrl::SetHint(const wxString& hint)
-{
- m_hintString = hint;
-
- if ( GetTextPeer() && GetTextPeer()->SetHint(hint) )
- return true;
-
- return false;
-}
-
-wxString wxTextCtrl::GetHint() const
-{
- return m_hintString;
-}
-
// ----------------------------------------------------------------------------
// implementation base class
// ----------------------------------------------------------------------------
diff --git a/Externals/wxWidgets3/src/osx/textentry_osx.cpp b/Externals/wxWidgets3/src/osx/textentry_osx.cpp
index 67a858e..8a1466b 100644
--- a/Externals/wxWidgets3/src/osx/textentry_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/textentry_osx.cpp
@@ -287,6 +287,18 @@ wxTextWidgetImpl * wxTextEntry::GetTextPeer() const
return win ? dynamic_cast<wxTextWidgetImpl *>(win->GetPeer()) : NULL;
}
+bool wxTextEntry::SetHint(const wxString& hint)
+{
+ m_hintString = hint;
+ return GetTextPeer() && GetTextPeer()->SetHint(hint);
+}
+
+wxString wxTextEntry::GetHint() const
+{
+ return m_hintString;
+}
+
+
// ----------------------------------------------------------------------------
// Auto-completion
// ----------------------------------------------------------------------------
diff --git a/Externals/wxWidgets3/src/osx/webview_webkit.mm b/Externals/wxWidgets3/src/osx/webview_webkit.mm
index a311bb3..ab75865 100644
--- a/Externals/wxWidgets3/src/osx/webview_webkit.mm
+++ b/Externals/wxWidgets3/src/osx/webview_webkit.mm
@@ -351,10 +351,7 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
m_webView = (WebView*) HIWebViewGetWebView( peer->GetControlRef() );
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- if ( UMAGetSystemVersion() >= 0x1030 )
- HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
-#endif
+ HIViewChangeFeatures( peer->GetControlRef() , kHIViewIsOpaque , 0 ) ;
InstallControlEventHandler(peer->GetControlRef(),
GetwxWebViewWebKitEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
@@ -495,18 +492,18 @@ wxString wxWebViewWebKit::GetPageSource() const
{
if (CanGetPageSource())
- {
+ {
WebDataSource* dataSource = [[m_webView mainFrame] dataSource];
- wxASSERT (dataSource != nil);
+ wxASSERT (dataSource != nil);
- id<WebDocumentRepresentation> representation = [dataSource representation];
- wxASSERT (representation != nil);
+ id<WebDocumentRepresentation> representation = [dataSource representation];
+ wxASSERT (representation != nil);
- NSString* source = [representation documentSource];
- if (source == nil)
- {
- return wxEmptyString;
- }
+ NSString* source = [representation documentSource];
+ if (source == nil)
+ {
+ return wxEmptyString;
+ }
return wxStringWithNSString( source );
}
@@ -1074,9 +1071,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
case NSURLErrorResourceUnavailable:
case NSURLErrorHTTPTooManyRedirects:
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
case NSURLErrorDataLengthExceedsMaximum:
-#endif
case NSURLErrorBadURL:
case NSURLErrorFileIsDirectory:
*out = wxWEBVIEW_NAV_ERR_REQUEST;
@@ -1098,11 +1093,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
*out = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
break;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
case NSURLErrorCannotDecodeRawData:
case NSURLErrorCannotDecodeContentData:
case NSURLErrorCannotParseResponse:
-#endif
case NSURLErrorBadServerResponse:
*out = wxWEBVIEW_NAV_ERR_REQUEST;
break;
@@ -1116,7 +1109,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
break;
case NSURLErrorNoPermissionsToReadFile:
- *out = wxWEBVIEW_NAV_ERR_SECURITY;
+ *out = wxWEBVIEW_NAV_ERR_SECURITY;
break;
case NSURLErrorServerCertificateHasBadDate:
@@ -1148,17 +1141,17 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
wxWebViewNavigationError type;
wxString description = nsErrorToWxHtmlError(error, &type);
- wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
- webKitWindow->GetId(),
+ wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
+ webKitWindow->GetId(),
wxStringWithNSString( url ),
wxEmptyString);
- event.SetString(description);
- event.SetInt(type);
+ event.SetString(description);
+ event.SetInt(type);
- if (webKitWindow && webKitWindow->GetEventHandler())
- {
- webKitWindow->GetEventHandler()->ProcessEvent(event);
- }
+ if (webKitWindow && webKitWindow->GetEventHandler())
+ {
+ webKitWindow->GetEventHandler()->ProcessEvent(event);
+ }
}
}
@@ -1172,17 +1165,17 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
NSString *url = [[[[frame provisionalDataSource] request] URL]
absoluteString];
- wxWebViewNavigationError type;
+ wxWebViewNavigationError type;
wxString description = nsErrorToWxHtmlError(error, &type);
- wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
- webKitWindow->GetId(),
+ wxWebViewEvent event(wxEVT_WEBVIEW_ERROR,
+ webKitWindow->GetId(),
wxStringWithNSString( url ),
wxEmptyString);
- event.SetString(description);
- event.SetInt(type);
+ event.SetString(description);
+ event.SetInt(type);
- if (webKitWindow && webKitWindow->GetEventHandler())
- webKitWindow->GetEventHandler()->ProcessEvent(event);
+ if (webKitWindow && webKitWindow->GetEventHandler())
+ webKitWindow->GetEventHandler()->ProcessEvent(event);
}
}
@@ -1275,7 +1268,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
}
}
- return NO;
+ return NO;
}
+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
@@ -1287,7 +1280,7 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
- (void)startLoading
{
NSURLRequest *request = [self request];
- NSString* path = [[request URL] absoluteString];
+ NSString* path = [[request URL] absoluteString];
id<NSURLProtocolClient> client = [self client];
@@ -1310,9 +1303,9 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:[request URL]
- MIMEType:wxNSStringWithWxString(file->GetMimeType())
- expectedContentLength:length
- textEncodingName:nil];
+ MIMEType:wxNSStringWithWxString(file->GetMimeType())
+ expectedContentLength:length
+ textEncodingName:nil];
//Load the data, we malloc it so it is tidied up properly
void* buffer = malloc(length);
@@ -1320,16 +1313,16 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out)
NSData *data = [[NSData alloc] initWithBytesNoCopy:buffer length:length];
//We do not support caching anything yet
- [client URLProtocol:self didReceiveResponse:response
+ [client URLProtocol:self didReceiveResponse:response
cacheStoragePolicy:NSURLCacheStorageNotAllowed];
//Set the data
- [client URLProtocol:self didLoadData:data];
+ [client URLProtocol:self didLoadData:data];
- //Notify that we have finished
- [client URLProtocolDidFinishLoading:self];
+ //Notify that we have finished
+ [client URLProtocolDidFinishLoading:self];
- [response release];
+ [response release];
}
- (void)stopLoading
diff --git a/Externals/wxWidgets3/src/osx/window_osx.cpp b/Externals/wxWidgets3/src/osx/window_osx.cpp
index afbf5a0..0f8f921 100644
--- a/Externals/wxWidgets3/src/osx/window_osx.cpp
+++ b/Externals/wxWidgets3/src/osx/window_osx.cpp
@@ -39,6 +39,7 @@
#include "wx/tooltip.h"
#include "wx/spinctrl.h"
#include "wx/geometry.h"
+#include "wx/weakref.h"
#if wxUSE_LISTCTRL
#include "wx/listctrl.h"
@@ -610,7 +611,7 @@ void wxWindowMac::SetFocus()
void wxWindowMac::OSXSimulateFocusEvents()
{
- wxWindow* former = FindFocus() ;
+ wxWeakRef<wxWindow> former = FindFocus() ;
if ( former != NULL && former != this )
{
{
@@ -620,6 +621,9 @@ void wxWindowMac::OSXSimulateFocusEvents()
former->HandleWindowEvent(event) ;
}
+ // 'former' could have been destroyed by a wxEVT_KILL_FOCUS handler,
+ // so we must test it for non-NULL again
+ if ( former )
{
wxFocusEvent event(wxEVT_SET_FOCUS, former->GetId());
event.SetEventObject(former);
@@ -2545,10 +2549,12 @@ bool wxWindowMac::OSXHandleClicked( double WXUNUSED(timestampsec) )
return false;
}
+#if wxOSX_USE_COCOA_OR_IPHONE
void *wxWindowMac::OSXGetViewOrWindow() const
{
return GetHandle();
}
+#endif
wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
{
diff --git a/Externals/wxWidgets3/src/unix/displayx11.cpp b/Externals/wxWidgets3/src/unix/displayx11.cpp
index 87dedfc..51f1335 100644
--- a/Externals/wxWidgets3/src/unix/displayx11.cpp
+++ b/Externals/wxWidgets3/src/unix/displayx11.cpp
@@ -231,14 +231,14 @@ wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n)
// Correct res rate from GLFW
#define wxCRR2(v,dc) (int) (((1000.0f * (float) dc) /*PIXELS PER SECOND */) / ((float) v.htotal * v.vtotal /*PIXELS PER FRAME*/) + 0.5f)
#define wxCRR(v) wxCRR2(v,v.dotclock)
-#define wxCVM2(v, dc) wxVideoMode(v.hdisplay, v.vdisplay, DefaultDepth((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay())), wxCRR2(v,dc))
-#define wxCVM(v) wxCVM2(v, v.dotclock)
+#define wxCVM2(v, dc, display, nScreen) wxVideoMode(v.hdisplay, v.vdisplay, DefaultDepth(display, nScreen), wxCRR2(v,dc))
+#define wxCVM(v, display, nScreen) wxCVM2(v, v.dotclock, display, nScreen)
wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& mode) const
{
//Convenience...
- Display* pDisplay = (Display*) wxGetDisplay(); //default display
- int nScreen = DefaultScreen(pDisplay); //default screen of (default) display...
+ Display* display = (Display*) wxGetDisplay(); //default display
+ int nScreen = DefaultScreen(display); //default screen of (default) display...
//Some variables..
XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :))
@@ -246,16 +246,17 @@ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& mode) const
wxArrayVideoModes Modes; //modes to return...
- if (XF86VidModeGetAllModeLines(pDisplay, nScreen, &nNumModes, &ppXModes) == TRUE)
+ if (XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes))
{
for (int i = 0; i < nNumModes; ++i)
{
- if (mode == wxDefaultVideoMode || //According to display.h All modes valid if dafault mode...
- mode.Matches(wxCVM((*ppXModes[i]))) ) //...?
+ XF86VidModeModeInfo& info = *ppXModes[i];
+ const wxVideoMode vm = wxCVM(info, display, nScreen);
+ if (vm.Matches(mode))
{
- Modes.Add(wxCVM((*ppXModes[i])));
+ Modes.Add(vm);
}
- wxClearXVM((*ppXModes[i]));
+ wxClearXVM(info);
// XFree(ppXModes[i]); //supposed to free?
}
XFree(ppXModes);
@@ -270,20 +271,23 @@ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& mode) const
wxVideoMode wxDisplayImplX11::GetCurrentMode() const
{
+ Display* display = static_cast<Display*>(wxGetDisplay());
+ int nScreen = DefaultScreen(display);
XF86VidModeModeLine VM;
int nDotClock;
- XF86VidModeGetModeLine((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
- &nDotClock, &VM);
+ XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM);
wxClearXVM(VM);
- return wxCVM2(VM, nDotClock);
+ return wxCVM2(VM, nDotClock, display, nScreen);
}
bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode)
{
+ Display* display = static_cast<Display*>(wxGetDisplay());
+ int nScreen = DefaultScreen(display);
XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :))
int nNumModes; //Number of modes enumerated....
- if( !XF86VidModeGetAllModeLines((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()), &nNumModes, &ppXModes) )
+ if(!XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes))
{
wxLogSysError(_("Failed to change video mode"));
return false;
@@ -292,8 +296,7 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode)
bool bRet = false;
if (mode == wxDefaultVideoMode)
{
- bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
- ppXModes[0]) == TRUE;
+ bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[0]) != 0;
for (int i = 0; i < nNumModes; ++i)
{
@@ -311,8 +314,7 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode)
wxCRR((*ppXModes[i])) == mode.GetRefresh())
{
//switch!
- bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
- ppXModes[i]) == TRUE;
+ bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[i]) != 0;
}
wxClearXVM((*ppXModes[i]));
// XFree(ppXModes[i]); //supposed to free?
@@ -324,7 +326,6 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode)
return bRet;
}
-
#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H
wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const
@@ -339,7 +340,7 @@ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const
wxVideoMode mode(m_rect.GetWidth(), m_rect.GetHeight(), depths[x]);
if ( mode.Matches(modeMatch) )
{
- modes.Add(modeMatch);
+ modes.Add(mode);
}
}
diff --git a/Externals/wxWidgets3/src/unix/dlunix.cpp b/Externals/wxWidgets3/src/unix/dlunix.cpp
index 881ea77..74c2277 100644
--- a/Externals/wxWidgets3/src/unix/dlunix.cpp
+++ b/Externals/wxWidgets3/src/unix/dlunix.cpp
@@ -64,171 +64,6 @@
// constants
// ----------------------------------------------------------------------------
-// ============================================================================
-// wxDynamicLibrary implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// dlxxx() emulation for Darwin
-// Only useful if the OS X version could be < 10.3 at runtime
-// ----------------------------------------------------------------------------
-
-#if defined(__DARWIN__) && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3)
-// ---------------------------------------------------------------------------
-// For Darwin/Mac OS X
-// supply the sun style dlopen functions in terms of Darwin NS*
-// ---------------------------------------------------------------------------
-
-/* Porting notes:
- * The dlopen port is a port from dl_next.xs by Anno Siegel.
- * dl_next.xs is itself a port from dl_dlopen.xs by Paul Marquess.
- * The method used here is just to supply the sun style dlopen etc.
- * functions in terms of Darwin NS*.
- */
-
-#include <stdio.h>
-#include <mach-o/dyld.h>
-
-static char dl_last_error[1024];
-
-static const char *wx_darwin_dlerror()
-{
- return dl_last_error;
-}
-
-static void *wx_darwin_dlopen(const char *path, int WXUNUSED(mode) /* mode is ignored */)
-{
- NSObjectFileImage ofile;
- NSModule handle = NULL;
-
- unsigned dyld_result = NSCreateObjectFileImageFromFile(path, &ofile);
- if ( dyld_result != NSObjectFileImageSuccess )
- {
- handle = NULL;
-
- static const char *const errorStrings[] =
- {
- "%d: Object Image Load Failure",
- "%d: Object Image Load Success",
- "%d: Not an recognisable object file",
- "%d: No valid architecture",
- "%d: Object image has an invalid format",
- "%d: Invalid access (permissions?)",
- "%d: Unknown error code from NSCreateObjectFileImageFromFile"
- };
-
- const int index = dyld_result < WXSIZEOF(errorStrings)
- ? dyld_result
- : WXSIZEOF(errorStrings) - 1;
-
- // this call to sprintf() is safe as strings above are fixed at
- // compile-time and are shorter than WXSIZEOF(dl_last_error)
- sprintf(dl_last_error, errorStrings[index], dyld_result);
- }
- else
- {
- handle = NSLinkModule
- (
- ofile,
- path,
- NSLINKMODULE_OPTION_BINDNOW |
- NSLINKMODULE_OPTION_RETURN_ON_ERROR
- );
-
- if ( !handle )
- {
- NSLinkEditErrors err;
- int code;
- const char *filename;
- const char *errmsg;
-
- NSLinkEditError(&err, &code, &filename, &errmsg);
- strncpy(dl_last_error, errmsg, WXSIZEOF(dl_last_error)-1);
- dl_last_error[WXSIZEOF(dl_last_error)-1] = '\0';
- }
- }
-
-
- return handle;
-}
-
-static int wx_darwin_dlclose(void *handle)
-{
- NSUnLinkModule((NSModule)handle, NSUNLINKMODULE_OPTION_NONE);
- return 0;
-}
-
-static void *wx_darwin_dlsym(void *handle, const char *symbol)
-{
- // as on many other systems, C symbols have prepended underscores under
- // Darwin but unlike the normal dlopen(), NSLookupSymbolInModule() is not
- // aware of this
- wxCharBuffer buf(strlen(symbol) + 1);
- char *p = buf.data();
- p[0] = '_';
- strcpy(p + 1, symbol);
-
- NSSymbol nsSymbol = NSLookupSymbolInModule((NSModule)handle, p );
- return nsSymbol ? NSAddressOfSymbol(nsSymbol) : NULL;
-}
-
-// Add the weak linking attribute to dlopen's declaration
-extern void * dlopen(const char * __path, int __mode) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
-
-// For all of these methods we test dlopen since all of the dl functions we use were added
-// to OS X at the same time. This also ensures we don't dlopen with the real function then
-// dlclose with the internal implementation.
-
-static inline void *wx_dlopen(const char *__path, int __mode)
-{
-#ifdef HAVE_DLOPEN
- if(&dlopen != NULL)
- return dlopen(__path, __mode);
- else
-#endif
- return wx_darwin_dlopen(__path, __mode);
-}
-
-static inline int wx_dlclose(void *__handle)
-{
-#ifdef HAVE_DLOPEN
- if(&dlopen != NULL)
- return dlclose(__handle);
- else
-#endif
- return wx_darwin_dlclose(__handle);
-}
-
-static inline const char *wx_dlerror()
-{
-#ifdef HAVE_DLOPEN
- if(&dlopen != NULL)
- return dlerror();
- else
-#endif
- return wx_darwin_dlerror();
-}
-
-static inline void *wx_dlsym(void *__handle, const char *__symbol)
-{
-#ifdef HAVE_DLOPEN
- if(&dlopen != NULL)
- return dlsym(__handle, __symbol);
- else
-#endif
- return wx_darwin_dlsym(__handle, __symbol);
-}
-
-#else // __DARWIN__/!__DARWIN__
-
-// Use preprocessor definitions for non-Darwin or OS X >= 10.3
-#define wx_dlopen(__path,__mode) dlopen(__path,__mode)
-#define wx_dlclose(__handle) dlclose(__handle)
-#define wx_dlerror() dlerror()
-#define wx_dlsym(__handle,__symbol) dlsym(__handle,__symbol)
-
-#endif // defined(__DARWIN__)
-
// ----------------------------------------------------------------------------
// loading/unloading DLLs
// ----------------------------------------------------------------------------
@@ -236,7 +71,7 @@ static inline void *wx_dlsym(void *__handle, const char *__symbol)
wxDllType wxDynamicLibrary::GetProgramHandle()
{
#ifdef USE_POSIX_DL_FUNCS
- return wx_dlopen(0, RTLD_LAZY);
+ return dlopen(0, RTLD_LAZY);
#else
return PROG_HANDLE;
#endif
@@ -257,7 +92,7 @@ wxDllType wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
if ( flags & wxDL_GLOBAL )
rtldFlags |= RTLD_GLOBAL;
- return wx_dlopen(libname.fn_str(), rtldFlags);
+ return dlopen(libname.fn_str(), rtldFlags);
#else // !USE_POSIX_DL_FUNCS
int shlFlags = 0;
@@ -282,7 +117,7 @@ void wxDynamicLibrary::Unload(wxDllType handle)
#endif
#ifdef USE_POSIX_DL_FUNCS
- wx_dlclose(handle);
+ dlclose(handle);
#else // !USE_POSIX_DL_FUNCS
shl_unload(handle);
#endif // USE_POSIX_DL_FUNCS/!USE_POSIX_DL_FUNCS
@@ -299,7 +134,7 @@ void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
void *symbol;
#ifdef USE_POSIX_DL_FUNCS
- symbol = wx_dlsym(handle, name.fn_str());
+ symbol = dlsym(handle, name.fn_str());
#else // !USE_POSIX_DL_FUNCS
// note that shl_findsym modifies the handle argument to indicate where the
// symbol was found, but it's ok to modify the local handle copy here
@@ -319,7 +154,7 @@ void *wxDynamicLibrary::RawGetSymbol(wxDllType handle, const wxString& name)
/* static */
void wxDynamicLibrary::Error()
{
- wxString err(wx_dlerror());
+ wxString err(dlerror());
if ( err.empty() )
err = _("Unknown dynamic library error");
diff --git a/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp b/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp
index 117a036..694beec 100644
--- a/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp
+++ b/Externals/wxWidgets3/src/unix/fswatcher_inotify.cpp
@@ -256,6 +256,7 @@ protected:
event
(
wxFSW_EVENT_WARNING,
+ wxFSW_WARNING_GENERAL,
wxString::Format
(
_("Unexpected event for \"%s\": no "
@@ -279,8 +280,19 @@ protected:
// check out for error/warning condition
if (flags & wxFSW_EVENT_WARNING || flags & wxFSW_EVENT_ERROR)
{
- wxString errMsg = GetErrorDescription(nativeFlags);
- wxFileSystemWatcherEvent event(flags, errMsg);
+ wxFSWWarningType warningType;
+ if ( flags & wxFSW_EVENT_WARNING )
+ {
+ warningType = nativeFlags & IN_Q_OVERFLOW
+ ? wxFSW_WARNING_OVERFLOW
+ : wxFSW_WARNING_GENERAL;
+ }
+ else // It's an error, not a warning.
+ {
+ warningType = wxFSW_WARNING_NONE;
+ }
+
+ wxFileSystemWatcherEvent event(flags, warningType);
SendEvent(event);
return;
}
@@ -293,6 +305,7 @@ protected:
event
(
wxFSW_EVENT_WARNING,
+ wxFSW_WARNING_GENERAL,
wxString::Format
(
_("Invalid inotify event for \"%s\""),
@@ -628,22 +641,6 @@ protected:
return -1;
}
- /**
- * Returns error description for specified inotify mask
- */
- static const wxString GetErrorDescription(int flag)
- {
- switch ( flag )
- {
- case IN_Q_OVERFLOW:
- return _("Event queue overflowed");
- }
-
- // never reached
- wxFAIL_MSG(wxString::Format("Unknown inotify event mask %u", flag));
- return wxEmptyString;
- }
-
wxFSWSourceHandler* m_handler; // handler for inotify event source
wxFSWatchEntryDescriptors m_watchMap; // inotify wd=>wxFSWatchEntry* map
wxArrayInt m_staleDescriptors; // stores recently-removed watches
diff --git a/Externals/wxWidgets3/src/unix/utilsunx.cpp b/Externals/wxWidgets3/src/unix/utilsunx.cpp
index 98548a2..450966d 100644
--- a/Externals/wxWidgets3/src/unix/utilsunx.cpp
+++ b/Externals/wxWidgets3/src/unix/utilsunx.cpp
@@ -627,7 +627,7 @@ long wxExecute(char **argv, int flags, wxProcess *process,
// 1. wxPRIORITY_{MIN,DEFAULT,MAX} map to -20, 0 and 19 respectively.
// 2. The mapping is monotonously increasing.
// 3. The mapping is onto the target range.
- int prio = process ? process->GetPriority() : 0;
+ int prio = process ? int(process->GetPriority()) : int(wxPRIORITY_DEFAULT);
if ( prio <= 50 )
prio = (2*prio)/5 - 20;
else if ( prio < 55 )
@@ -697,6 +697,7 @@ long wxExecute(char **argv, int flags, wxProcess *process,
// the descriptors do not need to be closed but for now this is better
// than never closing them at all as wx code never used FD_CLOEXEC.
+#ifdef __DARWIN__
// TODO: Iterating up to FD_SETSIZE is both inefficient (because it may
// be quite big) and incorrect (because in principle we could
// have more opened descriptions than this number). Unfortunately
@@ -704,6 +705,14 @@ long wxExecute(char **argv, int flags, wxProcess *process,
// above a certain threshold but non-portable solutions exist for
// most platforms, see [http://stackoverflow.com/questions/899038/
// getting-the-highest-allocated-file-descriptor]
+ //
+ // Unfortunately, we cannot do this safely on OS X, because libdispatch
+ // may crash when we do this:
+ // Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
+ // Exception Codes: 0x0000000000000001, 0x0000000000000000
+ //
+ // Application Specific Information:
+ // BUG IN CLIENT OF LIBDISPATCH: Do not close random Unix descriptors
for ( int fd = 0; fd < (int)FD_SETSIZE; ++fd )
{
if ( fd != STDIN_FILENO &&
@@ -713,6 +722,7 @@ long wxExecute(char **argv, int flags, wxProcess *process,
close(fd);
}
}
+#endif // !__DARWIN__
// Process additional options if we have any