From 4c0b91985141846bb1db4c97d8992dee89a233fd Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:40:09 +0200 Subject: [PATCH 001/231] Make wxToolBar::Init() private in wxQt No real changes, just keep private method out of the public part. --- include/wx/qt/toolbar.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index 850ef5eb67..9df7555e80 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -32,7 +32,6 @@ public: virtual ~wxToolBar(); - void Init(); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -69,6 +68,8 @@ protected: virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) wxOVERRIDE; private: + void Init(); + long GetButtonStyle(); QToolBar *m_qtToolBar; From 019cf6e6f06dbd435f9d05aab7f82baaf6a51a12 Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:49:53 +0200 Subject: [PATCH 002/231] Move wxComboBox::Clear() out of line in wxQt No real changes. --- include/wx/qt/combobox.h | 6 +----- src/qt/combobox.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h index b2fe23d305..4daf97c90c 100644 --- a/include/wx/qt/combobox.h +++ b/include/wx/qt/combobox.h @@ -63,11 +63,7 @@ public: return wxItemContainer::GetStringSelection(); } - virtual void Clear() wxOVERRIDE - { - wxTextEntry::Clear(); - wxItemContainer::Clear(); - } + virtual void Clear() wxOVERRIDE; // See wxComboBoxBase discussion of IsEmpty(). bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } diff --git a/src/qt/combobox.cpp b/src/qt/combobox.cpp index 67757fd2ee..9fd3308f5e 100644 --- a/src/qt/combobox.cpp +++ b/src/qt/combobox.cpp @@ -133,6 +133,12 @@ void wxComboBox::Dismiss() static_cast(GetHandle())->hidePopup(); } +void wxComboBox::Clear() +{ + wxTextEntry::Clear(); + wxItemContainer::Clear(); +} + void wxComboBox::SetSelection( long from, long to ) { // SelectAll uses -1 to -1, adjust for qt: From fd7f4dfe3de3ce6b9d25e6a78eecc8d58a0041ca Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:50:21 +0200 Subject: [PATCH 003/231] Implement wxComboBox::SetValue() in wxQt Make setting combobox value work. --- include/wx/qt/combobox.h | 2 ++ src/qt/combobox.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h index 4daf97c90c..490e2cb117 100644 --- a/include/wx/qt/combobox.h +++ b/include/wx/qt/combobox.h @@ -69,6 +69,8 @@ public: bool IsListEmpty() const { return wxItemContainer::IsEmpty(); } bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); } + virtual void SetValue(const wxString& value) wxOVERRIDE; + virtual void Popup(); virtual void Dismiss(); diff --git a/src/qt/combobox.cpp b/src/qt/combobox.cpp index 9fd3308f5e..14af9eb2d9 100644 --- a/src/qt/combobox.cpp +++ b/src/qt/combobox.cpp @@ -118,6 +118,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, return QtCreateControl( parent, id, pos, size, style, validator, name ); } +void wxComboBox::SetValue(const wxString& value) +{ + if ( HasFlag(wxCB_READONLY) ) + SetStringSelection(value); + else + wxTextEntry::SetValue(value); +} + wxString wxComboBox::DoGetValue() const { return wxQtConvertString( m_qtComboBox->currentText() ); From 13a96c586f7e41405cd2b7fcc4d1d80ed3de09d9 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 25 Sep 2018 15:20:37 +0200 Subject: [PATCH 004/231] macOS bitmap change info --- docs/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changes.txt b/docs/changes.txt index 3d97b8f6db..4f17402369 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -157,6 +157,7 @@ wxOSX: - Fix dispatching pending events (and CallAfter()) in console applications. - Implement wxDataViewColumn::UnsetAsSortKey() (Daniel Kulp). +- supporting native image formst like NSImage and UIImage in wxBitmap wxQt: From 19c4d8cf3e1e99909e75abcb3a901942299ce589 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 25 Sep 2018 15:22:56 +0200 Subject: [PATCH 005/231] macOS, iOS native implementation for wxStaticBitmap templated native images are not drawing correctly using the low-level drawing calls, therefore use the native Image Views --- Makefile.in | 84 +++++++++++++++++++++++---- build/bakefiles/files.bkl | 3 + build/cmake/files.cmake | 3 + build/files | 3 + include/wx/osx/cocoa/private.h | 1 - include/wx/osx/core/private.h | 1 + include/wx/osx/statbmp.h | 66 ++++++++++++++++++++- src/osx/cocoa/statbmp.mm | 101 +++++++++++++++++++++++++++++++++ src/osx/iphone/statbmp.mm | 101 +++++++++++++++++++++++++++++++++ src/osx/statbmp_osx.cpp | 66 +++++++++++++++++++++ 10 files changed, 414 insertions(+), 15 deletions(-) create mode 100644 src/osx/cocoa/statbmp.mm create mode 100644 src/osx/iphone/statbmp.mm create mode 100644 src/osx/statbmp_osx.cpp diff --git a/Makefile.in b/Makefile.in index d7bc3e8d99..342a4d4a29 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5605,7 +5605,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \ monodll_cocoa_dataview.o \ monodll_timectrl_osx.o \ monodll_taskbarcmn.o \ - monodll_cocoa_activityindicator.o + monodll_cocoa_activityindicator.o \ + monodll_cocoa_statbmp.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \ $(__OSX_COMMON_SRC_OBJECTS) \ @@ -5629,7 +5630,8 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \ monodll_iphone_settings.o \ monodll_sound_osx.o \ monodll_core_sound.o \ - monodll_animateg.o + monodll_animateg.o \ + monodll_iphone_statbmp.o @COND_TOOLKIT_OSX_IPHONE@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS) COND_TOOLKIT_QT___GUI_SRC_OBJECTS = \ monodll_taskbarcmn.o \ @@ -7568,7 +7570,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \ monolib_cocoa_dataview.o \ monolib_timectrl_osx.o \ monolib_taskbarcmn.o \ - monolib_cocoa_activityindicator.o + monolib_cocoa_activityindicator.o \ + monolib_cocoa_statbmp.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \ $(__OSX_COMMON_SRC_OBJECTS_0) \ @@ -7592,7 +7595,8 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \ monolib_iphone_settings.o \ monolib_sound_osx.o \ monolib_core_sound.o \ - monolib_animateg.o + monolib_animateg.o \ + monolib_iphone_statbmp.o @COND_TOOLKIT_OSX_IPHONE@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1) COND_TOOLKIT_QT___GUI_SRC_OBJECTS_1 = \ monolib_taskbarcmn.o \ @@ -9678,7 +9682,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \ coredll_cocoa_dataview.o \ coredll_timectrl_osx.o \ coredll_taskbarcmn.o \ - coredll_cocoa_activityindicator.o + coredll_cocoa_activityindicator.o \ + coredll_cocoa_statbmp.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \ $(__OSX_COMMON_SRC_OBJECTS_8) \ @@ -9702,7 +9707,8 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \ coredll_iphone_settings.o \ coredll_sound_osx.o \ coredll_core_sound.o \ - coredll_animateg.o + coredll_animateg.o \ + coredll_iphone_statbmp.o @COND_TOOLKIT_OSX_IPHONE@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2) COND_TOOLKIT_QT___GUI_SRC_OBJECTS_2 = \ coredll_taskbarcmn.o \ @@ -11383,7 +11389,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \ corelib_cocoa_dataview.o \ corelib_timectrl_osx.o \ corelib_taskbarcmn.o \ - corelib_cocoa_activityindicator.o + corelib_cocoa_activityindicator.o \ + corelib_cocoa_statbmp.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \ $(__OSX_COMMON_SRC_OBJECTS_9) \ @@ -11407,7 +11414,8 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \ corelib_iphone_settings.o \ corelib_sound_osx.o \ corelib_core_sound.o \ - corelib_animateg.o + corelib_animateg.o \ + corelib_iphone_statbmp.o @COND_TOOLKIT_OSX_IPHONE@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3) COND_TOOLKIT_QT___GUI_SRC_OBJECTS_3 = \ corelib_taskbarcmn.o \ @@ -13119,7 +13127,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \ monodll_prntdlgg.o \ monodll_generic_statusbr.o \ monodll_generic_textmeasure.o \ - monodll_generic_icon.o + monodll_generic_icon.o \ + monodll_statbmp_osx.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \ monodll_generic_caret.o \ @@ -13262,7 +13271,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \ monolib_prntdlgg.o \ monolib_generic_statusbr.o \ monolib_generic_textmeasure.o \ - monolib_generic_icon.o + monolib_generic_icon.o \ + monolib_statbmp_osx.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_0 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \ monolib_generic_caret.o \ @@ -13405,7 +13415,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \ coredll_prntdlgg.o \ coredll_generic_statusbr.o \ coredll_generic_textmeasure.o \ - coredll_generic_icon.o + coredll_generic_icon.o \ + coredll_statbmp_osx.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_8 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \ coredll_generic_caret.o \ @@ -13545,7 +13556,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \ corelib_prntdlgg.o \ corelib_generic_statusbr.o \ corelib_generic_textmeasure.o \ - corelib_generic_icon.o + corelib_generic_icon.o \ + corelib_statbmp_osx.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_9 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \ corelib_generic_caret.o \ @@ -16456,6 +16468,9 @@ monodll_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(MONODLL_ODEP) monodll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/activityindicator.mm +monodll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm + monodll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -16507,6 +16522,9 @@ monodll_iphone_window.o: $(srcdir)/src/osx/iphone/window.mm $(MONODLL_ODEP) monodll_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm +monodll_iphone_statbmp.o: $(srcdir)/src/osx/iphone/statbmp.mm $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/statbmp.mm + monodll_qt_accel.o: $(srcdir)/src/qt/accel.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/qt/accel.cpp @@ -20017,6 +20035,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_utilscocoa.o: $(srcdir)/src/osx/carbon/utilscocoa.mm $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/utilscocoa.mm +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(MONODLL_ODEP) @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp @@ -21694,6 +21718,9 @@ monolib_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(MONOLIB_ODEP) monolib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/activityindicator.mm +monolib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm + monolib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -21745,6 +21772,9 @@ monolib_iphone_window.o: $(srcdir)/src/osx/iphone/window.mm $(MONOLIB_ODEP) monolib_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm +monolib_iphone_statbmp.o: $(srcdir)/src/osx/iphone/statbmp.mm $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/statbmp.mm + monolib_qt_accel.o: $(srcdir)/src/qt/accel.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/qt/accel.cpp @@ -25255,6 +25285,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_utilscocoa.o: $(srcdir)/src/osx/carbon/utilscocoa.mm $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/utilscocoa.mm +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp @@ -27595,6 +27631,9 @@ coredll_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(COREDLL_ODEP) coredll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/activityindicator.mm +coredll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(COREDLL_ODEP) + $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm + coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -27649,6 +27688,9 @@ coredll_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(COREDLL_ODEP) coredll_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm +coredll_iphone_statbmp.o: $(srcdir)/src/osx/iphone/statbmp.mm $(COREDLL_ODEP) + $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/statbmp.mm + coredll_qt_accel.o: $(srcdir)/src/qt/accel.cpp $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/qt/accel.cpp @@ -30586,6 +30628,12 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_utilscocoa.o: $(srcdir)/src/osx/carbon/utilscocoa.mm $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/utilscocoa.mm +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(COREDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(COREDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(COREDLL_ODEP) @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp @@ -31828,6 +31876,9 @@ corelib_timectrl_osx.o: $(srcdir)/src/osx/timectrl_osx.cpp $(CORELIB_ODEP) corelib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/activityindicator.mm +corelib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(CORELIB_ODEP) + $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm + corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -31882,6 +31933,9 @@ corelib_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(CORELIB_ODEP) corelib_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm +corelib_iphone_statbmp.o: $(srcdir)/src/osx/iphone/statbmp.mm $(CORELIB_ODEP) + $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/statbmp.mm + corelib_qt_accel.o: $(srcdir)/src/qt/accel.cpp $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/qt/accel.cpp @@ -34819,6 +34873,12 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_utilscocoa.o: $(srcdir)/src/osx/carbon/utilscocoa.mm $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/carbon/utilscocoa.mm +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(CORELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_statbmp_osx.o: $(srcdir)/src/osx/statbmp_osx.cpp $(CORELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/statbmp_osx.cpp + @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_core_sound.o: $(srcdir)/src/osx/core/sound.cpp $(CORELIB_ODEP) @COND_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/sound.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 5dc4572ee7..27339536a8 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2468,6 +2468,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/statusbr.cpp src/generic/textmeasure.cpp src/generic/icon.cpp + src/osx/statbmp_osx.cpp @@ -2627,6 +2628,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/timectrl_osx.cpp src/common/taskbarcmn.cpp src/osx/cocoa/activityindicator.mm + src/osx/cocoa/statbmp.mm wx/osx/cocoa/chkconf.h @@ -2677,6 +2679,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/sound_osx.cpp src/osx/core/sound.cpp src/generic/animateg.cpp + src/osx/iphone/statbmp.mm diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 9183db4a9b..7749731579 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2346,6 +2346,7 @@ set(OSX_COMMON_SRC src/generic/textmeasure.cpp src/generic/icon.cpp #TODO: + src/osx/statbmp_osx.cpp ) set(OSX_SHARED_HDR @@ -2499,6 +2500,7 @@ set(OSX_COCOA_SRC src/osx/cocoa/notifmsg.mm src/osx/datectrl_osx.cpp src/osx/core/sound.cpp + src/osx/cocoa/statbmp.mm ) set(OSX_COCOA_HDR @@ -2546,6 +2548,7 @@ set(OSX_IPHONE_SRC src/osx/sound_osx.cpp src/generic/animateg.cpp src/osx/core/sound.cpp + src/osx/iphone/statbmp.mm ) set(OSX_IPHONE_HDR diff --git a/build/files b/build/files index 5fde938a4c..ef98625be1 100644 --- a/build/files +++ b/build/files @@ -2278,6 +2278,7 @@ OSX_COMMON_SRC = src/osx/slider_osx.cpp src/osx/spinbutt_osx.cpp src/osx/srchctrl_osx.cpp + src/osx/statbmp_osx.cpp src/osx/statbox_osx.cpp src/osx/statline_osx.cpp src/osx/stattext_osx.cpp @@ -2467,6 +2468,7 @@ OSX_COCOA_SRC = src/osx/cocoa/slider.mm src/osx/cocoa/spinbutt.mm src/osx/cocoa/srchctrl.mm + src/osx/cocoa/statbmp.mm src/osx/cocoa/statbox.mm src/osx/cocoa/statline.mm src/osx/cocoa/stattext.mm @@ -2525,6 +2527,7 @@ OSX_IPHONE_SRC = src/osx/iphone/scrolbar.mm src/osx/iphone/settings.mm src/osx/iphone/slider.mm + src/osx/iphone/statbmp.mm src/osx/iphone/stattext.mm src/osx/iphone/textctrl.mm src/osx/iphone/toolbar.mm diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index de91d02245..18267fda31 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -41,7 +41,6 @@ WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image, double WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ); WX_NSImage WXDLLIMPEXP_CORE wxOSXGetIconForType(OSType type ); void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat height); -double WXDLLIMPEXP_CORE wxOSXGetImageScaleFactor(WXImage image); wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size); WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow(); WXWindow WXDLLIMPEXP_CORE wxOSXGetKeyWindow(); diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index b9cffaa443..85bf77b8cf 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -119,6 +119,7 @@ CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromImage( WXImage nsimage, double CGImageRef WXDLLIMPEXP_CORE wxOSXGetCGImageFromImage( WXImage nsimage, CGRect* r, CGContextRef cg); CGContextRef WXDLLIMPEXP_CORE wxOSXCreateBitmapContextFromImage( WXImage nsimage, bool *isTemplate = NULL); WXImage WXDLLIMPEXP_CORE wxOSXGetImageFromCGImage( CGImageRef image, double scale = 1.0, bool isTemplate = false); +double WXDLLIMPEXP_CORE wxOSXGetImageScaleFactor(WXImage image); class wxWindowMac; diff --git a/include/wx/osx/statbmp.h b/include/wx/osx/statbmp.h index 45d1f3c9d5..4ba4e069d0 100644 --- a/include/wx/osx/statbmp.h +++ b/include/wx/osx/statbmp.h @@ -1,2 +1,64 @@ -#define wxGenericStaticBitmap wxStaticBitmap -#include "wx/generic/statbmpg.h" +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/statbmp.h" + +class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() {} + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, bitmap, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual void SetBitmap(const wxBitmap& bitmap) wxOVERRIDE; + + virtual wxBitmap GetBitmap() const wxOVERRIDE { return m_bitmap; } + + virtual void SetIcon(const wxIcon& icon) wxOVERRIDE + { + wxBitmap bmp; + bmp.CopyFromIcon(icon); + SetBitmap(bmp); + } + +#if defined(__WXGTK20__) || defined(__WXMAC__) + // icons and bitmaps are really the same thing in wxGTK and wxMac + wxIcon GetIcon() const wxOVERRIDE { return (const wxIcon &)m_bitmap; } +#endif + + virtual void SetScaleMode(ScaleMode scaleMode) wxOVERRIDE; + + virtual ScaleMode GetScaleMode() const wxOVERRIDE { return m_scaleMode; } + +private: + wxSize GetBitmapSize() + { + return m_bitmap.IsOk() ? m_bitmap.GetScaledSize() + : wxSize(16, 16); // this is completely arbitrary + } + + void OnPaint(wxPaintEvent& event); + + wxBitmap m_bitmap; + ScaleMode m_scaleMode; + + wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); +}; + +#endif diff --git a/src/osx/cocoa/statbmp.mm b/src/osx/cocoa/statbmp.mm new file mode 100644 index 0000000000..a1833634ff --- /dev/null +++ b/src/osx/cocoa/statbmp.mm @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/statbmp.mm +// Purpose: wxStaticBitmap +// Author: Stefan Csomor +// Created: 28.06.99 +// Copyright: (c) 2008 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_STATBMP + +#include "wx/statline.h" + +#ifndef WX_PRECOMP +#include "wx/statbmp.h" +#endif + +#include "wx/osx/private.h" + +class wxStaticBitmapCocoaImpl : public wxWidgetCocoaImpl +{ +public : + wxStaticBitmapCocoaImpl(wxWindowMac* peer , WXWidget w) : + wxWidgetCocoaImpl(peer, w) + { + } + + ~wxStaticBitmapCocoaImpl() + { + } + + void SetLabel( const wxString& title, wxFontEncoding encoding ) wxOVERRIDE + { + // although NSControl has this method, NSImageView throws an exception if it is called + } + + void SetScaleMode(wxStaticBitmap::ScaleMode scaleMode) + { + NSImageView* v = (NSImageView*) m_osxView; + + NSImageScaling scaling = NSImageScaleNone; + switch ( scaleMode ) + { + case wxStaticBitmap::Scale_Fill: + scaling = NSImageScaleAxesIndependently; + break; + case wxStaticBitmap::Scale_AspectFill: + scaling = NSImageScaleProportionallyUpOrDown; + break; + case wxStaticBitmap::Scale_AspectFit: + scaling = NSImageScaleProportionallyUpOrDown; + break; + default: + break; + } + [v setImageScaling:scaling]; + } +}; + +void wxStaticBitmap::SetScaleMode(ScaleMode scaleMode) +{ + m_scaleMode = scaleMode; + + dynamic_cast(GetPeer())->SetScaleMode(scaleMode); + + Refresh(); +} + + +wxWidgetImplType* wxWidgetImpl::CreateStaticBitmap( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, + long WXUNUSED(style), + long WXUNUSED(extraStyle)) +{ + NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; + NSImageView* v = [[NSImageView alloc] initWithFrame:r]; + + wxWidgetCocoaImpl* c = new wxStaticBitmapCocoaImpl( wxpeer, v ); + return c; +} + +#endif //wxUSE_STATBMP diff --git a/src/osx/iphone/statbmp.mm b/src/osx/iphone/statbmp.mm new file mode 100644 index 0000000000..a1095a04a9 --- /dev/null +++ b/src/osx/iphone/statbmp.mm @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/statbmp.mm +// Purpose: wxStaticBitmap +// Author: Stefan Csomor +// Created: 28.06.99 +// Copyright: (c) 2008 Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_STATBMP + +#include "wx/statline.h" + +#ifndef WX_PRECOMP +#include "wx/statbmp.h" +#endif + +#include "wx/osx/private.h" + +class wxStaticBitmapIPhoneImpl : public wxWidgetIPhoneImpl +{ +public : + wxStaticBitmapIPhoneImpl(wxWindowMac* peer , WXWidget w) : + wxWidgetIPhoneImpl(peer, w) + { + } + + ~wxStaticBitmapIPhoneImpl() + { + } + + void SetLabel( const wxString& title, wxFontEncoding encoding ) wxOVERRIDE + { + // although NSControl has this method, NSImageView throws an exception if it is called + } + + void SetScaleMode(wxStaticBitmap::ScaleMode scaleMode) + { + UIImageView* v = (UIImageView*) m_osxView; + + UIViewContentMode scaling = UIViewContentModeRedraw; + switch ( scaleMode ) + { + case wxStaticBitmap::Scale_Fill: + scaling = UIViewContentModeScaleToFill; + break; + case wxStaticBitmap::Scale_AspectFill: + scaling = UIViewContentModeScaleAspectFill; + break; + case wxStaticBitmap::Scale_AspectFit: + scaling = UIViewContentModeScaleAspectFit; + break; + default: + break; + } + [v setContentMode:scaling]; + } +}; + +void wxStaticBitmap::SetScaleMode(ScaleMode scaleMode) +{ + m_scaleMode = scaleMode; + + dynamic_cast(GetPeer())->SetScaleMode(scaleMode); + + Refresh(); +} + + +wxWidgetImplType* wxWidgetImpl::CreateStaticBitmap( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, + long WXUNUSED(style), + long WXUNUSED(extraStyle)) +{ + CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; + UIImageView* v = [[UIImageView alloc] initWithFrame:r]; + + wxWidgetIPhoneImpl* c = new wxStaticBitmapIPhoneImpl( wxpeer, v ); + return c; +} + +#endif //wxUSE_STATBMP diff --git a/src/osx/statbmp_osx.cpp b/src/osx/statbmp_osx.cpp new file mode 100644 index 0000000000..64d011cefa --- /dev/null +++ b/src/osx/statbmp_osx.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/statbmp_osx.cpp +// Purpose: wxStaticBitmap +// Author: Stefan Csomor +// Modified by: +// Created: 04/01/98 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_STATBMP + +#include "wx/stattext.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/dc.h" + #include "wx/dcclient.h" + #include "wx/settings.h" +#endif // WX_PRECOMP + +#include "wx/osx/private.h" + +#include + + +bool wxStaticBitmap::Create(wxWindow *parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) +{ + m_scaleMode = Scale_None; + + DontCreatePeer(); + + if (! wxControl::Create(parent, id, pos, size, style, + wxDefaultValidator, name)) + return false; + + SetPeer(wxWidgetImpl::CreateStaticBitmap( this, parent, id, bitmap , pos, size, style, GetExtraStyle() )); + + MacPostControlCreate( pos, size ); + + SetBitmap(bitmap); + + return true; +} + + +void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) +{ + m_bitmap = bitmap; + SetInitialSize(GetBitmapSize()); + + GetPeer()->SetBitmap(bitmap); + + Refresh(); +} + +#endif //if wxUSE_STATBMP From d44974789c8660a7ed440502005230771f491fa8 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 25 Sep 2018 15:29:39 +0200 Subject: [PATCH 006/231] docs update for macOS static bitmap --- docs/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changes.txt b/docs/changes.txt index 4f17402369..f229181029 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -158,6 +158,7 @@ wxOSX: - Fix dispatching pending events (and CallAfter()) in console applications. - Implement wxDataViewColumn::UnsetAsSortKey() (Daniel Kulp). - supporting native image formst like NSImage and UIImage in wxBitmap +- native implementation for wxStaticBitmap for correct rendering of template images wxQt: From 494581c54219528553e16172cfd2b5015ef316a0 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 25 Sep 2018 15:59:50 +0200 Subject: [PATCH 007/231] macOS wxStaticBitmap missing commit --- build/osx/wxcocoa.xcodeproj/project.pbxproj | 6 ++++++ include/wx/osx/core/private.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/build/osx/wxcocoa.xcodeproj/project.pbxproj b/build/osx/wxcocoa.xcodeproj/project.pbxproj index dc990c893a..6d9a13cb11 100644 --- a/build/osx/wxcocoa.xcodeproj/project.pbxproj +++ b/build/osx/wxcocoa.xcodeproj/project.pbxproj @@ -823,6 +823,8 @@ 4040AE89BF9F34668091064A /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; 4040AE89BF9F34668091064B /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; 4040AE89BF9F34668091064C /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; + 215958201947310B88BBEDB3 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; + 750C716389AD3ADBABC9D689 /* statbmp_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */; }; 4156FDB73D0A397A870E4302 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; 4156FDB73D0A397A870E4303 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; 4156FDB73D0A397A870E4304 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; @@ -4088,6 +4090,8 @@ 4048A3523EC03409BD899BEF /* xtixml.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xtixml.cpp; path = ../../src/common/xtixml.cpp; sourceTree = ""; }; 40586C8986443431A64EB066 /* LexLisp.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexLisp.cxx; path = ../../src/stc/scintilla/lexers/LexLisp.cxx; sourceTree = ""; }; 4071FF90F1D4336C836B2AE4 /* tif_pixarlog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_pixarlog.c; path = ../../src/tiff/libtiff/tif_pixarlog.c; sourceTree = ""; }; + FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = statbmp.mm; path = ../../src/osx/cocoa/statbmp.mm; sourceTree = ""; }; + F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = statbmp_osx.cpp; path = ../../src/osx/statbmp_osx.cpp; sourceTree = ""; }; 40CE02524DD4385AB2C3DF95 /* socket.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = socket.cpp; path = ../../src/common/socket.cpp; sourceTree = ""; }; 4188821BBA833CCAA678B234 /* utilscmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = utilscmn.cpp; path = ../../src/common/utilscmn.cpp; sourceTree = ""; }; 418AD9241B673308BE31DC06 /* xlocale.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xlocale.cpp; path = ../../src/common/xlocale.cpp; sourceTree = ""; }; @@ -5301,6 +5305,8 @@ 2E7B4F88F81E37B4A9FF6C0F /* core */ = { isa = PBXGroup; children = ( + F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */, + FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */, B0665A40F3FC3F218074C63C /* artmac.cpp */, 302A13BC64C238A297F4399F /* brush.cpp */, BDE76674C0F5391BAD2AFA2F /* dialog_osx.cpp */, diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 85bf77b8cf..8b02bc0f41 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -558,6 +558,15 @@ public : long extraStyle); #endif + static wxWidgetImplType* CreateStaticBitmap( wxWindowMac* wxpeer, + wxWindowMac* parent, + wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + long extraStyle); + // converts from Toplevel-Content relative to local static void Convert( wxPoint *pt , wxWidgetImpl *from , wxWidgetImpl *to ); protected : From bc2c58bd39f405dd1a7b7aa5df2aebadd7fcbbff Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 25 Sep 2018 16:47:51 +0200 Subject: [PATCH 008/231] fixing include statement --- src/osx/statbmp_osx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osx/statbmp_osx.cpp b/src/osx/statbmp_osx.cpp index 64d011cefa..94332a571f 100644 --- a/src/osx/statbmp_osx.cpp +++ b/src/osx/statbmp_osx.cpp @@ -12,7 +12,7 @@ #if wxUSE_STATBMP -#include "wx/stattext.h" +#include "wx/statbmp.h" #ifndef WX_PRECOMP #include "wx/app.h" From 2ed7ed6f39ec239cd3b259cd6ab1624ed9614fc9 Mon Sep 17 00:00:00 2001 From: imReker Date: Wed, 26 Sep 2018 10:29:05 +0800 Subject: [PATCH 009/231] Fix wxMSW build error when wxUSE_ENH_METAFILE=0 Don't include wx/msw/enhmeta.h when wxUSE_ENH_METAFILE is set to 0. Closes https://github.com/wxWidgets/wxWidgets/pull/951 --- src/common/graphcmn.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index fc0e6ab894..fc79fbe761 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -32,8 +32,10 @@ #endif #ifdef __WXMSW__ +#if wxUSE_ENH_METAFILE #include "wx/msw/enhmeta.h" #endif +#endif #include "wx/private/graphics.h" From 713a7ab8950b6ea7b7f1ec3d26f70b0bc35b0774 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 26 Sep 2018 14:47:45 +0200 Subject: [PATCH 010/231] Move wxUSE_ENH_METAFILE check inside wx/msw/enhmeta.h itself This is more consistent with the other headers, which are safe to include even when the corresponding feature is turned off. Also remove the now redundant wxUSE_ENH_METAFILE checks in the source code including this header. See https://github.com/wxWidgets/wxWidgets/pull/951 --- include/wx/msw/enhmeta.h | 6 ++++++ src/common/graphcmn.cpp | 2 -- src/generic/graphicc.cpp | 2 +- src/msw/graphics.cpp | 4 +--- src/msw/printwin.cpp | 5 ++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/wx/msw/enhmeta.h b/include/wx/msw/enhmeta.h index 74c65ddb2c..bd6c5f729e 100644 --- a/include/wx/msw/enhmeta.h +++ b/include/wx/msw/enhmeta.h @@ -11,6 +11,10 @@ #ifndef _WX_MSW_ENHMETA_H_ #define _WX_MSW_ENHMETA_H_ +#include "wx/defs.h" + +#if wxUSE_ENH_METAFILE + #include "wx/dc.h" #include "wx/gdiobj.h" @@ -192,4 +196,6 @@ protected: #endif // wxUSE_DATAOBJ +#endif // wxUSE_ENH_METAFILE + #endif // _WX_MSW_ENHMETA_H_ diff --git a/src/common/graphcmn.cpp b/src/common/graphcmn.cpp index fc79fbe761..fc0e6ab894 100644 --- a/src/common/graphcmn.cpp +++ b/src/common/graphcmn.cpp @@ -32,10 +32,8 @@ #endif #ifdef __WXMSW__ -#if wxUSE_ENH_METAFILE #include "wx/msw/enhmeta.h" #endif -#endif #include "wx/private/graphics.h" diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index ce232060ad..7ed04b4bd4 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -41,7 +41,7 @@ bool wxCairoInit(); #include "wx/private/graphics.h" #include "wx/rawbmp.h" #include "wx/vector.h" -#if defined(__WXMSW__) && wxUSE_ENH_METAFILE +#ifdef __WXMSW__ #include "wx/msw/enhmeta.h" #endif diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 78d4a36e68..04cca9d732 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -42,9 +42,7 @@ #include "wx/private/graphics.h" #include "wx/msw/wrapgdip.h" #include "wx/msw/dc.h" -#if wxUSE_ENH_METAFILE - #include "wx/msw/enhmeta.h" -#endif +#include "wx/msw/enhmeta.h" #include "wx/dcgraph.h" #include "wx/rawbmp.h" diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index 48e61003c1..b608aeacec 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -48,9 +48,8 @@ #include "wx/msw/printdlg.h" #include "wx/msw/private.h" #include "wx/msw/dcprint.h" -#if wxUSE_ENH_METAFILE - #include "wx/msw/enhmeta.h" -#endif +#include "wx/msw/enhmeta.h" + #include // --------------------------------------------------------------------------- From 3b1551a714e4c4a275ecbc5b1db2bb51d4965b42 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 27 Sep 2018 14:46:33 +0200 Subject: [PATCH 011/231] Fixing builds with Xcode --- build/osx/wxcocoa.xcodeproj/project.pbxproj | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/build/osx/wxcocoa.xcodeproj/project.pbxproj b/build/osx/wxcocoa.xcodeproj/project.pbxproj index 6d9a13cb11..b713560798 100644 --- a/build/osx/wxcocoa.xcodeproj/project.pbxproj +++ b/build/osx/wxcocoa.xcodeproj/project.pbxproj @@ -823,8 +823,12 @@ 4040AE89BF9F34668091064A /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; 4040AE89BF9F34668091064B /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; 4040AE89BF9F34668091064C /* dragimgg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A67053D16D63C588E555C84 /* dragimgg.cpp */; }; - 215958201947310B88BBEDB3 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; 750C716389AD3ADBABC9D689 /* statbmp_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */; }; + 750C716389AD3ADBABC9D68A /* statbmp_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */; }; + 750C716389AD3ADBABC9D68B /* statbmp_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */; }; + 215958201947310B88BBEDB3 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; + 215958201947310B88BBEDB4 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; + 215958201947310B88BBEDB5 /* statbmp.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */; }; 4156FDB73D0A397A870E4302 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; 4156FDB73D0A397A870E4303 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; 4156FDB73D0A397A870E4304 /* overlay.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FBD8031E28A3C9CB7C45784 /* overlay.mm */; }; @@ -4090,8 +4094,6 @@ 4048A3523EC03409BD899BEF /* xtixml.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xtixml.cpp; path = ../../src/common/xtixml.cpp; sourceTree = ""; }; 40586C8986443431A64EB066 /* LexLisp.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexLisp.cxx; path = ../../src/stc/scintilla/lexers/LexLisp.cxx; sourceTree = ""; }; 4071FF90F1D4336C836B2AE4 /* tif_pixarlog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_pixarlog.c; path = ../../src/tiff/libtiff/tif_pixarlog.c; sourceTree = ""; }; - FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = statbmp.mm; path = ../../src/osx/cocoa/statbmp.mm; sourceTree = ""; }; - F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = statbmp_osx.cpp; path = ../../src/osx/statbmp_osx.cpp; sourceTree = ""; }; 40CE02524DD4385AB2C3DF95 /* socket.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = socket.cpp; path = ../../src/common/socket.cpp; sourceTree = ""; }; 4188821BBA833CCAA678B234 /* utilscmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = utilscmn.cpp; path = ../../src/common/utilscmn.cpp; sourceTree = ""; }; 418AD9241B673308BE31DC06 /* xlocale.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xlocale.cpp; path = ../../src/common/xlocale.cpp; sourceTree = ""; }; @@ -4758,6 +4760,7 @@ F4B85051B7C835A8BF4E3EE1 /* xh_panel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xh_panel.cpp; path = ../../src/xrc/xh_panel.cpp; sourceTree = ""; }; F4C72C5C61A6335C8B418BA1 /* LexMetapost.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexMetapost.cxx; path = ../../src/stc/scintilla/lexers/LexMetapost.cxx; sourceTree = ""; }; F52DCBC0442233738B39138E /* CaseFolder.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CaseFolder.cxx; path = ../../src/stc/scintilla/src/CaseFolder.cxx; sourceTree = ""; }; + F582C6B3A5AA3367BB4DBE97 /* statbmp_osx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = statbmp_osx.cpp; path = ../../src/osx/statbmp_osx.cpp; sourceTree = ""; }; F5DAF1F49F0F3F41A427A21D /* icon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = icon.cpp; path = ../../src/generic/icon.cpp; sourceTree = ""; }; F6EA240B3DB93D398A990FAD /* tif_dirread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_dirread.c; path = ../../src/tiff/libtiff/tif_dirread.c; sourceTree = ""; }; F6F01A84F4DE3C9FB9849004 /* tif_jbig.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tif_jbig.c; path = ../../src/tiff/libtiff/tif_jbig.c; sourceTree = ""; }; @@ -4783,6 +4786,7 @@ FD0C7FCA25A3312E8F2FCF3C /* LexTeX.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexTeX.cxx; path = ../../src/stc/scintilla/lexers/LexTeX.cxx; sourceTree = ""; }; FD55F391CD1032DFACA88CFD /* xh_srchctrl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xh_srchctrl.cpp; path = ../../src/xrc/xh_srchctrl.cpp; sourceTree = ""; }; FD5F11A3646F397BA62EB037 /* htmllbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = htmllbox.cpp; path = ../../src/generic/htmllbox.cpp; sourceTree = ""; }; + FD6B26B5A6A733A89EF5AB9C /* statbmp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = statbmp.mm; path = ../../src/osx/cocoa/statbmp.mm; sourceTree = ""; }; FD6D2664C05131C3A06E98B4 /* ExternalLexer.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ExternalLexer.cxx; path = ../../src/stc/scintilla/src/ExternalLexer.cxx; sourceTree = ""; }; FDAEFCE0ED9D30DA94340A3B /* xtistrm.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = xtistrm.cpp; path = ../../src/common/xtistrm.cpp; sourceTree = ""; }; FDB0E2D0966C3E408C4A2D3D /* infback.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = infback.c; path = ../../src/zlib/infback.c; sourceTree = ""; }; @@ -7543,6 +7547,7 @@ 0FFFFA2F762B3160955D1D8A /* gauge_osx.cpp in Sources */, E4B826CE70283D999CB591F5 /* listbox_osx.cpp in Sources */, B198DA8239E9358A9D56B98A /* menu_osx.cpp in Sources */, + 750C716389AD3ADBABC9D68B /* statbmp_osx.cpp in Sources */, 1DF3A4F85FCB3BA79A552F3F /* menuitem_osx.cpp in Sources */, A3321FE2A87D3BD69E0BB00B /* notebook_osx.cpp in Sources */, 0C9A379D97B133FA831175A9 /* printdlg_osx.cpp in Sources */, @@ -7560,6 +7565,7 @@ 664A54F914443110B7BB692A /* tglbtn_osx.cpp in Sources */, A569A33A2097316D8110C2C3 /* toolbar_osx.cpp in Sources */, 0AEBA7389E223781A7A257A3 /* webkit.mm in Sources */, + 215958201947310B88BBEDB5 /* statbmp.mm in Sources */, F5FF98C231B33E3EB7902C66 /* colordlgosx.mm in Sources */, 2386B575BC3931D2AF86CB35 /* fontdlgosx.mm in Sources */, 2EECB3C2F9523D0B95847A81 /* accel.cpp in Sources */, @@ -8125,6 +8131,7 @@ E882402BEE0330A080A65170 /* strconv.cpp in Sources */, 30493B486DFF35AF80D12C4A /* stream.cpp in Sources */, 795613831EC8332A83FF26E8 /* string.cpp in Sources */, + 750C716389AD3ADBABC9D68A /* statbmp_osx.cpp in Sources */, 55F0D287F60F3EDEA16CCB65 /* stringimpl.cpp in Sources */, 88E1AE56FD393C8BA5CF8546 /* stringops.cpp in Sources */, 056E30EA43753A7CB1AF8C9F /* strvararg.cpp in Sources */, @@ -8583,6 +8590,7 @@ 5F2C2A46781739D897CF293E /* xh_chckl.cpp in Sources */, CE17002B5B7E37558274763A /* xh_choic.cpp in Sources */, 26E4813A97DE323E88119164 /* xh_choicbk.cpp in Sources */, + 215958201947310B88BBEDB4 /* statbmp.mm in Sources */, E7AF3BF2B3473AD9BE66D1A2 /* xh_clrpicker.cpp in Sources */, 1AB50C98FF473B33A3CA4D3A /* xh_cmdlinkbn.cpp in Sources */, E7921B0472B63E4091F4F518 /* xh_collpane.cpp in Sources */, @@ -9348,6 +9356,7 @@ E882402BEE0330A080A6516F /* strconv.cpp in Sources */, 30493B486DFF35AF80D12C49 /* stream.cpp in Sources */, 795613831EC8332A83FF26E7 /* string.cpp in Sources */, + 750C716389AD3ADBABC9D689 /* statbmp_osx.cpp in Sources */, 55F0D287F60F3EDEA16CCB64 /* stringimpl.cpp in Sources */, 88E1AE56FD393C8BA5CF8545 /* stringops.cpp in Sources */, 056E30EA43753A7CB1AF8C9E /* strvararg.cpp in Sources */, @@ -9806,6 +9815,7 @@ 5F2C2A46781739D897CF293D /* xh_chckl.cpp in Sources */, CE17002B5B7E375582747639 /* xh_choic.cpp in Sources */, 26E4813A97DE323E88119163 /* xh_choicbk.cpp in Sources */, + 215958201947310B88BBEDB3 /* statbmp.mm in Sources */, E7AF3BF2B3473AD9BE66D1A1 /* xh_clrpicker.cpp in Sources */, 1AB50C98FF473B33A3CA4D39 /* xh_cmdlinkbn.cpp in Sources */, E7921B0472B63E4091F4F517 /* xh_collpane.cpp in Sources */, From 875c095e870e407a41eab07cbc880ff40ad2aa35 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 27 Sep 2018 22:31:41 +0200 Subject: [PATCH 012/231] Normalize wxRegion rectangle if it has a negative size For compatibility with wxMSW and wxGTK rectangle defining wxRegion needs to be in the canonical form with (x,y) pointing to the top-left corner and width and height >= 0. --- src/osx/carbon/region.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/osx/carbon/region.cpp b/src/osx/carbon/region.cpp index a881b0996a..907b0f33fd 100644 --- a/src/osx/carbon/region.cpp +++ b/src/osx/carbon/region.cpp @@ -77,6 +77,21 @@ wxRegion::wxRegion(WXHRGN hRegion ) wxRegion::wxRegion(long x, long y, long w, long h) { + // Rectangle needs to be given in the canonical form, + // with (x,y) pointing to the top-left corner + // and with non-negative width and height + // (for compatibility with wxMSW anf wxGTK). + if ( w < 0 ) + { + w = -w; + x -= (w - 1); + } + if ( h < 0 ) + { + h = -h; + y -= (h - 1); + } + m_refData = new wxRegionRefData(x , y , w , h ); } From f96c37eaccca688109f3094e8cfa2cfac967d267 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 27 Sep 2018 22:50:45 +0200 Subject: [PATCH 013/231] Preserve wxGraphicsContext settings while resetting the clipping To reset the clipping there is necessary to restore all CGContext settings so we need to set them back to the previous values based on the stored wxGraphicsContext attributes. --- src/osx/carbon/graphics.cpp | 203 +++++++++++++++++++++--------------- 1 file changed, 119 insertions(+), 84 deletions(-) diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index c2fc7523b6..cd99421373 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -1430,6 +1430,9 @@ public: private: bool EnsureIsValid(); void CheckInvariants() const; + bool DoSetAntialiasMode(wxAntialiasMode antialias); + bool DoSetInterpolationQuality(wxInterpolationQuality interpolation); + bool DoSetCompositionMode(wxCompositionMode op); virtual void DoDrawText( const wxString &str, wxDouble x, wxDouble y ) wxOVERRIDE; virtual void DoDrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) wxOVERRIDE; @@ -1678,6 +1681,16 @@ bool wxMacCoreGraphicsContext::SetAntialiasMode(wxAntialiasMode antialias) m_antialias = antialias; + if ( !DoSetAntialiasMode(antialias) ) + { + return false; + } + CheckInvariants(); + return true; +} + +bool wxMacCoreGraphicsContext::DoSetAntialiasMode(wxAntialiasMode antialias) +{ bool antialiasMode; switch (antialias) { @@ -1691,7 +1704,6 @@ bool wxMacCoreGraphicsContext::SetAntialiasMode(wxAntialiasMode antialias) return false; } CGContextSetShouldAntialias(m_cgContext, antialiasMode); - CheckInvariants(); return true; } @@ -1704,9 +1716,20 @@ bool wxMacCoreGraphicsContext::SetInterpolationQuality(wxInterpolationQuality in return true; m_interpolation = interpolation; + + if ( !DoSetInterpolationQuality(interpolation) ) + { + return false; + } + CheckInvariants(); + return true; +} + +bool wxMacCoreGraphicsContext::DoSetInterpolationQuality(wxInterpolationQuality interpolation) +{ CGInterpolationQuality quality; - - switch (interpolation) + + switch (interpolation) { case wxINTERPOLATION_DEFAULT: quality = kCGInterpolationDefault; @@ -1727,7 +1750,6 @@ bool wxMacCoreGraphicsContext::SetInterpolationQuality(wxInterpolationQuality in return false; } CGContextSetInterpolationQuality(m_cgContext, quality); - CheckInvariants(); return true; } @@ -1741,7 +1763,17 @@ bool wxMacCoreGraphicsContext::SetCompositionMode(wxCompositionMode op) m_composition = op; - if (m_composition == wxCOMPOSITION_DEST) + if ( !DoSetCompositionMode(op) ) + { + return false; + } + CheckInvariants(); + return true; +} + +bool wxMacCoreGraphicsContext::DoSetCompositionMode(wxCompositionMode op) +{ + if (op == wxCOMPOSITION_DEST) return true; // TODO REMOVE if we don't need it because of bugs in 10.5 @@ -1751,44 +1783,44 @@ bool wxMacCoreGraphicsContext::SetCompositionMode(wxCompositionMode op) CGBlendMode mode = kCGBlendModeNormal; switch( op ) { - case wxCOMPOSITION_CLEAR: - cop = kCGCompositeOperationClear; - break; - case wxCOMPOSITION_SOURCE: - cop = kCGCompositeOperationCopy; - break; - case wxCOMPOSITION_OVER: - mode = kCGBlendModeNormal; - break; - case wxCOMPOSITION_IN: - cop = kCGCompositeOperationSourceIn; - break; - case wxCOMPOSITION_OUT: - cop = kCGCompositeOperationSourceOut; - break; - case wxCOMPOSITION_ATOP: - cop = kCGCompositeOperationSourceAtop; - break; - case wxCOMPOSITION_DEST_OVER: - cop = kCGCompositeOperationDestinationOver; - break; - case wxCOMPOSITION_DEST_IN: - cop = kCGCompositeOperationDestinationIn; - break; - case wxCOMPOSITION_DEST_OUT: - cop = kCGCompositeOperationDestinationOut; - break; - case wxCOMPOSITION_DEST_ATOP: - cop = kCGCompositeOperationDestinationAtop; - break; - case wxCOMPOSITION_XOR: - cop = kCGCompositeOperationXOR; - break; - case wxCOMPOSITION_ADD: - mode = kCGBlendModePlusLighter ; - break; - default: - return false; + case wxCOMPOSITION_CLEAR: + cop = kCGCompositeOperationClear; + break; + case wxCOMPOSITION_SOURCE: + cop = kCGCompositeOperationCopy; + break; + case wxCOMPOSITION_OVER: + mode = kCGBlendModeNormal; + break; + case wxCOMPOSITION_IN: + cop = kCGCompositeOperationSourceIn; + break; + case wxCOMPOSITION_OUT: + cop = kCGCompositeOperationSourceOut; + break; + case wxCOMPOSITION_ATOP: + cop = kCGCompositeOperationSourceAtop; + break; + case wxCOMPOSITION_DEST_OVER: + cop = kCGCompositeOperationDestinationOver; + break; + case wxCOMPOSITION_DEST_IN: + cop = kCGCompositeOperationDestinationIn; + break; + case wxCOMPOSITION_DEST_OUT: + cop = kCGCompositeOperationDestinationOut; + break; + case wxCOMPOSITION_DEST_ATOP: + cop = kCGCompositeOperationDestinationAtop; + break; + case wxCOMPOSITION_XOR: + cop = kCGCompositeOperationXOR; + break; + case wxCOMPOSITION_ADD: + mode = kCGBlendModePlusLighter ; + break; + default: + return false; } if ( cop != kCGCompositeOperationSourceOver ) CGContextSetCompositeOperation(m_cgContext, cop); @@ -1800,50 +1832,47 @@ bool wxMacCoreGraphicsContext::SetCompositionMode(wxCompositionMode op) CGBlendMode mode = kCGBlendModeNormal; switch( op ) { - case wxCOMPOSITION_CLEAR: - mode = kCGBlendModeClear; - break; - case wxCOMPOSITION_SOURCE: - mode = kCGBlendModeCopy; - break; - case wxCOMPOSITION_OVER: - mode = kCGBlendModeNormal; - break; - case wxCOMPOSITION_IN: - mode = kCGBlendModeSourceIn; - break; - case wxCOMPOSITION_OUT: - mode = kCGBlendModeSourceOut; - break; - case wxCOMPOSITION_ATOP: - mode = kCGBlendModeSourceAtop; - break; - case wxCOMPOSITION_DEST_OVER: - mode = kCGBlendModeDestinationOver; - break; - case wxCOMPOSITION_DEST_IN: - mode = kCGBlendModeDestinationIn; - break; - case wxCOMPOSITION_DEST_OUT: - mode = kCGBlendModeDestinationOut; - break; - case wxCOMPOSITION_DEST_ATOP: - mode = kCGBlendModeDestinationAtop; - break; - case wxCOMPOSITION_XOR: - mode = kCGBlendModeExclusion; // Not kCGBlendModeXOR! - break; - - case wxCOMPOSITION_ADD: - mode = kCGBlendModePlusLighter ; - break; - default: - return false; + case wxCOMPOSITION_CLEAR: + mode = kCGBlendModeClear; + break; + case wxCOMPOSITION_SOURCE: + mode = kCGBlendModeCopy; + break; + case wxCOMPOSITION_OVER: + mode = kCGBlendModeNormal; + break; + case wxCOMPOSITION_IN: + mode = kCGBlendModeSourceIn; + break; + case wxCOMPOSITION_OUT: + mode = kCGBlendModeSourceOut; + break; + case wxCOMPOSITION_ATOP: + mode = kCGBlendModeSourceAtop; + break; + case wxCOMPOSITION_DEST_OVER: + mode = kCGBlendModeDestinationOver; + break; + case wxCOMPOSITION_DEST_IN: + mode = kCGBlendModeDestinationIn; + break; + case wxCOMPOSITION_DEST_OUT: + mode = kCGBlendModeDestinationOut; + break; + case wxCOMPOSITION_DEST_ATOP: + mode = kCGBlendModeDestinationAtop; + break; + case wxCOMPOSITION_XOR: + mode = kCGBlendModeExclusion; // Not kCGBlendModeXOR! + break; + case wxCOMPOSITION_ADD: + mode = kCGBlendModePlusLighter ; + break; + default: + return false; } CGContextSetBlendMode(m_cgContext, mode); } - - CheckInvariants(); return true; } @@ -1939,6 +1968,12 @@ void wxMacCoreGraphicsContext::ResetClip() transformNew = CGAffineTransformInvert( transformNew ) ; CGContextConcatCTM( m_cgContext, transformNew); CGContextConcatCTM( m_cgContext, transform); + // Retain antialiasing mode + DoSetAntialiasMode(m_antialias); + // Retain interpolation quality + DoSetInterpolationQuality(m_interpolation); + // Retain composition mode + DoSetCompositionMode(m_composition); } else { From 378f62bd08a2dd496ff8c1a273eba4132443210b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 16:52:20 +0200 Subject: [PATCH 014/231] Improve documentation of wxPGChoices ctor and Add() methods Mention that the "labels" array must be NULL-terminated and that "values" must have at least as many items, if they're provided at all. --- include/wx/propgrid/property.h | 4 ++-- interface/wx/propgrid/property.h | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 46591191d6..a37a953fc5 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -719,7 +719,7 @@ public: } // Constructor. - // labels - Labels for choices. + // labels - Labels for choices, NULL-terminated. // values - Values for choices. If NULL, indexes are used. wxPGChoices( const wxChar* const* labels, const long* values = NULL ) { @@ -754,7 +754,7 @@ public: // Adds to current. // If did not have own copies, creates them now. If was empty, identical // to set except that creates copies. - // labels - Labels for added choices. + // labels - Labels for added choices, NULL-terminated. // values - Values for added choices. If empty, relevant entry indexes are used. void Add( const wxChar* const* labels, const ValArrItem* values = NULL ); diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index e12ad51e3f..483f220c20 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -2488,10 +2488,11 @@ public: Constructor. @param labels - Labels for choices. + Labels for choices, @NULL-terminated. @param values - Values for choices. If @NULL, indexes are used. + Values for choices. If @NULL, indexes are used. Otherwise must have + at least the same size as @a labels. */ wxPGChoices( const wxChar** labels, const long* values = NULL ); @@ -2502,7 +2503,8 @@ public: Labels for choices. @param values - Values for choices. If empty, indexes are used. + Values for choices. If empty, indexes are used. Otherwise must have + at least the same size as @a labels. */ wxPGChoices( const wxArrayString& labels, const wxArrayInt& values = wxArrayInt() ); @@ -2521,10 +2523,11 @@ public: identical to set except that creates copies. @param labels - Labels for added choices. + Labels for added choices, @NULL-terminated. @param values - Values for added choices. If empty, relevant entry indexes are used. + Values for added choices. If empty, relevant entry indexes are + used. Otherwise must have at least the same size as @a labels. */ void Add( const wxChar** labels, const ValArrItem* values = NULL ); From 8bb5cb1d6e59e4a0447d8d3f5d30f06c82275cef Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 16:57:10 +0200 Subject: [PATCH 015/231] Improve wxPGChoices::Set() documentation too Refer to Add() and use @overload rather than duplicating the description. --- interface/wx/propgrid/property.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 483f220c20..f106f7cab4 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -2662,12 +2662,14 @@ public: /** Sets contents from lists of strings and values. + + This is similar to calling Clear() and the corresponding overload of Add(). */ void Set( const wxChar** labels, const long* values = NULL ); /** - Sets contents from lists of strings and values. - */ + @overload + */ void Set( const wxArrayString& labels, const wxArrayInt& values = wxArrayInt() ); /** From d2e072db3ce6e4be78a1e817e8be6d0cf9dd518f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 16:59:32 +0200 Subject: [PATCH 016/231] Don't use unclear ValArrItem typedef in wxPGChoices documentation All the other methods use just "long", so use it in Add() documentation as well instead of the rather cryptic ValArrItem. --- interface/wx/propgrid/property.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index f106f7cab4..758f9b810a 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -2529,7 +2529,7 @@ public: Values for added choices. If empty, relevant entry indexes are used. Otherwise must have at least the same size as @a labels. */ - void Add( const wxChar** labels, const ValArrItem* values = NULL ); + void Add( const wxChar** labels, const long* values = NULL ); /** Adds to current. Version that works with wxArrayString and wxArrayInt. From b624064659c37f995125e959c2b749f67c2c6b9d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 17:01:17 +0200 Subject: [PATCH 017/231] Call Add(), not Set(), from wxPGChoices ctors There is no need to call Free() on a newly constructed object and Set() is just Free() followed by Add(). No real changes. --- include/wx/propgrid/property.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index a37a953fc5..937fabcd06 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -724,7 +724,7 @@ public: wxPGChoices( const wxChar* const* labels, const long* values = NULL ) { Init(); - Set(labels,values); + Add(labels,values); } // Constructor. @@ -734,7 +734,7 @@ public: const wxArrayInt& values = wxArrayInt() ) { Init(); - Set(labels,values); + Add(labels,values); } // Simple interface constructor. From 96ecfd8c77a5dbe776ee6c4795a1f271e28ff00a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 17:13:00 +0200 Subject: [PATCH 018/231] Provide wxPGChoices ctor, Add(), Set() overloads taking wxStrings Allow passing an array of wxStrings in addition to an array of wxChar* strings. --- include/wx/propgrid/property.h | 20 +++++++++++++++ interface/wx/propgrid/property.h | 43 +++++++++++++++++++++++++++++++- src/propgrid/property.cpp | 14 +++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 937fabcd06..82b5c3bb83 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -719,6 +719,17 @@ public: } // Constructor. + // count - Number of labels. + // labels - Labels themselves. + // values - Values for choices. If NULL, indexes are used. + wxPGChoices(size_t count, const wxString* labels, const long* values = NULL) + { + Init(); + Add(count, labels, values); + } + + // Constructor overload taking wxChar strings, provided mostly for + // compatibility. // labels - Labels for choices, NULL-terminated. // values - Values for choices. If NULL, indexes are used. wxPGChoices( const wxChar* const* labels, const long* values = NULL ) @@ -754,6 +765,9 @@ public: // Adds to current. // If did not have own copies, creates them now. If was empty, identical // to set except that creates copies. + void Add(size_t count, const wxString* labels, const long* values = NULL); + + // Overload taking wxChar strings, provided mostly for compatibility. // labels - Labels for added choices, NULL-terminated. // values - Values for added choices. If empty, relevant entry indexes are used. void Add( const wxChar* const* labels, const ValArrItem* values = NULL ); @@ -879,6 +893,12 @@ public: // Sets contents from lists of strings and values. // Does not create copies for itself. // TODO: Deprecate. + void Set(size_t count, const wxString* labels, const long* values = NULL) + { + Free(); + Add(count, labels, values); + } + void Set( const wxChar* const* labels, const long* values = NULL ) { Free(); diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 758f9b810a..e60002a638 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -2487,6 +2487,24 @@ public: /** Constructor. + @param count + Number of the strings in @a labels array. + @param labels + Labels for choices. + @param values + Values for choices. If @NULL, indexes are used. Otherwise must have + at least @a count elements. + + @since 3.1.2 + */ + wxPGChoices(size_t count, const wxString* labels, const long* values = NULL); + + /** + Constructor overload taking wxChar strings. + + This constructor is provided mostly for compatibility, prefer to use + one of the other constructor overloads in the new code. + @param labels Labels for choices, @NULL-terminated. @@ -2522,6 +2540,24 @@ public: Adds to current. If did not have own copies, creates them now. If was empty, identical to set except that creates copies. + @param count + Number of the strings in @a labels array. + @param labels + Labels for choices. + @param values + Values for choices. If @NULL, indexes are used. Otherwise must have + at least @a count elements. + + @since 3.1.2 + */ + void Add(size_t count, const wxString* labels, const long* values = NULL); + + /** + Adds to current. + + This overload is provided mostly for compatibility, prefer to use one + of the other ones in the new code. + @param labels Labels for added choices, @NULL-terminated. @@ -2532,7 +2568,7 @@ public: void Add( const wxChar** labels, const long* values = NULL ); /** - Adds to current. Version that works with wxArrayString and wxArrayInt. + @overload */ void Add( const wxArrayString& arr, const wxArrayInt& arrint ); @@ -2665,6 +2701,11 @@ public: This is similar to calling Clear() and the corresponding overload of Add(). */ + void Set(size_t count, const wxString* labels, const long* values = NULL); + + /** + @overload + */ void Set( const wxChar** labels, const long* values = NULL ); /** diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 281ed15d23..5cfa571546 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -3013,6 +3013,20 @@ wxPGChoiceEntry& wxPGChoices::AddAsSorted( const wxString& label, int value ) // ----------------------------------------------------------------------- +void wxPGChoices::Add(size_t count, const wxString* labels, const long* values) +{ + AllocExclusive(); + + for ( size_t i = 0; i < count; ++i ) + { + const int value = values ? values[i] : i; + wxPGChoiceEntry entry(labels[i], value); + m_data->Insert( i, entry ); + } +} + +// ----------------------------------------------------------------------- + void wxPGChoices::Add( const wxChar* const* labels, const ValArrItem* values ) { AllocExclusive(); From b70ed2d8c84cadf10bd42fc052a255fac02391e4 Mon Sep 17 00:00:00 2001 From: Blake Eryx Date: Fri, 28 Sep 2018 21:45:15 -0400 Subject: [PATCH 019/231] Remove more wxT() macros from samples Also use wxString instead of wxChar* strings. Closes https://github.com/wxWidgets/wxWidgets/pull/950 --- samples/artprov/artbrows.cpp | 4 +- samples/combo/combo.cpp | 2 +- samples/dataview/mymodels.h | 2 +- samples/debugrpt/debugrpt.cpp | 2 +- samples/dnd/dnd.cpp | 40 +- samples/except/except.cpp | 2 +- samples/exec/exec.cpp | 35 +- samples/font/font.cpp | 16 +- samples/grid/griddemo.cpp | 13 +- samples/image/canvas.cpp | 2 +- samples/internat/internat.cpp | 4 +- samples/ipc/client.cpp | 2 +- samples/layout/layout.cpp | 25 +- samples/listctrl/listtest.cpp | 270 +++--- samples/listctrl/listtest.h | 6 +- samples/menu/menu.cpp | 6 +- samples/notebook/notebook.cpp | 12 +- samples/propgrid/propgrid.cpp | 1083 ++++++++++++------------- samples/propgrid/propgrid_minimal.cpp | 18 +- samples/propgrid/sampleprops.cpp | 36 +- samples/propgrid/tests.cpp | 382 ++++----- samples/render/render.cpp | 4 +- samples/ribbon/ribbondemo.cpp | 4 +- samples/stc/edit.cpp | 90 +- samples/stc/edit.h | 2 +- samples/stc/prefs.cpp | 186 ++--- samples/stc/prefs.h | 8 +- samples/stc/stctest.cpp | 62 +- samples/text/text.cpp | 6 +- samples/toolbar/toolbar.cpp | 2 +- samples/treectrl/treetest.cpp | 14 +- samples/treectrl/treetest.h | 2 +- samples/typetest/typetest.cpp | 6 +- samples/widgets/activityindicator.cpp | 2 +- samples/widgets/bmpcombobox.cpp | 106 +-- samples/widgets/button.cpp | 62 +- samples/widgets/checkbox.cpp | 34 +- samples/widgets/choice.cpp | 42 +- samples/widgets/clrpicker.cpp | 14 +- samples/widgets/combobox.cpp | 78 +- samples/widgets/datepick.cpp | 2 +- samples/widgets/dirctrl.cpp | 56 +- samples/widgets/dirpicker.cpp | 16 +- samples/widgets/editlbox.cpp | 14 +- samples/widgets/filectrl.cpp | 30 +- samples/widgets/filepicker.cpp | 22 +- samples/widgets/fontpicker.cpp | 14 +- samples/widgets/gauge.cpp | 48 +- samples/widgets/headerctrl.cpp | 2 +- samples/widgets/hyperlnk.cpp | 48 +- samples/widgets/itemcontainer.cpp | 58 +- samples/widgets/listbox.cpp | 74 +- samples/widgets/native.cpp | 2 +- samples/widgets/notebook.cpp | 70 +- samples/widgets/odcombobox.cpp | 102 +-- samples/widgets/radiobox.cpp | 66 +- samples/widgets/searchctrl.cpp | 16 +- samples/widgets/slider.cpp | 104 +-- samples/widgets/spinbtn.cpp | 68 +- samples/widgets/statbmp.cpp | 14 +- samples/widgets/static.cpp | 58 +- samples/widgets/textctrl.cpp | 138 ++-- samples/widgets/timepick.cpp | 2 +- samples/widgets/toggle.cpp | 52 +- samples/widgets/widgets.cpp | 88 +- samples/widgets/widgets.h | 2 +- samples/xti/codereadercallback.cpp | 6 +- 67 files changed, 1926 insertions(+), 1932 deletions(-) diff --git a/samples/artprov/artbrows.cpp b/samples/artprov/artbrows.cpp index 2b13ac4632..93e0f9f638 100644 --- a/samples/artprov/artbrows.cpp +++ b/samples/artprov/artbrows.cpp @@ -28,7 +28,7 @@ #include "artbrows.h" #define ART_CLIENT(id) \ - choice->Append(wxT(#id), (void*)id); + choice->Append(#id, (void*)id); #define ART_ICON(id) \ { \ int ind; \ @@ -37,7 +37,7 @@ ind = images->Add(icon); \ else \ ind = 0; \ - list->InsertItem(index, wxT(#id), ind); \ + list->InsertItem(index, #id, ind); \ list->SetItemPtrData(index, wxPtrToUInt(id)); \ index++; \ } diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp index 944e65a85e..479b30cb7c 100644 --- a/samples/combo/combo.cpp +++ b/samples/combo/combo.cpp @@ -944,7 +944,7 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event ) } else if ( event.GetEventType() == wxEVT_TEXT ) { - wxLogDebug(wxT("EVT_TEXT(id=%i,string=\"%s\")"),event.GetId(),event.GetString().c_str()); + wxLogDebug("EVT_TEXT(id=%i,string=\"%s\")",event.GetId(),event.GetString().c_str()); } else if ( event.GetEventType() == wxEVT_TEXT_ENTER ) { diff --git a/samples/dataview/mymodels.h b/samples/dataview/mymodels.h index 6366250b87..59d3c984a7 100644 --- a/samples/dataview/mymodels.h +++ b/samples/dataview/mymodels.h @@ -226,7 +226,7 @@ public: virtual wxString GetColumnType( unsigned int col ) const wxOVERRIDE { if (col == Col_Toggle) - return wxT( "bool" ); + return "bool"; if (col == Col_IconText) return "wxDataViewIconText"; diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp index faa0fe4862..ecf09b2aac 100644 --- a/samples/debugrpt/debugrpt.cpp +++ b/samples/debugrpt/debugrpt.cpp @@ -466,7 +466,7 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx) } else { - wxLogMessage(wxT("Report generated in \"%s\"."), + wxLogMessage("Report generated in \"%s\".", report->GetCompressedFileName().c_str()); report->Reset(); } diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index e5184a3ca5..37744f6178 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -631,7 +631,7 @@ public: size_t WXUNUSED(len), const void *buf) wxOVERRIDE { wxCHECK_MSG( format == m_formatShape, false, - wxT( "unsupported format") ); + "unsupported format"); delete m_shape; m_shape = DnDShape::New(buf); @@ -1150,7 +1150,7 @@ void DnDFrame::OnDragMoveAllow(wxCommandEvent& event) void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageBox("Drag-&-Drop Demo\n" - wxT("Please see \"Help|Help...\" for details\n") + "Please see \"Help|Help...\" for details\n" "Copyright (c) 1998 Vadim Zeitlin", "About wxDnD", wxICON_INFORMATION | wxOK, @@ -1175,11 +1175,11 @@ void DnDFrame::OnHelp(wxCommandEvent& /* event */) "it to wordpad or any other droptarget accepting text (and of course you can just drag it\n" "to the right pane). Due to a lot of trace messages, the cursor might take some time to \n" "change, don't release the mouse button until it does. You can change the string being\n" - wxT("dragged in \"File|Test drag...\" dialog.\n") + "dragged in \"File|Test drag...\" dialog.\n" "\n" "\n" "Please send all questions/bug reports/suggestions &c to \n" - wxT("Vadim Zeitlin "), + "Vadim Zeitlin ", "wxDnD Help"); dialog.ShowModal(); @@ -1199,18 +1199,18 @@ void DnDFrame::OnLogClear(wxCommandEvent& /* event */ ) void DnDFrame::LogDragResult(wxDragResult result) { #if wxUSE_STATUSBAR - wxString pc; + wxString msg; switch ( result ) { - case wxDragError: pc = "Error!"; break; - case wxDragNone: pc = "Nothing"; break; - case wxDragCopy: pc = "Copied"; break; - case wxDragMove: pc = "Moved"; break; - case wxDragCancel: pc = "Cancelled"; break; - default: pc = "Huh?"; break; + case wxDragError: msg = "Error!"; break; + case wxDragNone: msg = "Nothing"; break; + case wxDragCopy: msg = "Copied"; break; + case wxDragMove: msg = "Moved"; break; + case wxDragCancel: msg = "Cancelled"; break; + default: msg = "Huh?"; break; } - SetStatusText(wxString("Drag result: ") + pc); + SetStatusText(wxString("Drag result: ") + msg); #else wxUnusedVar(result); #endif // wxUSE_STATUSBAR @@ -1294,9 +1294,9 @@ void DnDFrame::OnCopyBitmap(wxCommandEvent& WXUNUSED(event)) { // PNG support is not always compiled in under Windows, so use BMP there #if wxUSE_LIBPNG - wxFileDialog dialog(this, "Open a PNG file", wxEmptyString, wxEmptyString, wxT("PNG files (*.png)|*.png"), 0); + wxFileDialog dialog(this, "Open a PNG file", wxEmptyString, wxEmptyString, "PNG files (*.png)|*.png", 0); #else - wxFileDialog dialog(this, "Open a BMP file", wxEmptyString, wxEmptyString, wxT("BMP files (*.bmp)|*.bmp"), 0); + wxFileDialog dialog(this, "Open a BMP file", wxEmptyString, wxEmptyString, "BMP files (*.bmp)|*.bmp", 0); #endif if (dialog.ShowModal() != wxID_OK) @@ -1439,7 +1439,7 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event)) { #ifdef __WXMSW__ wxFileDialog dialog(this, "Select a file to copy", wxEmptyString, wxEmptyString, - wxT("All files (*.*)|*.*"), 0); + "All files (*.*)|*.*", 0); wxArrayString filenames; while ( dialog.ShowModal() == wxID_OK ) @@ -1802,7 +1802,7 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event) DnDShapeDataObject shapeData(m_shape); wxDropSource source(shapeData, this); - wxString pc; + wxString msg; switch ( source.DoDragDrop(true) ) { default: @@ -1817,11 +1817,11 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event) break; case wxDragCopy: - pc = "copied"; + msg = "copied"; break; case wxDragMove: - pc = "moved"; + msg = "moved"; if ( ms_lastDropTarget != this ) { // don't delete the shape if we dropped it on ourselves! @@ -1836,10 +1836,10 @@ void DnDShapeFrame::OnDrag(wxMouseEvent& event) break; } - if ( pc.length() ) + if (msg.length() ) { #if wxUSE_STATUSBAR - SetStatusText(wxString("Shape successfully ") + pc); + SetStatusText(wxString("Shape successfully ") + msg); #endif // wxUSE_STATUSBAR } //else: status text already set diff --git a/samples/except/except.cpp b/samples/except/except.cpp index 30173d8e47..c10e374623 100644 --- a/samples/except/except.cpp +++ b/samples/except/except.cpp @@ -464,7 +464,7 @@ bool MyFrame::ProcessEvent(wxEvent& event) } catch ( const wxChar *msg ) { - wxLogMessage(wxT("Caught a string \"%s\" in MyFrame"), msg); + wxLogMessage("Caught a string \"%s\" in MyFrame", msg); return true; } diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index 860a7011e0..b88e3ff441 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -343,7 +343,7 @@ enum Exec_Btn_Close }; -static wxString DIALOG_TITLE() +static wxString GetDialogTitle() { return "Exec sample"; } @@ -675,12 +675,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event)) } else { - wxArrayString errorText; - errorText.push_back(""); // no error - errorText.push_back("signal not supported"); - errorText.push_back("permission denied"); - errorText.push_back("no such process"); - errorText.push_back("unspecified error"); + const wxString errorText[] = { "", // no error + "signal not supported", + "permission denied", + "no such process", + "unspecified error" }; wxLogStatus("Failed to kill process %ld with signal %d: %s", pid, sig, errorText[rc]); @@ -742,7 +741,7 @@ wxBEGIN_EVENT_TABLE(ExecQueryDialog, wxDialog) wxEND_EVENT_TABLE() ExecQueryDialog::ExecQueryDialog(const wxString& cmd) - : wxDialog(NULL, wxID_ANY, DIALOG_TITLE(), + : wxDialog(NULL, wxID_ANY, GetDialogTitle(), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { @@ -891,7 +890,7 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event)) { wxString cmd = wxGetTextFromUser("Enter the command: ", - DIALOG_TITLE(), + GetDialogTitle(), m_cmdLast); if ( !cmd ) @@ -903,7 +902,7 @@ void MyFrame::OnAsyncExec(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event)) { wxString cmd = wxGetTextFromUser("Enter the command: ", - DIALOG_TITLE(), + GetDialogTitle(), m_cmdLast); if ( !cmd ) @@ -927,7 +926,7 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) } wxString cmd = wxGetTextFromUser("Enter the command: ", - DIALOG_TITLE(), + GetDialogTitle(), m_cmdLast); if ( !cmd ) @@ -989,14 +988,14 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event)) m_cmdLast = "tr [a-z] [A-Z]"; wxString cmd = wxGetTextFromUser("Enter the command: ", - DIALOG_TITLE(), + GetDialogTitle(), m_cmdLast); if ( !cmd ) return; wxString input = wxGetTextFromUser("Enter the string to send to it: ", - DIALOG_TITLE()); + GetDialogTitle()); if ( !input ) return; @@ -1022,7 +1021,7 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnPOpen(wxCommandEvent& WXUNUSED(event)) { wxString cmd = wxGetTextFromUser("Enter the command to launch: ", - DIALOG_TITLE(), + GetDialogTitle(), m_cmdLast); if ( cmd.empty() ) return; @@ -1174,7 +1173,7 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event)) if ( !wxLaunchDefaultBrowser(s_url) ) { - wxLogError(wxT("Failed to open URL \"%s\""), s_url.c_str()); + wxLogError("Failed to open URL \"%s\"", s_url.c_str()); } } @@ -1187,19 +1186,19 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event)) bool MyFrame::GetDDEServer() { wxString server = wxGetTextFromUser("Server to connect to:", - DIALOG_TITLE(), m_server); + GetDialogTitle(), m_server); if ( !server ) return false; m_server = server; - wxString topic = wxGetTextFromUser("DDE topic:", DIALOG_TITLE(), m_topic); + wxString topic = wxGetTextFromUser("DDE topic:", GetDialogTitle(), m_topic); if ( !topic ) return false; m_topic = topic; - wxString cmd = wxGetTextFromUser("DDE command:", DIALOG_TITLE(), m_cmdDde); + wxString cmd = wxGetTextFromUser("DDE command:", GetDialogTitle(), m_cmdDde); if ( !cmd ) return false; diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 112e705da5..a73720f811 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -45,7 +45,7 @@ #endif // used as title for several dialog boxes -static wxString SAMPLE_TITLE() +static wxString GetSampleTitle() { return "wxWidgets Font Sample"; } @@ -659,7 +659,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, n = wxGetSingleChoiceIndex ( "Choose a facename", - SAMPLE_TITLE(), + GetSampleTitle(), nFacenames, facenames, this @@ -713,7 +713,7 @@ void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event)) font.SetNativeFontInfo(fontInfo); if ( !font.IsOk() ) { - wxLogError(wxT("Font info string \"%s\" is invalid."), + wxLogError("Font info string \"%s\" is invalid.", fontInfo.c_str()); return; } @@ -807,7 +807,7 @@ wxFontEncoding MyFrame::GetEncodingFromUser() int i = wxGetSingleChoiceIndex ( "Choose the encoding", - SAMPLE_TITLE(), + GetSampleTitle(), names, this ); @@ -837,7 +837,7 @@ wxFontFamily MyFrame::GetFamilyFromUser() int i = wxGetSingleChoiceIndex ( "Choose the family", - SAMPLE_TITLE(), + GetSampleTitle(), names, this ); @@ -1088,10 +1088,10 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) { // found! const wxChar *pc = line.c_str() + len; - if ( *pc == wxT('"') ) + if ( *pc == '"') pc++; - while ( *pc && *pc != wxT('"') ) + while ( *pc && *pc != '"') { charset += *pc++; } @@ -1165,7 +1165,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageBox("wxWidgets font sample\n" "(c) 1999-2006 Vadim Zeitlin", - wxString("About ") + SAMPLE_TITLE(), + wxString("About ") + GetSampleTitle(), wxOK | wxICON_INFORMATION, this); } diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 1439fef65c..1e6c8087ca 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -1850,13 +1850,12 @@ void BugsGridTable::SetValueAsBool( int row, int col, bool value ) wxString BugsGridTable::GetColLabelValue( int col ) { - static wxArrayString headers; - headers.push_back("Id"); - headers.push_back("Summary"); - headers.push_back("Severity"); - headers.push_back("Priority"); - headers.push_back("Platform"); - headers.push_back("Opened?"); + static const wxString headers[] = { "Id", + "Summary", + "Severity", + "Priority", + "Platform", + "Opened?" }; return headers[col]; } diff --git a/samples/image/canvas.cpp b/samples/image/canvas.cpp index 31e2bfc268..d02ac51477 100644 --- a/samples/image/canvas.cpp +++ b/samples/image/canvas.cpp @@ -153,7 +153,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, #if wxUSE_GIF image.Destroy(); - if ( !image.LoadFile( dir + wxT("horse.gif" )) ) + if ( !image.LoadFile( dir + "horse.gif" ) ) { wxLogError("Can't load GIF image"); } diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index e0b27439f7..241be9d26d 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -397,8 +397,8 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) } else if ( num == 9 ) { - // this message is not translated (not in catalog) because we used wxT() - // and not _() around it + // this message is not translated (not in catalog) because we + // did not put _() around it str = "You've found a bug in this program!"; } else if ( num == 17 ) diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index cea7e80e80..2c14651761 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -251,7 +251,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event)) m_client = new MyClient; bool retval = m_client->Connect(hostname, servername, topic); - wxLogMessage(wxT("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s"), + wxLogMessage("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s", hostname.c_str(), servername.c_str(), topic.c_str(), retval ? "connected" : "failed to connect"); diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 04c9be5587..290fee2afe 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -368,7 +368,7 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent) sizerFlex->SetFlexibleDirection(wxHORIZONTAL); sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); - sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Same with grow mode == \"none\"")), 0, wxCENTER | wxTOP, 20); + sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Same with grow mode == \"none\""), 0, wxCENTER | wxTOP, 20); sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5)); InitFlexSizer(sizerFlex, p); sizerFlex->AddGrowableCol(1); @@ -377,7 +377,7 @@ MyFlexSizerFrame::MyFlexSizerFrame(wxFrame* parent) sizerFlex->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_NONE); sizerCol2->Add(sizerFlex, 1, wxALL | wxEXPAND, 10); - sizerCol2->Add(new wxStaticText(p, wxID_ANY, wxT("Same with grow mode == \"all\"")), 0, wxCENTER | wxTOP, 20); + sizerCol2->Add(new wxStaticText(p, wxID_ANY, "Same with grow mode == \"all\""), 0, wxCENTER | wxTOP, 20); sizerFlex = new wxFlexGridSizer(3, 3, wxSize(5, 5)); InitFlexSizer(sizerFlex, p); sizerFlex->AddGrowableCol(1); @@ -441,15 +441,18 @@ MySizerDialog::MySizerDialog(wxWindow *parent, const wxString &title) // ---------------------------------------------------------------------------- // some simple macros to help make the sample code below more clear -#define TEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, wxT(text)) -#define MLTEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, wxT(text), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE) +#define TEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, text) +#define MLTEXTCTRL(text) new wxTextCtrl(p, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE) #define POS(r, c) wxGBPosition(r,c) #define SPAN(r, c) wxGBSpan(r,c) -const wxChar gbsDescription[] =wxT("\ -The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned\n\ -in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this\n\ -static text is positioned at (0,0) and it spans 7 columns."); +wxString GetGbsDescription() +{ + return "\ + The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned\n\ + in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this\n\ + static text is positioned at (0,0) and it spans 7 columns."; +} // Some IDs @@ -479,7 +482,7 @@ MyGridBagSizerFrame::MyGridBagSizerFrame(wxFrame* parent) m_gbs = new wxGridBagSizer(); - m_gbs->Add( new wxStaticText(p, wxID_ANY, gbsDescription), + m_gbs->Add( new wxStaticText(p, wxID_ANY, GetGbsDescription()), POS(0,0), SPAN(1, 7), wxALIGN_CENTER | wxALL, 5); @@ -557,9 +560,9 @@ void MyGridBagSizerFrame::OnMoveBtn(wxCommandEvent& event) { if ( m_gbs->CheckForIntersection(wxGBPosition(3,6), wxGBSpan(1,1)) ) wxMessageBox( -wxT("wxGridBagSizer will not allow items to be in the same cell as\n\ +"wxGridBagSizer will not allow items to be in the same cell as\n\ another item, so this operation will fail. You will also get an assert\n\ -when compiled in debug mode."), "Warning", wxOK | wxICON_INFORMATION); +when compiled in debug mode.", "Warning", wxOK | wxICON_INFORMATION); if ( m_gbs->SetItemPosition(btn, wxGBPosition(3,6)) ) { diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 84d6898b04..a0d2f287a9 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -95,7 +95,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - MyFrame *frame = new MyFrame(wxT("wxListCtrl Test")); + MyFrame *frame = new MyFrame("wxListCtrl Test"); // Show the frame frame->Show(true); @@ -169,7 +169,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() // My frame constructor -MyFrame::MyFrame(const wxChar *title) +MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) { m_listCtrl = NULL; @@ -185,17 +185,17 @@ MyFrame::MyFrame(const wxChar *title) m_imageListSmall = new wxImageList(16, 16, true); #ifdef wxHAS_IMAGES_IN_RESOURCES - m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListNormal->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE) ); - m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) ); + m_imageListSmall->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE) ); #else m_imageListNormal->Add( wxIcon( toolbrai_xpm ) ); @@ -213,77 +213,77 @@ MyFrame::MyFrame(const wxChar *title) // Make a menubar wxMenu *menuFile = new wxMenu; - menuFile->Append(LIST_ABOUT, wxT("&About")); + menuFile->Append(LIST_ABOUT, "&About"); menuFile->AppendSeparator(); - menuFile->Append(LIST_QUIT, wxT("E&xit\tAlt-X")); + menuFile->Append(LIST_QUIT, "E&xit\tAlt-X"); wxMenu *menuView = new wxMenu; - menuView->Append(LIST_LIST_VIEW, wxT("&List view\tF1")); - menuView->Append(LIST_REPORT_VIEW, wxT("&Report view\tF2")); - menuView->Append(LIST_ICON_VIEW, wxT("&Icon view\tF3")); - menuView->Append(LIST_ICON_TEXT_VIEW, wxT("Icon view with &text\tF4")); - menuView->Append(LIST_SMALL_ICON_VIEW, wxT("&Small icon view\tF5")); - menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, wxT("Small icon &view with text\tF6")); - menuView->Append(LIST_VIRTUAL_VIEW, wxT("&Virtual view\tF7")); - menuView->Append(LIST_SMALL_VIRTUAL_VIEW, wxT("Small virtual vie&w\tF8")); + menuView->Append(LIST_LIST_VIEW, "&List view\tF1"); + menuView->Append(LIST_REPORT_VIEW, "&Report view\tF2"); + menuView->Append(LIST_ICON_VIEW, "&Icon view\tF3"); + menuView->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text\tF4"); + menuView->Append(LIST_SMALL_ICON_VIEW, "&Small icon view\tF5"); + menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text\tF6"); + menuView->Append(LIST_VIRTUAL_VIEW, "&Virtual view\tF7"); + menuView->Append(LIST_SMALL_VIRTUAL_VIEW, "Small virtual vie&w\tF8"); menuView->AppendSeparator(); menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items"); #ifdef __WXOSX__ menuView->AppendSeparator(); - menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, wxT("Mac: Use Generic Control")); + menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, "Mac: Use Generic Control"); #endif wxMenu *menuList = new wxMenu; - menuList->Append(LIST_GOTO, wxT("&Go to item #3\tCtrl-3")); - menuList->Append(LIST_FOCUS_LAST, wxT("&Make last item current\tCtrl-L")); - menuList->Append(LIST_TOGGLE_FIRST, wxT("To&ggle first item\tCtrl-G")); - menuList->Append(LIST_DESELECT_ALL, wxT("&Deselect All\tCtrl-D")); - menuList->Append(LIST_SELECT_ALL, wxT("S&elect All\tCtrl-A")); + menuList->Append(LIST_GOTO, "&Go to item #3\tCtrl-3"); + menuList->Append(LIST_FOCUS_LAST, "&Make last item current\tCtrl-L"); + menuList->Append(LIST_TOGGLE_FIRST, "To&ggle first item\tCtrl-G"); + menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D"); + menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A"); menuList->AppendSeparator(); - menuList->Append(LIST_SHOW_COL_INFO, wxT("Show &column info\tCtrl-C")); - menuList->Append(LIST_SHOW_SEL_INFO, wxT("Show &selected items\tCtrl-S")); - menuList->Append(LIST_SHOW_VIEW_RECT, wxT("Show &view rect")); + menuList->Append(LIST_SHOW_COL_INFO, "Show &column info\tCtrl-C"); + menuList->Append(LIST_SHOW_SEL_INFO, "Show &selected items\tCtrl-S"); + menuList->Append(LIST_SHOW_VIEW_RECT, "Show &view rect"); #ifdef wxHAS_LISTCTRL_COLUMN_ORDER - menuList->Append(LIST_SET_COL_ORDER, wxT("Se&t columns order\tShift-Ctrl-O")); - menuList->Append(LIST_GET_COL_ORDER, wxT("Sho&w columns order\tCtrl-O")); + menuList->Append(LIST_SET_COL_ORDER, "Se&t columns order\tShift-Ctrl-O"); + menuList->Append(LIST_GET_COL_ORDER, "Sho&w columns order\tCtrl-O"); #endif // wxHAS_LISTCTRL_COLUMN_ORDER menuList->AppendSeparator(); - menuList->Append(LIST_SORT, wxT("Sor&t\tCtrl-T")); + menuList->Append(LIST_SORT, "Sor&t\tCtrl-T"); menuList->Append(LIST_FIND, "Test Find() performance"); menuList->AppendSeparator(); - menuList->Append(LIST_ADD, wxT("&Append an item\tCtrl-P")); - menuList->Append(LIST_EDIT, wxT("&Edit the item\tCtrl-E")); - menuList->Append(LIST_DELETE, wxT("&Delete first item\tCtrl-X")); - menuList->Append(LIST_DELETE_ALL, wxT("Delete &all items")); + menuList->Append(LIST_ADD, "&Append an item\tCtrl-P"); + menuList->Append(LIST_EDIT, "&Edit the item\tCtrl-E"); + menuList->Append(LIST_DELETE, "&Delete first item\tCtrl-X"); + menuList->Append(LIST_DELETE_ALL, "Delete &all items"); menuList->AppendSeparator(); - menuList->Append(LIST_FREEZE, wxT("Free&ze\tCtrl-Z")); - menuList->Append(LIST_THAW, wxT("Tha&w\tCtrl-W")); + menuList->Append(LIST_FREEZE, "Free&ze\tCtrl-Z"); + menuList->Append(LIST_THAW, "Tha&w\tCtrl-W"); menuList->AppendSeparator(); - menuList->AppendCheckItem(LIST_TOGGLE_LINES, wxT("Toggle &lines\tCtrl-I")); + menuList->AppendCheckItem(LIST_TOGGLE_LINES, "Toggle &lines\tCtrl-I"); menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL, - wxT("&Multiple selection\tCtrl-M")); + "&Multiple selection\tCtrl-M"); menuList->Check(LIST_TOGGLE_MULTI_SEL, true); menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H"); menuList->Check(LIST_TOGGLE_HEADER, true); menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match"); menuList->AppendSeparator(); menuList->AppendCheckItem(LIST_TOGGLE_CHECKBOXES, - wxT("&Enable Checkboxes")); + "&Enable Checkboxes"); menuList->Check(LIST_TOGGLE_CHECKBOXES, true); - menuList->Append(LIST_TOGGLE_CHECKBOX, wxT("Toggle the item checkbox state")); - menuList->Append(LIST_GET_CHECKBOX, wxT("Get the item checkbox state")); + menuList->Append(LIST_TOGGLE_CHECKBOX, "Toggle the item checkbox state"); + menuList->Append(LIST_GET_CHECKBOX, "Get the item checkbox state"); wxMenu *menuCol = new wxMenu; - menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour...")); - menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour...")); - menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); + menuCol->Append(LIST_SET_FG_COL, "&Foreground colour..."); + menuCol->Append(LIST_SET_BG_COL, "&Background colour..."); + menuCol->AppendCheckItem(LIST_ROW_LINES, "Alternating colours"); menuCol->AppendCheckItem(LIST_CUSTOM_HEADER_ATTR, "&Custom header attributes"); wxMenuBar *menubar = new wxMenuBar; - menubar->Append(menuFile, wxT("&File")); - menubar->Append(menuView, wxT("&View")); - menubar->Append(menuList, wxT("&List")); - menubar->Append(menuCol, wxT("&Colour")); + menubar->Append(menuFile, "&File"); + menubar->Append(menuView, "&View"); + menubar->Append(menuList, "&List"); + menubar->Append(menuCol, "&Colour"); SetMenuBar(menubar); m_panel = new wxPanel(this, wxID_ANY); @@ -327,7 +327,7 @@ bool MyFrame::CheckNonVirtual() const return true; // "this" == whatever - wxLogWarning(wxT("Can't do this in virtual view, sorry.")); + wxLogWarning("Can't do this in virtual view, sorry."); return false; } @@ -339,22 +339,22 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageDialog dialog(this, wxT("List test sample\nJulian Smart (c) 1997"), - wxT("About list test")); + wxMessageDialog dialog(this, "List test sample\nJulian Smart (c) 1997", + "About list test"); dialog.ShowModal(); } void MyFrame::OnFreeze(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Freezing the control")); + wxLogMessage("Freezing the control"); m_listCtrl->Freeze(); } void MyFrame::OnThaw(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Thawing the control")); + wxLogMessage("Thawing the control"); m_listCtrl->Thaw(); } @@ -380,7 +380,7 @@ void MyFrame::OnToggleBell(wxCommandEvent& event) void MyFrame::OnToggleMacUseGeneric(wxCommandEvent& event) { - wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), event.IsChecked()); + wxSystemOptions::SetOption("mac.listctrl.always_use_generic", event.IsChecked()); } #endif // __WXOSX__ @@ -486,7 +486,7 @@ void MyFrame::RecreateList(long flags, bool withText) break; default: - wxFAIL_MSG( wxT("unknown listctrl mode") ); + wxFAIL_MSG( "unknown listctrl mode" ); } wxMenuBar* const mb = GetMenuBar(); @@ -508,7 +508,7 @@ void MyFrame::InitWithListItems() { for ( int i = 0; i < m_numListItems; i++ ) { - m_listCtrl->InsertItem(i, wxString::Format(wxT("Item %d"), i)); + m_listCtrl->InsertItem(i, wxString::Format("Item %d", i)); } } @@ -524,15 +524,15 @@ void MyFrame::InitWithReportItems() // note that under MSW for SetColumnWidth() to work we need to create the // items with images initially even if we specify dummy image id wxListItem itemCol; - itemCol.SetText(wxT("Column 1")); + itemCol.SetText("Column 1"); itemCol.SetImage(-1); m_listCtrl->InsertColumn(0, itemCol); - itemCol.SetText(wxT("Column 2 (auto size excluding header)")); + itemCol.SetText("Column 2 (auto size excluding header)"); itemCol.SetAlign(wxLIST_FORMAT_CENTRE); m_listCtrl->InsertColumn(1, itemCol); - itemCol.SetText(wxT("Column 3 (auto size including header)")); + itemCol.SetText("Column 3 (auto size including header)"); itemCol.SetAlign(wxLIST_FORMAT_RIGHT); m_listCtrl->InsertColumn(2, itemCol); @@ -546,7 +546,7 @@ void MyFrame::InitWithReportItems() m_listCtrl->InsertItemInReportView(i); } - m_logWindow->WriteText(wxString::Format(wxT("%d items inserted in %ldms\n"), + m_logWindow->WriteText(wxString::Format("%d items inserted in %ldms\n", m_numListItems, sw.Time())); m_listCtrl->Show(); @@ -674,14 +674,14 @@ void MyFrame::InitWithVirtualItems() if ( m_smallVirtual ) { - m_listCtrl->AppendColumn(wxT("Animal")); - m_listCtrl->AppendColumn(wxT("Sound")); + m_listCtrl->AppendColumn("Animal"); + m_listCtrl->AppendColumn("Sound"); m_listCtrl->SetItemCount(WXSIZEOF(SMALL_VIRTUAL_VIEW_ITEMS)); } else { - m_listCtrl->AppendColumn(wxT("First Column (size auto)")); - m_listCtrl->AppendColumn(wxT("Second Column (150px)")); + m_listCtrl->AppendColumn("First Column (size auto)"); + m_listCtrl->AppendColumn("Second Column (150px)"); m_listCtrl->SetItemCount(1000000); m_listCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER); m_listCtrl->SetColumnWidth(1, 150); @@ -694,7 +694,7 @@ void MyFrame::OnSort(wxCommandEvent& WXUNUSED(event)) m_listCtrl->SortItems(MyCompareFunction, 0); - m_logWindow->WriteText(wxString::Format(wxT("Sorting %d items took %ld ms\n"), + m_logWindow->WriteText(wxString::Format("Sorting %d items took %ld ms\n", m_listCtrl->GetItemCount(), sw.Time())); } @@ -714,7 +714,7 @@ void MyFrame::OnFind(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event)) { int selCount = m_listCtrl->GetSelectedItemCount(); - wxLogMessage(wxT("%d items selected:"), selCount); + wxLogMessage("%d items selected:", selCount); // don't show too many items size_t shownCount = 0; @@ -723,12 +723,12 @@ void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event)) wxLIST_STATE_SELECTED); while ( item != -1 ) { - wxLogMessage(wxT("\t%ld (%s)"), + wxLogMessage("\t%ld (%s)", item, m_listCtrl->GetItemText(item).c_str()); if ( ++shownCount > 10 ) { - wxLogMessage(wxT("\t... more selected items snipped...")); + wxLogMessage("\t... more selected items snipped..."); break; } @@ -812,10 +812,10 @@ void MyFrame::OnGetColOrder(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnShowColInfo(wxCommandEvent& WXUNUSED(event)) { int count = m_listCtrl->GetColumnCount(); - wxLogMessage(wxT("%d columns:"), count); + wxLogMessage("%d columns:", count); for ( int c = 0; c < count; c++ ) { - wxLogMessage(wxT("\tcolumn %d has width %d"), c, + wxLogMessage("\tcolumn %d has width %d", c, m_listCtrl->GetColumnWidth(c)); } } @@ -833,8 +833,8 @@ void MyFrame::OnToggleMultiSel(wxCommandEvent& WXUNUSED(event)) else flags |= wxLC_SINGLE_SEL; - m_logWindow->WriteText(wxString::Format(wxT("Current selection mode: %sle\n"), - (flags & wxLC_SINGLE_SEL) ? wxT("sing") : wxT("multip"))); + m_logWindow->WriteText(wxString::Format("Current selection mode: %sle\n", + (flags & wxLC_SINGLE_SEL) ? "sing" : "multip")); RecreateList(flags); } @@ -909,7 +909,7 @@ void MyFrame::OnCustomHeaderAttr(wxCommandEvent& event) void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event)) { - m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxT("Appended item")); + m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), "Appended item"); } void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event)) @@ -932,7 +932,7 @@ void MyFrame::OnEdit(wxCommandEvent& WXUNUSED(event)) } else { - m_logWindow->WriteText(wxT("No item to edit")); + m_logWindow->WriteText("No item to edit"); } } } @@ -957,7 +957,7 @@ void MyFrame::OnGetItemCheckBox(wxCommandEvent& WXUNUSED(event)) { bool checked = m_listCtrl->IsItemChecked(item); - wxLogMessage(wxT("Item %ld is %s"), item, checked ? wxT("checked") : wxT("unchecked")); + wxLogMessage("Item %ld is %s", item, checked ? "checked" : "unchecked"); item = m_listCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); @@ -972,7 +972,7 @@ void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event)) } else { - m_logWindow->WriteText(wxT("Nothing to delete")); + m_logWindow->WriteText("Nothing to delete"); } } @@ -984,7 +984,7 @@ void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event)) m_listCtrl->DeleteAllItems(); - m_logWindow->WriteText(wxString::Format(wxT("Deleting %d items took %ld ms\n"), + m_logWindow->WriteText(wxString::Format("Deleting %d items took %ld ms\n", itemCount, sw.Time())); } @@ -1029,7 +1029,7 @@ wxEND_EVENT_TABLE() void MyListCtrl::OnCacheHint(wxListEvent& event) { - wxLogMessage( wxT("OnCacheHint: cache items %ld..%ld"), + wxLogMessage( "OnCacheHint: cache items %ld..%ld", event.GetCacheFrom(), event.GetCacheTo() ); } @@ -1050,7 +1050,7 @@ void MyListCtrl::OnColClick(wxListEvent& event) x = !x; SetColumnImage(col, x ? 0 : -1); - wxLogMessage( wxT("OnColumnClick at %d."), col ); + wxLogMessage( "OnColumnClick at %d.", col ); } void MyListCtrl::OnColRightClick(wxListEvent& event) @@ -1062,18 +1062,18 @@ void MyListCtrl::OnColRightClick(wxListEvent& event) } // Show popupmenu at position - wxMenu menu(wxT("Test")); - menu.Append(LIST_ABOUT, wxT("&About")); + wxMenu menu("Test"); + menu.Append(LIST_ABOUT, "&About"); PopupMenu(&menu, event.GetPoint()); - wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() ); + wxLogMessage( "OnColumnRightClick at %d.", event.GetColumn() ); } -void MyListCtrl::LogColEvent(const wxListEvent& event, const wxChar *name) +void MyListCtrl::LogColEvent(const wxListEvent& event, const wxString& name) { const int col = event.GetColumn(); - wxLogMessage(wxT("%s: column %d (width = %d or %d)."), + wxLogMessage("%s: column %d (width = %d or %d).", name, col, event.GetItem().GetWidth(), @@ -1082,11 +1082,11 @@ void MyListCtrl::LogColEvent(const wxListEvent& event, const wxChar *name) void MyListCtrl::OnColBeginDrag(wxListEvent& event) { - LogColEvent( event, wxT("OnColBeginDrag") ); + LogColEvent( event, "OnColBeginDrag" ); if ( event.GetColumn() == 0 ) { - wxLogMessage(wxT("Resizing this column shouldn't work.")); + wxLogMessage("Resizing this column shouldn't work."); event.Veto(); } @@ -1094,12 +1094,12 @@ void MyListCtrl::OnColBeginDrag(wxListEvent& event) void MyListCtrl::OnColDragging(wxListEvent& event) { - LogColEvent( event, wxT("OnColDragging") ); + LogColEvent( event, "OnColDragging" ); } void MyListCtrl::OnColEndDrag(wxListEvent& event) { - LogColEvent( event, wxT("OnColEndDrag") ); + LogColEvent( event, "OnColEndDrag" ); } void MyListCtrl::OnBeginDrag(wxListEvent& event) @@ -1107,19 +1107,19 @@ void MyListCtrl::OnBeginDrag(wxListEvent& event) const wxPoint& pt = event.m_pointDrag; int flags; - wxLogMessage( wxT("OnBeginDrag at (%d, %d), item %ld."), + wxLogMessage( "OnBeginDrag at (%d, %d), item %ld.", pt.x, pt.y, HitTest(pt, flags) ); } void MyListCtrl::OnBeginRDrag(wxListEvent& event) { - wxLogMessage( wxT("OnBeginRDrag at %d,%d."), + wxLogMessage( "OnBeginRDrag at %d,%d.", event.m_pointDrag.x, event.m_pointDrag.y ); } void MyListCtrl::OnBeginLabelEdit(wxListEvent& event) { - wxLogMessage( wxT("OnBeginLabelEdit: %s"), event.m_item.m_text.c_str()); + wxLogMessage( "OnBeginLabelEdit: %s", event.m_item.m_text.c_str()); wxTextCtrl * const text = GetEditControl(); if ( !text ) @@ -1134,7 +1134,7 @@ void MyListCtrl::OnBeginLabelEdit(wxListEvent& event) void MyListCtrl::OnEndLabelEdit(wxListEvent& event) { - wxLogMessage( wxT("OnEndLabelEdit: %s"), + wxLogMessage( "OnEndLabelEdit: %s", ( event.IsEditCancelled() ? wxString("[cancelled]") : @@ -1145,18 +1145,18 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event) void MyListCtrl::OnDeleteItem(wxListEvent& event) { - LogEvent(event, wxT("OnDeleteItem")); - wxLogMessage( wxT("Number of items when delete event is sent: %d"), GetItemCount() ); + LogEvent(event, "OnDeleteItem"); + wxLogMessage( "Number of items when delete event is sent: %d", GetItemCount() ); } void MyListCtrl::OnDeleteAllItems(wxListEvent& event) { - LogEvent(event, wxT("OnDeleteAllItems")); + LogEvent(event, "OnDeleteAllItems"); } void MyListCtrl::OnSelected(wxListEvent& event) { - LogEvent(event, wxT("OnSelected")); + LogEvent(event, "OnSelected"); if ( GetWindowStyle() & wxLC_REPORT ) { @@ -1166,50 +1166,50 @@ void MyListCtrl::OnSelected(wxListEvent& event) info.m_mask = wxLIST_MASK_TEXT; if ( GetItem(info) ) { - wxLogMessage(wxT("Value of the 2nd field of the selected item: %s"), + wxLogMessage("Value of the 2nd field of the selected item: %s", info.m_text.c_str()); } else { - wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed")); + wxFAIL_MSG("wxListCtrl::GetItem() failed"); } } } void MyListCtrl::OnDeselected(wxListEvent& event) { - LogEvent(event, wxT("OnDeselected")); + LogEvent(event, "OnDeselected"); } void MyListCtrl::OnActivated(wxListEvent& event) { - LogEvent(event, wxT("OnActivated")); + LogEvent(event, "OnActivated"); } void MyListCtrl::OnFocused(wxListEvent& event) { - LogEvent(event, wxT("OnFocused")); + LogEvent(event, "OnFocused"); event.Skip(); } void MyListCtrl::OnItemRightClick(wxListEvent& event) { - LogEvent(event, wxT("OnItemRightClick")); + LogEvent(event, "OnItemRightClick"); event.Skip(); } void MyListCtrl::OnChecked(wxListEvent& event) { - LogEvent(event, wxT("OnChecked")); + LogEvent(event, "OnChecked"); event.Skip(); } void MyListCtrl::OnUnChecked(wxListEvent& event) { - LogEvent(event, wxT("OnUnChecked")); + LogEvent(event, "OnUnChecked"); event.Skip(); } @@ -1220,7 +1220,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) if ( !wxGetKeyState(WXK_SHIFT) ) { - LogEvent(event, wxT("OnListKeyDown")); + LogEvent(event, "OnListKeyDown"); event.Skip(); return; } @@ -1258,7 +1258,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) item = 0; } - wxLogMessage(wxT("Focusing item %ld"), item); + wxLogMessage("Focusing item %ld", item); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); EnsureVisible(item); @@ -1270,11 +1270,11 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) wxRect r; if ( !GetItemRect(item, r) ) { - wxLogError(wxT("Failed to retrieve rect of item %ld"), item); + wxLogError("Failed to retrieve rect of item %ld", item); break; } - wxLogMessage(wxT("Bounding rect of item %ld is (%d, %d)-(%d, %d)"), + wxLogMessage("Bounding rect of item %ld is (%d, %d)-(%d, %d)", item, r.x, r.y, r.x + r.width, r.y + r.height); } break; @@ -1297,11 +1297,11 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) if ( !GetSubItemRect(item, subItem, r, code) ) { - wxLogError(wxT("Failed to retrieve rect of item %ld column %d"), item, subItem + 1); + wxLogError("Failed to retrieve rect of item %ld column %d", item, subItem + 1); break; } - wxLogMessage(wxT("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)"), + wxLogMessage("Bounding rect of item %ld column %d is (%d, %d)-(%d, %d)", item, subItem + 1, r.x, r.y, r.x + r.width, r.y + r.height); } @@ -1333,7 +1333,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) { DeleteItem(item); - wxLogMessage(wxT("Item %ld deleted"), item); + wxLogMessage("Item %ld deleted", item); // -1 because the indices were shifted by DeleteItem() item = GetNextItem(item - 1, @@ -1357,7 +1357,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) wxFALLTHROUGH; default: - LogEvent(event, wxT("OnListKeyDown")); + LogEvent(event, "OnListKeyDown"); event.Skip(); } @@ -1365,7 +1365,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) void MyListCtrl::OnChar(wxKeyEvent& event) { - wxLogMessage(wxT("Got char event.")); + wxLogMessage("Got char event."); event.Skip(); } @@ -1385,24 +1385,24 @@ void MyListCtrl::OnRightClick(wxMouseEvent& event) wxString where; switch ( flags ) { - case wxLIST_HITTEST_ABOVE: where = wxT("above"); break; - case wxLIST_HITTEST_BELOW: where = wxT("below"); break; - case wxLIST_HITTEST_NOWHERE: where = wxT("nowhere near"); break; - case wxLIST_HITTEST_ONITEMICON: where = wxT("on icon of"); break; - case wxLIST_HITTEST_ONITEMLABEL: where = wxT("on label of"); break; - case wxLIST_HITTEST_ONITEMRIGHT: where = wxT("right on"); break; - case wxLIST_HITTEST_TOLEFT: where = wxT("to the left of"); break; - case wxLIST_HITTEST_TORIGHT: where = wxT("to the right of"); break; - default: where = wxT("not clear exactly where on"); break; + case wxLIST_HITTEST_ABOVE: where = "above"; break; + case wxLIST_HITTEST_BELOW: where = "below"; break; + case wxLIST_HITTEST_NOWHERE: where = "nowhere near"; break; + case wxLIST_HITTEST_ONITEMICON: where = "on icon of"; break; + case wxLIST_HITTEST_ONITEMLABEL: where = "on label of"; break; + case wxLIST_HITTEST_ONITEMRIGHT: where = "right on"; break; + case wxLIST_HITTEST_TOLEFT: where = "to the left of"; break; + case wxLIST_HITTEST_TORIGHT: where = "to the right of"; break; + default: where = "not clear exactly where on"; break; } - wxLogMessage(wxT("Right double click %s item %ld, subitem %ld"), + wxLogMessage("Right double click %s item %ld, subitem %ld", where.c_str(), item, subitem); } -void MyListCtrl::LogEvent(const wxListEvent& event, const wxChar *eventName) +void MyListCtrl::LogEvent(const wxListEvent& event, const wxString& eventName) { - wxLogMessage(wxT("Item %ld: %s (item text = %s, data = %ld)"), + wxLogMessage("Item %ld: %s (item text = %s, data = %ld)", event.GetIndex(), eventName, event.GetText(), static_cast(event.GetData())); } @@ -1415,7 +1415,7 @@ wxString MyListCtrl::OnGetItemText(long item, long column) const } else // "big" virtual control { - return wxString::Format(wxT("Column %ld of item %ld"), column, item); + return wxString::Format("Column %ld of item %ld", column, item); } } @@ -1446,14 +1446,14 @@ wxItemAttr *MyListCtrl::OnGetItemAttr(long item) const void MyListCtrl::InsertItemInReportView(int i) { wxString buf; - buf.Printf(wxT("This is item %d"), i); + buf.Printf("This is item %d", i); long tmp = InsertItem(i, buf, 0); SetItemData(tmp, i); - buf.Printf(wxT("Col 1, item %d"), i); + buf.Printf("Col 1, item %d", i); SetItem(tmp, 1, buf); - buf.Printf(wxT("Item %d in column 2"), i); + buf.Printf("Item %d in column 2", i); SetItem(tmp, 2, buf); } @@ -1490,9 +1490,9 @@ void MyListCtrl::ShowContextMenu(const wxPoint& pos) { wxMenu menu; - menu.Append(wxID_ABOUT, wxT("&About")); + menu.Append(wxID_ABOUT, "&About"); menu.AppendSeparator(); - menu.Append(wxID_EXIT, wxT("E&xit")); + menu.Append(wxID_EXIT, "E&xit"); PopupMenu(&menu, pos.x, pos.y); } diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index 4f4b8a13f4..e48b5292ef 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -79,8 +79,8 @@ private: wxLog *m_logOld; void SetColumnImage(int col, int image); - void LogEvent(const wxListEvent& event, const wxChar *eventName); - void LogColEvent(const wxListEvent& event, const wxChar *eventName); + void LogEvent(const wxListEvent& event, const wxString& eventName); + void LogColEvent(const wxListEvent& event, const wxString& eventName); virtual wxString OnGetItemText(long item, long column) const wxOVERRIDE; virtual int OnGetItemColumnImage(long item, long column) const wxOVERRIDE; @@ -97,7 +97,7 @@ private: class MyFrame: public wxFrame { public: - MyFrame(const wxChar *title); + MyFrame(const wxString& title); virtual ~MyFrame(); protected: diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index 3501d2a243..ae44dae5bc 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -674,9 +674,9 @@ MyFrame::MyFrame() wxLog::DisableTimestamp(); m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_textctrl)); - wxLogMessage(wxT("Brief explanations: the commands in the \"Menu\" menu ") - wxT("append/insert/delete items to/from the \"Test\" menu.\n") - wxT("The commands in the \"Menubar\" menu work with the ") + wxLogMessage("Brief explanations: the commands in the \"Menu\" menu " + "append/insert/delete items to/from the \"Test\" menu.\n" + "The commands in the \"Menubar\" menu work with the " "menubar itself.\n\n" "Right click the band below to test popup menus.\n"); #endif diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 9d53b15d94..6fcf42912b 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -70,7 +70,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent) wxPanel *panel = new wxPanel(parent); #if wxUSE_HELP - panel->SetHelpText( wxT( "Panel with a Button" ) ); + panel->SetHelpText("Panel with a Button"); #endif (void) new wxButton( panel, wxID_ANY, "Button", @@ -84,7 +84,7 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent) wxPanel *panel = new wxPanel(parent); #if wxUSE_HELP - panel->SetHelpText( wxT( "Panel with some Radio Buttons" ) ); + panel->SetHelpText("Panel with some Radio Buttons"); #endif wxString animals[] = @@ -115,7 +115,7 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent) wxPanel *panel = new wxPanel(parent); #if wxUSE_HELP - panel->SetHelpText( wxT( "An empty panel" ) ); + panel->SetHelpText("An empty panel"); #endif (void) new wxStaticText( panel, wxID_ANY, @@ -130,7 +130,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent) wxPanel *panel = new wxPanel(parent); #if wxUSE_HELP - panel->SetHelpText( wxT( "Panel with a maximized button" ) ); + panel->SetHelpText("Panel with a maximized button"); #endif wxButton *buttonBig = new wxButton(panel, wxID_ANY, "Maximized button"); @@ -147,7 +147,7 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent) wxPanel *panel = new wxPanel(parent); #if wxUSE_HELP - panel->SetHelpText( wxT( "Maroon panel" ) ); + panel->SetHelpText("Maroon panel"); #endif panel->SetBackgroundColour( wxColour( "MAROON" ) ); @@ -642,7 +642,7 @@ wxPanel *MyFrame::CreateNewPage() const wxPanel *panel = new wxPanel(m_bookCtrl, wxID_ANY ); #if wxUSE_HELP - panel->SetHelpText( wxT( "Panel with \"First\" and \"Second\" buttons" ) ); + panel->SetHelpText("Panel with \"First\" and \"Second\" buttons"); #endif (void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30)); diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 5112f5a7e3..7a0fb4a54d 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -107,8 +107,8 @@ wxPGWindowList wxSampleMultiButtonEditor::CreateControls( wxPropertyGrid* propGr wxPGMultiButton* buttons = new wxPGMultiButton( propGrid, sz ); // Add two regular buttons - buttons->Add( wxT("...") ); - buttons->Add( wxT("A") ); + buttons->Add( "..." ); + buttons->Add( "A" ); // Add a bitmap button buttons->Add( wxArtProvider::GetBitmap(wxART_FOLDER) ); @@ -137,19 +137,19 @@ bool wxSampleMultiButtonEditor::OnEvent( wxPropertyGrid* propGrid, if ( event.GetId() == buttons->GetButtonId(0) ) { // Do something when the first button is pressed - wxLogDebug(wxT("First button pressed")); + wxLogDebug("First button pressed"); return false; // Return false since value did not change } if ( event.GetId() == buttons->GetButtonId(1) ) { // Do something when the second button is pressed - wxMessageBox(wxT("Second button pressed")); + wxMessageBox("Second button pressed"); return false; // Return false since value did not change } if ( event.GetId() == buttons->GetButtonId(2) ) { // Do something when the third button is pressed - wxMessageBox(wxT("Third button pressed")); + wxMessageBox("Third button pressed"); return false; // Return false since value did not change } } @@ -181,15 +181,15 @@ public: virtual bool Validate(wxWindow* WXUNUSED(parent)) wxOVERRIDE { wxTextCtrl* tc = wxDynamicCast(GetWindow(), wxTextCtrl); - wxCHECK_MSG(tc, true, wxT("validator window must be wxTextCtrl")); + wxCHECK_MSG(tc, true, "validator window must be wxTextCtrl"); wxString val = tc->GetValue(); if ( val.find(m_invalidWord) == wxString::npos ) return true; - ::wxMessageBox(wxString::Format(wxT("%s is not allowed word"),m_invalidWord.c_str()), - wxT("Validation Failure")); + ::wxMessageBox(wxString::Format("%s is not allowed word",m_invalidWord.c_str()), + "Validation Failure"); return false; } @@ -217,9 +217,9 @@ wxVectorProperty::wxVectorProperty( const wxString& label, : wxPGProperty(label,name) { SetValue( WXVARIANT(value) ); - AddPrivateChild( new wxFloatProperty(wxT("X"),wxPG_LABEL,value.x) ); - AddPrivateChild( new wxFloatProperty(wxT("Y"),wxPG_LABEL,value.y) ); - AddPrivateChild( new wxFloatProperty(wxT("Z"),wxPG_LABEL,value.z) ); + AddPrivateChild( new wxFloatProperty("X",wxPG_LABEL,value.x) ); + AddPrivateChild( new wxFloatProperty("Y",wxPG_LABEL,value.y) ); + AddPrivateChild( new wxFloatProperty("Z",wxPG_LABEL,value.z) ); } wxVectorProperty::~wxVectorProperty() { } @@ -268,9 +268,9 @@ wxTriangleProperty::wxTriangleProperty( const wxString& label, : wxPGProperty(label,name) { SetValue( WXVARIANT(value) ); - AddPrivateChild( new wxVectorProperty(wxT("A"),wxPG_LABEL,value.a) ); - AddPrivateChild( new wxVectorProperty(wxT("B"),wxPG_LABEL,value.b) ); - AddPrivateChild( new wxVectorProperty(wxT("C"),wxPG_LABEL,value.c) ); + AddPrivateChild( new wxVectorProperty("A",wxPG_LABEL,value.a) ); + AddPrivateChild( new wxVectorProperty("B",wxPG_LABEL,value.b) ); + AddPrivateChild( new wxVectorProperty("C",wxPG_LABEL,value.c) ); } wxTriangleProperty::~wxTriangleProperty() { } @@ -319,8 +319,8 @@ public: virtual bool DoShowDialog( wxPropertyGrid* WXUNUSED(propGrid), wxPGProperty* WXUNUSED(property) ) wxOVERRIDE { - wxString s = ::wxGetSingleChoice(wxT("Message"), - wxT("Caption"), + wxString s = ::wxGetSingleChoice("Message", + "Caption", m_choices.GetLabels()); if ( !s.empty() ) { @@ -346,10 +346,10 @@ public: : wxStringProperty(label, name, value) { // Prepare choices - m_choices.Add(wxT("Cat")); - m_choices.Add(wxT("Dog")); - m_choices.Add(wxT("Gibbon")); - m_choices.Add(wxT("Otter")); + m_choices.Add("Cat"); + m_choices.Add("Dog"); + m_choices.Add("Gibbon"); + m_choices.Add("Otter"); } // Set editor to have button @@ -586,15 +586,15 @@ void FormMain::OnMove( wxMoveEvent& event ) // Must check if properties exist (as they may be deleted). // Using m_pPropGridManager, we can scan all pages automatically. - id = m_pPropGridManager->GetPropertyByName( wxT("X") ); + id = m_pPropGridManager->GetPropertyByName( "X" ); if ( id ) m_pPropGridManager->SetPropertyValue( id, x ); - id = m_pPropGridManager->GetPropertyByName( wxT("Y") ); + id = m_pPropGridManager->GetPropertyByName( "Y" ); if ( id ) m_pPropGridManager->SetPropertyValue( id, y ); - id = m_pPropGridManager->GetPropertyByName( wxT("Position") ); + id = m_pPropGridManager->GetPropertyByName( "Position" ); if ( id ) m_pPropGridManager->SetPropertyValue( id, WXVARIANT(wxPoint(x,y)) ); @@ -624,15 +624,15 @@ void FormMain::OnResize( wxSizeEvent& event ) // Must check if properties exist (as they may be deleted). // Using m_pPropGridManager, we can scan all pages automatically. - p = m_pPropGridManager->GetPropertyByName( wxT("Width") ); + p = m_pPropGridManager->GetPropertyByName( "Width" ); if ( p && !p->IsValueUnspecified() ) m_pPropGridManager->SetPropertyValue( p, w ); - p = m_pPropGridManager->GetPropertyByName( wxT("Height") ); + p = m_pPropGridManager->GetPropertyByName( "Height" ); if ( p && !p->IsValueUnspecified() ) m_pPropGridManager->SetPropertyValue( p, h ); - id = m_pPropGridManager->GetPropertyByName ( wxT("Size") ); + id = m_pPropGridManager->GetPropertyByName ( "Size" ); if ( id ) m_pPropGridManager->SetPropertyValue( id, WXVARIANT(wxSize(w,h)) ); @@ -646,12 +646,12 @@ void FormMain::OnPropertyGridChanging( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); - if ( p->GetName() == wxT("Font") ) + if ( p->GetName() == "Font" ) { int res = - wxMessageBox(wxString::Format(wxT("'%s' is about to change (to variant of type '%s')\n\nAllow or deny?"), + wxMessageBox(wxString::Format("'%s' is about to change (to variant of type '%s')\n\nAllow or deny?", p->GetName().c_str(),event.GetValue().GetType().c_str()), - wxT("Testing wxEVT_PG_CHANGING"), wxYES_NO, m_pPropGridManager); + "Testing wxEVT_PG_CHANGING", wxYES_NO, m_pPropGridManager); if ( res == wxNO ) { @@ -687,20 +687,20 @@ void FormMain::OnPropertyGridChange( wxPropertyGridEvent& event ) return; // Some settings are disabled outside Windows platform - if ( name == wxT("X") ) + if ( name == "X" ) SetSize( value.As(), -1, -1, -1, wxSIZE_USE_EXISTING ); - else if ( name == wxT("Y") ) + else if ( name == "Y" ) // wxPGVariantToInt is safe long int value getter SetSize ( -1, value.As(), -1, -1, wxSIZE_USE_EXISTING ); - else if ( name == wxT("Width") ) + else if ( name == "Width" ) SetSize ( -1, -1, value.As(), -1, wxSIZE_USE_EXISTING ); - else if ( name == wxT("Height") ) + else if ( name == "Height" ) SetSize ( -1, -1, -1, value.As(), wxSIZE_USE_EXISTING ); - else if ( name == wxT("Label") ) + else if ( name == "Label" ) { SetTitle( value.As() ); } - else if ( name == wxT("Password") ) + else if ( name == "Password" ) { static int pwdMode = 0; @@ -710,7 +710,7 @@ void FormMain::OnPropertyGridChange( wxPropertyGridEvent& event ) pwdMode &= 1; } else - if ( name == wxT("Font") ) + if ( name == "Font" ) { wxFont font = value.As(); wxASSERT( font.IsOk() ); @@ -718,22 +718,22 @@ void FormMain::OnPropertyGridChange( wxPropertyGridEvent& event ) m_pPropGridManager->SetFont( font ); } else - if ( name == wxT("Margin Colour") ) + if ( name == "Margin Colour" ) { wxColourPropertyValue cpv = value.As(); m_pPropGridManager->GetGrid()->SetMarginColour( cpv.m_colour ); } - else if ( name == wxT("Cell Colour") ) + else if ( name == "Cell Colour" ) { wxColourPropertyValue cpv = value.As(); m_pPropGridManager->GetGrid()->SetCellBackgroundColour( cpv.m_colour ); } - else if ( name == wxT("Line Colour") ) + else if ( name == "Line Colour" ) { wxColourPropertyValue cpv = value.As(); m_pPropGridManager->GetGrid()->SetLineColour( cpv.m_colour ); } - else if ( name == wxT("Cell Text Colour") ) + else if ( name == "Cell Text Colour" ) { wxColourPropertyValue cpv = value.As(); m_pPropGridManager->GetGrid()->SetCellTextColour( cpv.m_colour ); @@ -749,9 +749,9 @@ void FormMain::OnPropertyGridSelect( wxPropertyGridEvent& event ) { m_itemEnable->Enable( true ); if ( property->IsEnabled() ) - m_itemEnable->SetItemLabel( wxT("Disable") ); + m_itemEnable->SetItemLabel( "Disable" ); else - m_itemEnable->SetItemLabel( wxT("Enable") ); + m_itemEnable->SetItemLabel( "Enable" ); } else { @@ -763,7 +763,7 @@ void FormMain::OnPropertyGridSelect( wxPropertyGridEvent& event ) wxStatusBar* sb = GetStatusBar(); if ( prop ) { - wxString text(wxT("Selected: ")); + wxString text("Selected: "); text += m_pPropGridManager->GetPropertyLabel( prop ); sb->SetStatusText ( text ); } @@ -776,7 +776,7 @@ void FormMain::OnPropertyGridPageChange( wxPropertyGridEvent& WXUNUSED(event) ) { #if wxUSE_STATUSBAR wxStatusBar* sb = GetStatusBar(); - wxString text(wxT("Page Changed: ")); + wxString text("Page Changed: "); text += m_pPropGridManager->GetPageName(m_pPropGridManager->GetSelectedPage()); sb->SetStatusText( text ); #endif @@ -786,7 +786,7 @@ void FormMain::OnPropertyGridPageChange( wxPropertyGridEvent& WXUNUSED(event) ) void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event ) { - wxLogMessage(wxT("wxPG_EVT_LABEL_EDIT_BEGIN(%s)"), + wxLogMessage("wxPG_EVT_LABEL_EDIT_BEGIN(%s)", event.GetProperty()->GetLabel().c_str()); } @@ -794,7 +794,7 @@ void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event ) void FormMain::OnPropertyGridLabelEditEnding( wxPropertyGridEvent& event ) { - wxLogMessage(wxT("wxPG_EVT_LABEL_EDIT_ENDING(%s)"), + wxLogMessage("wxPG_EVT_LABEL_EDIT_ENDING(%s)", event.GetProperty()->GetLabel().c_str()); } @@ -813,9 +813,9 @@ void FormMain::OnPropertyGridItemRightClick( wxPropertyGridEvent& event ) wxStatusBar* sb = GetStatusBar(); if ( prop ) { - wxString text(wxT("Right-clicked: ")); + wxString text("Right-clicked: "); text += prop->GetLabel(); - text += wxT(", name="); + text += ", name="; text += m_pPropGridManager->GetPropertyName(prop); sb->SetStatusText( text ); } @@ -835,9 +835,9 @@ void FormMain::OnPropertyGridItemDoubleClick( wxPropertyGridEvent& event ) wxStatusBar* sb = GetStatusBar(); if ( prop ) { - wxString text(wxT("Double-clicked: ")); + wxString text("Double-clicked: "); text += prop->GetLabel(); - text += wxT(", name="); + text += ", name="; text += m_pPropGridManager->GetPropertyName(prop); sb->SetStatusText ( text ); } @@ -857,15 +857,15 @@ void FormMain::OnPropertyGridButtonClick ( wxCommandEvent& ) wxStatusBar* sb = GetStatusBar(); if ( prop ) { - wxString text(wxT("Button clicked: ")); + wxString text("Button clicked: "); text += m_pPropGridManager->GetPropertyLabel(prop); - text += wxT(", name="); + text += ", name="; text += m_pPropGridManager->GetPropertyName(prop); sb->SetStatusText( text ); } else { - ::wxMessageBox(wxT("SHOULD NOT HAPPEN!!!")); + ::wxMessageBox("SHOULD NOT HAPPEN!!!"); } #endif } @@ -874,14 +874,14 @@ void FormMain::OnPropertyGridButtonClick ( wxCommandEvent& ) void FormMain::OnPropertyGridItemCollapse( wxPropertyGridEvent& ) { - wxLogMessage(wxT("Item was Collapsed")); + wxLogMessage("Item was Collapsed"); } // ----------------------------------------------------------------------- void FormMain::OnPropertyGridItemExpand( wxPropertyGridEvent& ) { - wxLogMessage(wxT("Item was Expanded")); + wxLogMessage("Item was Expanded"); } // ----------------------------------------------------------------------- @@ -890,12 +890,12 @@ void FormMain::OnPropertyGridColBeginDrag( wxPropertyGridEvent& event ) { if ( m_itemVetoDragging->IsChecked() ) { - wxLogMessage(wxT("Splitter %i resize was vetoed"), event.GetColumn()); + wxLogMessage("Splitter %i resize was vetoed", event.GetColumn()); event.Veto(); } else { - wxLogDebug(wxT("Splitter %i resize began"), event.GetColumn()); + wxLogDebug("Splitter %i resize began", event.GetColumn()); } } @@ -905,7 +905,7 @@ void FormMain::OnPropertyGridColDragging( wxPropertyGridEvent& event ) { wxUnusedVar(event); // For now, let's not spam the log output - //wxLogDebug(wxT("Splitter %i is being resized"), event.GetColumn()); + //wxLogDebug("Splitter %i is being resized", event.GetColumn()); } // ----------------------------------------------------------------------- @@ -913,7 +913,7 @@ void FormMain::OnPropertyGridColDragging( wxPropertyGridEvent& event ) void FormMain::OnPropertyGridColEndDrag( wxPropertyGridEvent& event ) { wxUnusedVar(event); - wxLogDebug(wxT("Splitter %i resize ended"), event.GetColumn()); + wxLogDebug("Splitter %i resize ended", event.GetColumn()); } // ----------------------------------------------------------------------- @@ -943,26 +943,25 @@ void FormMain::OnLabelTextChange( wxCommandEvent& WXUNUSED(event) ) // ----------------------------------------------------------------------- -static const wxChar* _fs_windowstyle_labels[] = { - wxT("wxSIMPLE_BORDER"), - wxT("wxDOUBLE_BORDER"), - wxT("wxSUNKEN_BORDER"), - wxT("wxRAISED_BORDER"), - wxT("wxNO_BORDER"), - wxT("wxTRANSPARENT_WINDOW"), - wxT("wxTAB_TRAVERSAL"), - wxT("wxWANTS_CHARS"), +static const wxString _fs_windowstyle_labels[] = { + "wxSIMPLE_BORDER", + "wxDOUBLE_BORDER", + "wxSUNKEN_BORDER", + "wxRAISED_BORDER", + "wxNO_BORDER", + "wxTRANSPARENT_WINDOW", + "wxTAB_TRAVERSAL", + "wxWANTS_CHARS", #if wxNO_FULL_REPAINT_ON_RESIZE - wxT("wxNO_FULL_REPAINT_ON_RESIZE"), + "wxNO_FULL_REPAINT_ON_RESIZE", #endif - wxT("wxVSCROLL"), - wxT("wxALWAYS_SHOW_SB"), - wxT("wxCLIP_CHILDREN"), + "wxVSCROLL", + "wxALWAYS_SHOW_SB", + "wxCLIP_CHILDREN", #if wxFULL_REPAINT_ON_RESIZE - wxT("wxFULL_REPAINT_ON_RESIZE"), + "wxFULL_REPAINT_ON_RESIZE", #endif - (const wxChar*) NULL // terminator is always needed -}; + }; static const long _fs_windowstyle_values[] = { wxSIMPLE_BORDER, @@ -984,19 +983,18 @@ static const long _fs_windowstyle_values[] = { #endif }; -static const wxChar* _fs_framestyle_labels[] = { - wxT("wxCAPTION"), - wxT("wxMINIMIZE"), - wxT("wxMAXIMIZE"), - wxT("wxCLOSE_BOX"), - wxT("wxSTAY_ON_TOP"), - wxT("wxSYSTEM_MENU"), - wxT("wxRESIZE_BORDER"), - wxT("wxFRAME_TOOL_WINDOW"), - wxT("wxFRAME_NO_TASKBAR"), - wxT("wxFRAME_FLOAT_ON_PARENT"), - wxT("wxFRAME_SHAPED"), - (const wxChar*) NULL +static const wxString _fs_framestyle_labels[] = { + "wxCAPTION", + "wxMINIMIZE", + "wxMAXIMIZE", + "wxCLOSE_BOX", + "wxSTAY_ON_TOP", + "wxSYSTEM_MENU", + "wxRESIZE_BORDER", + "wxFRAME_TOOL_WINDOW", + "wxFRAME_NO_TASKBAR", + "wxFRAME_FLOAT_ON_PARENT", + "wxFRAME_SHAPED" }; static const long _fs_framestyle_values[] = { @@ -1012,12 +1010,9 @@ static const long _fs_framestyle_values[] = { wxFRAME_FLOAT_ON_PARENT, wxFRAME_SHAPED }; - -// ----------------------------------------------------------------------- - void FormMain::OnTestXRC(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox(wxT("Sorry, not yet implemented")); + wxMessageBox("Sorry, not yet implemented"); } void FormMain::OnEnableCommonValues(wxCommandEvent& WXUNUSED(event)) @@ -1026,113 +1021,113 @@ void FormMain::OnEnableCommonValues(wxCommandEvent& WXUNUSED(event)) if ( prop ) prop->EnableCommonValue(); else - wxMessageBox(wxT("First select a property")); + wxMessageBox("First select a property"); } void FormMain::PopulateWithStandardItems () { wxPropertyGridManager* pgman = m_pPropGridManager; - wxPropertyGridPage* pg = pgman->GetPage(wxT("Standard Items")); + wxPropertyGridPage* pg = pgman->GetPage("Standard Items"); // Append is ideal way to add items to wxPropertyGrid. - pg->Append( new wxPropertyCategory(wxT("Appearance"),wxPG_LABEL) ); + pg->Append( new wxPropertyCategory("Appearance",wxPG_LABEL) ); - pg->Append( new wxStringProperty(wxT("Label"),wxPG_LABEL,GetTitle()) ); - pg->Append( new wxFontProperty(wxT("Font"),wxPG_LABEL) ); - pg->SetPropertyHelpString ( wxT("Font"), wxT("Editing this will change font used in the property grid.") ); + pg->Append( new wxStringProperty("Label",wxPG_LABEL,GetTitle()) ); + pg->Append( new wxFontProperty("Font",wxPG_LABEL) ); + pg->SetPropertyHelpString ( "Font", "Editing this will change font used in the property grid." ); - pg->Append( new wxSystemColourProperty(wxT("Margin Colour"),wxPG_LABEL, + pg->Append( new wxSystemColourProperty("Margin Colour",wxPG_LABEL, pg->GetGrid()->GetMarginColour()) ); - pg->Append( new wxSystemColourProperty(wxT("Cell Colour"),wxPG_LABEL, + pg->Append( new wxSystemColourProperty("Cell Colour",wxPG_LABEL, pg->GetGrid()->GetCellBackgroundColour()) ); - pg->Append( new wxSystemColourProperty(wxT("Cell Text Colour"),wxPG_LABEL, + pg->Append( new wxSystemColourProperty("Cell Text Colour",wxPG_LABEL, pg->GetGrid()->GetCellTextColour()) ); - pg->Append( new wxSystemColourProperty(wxT("Line Colour"),wxPG_LABEL, + pg->Append( new wxSystemColourProperty("Line Colour",wxPG_LABEL, pg->GetGrid()->GetLineColour()) ); - pg->Append( new wxFlagsProperty(wxT("Window Styles"),wxPG_LABEL, + pg->Append( new wxFlagsProperty("Window Styles",wxPG_LABEL, m_combinedFlags, GetWindowStyle()) ); - //pg->SetPropertyAttribute(wxT("Window Styles"),wxPG_BOOL_USE_CHECKBOX,true,wxPG_RECURSE); + //pg->SetPropertyAttribute("Window Styles",wxPG_BOOL_USE_CHECKBOX,true,wxPG_RECURSE); - pg->Append( new wxCursorProperty(wxT("Cursor"),wxPG_LABEL) ); + pg->Append( new wxCursorProperty("Cursor",wxPG_LABEL) ); - pg->Append( new wxPropertyCategory(wxT("Position"),wxT("PositionCategory")) ); - pg->SetPropertyHelpString( wxT("PositionCategory"), wxT("Change in items in this category will cause respective changes in frame.") ); + pg->Append( new wxPropertyCategory("Position","PositionCategory") ); + pg->SetPropertyHelpString( "PositionCategory", "Change in items in this category will cause respective changes in frame." ); // Let's demonstrate 'Units' attribute here // Note that we use many attribute constants instead of strings here - // (for instance, wxPG_ATTR_MIN, instead of wxT("min")). + // (for instance, wxPG_ATTR_MIN, instead of "min"). // Using constant may reduce binary size. - pg->Append( new wxIntProperty(wxT("Height"),wxPG_LABEL,480) ); - pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_MIN, (long)10 ); - pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_MAX, (long)2048 ); - pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_UNITS, wxT("Pixels") ); + pg->Append( new wxIntProperty("Height",wxPG_LABEL,480) ); + pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, (long)10 ); + pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, (long)2048 ); + pg->SetPropertyAttribute("Height", wxPG_ATTR_UNITS, "Pixels" ); // Set value to unspecified so that Hint attribute will be demonstrated - pg->SetPropertyValueUnspecified(wxT("Height")); - pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_HINT, - wxT("Enter new height for window") ); + pg->SetPropertyValueUnspecified("Height"); + pg->SetPropertyAttribute("Height", wxPG_ATTR_HINT, + "Enter new height for window" ); // Difference between hint and help string is that the hint is shown in // an empty value cell, while help string is shown either in the // description text box, as a tool tip, or on the status bar. - pg->SetPropertyHelpString(wxT("Height"), - wxT("This property uses attributes \"Units\" and \"Hint\".") ); + pg->SetPropertyHelpString("Height", + "This property uses attributes \"Units\" and \"Hint\"."); - pg->Append( new wxIntProperty(wxT("Width"),wxPG_LABEL,640) ); - pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MIN, (long)10 ); - pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MAX, (long)2048 ); - pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_UNITS, wxT("Pixels") ); + pg->Append( new wxIntProperty("Width",wxPG_LABEL,640) ); + pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, (long)10 ); + pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, (long)2048 ); + pg->SetPropertyAttribute("Width", wxPG_ATTR_UNITS, "Pixels" ); - pg->SetPropertyValueUnspecified(wxT("Width")); - pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_HINT, - wxT("Enter new width for window") ); - pg->SetPropertyHelpString(wxT("Width"), - wxT("This property uses attributes \"Units\" and \"Hint\".") ); + pg->SetPropertyValueUnspecified("Width"); + pg->SetPropertyAttribute("Width", wxPG_ATTR_HINT, + "Enter new width for window" ); + pg->SetPropertyHelpString("Width", + "This property uses attributes \"Units\" and \"Hint\"."); - pg->Append( new wxIntProperty(wxT("X"),wxPG_LABEL,10) ); - pg->SetPropertyAttribute(wxT("X"), wxPG_ATTR_UNITS, wxT("Pixels") ); - pg->SetPropertyHelpString(wxT("X"), wxT("This property uses \"Units\" attribute.") ); + pg->Append( new wxIntProperty("X",wxPG_LABEL,10) ); + pg->SetPropertyAttribute("X", wxPG_ATTR_UNITS, "Pixels" ); + pg->SetPropertyHelpString("X", "This property uses \"Units\" attribute."); - pg->Append( new wxIntProperty(wxT("Y"),wxPG_LABEL,10) ); - pg->SetPropertyAttribute(wxT("Y"), wxPG_ATTR_UNITS, wxT("Pixels") ); - pg->SetPropertyHelpString(wxT("Y"), wxT("This property uses \"Units\" attribute.") ); + pg->Append( new wxIntProperty("Y",wxPG_LABEL,10) ); + pg->SetPropertyAttribute("Y", wxPG_ATTR_UNITS, "Pixels" ); + pg->SetPropertyHelpString("Y", "This property uses \"Units\" attribute."); - const wxChar* disabledHelpString = wxT("This property is simply disabled. In order to have label disabled as well, ") - wxT("you need to set wxPG_EX_GREY_LABEL_WHEN_DISABLED using SetExtraStyle."); + const wxString disabledHelpString = "This property is simply disabled. In order to have label disabled as well, " + "you need to set wxPG_EX_GREY_LABEL_WHEN_DISABLED using SetExtraStyle."; - pg->Append( new wxPropertyCategory(wxT("Environment"),wxPG_LABEL) ); - pg->Append( new wxStringProperty(wxT("Operating System"),wxPG_LABEL,::wxGetOsDescription()) ); + pg->Append( new wxPropertyCategory("Environment",wxPG_LABEL) ); + pg->Append( new wxStringProperty("Operating System",wxPG_LABEL,::wxGetOsDescription()) ); - pg->Append( new wxStringProperty(wxT("User Id"),wxPG_LABEL,::wxGetUserId()) ); - pg->Append( new wxDirProperty(wxT("User Home"),wxPG_LABEL,::wxGetUserHome()) ); - pg->Append( new wxStringProperty(wxT("User Name"),wxPG_LABEL,::wxGetUserName()) ); + pg->Append( new wxStringProperty("User Id",wxPG_LABEL,::wxGetUserId()) ); + pg->Append( new wxDirProperty("User Home",wxPG_LABEL,::wxGetUserHome()) ); + pg->Append( new wxStringProperty("User Name",wxPG_LABEL,::wxGetUserName()) ); // Disable some of them - pg->DisableProperty( wxT("Operating System") ); - pg->DisableProperty( wxT("User Id") ); - pg->DisableProperty( wxT("User Name") ); + pg->DisableProperty( "Operating System" ); + pg->DisableProperty( "User Id" ); + pg->DisableProperty( "User Name" ); - pg->SetPropertyHelpString( wxT("Operating System"), disabledHelpString ); - pg->SetPropertyHelpString( wxT("User Id"), disabledHelpString ); - pg->SetPropertyHelpString( wxT("User Name"), disabledHelpString ); + pg->SetPropertyHelpString( "Operating System", disabledHelpString ); + pg->SetPropertyHelpString( "User Id", disabledHelpString ); + pg->SetPropertyHelpString( "User Name", disabledHelpString ); - pg->Append( new wxPropertyCategory(wxT("More Examples"),wxPG_LABEL) ); + pg->Append( new wxPropertyCategory("More Examples",wxPG_LABEL) ); - pg->Append( new wxFontDataProperty( wxT("FontDataProperty"), wxPG_LABEL) ); - pg->SetPropertyHelpString( wxT("FontDataProperty"), - wxT("This demonstrates wxFontDataProperty class defined in this sample app. ") - wxT("It is exactly like wxFontProperty from the library, but also has colour sub-property.") + pg->Append( new wxFontDataProperty( "FontDataProperty", wxPG_LABEL) ); + pg->SetPropertyHelpString( "FontDataProperty", + "This demonstrates wxFontDataProperty class defined in this sample app. " + "It is exactly like wxFontProperty from the library, but also has colour sub-property." ); - pg->Append( new wxDirsProperty(wxT("DirsProperty"),wxPG_LABEL) ); - pg->SetPropertyHelpString( wxT("DirsProperty"), - wxT("This demonstrates wxDirsProperty class defined in this sample app. ") - wxT("It is built with WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR macro, ") - wxT("with custom action (dir dialog popup) defined.") + pg->Append( new wxDirsProperty("DirsProperty",wxPG_LABEL) ); + pg->SetPropertyHelpString( "DirsProperty", + "This demonstrates wxDirsProperty class defined in this sample app. " + "It is built with WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR macro, " + "with custom action (dir dialog popup) defined." ); wxArrayDouble arrdbl; @@ -1142,21 +1137,21 @@ void FormMain::PopulateWithStandardItems () arrdbl.Add(0.5); arrdbl.Add(1.0); - pg->Append( new wxArrayDoubleProperty(wxT("ArrayDoubleProperty"),wxPG_LABEL,arrdbl) ); - //pg->SetPropertyAttribute(wxT("ArrayDoubleProperty"),wxPG_FLOAT_PRECISION,(long)2); - pg->SetPropertyHelpString( wxT("ArrayDoubleProperty"), - wxT("This demonstrates wxArrayDoubleProperty class defined in this sample app. ") - wxT("It is an example of a custom list editor property.") + pg->Append( new wxArrayDoubleProperty("ArrayDoubleProperty",wxPG_LABEL,arrdbl) ); + //pg->SetPropertyAttribute("ArrayDoubleProperty",wxPG_FLOAT_PRECISION,(long)2); + pg->SetPropertyHelpString( "ArrayDoubleProperty", + "This demonstrates wxArrayDoubleProperty class defined in this sample app. " + "It is an example of a custom list editor property." ); - pg->Append( new wxLongStringProperty(wxT("Information"),wxPG_LABEL, - wxT("Editing properties will have immediate effect on this window, ") - wxT("and vice versa (at least in most cases, that is).") + pg->Append( new wxLongStringProperty("Information",wxPG_LABEL, + "Editing properties will have immediate effect on this window, " + "and vice versa (at least in most cases, that is)." ) ); - pg->SetPropertyHelpString( wxT("Information"), - wxT("This property is read-only.") ); + pg->SetPropertyHelpString( "Information", + "This property is read-only." ); - pg->SetPropertyReadOnly( wxT("Information"), true ); + pg->SetPropertyReadOnly( "Information", true ); // // Set test information for cells in columns 3 and 4 @@ -1172,8 +1167,8 @@ void FormMain::PopulateWithStandardItems () if ( p->IsCategory() ) continue; - pg->SetPropertyCell( p, 3, wxT("Cell 3"), bmp ); - pg->SetPropertyCell( p, 4, wxT("Cell 4"), wxNullBitmap, *wxWHITE, *wxBLACK ); + pg->SetPropertyCell( p, 3, "Cell 3", bmp ); + pg->SetPropertyCell( p, 4, "Cell 4", wxNullBitmap, *wxWHITE, *wxBLACK ); } } @@ -1182,75 +1177,75 @@ void FormMain::PopulateWithStandardItems () void FormMain::PopulateWithExamples () { wxPropertyGridManager* pgman = m_pPropGridManager; - wxPropertyGridPage* pg = pgman->GetPage(wxT("Examples")); + wxPropertyGridPage* pg = pgman->GetPage("Examples"); wxPGProperty* pid; wxPGProperty* prop; - //pg->Append( new wxPropertyCategory(wxT("Examples (low priority)"),wxT("Examples")) ); - //pg->SetPropertyHelpString ( wxT("Examples"), wxT("This category has example of (almost) every built-in property class.") ); + //pg->Append( new wxPropertyCategory("Examples (low priority)","Examples") ); + //pg->SetPropertyHelpString ( "Examples", "This category has example of (almost) every built-in property class." ); #if wxUSE_SPINBTN - pg->Append( new wxIntProperty ( wxT("SpinCtrl"), wxPG_LABEL, 0 ) ); + pg->Append( new wxIntProperty ( "SpinCtrl", wxPG_LABEL, 0 ) ); - pg->SetPropertyEditor( wxT("SpinCtrl"), wxPGEditor_SpinCtrl ); - pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string - pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size. - pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_SPINCTRL_STEP, (long)2 ); - pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_SPINCTRL_MOTION, true ); - //pg->SetPropertyAttribute( wxT("SpinCtrl"), wxPG_ATTR_SPINCTRL_WRAP, true ); + pg->SetPropertyEditor( "SpinCtrl", wxPGEditor_SpinCtrl ); + pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MIN, (long)-10 ); // Use constants instead of string + pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_MAX, (long)16384 ); // for reduced binary size. + pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, (long)2 ); + pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_MOTION, true ); + //pg->SetPropertyAttribute( "SpinCtrl", wxPG_ATTR_SPINCTRL_WRAP, true ); - pg->SetPropertyHelpString( wxT("SpinCtrl"), - wxT("This is regular wxIntProperty, which editor has been ") - wxT("changed to wxPGEditor_SpinCtrl. Note however that ") - wxT("static wxPropertyGrid::RegisterAdditionalEditors() ") - wxT("needs to be called prior to using it.")); + pg->SetPropertyHelpString( "SpinCtrl", + "This is regular wxIntProperty, which editor has been " + "changed to wxPGEditor_SpinCtrl. Note however that " + "static wxPropertyGrid::RegisterAdditionalEditors() " + "needs to be called prior to using it."); #endif // Add bool property - pg->Append( new wxBoolProperty( wxT("BoolProperty"), wxPG_LABEL, false ) ); + pg->Append( new wxBoolProperty( "BoolProperty", wxPG_LABEL, false ) ); // Add bool property with check box - pg->Append( new wxBoolProperty( wxT("BoolProperty with CheckBox"), wxPG_LABEL, false ) ); - pg->SetPropertyAttribute( wxT("BoolProperty with CheckBox"), + pg->Append( new wxBoolProperty( "BoolProperty with CheckBox", wxPG_LABEL, false ) ); + pg->SetPropertyAttribute( "BoolProperty with CheckBox", wxPG_BOOL_USE_CHECKBOX, true ); - pg->SetPropertyHelpString( wxT("BoolProperty with CheckBox"), - wxT("Property attribute wxPG_BOOL_USE_CHECKBOX has been set to true.") ); + pg->SetPropertyHelpString( "BoolProperty with CheckBox", + "Property attribute wxPG_BOOL_USE_CHECKBOX has been set to true." ); - prop = pg->Append( new wxFloatProperty(wxT("FloatProperty"), + prop = pg->Append( new wxFloatProperty("FloatProperty", wxPG_LABEL, 1234500.23) ); prop->SetAttribute(wxPG_ATTR_MIN, -100.12); // A string property that can be edited in a separate editor dialog. - pg->Append( new wxLongStringProperty( wxT("LongStringProperty"), wxT("LongStringProp"), - wxT("This is much longer string than the first one. Edit it by clicking the button.") ) ); + pg->Append( new wxLongStringProperty( "LongStringProperty", "LongStringProp", + "This is much longer string than the first one. Edit it by clicking the button." ) ); // A property that edits a wxArrayString. wxArrayString example_array; - example_array.Add( wxT("String 1")); - example_array.Add( wxT("String 2")); - example_array.Add( wxT("String 3")); - pg->Append( new wxArrayStringProperty( wxT("ArrayStringProperty"), wxPG_LABEL, + example_array.Add( "String 1"); + example_array.Add( "String 2"); + example_array.Add( "String 3"); + pg->Append( new wxArrayStringProperty( "ArrayStringProperty", wxPG_LABEL, example_array) ); // Test adding same category multiple times ( should not actually create a new one ) - //pg->Append( new wxPropertyCategory(wxT("Examples (low priority)"),wxT("Examples")) ); + //pg->Append( new wxPropertyCategory("Examples (low priority)","Examples") ); // A file selector property. Note that argument between name // and initial value is wildcard (format same as in wxFileDialog). - prop = new wxFileProperty( wxT("FileProperty"), wxT("TextFile") ); + prop = new wxFileProperty( "FileProperty", "TextFile" ); pg->Append( prop ); - prop->SetAttribute(wxPG_FILE_WILDCARD,wxT("Text Files (*.txt)|*.txt")); - prop->SetAttribute(wxPG_FILE_DIALOG_TITLE,wxT("Custom File Dialog Title")); + prop->SetAttribute(wxPG_FILE_WILDCARD,"Text Files (*.txt)|*.txt"); + prop->SetAttribute(wxPG_FILE_DIALOG_TITLE,"Custom File Dialog Title"); prop->SetAttribute(wxPG_FILE_SHOW_FULL_PATH,false); #ifdef __WXMSW__ - prop->SetAttribute(wxPG_FILE_SHOW_RELATIVE_PATH,wxT("C:\\Windows")); - pg->SetPropertyValue(prop,wxT("C:\\Windows\\System32\\msvcrt71.dll")); + prop->SetAttribute(wxPG_FILE_SHOW_RELATIVE_PATH,"C:\\Windows"); + pg->SetPropertyValue(prop,"C:\\Windows\\System32\\msvcrt71.dll"); #endif #if wxUSE_IMAGE @@ -1258,58 +1253,56 @@ void FormMain::PopulateWithExamples () // wildcard is missing (it is autogenerated from supported image formats). // If you really need to override it, create property separately, and call // its SetWildcard method. - pg->Append( new wxImageFileProperty( wxT("ImageFile"), wxPG_LABEL ) ); + pg->Append( new wxImageFileProperty( "ImageFile", wxPG_LABEL ) ); #endif - pid = pg->Append( new wxColourProperty(wxT("ColourProperty"),wxPG_LABEL,*wxRED) ); - pg->SetPropertyEditor( wxT("ColourProperty"), wxPGEditor_ComboBox ); - pg->GetProperty(wxT("ColourProperty"))->SetAutoUnspecified(true); - pg->SetPropertyHelpString( wxT("ColourProperty"), - wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ") - wxT("editor of this property to wxPGEditor_ComboBox)")); + pid = pg->Append( new wxColourProperty("ColourProperty",wxPG_LABEL,*wxRED) ); + pg->SetPropertyEditor( "ColourProperty", wxPGEditor_ComboBox ); + pg->GetProperty("ColourProperty")->SetAutoUnspecified(true); + pg->SetPropertyHelpString( "ColourProperty", + "wxPropertyGrid::SetPropertyEditor method has been used to change " + "editor of this property to wxPGEditor_ComboBox)"); - pid = pg->Append( new wxColourProperty(wxT("ColourPropertyWithAlpha"), + pid = pg->Append( new wxColourProperty("ColourPropertyWithAlpha", wxPG_LABEL, wxColour(15, 200, 95, 128)) ); - pg->SetPropertyAttribute(wxT("ColourPropertyWithAlpha"), wxPG_COLOUR_HAS_ALPHA, true); - pg->SetPropertyHelpString(wxT("ColourPropertyWithAlpha"), - wxT("Attribute \"HasAlpha\" is set to true for this property.")); + pg->SetPropertyAttribute("ColourPropertyWithAlpha", wxPG_COLOUR_HAS_ALPHA, true); + pg->SetPropertyHelpString("ColourPropertyWithAlpha", + "Attribute \"HasAlpha\" is set to true for this property."); // // This demonstrates using alternative editor for colour property // to trigger colour dialog directly from button. - pg->Append( new wxColourProperty(wxT("ColourProperty2"),wxPG_LABEL,*wxGREEN) ); + pg->Append( new wxColourProperty("ColourProperty2",wxPG_LABEL,*wxGREEN) ); // // wxEnumProperty does not store strings or even list of strings // ( so that's why they are static in function ). - static const wxChar* enum_prop_labels[] = { wxT("One Item"), - wxT("Another Item"), wxT("One More"), wxT("This Is Last"), NULL }; + static const wxString enum_prop_labels[] = { "One Item", + "Another Item", "One More", "This Is Last" }; // this value array would be optional if values matched string indexes static long enum_prop_values[] = { 40, 80, 120, 160 }; // note that the initial value (the last argument) is the actual value, // not index or anything like that. Thus, our value selects "Another Item". - // - // 0 before value is number of items. If it is 0, like in our example, - // number of items is calculated, and this requires that the string pointer - // array is terminated with NULL. - pg->Append( new wxEnumProperty(wxT("EnumProperty"),wxPG_LABEL, - enum_prop_labels, enum_prop_values, 80 ) ); + pg->Append( new wxEnumProperty("EnumProperty",wxPG_LABEL, + wxArrayString(WXSIZEOF(enum_prop_labels), enum_prop_labels), + wxArrayInt(enum_prop_values, enum_prop_values+ WXSIZEOF(enum_prop_values)), 80 ) ); wxPGChoices soc; // use basic table from our previous example // can also set/add wxArrayStrings and wxArrayInts directly. - soc.Set( enum_prop_labels, enum_prop_values ); + soc.Set(wxArrayString(WXSIZEOF(enum_prop_labels), enum_prop_labels), + wxArrayInt(enum_prop_values, enum_prop_values + WXSIZEOF(enum_prop_values))); // add extra items - soc.Add( wxT("Look, it continues"), 200 ); - soc.Add( wxT("Even More"), 240 ); - soc.Add( wxT("And More"), 280 ); + soc.Add( "Look, it continues", 200 ); + soc.Add( "Even More", 240 ); + soc.Add( "And More", 280 ); soc.Add( wxEmptyString, 300 ); - soc.Add( wxT("True End of the List"), 320 ); + soc.Add( "True End of the List", 320 ); // Test custom colours ([] operator of wxPGChoices returns // references to wxPGChoiceEntry). @@ -1321,85 +1314,85 @@ void FormMain::PopulateWithExamples () soc[3].SetBgCol(*wxLIGHT_GREY); soc[4].SetBitmap(wxArtProvider::GetBitmap(wxART_FOLDER)); - pg->Append( new wxEnumProperty(wxT("EnumProperty 2"), + pg->Append( new wxEnumProperty("EnumProperty 2", wxPG_LABEL, soc, 240) ); - pg->GetProperty(wxT("EnumProperty 2"))->AddChoice(wxT("Testing Extra"), 360); + pg->GetProperty("EnumProperty 2")->AddChoice("Testing Extra", 360); // Here we only display the original 'soc' choices - pg->Append( new wxEnumProperty(wxT("EnumProperty 3"),wxPG_LABEL, + pg->Append( new wxEnumProperty("EnumProperty 3",wxPG_LABEL, soc, 240 ) ); // Test Hint attribute in EnumProperty - pg->GetProperty(wxT("EnumProperty 3"))->SetAttribute(wxPG_ATTR_HINT, wxT("Dummy Hint")); + pg->GetProperty("EnumProperty 3")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint"); - pg->SetPropertyHelpString(wxT("EnumProperty 3"), - wxT("This property uses \"Hint\" attribute.")); + pg->SetPropertyHelpString("EnumProperty 3", + "This property uses \"Hint\" attribute."); // 'soc' plus one exclusive extra choice "4th only" - pg->Append( new wxEnumProperty(wxT("EnumProperty 4"),wxPG_LABEL, + pg->Append( new wxEnumProperty("EnumProperty 4",wxPG_LABEL, soc, 240 ) ); - pg->GetProperty(wxT("EnumProperty 4"))->AddChoice(wxT("4th only"), 360); + pg->GetProperty("EnumProperty 4")->AddChoice("4th only", 360); - pg->SetPropertyHelpString(wxT("EnumProperty 4"), - wxT("Should have one extra item when compared to EnumProperty 3")); + pg->SetPropertyHelpString("EnumProperty 4", + "Should have one extra item when compared to EnumProperty 3"); // Plus property value bitmap pg->Append( new wxEnumProperty(wxS("EnumProperty With Bitmap"), wxS("EnumProperty 5"), soc, 280) ); pg->SetPropertyHelpString(wxS("EnumProperty 5"), - wxS("Should have bitmap in front of the displayed value")); + "Should have bitmap in front of the displayed value"); wxBitmap bmpVal = wxArtProvider::GetBitmap(wxART_REMOVABLE); - pg->SetPropertyImage(wxS("EnumProperty 5"), bmpVal); + pg->SetPropertyImage("EnumProperty 5", bmpVal); // Password property example. - pg->Append( new wxStringProperty(wxT("Password"),wxPG_LABEL, wxT("password")) ); - pg->SetPropertyAttribute( wxT("Password"), wxPG_STRING_PASSWORD, true ); - pg->SetPropertyHelpString( wxT("Password"), - wxT("Has attribute wxPG_STRING_PASSWORD set to true") ); + pg->Append( new wxStringProperty("Password",wxPG_LABEL, "password") ); + pg->SetPropertyAttribute( "Password", wxPG_STRING_PASSWORD, true ); + pg->SetPropertyHelpString( "Password", + "Has attribute wxPG_STRING_PASSWORD set to true" ); // String editor with dir selector button. Uses wxEmptyString as name, which // is allowed (naturally, in this case property cannot be accessed by name). - pg->Append( new wxDirProperty( wxT("DirProperty"), wxPG_LABEL, ::wxGetUserHome()) ); - pg->SetPropertyAttribute( wxT("DirProperty"), + pg->Append( new wxDirProperty( "DirProperty", wxPG_LABEL, ::wxGetUserHome()) ); + pg->SetPropertyAttribute( "DirProperty", wxPG_DIR_DIALOG_MESSAGE, - wxT("This is a custom dir dialog message") ); + "This is a custom dir dialog message" ); // Add string property - first arg is label, second name, and third initial value - pg->Append( new wxStringProperty ( wxT("StringProperty"), wxPG_LABEL ) ); - pg->SetPropertyMaxLength( wxT("StringProperty"), 6 ); - pg->SetPropertyHelpString( wxT("StringProperty"), - wxT("Max length of this text has been limited to 6, using wxPropertyGrid::SetPropertyMaxLength.") ); + pg->Append( new wxStringProperty ( "StringProperty", wxPG_LABEL ) ); + pg->SetPropertyMaxLength( "StringProperty", 6 ); + pg->SetPropertyHelpString( "StringProperty", + "Max length of this text has been limited to 6, using wxPropertyGrid::SetPropertyMaxLength." ); // Set value after limiting so that it will be applied - pg->SetPropertyValue( wxT("StringProperty"), wxT("some text") ); + pg->SetPropertyValue( "StringProperty", "some text" ); // // Demonstrate "AutoComplete" attribute - pg->Append( new wxStringProperty( wxT("StringProperty AutoComplete"), + pg->Append( new wxStringProperty( "StringProperty AutoComplete", wxPG_LABEL ) ); wxArrayString autoCompleteStrings; - autoCompleteStrings.Add(wxT("One choice")); - autoCompleteStrings.Add(wxT("Another choice")); - autoCompleteStrings.Add(wxT("Another choice, yeah")); - autoCompleteStrings.Add(wxT("Yet another choice")); - autoCompleteStrings.Add(wxT("Yet another choice, bear with me")); - pg->SetPropertyAttribute( wxT("StringProperty AutoComplete"), + autoCompleteStrings.Add("One choice"); + autoCompleteStrings.Add("Another choice"); + autoCompleteStrings.Add("Another choice, yeah"); + autoCompleteStrings.Add("Yet another choice"); + autoCompleteStrings.Add("Yet another choice, bear with me"); + pg->SetPropertyAttribute( "StringProperty AutoComplete", wxPG_ATTR_AUTOCOMPLETE, autoCompleteStrings ); - pg->SetPropertyHelpString( wxT("StringProperty AutoComplete"), - wxT("AutoComplete attribute has been set for this property ") - wxT("(try writing something beginning with 'a', 'o' or 'y').")); + pg->SetPropertyHelpString( "StringProperty AutoComplete", + "AutoComplete attribute has been set for this property " + "(try writing something beginning with 'a', 'o' or 'y')."); // Add string property with arbitrarily wide bitmap in front of it. We // intentionally lower-than-typical row height here so that the ugly // scaling code won't be run. - pg->Append( new wxStringProperty( wxT("StringPropertyWithBitmap"), + pg->Append( new wxStringProperty( "StringPropertyWithBitmap", wxPG_LABEL, - wxT("Test Text")) ); + "Test Text") ); wxBitmap myTestBitmap(60, 15, 32); wxMemoryDC mdc; mdc.SelectObject(myTestBitmap); @@ -1407,80 +1400,80 @@ void FormMain::PopulateWithExamples () mdc.SetPen(*wxBLACK); mdc.DrawLine(0, 0, 60, 15); mdc.SelectObject(wxNullBitmap); - pg->SetPropertyImage( wxT("StringPropertyWithBitmap"), myTestBitmap ); + pg->SetPropertyImage( "StringPropertyWithBitmap", myTestBitmap ); // this value array would be optional if values matched string indexes //long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, wxMAXIMIZE_BOX }; - //pg->Append( wxFlagsProperty(wxT("Example of FlagsProperty"),wxT("FlagsProp"), + //pg->Append( wxFlagsProperty("Example of FlagsProperty","FlagsProp", // flags_prop_labels, flags_prop_values, 0, GetWindowStyle() ) ); // Multi choice dialog. wxArrayString tchoices; - tchoices.Add(wxT("Cabbage")); - tchoices.Add(wxT("Carrot")); - tchoices.Add(wxT("Onion")); - tchoices.Add(wxT("Potato")); - tchoices.Add(wxT("Strawberry")); + tchoices.Add("Cabbage"); + tchoices.Add("Carrot"); + tchoices.Add("Onion"); + tchoices.Add("Potato"); + tchoices.Add("Strawberry"); wxArrayString tchoicesValues; - tchoicesValues.Add(wxT("Carrot")); - tchoicesValues.Add(wxT("Potato")); + tchoicesValues.Add("Carrot"); + tchoicesValues.Add("Potato"); - pg->Append( new wxEnumProperty(wxT("EnumProperty X"),wxPG_LABEL, tchoices ) ); + pg->Append( new wxEnumProperty("EnumProperty X",wxPG_LABEL, tchoices ) ); - pg->Append( new wxMultiChoiceProperty( wxT("MultiChoiceProperty"), wxPG_LABEL, + pg->Append( new wxMultiChoiceProperty( "MultiChoiceProperty", wxPG_LABEL, tchoices, tchoicesValues ) ); - pg->SetPropertyAttribute( wxT("MultiChoiceProperty"), wxPG_ATTR_MULTICHOICE_USERSTRINGMODE, true ); + pg->SetPropertyAttribute( "MultiChoiceProperty", wxPG_ATTR_MULTICHOICE_USERSTRINGMODE, true ); - pg->Append( new wxSizeProperty( wxT("SizeProperty"), wxT("Size"), GetSize() ) ); - pg->Append( new wxPointProperty( wxT("PointProperty"), wxT("Position"), GetPosition() ) ); + pg->Append( new wxSizeProperty( "SizeProperty", "Size", GetSize() ) ); + pg->Append( new wxPointProperty( "PointProperty", "Position", GetPosition() ) ); // UInt samples #if wxUSE_LONGLONG - pg->Append( new wxUIntProperty( wxT("UIntProperty"), wxPG_LABEL, wxULongLong(wxULL(0xFEEEFEEEFEEE)))); + pg->Append( new wxUIntProperty( "UIntProperty", wxPG_LABEL, wxULongLong(wxULL(0xFEEEFEEEFEEE)))); #else - pg->Append( new wxUIntProperty( wxT("UIntProperty"), wxPG_LABEL, 0xFEEEFEEE)); + pg->Append( new wxUIntProperty( "UIntProperty", wxPG_LABEL, 0xFEEEFEEE)); #endif - pg->SetPropertyAttribute( wxT("UIntProperty"), wxPG_UINT_PREFIX, wxPG_PREFIX_NONE ); - pg->SetPropertyAttribute( wxT("UIntProperty"), wxPG_UINT_BASE, wxPG_BASE_HEX ); - //pg->SetPropertyAttribute( wxT("UIntProperty"), wxPG_UINT_PREFIX, wxPG_PREFIX_NONE ); - //pg->SetPropertyAttribute( wxT("UIntProperty"), wxPG_UINT_BASE, wxPG_BASE_OCT ); + pg->SetPropertyAttribute( "UIntProperty", wxPG_UINT_PREFIX, wxPG_PREFIX_NONE ); + pg->SetPropertyAttribute( "UIntProperty", wxPG_UINT_BASE, wxPG_BASE_HEX ); + //pg->SetPropertyAttribute( "UIntProperty", wxPG_UINT_PREFIX, wxPG_PREFIX_NONE ); + //pg->SetPropertyAttribute( "UIntProperty", wxPG_UINT_BASE, wxPG_BASE_OCT ); // // wxEditEnumProperty wxPGChoices eech; - eech.Add(wxT("Choice 1")); - eech.Add(wxT("Choice 2")); - eech.Add(wxT("Choice 3")); - pg->Append( new wxEditEnumProperty(wxT("EditEnumProperty"), + eech.Add("Choice 1"); + eech.Add("Choice 2"); + eech.Add("Choice 3"); + pg->Append( new wxEditEnumProperty("EditEnumProperty", wxPG_LABEL, eech, - wxT("Choice not in the list")) ); + "Choice not in the list") ); // Test Hint attribute in EditEnumProperty - pg->GetProperty(wxT("EditEnumProperty"))->SetAttribute(wxPG_ATTR_HINT, wxT("Dummy Hint")); + pg->GetProperty("EditEnumProperty")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint"); //wxString v_; //wxTextValidator validator1(wxFILTER_NUMERIC,&v_); - //pg->SetPropertyValidator( wxT("EditEnumProperty"), validator1 ); + //pg->SetPropertyValidator( "EditEnumProperty", validator1 ); #if wxUSE_DATETIME // // wxDateTimeProperty - pg->Append( new wxDateProperty(wxT("DateProperty"), wxPG_LABEL, wxDateTime::Now() ) ); + pg->Append( new wxDateProperty("DateProperty", wxPG_LABEL, wxDateTime::Now() ) ); #if wxUSE_DATEPICKCTRL - pg->SetPropertyAttribute( wxT("DateProperty"), wxPG_DATE_PICKER_STYLE, + pg->SetPropertyAttribute( "DateProperty", wxPG_DATE_PICKER_STYLE, (long)(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE) ); - pg->SetPropertyHelpString( wxT("DateProperty"), - wxT("Attribute wxPG_DATE_PICKER_STYLE has been set to (long)") - wxT("(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE).") ); + pg->SetPropertyHelpString( "DateProperty", + "Attribute wxPG_DATE_PICKER_STYLE has been set to (long)" + "(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE)." ); #endif #endif @@ -1489,61 +1482,61 @@ void FormMain::PopulateWithExamples () // Add Triangle properties as both wxTriangleProperty and // a generic parent property (using wxStringProperty). // - wxPGProperty* topId = pg->Append( new wxStringProperty(wxT("3D Object"), wxPG_LABEL, wxT("")) ); + wxPGProperty* topId = pg->Append( new wxStringProperty("3D Object", wxPG_LABEL, "") ); - pid = pg->AppendIn( topId, new wxStringProperty(wxT("Triangle 1"), wxT("Triangle 1"), wxT("")) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("A"), wxPG_LABEL ) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("B"), wxPG_LABEL ) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("C"), wxPG_LABEL ) ); + pid = pg->AppendIn( topId, new wxStringProperty("Triangle 1", "Triangle 1", "") ); + pg->AppendIn( pid, new wxVectorProperty( "A", wxPG_LABEL ) ); + pg->AppendIn( pid, new wxVectorProperty( "B", wxPG_LABEL ) ); + pg->AppendIn( pid, new wxVectorProperty( "C", wxPG_LABEL ) ); - pg->AppendIn( topId, new wxTriangleProperty( wxT("Triangle 2"), wxT("Triangle 2") ) ); + pg->AppendIn( topId, new wxTriangleProperty( "Triangle 2", "Triangle 2" ) ); - pg->SetPropertyHelpString( wxT("3D Object"), - wxT("3D Object is wxStringProperty with value \"\". Two of its children are similar wxStringProperties with ") - wxT("three wxVectorProperty children, and other two are custom wxTriangleProperties.") ); + pg->SetPropertyHelpString( "3D Object", + "3D Object is wxStringProperty with value \"\". Two of its children are similar wxStringProperties with " + "three wxVectorProperty children, and other two are custom wxTriangleProperties." ); - pid = pg->AppendIn( topId, new wxStringProperty(wxT("Triangle 3"), wxT("Triangle 3"), wxT("")) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("A"), wxPG_LABEL ) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("B"), wxPG_LABEL ) ); - pg->AppendIn( pid, new wxVectorProperty( wxT("C"), wxPG_LABEL ) ); + pid = pg->AppendIn( topId, new wxStringProperty("Triangle 3", "Triangle 3", "") ); + pg->AppendIn( pid, new wxVectorProperty( "A", wxPG_LABEL ) ); + pg->AppendIn( pid, new wxVectorProperty( "B", wxPG_LABEL ) ); + pg->AppendIn( pid, new wxVectorProperty( "C", wxPG_LABEL ) ); - pg->AppendIn( topId, new wxTriangleProperty( wxT("Triangle 4"), wxT("Triangle 4") ) ); + pg->AppendIn( topId, new wxTriangleProperty( "Triangle 4", "Triangle 4" ) ); // // This snippet is a doc sample test // - wxPGProperty* carProp = pg->Append(new wxStringProperty(wxT("Car"), + wxPGProperty* carProp = pg->Append(new wxStringProperty("Car", wxPG_LABEL, - wxT(""))); + "")); - pg->AppendIn(carProp, new wxStringProperty(wxT("Model"), + pg->AppendIn(carProp, new wxStringProperty("Model", wxPG_LABEL, - wxT("Lamborghini Diablo SV"))); + "Lamborghini Diablo SV")); - pg->AppendIn(carProp, new wxIntProperty(wxT("Engine Size (cc)"), + pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)", wxPG_LABEL, 5707) ); wxPGProperty* speedsProp = pg->AppendIn(carProp, - new wxStringProperty(wxT("Speeds"), + new wxStringProperty("Speeds", wxPG_LABEL, - wxT(""))); + "")); - pg->AppendIn( speedsProp, new wxIntProperty(wxT("Max. Speed (mph)"), + pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)", wxPG_LABEL,290) ); - pg->AppendIn( speedsProp, new wxFloatProperty(wxT("0-100 mph (sec)"), + pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)", wxPG_LABEL,3.9) ); - pg->AppendIn( speedsProp, new wxFloatProperty(wxT("1/4 mile (sec)"), + pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)", wxPG_LABEL,8.6) ); // This is how child property can be referred to by name - pg->SetPropertyValue( wxT("Car.Speeds.Max. Speed (mph)"), 300 ); + pg->SetPropertyValue( "Car.Speeds.Max. Speed (mph)", 300 ); - pg->AppendIn(carProp, new wxIntProperty(wxT("Price ($)"), + pg->AppendIn(carProp, new wxIntProperty("Price ($)", wxPG_LABEL, 300000) ); - pg->AppendIn(carProp, new wxBoolProperty(wxT("Convertible"), + pg->AppendIn(carProp, new wxBoolProperty("Convertible", wxPG_LABEL, false) ); @@ -1552,53 +1545,53 @@ void FormMain::PopulateWithExamples () // // Test wxSampleMultiButtonEditor - pg->Append( new wxLongStringProperty(wxT("MultipleButtons"), wxPG_LABEL) ); - pg->SetPropertyEditor(wxT("MultipleButtons"), m_pSampleMultiButtonEditor ); + pg->Append( new wxLongStringProperty("MultipleButtons", wxPG_LABEL) ); + pg->SetPropertyEditor("MultipleButtons", m_pSampleMultiButtonEditor ); // Test SingleChoiceProperty - pg->Append( new SingleChoiceProperty(wxT("SingleChoiceProperty")) ); + pg->Append( new SingleChoiceProperty("SingleChoiceProperty") ); // // Test adding variable height bitmaps in wxPGChoices wxPGChoices bc; - bc.Add(wxT("Wee"), + bc.Add("Wee", wxArtProvider::GetBitmap(wxART_CDROM, wxART_OTHER, wxSize(16, 16))); - bc.Add(wxT("Not so wee"), + bc.Add("Not so wee", wxArtProvider::GetBitmap(wxART_FLOPPY, wxART_OTHER, wxSize(32, 32))); - bc.Add(wxT("Friggin' huge"), + bc.Add("Friggin' huge", wxArtProvider::GetBitmap(wxART_HARDDISK, wxART_OTHER, wxSize(64, 64))); - pg->Append( new wxEnumProperty(wxT("Variable Height Bitmaps"), + pg->Append( new wxEnumProperty("Variable Height Bitmaps", wxPG_LABEL, bc, 0) ); // // Test how non-editable composite strings appear - pid = new wxStringProperty(wxT("wxWidgets Traits"), wxPG_LABEL, wxT("")); + pid = new wxStringProperty("wxWidgets Traits", wxPG_LABEL, ""); pg->SetPropertyReadOnly(pid); // // For testing purposes, combine two methods of adding children // - pid->AppendChild( new wxStringProperty(wxT("Latest Release"), + pid->AppendChild( new wxStringProperty("Latest Release", wxPG_LABEL, - wxT("3.0.2"))); - pid->AppendChild( new wxBoolProperty(wxT("Win API"), + "3.0.2")); + pid->AppendChild( new wxBoolProperty("Win API", wxPG_LABEL, true) ); pg->Append( pid ); - pg->AppendIn(pid, new wxBoolProperty(wxT("QT"), wxPG_LABEL, true) ); - pg->AppendIn(pid, new wxBoolProperty(wxT("Cocoa"), wxPG_LABEL, true) ); - pg->AppendIn(pid, new wxBoolProperty(wxT("BeOS"), wxPG_LABEL, false) ); - pg->AppendIn(pid, new wxStringProperty(wxT("Trunk Version"), wxPG_LABEL, wxT("3.1.0")) ); - pg->AppendIn(pid, new wxBoolProperty(wxT("GTK+"), wxPG_LABEL, true) ); - pg->AppendIn(pid, new wxBoolProperty(wxT("Sky OS"), wxPG_LABEL, false) ); - pg->AppendIn(pid, new wxBoolProperty(wxT("Android"), wxPG_LABEL, false) ); + pg->AppendIn(pid, new wxBoolProperty("QT", wxPG_LABEL, true) ); + pg->AppendIn(pid, new wxBoolProperty("Cocoa", wxPG_LABEL, true) ); + pg->AppendIn(pid, new wxBoolProperty("BeOS", wxPG_LABEL, false) ); + pg->AppendIn(pid, new wxStringProperty("Trunk Version", wxPG_LABEL, "3.1.0") ); + pg->AppendIn(pid, new wxBoolProperty("GTK+", wxPG_LABEL, true) ); + pg->AppendIn(pid, new wxBoolProperty("Sky OS", wxPG_LABEL, false) ); + pg->AppendIn(pid, new wxBoolProperty("Android", wxPG_LABEL, false) ); AddTestProperties(pg); } @@ -1608,7 +1601,7 @@ void FormMain::PopulateWithExamples () void FormMain::PopulateWithLibraryConfig () { wxPropertyGridManager* pgman = m_pPropGridManager; - wxPropertyGridPage* pg = pgman->GetPage(wxT("wxWidgets Library Config")); + wxPropertyGridPage* pg = pgman->GetPage("wxWidgets Library Config"); // Set custom column proportions (here in the sample app we need // to check if the grid has wxPG_SPLITTER_AUTO_CENTER style. You usually @@ -1628,10 +1621,10 @@ void FormMain::PopulateWithLibraryConfig () wxFont italicFont = pgman->GetGrid()->GetCaptionFont(); italicFont.SetStyle(wxFONTSTYLE_ITALIC); - wxString italicFontHelp = wxT("Font of this property's wxPGCell has ") - wxT("been modified. Obtain property's cell ") - wxT("with wxPGProperty::") - wxT("GetOrCreateCell(column)."); + wxString italicFontHelp = "Font of this property's wxPGCell has " + "been modified. Obtain property's cell " + "with wxPGProperty::" + "GetOrCreateCell(column)."; #define ADD_WX_LIB_CONF_GROUP(A) \ cat = pg->AppendIn( pid, new wxPropertyCategory(A) ); \ @@ -1639,21 +1632,21 @@ void FormMain::PopulateWithLibraryConfig () cat->GetCell(0).SetFont(italicFont); \ cat->SetHelpString(italicFontHelp); -#define ADD_WX_LIB_CONF(A) pg->Append( new wxBoolProperty(wxT(#A),wxPG_LABEL,(bool)((A>0)?true:false))); -#define ADD_WX_LIB_CONF_NODEF(A) pg->Append( new wxBoolProperty(wxT(#A),wxPG_LABEL,(bool)false) ); \ - pg->DisableProperty(wxT(#A)); +#define ADD_WX_LIB_CONF(A) pg->Append( new wxBoolProperty(#A,wxPG_LABEL,(bool)((A>0)?true:false))); +#define ADD_WX_LIB_CONF_NODEF(A) pg->Append( new wxBoolProperty(#A,wxPG_LABEL,(bool)false) ); \ + pg->DisableProperty(#A); - pid = pg->Append( new wxPropertyCategory( wxT("wxWidgets Library Configuration") ) ); + pid = pg->Append( new wxPropertyCategory( "wxWidgets Library Configuration" ) ); pg->SetPropertyCell( pid, 0, wxPG_LABEL, bmp ); // Both of following lines would set a label for the second column - pg->SetPropertyCell( pid, 1, wxT("Is Enabled") ); - pid->SetValue(wxT("Is Enabled")); + pg->SetPropertyCell( pid, 1, "Is Enabled" ); + pid->SetValue("Is Enabled"); - ADD_WX_LIB_CONF_GROUP(wxT("Global Settings")) + ADD_WX_LIB_CONF_GROUP("Global Settings") ADD_WX_LIB_CONF( wxUSE_GUI ) - ADD_WX_LIB_CONF_GROUP(wxT("Compatibility Settings")) + ADD_WX_LIB_CONF_GROUP("Compatibility Settings") #if defined(WXWIN_COMPATIBILITY_2_8) ADD_WX_LIB_CONF( WXWIN_COMPATIBILITY_2_8 ) #endif @@ -1671,17 +1664,17 @@ void FormMain::PopulateWithLibraryConfig () ADD_WX_LIB_CONF_NODEF ( wxDIALOG_UNIT_COMPATIBILITY ) #endif - ADD_WX_LIB_CONF_GROUP(wxT("Debugging Settings")) + ADD_WX_LIB_CONF_GROUP("Debugging Settings") ADD_WX_LIB_CONF( wxUSE_DEBUG_CONTEXT ) ADD_WX_LIB_CONF( wxUSE_MEMORY_TRACING ) ADD_WX_LIB_CONF( wxUSE_GLOBAL_MEMORY_OPERATORS ) ADD_WX_LIB_CONF( wxUSE_DEBUG_NEW_ALWAYS ) ADD_WX_LIB_CONF( wxUSE_ON_FATAL_EXCEPTION ) - ADD_WX_LIB_CONF_GROUP(wxT("Unicode Support")) + ADD_WX_LIB_CONF_GROUP("Unicode Support") ADD_WX_LIB_CONF( wxUSE_UNICODE ) - ADD_WX_LIB_CONF_GROUP(wxT("Global Features")) + ADD_WX_LIB_CONF_GROUP("Global Features") ADD_WX_LIB_CONF( wxUSE_EXCEPTIONS ) ADD_WX_LIB_CONF( wxUSE_EXTENDED_RTTI ) ADD_WX_LIB_CONF( wxUSE_STL ) @@ -1694,7 +1687,7 @@ void FormMain::PopulateWithLibraryConfig () ADD_WX_LIB_CONF( wxUSE_STREAMS ) ADD_WX_LIB_CONF( wxUSE_STD_IOSTREAM ) - ADD_WX_LIB_CONF_GROUP(wxT("Non-GUI Features")) + ADD_WX_LIB_CONF_GROUP("Non-GUI Features") ADD_WX_LIB_CONF( wxUSE_LONGLONG ) ADD_WX_LIB_CONF( wxUSE_FILE ) ADD_WX_LIB_CONF( wxUSE_FFILE ) @@ -1790,15 +1783,15 @@ void wxMyPropertyGridPage::OnPropertySelect( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); wxUnusedVar(p); - wxLogDebug(wxT("wxMyPropertyGridPage::OnPropertySelect('%s' is %s"), + wxLogDebug("wxMyPropertyGridPage::OnPropertySelect('%s' is %s", p->GetName().c_str(), - IsPropertySelected(p)? wxT("selected"): wxT("unselected")); + IsPropertySelected(p)? "selected": "unselected"); } void wxMyPropertyGridPage::OnPropertyChange( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); - wxLogVerbose(wxT("wxMyPropertyGridPage::OnPropertyChange('%s', to value '%s')"), + wxLogVerbose("wxMyPropertyGridPage::OnPropertyChange('%s', to value '%s')", p->GetName().c_str(), p->GetDisplayedString().c_str()); } @@ -1806,14 +1799,14 @@ void wxMyPropertyGridPage::OnPropertyChange( wxPropertyGridEvent& event ) void wxMyPropertyGridPage::OnPropertyChanging( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); - wxLogVerbose(wxT("wxMyPropertyGridPage::OnPropertyChanging('%s', to value '%s')"), + wxLogVerbose("wxMyPropertyGridPage::OnPropertyChanging('%s', to value '%s')", p->GetName().c_str(), event.GetValue().GetString().c_str()); } void wxMyPropertyGridPage::OnPageChange( wxPropertyGridEvent& WXUNUSED(event) ) { - wxLogDebug(wxT("wxMyPropertyGridPage::OnPageChange()")); + wxLogDebug("wxMyPropertyGridPage::OnPageChange()"); } @@ -1823,7 +1816,7 @@ public: void OnKeyEvent( wxKeyEvent& event ) { - wxMessageBox(wxString::Format(wxT("%i"),event.GetKeyCode())); + wxMessageBox(wxString::Format("%i",event.GetKeyCode())); event.Skip(); } private: @@ -1857,10 +1850,10 @@ void FormMain::FinalizePanel( bool wasCreated ) { // Button for tab traversal testing m_topSizer->Add( new wxButton(m_panel, wxID_ANY, - wxT("Should be able to move here with Tab")), + "Should be able to move here with Tab"), wxSizerFlags(0).Expand()); m_topSizer->Add( new wxButton(m_panel, ID_SHOWPOPUP, - wxT("Show Popup")), + "Show Popup"), wxSizerFlags(0).Expand()); m_panel->SetSizer( m_topSizer ); @@ -1879,20 +1872,20 @@ void FormMain::FinalizePanel( bool wasCreated ) void FormMain::PopulateGrid() { wxPropertyGridManager* pgman = m_pPropGridManager; - pgman->AddPage(wxT("Standard Items")); + pgman->AddPage("Standard Items"); PopulateWithStandardItems(); - pgman->AddPage(wxT("wxWidgets Library Config")); + pgman->AddPage("wxWidgets Library Config"); PopulateWithLibraryConfig(); wxPropertyGridPage* myPage = new wxMyPropertyGridPage(); - myPage->Append( new wxIntProperty ( wxT("IntProperty"), wxPG_LABEL, 12345678 ) ); + myPage->Append( new wxIntProperty ( "IntProperty", wxPG_LABEL, 12345678 ) ); // Use wxMyPropertyGridPage (see above) to test the // custom wxPropertyGridPage feature. - pgman->AddPage(wxT("Examples"),wxNullBitmap,myPage); + pgman->AddPage("Examples",wxNullBitmap,myPage); PopulateWithExamples(); } @@ -1932,8 +1925,8 @@ void FormMain::CreateGrid( int style, int extraStyle ) // // This shows how to combine two static choice descriptors - m_combinedFlags.Add( _fs_windowstyle_labels, _fs_windowstyle_values ); - m_combinedFlags.Add( _fs_framestyle_labels, _fs_framestyle_values ); + m_combinedFlags.Add( WXSIZEOF(_fs_windowstyle_labels), _fs_windowstyle_labels, _fs_windowstyle_values ); + m_combinedFlags.Add( WXSIZEOF(_fs_framestyle_labels), _fs_framestyle_labels, _fs_framestyle_values ); wxPropertyGridManager* pgman = m_pPropGridManager = new wxPropertyGridManager(m_panel, @@ -1957,7 +1950,7 @@ void FormMain::CreateGrid( int style, int extraStyle ) // // Set somewhat different unspecified value appearance wxPGCell cell; - cell.SetText(wxT("Unspecified")); + cell.SetText("Unspecified"); cell.SetFgCol(*wxLIGHT_GREY); m_propGrid->SetUnspecifiedValueAppearance(cell); @@ -2033,116 +2026,116 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size wxMenu *menuTools2 = new wxMenu; wxMenu *menuHelp = new wxMenu; - menuHelp->Append(ID_ABOUT, wxT("&About"), wxT("Show about dialog") ); + menuHelp->Append(ID_ABOUT, "&About", "Show about dialog" ); - menuTools1->Append(ID_APPENDPROP, wxT("Append New Property") ); - menuTools1->Append(ID_APPENDCAT, wxT("Append New Category\tCtrl-S") ); + menuTools1->Append(ID_APPENDPROP, "Append New Property" ); + menuTools1->Append(ID_APPENDCAT, "Append New Category\tCtrl-S" ); menuTools1->AppendSeparator(); - menuTools1->Append(ID_INSERTPROP, wxT("Insert New Property\tCtrl-I") ); - menuTools1->Append(ID_INSERTCAT, wxT("Insert New Category\tCtrl-W") ); + menuTools1->Append(ID_INSERTPROP, "Insert New Property\tCtrl-I" ); + menuTools1->Append(ID_INSERTCAT, "Insert New Category\tCtrl-W" ); menuTools1->AppendSeparator(); - menuTools1->Append(ID_DELETE, wxT("Delete Selected") ); - menuTools1->Append(ID_DELETER, wxT("Delete Random") ); - menuTools1->Append(ID_DELETEALL, wxT("Delete All") ); + menuTools1->Append(ID_DELETE, "Delete Selected" ); + menuTools1->Append(ID_DELETER, "Delete Random" ); + menuTools1->Append(ID_DELETEALL, "Delete All" ); menuTools1->AppendSeparator(); - menuTools1->Append(ID_SETBGCOLOUR, wxT("Set Bg Colour") ); - menuTools1->Append(ID_SETBGCOLOURRECUR, wxT("Set Bg Colour (Recursively)") ); - menuTools1->Append(ID_UNSPECIFY, wxT("Set Value to Unspecified")); + menuTools1->Append(ID_SETBGCOLOUR, "Set Bg Colour" ); + menuTools1->Append(ID_SETBGCOLOURRECUR, "Set Bg Colour (Recursively)" ); + menuTools1->Append(ID_UNSPECIFY, "Set Value to Unspecified"); menuTools1->AppendSeparator(); - m_itemEnable = menuTools1->Append(ID_ENABLE, wxT("Enable"), - wxT("Toggles item's enabled state.") ); + m_itemEnable = menuTools1->Append(ID_ENABLE, "Enable", + "Toggles item's enabled state." ); m_itemEnable->Enable( false ); - menuTools1->Append(ID_HIDE, wxT("Hide"), wxT("Hides a property") ); - menuTools1->Append(ID_SETREADONLY, wxT("Set as Read-Only"), - wxT("Set property as read-only") ); + menuTools1->Append(ID_HIDE, "Hide", "Hides a property" ); + menuTools1->Append(ID_SETREADONLY, "Set as Read-Only", + "Set property as read-only" ); - menuTools2->Append(ID_ITERATE1, wxT("Iterate Over Properties") ); - menuTools2->Append(ID_ITERATE2, wxT("Iterate Over Visible Items") ); - menuTools2->Append(ID_ITERATE3, wxT("Reverse Iterate Over Properties") ); - menuTools2->Append(ID_ITERATE4, wxT("Iterate Over Categories") ); + menuTools2->Append(ID_ITERATE1, "Iterate Over Properties" ); + menuTools2->Append(ID_ITERATE2, "Iterate Over Visible Items" ); + menuTools2->Append(ID_ITERATE3, "Reverse Iterate Over Properties" ); + menuTools2->Append(ID_ITERATE4, "Iterate Over Categories" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_ONEXTENDEDKEYNAV, wxT("Extend Keyboard Navigation"), - wxT("This will set Enter to navigate to next property, ") - wxT("and allows arrow keys to navigate even when in ") - wxT("editor control.")); + menuTools2->Append(ID_ONEXTENDEDKEYNAV, "Extend Keyboard Navigation", + "This will set Enter to navigate to next property, " + "and allows arrow keys to navigate even when in " + "editor control."); menuTools2->AppendSeparator(); - menuTools2->Append(ID_SETPROPERTYVALUE, wxT("Set Property Value") ); - menuTools2->Append(ID_CLEARMODIF, wxT("Clear Modified Status"), wxT("Clears wxPG_MODIFIED flag from all properties.") ); + menuTools2->Append(ID_SETPROPERTYVALUE, "Set Property Value" ); + menuTools2->Append(ID_CLEARMODIF, "Clear Modified Status", "Clears wxPG_MODIFIED flag from all properties." ); menuTools2->AppendSeparator(); - m_itemFreeze = menuTools2->AppendCheckItem(ID_FREEZE, wxT("Freeze"), - wxT("Disables painting, auto-sorting, etc.") ); + m_itemFreeze = menuTools2->AppendCheckItem(ID_FREEZE, "Freeze", + "Disables painting, auto-sorting, etc." ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_DUMPLIST, wxT("Display Values as wxVariant List"), wxT("Tests GetAllValues method and wxVariant conversion.") ); + menuTools2->Append(ID_DUMPLIST, "Display Values as wxVariant List", "Tests GetAllValues method and wxVariant conversion." ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_GETVALUES, wxT("Get Property Values"), wxT("Stores all property values.") ); - menuTools2->Append(ID_SETVALUES, wxT("Set Property Values"), wxT("Reverts property values to those last stored.") ); - menuTools2->Append(ID_SETVALUES2, wxT("Set Property Values 2"), wxT("Adds property values that should not initially be as items (so new items are created).") ); + menuTools2->Append(ID_GETVALUES, "Get Property Values", "Stores all property values." ); + menuTools2->Append(ID_SETVALUES, "Set Property Values", "Reverts property values to those last stored." ); + menuTools2->Append(ID_SETVALUES2, "Set Property Values 2", "Adds property values that should not initially be as items (so new items are created)." ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_SAVESTATE, wxT("Save Editable State") ); - menuTools2->Append(ID_RESTORESTATE, wxT("Restore Editable State") ); + menuTools2->Append(ID_SAVESTATE, "Save Editable State" ); + menuTools2->Append(ID_RESTORESTATE, "Restore Editable State" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_ENABLECOMMONVALUES, wxT("Enable Common Value"), - wxT("Enable values that are common to all properties, for selected property.")); + menuTools2->Append(ID_ENABLECOMMONVALUES, "Enable Common Value", + "Enable values that are common to all properties, for selected property."); menuTools2->AppendSeparator(); - menuTools2->Append(ID_COLLAPSE, wxT("Collapse Selected") ); - menuTools2->Append(ID_COLLAPSEALL, wxT("Collapse All") ); + menuTools2->Append(ID_COLLAPSE, "Collapse Selected" ); + menuTools2->Append(ID_COLLAPSEALL, "Collapse All" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_INSERTPAGE, wxT("Add Page") ); - menuTools2->Append(ID_REMOVEPAGE, wxT("Remove Page") ); + menuTools2->Append(ID_INSERTPAGE, "Add Page" ); + menuTools2->Append(ID_REMOVEPAGE, "Remove Page" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_FITCOLUMNS, wxT("Fit Columns") ); + menuTools2->Append(ID_FITCOLUMNS, "Fit Columns" ); m_itemVetoDragging = menuTools2->AppendCheckItem(ID_VETOCOLDRAG, - wxT("Veto Column Dragging")); + "Veto Column Dragging"); menuTools2->AppendSeparator(); - menuTools2->Append(ID_CHANGEFLAGSITEMS, wxT("Change Children of FlagsProp") ); + menuTools2->Append(ID_CHANGEFLAGSITEMS, "Change Children of FlagsProp" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_TESTINSERTCHOICE, wxT("Test InsertPropertyChoice") ); - menuTools2->Append(ID_TESTDELETECHOICE, wxT("Test DeletePropertyChoice") ); + menuTools2->Append(ID_TESTINSERTCHOICE, "Test InsertPropertyChoice" ); + menuTools2->Append(ID_TESTDELETECHOICE, "Test DeletePropertyChoice" ); menuTools2->AppendSeparator(); - menuTools2->Append(ID_SETSPINCTRLEDITOR, wxT("Use SpinCtrl Editor") ); - menuTools2->Append(ID_TESTREPLACE, wxT("Test ReplaceProperty") ); + menuTools2->Append(ID_SETSPINCTRLEDITOR, "Use SpinCtrl Editor" ); + menuTools2->Append(ID_TESTREPLACE, "Test ReplaceProperty" ); - menuTry->Append(ID_SELECTSTYLE, wxT("Set Window Style"), - wxT("Select window style flags used by the grid.")); - menuTry->AppendCheckItem(ID_ENABLELABELEDITING, wxT("Enable label editing"), - wxT("This calls wxPropertyGrid::MakeColumnEditable(0)")); + menuTry->Append(ID_SELECTSTYLE, "Set Window Style", + "Select window style flags used by the grid."); + menuTry->AppendCheckItem(ID_ENABLELABELEDITING, "Enable label editing", + "This calls wxPropertyGrid::MakeColumnEditable(0)"); #if wxUSE_HEADERCTRL menuTry->AppendCheckItem(ID_SHOWHEADER, - wxT("Enable header"), - wxT("This calls wxPropertyGridManager::ShowHeader()")); + "Enable header", + "This calls wxPropertyGridManager::ShowHeader()"); #endif // wxUSE_HEADERCTRL menuTry->AppendSeparator(); - menuTry->AppendRadioItem( ID_COLOURSCHEME1, wxT("Standard Colour Scheme") ); - menuTry->AppendRadioItem( ID_COLOURSCHEME2, wxT("White Colour Scheme") ); - menuTry->AppendRadioItem( ID_COLOURSCHEME3, wxT(".NET Colour Scheme") ); - menuTry->AppendRadioItem( ID_COLOURSCHEME4, wxT("Cream Colour Scheme") ); + menuTry->AppendRadioItem( ID_COLOURSCHEME1, "Standard Colour Scheme" ); + menuTry->AppendRadioItem( ID_COLOURSCHEME2, "White Colour Scheme" ); + menuTry->AppendRadioItem( ID_COLOURSCHEME3, ".NET Colour Scheme" ); + menuTry->AppendRadioItem( ID_COLOURSCHEME4, "Cream Colour Scheme" ); menuTry->AppendSeparator(); - m_itemCatColours = menuTry->AppendCheckItem(ID_CATCOLOURS, wxT("Category Specific Colours"), - wxT("Switches between category-specific cell colours and default scheme (actually done using SetPropertyTextColour and SetPropertyBackgroundColour).") ); + m_itemCatColours = menuTry->AppendCheckItem(ID_CATCOLOURS, "Category Specific Colours", + "Switches between category-specific cell colours and default scheme (actually done using SetPropertyTextColour and SetPropertyBackgroundColour)." ); menuTry->AppendSeparator(); - menuTry->AppendCheckItem(ID_STATICLAYOUT, wxT("Static Layout"), - wxT("Switches between user-modifiable and static layouts.") ); - menuTry->AppendCheckItem(ID_BOOL_CHECKBOX, wxT("Render Boolean values as checkboxes"), - wxT("Renders Boolean values as checkboxes")); - menuTry->Append(ID_SETCOLUMNS, wxT("Set Number of Columns") ); + menuTry->AppendCheckItem(ID_STATICLAYOUT, "Static Layout", + "Switches between user-modifiable and static layouts." ); + menuTry->AppendCheckItem(ID_BOOL_CHECKBOX, "Render Boolean values as checkboxes", + "Renders Boolean values as checkboxes"); + menuTry->Append(ID_SETCOLUMNS, "Set Number of Columns" ); menuTry->AppendSeparator(); - menuTry->Append(ID_TESTXRC, wxT("Display XRC sample") ); + menuTry->Append(ID_TESTXRC, "Display XRC sample" ); - menuFile->Append(ID_RUNMINIMAL, wxT("Run Minimal Sample") ); + menuFile->Append(ID_RUNMINIMAL, "Run Minimal Sample" ); menuFile->AppendSeparator(); - menuFile->Append(ID_RUNTESTFULL, wxT("Run Tests (full)") ); - menuFile->Append(ID_RUNTESTPARTIAL, wxT("Run Tests (fast)") ); + menuFile->Append(ID_RUNTESTFULL, "Run Tests (full)" ); + menuFile->Append(ID_RUNTESTPARTIAL, "Run Tests (fast)" ); menuFile->AppendSeparator(); - menuFile->Append(ID_QUIT, wxT("E&xit\tAlt-X"), wxT("Quit this program") ); + menuFile->Append(ID_QUIT, "E&xit\tAlt-X", "Quit this program" ); // Now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, wxT("&File") ); - menuBar->Append(menuTry, wxT("&Try These!") ); - menuBar->Append(menuTools1, wxT("&Basic") ); - menuBar->Append(menuTools2, wxT("&Advanced") ); - menuBar->Append(menuHelp, wxT("&Help") ); + menuBar->Append(menuFile, "&File" ); + menuBar->Append(menuTry, "&Try These!" ); + menuBar->Append(menuTools1, "&Basic" ); + menuBar->Append(menuTools2, "&Advanced" ); + menuBar->Append(menuHelp, "&Help" ); // ... and attach this menu bar to the frame SetMenuBar(menuBar); @@ -2157,7 +2150,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size #if wxUSE_LOGWINDOW // Create log window - m_logWindow = new wxLogWindow(this, wxT("Log Messages"), false); + m_logWindow = new wxLogWindow(this, "Log Messages", false); m_logWindow->GetFrame()->Move(GetPosition().x + GetSize().x + 10, GetPosition().y); m_logWindow->Show(); @@ -2193,7 +2186,7 @@ void GenerateUniquePropertyLabel( wxPropertyGridManager* pg, wxString& baselabel for (;;) { count++; - newlabel.Printf(wxT("%s%i"),baselabel.c_str(),count); + newlabel.Printf("%s%i",baselabel.c_str(),count); if ( !pg->GetPropertyByLabel( newlabel ) ) break; } } @@ -2212,17 +2205,17 @@ void FormMain::OnInsertPropClick( wxCommandEvent& WXUNUSED(event) ) if ( !m_pPropGridManager->GetGrid()->GetRoot()->GetChildCount() ) { - wxMessageBox(wxT("No items to relate - first add some with Append.")); + wxMessageBox("No items to relate - first add some with Append."); return; } wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); if ( !id ) { - wxMessageBox(wxT("First select a property - new one will be inserted right before that.")); + wxMessageBox("First select a property - new one will be inserted right before that."); return; } - if ( propLabel.Len() < 1 ) propLabel = wxT("Property"); + if ( propLabel.Len() < 1 ) propLabel = "Property"; GenerateUniquePropertyLabel( m_pPropGridManager, propLabel ); @@ -2238,7 +2231,7 @@ void FormMain::OnAppendPropClick( wxCommandEvent& WXUNUSED(event) ) { wxString propLabel; - if ( propLabel.Len() < 1 ) propLabel = wxT("Property"); + if ( propLabel.Len() < 1 ) propLabel = "Property"; GenerateUniquePropertyLabel( m_pPropGridManager, propLabel ); @@ -2260,7 +2253,7 @@ void FormMain::OnAppendCatClick( wxCommandEvent& WXUNUSED(event) ) { wxString propLabel; - if ( propLabel.Len() < 1 ) propLabel = wxT("Category"); + if ( propLabel.Len() < 1 ) propLabel = "Category"; GenerateUniquePropertyLabel( m_pPropGridManager, propLabel ); @@ -2278,18 +2271,18 @@ void FormMain::OnInsertCatClick( wxCommandEvent& WXUNUSED(event) ) if ( !m_pPropGridManager->GetGrid()->GetRoot()->GetChildCount() ) { - wxMessageBox(wxT("No items to relate - first add some with Append.")); + wxMessageBox("No items to relate - first add some with Append."); return; } wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); if ( !id ) { - wxMessageBox(wxT("First select a property - new one will be inserted right before that.")); + wxMessageBox("First select a property - new one will be inserted right before that."); return; } - if ( propLabel.Len() < 1 ) propLabel = wxT("Category"); + if ( propLabel.Len() < 1 ) propLabel = "Category"; GenerateUniquePropertyLabel( m_pPropGridManager, propLabel ); @@ -2305,7 +2298,7 @@ void FormMain::OnDelPropClick( wxCommandEvent& WXUNUSED(event) ) wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); if ( !id ) { - wxMessageBox(wxT("First select a property.")); + wxMessageBox("First select a property."); return; } @@ -2340,7 +2333,7 @@ void FormMain::OnDelPropRClick( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnContextMenu( wxContextMenuEvent& event ) { - wxLogDebug(wxT("FormMain::OnContextMenu(%i,%i)"), + wxLogDebug("FormMain::OnContextMenu(%i,%i)", event.GetPosition().x,event.GetPosition().y); wxUnusedVar(event); @@ -2354,7 +2347,7 @@ void FormMain::OnCloseClick( wxCommandEvent& WXUNUSED(event) ) { /*#ifdef __WXDEBUG__ m_pPropGridManager->GetGrid()->DumpAllocatedChoiceSets(); - wxLogDebug(wxT("\\-> Don't worry, this is perfectly normal in this sample.")); + wxLogDebug("\\-> Don't worry, this is perfectly normal in this sample."); #endif*/ Close(false); @@ -2366,10 +2359,10 @@ int IterateMessage( wxPGProperty* prop ) { wxString s; - s.Printf( wxT("\"%s\" class = %s, valuetype = %s"), prop->GetLabel().c_str(), + s.Printf( "\"%s\" class = %s, valuetype = %s", prop->GetLabel().c_str(), prop->GetClassInfo()->GetClassName(), prop->GetValueType().c_str() ); - return wxMessageBox( s, wxT("Iterating... (press CANCEL to end)"), wxOK|wxCANCEL ); + return wxMessageBox( s, "Iterating... (press CANCEL to end)", wxOK|wxCANCEL ); } // ----------------------------------------------------------------------- @@ -2492,14 +2485,14 @@ void FormMain::OnFitColumnsClick( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnChangeFlagsPropItemsClick( wxCommandEvent& WXUNUSED(event) ) { - wxPGProperty* p = m_pPropGridManager->GetPropertyByName(wxT("Window Styles")); + wxPGProperty* p = m_pPropGridManager->GetPropertyByName("Window Styles"); wxPGChoices newChoices; - newChoices.Add(wxT("Fast"),0x1); - newChoices.Add(wxT("Powerful"),0x2); - newChoices.Add(wxT("Safe"),0x4); - newChoices.Add(wxT("Sleek"),0x8); + newChoices.Add("Fast",0x1); + newChoices.Add("Powerful",0x2); + newChoices.Add("Safe",0x4); + newChoices.Add("Sleek",0x8); p->SetChoices(newChoices); } @@ -2511,19 +2504,19 @@ void FormMain::OnEnableDisable( wxCommandEvent& ) wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); if ( !id ) { - wxMessageBox(wxT("First select a property.")); + wxMessageBox("First select a property."); return; } if ( m_pPropGridManager->IsPropertyEnabled( id ) ) { m_pPropGridManager->DisableProperty ( id ); - m_itemEnable->SetItemLabel( wxT("Enable") ); + m_itemEnable->SetItemLabel( "Enable" ); } else { m_pPropGridManager->EnableProperty ( id ); - m_itemEnable->SetItemLabel( wxT("Disable") ); + m_itemEnable->SetItemLabel( "Disable" ); } } @@ -2534,7 +2527,7 @@ void FormMain::OnSetReadOnly( wxCommandEvent& WXUNUSED(event) ) wxPGProperty* p = m_pPropGridManager->GetGrid()->GetSelection(); if ( !p ) { - wxMessageBox(wxT("First select a property.")); + wxMessageBox("First select a property."); return; } m_pPropGridManager->SetPropertyReadOnly(p); @@ -2547,7 +2540,7 @@ void FormMain::OnHide( wxCommandEvent& WXUNUSED(event) ) wxPGProperty* id = m_pPropGridManager->GetGrid()->GetSelection(); if ( !id ) { - wxMessageBox(wxT("First select a property.")); + wxMessageBox("First select a property."); return; } @@ -2570,11 +2563,11 @@ FormMain::OnSetBackgroundColour( wxCommandEvent& event ) wxPGProperty* prop = pg->GetSelection(); if ( !prop ) { - wxMessageBox(wxT("First select a property.")); + wxMessageBox("First select a property."); return; } - wxColour col = ::wxGetColourFromUser(this, *wxWHITE, wxT("Choose colour")); + wxColour col = ::wxGetColourFromUser(this, *wxWHITE, "Choose colour"); if ( col.IsOk() ) { @@ -2587,7 +2580,7 @@ FormMain::OnSetBackgroundColour( wxCommandEvent& event ) void FormMain::OnInsertPage( wxCommandEvent& WXUNUSED(event) ) { - m_pPropGridManager->AddPage(wxT("New Page")); + m_pPropGridManager->AddPage("New Page"); } // ----------------------------------------------------------------------- @@ -2602,7 +2595,7 @@ void FormMain::OnRemovePage( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnSaveState( wxCommandEvent& WXUNUSED(event) ) { m_savedState = m_pPropGridManager->SaveEditableState(); - wxLogDebug(wxT("Saved editable state string: \"%s\""), m_savedState.c_str()); + wxLogDebug("Saved editable state string: \"%s\"", m_savedState.c_str()); } // ----------------------------------------------------------------------- @@ -2621,7 +2614,7 @@ void FormMain::OnSetSpinCtrlEditorClick( wxCommandEvent& WXUNUSED(event) ) if ( pgId ) m_pPropGridManager->SetPropertyEditor( pgId, wxPGEditor_SpinCtrl ); else - wxMessageBox(wxT("First select a property")); + wxMessageBox("First select a property"); #endif } @@ -2633,17 +2626,17 @@ void FormMain::OnTestReplaceClick( wxCommandEvent& WXUNUSED(event) ) if ( pgId ) { wxPGChoices choices; - choices.Add(wxT("Flag 0"),0x0001); - choices.Add(wxT("Flag 1"),0x0002); - choices.Add(wxT("Flag 2"),0x0004); - choices.Add(wxT("Flag 3"),0x0008); + choices.Add("Flag 0",0x0001); + choices.Add("Flag 1",0x0002); + choices.Add("Flag 2",0x0004); + choices.Add("Flag 3",0x0008); const long maxVal = 0x000F; // Look for unused property name - wxString propName = wxT("ReplaceFlagsProperty"); + wxString propName = "ReplaceFlagsProperty"; int idx = 0; while ( m_pPropGridManager->GetPropertyByName(propName) ) { - propName = wxString::Format(wxT("ReplaceFlagsProperty %i"), ++idx); + propName = wxString::Format("ReplaceFlagsProperty %i", ++idx); } // Replace property and select new one // with random value in range [1..maxVal] @@ -2657,7 +2650,7 @@ void FormMain::OnTestReplaceClick( wxCommandEvent& WXUNUSED(event) ) m_pPropGridManager->SelectProperty(newId); } else - wxMessageBox(wxT("First select a property")); + wxMessageBox("First select a property"); } // ----------------------------------------------------------------------- @@ -2707,7 +2700,7 @@ void FormMain::OnShowHeader( wxCommandEvent& event ) m_pPropGridManager->ShowHeader(show); if ( show ) { - m_pPropGridManager->SetColumnTitle(2, wxT("Units")); + m_pPropGridManager->SetColumnTitle(2, "Units"); } } #endif // wxUSE_HEADERCTRL @@ -2717,28 +2710,28 @@ void FormMain::OnShowHeader( wxCommandEvent& event ) void FormMain::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxString msg; - msg.Printf( wxT("wxPropertyGrid Sample") + msg.Printf( "wxPropertyGrid Sample" #if wxUSE_UNICODE #if defined(wxUSE_UNICODE_UTF8) && wxUSE_UNICODE_UTF8 - wxT(" ") + " " #else - wxT(" ") + " " #endif #else - wxT(" ") + " " #endif #ifdef __WXDEBUG__ - wxT(" ") + " " #else - wxT(" ") + " " #endif - wxT("\n\n") - wxT("Programmed by %s\n\n") - wxT("Using %s\n\n"), - wxT("Jaakko Salli"), wxVERSION_STRING + "\n\n" + "Programmed by %s\n\n" + "Using %s\n\n", + "Jaakko Salli", wxVERSION_STRING ); - wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this); + wxMessageBox(msg, "About", wxOK | wxICON_INFORMATION, this); } // ----------------------------------------------------------------------- @@ -2823,28 +2816,28 @@ void FormMain::OnCatColours( wxCommandEvent& event ) if ( event.IsChecked() ) { // Set custom colours. - pg->SetPropertyTextColour( wxT("Appearance"), wxColour(255,0,0), wxPG_DONT_RECURSE ); - pg->SetPropertyBackgroundColour( wxT("Appearance"), wxColour(255,255,183) ); - pg->SetPropertyTextColour( wxT("Appearance"), wxColour(255,0,183) ); - pg->SetPropertyTextColour( wxT("PositionCategory"), wxColour(0,255,0), wxPG_DONT_RECURSE ); - pg->SetPropertyBackgroundColour( wxT("PositionCategory"), wxColour(255,226,190) ); - pg->SetPropertyTextColour( wxT("PositionCategory"), wxColour(255,0,190) ); - pg->SetPropertyTextColour( wxT("Environment"), wxColour(0,0,255), wxPG_DONT_RECURSE ); - pg->SetPropertyBackgroundColour( wxT("Environment"), wxColour(208,240,175) ); - pg->SetPropertyTextColour( wxT("Environment"), wxColour(255,255,255) ); - pg->SetPropertyBackgroundColour( wxT("More Examples"), wxColour(172,237,255) ); - pg->SetPropertyTextColour( wxT("More Examples"), wxColour(172,0,255) ); + pg->SetPropertyTextColour( "Appearance", wxColour(255,0,0), wxPG_DONT_RECURSE ); + pg->SetPropertyBackgroundColour( "Appearance", wxColour(255,255,183) ); + pg->SetPropertyTextColour( "Appearance", wxColour(255,0,183) ); + pg->SetPropertyTextColour( "PositionCategory", wxColour(0,255,0), wxPG_DONT_RECURSE ); + pg->SetPropertyBackgroundColour( "PositionCategory", wxColour(255,226,190) ); + pg->SetPropertyTextColour( "PositionCategory", wxColour(255,0,190) ); + pg->SetPropertyTextColour( "Environment", wxColour(0,0,255), wxPG_DONT_RECURSE ); + pg->SetPropertyBackgroundColour( "Environment", wxColour(208,240,175) ); + pg->SetPropertyTextColour( "Environment", wxColour(255,255,255) ); + pg->SetPropertyBackgroundColour( "More Examples", wxColour(172,237,255) ); + pg->SetPropertyTextColour( "More Examples", wxColour(172,0,255) ); } else { // Revert to original. - pg->SetPropertyColoursToDefault( wxT("Appearance") ); - pg->SetPropertyColoursToDefault( wxT("Appearance"), wxPG_RECURSE ); - pg->SetPropertyColoursToDefault( wxT("PositionCategory") ); - pg->SetPropertyColoursToDefault( wxT("PositionCategory"), wxPG_RECURSE ); - pg->SetPropertyColoursToDefault( wxT("Environment") ); - pg->SetPropertyColoursToDefault( wxT("Environment"), wxPG_RECURSE ); - pg->SetPropertyColoursToDefault( wxT("More Examples"), wxPG_RECURSE ); + pg->SetPropertyColoursToDefault( "Appearance" ); + pg->SetPropertyColoursToDefault( "Appearance", wxPG_RECURSE ); + pg->SetPropertyColoursToDefault( "PositionCategory" ); + pg->SetPropertyColoursToDefault( "PositionCategory", wxPG_RECURSE ); + pg->SetPropertyColoursToDefault( "Environment" ); + pg->SetPropertyColoursToDefault( "Environment", wxPG_RECURSE ); + pg->SetPropertyColoursToDefault( "More Examples", wxPG_RECURSE ); } m_pPropGridManager->Thaw(); m_pPropGridManager->Refresh(); @@ -2853,7 +2846,7 @@ void FormMain::OnCatColours( wxCommandEvent& event ) // ----------------------------------------------------------------------- #define ADD_FLAG(FLAG) \ - chs.Add(wxT(#FLAG)); \ + chs.Add(#FLAG); \ vls.Add(FLAG); \ if ( (flags & FLAG) == FLAG ) sel.Add(ind); \ ind++; @@ -2880,8 +2873,8 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) ) ADD_FLAG(wxPG_TOOLBAR) ADD_FLAG(wxPG_DESCRIPTION) ADD_FLAG(wxPG_NO_INTERNAL_BORDER) - wxMultiChoiceDialog dlg( this, wxT("Select window styles to use"), - wxT("wxPropertyGrid Window Style"), chs ); + wxMultiChoiceDialog dlg( this, "Select window styles to use", + "wxPropertyGrid Window Style", chs ); dlg.SetSelections(sel); if ( dlg.ShowModal() == wxID_CANCEL ) return; @@ -2913,8 +2906,8 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) ) ADD_FLAG(wxPG_EX_NO_TOOLBAR_DIVIDER) ADD_FLAG(wxPG_EX_TOOLBAR_SEPARATOR) ADD_FLAG(wxPG_EX_ALWAYS_ALLOW_FOCUS) - wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"), - wxT("wxPropertyGrid Extra Style"), chs ); + wxMultiChoiceDialog dlg( this, "Select extra window styles to use", + "wxPropertyGrid Extra Style", chs ); dlg.SetSelections(sel); if ( dlg.ShowModal() == wxID_CANCEL ) return; @@ -2936,8 +2929,8 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnSetColumns( wxCommandEvent& WXUNUSED(event) ) { - long colCount = ::wxGetNumberFromUser(wxT("Enter number of columns (2-20)."),wxT("Columns:"), - wxT("Change Columns"),m_pPropGridManager->GetColumnCount(), + long colCount = ::wxGetNumberFromUser("Enter number of columns (2-20).","Columns:", + "Change Columns",m_pPropGridManager->GetColumnCount(), 2,20); if ( colCount >= 2 ) @@ -2955,7 +2948,7 @@ void FormMain::OnSetPropertyValue( wxCommandEvent& WXUNUSED(event) ) if ( selected ) { - wxString value = ::wxGetTextFromUser( wxT("Enter new value:") ); + wxString value = ::wxGetTextFromUser( "Enter new value:" ); pg->SetPropertyValue( selected, value ); } } @@ -2974,11 +2967,11 @@ void FormMain::OnInsertChoice( wxCommandEvent& WXUNUSED(event) ) if ( choices.IsOk() ) { int pos = choices.GetCount() / 2; - selected->InsertChoice(wxT("New Choice"), pos); + selected->InsertChoice("New Choice", pos); } else { - ::wxMessageBox(wxT("First select a property with some choices.")); + ::wxMessageBox("First select a property with some choices."); } } @@ -3000,7 +2993,7 @@ void FormMain::OnDeleteChoice( wxCommandEvent& WXUNUSED(event) ) } else { - ::wxMessageBox(wxT("First select a property with some choices.")); + ::wxMessageBox("First select a property with some choices."); } } @@ -3029,26 +3022,26 @@ void FormMain::OnMisc ( wxCommandEvent& event ) } else if ( id == ID_GETVALUES ) { - m_storedValues = m_pPropGridManager->GetGrid()->GetPropertyValues(wxT("Test"), + m_storedValues = m_pPropGridManager->GetGrid()->GetPropertyValues("Test", m_pPropGridManager->GetGrid()->GetRoot(), wxPG_KEEP_STRUCTURE|wxPG_INC_ATTRIBUTES); } else if ( id == ID_SETVALUES ) { - if ( m_storedValues.IsType(wxT("list")) ) + if ( m_storedValues.IsType("list") ) { m_pPropGridManager->GetGrid()->SetPropertyValues(m_storedValues); } else - wxMessageBox(wxT("First use Get Property Values.")); + wxMessageBox("First use Get Property Values."); } else if ( id == ID_SETVALUES2 ) { wxVariant list; list.NullList(); - list.Append( wxVariant((long)1234,wxT("VariantLong")) ); - list.Append( wxVariant(true,wxT("VariantBool")) ); - list.Append( wxVariant(wxT("Test Text"),wxT("VariantString")) ); + list.Append( wxVariant((long)1234,"VariantLong") ); + list.Append( wxVariant(true,"VariantBool") ); + list.Append( wxVariant("Test Text","VariantString") ); m_pPropGridManager->GetGrid()->SetPropertyValues(list); } else if ( id == ID_COLLAPSE ) @@ -3123,7 +3116,7 @@ bool cxApplication::OnInit() //wxLocale Locale; //Locale.Init(wxLANGUAGE_FINNISH); - FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) ); + FormMain* frame = Form1 = new FormMain( "wxPropertyGrid Sample", wxPoint(0,0), wxSize(300,500) ); frame->Show(true); // @@ -3132,7 +3125,7 @@ bool cxApplication::OnInit() if ( app.argc > 1 ) { wxString s = app.argv[1]; - if ( s == wxT("--run-tests") ) + if ( s == "--run-tests" ) { // // Run tests @@ -3158,11 +3151,11 @@ void FormMain::OnIdle( wxIdleEvent& event ) if ( cur_focus != last_focus ) { - const wxChar* class_name = wxT(""); + const wxChar* class_name = ""; if ( cur_focus ) class_name = cur_focus->GetClassInfo()->GetClassName(); last_focus = cur_focus; - wxLogDebug( wxT("FOCUSED: %s %X"), + wxLogDebug( "FOCUSED: %s %X", class_name, (unsigned int)cur_focus); } @@ -3269,20 +3262,20 @@ struct PropertyGridPopup : wxPopupWindow m_grid = new wxPropertyGrid(m_panel, ID_POPUPGRID, wxDefaultPosition, wxSize(400,400), wxPG_SPLITTER_AUTO_CENTER); m_grid->SetColumnCount(3); - wxPGProperty *prop=m_grid->Append(new wxStringProperty(wxT("test_name"), wxPG_LABEL, wxT("test_value"))); - m_grid->SetPropertyAttribute(prop, wxPG_ATTR_UNITS, wxT("type")); - wxPGProperty *prop1 = m_grid->AppendIn(prop, new wxStringProperty(wxT("sub_name1"), wxPG_LABEL, wxT("sub_value1"))); + wxPGProperty *prop=m_grid->Append(new wxStringProperty("test_name", wxPG_LABEL, "test_value")); + m_grid->SetPropertyAttribute(prop, wxPG_ATTR_UNITS, "type"); + wxPGProperty *prop1 = m_grid->AppendIn(prop, new wxStringProperty("sub_name1", wxPG_LABEL, "sub_value1")); - m_grid->AppendIn(prop1, new wxSystemColourProperty(wxT("Cell Colour"),wxPG_LABEL, m_grid->GetGrid()->GetCellBackgroundColour())); - wxPGProperty *prop2 = m_grid->AppendIn(prop, new wxStringProperty(wxT("sub_name2"), wxPG_LABEL, wxT("sub_value2"))); - m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name21"), wxPG_LABEL, wxT("sub_value21"))); + m_grid->AppendIn(prop1, new wxSystemColourProperty("Cell Colour",wxPG_LABEL, m_grid->GetGrid()->GetCellBackgroundColour())); + wxPGProperty *prop2 = m_grid->AppendIn(prop, new wxStringProperty("sub_name2", wxPG_LABEL, "sub_value2")); + m_grid->AppendIn(prop2, new wxStringProperty("sub_name21", wxPG_LABEL, "sub_value21")); wxArrayDouble arrdbl; arrdbl.Add(-1.0); arrdbl.Add(-0.5); arrdbl.Add(0.0); arrdbl.Add(0.5); arrdbl.Add(1.0); - m_grid->AppendIn(prop, new wxArrayDoubleProperty(wxT("ArrayDoubleProperty"),wxPG_LABEL,arrdbl) ); - m_grid->AppendIn(prop, new wxFontProperty(wxT("Font"),wxPG_LABEL)); - m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name22"), wxPG_LABEL, wxT("sub_value22"))); - m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name23"), wxPG_LABEL, wxT("sub_value23"))); + m_grid->AppendIn(prop, new wxArrayDoubleProperty("ArrayDoubleProperty",wxPG_LABEL,arrdbl) ); + m_grid->AppendIn(prop, new wxFontProperty("Font",wxPG_LABEL)); + m_grid->AppendIn(prop2, new wxStringProperty("sub_name22", wxPG_LABEL, "sub_value22")); + m_grid->AppendIn(prop2, new wxStringProperty("sub_name23", wxPG_LABEL, "sub_value23")); prop2->SetExpanded(false); ::SetMinSize(m_grid); @@ -3297,13 +3290,13 @@ struct PropertyGridPopup : wxPopupWindow void OnCollapse(wxPropertyGridEvent& WXUNUSED(event)) { - wxLogMessage(wxT("OnCollapse")); + wxLogMessage("OnCollapse"); Fit(); } void OnExpand(wxPropertyGridEvent& WXUNUSED(event)) { - wxLogMessage(wxT("OnExpand")); + wxLogMessage("OnExpand"); Fit(); } diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp index 355ad7a19a..a1328443b7 100644 --- a/samples/propgrid/propgrid_minimal.cpp +++ b/samples/propgrid/propgrid_minimal.cpp @@ -38,12 +38,12 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) wxEND_EVENT_TABLE() MyFrame::MyFrame(wxWindow* parent) - : wxFrame(parent, wxID_ANY, wxT("PropertyGrid Test")) + : wxFrame(parent, wxID_ANY, "PropertyGrid Test") { wxMenu *Menu = new wxMenu; - Menu->Append(ID_ACTION, wxT("Action")); + Menu->Append(ID_ACTION, "Action"); wxMenuBar *MenuBar = new wxMenuBar(); - MenuBar->Append(Menu, wxT("Action")); + MenuBar->Append(Menu, "Action"); SetMenuBar(MenuBar); wxPropertyGrid *pg = new wxPropertyGrid(this,wxID_ANY,wxDefaultPosition,wxSize(400,400), @@ -51,9 +51,9 @@ MyFrame::MyFrame(wxWindow* parent) wxPG_BOLD_MODIFIED ); m_pg = pg; - pg->Append( new wxStringProperty(wxT("String Property"), wxPG_LABEL) ); - pg->Append( new wxIntProperty(wxT("Int Property"), wxPG_LABEL) ); - pg->Append( new wxBoolProperty(wxT("Bool Property"), wxPG_LABEL) ); + pg->Append( new wxStringProperty("String Property", wxPG_LABEL) ); + pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) ); + pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) ); SetSize(400, 600); } @@ -64,12 +64,12 @@ void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) if ( p ) { - wxLogVerbose(wxT("OnPropertyGridChange(%s, value=%s)"), + wxLogVerbose("OnPropertyGridChange(%s, value=%s)", p->GetName().c_str(), p->GetValueAsString().c_str()); } else { - wxLogVerbose(wxT("OnPropertyGridChange(NULL)")); + wxLogVerbose("OnPropertyGridChange(NULL)"); } } @@ -77,7 +77,7 @@ void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event) { wxPGProperty* p = event.GetProperty(); - wxLogVerbose(wxT("OnPropertyGridChanging(%s)"), p->GetName().c_str()); + wxLogVerbose("OnPropertyGridChanging(%s)", p->GetName().c_str()); } void MyFrame::OnAction(wxCommandEvent &) diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index 788b414767..9a3b7a1b41 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -69,7 +69,7 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n m_value_wxFontData << fontData; // Add extra children. - AddPrivateChild( new wxColourProperty(wxT("Colour"), wxPG_LABEL, + AddPrivateChild( new wxColourProperty("Colour", wxPG_LABEL, fontData.GetColour() ) ); } @@ -77,9 +77,9 @@ wxFontDataProperty::~wxFontDataProperty () { } void wxFontDataProperty::OnSetValue() { - if ( !m_value.IsType(wxT("wxFontData")) ) + if ( !m_value.IsType("wxFontData") ) { - if ( m_value.IsType(wxT("wxFont")) ) + if ( m_value.IsType("wxFont") ) { wxFont font; font << m_value; @@ -101,7 +101,7 @@ void wxFontDataProperty::OnSetValue() } else { - wxFAIL_MSG(wxT("Value to wxFontDataProperty must be either wxFontData or wxFont")); + wxFAIL_MSG("Value to wxFontDataProperty must be either wxFontData or wxFont"); } } else @@ -201,8 +201,8 @@ wxSizeProperty::wxSizeProperty( const wxString& label, const wxString& name, const wxSize& value) : wxPGProperty(label,name) { SetValueI(value); - AddPrivateChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) ); - AddPrivateChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) ); + AddPrivateChild( new wxIntProperty("Width",wxPG_LABEL,value.x) ); + AddPrivateChild( new wxIntProperty("Height",wxPG_LABEL,value.y) ); } wxSizeProperty::~wxSizeProperty() { } @@ -241,8 +241,8 @@ wxPointProperty::wxPointProperty( const wxString& label, const wxString& name, const wxPoint& value) : wxPGProperty(label,name) { SetValueI(value); - AddPrivateChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) ); - AddPrivateChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) ); + AddPrivateChild( new wxIntProperty("X",wxPG_LABEL,value.x) ); + AddPrivateChild( new wxIntProperty("Y",wxPG_LABEL,value.y) ); } wxPointProperty::~wxPointProperty() { } @@ -277,7 +277,7 @@ wxVariant wxPointProperty::ChildChanged( wxVariant& thisValue, // ----------------------------------------------------------------------- WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(wxDirsProperty, ',', - wxT("Browse")) + "Browse") #if wxUSE_VALIDATORS @@ -292,7 +292,7 @@ wxValidator* wxDirsProperty::DoGetValidator() const bool wxDirsProperty::OnCustomStringEdit( wxWindow* parent, wxString& value ) { wxDirDialog dlg(parent, - wxT("Select a directory to be added to the list:"), + "Select a directory to be added to the list:", value, 0); @@ -474,7 +474,7 @@ bool operator == (const wxArrayDouble& a, const wxArrayDouble& b) // Can't do direct equality comparison with floating point numbers. if ( fabs(a[i] - b[i]) > 0.0000000001 ) { - //wxLogDebug(wxT("%f != %f"),a[i],b[i]); + //wxLogDebug("%f != %f",a[i],b[i]); return false; } } @@ -498,10 +498,10 @@ wxArrayDoubleProperty::wxArrayDoubleProperty (const wxString& label, // // Need to figure out delimiter needed for this locale // (i.e. can't use comma when comma acts as decimal point in float). - wxChar use_delimiter = wxT(','); + wxChar use_delimiter = ','; - if (wxString::Format(wxT("%.2f"),12.34).Find(use_delimiter) >= 0) - use_delimiter = wxT(';'); + if (wxString::Format("%.2f",12.34).Find(use_delimiter) >= 0) + use_delimiter = ';'; m_delimiter = use_delimiter; @@ -540,7 +540,7 @@ wxString wxArrayDoubleProperty::ValueToString( wxVariant& value, void wxArrayDoubleProperty::GenerateValueAsString( wxString& target, int prec, bool removeZeroes ) const { - wxChar between[3] = wxT(", "); + wxString between = ", "; size_t i; between[0] = m_delimiter; @@ -657,7 +657,7 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const wxArrayString incChars(numValidator.GetIncludes()); // Accept also a delimiter and space character incChars.Add(m_delimiter); - incChars.Add(wxT(" ")); + incChars.Add(" "); validator->SetIncludes(incChars); @@ -670,9 +670,9 @@ wxValidator* wxArrayDoubleProperty::DoGetValidator() const bool wxArrayDoubleProperty::ValidateValue(wxVariant& value, wxPGValidationInfo& validationInfo) const { - if (!value.IsType(wxT("wxArrayDouble"))) + if (!value.IsType("wxArrayDouble")) { - validationInfo.SetFailureMessage(wxT("At least one element is not a valid floating-point number.")); + validationInfo.SetFailureMessage("At least one element is not a valid floating-point number."); return false; } diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index 3a48785286..5f6cd552c5 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -45,13 +45,13 @@ public: : wxColourProperty(label, name, value) { wxPGChoices colours; - colours.Add(wxT("White")); - colours.Add(wxT("Black")); - colours.Add(wxT("Red")); - colours.Add(wxT("Green")); - colours.Add(wxT("Blue")); - colours.Add(wxT("Custom")); - colours.Add(wxT("None")); + colours.Add("White"); + colours.Add("Black"); + colours.Add("Red"); + colours.Add("Green"); + colours.Add("Blue"); + colours.Add("Custom"); + colours.Add("None"); m_choices = colours; SetIndex(0); wxVariant variant; @@ -106,24 +106,24 @@ public: void FormMain::AddTestProperties( wxPropertyGridPage* pg ) { - pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) ); - pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true); - pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox ); + pg->Append( new MyColourProperty("CustomColourProperty", wxPG_LABEL, *wxGREEN) ); + pg->GetProperty("CustomColourProperty")->SetAutoUnspecified(true); + pg->SetPropertyEditor( "CustomColourProperty", wxPGEditor_ComboBox ); - pg->SetPropertyHelpString(wxT("CustomColourProperty"), - wxT("This is a MyColourProperty from the sample app. ") - wxT("It is built by subclassing wxColourProperty.")); + pg->SetPropertyHelpString("CustomColourProperty", + "This is a MyColourProperty from the sample app. " + "It is built by subclassing wxColourProperty."); } // ----------------------------------------------------------------------- void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) { - wxVariant values = m_pPropGridManager->GetPropertyValues(wxT("list"), wxNullProperty, wxPG_INC_ATTRIBUTES); - wxString text = wxT("This only tests that wxVariant related routines do not crash."); + wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES); + wxString text = "This only tests that wxVariant related routines do not crash."; wxString t; - wxDialog* dlg = new wxDialog(this,wxID_ANY,wxT("wxVariant Test"), + wxDialog* dlg = new wxDialog(this,wxID_ANY,"wxVariant Test", wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); unsigned int i; @@ -134,26 +134,26 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) wxString strValue = v.GetString(); #if wxCHECK_VERSION(2,8,0) - if ( v.GetName().EndsWith(wxT("@attr")) ) + if ( v.GetName().EndsWith("@attr") ) #else - if ( v.GetName().Right(5) == wxT("@attr") ) + if ( v.GetName().Right(5) == "@attr" ) #endif { - text += wxString::Format(wxT("Attributes:\n")); + text += wxString::Format("Attributes:\n"); unsigned int n; for ( n = 0; n < (unsigned int)v.GetCount(); n++ ) { wxVariant& a = v[n]; - t.Printf(wxT(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n"),(int)n, + t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n",(int)n, a.GetName().c_str(),a.GetType().c_str(),a.GetString().c_str()); text += t; } } else { - t.Printf(wxT("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n"),(int)i, + t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n",(int)i, v.GetName().c_str(),v.GetType().c_str(),strValue.c_str()); text += t; } @@ -169,7 +169,7 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); rowsizer = new wxBoxSizer( wxHORIZONTAL ); - rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")), + rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"), wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); topsizer->Add( rowsizer, wxSizerFlags().Right() ); @@ -197,8 +197,8 @@ public: m_preWarnings = wxPGGlobalVars->m_warnings; #endif - if ( name != wxT("none") ) - Msg(name+wxT("\n")); + if ( name != "none" ) + Msg(name+"\n"); } ~TestRunner() @@ -207,7 +207,7 @@ public: int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings; if ( warningsOccurred ) { - wxString s = wxString::Format(wxT("%i warnings occurred during test '%s'"), warningsOccurred, m_name.c_str()); + wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name.c_str()); m_errorMessages->push_back(s); Msg(s); } @@ -219,7 +219,7 @@ public: if ( m_ed ) { m_ed->AppendText(text); - m_ed->AppendText(wxT("\n")); + m_ed->AppendText("\n"); } wxLogDebug(text); } @@ -236,14 +236,14 @@ protected: #define RT_START_TEST(TESTNAME) \ - TestRunner tr(wxT(#TESTNAME), pgman, ed, &errorMessages); + TestRunner tr(#TESTNAME, pgman, ed, &errorMessages); #define RT_MSG(S) \ tr.Msg(S); #define RT_FAILURE() \ { \ - wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \ + wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \ errorMessages.push_back(s1); \ wxLogDebug(s1); \ failures++; \ @@ -255,10 +255,10 @@ protected: #define RT_FAILURE_MSG(MSG) \ { \ - wxString s1 = wxString::Format(wxT("Test failure in tests.cpp, line %i."),__LINE__-1); \ + wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \ errorMessages.push_back(s1); \ wxLogDebug(s1); \ - wxString s2 = wxString::Format(wxT("Message: %s"),MSG.c_str()); \ + wxString s2 = wxString::Format("Message: %s",MSG.c_str()); \ errorMessages.push_back(s2); \ wxLogDebug(s2); \ failures++; \ @@ -270,7 +270,7 @@ protected: unsigned int h2_ = PROPS->GetActualVirtualHeight(); \ if ( h1_ != h2_ ) \ { \ - wxString s_ = wxString::Format(wxT("VirtualHeight = %i, should be %i (%s)"), h1_, h2_, EXTRATEXT.c_str()); \ + wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT.c_str()); \ RT_FAILURE_MSG(s_); \ _failed_ = true; \ } \ @@ -342,7 +342,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxArrayString errorMessages; wxDialog* dlg = NULL; - dlg = new wxDialog(this,wxID_ANY,wxT("wxPropertyGrid Regression Tests"), + dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests", wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); // multi-line text editor dialog @@ -355,7 +355,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); rowsizer = new wxBoxSizer( wxHORIZONTAL ); - rowsizer->Add( new wxButton(dlg,wxID_OK,wxT("Ok")), + rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"), wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); topsizer->Add( rowsizer, wxSizerFlags().Right() ); @@ -382,13 +382,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a category (non-private child property expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel().c_str())) else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel().c_str())) count++; } - RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries"), count)); + RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries", count)); count = 0; for ( it = pgman->GetVIterator(wxPG_ITERATE_CATEGORIES); @@ -397,11 +397,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( !p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' is not a category (only category was expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel().c_str())) count++; } - RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries"), count)); + RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries", count)); count = 0; for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES); @@ -410,11 +410,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' is a private child (non-private child property or category expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel().c_str())) count++; } - RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries"), count)); + RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries", count)); count = 0; for ( it = pgman->GetVIterator(wxPG_ITERATE_VISIBLE); @@ -423,13 +423,13 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( (p->GetParent() != p->GetParentState()->DoGetRoot() && !p->GetParent()->IsExpanded()) ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' had collapsed parent (only visible properties expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel().c_str())) else if ( p->HasFlag(wxPG_PROP_HIDDEN) ) - RT_FAILURE_MSG(wxString::Format(wxT("'%s' was hidden (only visible properties expected)"),p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel().c_str())) count++; } - RT_MSG(wxString::Format(wxT("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries"), count)); + RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries", count)); } if ( fullTest ) @@ -476,7 +476,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 ) { wxPGProperty* p = (wxPGProperty*)*it2; - RT_MSG(wxString::Format(wxT("Deleting '%s' ('%s')"),p->GetLabel().c_str(),p->GetName().c_str())); + RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel().c_str(),p->GetName().c_str())); pgman->DeleteProperty(p); } @@ -521,7 +521,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxAny any; #if wxUSE_DATETIME - prop = pgman->GetProperty(wxT("DateProperty")); + prop = pgman->GetProperty("DateProperty"); wxDateTime testTime = wxDateTime::Now(); any = testTime; prop->SetValue(any); @@ -529,7 +529,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_FAILURE(); #endif - prop = pgman->GetProperty(wxT("IntProperty")); + prop = pgman->GetProperty("IntProperty"); int testInt = 25537983; any = testInt; prop->SetValue(any); @@ -540,15 +540,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_FAILURE(); #endif - prop = pgman->GetProperty(wxT("StringProperty")); - wxString testString = wxT("asd934jfyn3"); + prop = pgman->GetProperty("StringProperty"); + wxString testString = "asd934jfyn3"; any = testString; prop->SetValue(any); if ( prop->GetValue().GetAny().As() != testString ) RT_FAILURE(); // Test with a type generated with IMPLEMENT_VARIANT_OBJECT() - prop = pgman->GetProperty(wxT("ColourProperty")); + prop = pgman->GetProperty("ColourProperty"); wxColour testCol = *wxCYAN; any = testCol; prop->SetValue(any); @@ -557,7 +557,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) // Test with a type with custom wxVariantData defined by // wxPG headers. - prop = pgman->GetProperty(wxT("Position")); + prop = pgman->GetProperty("Position"); wxPoint testPoint(199, 199); any = testPoint; prop->SetValue(any); @@ -580,7 +580,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxVariant& v = values[j]; - t.Printf(wxT("%i: name=\"%s\" type=\"%s\"\n"),(int)j, + t.Printf("%i: name=\"%s\" type=\"%s\"\n",(int)j, v.GetName().c_str(),v.GetType().c_str()); text += t; @@ -592,21 +592,21 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { RT_START_TEST(SetPropertyValue_and_GetPropertyValue) - // In this section, mixed up usage of wxT("propname") and "propname" + // In this section, mixed up usage of "propname" and "propname" // in wxPropertyGridInterface functions is intentional. // Purpose is to test wxPGPropArgCls ctors. //pg = (wxPropertyGrid*) NULL; wxArrayString test_arrstr_1; - test_arrstr_1.Add(wxT("Apple")); - test_arrstr_1.Add(wxT("Orange")); - test_arrstr_1.Add(wxT("Lemon")); + test_arrstr_1.Add("Apple"); + test_arrstr_1.Add("Orange"); + test_arrstr_1.Add("Lemon"); wxArrayString test_arrstr_2; - test_arrstr_2.Add(wxT("Potato")); - test_arrstr_2.Add(wxT("Cabbage")); - test_arrstr_2.Add(wxT("Cucumber")); + test_arrstr_2.Add("Potato"); + test_arrstr_2.Add("Cabbage"); + test_arrstr_2.Add("Cucumber"); wxArrayInt test_arrint_1; test_arrint_1.Add(1); @@ -632,117 +632,117 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) #define FLAG_TEST_SET1 (wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER) #define FLAG_TEST_SET2 (wxSTAY_ON_TOP|wxCAPTION|wxICONIZE|wxSYSTEM_MENU) - pgman->SetPropertyValue(wxT("StringProperty"),wxT("Text1")); - pgman->SetPropertyValue(wxT("IntProperty"),1024); - pgman->SetPropertyValue(wxT("FloatProperty"),1024.0000000001); - pgman->SetPropertyValue(wxT("BoolProperty"),false); - pgman->SetPropertyValue(wxT("EnumProperty"),120); - pgman->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_1); + pgman->SetPropertyValue("StringProperty","Text1"); + pgman->SetPropertyValue("IntProperty",1024); + pgman->SetPropertyValue("FloatProperty",1024.0000000001); + pgman->SetPropertyValue("BoolProperty",false); + pgman->SetPropertyValue("EnumProperty",120); + pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1); wxColour emptyCol; - pgman->SetPropertyValue(wxT("ColourProperty"),emptyCol); - pgman->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxBLACK); - pgman->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(150,150))); - pgman->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(150,150))); - pgman->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_1); + pgman->SetPropertyValue("ColourProperty",emptyCol); + pgman->SetPropertyValue("ColourProperty",(wxObject*)wxBLACK); + pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150))); + pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150))); + pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1); #if wxUSE_DATETIME - pgman->SetPropertyValue(wxT("DateProperty"),dt1); + pgman->SetPropertyValue("DateProperty",dt1); #endif pgman->SelectPage(2); pg = pgman->GetGrid(); - if ( pg->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text1") ) + if ( pg->GetPropertyValueAsString("StringProperty") != "Text1" ) RT_FAILURE(); - if ( pg->GetPropertyValueAsInt(wxT("IntProperty")) != 1024 ) + if ( pg->GetPropertyValueAsInt("IntProperty") != 1024 ) RT_FAILURE(); - if ( pg->GetPropertyValueAsDouble(wxT("FloatProperty")) != 1024.0000000001 ) + if ( pg->GetPropertyValueAsDouble("FloatProperty") != 1024.0000000001 ) RT_FAILURE(); - if ( pg->GetPropertyValueAsBool(wxT("BoolProperty")) != false ) + if ( pg->GetPropertyValueAsBool("BoolProperty") != false ) RT_FAILURE(); - if ( pg->GetPropertyValueAsLong(wxT("EnumProperty")) != 120 ) + if ( pg->GetPropertyValueAsLong("EnumProperty") != 120 ) RT_FAILURE(); - if ( pg->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_1 ) + if ( pg->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_1 ) RT_FAILURE(); wxColour col; - col << pgman->GetPropertyValue(wxT("ColourProperty")); + col << pgman->GetPropertyValue("ColourProperty"); if ( col != *wxBLACK ) RT_FAILURE(); - wxVariant varSize(pg->GetPropertyValue(wxT("Size"))); + wxVariant varSize(pg->GetPropertyValue("Size")); if ( wxSizeRefFromVariant(varSize) != wxSize(150,150) ) RT_FAILURE(); - wxVariant varPos(pg->GetPropertyValue(wxT("Position"))); + wxVariant varPos(pg->GetPropertyValue("Position")); if ( wxPointRefFromVariant(varPos) != wxPoint(150,150) ) RT_FAILURE(); - if ( !(pg->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_1) ) + if ( !(pg->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_1) ) RT_FAILURE(); #if wxUSE_DATETIME - if ( !(pg->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt1) ) + if ( !(pg->GetPropertyValueAsDateTime("DateProperty") == dt1) ) RT_FAILURE(); #endif #if wxUSE_LONGLONG && defined(wxLongLong_t) - pgman->SetPropertyValue(wxT("IntProperty"),wxLL(10000000000)); - if ( pg->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(10000000000) ) + pgman->SetPropertyValue("IntProperty",wxLL(10000000000)); + if ( pg->GetPropertyValueAsLongLong("IntProperty") != wxLL(10000000000) ) RT_FAILURE(); #else - pgman->SetPropertyValue(wxT("IntProperty"),1000000000); - if ( pg->GetPropertyValueAsLong(wxT("IntProperty")) != 1000000000 ) + pgman->SetPropertyValue("IntProperty",1000000000); + if ( pg->GetPropertyValueAsLong("IntProperty") != 1000000000 ) RT_FAILURE(); #endif - pg->SetPropertyValue(wxT("StringProperty"),wxT("Text2")); - pg->SetPropertyValue(wxT("IntProperty"),512); - pg->SetPropertyValue(wxT("FloatProperty"),512.0); - pg->SetPropertyValue(wxT("BoolProperty"),true); - pg->SetPropertyValue(wxT("EnumProperty"),80); - pg->SetPropertyValue(wxT("ArrayStringProperty"),test_arrstr_2); - pg->SetPropertyValue(wxT("ColourProperty"),(wxObject*)wxWHITE); - pg->SetPropertyValue(wxT("Size"),WXVARIANT(wxSize(300,300))); - pg->SetPropertyValue(wxT("Position"),WXVARIANT(wxPoint(300,300))); - pg->SetPropertyValue(wxT("MultiChoiceProperty"),test_arrint_2); + pg->SetPropertyValue("StringProperty","Text2"); + pg->SetPropertyValue("IntProperty",512); + pg->SetPropertyValue("FloatProperty",512.0); + pg->SetPropertyValue("BoolProperty",true); + pg->SetPropertyValue("EnumProperty",80); + pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2); + pg->SetPropertyValue("ColourProperty",(wxObject*)wxWHITE); + pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300))); + pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300))); + pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2); #if wxUSE_DATETIME - pg->SetPropertyValue(wxT("DateProperty"),dt2); + pg->SetPropertyValue("DateProperty",dt2); #endif //pg = (wxPropertyGrid*) NULL; pgman->SelectPage(0); - if ( pgman->GetPropertyValueAsString(wxT("StringProperty")) != wxT("Text2") ) + if ( pgman->GetPropertyValueAsString("StringProperty") != "Text2" ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsInt(wxT("IntProperty")) != 512 ) + if ( pgman->GetPropertyValueAsInt("IntProperty") != 512 ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsDouble(wxT("FloatProperty")) != 512.0 ) + if ( pgman->GetPropertyValueAsDouble("FloatProperty") != 512.0 ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsBool(wxT("BoolProperty")) != true ) + if ( pgman->GetPropertyValueAsBool("BoolProperty") != true ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsLong(wxT("EnumProperty")) != 80 ) + if ( pgman->GetPropertyValueAsLong("EnumProperty") != 80 ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsArrayString(wxT("ArrayStringProperty")) != test_arrstr_2 ) + if ( pgman->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_2 ) RT_FAILURE(); - col << pgman->GetPropertyValue(wxT("ColourProperty")); + col << pgman->GetPropertyValue("ColourProperty"); if ( col != *wxWHITE ) RT_FAILURE(); - varSize = pgman->GetPropertyValue(wxT("Size")); + varSize = pgman->GetPropertyValue("Size"); if ( wxSizeRefFromVariant(varSize) != wxSize(300,300) ) RT_FAILURE(); - varPos = pgman->GetPropertyValue(wxT("Position")); + varPos = pgman->GetPropertyValue("Position"); if ( wxPointRefFromVariant(varPos) != wxPoint(300,300) ) RT_FAILURE(); - if ( !(pgman->GetPropertyValueAsArrayInt(wxT("MultiChoiceProperty")) == test_arrint_2) ) + if ( !(pgman->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_2) ) RT_FAILURE(); #if wxUSE_DATETIME - if ( !(pgman->GetPropertyValueAsDateTime(wxT("DateProperty")) == dt2) ) + if ( !(pgman->GetPropertyValueAsDateTime("DateProperty") == dt2) ) RT_FAILURE(); #endif #if wxUSE_LONGLONG && defined(wxLongLong_t) - pgman->SetPropertyValue(wxT("IntProperty"),wxLL(-80000000000)); - if ( pgman->GetPropertyValueAsLongLong(wxT("IntProperty")) != wxLL(-80000000000) ) + pgman->SetPropertyValue("IntProperty",wxLL(-80000000000)); + if ( pgman->GetPropertyValueAsLongLong("IntProperty") != wxLL(-80000000000) ) RT_FAILURE(); #else - pgman->SetPropertyValue(wxT("IntProperty"),-1000000000); - if ( pgman->GetPropertyValueAsLong(wxT("IntProperty")) != -1000000000 ) + pgman->SetPropertyValue("IntProperty",-1000000000); + if ( pgman->GetPropertyValueAsLong("IntProperty") != -1000000000 ) RT_FAILURE(); #endif @@ -751,46 +751,46 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) // // This updates children as well - wxString nvs = wxT("Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible"); + wxString nvs = "Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible"; pgman->SetPropertyValue("Car", nvs); - if ( pgman->GetPropertyValueAsString(wxT("Car.Model")) != wxT("Lamborghini Diablo XYZ") ) + if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" ) { RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Model=%s"), pgman->GetPropertyValueAsString(wxS("Car.Model")).c_str())); } - if ( pgman->GetPropertyValueAsInt(wxT("Car.Speeds.Max. Speed (mph)")) != 100 ) + if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 ) { - RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Speeds.Max. Speed (mph)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str())); } - if ( pgman->GetPropertyValueAsInt(wxT("Car.Price ($)")) != 3000002 ) + if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 ) { RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")).c_str())); } - if ( !pgman->GetPropertyValueAsBool(wxT("Car.Convertible")) ) + if ( !pgman->GetPropertyValueAsBool("Car.Convertible") ) { - RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Convertible=%s"), pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str())); } // SetPropertyValueString for special cases such as wxColour - pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("(123,4,255)")); - col << pgman->GetPropertyValue(wxT("ColourProperty")); + pgman->SetPropertyValueString("ColourProperty", "(123,4,255)"); + col << pgman->GetPropertyValue("ColourProperty"); if ( col != wxColour(123, 4, 255) ) RT_FAILURE(); - pgman->SetPropertyValueString(wxT("ColourProperty"), wxT("#FE860B")); - col << pgman->GetPropertyValue(wxT("ColourProperty")); + pgman->SetPropertyValueString("ColourProperty", "#FE860B"); + col << pgman->GetPropertyValue("ColourProperty"); if ( col != wxColour(254, 134, 11) ) RT_FAILURE(); - pgman->SetPropertyValueString(wxT("ColourPropertyWithAlpha"), - wxT("(10, 20, 30, 128)")); - col << pgman->GetPropertyValue(wxT("ColourPropertyWithAlpha")); + pgman->SetPropertyValueString("ColourPropertyWithAlpha", + "(10, 20, 30, 128)"); + col << pgman->GetPropertyValue("ColourPropertyWithAlpha"); if ( col != wxColour(10, 20, 30, 128) ) RT_FAILURE(); - if ( pgman->GetPropertyValueAsString(wxT("ColourPropertyWithAlpha")) - != wxT("(10,20,30,128)") ) + if ( pgman->GetPropertyValueAsString("ColourPropertyWithAlpha") + != "(10,20,30,128)" ) RT_FAILURE(); } @@ -798,18 +798,18 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_START_TEST(SetPropertyValueUnspecified) // Null variant setter tests - pgman->SetPropertyValueUnspecified(wxT("StringProperty")); - pgman->SetPropertyValueUnspecified(wxT("IntProperty")); - pgman->SetPropertyValueUnspecified(wxT("FloatProperty")); - pgman->SetPropertyValueUnspecified(wxT("BoolProperty")); - pgman->SetPropertyValueUnspecified(wxT("EnumProperty")); - pgman->SetPropertyValueUnspecified(wxT("ArrayStringProperty")); - pgman->SetPropertyValueUnspecified(wxT("ColourProperty")); - pgman->SetPropertyValueUnspecified(wxT("Size")); - pgman->SetPropertyValueUnspecified(wxT("Position")); - pgman->SetPropertyValueUnspecified(wxT("MultiChoiceProperty")); + pgman->SetPropertyValueUnspecified("StringProperty"); + pgman->SetPropertyValueUnspecified("IntProperty"); + pgman->SetPropertyValueUnspecified("FloatProperty"); + pgman->SetPropertyValueUnspecified("BoolProperty"); + pgman->SetPropertyValueUnspecified("EnumProperty"); + pgman->SetPropertyValueUnspecified("ArrayStringProperty"); + pgman->SetPropertyValueUnspecified("ColourProperty"); + pgman->SetPropertyValueUnspecified("Size"); + pgman->SetPropertyValueUnspecified("Position"); + pgman->SetPropertyValueUnspecified("MultiChoiceProperty"); #if wxUSE_DATETIME - pgman->SetPropertyValueUnspecified(wxT("DateProperty")); + pgman->SetPropertyValueUnspecified("DateProperty"); #endif } @@ -823,10 +823,10 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pg = pgman->GetGrid(); - wxPGProperty* prop1 = pg->GetProperty(wxT("Label")); - wxPGProperty* prop2 = pg->GetProperty(wxT("Cell Text Colour")); - wxPGProperty* prop3 = pg->GetProperty(wxT("Height")); - wxPGProperty* catProp = pg->GetProperty(wxT("Appearance")); + wxPGProperty* prop1 = pg->GetProperty("Label"); + wxPGProperty* prop2 = pg->GetProperty("Cell Text Colour"); + wxPGProperty* prop3 = pg->GetProperty("Height"); + wxPGProperty* catProp = pg->GetProperty("Appearance"); RT_ASSERT( prop1 && prop2 && prop3 ); @@ -882,7 +882,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pg->MakeColumnEditable(2, true); pg->MakeColumnEditable(0, false); pg->MakeColumnEditable(2, false); - pg->SelectProperty(wxT("Height")); + pg->SelectProperty("Height"); pg->BeginLabelEdit(0); pg->BeginLabelEdit(0); pg->EndLabelEdit(0); @@ -896,15 +896,15 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { RT_START_TEST(Attributes) - wxPGProperty* prop = pgman->GetProperty(wxT("StringProperty")); - prop->SetAttribute(wxT("Dummy Attribute"), (long)15); + wxPGProperty* prop = pgman->GetProperty("StringProperty"); + prop->SetAttribute("Dummy Attribute", (long)15); - if ( prop->GetAttribute(wxT("Dummy Attribute")).GetLong() != 15 ) + if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15 ) RT_FAILURE(); - prop->SetAttribute(wxT("Dummy Attribute"), wxVariant()); + prop->SetAttribute("Dummy Attribute", wxVariant()); - if ( !prop->GetAttribute(wxT("Dummy Attribute")).IsNull() ) + if ( !prop->GetAttribute("Dummy Attribute").IsNull() ) RT_FAILURE(); } @@ -913,20 +913,20 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_START_TEST(DoubleToString) // Locale-specific decimal separator - wxString sep = wxString::Format(wxT("%g"), 1.1)[1]; + wxString sep = wxString::Format("%g", 1.1)[1]; wxString s; if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) != - wxString::Format(wxT("123%s12"), sep.c_str()) ) + wxString::Format("123%s12", sep.c_str()) ) RT_FAILURE(); if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) != - wxString::Format(wxT("-123%s1230"), sep.c_str()) ) + wxString::Format("-123%s1230", sep.c_str()) ) RT_FAILURE(); if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) != - wxString::Format(wxT("0%s0"), sep) ) + wxString::Format("0%s0", sep) ) RT_FAILURE(); - if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != wxT("0") ) + if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != "0" ) RT_FAILURE(); } #endif @@ -943,11 +943,11 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_START_TEST(GetPropertyValues) page1 = pgman->GetPage(0); - pg1_values = page1->GetPropertyValues(wxT("Page1"),NULL,wxPG_KEEP_STRUCTURE); + pg1_values = page1->GetPropertyValues("Page1",NULL,wxPG_KEEP_STRUCTURE); page2 = pgman->GetPage(1); - pg2_values = page2->GetPropertyValues(wxT("Page2"),NULL,wxPG_KEEP_STRUCTURE); + pg2_values = page2->GetPropertyValues("Page2",NULL,wxPG_KEEP_STRUCTURE); page3 = pgman->GetPage(2); - pg3_values = page3->GetPropertyValues(wxT("Page3"),NULL,wxPG_KEEP_STRUCTURE); + pg3_values = page3->GetPropertyValues("Page3",NULL,wxPG_KEEP_STRUCTURE); } { @@ -980,7 +980,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) page->Collapse( p ); - t.Printf(wxT("Collapsing: %s\n"),page->GetPropertyLabel(p).c_str()); + t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p).c_str()); ed->AppendText(t); } } @@ -1021,7 +1021,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) page->Expand( p ); - t.Printf(wxT("Expand: %s\n"),page->GetPropertyLabel(p).c_str()); + t.Printf("Expand: %s\n",page->GetPropertyLabel(p).c_str()); ed->AppendText(t); } } @@ -1030,14 +1030,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { RT_START_TEST(Choice_Manipulation) - wxPGProperty* enumProp = pgman->GetProperty(wxT("EnumProperty")); + wxPGProperty* enumProp = pgman->GetProperty("EnumProperty"); pgman->SelectPage(2); pgman->SelectProperty(enumProp); wxASSERT(pgman->GetGrid()->GetSelection() == enumProp); const wxPGChoices& choices = enumProp->GetChoices(); - int ind = enumProp->InsertChoice(wxT("New Choice"), choices.GetCount()/2); + int ind = enumProp->InsertChoice("New Choice", choices.GetCount()/2); enumProp->DeleteChoice(ind); // Recreate the original grid @@ -1084,7 +1084,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { RT_START_TEST(EnsureVisible) - pgman->EnsureVisible(wxT("Cell Colour")); + pgman->EnsureVisible("Cell Colour"); } { @@ -1093,17 +1093,17 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p; wxPGProperty* origParent = - pgman->GetProperty(wxT("Window Styles"))->GetParent(); + pgman->GetProperty("Window Styles")->GetParent(); // For testing purposes, let's set some custom cell colours - p = pgman->GetProperty(wxT("Window Styles")); + p = pgman->GetProperty("Window Styles"); p->SetCell(2, wxPGCell("style")); - p = pgman->RemoveProperty(wxT("Window Styles")); + p = pgman->RemoveProperty("Window Styles"); pgman->Refresh(); pgman->Update(); pgman->AppendIn(origParent, p); - wxASSERT( p->GetCell(2).GetText() == wxT("style")); + wxASSERT( p->GetCell(2).GetText() == "style"); pgman->Refresh(); pgman->Update(); } @@ -1115,40 +1115,40 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) // Make sure indexes are as supposed - p = pgman->GetProperty(wxT("User Name")); + p = pgman->GetProperty("User Name"); if ( p->GetIndexInParent() != 3 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("User Id")); + p = pgman->GetProperty("User Id"); if ( p->GetIndexInParent() != 2 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("User Home")); + p = pgman->GetProperty("User Home"); if ( p->GetIndexInParent() != 1 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("Operating System")); + p = pgman->GetProperty("Operating System"); if ( p->GetIndexInParent() != 0 ) RT_FAILURE(); pgman->GetGrid()->SetSortFunction(MyPropertySortFunction); - pgman->GetGrid()->SortChildren(wxT("Environment")); + pgman->GetGrid()->SortChildren("Environment"); // Make sure indexes have been reversed - p = pgman->GetProperty(wxT("User Name")); + p = pgman->GetProperty("User Name"); if ( p->GetIndexInParent() != 0 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("User Id")); + p = pgman->GetProperty("User Id"); if ( p->GetIndexInParent() != 1 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("User Home")); + p = pgman->GetProperty("User Home"); if ( p->GetIndexInParent() != 2 ) RT_FAILURE(); - p = pgman->GetProperty(wxT("Operating System")); + p = pgman->GetProperty("Operating System"); if ( p->GetIndexInParent() != 3 ) RT_FAILURE(); } @@ -1166,7 +1166,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_START_TEST(Clear) // Manager clear - pgman->SelectProperty(wxT("Label")); + pgman->SelectProperty("Label"); pgman->Clear(); if ( pgman->GetPageCount() ) @@ -1180,7 +1180,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pgman = m_pPropGridManager; // Grid clear - pgman->SelectProperty(wxT("Label")); + pgman->SelectProperty("Label"); pgman->GetGrid()->Clear(); if ( pgman->GetGrid()->GetRoot()->GetChildCount() ) @@ -1209,7 +1209,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pgman->SetSplitterPosition(trySplitterPos); if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) - RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); + RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); m_topSizer->Add( m_pPropGridManager, wxSizerFlags(1).Expand()); FinalizePanel(); @@ -1221,7 +1221,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) SetSize(sz); if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) - RT_FAILURE_MSG(wxString::Format(wxT("Splitter position was %i (should have been %i)"),(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); + RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); SetSize(origSz); @@ -1246,7 +1246,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1262,7 +1262,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1280,7 +1280,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1296,7 +1296,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1315,7 +1315,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format(wxT("HideProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1331,7 +1331,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format(wxT("ShowProperty(%i, %s)"), (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1592,7 +1592,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pgman = m_pPropGridManager; for ( i=3; i<12; i+=2 ) { - RT_MSG(wxString::Format(wxT("%i columns"),(int)i)); + RT_MSG(wxString::Format("%i columns",(int)i)); pgman->SetColumnCount(i); Refresh(); Update(); @@ -1610,7 +1610,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) for ( i=4; i<16; i++ ) { int flag = 1<m_warnings); + s = wxString::Format("All tests were successful, but there were %i warnings!", wxPGGlobalVars->m_warnings); #endif RT_MSG(s) for ( i=0; iRefresh(); - wxLogStatus(this, wxT("Successfully loaded the renderer \"%s\"."), + wxLogStatus(this, "Successfully loaded the renderer \"%s\".", name.c_str()); } } diff --git a/samples/ribbon/ribbondemo.cpp b/samples/ribbon/ribbondemo.cpp index 9f74eac9c6..3ea2150c5a 100644 --- a/samples/ribbon/ribbondemo.cpp +++ b/samples/ribbon/ribbondemo.cpp @@ -651,7 +651,7 @@ void MyFrame::OnPrimaryColourSelect(wxRibbonGalleryEvent& evt) { wxString name; wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); - AddText(wxT("Colour \"") + name + wxT("\" selected as primary.")); + AddText("Colour \"" + name + "\" selected as primary."); wxColour secondary, tertiary; m_ribbon->GetArtProvider()->GetColourScheme(NULL, &secondary, &tertiary); m_ribbon->GetArtProvider()->SetColourScheme(colour, secondary, tertiary); @@ -663,7 +663,7 @@ void MyFrame::OnSecondaryColourSelect(wxRibbonGalleryEvent& evt) { wxString name; wxColour colour = GetGalleryColour(evt.GetGallery(), evt.GetGalleryItem(), &name); - AddText(wxT("Colour \"") + name + wxT("\" selected as secondary.")); + AddText("Colour \"" + name + "\" selected as secondary."); wxColour primary, tertiary; m_ribbon->GetArtProvider()->GetColourScheme(&primary, NULL, &tertiary); m_ribbon->GetArtProvider()->SetColourScheme(primary, colour, tertiary); diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp index 7d9b970ea1..7e7f412ec2 100644 --- a/samples/stc/edit.cpp +++ b/samples/stc/edit.cpp @@ -149,9 +149,9 @@ Edit::Edit (wxWindow *parent, wxWindowID id, StyleSetFont (wxSTC_STYLE_DEFAULT, font); StyleSetForeground (wxSTC_STYLE_DEFAULT, *wxBLACK); StyleSetBackground (wxSTC_STYLE_DEFAULT, *wxWHITE); - StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); + StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY")); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); - StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); + StyleSetForeground(wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY")); InitializePrefs (DEFAULT_LANGUAGE); // set visibility @@ -160,19 +160,19 @@ Edit::Edit (wxWindow *parent, wxWindowID id, SetYCaretPolicy (wxSTC_CARET_EVEN|wxSTC_VISIBLE_STRICT|wxSTC_CARET_SLOP, 1); // markers - MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("BLACK")); - MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("BLACK")); - MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); - MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, wxT("BLACK"), wxT("WHITE")); - MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, wxT("BLACK"), wxT("WHITE")); - MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); - MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, wxT("BLACK"), wxT("BLACK")); + MarkerDefine (wxSTC_MARKNUM_FOLDER, wxSTC_MARK_DOTDOTDOT, "BLACK", "BLACK"); + MarkerDefine (wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, "BLACK", "BLACK"); + MarkerDefine (wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "BLACK", "BLACK"); + MarkerDefine (wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_DOTDOTDOT, "BLACK", "WHITE"); + MarkerDefine (wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, "BLACK", "WHITE"); + MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK"); + MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "BLACK", "BLACK"); // annotations AnnotationSetVisible(wxSTC_ANNOTATION_BOXED); // miscellaneous - m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999")); + m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, "_999999"); m_FoldingMargin = 16; CmdKeyClear (wxSTC_KEY_TAB, 0); // this is done by the menu accelerator key SetLayoutCache (wxSTC_CACHE_PAGE); @@ -501,8 +501,8 @@ wxString Edit::DeterminePrefs (const wxString &filename) { while (!filepattern.empty()) { wxString cur = filepattern.BeforeFirst (';'); if ((cur == filename) || - (cur == (filename.BeforeLast ('.') + wxT(".*"))) || - (cur == (wxT("*.") + filename.AfterLast ('.')))) { + (cur == (filename.BeforeLast ('.') + ".*")) || + (cur == ("*." + filename.AfterLast ('.')))) { return curInfo->name; } filepattern = filepattern.AfterFirst (';'); @@ -536,7 +536,7 @@ bool Edit::InitializePrefs (const wxString &name) { // set margin for line numbers SetMarginType (m_LineNrID, wxSTC_MARGIN_NUMBER); - StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY"))); + StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour ("DARK GREY")); StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE); SetMarginWidth (m_LineNrID, 0); // start out not visible @@ -554,8 +554,8 @@ bool Edit::InitializePrefs (const wxString &name) { } // set common styles - StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY"))); - StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY"))); + StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour ("DARK GREY")); + StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour ("DARK GREY")); // initialize settings if (g_CommonPrefs.syntaxEnable) { @@ -567,10 +567,10 @@ bool Edit::InitializePrefs (const wxString &name) { .Family(wxFONTFAMILY_MODERN) .FaceName(curType.fontname)); StyleSetFont (Nr, font); - if (curType.foreground) { + if (curType.foreground.length()) { StyleSetForeground (Nr, wxColour (curType.foreground)); } - if (curType.background) { + if (curType.background.length()) { StyleSetBackground (Nr, wxColour (curType.background)); } StyleSetBold (Nr, (curType.fontstyle & mySTC_STYLE_BOLD) > 0); @@ -600,21 +600,21 @@ bool Edit::InitializePrefs (const wxString &name) { if (g_CommonPrefs.foldEnable) { SetMarginWidth (m_FoldingID, curInfo->folds != 0? m_FoldingMargin: 0); SetMarginSensitive (m_FoldingID, curInfo->folds != 0); - SetProperty (wxT("fold"), curInfo->folds != 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.comment"), - (curInfo->folds & mySTC_FOLD_COMMENT) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.compact"), - (curInfo->folds & mySTC_FOLD_COMPACT) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.preprocessor"), - (curInfo->folds & mySTC_FOLD_PREPROC) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.html"), - (curInfo->folds & mySTC_FOLD_HTML) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.html.preprocessor"), - (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.comment.python"), - (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? wxT("1"): wxT("0")); - SetProperty (wxT("fold.quotes.python"), - (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? wxT("1"): wxT("0")); + SetProperty ("fold", curInfo->folds != 0? "1": "0"); + SetProperty ("fold.comment", + (curInfo->folds & mySTC_FOLD_COMMENT) > 0? "1": "0"); + SetProperty ("fold.compact", + (curInfo->folds & mySTC_FOLD_COMPACT) > 0? "1": "0"); + SetProperty ("fold.preprocessor", + (curInfo->folds & mySTC_FOLD_PREPROC) > 0? "1": "0"); + SetProperty ("fold.html", + (curInfo->folds & mySTC_FOLD_HTML) > 0? "1": "0"); + SetProperty ("fold.html.preprocessor", + (curInfo->folds & mySTC_FOLD_HTMLPREP) > 0? "1": "0"); + SetProperty ("fold.comment.python", + (curInfo->folds & mySTC_FOLD_COMMENTPY) > 0? "1": "0"); + SetProperty ("fold.quotes.python", + (curInfo->folds & mySTC_FOLD_QUOTESPY) > 0? "1": "0"); } SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED); @@ -646,8 +646,8 @@ bool Edit::LoadFile () #if wxUSE_FILEDLG // get filename if (!m_filename) { - wxFileDialog dlg (this, wxT("Open file"), wxEmptyString, wxEmptyString, - wxT("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); + wxFileDialog dlg (this, "Open file", wxEmptyString, wxEmptyString, + "Any file (*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); if (dlg.ShowModal() != wxID_OK) return false; m_filename = dlg.GetPath(); } @@ -683,7 +683,7 @@ bool Edit::SaveFile () // get filename if (!m_filename) { - wxFileDialog dlg (this, wxT("Save file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), + wxFileDialog dlg (this, "Save file", wxEmptyString, wxEmptyString, "Any file (*)|*", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if (dlg.ShowModal() != wxID_OK) return false; m_filename = dlg.GetPath(); @@ -757,14 +757,14 @@ EditProperties::EditProperties (Edit *edit, textinfo->Add (new wxStaticText (this, wxID_ANY, _("Lexer-ID: "), wxDefaultPosition, wxSize(80, wxDefaultCoord)), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); - text = wxString::Format (wxT("%d"), edit->GetLexer()); + text = wxString::Format ("%d", edit->GetLexer()); textinfo->Add (new wxStaticText (this, wxID_ANY, text), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); wxString EOLtype = wxEmptyString; switch (edit->GetEOLMode()) { - case wxSTC_EOL_CR: {EOLtype = wxT("CR (Unix)"); break; } - case wxSTC_EOL_CRLF: {EOLtype = wxT("CRLF (Windows)"); break; } - case wxSTC_EOL_LF: {EOLtype = wxT("CR (Macintosh)"); break; } + case wxSTC_EOL_CR: {EOLtype = "CR (Unix)"; break; } + case wxSTC_EOL_CRLF: {EOLtype = "CRLF (Windows)"; break; } + case wxSTC_EOL_LF: {EOLtype = "CR (Macintosh)"; break; } } textinfo->Add (new wxStaticText (this, wxID_ANY, _("Line endings"), wxDefaultPosition, wxSize(80, wxDefaultCoord)), @@ -774,7 +774,7 @@ EditProperties::EditProperties (Edit *edit, // text info box wxStaticBoxSizer *textinfos = new wxStaticBoxSizer ( - new wxStaticBox (this, wxID_ANY, _("Informations")), + new wxStaticBox (this, wxID_ANY, _("Information")), wxVERTICAL); textinfos->Add (textinfo, 0, wxEXPAND); textinfos->Add (0, 6); @@ -784,25 +784,25 @@ EditProperties::EditProperties (Edit *edit, statistic->Add (new wxStaticText (this, wxID_ANY, _("Total lines"), wxDefaultPosition, wxSize(80, wxDefaultCoord)), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); - text = wxString::Format (wxT("%d"), edit->GetLineCount()); + text = wxString::Format ("%d", edit->GetLineCount()); statistic->Add (new wxStaticText (this, wxID_ANY, text), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); statistic->Add (new wxStaticText (this, wxID_ANY, _("Total chars"), wxDefaultPosition, wxSize(80, wxDefaultCoord)), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); - text = wxString::Format (wxT("%d"), edit->GetTextLength()); + text = wxString::Format ("%d", edit->GetTextLength()); statistic->Add (new wxStaticText (this, wxID_ANY, text), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); statistic->Add (new wxStaticText (this, wxID_ANY, _("Current line"), wxDefaultPosition, wxSize(80, wxDefaultCoord)), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); - text = wxString::Format (wxT("%d"), edit->GetCurrentLine()); + text = wxString::Format ("%d", edit->GetCurrentLine()); statistic->Add (new wxStaticText (this, wxID_ANY, text), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); statistic->Add (new wxStaticText (this, wxID_ANY, _("Current pos"), wxDefaultPosition, wxSize(80, wxDefaultCoord)), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxLEFT, 4); - text = wxString::Format (wxT("%d"), edit->GetCurrentPos()); + text = wxString::Format ("%d", edit->GetCurrentPos()); statistic->Add (new wxStaticText (this, wxID_ANY, text), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4); @@ -836,7 +836,7 @@ EditProperties::EditProperties (Edit *edit, // EditPrint //---------------------------------------------------------------------------- -EditPrint::EditPrint (Edit *edit, const wxChar *title) +EditPrint::EditPrint (Edit *edit, const wxString& title) : wxPrintout(title) , m_edit(edit) { diff --git a/samples/stc/edit.h b/samples/stc/edit.h index 10f4e39c56..908990e757 100644 --- a/samples/stc/edit.h +++ b/samples/stc/edit.h @@ -162,7 +162,7 @@ class EditPrint: public wxPrintout { public: //! constructor - EditPrint (Edit *edit, const wxChar *title = wxT("")); + EditPrint (Edit *edit, const wxString& title = ""); //! event handlers bool OnPrintPage (int page) wxOVERRIDE; diff --git a/samples/stc/prefs.cpp b/samples/stc/prefs.cpp index 0e98bcf95a..e2f6bb88f9 100644 --- a/samples/stc/prefs.cpp +++ b/samples/stc/prefs.cpp @@ -218,159 +218,159 @@ const int g_LanguagePrefsSize = WXSIZEOF(g_LanguagePrefs); //! style types const StyleInfo g_StylePrefs [] = { // mySTC_TYPE_DEFAULT - {wxT("Default"), - wxT("BLACK"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Default", + "BLACK", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_WORD1 - {wxT("Keyword1"), - wxT("BLUE"), wxT("WHITE"), - wxT(""), 10, mySTC_STYLE_BOLD, 0}, + {"Keyword1", + "BLUE", "WHITE", + "", 10, mySTC_STYLE_BOLD, 0}, // mySTC_TYPE_WORD2 - {wxT("Keyword2"), - wxT("MIDNIGHT BLUE"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Keyword2", + "MIDNIGHT BLUE", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_WORD3 - {wxT("Keyword3"), - wxT("CORNFLOWER BLUE"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Keyword3", + "CORNFLOWER BLUE", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_WORD4 - {wxT("Keyword4"), - wxT("CYAN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Keyword4", + "CYAN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_WORD5 - {wxT("Keyword5"), - wxT("DARK GREY"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Keyword5", + "DARK GREY", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_WORD6 - {wxT("Keyword6"), - wxT("GREY"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Keyword6", + "GREY", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_COMMENT - {wxT("Comment"), - wxT("FOREST GREEN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Comment", + "FOREST GREEN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_COMMENT_DOC - {wxT("Comment (Doc)"), - wxT("FOREST GREEN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Comment (Doc)", + "FOREST GREEN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_COMMENT_LINE - {wxT("Comment line"), - wxT("FOREST GREEN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Comment line", + "FOREST GREEN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_COMMENT_SPECIAL - {wxT("Special comment"), - wxT("FOREST GREEN"), wxT("WHITE"), - wxT(""), 10, mySTC_STYLE_ITALIC, 0}, + {"Special comment", + "FOREST GREEN", "WHITE", + "", 10, mySTC_STYLE_ITALIC, 0}, // mySTC_TYPE_CHARACTER - {wxT("Character"), - wxT("KHAKI"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Character", + "KHAKI", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_CHARACTER_EOL - {wxT("Character (EOL)"), - wxT("KHAKI"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Character (EOL)", + "KHAKI", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_STRING - {wxT("String"), - wxT("BROWN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"String", + "BROWN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_STRING_EOL - {wxT("String (EOL)"), - wxT("BROWN"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"String (EOL)", + "BROWN", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_DELIMITER - {wxT("Delimiter"), - wxT("ORANGE"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Delimiter", + "ORANGE", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_PUNCTUATION - {wxT("Punctuation"), - wxT("ORANGE"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Punctuation", + "ORANGE", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_OPERATOR - {wxT("Operator"), - wxT("BLACK"), wxT("WHITE"), - wxT(""), 10, mySTC_STYLE_BOLD, 0}, + {"Operator", + "BLACK", "WHITE", + "", 10, mySTC_STYLE_BOLD, 0}, // mySTC_TYPE_BRACE - {wxT("Label"), - wxT("VIOLET"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Label", + "VIOLET", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_COMMAND - {wxT("Command"), - wxT("BLUE"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Command", + "BLUE", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_IDENTIFIER - {wxT("Identifier"), - wxT("BLACK"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Identifier", + "BLACK", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_LABEL - {wxT("Label"), - wxT("VIOLET"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Label", + "VIOLET", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_NUMBER - {wxT("Number"), - wxT("SIENNA"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Number", + "SIENNA", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_PARAMETER - {wxT("Parameter"), - wxT("VIOLET"), wxT("WHITE"), - wxT(""), 10, mySTC_STYLE_ITALIC, 0}, + {"Parameter", + "VIOLET", "WHITE", + "", 10, mySTC_STYLE_ITALIC, 0}, // mySTC_TYPE_REGEX - {wxT("Regular expression"), - wxT("ORCHID"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Regular expression", + "ORCHID", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_UUID - {wxT("UUID"), - wxT("ORCHID"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"UUID", + "ORCHID", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_VALUE - {wxT("Value"), - wxT("ORCHID"), wxT("WHITE"), - wxT(""), 10, mySTC_STYLE_ITALIC, 0}, + {"Value", + "ORCHID", "WHITE", + "", 10, mySTC_STYLE_ITALIC, 0}, // mySTC_TYPE_PREPROCESSOR - {wxT("Preprocessor"), - wxT("GREY"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Preprocessor", + "GREY", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_SCRIPT - {wxT("Script"), - wxT("DARK GREY"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Script", + "DARK GREY", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_ERROR - {wxT("Error"), - wxT("RED"), wxT("WHITE"), - wxT(""), 10, 0, 0}, + {"Error", + "RED", "WHITE", + "", 10, 0, 0}, // mySTC_TYPE_UNDEFINED - {wxT("Undefined"), - wxT("ORANGE"), wxT("WHITE"), - wxT(""), 10, 0, 0} + {"Undefined", + "ORANGE", "WHITE", + "", 10, 0, 0} }; diff --git a/samples/stc/prefs.h b/samples/stc/prefs.h index 74db4de9ce..5c8fd7e472 100644 --- a/samples/stc/prefs.h +++ b/samples/stc/prefs.h @@ -136,10 +136,10 @@ extern const int g_LanguagePrefsSize; //---------------------------------------------------------------------------- // StyleInfo struct StyleInfo { - const wxChar *name; - const wxChar *foreground; - const wxChar *background; - const wxChar *fontname; + const wxString name; + const wxString foreground; + const wxString background; + const wxString fontname; int fontsize; int fontstyle; int lettercase; diff --git a/samples/stc/stctest.cpp b/samples/stc/stctest.cpp index e60c04cd97..122626f4fe 100644 --- a/samples/stc/stctest.cpp +++ b/samples/stc/stctest.cpp @@ -54,19 +54,19 @@ // declarations //============================================================================ -#define APP_NAME wxT("STC-Test") -#define APP_DESCR _("See http://wxguide.sourceforge.net/") +#define APP_NAME "STC-Test" +#define APP_DESCR "See http://wxguide.sourceforge.net/" -#define APP_MAINT wxT("Otto Wyss") -#define APP_VENDOR wxT("wxWidgets") -#define APP_COPYRIGTH wxT("(C) 2003 Otto Wyss") -#define APP_LICENCE wxT("wxWidgets") +#define APP_MAINT "Otto Wyss" +#define APP_VENDOR "wxWidgets" +#define APP_COPYRIGTH "(C) 2003 Otto Wyss" +#define APP_LICENCE "wxWidgets" -#define APP_VERSION wxT("0.1.alpha") +#define APP_VERSION "0.1.alpha" #define APP_BUILD __DATE__ -#define APP_WEBSITE wxT("http://www.wxWidgets.org") -#define APP_MAIL wxT("mailto://???") +#define APP_WEBSITE "http://www.wxWidgets.org" +#define APP_MAIL "mailto://???" #define NONAME _("") @@ -214,7 +214,7 @@ bool App::OnInit () { SetVendorName (APP_VENDOR); g_appname = new wxString (); g_appname->Append (APP_VENDOR); - g_appname->Append (wxT("-")); + g_appname->Append ("-"); g_appname->Append (APP_NAME); #if wxUSE_PRINTING_ARCHITECTURE @@ -301,7 +301,7 @@ AppFrame::AppFrame (const wxString &title) // set icon and background SetTitle (*g_appname); - SetBackgroundColour (wxT("WHITE")); + SetBackgroundColour ("WHITE"); // create menu m_menuBar = new wxMenuBar; @@ -311,7 +311,7 @@ AppFrame::AppFrame (const wxString &title) m_edit = new Edit (this, wxID_ANY); m_edit->SetFocus(); - FileOpen (wxT("stctest.cpp")); + FileOpen ("stctest.cpp"); } AppFrame::~AppFrame () { @@ -341,7 +341,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) { if (!m_edit) return; #if wxUSE_FILEDLG wxString fname; - wxFileDialog dlg (this, wxT("Open file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), + wxFileDialog dlg (this, "Open file", wxEmptyString, wxEmptyString, "Any file (*)|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR); if (dlg.ShowModal() != wxID_OK) return; fname = dlg.GetPath (); @@ -363,7 +363,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) { if (!m_edit) return; #if wxUSE_FILEDLG wxString filename = wxEmptyString; - wxFileDialog dlg (this, wxT("Save file"), wxEmptyString, wxEmptyString, wxT("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT); + wxFileDialog dlg (this, "Save file", wxEmptyString, wxEmptyString, "Any file (*)|*", wxFD_SAVE|wxFD_OVERWRITE_PROMPT); if (dlg.ShowModal() != wxID_OK) return; filename = dlg.GetPath(); m_edit->SaveFile (filename); @@ -466,8 +466,8 @@ void AppFrame::OnContextMenu(wxContextMenuEvent& evt) } wxMenu menu; - menu.Append(wxID_ABOUT, wxT("&About")); - menu.Append(wxID_EXIT, wxT("E&xit")); + menu.Append(wxID_ABOUT, "&About"); + menu.Append(wxID_EXIT, "E&xit"); PopupMenu(&menu, point); } @@ -733,23 +733,23 @@ public: { SetLexerXml(); - SetProperty(wxT("fold"), wxT("1")); - SetProperty(wxT("fold.comment"), wxT("1")); - SetProperty(wxT("fold.compact"), wxT("1")); - SetProperty(wxT("fold.preprocessor"), wxT("1")); - SetProperty(wxT("fold.html"), wxT("1")); - SetProperty(wxT("fold.html.preprocessor"), wxT("1")); + SetProperty("fold", "1"); + SetProperty("fold.comment", "1"); + SetProperty("fold.compact", "1"); + SetProperty("fold.preprocessor", "1"); + SetProperty("fold.html", "1"); + SetProperty("fold.html.preprocessor", "1"); SetMarginType(margin_id_lineno, wxSTC_MARGIN_NUMBER); SetMarginWidth(margin_id_lineno, 32); - MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, wxT("WHITE"), wxT("BLACK")); - MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, wxT("WHITE"), wxT("BLACK")); + MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "WHITE", "BLACK"); + MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "WHITE", "BLACK"); SetMarginMask(margin_id_fold, wxSTC_MASK_FOLDERS); SetMarginWidth(margin_id_fold, 32); @@ -780,7 +780,7 @@ public: StyleSetForeground(wxSTC_H_DOUBLESTRING, *wxBLACK); StyleSetForeground(wxSTC_H_SINGLESTRING, *wxBLACK); StyleSetForeground(wxSTC_H_OTHER, *wxBLUE); - StyleSetForeground(wxSTC_H_COMMENT, wxTheColourDatabase->Find(wxT("GREY"))); + StyleSetForeground(wxSTC_H_COMMENT, wxTheColourDatabase->Find("GREY")); StyleSetForeground(wxSTC_H_ENTITY, *wxRED); StyleSetBold(wxSTC_H_ENTITY, true); StyleSetForeground(wxSTC_H_TAGEND, *wxBLUE); @@ -814,7 +814,7 @@ void MinimalEditor::OnMarginClick(wxStyledTextEvent &event) void MinimalEditor::OnText(wxStyledTextEvent& event) { - wxLogDebug(wxT("Modified")); + wxLogDebug("Modified"); event.Skip(); } diff --git a/samples/text/text.cpp b/samples/text/text.cpp index c95c949498..fc20d792a0 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -898,7 +898,7 @@ void MyTextCtrl::OnText(wxCommandEvent& event) const wxChar *data = (const wxChar *)(win->GetClientData()); if ( data ) { - wxLogMessage(wxT("Text %s in control \"%s\""), changeVerb, data); + wxLogMessage("Text %s in control \"%s\"", changeVerb, data); } else { @@ -1022,7 +1022,7 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event) (unsigned int) sel.length()); const wxString text = GetLineText(line); - wxLogMessage(wxT("Current line: \"%s\"; length = %lu"), + wxLogMessage("Current line: \"%s\"; length = %lu", text.c_str(), text.length()); } break; @@ -1212,7 +1212,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) "very very very long line to test " "wxHSCROLL style\n" "\nAnd here is a link in quotation marks to " - wxT("test wxTE_AUTO_URL: \"http://www.wxwidgets.org\""), + "test wxTE_AUTO_URL: \"http://www.wxwidgets.org\"", wxPoint(450, 10), wxSize(200, 230), wxTE_RICH | wxTE_MULTILINE | wxTE_AUTO_URL); m_textrich->SetStyle(0, 10, *wxRED); diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index 0b442bf8c3..ac7bc3daad 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -605,7 +605,7 @@ MyFrame::MyFrame(wxFrame* parent, toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN2, "Toggle &2nd radio button\tCtrl-2"); toolMenu->Append(IDM_TOOLBAR_TOGGLERADIOBTN3, "Toggle &3rd radio button\tCtrl-3"); toolMenu->AppendSeparator(); - toolMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, wxT("Change tooltip of \"New\"")); + toolMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tooltip of \"New\""); toolMenu->AppendSeparator(); toolMenu->Append(IDM_TOOLBAR_INC_TOOL_SPACING, "Increase spacing\tCtrl-+"); toolMenu->Append(IDM_TOOLBAR_DEC_TOOL_SPACING, "Decrease spacing\tCtrl--"); diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 4543073660..230a6da343 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -1298,12 +1298,12 @@ void MyTreeCtrl::DoResetBrokenStateImages(const wxTreeItemId& idParent, DoResetBrokenStateImages(idParent, cookie, state); } -void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event) +void MyTreeCtrl::LogEvent(const wxString& name, const wxTreeEvent& event) { wxTreeItemId item = event.GetItem(); wxString text; if ( item.IsOk() ) - text << wxT('"') << GetItemText(item).c_str() << wxT('"'); + text << '"' << GetItemText(item).c_str() << '"'; else text = "invalid item"; wxLogMessage("%s(%s)", name, text.c_str()); @@ -1313,7 +1313,7 @@ void MyTreeCtrl::LogEvent(const wxChar *name, const wxTreeEvent& event) #define TREE_EVENT_HANDLER(name) \ void MyTreeCtrl::name(wxTreeEvent& event) \ { \ - LogEvent(wxT(#name), event); \ + LogEvent(#name, event); \ event.Skip(); \ } @@ -1606,7 +1606,7 @@ void MyTreeCtrl::OnItemStateClick(wxTreeEvent& event) wxTreeItemId itemId = event.GetItem(); DoToggleState(itemId); - wxLogMessage(wxT("Item \"%s\" state changed to %d"), + wxLogMessage("Item \"%s\" state changed to %d", GetItemText(itemId), GetItemState(itemId)); } @@ -1619,8 +1619,8 @@ void MyTreeCtrl::OnItemMenu(wxTreeEvent& event) wxPoint clientpt = event.GetPoint(); wxPoint screenpt = ClientToScreen(clientpt); - wxLogMessage(wxT("OnItemMenu for item \"%s\" at screen coords (%i, %i)"), - item ? item->GetDesc() : wxString(wxS("unknown")), screenpt.x, screenpt.y); + wxLogMessage("OnItemMenu for item \"%s\" at screen coords (%i, %i)", + item ? item->GetDesc() : wxString("unknown"), screenpt.x, screenpt.y); ShowMenu(itemId, clientpt); event.Skip(); @@ -1665,7 +1665,7 @@ void MyTreeCtrl::OnItemRClick(wxTreeEvent& event) MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId); - wxLogMessage(wxT("Item \"%s\" right clicked"), item ? item->GetDesc() : wxString(wxS("unknown"))); + wxLogMessage("Item \"%s\" right clicked", item ? item->GetDesc() : wxString("unknown")); event.Skip(); } diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h index 971b745cc1..c615a483bc 100644 --- a/samples/treectrl/treetest.h +++ b/samples/treectrl/treetest.h @@ -147,7 +147,7 @@ private: void DoResetBrokenStateImages(const wxTreeItemId& idParent, wxTreeItemIdValue cookie, int state); - void LogEvent(const wxChar *name, const wxTreeEvent& event); + void LogEvent(const wxString& name, const wxTreeEvent& event); int m_imageSize; // current size of images bool m_reverseSort; // flag for OnCompareItems diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index a703c0ca89..42894c6fcf 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -1051,15 +1051,15 @@ void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) ) wxFont* sysFont = new wxFont(wxSystemSettings::GetFont(wxSYS_OEM_FIXED_FONT)); var1 = wxVariant(sysFont); - textCtrl << wxT("var1 = (wxfont)\""); + textCtrl << "var1 = (wxfont)\""; wxFont* font = wxGetVariantCast(var1,wxFont); if (font) { - textCtrl << font->GetNativeFontInfoDesc() << wxT("\"\n"); + textCtrl << font->GetNativeFontInfoDesc() << "\"\n"; } else { - textCtrl << wxT("(null)\"\n"); + textCtrl << "(null)\"\n"; } delete sysFont; diff --git a/samples/widgets/activityindicator.cpp b/samples/widgets/activityindicator.cpp index 78e43bf6c6..b0f2354cab 100644 --- a/samples/widgets/activityindicator.cpp +++ b/samples/widgets/activityindicator.cpp @@ -109,7 +109,7 @@ wxEND_EVENT_TABLE() // ============================================================================ IMPLEMENT_WIDGETS_PAGE(ActivityIndicatorWidgetsPage, - wxT("ActivityIndicator"), NATIVE_CTRLS); + "ActivityIndicator", NATIVE_CTRLS); void ActivityIndicatorWidgetsPage::CreateContent() { diff --git a/samples/widgets/bmpcombobox.cpp b/samples/widgets/bmpcombobox.cpp index f73feb8978..8d33ca70ac 100644 --- a/samples/widgets/bmpcombobox.cpp +++ b/samples/widgets/bmpcombobox.cpp @@ -242,7 +242,7 @@ wxEND_EVENT_TABLE() #define NATIVE_OR_GENERIC_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(BitmapComboBoxWidgetsPage, wxT("BitmapCombobox"), +IMPLEMENT_WIDGETS_PAGE(BitmapComboBoxWidgetsPage, "BitmapCombobox", NATIVE_OR_GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS ); @@ -298,39 +298,39 @@ void BitmapComboBoxWidgetsPage::CreateContent() wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL); // left pane - style box - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); // should be in sync with ComboKind_XXX values static const wxString kinds[] = { - wxT("default"), - wxT("simple"), - wxT("drop down"), + "default", + "simple", + "drop down", }; - m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Combobox &kind:"), + m_radioKind = new wxRadioBox(this, wxID_ANY, "Combobox &kind:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1, wxRA_SPECIFY_COLS); wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Sort items")); - m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Read only")); + m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items"); + m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only"); - wxButton *btn = new wxButton(this, BitmapComboBoxPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, BitmapComboBoxPage_Reset, "&Reset"); sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3); sizerLeft->Add(sizerStyle, wxSizerFlags().Expand()); sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); // left pane - other options box - box = new wxStaticBox(this, wxID_ANY, wxT("Demo options")); + box = new wxStaticBox(this, wxID_ANY, "Demo options"); wxSizer *sizerOptions = new wxStaticBoxSizer(box, wxVERTICAL); - sizerRow = CreateSizerWithSmallTextAndLabel(wxT("Control &height:"), + sizerRow = CreateSizerWithSmallTextAndLabel("Control &height:", BitmapComboBoxPage_ChangeHeight, &m_textChangeHeight); m_textChangeHeight->SetSize(20, wxDefaultCoord); @@ -340,42 +340,42 @@ void BitmapComboBoxWidgetsPage::CreateContent() // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change wxBitmapComboBox contents")); + "&Change wxBitmapComboBox contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); - btn = new wxButton(this, BitmapComboBoxPage_ContainerTests, wxT("Run &tests")); + btn = new wxButton(this, BitmapComboBoxPage_ContainerTests, "Run &tests"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); #if wxUSE_IMAGE - btn = new wxButton(this, BitmapComboBoxPage_AddWidgetIcons, wxT("Add &widget icons")); + btn = new wxButton(this, BitmapComboBoxPage_AddWidgetIcons, "Add &widget icons"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_LoadFromFile, wxT("Insert image from &file")); + btn = new wxButton(this, BitmapComboBoxPage_LoadFromFile, "Insert image from &file"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_SetFromFile, wxT("&Set image from file")); + btn = new wxButton(this, BitmapComboBoxPage_SetFromFile, "&Set image from file"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); #endif - btn = new wxButton(this, BitmapComboBoxPage_AddSeveralWithImages, wxT("A&ppend a few strings with images")); + btn = new wxButton(this, BitmapComboBoxPage_AddSeveralWithImages, "A&ppend a few strings with images"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_AddSeveral, wxT("Append a &few strings")); + btn = new wxButton(this, BitmapComboBoxPage_AddSeveral, "Append a &few strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_AddMany, wxT("Append &many strings")); + btn = new wxButton(this, BitmapComboBoxPage_AddMany, "Append &many strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(BitmapComboBoxPage_Delete, - wxT("&Delete this item"), + "&Delete this item", BitmapComboBoxPage_DeleteText, &m_textDelete); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_DeleteSel, wxT("Delete &selection")); + btn = new wxButton(this, BitmapComboBoxPage_DeleteSel, "Delete &selection"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BitmapComboBoxPage_Clear, wxT("&Clear")); + btn = new wxButton(this, BitmapComboBoxPage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); #if wxUSE_IMAGE @@ -432,7 +432,7 @@ void BitmapComboBoxWidgetsPage::CreateCombo() switch ( m_radioKind->GetSelection() ) { default: - wxFAIL_MSG( wxT("unknown combo kind") ); + wxFAIL_MSG( "unknown combo kind" ); // fall through case ComboKind_Default: @@ -512,7 +512,7 @@ void BitmapComboBoxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event)) #ifndef __WXGTK__ m_combobox->SetString(sel, m_textChange->GetValue()); #else - wxLogMessage(wxT("Not implemented in wxGTK")); + wxLogMessage("Not implemented in wxGTK"); #endif } } @@ -551,7 +551,7 @@ void BitmapComboBoxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event)) if ( !m_textInsert->IsModified() ) { // update the default string - m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textInsert->SetValue(wxString::Format("test item %u", ++s_item)); } int sel = m_combobox->GetSelection(); @@ -595,15 +595,15 @@ void BitmapComboBoxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) // "many" means 1000 here for ( unsigned int n = 0; n < 1000; n++ ) { - m_combobox->Append(wxString::Format(wxT("item #%u"), n)); + m_combobox->Append(wxString::Format("item #%u", n)); } } void BitmapComboBoxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) { - m_combobox->Append(wxT("First")); - m_combobox->Append(wxT("another one")); - m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); + m_combobox->Append("First"); + m_combobox->Append("another one"); + m_combobox->Append("and the last (very very very very very very very very very very long) one"); } void BitmapComboBoxWidgetsPage::OnButtonAddSeveralWithImages(wxCommandEvent& WXUNUSED(event)) @@ -640,10 +640,10 @@ void BitmapComboBoxWidgetsPage::RescaleImage(wxImage& image, int w, int h) if ( isFirstScale && m_combobox->GetCount() > 0 ) { - wxMessageBox( wxT("wxBitmapComboBox normally only supports images of one size. ") - wxT("However, for demonstration purposes, loaded bitmaps are scaled to fit ") - wxT("using wxImage::Rescale."), - wxT("Notice"), + wxMessageBox( "wxBitmapComboBox normally only supports images of one size. " + "However, for demonstration purposes, loaded bitmaps are scaled to fit " + "using wxImage::Rescale.", + "Notice", wxOK, this ); @@ -658,32 +658,32 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag { wxFileName fn; fn.AssignCwd(); - fn.AppendDir(wxT("icons")); + fn.AppendDir("icons"); wxSetCursor(*wxHOURGLASS_CURSOR); if ( !wxDir::Exists(fn.GetFullPath()) || - !wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) + !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") ) { // Try ../../samples/widgets/icons fn.RemoveLastDir(); fn.RemoveLastDir(); - fn.AppendDir(wxT("icons")); + fn.AppendDir("icons"); if ( !wxDir::Exists(fn.GetFullPath()) || - !wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) + !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") ) { // Try ../../../samples/widgets/icons fn.AssignCwd(); fn.RemoveLastDir(); fn.RemoveLastDir(); fn.RemoveLastDir(); - fn.AppendDir(wxT("samples")); - fn.AppendDir(wxT("widgets")); - fn.AppendDir(wxT("icons")); + fn.AppendDir("samples"); + fn.AppendDir("widgets"); + fn.AppendDir("icons"); if ( !wxDir::Exists(fn.GetFullPath()) || - !wxDir::GetAllFiles(fn.GetFullPath(),strings,wxT("*.xpm")) ) + !wxDir::GetAllFiles(fn.GetFullPath(),strings,"*.xpm") ) { - wxLogWarning(wxT("Could not load widget icons.")); + wxLogWarning("Could not load widget icons."); wxSetCursor(*wxSTANDARD_CURSOR); return; } @@ -703,7 +703,7 @@ void BitmapComboBoxWidgetsPage::LoadWidgetImages( wxArrayString* strings, wxImag wxString name = fn.GetName(); // Handle few exceptions - if ( name == wxT("bmpbtn") ) + if ( name == "bmpbtn" ) { strings->RemoveAt(i); i--; @@ -802,26 +802,26 @@ void BitmapComboBoxWidgetsPage::OnComboText(wxCommandEvent& event) wxString s = event.GetString(); wxASSERT_MSG( s == m_combobox->GetValue(), - wxT("event and combobox values should be the same") ); + "event and combobox values should be the same" ); if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage(wxT("BitmapCombobox enter pressed (now '%s')"), s.c_str()); + wxLogMessage("BitmapCombobox enter pressed (now '%s')", s.c_str()); } else { - wxLogMessage(wxT("BitmapCombobox text changed (now '%s')"), s.c_str()); + wxLogMessage("BitmapCombobox text changed (now '%s')", s.c_str()); } } void BitmapComboBoxWidgetsPage::OnComboBox(wxCommandEvent& event) { long sel = event.GetInt(); - m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); + m_textDelete->SetValue(wxString::Format("%ld", sel)); - wxLogMessage(wxT("BitmapCombobox item %ld selected"), sel); + wxLogMessage("BitmapCombobox item %ld selected", sel); - wxLogMessage(wxT("BitmapCombobox GetValue(): %s"), m_combobox->GetValue().c_str() ); + wxLogMessage("BitmapCombobox GetValue(): %s", m_combobox->GetValue().c_str() ); } void BitmapComboBoxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) @@ -876,7 +876,7 @@ wxBitmap BitmapComboBoxWidgetsPage::LoadBitmap(const wxString& WXUNUSED(filepath wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr) { - wxString filepath = wxLoadFileSelector(wxT("image"), + wxString filepath = wxLoadFileSelector("image", wxEmptyString, wxEmptyString, this); @@ -897,7 +897,7 @@ wxBitmap BitmapComboBoxWidgetsPage::QueryBitmap(wxString* pStr) if (bitmap.IsOk()) { - wxLogDebug(wxT("%i, %i"),bitmap.GetWidth(), bitmap.GetHeight()); + wxLogDebug("%i, %i",bitmap.GetWidth(), bitmap.GetHeight()); } ::wxSetCursor( *wxSTANDARD_CURSOR ); @@ -936,12 +936,12 @@ wxBitmap BitmapComboBoxWidgetsPage::CreateBitmap(const wxColour& colour) void BitmapComboBoxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox dropped down")); + wxLogMessage("Combobox dropped down"); } void BitmapComboBoxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox closed up")); + wxLogMessage("Combobox closed up"); } #endif // wxUSE_BITMAPCOMBOBOX diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 54bb5db6e5..1275372a6d 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -197,7 +197,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, wxT("Button"), FAMILY_CTRLS ); +IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, "Button", FAMILY_CTRLS ); ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) @@ -236,21 +236,21 @@ void ButtonWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only"); m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap"); - m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Fit exactly")); - m_chkAuthNeeded = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Require a&uth")); + m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly"); + m_chkAuthNeeded = CreateCheckBoxAndAddToSizer(sizerLeft, "Require a&uth"); #if wxUSE_COMMANDLINKBUTTON - m_chkCommandLink = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Use command &link button")); + m_chkCommandLink = CreateCheckBoxAndAddToSizer(sizerLeft, "Use command &link button"); #endif #if wxUSE_MARKUP m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup"); #endif // wxUSE_MARKUP - m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Default")); + m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, "&Default"); m_chkUseBitmapClass = CreateCheckBoxAndAddToSizer(sizerLeft, "Use wxBitmapButton"); @@ -286,22 +286,22 @@ void ButtonWidgetsPage::CreateContent() // should be in sync with enums Button[HV]Align! static const wxString halign[] = { - wxT("left"), - wxT("centre"), - wxT("right"), + "left", + "centre", + "right", }; static const wxString valign[] = { - wxT("top"), - wxT("centre"), - wxT("bottom"), + "top", + "centre", + "bottom", }; - m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign); - m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign); @@ -310,26 +310,26 @@ void ButtonWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - wxButton *btn = new wxButton(this, ButtonPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, ButtonPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel, - wxT("Change label"), + "Change label", wxID_ANY, &m_textLabel); - m_textLabel->SetValue(wxT("&Press me!")); + m_textLabel->SetValue("&Press me!"); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); #if wxUSE_COMMANDLINKBUTTON m_sizerNote = CreateSizerWithTextAndButton(ButtonPage_ChangeNote, - wxT("Change note"), + "Change note", wxID_ANY, &m_textNote); - m_textNote->SetValue(wxT("Writes down button clicks in the log.")); + m_textNote->SetValue("Writes down button clicks in the log."); sizerMiddle->Add(m_sizerNote, 0, wxALL | wxGROW, 5); #endif @@ -415,7 +415,7 @@ void ButtonWidgetsPage::CreateButton() break; default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case ButtonHAlign_Centre: @@ -433,7 +433,7 @@ void ButtonWidgetsPage::CreateButton() break; default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case ButtonVAlign_Centre: @@ -456,22 +456,22 @@ void ButtonWidgetsPage::CreateButton() if ( m_chkUseBitmapClass->GetValue() ) { bbtn = new wxBitmapButton(this, ButtonPage_Button, - CreateBitmap(wxT("normal")), + CreateBitmap("normal"), wxDefaultPosition, wxDefaultSize, flags); } else { bbtn = new wxButton(this, ButtonPage_Button); - bbtn->SetBitmapLabel(CreateBitmap(wxT("normal"))); + bbtn->SetBitmapLabel(CreateBitmap("normal")); } if ( m_chkUsePressed->GetValue() ) - bbtn->SetBitmapPressed(CreateBitmap(wxT("pushed"))); + bbtn->SetBitmapPressed(CreateBitmap("pushed")); if ( m_chkUseFocused->GetValue() ) - bbtn->SetBitmapFocus(CreateBitmap(wxT("focused"))); + bbtn->SetBitmapFocus(CreateBitmap("focused")); if ( m_chkUseCurrent->GetValue() ) - bbtn->SetBitmapCurrent(CreateBitmap(wxT("hover"))); + bbtn->SetBitmapCurrent(CreateBitmap("hover")); if ( m_chkUseDisabled->GetValue() ) - bbtn->SetBitmapDisabled(CreateBitmap(wxT("disabled"))); + bbtn->SetBitmapDisabled(CreateBitmap("disabled")); m_button = bbtn; #if wxUSE_COMMANDLINKBUTTON m_cmdLnkButton = NULL; @@ -611,7 +611,7 @@ void ButtonWidgetsPage::OnButtonChangeNote(wxCommandEvent& WXUNUSED(event)) void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Test button clicked.")); + wxLogMessage("Test button clicked."); } // ---------------------------------------------------------------------------- @@ -626,8 +626,8 @@ wxBitmap ButtonWidgetsPage::CreateBitmap(const wxString& label) dc.SetBackground(*wxCYAN_BRUSH); dc.Clear(); dc.SetTextForeground(*wxBLACK); - dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") - wxT("(") + label + wxT(" state)"), + dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n" + "(" + label + " state)", wxArtProvider::GetBitmap(wxART_INFORMATION), wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20), wxALIGN_CENTRE); diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index 09b21b6238..09893f3029 100644 --- a/samples/widgets/checkbox.cpp +++ b/samples/widgets/checkbox.cpp @@ -155,7 +155,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS ); +IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, "CheckBox", FAMILY_CTRLS ); CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) @@ -168,14 +168,14 @@ void CheckBoxWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); m_chkRight = CreateCheckBoxAndAddToSizer ( sizerLeft, - wxT("&Right aligned"), + "&Right aligned", CheckboxPage_ChkRight ); @@ -183,39 +183,39 @@ void CheckBoxWidgetsPage::CreateContent() static const wxString kinds[] = { - wxT("usual &2-state checkbox"), - wxT("&3rd state settable by program"), - wxT("&user-settable 3rd state"), + "usual &2-state checkbox", + "&3rd state settable by program", + "&user-settable 3rd state", }; - m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("&Kind"), + m_radioKind = new wxRadioBox(this, wxID_ANY, "&Kind", wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1); sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); - wxButton *btn = new wxButton(this, CheckboxPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, CheckboxPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); sizerMiddle->Add(CreateSizerWithTextAndButton(CheckboxPage_ChangeLabel, - wxT("Change label"), + "Change label", wxID_ANY, &m_textLabel), 0, wxALL | wxGROW, 5); - sizerMiddle->Add(new wxButton(this, CheckboxPage_Check, wxT("&Check it")), + sizerMiddle->Add(new wxButton(this, CheckboxPage_Check, "&Check it"), 0, wxALL | wxGROW, 5); - sizerMiddle->Add(new wxButton(this, CheckboxPage_Uncheck, wxT("&Uncheck it")), + sizerMiddle->Add(new wxButton(this, CheckboxPage_Uncheck, "&Uncheck it"), 0, wxALL | wxGROW, 5); sizerMiddle->Add(new wxButton(this, CheckboxPage_PartCheck, - wxT("Put in &3rd state")), + "Put in &3rd state"), 0, wxALL | wxGROW, 5); // right pane wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL); - m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, wxT("&Check me!")); + m_checkbox = new wxCheckBox(this, CheckboxPage_Checkbox, "&Check me!"); sizerRight->Add(0, 0, 1, wxCENTRE); sizerRight->Add(m_checkbox, 1, wxCENTRE); sizerRight->Add(0, 0, 1, wxCENTRE); @@ -258,7 +258,7 @@ void CheckBoxWidgetsPage::CreateCheckbox() switch ( m_radioKind->GetSelection() ) { default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case CheckboxKind_2State: @@ -307,8 +307,8 @@ void CheckBoxWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event)) void CheckBoxWidgetsPage::OnCheckBox(wxCommandEvent& event) { - wxLogMessage(wxT("Test checkbox %schecked (value = %d)."), - event.IsChecked() ? wxT("") : wxT("un"), + wxLogMessage("Test checkbox %schecked (value = %d).", + event.IsChecked() ? "" : "un", (int)m_checkbox->Get3StateValue()); } diff --git a/samples/widgets/choice.cpp b/samples/widgets/choice.cpp index 32153588fd..04005a1749 100644 --- a/samples/widgets/choice.cpp +++ b/samples/widgets/choice.cpp @@ -178,7 +178,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ChoiceWidgetsPage, wxT("Choice"), +IMPLEMENT_WIDGETS_PAGE(ChoiceWidgetsPage, "Choice", FAMILY_CTRLS | WITH_ITEMS_CTRLS ); @@ -207,53 +207,53 @@ void ChoiceWidgetsPage::CreateContent() // left pane wxStaticBox *box = new wxStaticBox(this, wxID_ANY, - wxT("&Set choice parameters")); + "&Set choice parameters"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Sort items")); + m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items"); - wxButton *btn = new wxButton(this, ChoicePage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, ChoicePage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change choice contents")); + "&Change choice contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ChoicePage_Add, wxT("&Add this string")); - m_textAdd = new wxTextCtrl(this, ChoicePage_AddText, wxT("test item 0")); + btn = new wxButton(this, ChoicePage_Add, "&Add this string"); + m_textAdd = new wxTextCtrl(this, ChoicePage_AddText, "test item 0"); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textAdd, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ChoicePage_AddSeveral, wxT("&Insert a few strings")); + btn = new wxButton(this, ChoicePage_AddSeveral, "&Insert a few strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ChoicePage_AddMany, wxT("Add &many strings")); + btn = new wxButton(this, ChoicePage_AddMany, "Add &many strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ChoicePage_Change, wxT("C&hange current")); + btn = new wxButton(this, ChoicePage_Change, "C&hange current"); m_textChange = new wxTextCtrl(this, ChoicePage_ChangeText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ChoicePage_Delete, wxT("&Delete this item")); + btn = new wxButton(this, ChoicePage_Delete, "&Delete this item"); m_textDelete = new wxTextCtrl(this, ChoicePage_DeleteText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ChoicePage_DeleteSel, wxT("Delete &selection")); + btn = new wxButton(this, ChoicePage_DeleteSel, "Delete &selection"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ChoicePage_Clear, wxT("&Clear")); + btn = new wxButton(this, ChoicePage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ChoicePage_ContainerTests, wxT("Run &tests")); + btn = new wxButton(this, ChoicePage_ContainerTests, "Run &tests"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); // right pane @@ -367,7 +367,7 @@ void ChoiceWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event)) if ( !m_textAdd->IsModified() ) { // update the default string - m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textAdd->SetValue(wxString::Format("test item %u", ++s_item)); } m_choice->Append(s); @@ -379,7 +379,7 @@ void ChoiceWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) wxArrayString strings; for ( unsigned int n = 0; n < 1000; n++ ) { - strings.Add(wxString::Format(wxT("item #%u"), n)); + strings.Add(wxString::Format("item #%u", n)); } m_choice->Append(strings); } @@ -387,9 +387,9 @@ void ChoiceWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) void ChoiceWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) { wxArrayString items; - items.Add(wxT("First")); - items.Add(wxT("another one")); - items.Add(wxT("and the last (very very very very very very very very very very long) one")); + items.Add("First"); + items.Add("another one"); + items.Add("and the last (very very very very very very very very very very long) one"); m_choice->Insert(items, 0); } @@ -424,9 +424,9 @@ void ChoiceWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event) void ChoiceWidgetsPage::OnChoice(wxCommandEvent& event) { long sel = event.GetSelection(); - m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); + m_textDelete->SetValue(wxString::Format("%ld", sel)); - wxLogMessage(wxT("Choice item %ld selected"), sel); + wxLogMessage("Choice item %ld selected", sel); } void ChoiceWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/widgets/clrpicker.cpp b/samples/widgets/clrpicker.cpp index 1c428a0db4..132c3b339c 100644 --- a/samples/widgets/clrpicker.cpp +++ b/samples/widgets/clrpicker.cpp @@ -125,7 +125,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ColourPickerWidgetsPage, wxT("ColourPicker"), +IMPLEMENT_WIDGETS_PAGE(ColourPickerWidgetsPage, "ColourPicker", PICKER_CTRLS | FAMILY_CTRLS); ColourPickerWidgetsPage::ColourPickerWidgetsPage(WidgetsBookCtrl *book, @@ -139,13 +139,13 @@ void ColourPickerWidgetsPage::CreateContent() // left pane wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&ColourPicker style")); - m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, wxT("With textctrl")); - m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, wxT("With label")); - m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, wxT("With opacity")); + wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, "&ColourPicker style"); + m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, "With textctrl"); + m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, "With label"); + m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, "With opacity"); boxleft->Add(clrbox, 0, wxALL|wxGROW, 5); - boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), + boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"), 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); Reset(); // set checkboxes state @@ -217,7 +217,7 @@ void ColourPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event) { - wxLogMessage(wxT("The colour changed to '%s' !"), + wxLogMessage("The colour changed to '%s' !", event.GetColour().GetAsString(wxC2S_CSS_SYNTAX).c_str()); } diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index e0f0312334..f978711047 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -234,7 +234,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, wxT("Combobox"), +IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, "Combobox", FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS ); @@ -266,26 +266,26 @@ void ComboboxWidgetsPage::CreateContent() // should be in sync with ComboKind_XXX values static const wxString kinds[] = { - wxT("default"), - wxT("simple"), - wxT("drop down"), + "default", + "simple", + "drop down", }; - m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Combobox &kind:"), + m_radioKind = new wxRadioBox(this, wxID_ANY, "Combobox &kind:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1, wxRA_SPECIFY_COLS); wxSizer *sizerLeftTop = new wxStaticBoxSizer(wxVERTICAL, this, "&Set style"); - m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("&Sort items")); - m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("&Read only")); - m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftTop, wxT("Process &Enter")); + m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Sort items"); + m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeftTop, "&Read only"); + m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeftTop, "Process &Enter"); sizerLeftTop->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeftTop->Add(m_radioKind, 0, wxGROW | wxALL, 5); - wxButton *btn = new wxButton(this, ComboPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, ComboPage_Reset, "&Reset"); sizerLeftTop->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // lower left pane @@ -303,20 +303,20 @@ void ComboboxWidgetsPage::CreateContent() // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change combobox contents")); + "&Change combobox contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow; sizerRow = CreateSizerWithTextAndButton(ComboPage_SetCurrent, - wxT("Current &selection"), + "Current &selection", ComboPage_CurText, &m_textCur); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); wxTextCtrl *text; - sizerRow = CreateSizerWithTextAndLabel(wxT("Insertion Point"), + sizerRow = CreateSizerWithTextAndLabel("Insertion Point", ComboPage_InsertionPointText, &text); text->SetEditable(false); @@ -324,54 +324,54 @@ void ComboboxWidgetsPage::CreateContent() sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_Insert, - wxT("&Insert this string"), + "&Insert this string", ComboPage_InsertText, &m_textInsert); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_Add, - wxT("&Add this string"), + "&Add this string", ComboPage_AddText, &m_textAdd); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_SetFirst, - wxT("Change &1st string"), + "Change &1st string", ComboPage_SetFirstText, &m_textSetFirst); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ComboPage_AddSeveral, wxT("&Append a few strings")); + btn = new wxButton(this, ComboPage_AddSeveral, "&Append a few strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ComboPage_AddMany, wxT("Append &many strings")); + btn = new wxButton(this, ComboPage_AddMany, "Append &many strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_Change, - wxT("C&hange current"), + "C&hange current", ComboPage_ChangeText, &m_textChange); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_Delete, - wxT("&Delete this item"), + "&Delete this item", ComboPage_DeleteText, &m_textDelete); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ComboPage_DeleteSel, wxT("Delete &selection")); + btn = new wxButton(this, ComboPage_DeleteSel, "Delete &selection"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ComboPage_Clear, wxT("&Clear")); + btn = new wxButton(this, ComboPage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ComboPage_SetValue, - wxT("SetValue"), + "SetValue", ComboPage_SetValueText, &m_textSetValue); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ComboPage_ContainerTests, wxT("Run &tests")); + btn = new wxButton(this, ComboPage_ContainerTests, "Run &tests"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); @@ -430,7 +430,7 @@ void ComboboxWidgetsPage::CreateCombo() switch ( m_radioKind->GetSelection() ) { default: - wxFAIL_MSG( wxT("unknown combo kind") ); + wxFAIL_MSG( "unknown combo kind" ); // fall through case ComboKind_Default: @@ -533,7 +533,7 @@ void ComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event)) if ( !m_textInsert->IsModified() ) { // update the default string - m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textInsert->SetValue(wxString::Format("test item %u", ++s_item)); } if (m_combobox->GetSelection() >= 0) @@ -548,7 +548,7 @@ void ComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event)) if ( !m_textAdd->IsModified() ) { // update the default string - m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textAdd->SetValue(wxString::Format("test item %u", ++s_item)); } m_combobox->Append(s); @@ -570,7 +570,7 @@ void ComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) // "many" means 1000 here for ( unsigned int n = 0; n < 1000; n++ ) { - m_combobox->Append(wxString::Format(wxT("item #%u"), n)); + m_combobox->Append(wxString::Format("item #%u", n)); } } @@ -585,15 +585,15 @@ void ComboboxWidgetsPage::OnButtonSetCurrent(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) { - m_combobox->Append(wxT("First")); - m_combobox->Append(wxT("another one")); - m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); + m_combobox->Append("First"); + m_combobox->Append("another one"); + m_combobox->Append("and the last (very very very very very very very very very very long) one"); } void ComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event) { if (m_combobox) - event.SetText( wxString::Format(wxT("%ld"), m_combobox->GetInsertionPoint()) ); + event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) ); } void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event) @@ -658,15 +658,15 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event) wxString s = event.GetString(); wxASSERT_MSG( s == m_combobox->GetValue(), - wxT("event and combobox values should be the same") ); + "event and combobox values should be the same" ); if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage(wxT("Combobox enter pressed (now '%s')"), s.c_str()); + wxLogMessage("Combobox enter pressed (now '%s')", s.c_str()); } else { - wxLogMessage(wxT("Combobox text changed (now '%s')"), s.c_str()); + wxLogMessage("Combobox text changed (now '%s')", s.c_str()); } } @@ -679,13 +679,13 @@ void ComboboxWidgetsPage::OnComboTextPasted(wxClipboardTextEvent& event) void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) { long sel = event.GetInt(); - const wxString selstr = wxString::Format(wxT("%ld"), sel); + const wxString selstr = wxString::Format("%ld", sel); m_textDelete->SetValue(selstr); m_textCur->SetValue(selstr); - wxLogMessage(wxT("Combobox item %ld selected"), sel); + wxLogMessage("Combobox item %ld selected", sel); - wxLogMessage(wxT("Combobox GetValue(): %s"), m_combobox->GetValue().c_str() ); + wxLogMessage("Combobox GetValue(): %s", m_combobox->GetValue().c_str() ); if ( event.GetString() != m_combobox->GetValue() ) { @@ -701,12 +701,12 @@ void ComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnDropdown(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox dropped down")); + wxLogMessage("Combobox dropped down"); } void ComboboxWidgetsPage::OnCloseup(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox closed up")); + wxLogMessage("Combobox closed up"); } void ComboboxWidgetsPage::OnPopup(wxCommandEvent &WXUNUSED(event)) diff --git a/samples/widgets/datepick.cpp b/samples/widgets/datepick.cpp index 88dd3c8bea..9815f40919 100644 --- a/samples/widgets/datepick.cpp +++ b/samples/widgets/datepick.cpp @@ -134,7 +134,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"), +IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, "DatePicker", FAMILY_CTRLS | PICKER_CTRLS ); diff --git a/samples/widgets/dirctrl.cpp b/samples/widgets/dirctrl.cpp index 5944a62ff0..7a2c60f717 100644 --- a/samples/widgets/dirctrl.cpp +++ b/samples/widgets/dirctrl.cpp @@ -61,16 +61,16 @@ enum static const wxString stdPaths[] = { - wxT("&none"), - wxT("&config"), - wxT("&data"), - wxT("&documents"), - wxT("&local data"), - wxT("&plugins"), - wxT("&resources"), - wxT("&user config"), - wxT("&user data"), - wxT("&user local data") + "&none", + "&config", + "&data", + "&documents", + "&local data", + "&plugins", + "&resources", + "&user config", + "&user data", + "&user local data" }; enum @@ -164,7 +164,7 @@ wxEND_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(DirCtrlWidgetsPage, wxT("DirCtrl"), +IMPLEMENT_WIDGETS_PAGE(DirCtrlWidgetsPage, "DirCtrl", GENERIC_CTRLS ); @@ -180,39 +180,39 @@ void DirCtrlWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Dir control details")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Dir control details"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - sizerLeft->Add( CreateSizerWithTextAndButton( DirCtrlPage_SetPath , wxT("Set &path"), wxID_ANY, &m_path ), + sizerLeft->Add( CreateSizerWithTextAndButton( DirCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path ), 0, wxALL | wxALIGN_RIGHT , 5 ); wxSizer *sizerUseFlags = - new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Flags")); - m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_DIR_ONLY")); - m_chk3D = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_3D_INTERNAL")); - m_chkFirst = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_SELECT_FIRST")); - m_chkFilters = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_SHOW_FILTERS")); - m_chkLabels = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_EDIT_LABELS")); - m_chkMulti = CreateCheckBoxAndAddToSizer(sizerUseFlags, wxT("wxDIRCTRL_MULTIPLE")); + new wxStaticBoxSizer(wxVERTICAL, this, "&Flags"); + m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_DIR_ONLY"); + m_chk3D = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_3D_INTERNAL"); + m_chkFirst = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_SELECT_FIRST"); + m_chkFilters = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_SHOW_FILTERS"); + m_chkLabels = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_EDIT_LABELS"); + m_chkMulti = CreateCheckBoxAndAddToSizer(sizerUseFlags, "wxDIRCTRL_MULTIPLE"); sizerLeft->Add(sizerUseFlags, wxSizerFlags().Expand().Border()); wxSizer *sizerFilters = - new wxStaticBoxSizer(wxVERTICAL, this, wxT("&Filters")); - m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format(wxT("all files (%s)|%s"), + new wxStaticBoxSizer(wxVERTICAL, this, "&Filters"); + m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format("all files (%s)|%s", wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr)); - m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("C++ files (*.cpp; *.h)|*.cpp;*.h")); - m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("PNG images (*.png)|*.png")); + m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h"); + m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, "PNG images (*.png)|*.png"); sizerLeft->Add(sizerFilters, wxSizerFlags().Expand().Border()); - wxButton *btn = new wxButton(this, DirCtrlPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, DirCtrlPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // keep consistency between enum and labels of radiobox wxCOMPILE_TIME_ASSERT( stdPathMax == WXSIZEOF(stdPaths), EnumForRadioBoxMismatch); // middle pane - m_radioStdPath = new wxRadioBox(this, wxID_ANY, wxT("Standard path"), + m_radioStdPath = new wxRadioBox(this, wxID_ANY, "Standard path", wxDefaultPosition, wxDefaultSize, WXSIZEOF(stdPaths), stdPaths, 1); @@ -275,7 +275,7 @@ void DirCtrlWidgetsPage::CreateDirCtrl() if (m_fltr[i]->IsChecked()) { if (!filter.IsEmpty()) - filter += wxT("|"); + filter += "|"; filter += m_fltr[i]->GetLabel(); } } @@ -317,7 +317,7 @@ void DirCtrlWidgetsPage::OnRadioBox(wxCommandEvent& WXUNUSED(event)) { wxString path; - wxTheApp->SetAppName(wxT("widgets")); + wxTheApp->SetAppName("widgets"); wxStandardPathsBase& stdp = wxStandardPaths::Get(); switch ( m_radioStdPath->GetSelection() ) diff --git a/samples/widgets/dirpicker.cpp b/samples/widgets/dirpicker.cpp index 003f3b51ad..84f71fc064 100644 --- a/samples/widgets/dirpicker.cpp +++ b/samples/widgets/dirpicker.cpp @@ -133,7 +133,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(DirPickerWidgetsPage, wxT("DirPicker"), +IMPLEMENT_WIDGETS_PAGE(DirPickerWidgetsPage, "DirPicker", PICKER_CTRLS | FAMILY_CTRLS); DirPickerWidgetsPage::DirPickerWidgetsPage(WidgetsBookCtrl *book, @@ -147,10 +147,10 @@ void DirPickerWidgetsPage::CreateContent() // left pane wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer *dirbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&DirPicker style")); - m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, wxT("With textctrl")); - m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, wxT("Dir must exist")); - m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, wxT("Change working dir")); + wxStaticBoxSizer *dirbox = new wxStaticBoxSizer(wxVERTICAL, this, "&DirPicker style"); + m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, "With textctrl"); + m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, "Dir must exist"); + m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, "Change working dir"); m_chkSmall = CreateCheckBoxAndAddToSizer(dirbox, "&Small version"); boxleft->Add(dirbox, 0, wxALL|wxGROW, 5); @@ -164,7 +164,7 @@ void DirPickerWidgetsPage::CreateContent() boxleft->AddSpacer(10); - boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), + boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"), 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); Reset(); // set checkboxes state @@ -206,7 +206,7 @@ void DirPickerWidgetsPage::CreatePicker() style |= wxDIRP_SMALL; m_dirPicker = new wxDirPickerCtrl(this, PickerPage_Dir, - wxGetHomeDir(), wxT("Hello!"), + wxGetHomeDir(), "Hello!", wxDefaultPosition, wxDefaultSize, style); } @@ -246,7 +246,7 @@ void DirPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void DirPickerWidgetsPage::OnDirChange(wxFileDirPickerEvent& event) { - wxLogMessage(wxT("The directory changed to '%s' ! The current working directory is '%s'"), + wxLogMessage("The directory changed to '%s' ! The current working directory is '%s'", event.GetPath().c_str(), wxGetCwd().c_str()); } diff --git a/samples/widgets/editlbox.cpp b/samples/widgets/editlbox.cpp index 383fb981aa..bcd45d9eaf 100644 --- a/samples/widgets/editlbox.cpp +++ b/samples/widgets/editlbox.cpp @@ -115,7 +115,7 @@ wxEND_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(EditableListboxWidgetsPage, wxT("EditableListbox"), GENERIC_CTRLS); +IMPLEMENT_WIDGETS_PAGE(EditableListboxWidgetsPage, "EditableListbox", GENERIC_CTRLS); EditableListboxWidgetsPage::EditableListboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) @@ -134,15 +134,15 @@ void EditableListboxWidgetsPage::CreateContent() // left pane wxStaticBox *box = new wxStaticBox(this, wxID_ANY, - wxT("&Set listbox parameters")); + "&Set listbox parameters"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow new items")); - m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow editing items")); - m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Allow deleting items")); - m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Block user reordering")); + m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow new items"); + m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow editing items"); + m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow deleting items"); + m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, "Block user reordering"); - wxButton *btn = new wxButton(this, EditableListboxPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, EditableListboxPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // right pane diff --git a/samples/widgets/filectrl.cpp b/samples/widgets/filectrl.cpp index 9790fd78dd..1ec56bd8ff 100644 --- a/samples/widgets/filectrl.cpp +++ b/samples/widgets/filectrl.cpp @@ -145,7 +145,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, wxT( "FileCtrl" ), +IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, "FileCtrl", FAMILY_CTRLS ); FileCtrlWidgetsPage::FileCtrlWidgetsPage( WidgetsBookCtrl *book, @@ -161,37 +161,37 @@ void FileCtrlWidgetsPage::CreateContent() // left pane wxSizer *sizerLeft = new wxBoxSizer( wxVERTICAL ); - static const wxString mode[] = { wxT( "open" ), wxT( "save" ) }; - m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, wxT( "wxFileCtrl mode" ), + static const wxString mode[] = { "open", "save" }; + m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, "wxFileCtrl mode", wxDefaultPosition, wxDefaultSize, WXSIZEOF( mode ), mode ); sizerLeft->Add( m_radioFileCtrlMode, 0, wxALL | wxEXPAND , 5 ); - sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , wxT( "Set &directory" ), wxID_ANY, &m_dir ), + sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , "Set &directory", wxID_ANY, &m_dir ), 0, wxALL | wxEXPAND , 5 ); - sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , wxT( "Set &path" ), wxID_ANY, &m_path ), + sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , "Set &path", wxID_ANY, &m_path ), 0, wxALL | wxEXPAND , 5 ); - sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , wxT( "Set &filename" ), wxID_ANY, &m_filename ), + sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , "Set &filename", wxID_ANY, &m_filename ), 0, wxALL | wxEXPAND , 5 ); wxSizer *sizerUseFlags = - new wxStaticBoxSizer( wxVERTICAL, this, wxT( "&Flags" ) ); + new wxStaticBoxSizer( wxVERTICAL, this, "&Flags"); - m_chkMultiple = CreateCheckBoxAndAddToSizer( sizerUseFlags, wxT( "wxFC_MULTIPLE" ) ); - m_chkNoShowHidden = CreateCheckBoxAndAddToSizer( sizerUseFlags, wxT( "wxFC_NOSHOWHIDDEN" ) ); + m_chkMultiple = CreateCheckBoxAndAddToSizer( sizerUseFlags, "wxFC_MULTIPLE"); + m_chkNoShowHidden = CreateCheckBoxAndAddToSizer( sizerUseFlags, "wxFC_NOSHOWHIDDEN"); sizerLeft->Add( sizerUseFlags, wxSizerFlags().Expand().Border() ); wxSizer *sizerFilters = - new wxStaticBoxSizer( wxVERTICAL, this, wxT( "&Filters" ) ); - m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format( wxT( "all files (%s)|%s" ), + new wxStaticBoxSizer( wxVERTICAL, this, "&Filters"); + m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format("all files (%s)|%s", wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ) ); - m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "C++ files (*.cpp; *.h)|*.cpp;*.h" ) ); - m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "PNG images (*.png)|*.png" ) ); + m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, "C++ files (*.cpp; *.h)|*.cpp;*.h" ); + m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, "PNG images (*.png)|*.png"); sizerLeft->Add( sizerFilters, wxSizerFlags().Expand().Border() ); - wxButton *btn = new wxButton( this, FileCtrlPage_Reset, wxT( "&Reset" ) ); + wxButton *btn = new wxButton( this, FileCtrlPage_Reset, "&Reset" ); sizerLeft->Add( btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15 ); // right pane @@ -253,7 +253,7 @@ void FileCtrlWidgetsPage::CreateFileCtrl() if ( m_fltr[i]->IsChecked() ) { if ( !wildcard.IsEmpty() ) - wildcard += wxT( "|" ); + wildcard += "|"; wildcard += m_fltr[i]->GetLabel(); } } diff --git a/samples/widgets/filepicker.cpp b/samples/widgets/filepicker.cpp index 14236781ad..dfa8e6ba2e 100644 --- a/samples/widgets/filepicker.cpp +++ b/samples/widgets/filepicker.cpp @@ -150,7 +150,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(FilePickerWidgetsPage, wxT("FilePicker"), +IMPLEMENT_WIDGETS_PAGE(FilePickerWidgetsPage, "FilePicker", PICKER_CTRLS | FAMILY_CTRLS); FilePickerWidgetsPage::FilePickerWidgetsPage(WidgetsBookCtrl *book, @@ -164,17 +164,17 @@ void FilePickerWidgetsPage::CreateContent() // left pane wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); - static const wxString mode[] = { wxT("open"), wxT("save") }; - m_radioFilePickerMode = new wxRadioBox(this, wxID_ANY, wxT("wxFilePicker mode"), + static const wxString mode[] = { "open", "save" }; + m_radioFilePickerMode = new wxRadioBox(this, wxID_ANY, "wxFilePicker mode", wxDefaultPosition, wxDefaultSize, WXSIZEOF(mode), mode); boxleft->Add(m_radioFilePickerMode, 0, wxALL|wxGROW, 5); - wxStaticBoxSizer *filebox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&FilePicker style")); - m_chkFileTextCtrl = CreateCheckBoxAndAddToSizer(filebox, wxT("With textctrl")); - m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(filebox, wxT("Overwrite prompt")); - m_chkFileMustExist = CreateCheckBoxAndAddToSizer(filebox, wxT("File must exist")); - m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(filebox, wxT("Change working dir")); + wxStaticBoxSizer *filebox = new wxStaticBoxSizer(wxVERTICAL, this, "&FilePicker style"); + m_chkFileTextCtrl = CreateCheckBoxAndAddToSizer(filebox, "With textctrl"); + m_chkFileOverwritePrompt = CreateCheckBoxAndAddToSizer(filebox, "Overwrite prompt"); + m_chkFileMustExist = CreateCheckBoxAndAddToSizer(filebox, "File must exist"); + m_chkFileChangeDir = CreateCheckBoxAndAddToSizer(filebox, "Change working dir"); m_chkSmall = CreateCheckBoxAndAddToSizer(filebox, "&Small version"); boxleft->Add(filebox, 0, wxALL|wxGROW, 5); @@ -189,7 +189,7 @@ void FilePickerWidgetsPage::CreateContent() boxleft->AddSpacer(10); - boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), + boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"), 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); Reset(); // set checkboxes state @@ -245,7 +245,7 @@ void FilePickerWidgetsPage::CreatePicker() // pass an empty string as initial file m_filePicker = new wxFilePickerCtrl(this, PickerPage_File, wxEmptyString, - wxT("Hello!"), wxT("*"), + "Hello!", "*", wxDefaultPosition, wxDefaultSize, style); } @@ -310,7 +310,7 @@ void FilePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void FilePickerWidgetsPage::OnFileChange(wxFileDirPickerEvent& event) { - wxLogMessage(wxT("The file changed to '%s' ! The current working directory is '%s'"), + wxLogMessage("The file changed to '%s' ! The current working directory is '%s'", event.GetPath().c_str(), wxGetCwd().c_str()); } diff --git a/samples/widgets/fontpicker.cpp b/samples/widgets/fontpicker.cpp index d753592796..3039479401 100644 --- a/samples/widgets/fontpicker.cpp +++ b/samples/widgets/fontpicker.cpp @@ -125,7 +125,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(FontPickerWidgetsPage, wxT("FontPicker"), +IMPLEMENT_WIDGETS_PAGE(FontPickerWidgetsPage, "FontPicker", PICKER_CTRLS | FAMILY_CTRLS); FontPickerWidgetsPage::FontPickerWidgetsPage(WidgetsBookCtrl *book, @@ -139,13 +139,13 @@ void FontPickerWidgetsPage::CreateContent() // left pane wxSizer *boxleft = new wxBoxSizer(wxVERTICAL); - wxStaticBoxSizer *fontbox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("&FontPicker style")); - m_chkFontTextCtrl = CreateCheckBoxAndAddToSizer(fontbox, wxT("With textctrl")); - m_chkFontDescAsLabel = CreateCheckBoxAndAddToSizer(fontbox, wxT("Font desc as btn label")); - m_chkFontUseFontForLabel = CreateCheckBoxAndAddToSizer(fontbox, wxT("Use font for label")); + wxStaticBoxSizer *fontbox = new wxStaticBoxSizer(wxVERTICAL, this, "&FontPicker style"); + m_chkFontTextCtrl = CreateCheckBoxAndAddToSizer(fontbox, "With textctrl"); + m_chkFontDescAsLabel = CreateCheckBoxAndAddToSizer(fontbox, "Font desc as btn label"); + m_chkFontUseFontForLabel = CreateCheckBoxAndAddToSizer(fontbox, "Use font for label"); boxleft->Add(fontbox, 0, wxALL|wxGROW, 5); - boxleft->Add(new wxButton(this, PickerPage_Reset, wxT("&Reset")), + boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"), 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); Reset(); // set checkboxes state @@ -218,7 +218,7 @@ void FontPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void FontPickerWidgetsPage::OnFontChange(wxFontPickerEvent& event) { - wxLogMessage(wxT("The font changed to '%s' with size %d !"), + wxLogMessage("The font changed to '%s' with size %d !", event.GetFont().GetFaceName().c_str(), event.GetFont().GetPointSize()); } diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index 87ad1b547d..457fb4aa77 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -175,7 +175,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, wxT("Gauge"), FAMILY_CTRLS ); +IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, "Gauge", FAMILY_CTRLS ); GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) @@ -199,25 +199,25 @@ void GaugeWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Vertical")); - m_chkSmooth = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Smooth")); - m_chkProgress = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Progress")); + m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical"); + m_chkSmooth = CreateCheckBoxAndAddToSizer(sizerLeft, "&Smooth"); + m_chkProgress = CreateCheckBoxAndAddToSizer(sizerLeft, "&Progress"); sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - wxButton *btn = new wxButton(this, GaugePage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, GaugePage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change gauge value")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change gauge value"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; - wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), + wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value", GaugePage_CurValueText, &text); text->SetEditable(false); @@ -225,26 +225,26 @@ void GaugeWidgetsPage::CreateContent() sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(GaugePage_SetValue, - wxT("Set &value"), + "Set &value", GaugePage_ValueText, &m_textValue); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(GaugePage_SetRange, - wxT("Set &range"), + "Set &range", GaugePage_RangeText, &m_textRange); - m_textRange->SetValue( wxString::Format(wxT("%lu"), m_range) ); + m_textRange->SetValue( wxString::Format("%lu", m_range) ); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, GaugePage_Progress, wxT("Simulate &progress")); + btn = new wxButton(this, GaugePage_Progress, "Simulate &progress"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); btn = new wxButton(this, GaugePage_IndeterminateProgress, - wxT("Simulate &indeterminate job")); + "Simulate &indeterminate job"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, GaugePage_Clear, wxT("&Clear")); + btn = new wxButton(this, GaugePage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); // right pane @@ -322,13 +322,13 @@ void GaugeWidgetsPage::StartTimer(wxButton *clicked) { static const int INTERVAL = 300; - wxLogMessage(wxT("Launched progress timer (interval = %d ms)"), INTERVAL); + wxLogMessage("Launched progress timer (interval = %d ms)", INTERVAL); m_timer = new wxTimer(this, clicked->GetId() == GaugePage_Progress ? GaugePage_Timer : GaugePage_IndeterminateTimer); m_timer->Start(INTERVAL); - clicked->SetLabel(wxT("&Stop timer")); + clicked->SetLabel("&Stop timer"); if (clicked->GetId() == GaugePage_Progress) FindWindow(GaugePage_IndeterminateProgress)->Disable(); @@ -338,23 +338,23 @@ void GaugeWidgetsPage::StartTimer(wxButton *clicked) void GaugeWidgetsPage::StopTimer(wxButton *clicked) { - wxCHECK_RET( m_timer, wxT("shouldn't be called") ); + wxCHECK_RET( m_timer, "shouldn't be called" ); m_timer->Stop(); wxDELETE(m_timer); if (clicked->GetId() == GaugePage_Progress) { - clicked->SetLabel(wxT("Simulate &progress")); + clicked->SetLabel("Simulate &progress"); FindWindow(GaugePage_IndeterminateProgress)->Enable(); } else { - clicked->SetLabel(wxT("Simulate indeterminate job")); + clicked->SetLabel("Simulate indeterminate job"); FindWindow(GaugePage_Progress)->Enable(); } - wxLogMessage(wxT("Progress finished.")); + wxLogMessage("Progress finished."); } // ---------------------------------------------------------------------------- @@ -379,7 +379,7 @@ void GaugeWidgetsPage::OnButtonProgress(wxCommandEvent& event) { StopTimer(b); - wxLogMessage(wxT("Stopped the timer.")); + wxLogMessage("Stopped the timer."); } } @@ -396,7 +396,7 @@ void GaugeWidgetsPage::OnButtonIndeterminateProgress(wxCommandEvent& event) m_gauge->SetValue(0); - wxLogMessage(wxT("Stopped the timer.")); + wxLogMessage("Stopped the timer."); } } @@ -457,7 +457,7 @@ void GaugeWidgetsPage::OnProgressTimer(wxTimerEvent& WXUNUSED(event)) else // reached the end { wxButton *btn = (wxButton *)FindWindow(GaugePage_Progress); - wxCHECK_RET( btn, wxT("no progress button?") ); + wxCHECK_RET( btn, "no progress button?" ); StopTimer(btn); } @@ -470,7 +470,7 @@ void GaugeWidgetsPage::OnIndeterminateProgressTimer(wxTimerEvent& WXUNUSED(event void GaugeWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) { - event.SetText( wxString::Format(wxT("%d"), m_gauge->GetValue())); + event.SetText( wxString::Format("%d", m_gauge->GetValue())); } #endif diff --git a/samples/widgets/headerctrl.cpp b/samples/widgets/headerctrl.cpp index 92979e49a0..17c28de6e3 100644 --- a/samples/widgets/headerctrl.cpp +++ b/samples/widgets/headerctrl.cpp @@ -78,7 +78,7 @@ private: #endif IMPLEMENT_WIDGETS_PAGE(HeaderCtrlWidgetsPage, - wxT("Header"), HEADER_CTRL_FAMILY); + "Header", HEADER_CTRL_FAMILY); void HeaderCtrlWidgetsPage::CreateContent() { diff --git a/samples/widgets/hyperlnk.cpp b/samples/widgets/hyperlnk.cpp index d3d7baba44..fb110f5a71 100644 --- a/samples/widgets/hyperlnk.cpp +++ b/samples/widgets/hyperlnk.cpp @@ -142,7 +142,7 @@ wxEND_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(HyperlinkWidgetsPage, wxT("Hyperlink"), +IMPLEMENT_WIDGETS_PAGE(HyperlinkWidgetsPage, "Hyperlink", GENERIC_CTRLS ); @@ -157,33 +157,33 @@ void HyperlinkWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Hyperlink details")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Hyperlink details"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetLabel , wxT("Set &Label"), wxID_ANY, &m_label ), + sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetLabel , "Set &Label", wxID_ANY, &m_label ), 0, wxALL | wxALIGN_RIGHT , 5 ); - sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetURL , wxT("Set &URL"), wxID_ANY, &m_url ), + sizerLeft->Add( CreateSizerWithTextAndButton( HyperlinkPage_SetURL , "Set &URL", wxID_ANY, &m_url ), 0, wxALL | wxALIGN_RIGHT , 5 ); static const wxString alignments[] = { - wxT("&left"), - wxT("¢re"), - wxT("&right") + "&left", + "¢re", + "&right" }; wxCOMPILE_TIME_ASSERT( WXSIZEOF(alignments) == Align_Max, AlignMismatch ); - m_radioAlignMode = new wxRadioBox(this, wxID_ANY, wxT("alignment"), + m_radioAlignMode = new wxRadioBox(this, wxID_ANY, "alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(alignments), alignments); m_radioAlignMode->SetSelection(1); // start with "centre" selected since // wxHL_DEFAULT_STYLE contains wxHL_ALIGN_CENTRE sizerLeft->Add(m_radioAlignMode, 0, wxALL|wxGROW, 5); - m_checkGeneric = new wxCheckBox(this, wxID_ANY, wxT("Use generic version"), + m_checkGeneric = new wxCheckBox(this, wxID_ANY, "Use generic version", wxDefaultPosition, wxDefaultSize); sizerLeft->Add(m_checkGeneric, 0, wxALL|wxGROW, 5); @@ -191,24 +191,24 @@ void HyperlinkWidgetsPage::CreateContent() wxSizer *szHyperlinkLong = new wxBoxSizer(wxVERTICAL); wxSizer *szHyperlink = new wxBoxSizer(wxHORIZONTAL); - m_visit = new wxStaticText(this, wxID_ANY, wxT("Visit ")); + m_visit = new wxStaticText(this, wxID_ANY, "Visit "); if (m_checkGeneric->IsChecked()) { m_hyperlink = new wxGenericHyperlinkCtrl(this, HyperlinkPage_Ctrl, - wxT("wxWidgets website"), - wxT("www.wxwidgets.org")); + "wxWidgets website", + "www.wxwidgets.org"); } else { m_hyperlink = new wxHyperlinkCtrl(this, HyperlinkPage_Ctrl, - wxT("wxWidgets website"), - wxT("www.wxwidgets.org")); + "wxWidgets website", + "www.wxwidgets.org"); } - m_fun = new wxStaticText(this, wxID_ANY, wxT(" for fun!")); + m_fun = new wxStaticText(this, wxID_ANY, " for fun!"); szHyperlink->Add(0, 0, 1, wxCENTRE); szHyperlink->Add(m_visit, 0, wxCENTRE); @@ -221,15 +221,15 @@ void HyperlinkWidgetsPage::CreateContent() { m_hyperlinkLong = new wxGenericHyperlinkCtrl(this, wxID_ANY, - wxT("This is a long hyperlink"), - wxT("www.wxwidgets.org")); + "This is a long hyperlink", + "www.wxwidgets.org"); } else { m_hyperlinkLong = new wxHyperlinkCtrl(this, wxID_ANY, - wxT("This is a long hyperlink"), - wxT("www.wxwidgets.org")); + "This is a long hyperlink", + "www.wxwidgets.org"); } szHyperlinkLong->Add(0, 0, 1, wxCENTRE); @@ -307,8 +307,8 @@ void HyperlinkWidgetsPage::CreateHyperlinkLong(long align) { hyp = new wxGenericHyperlinkCtrl(this, wxID_ANY, - wxT("This is a long hyperlink"), - wxT("www.wxwidgets.org"), + "This is a long hyperlink", + "www.wxwidgets.org", wxDefaultPosition, wxDefaultSize, style); @@ -317,8 +317,8 @@ void HyperlinkWidgetsPage::CreateHyperlinkLong(long align) { hyp = new wxHyperlinkCtrl(this, wxID_ANY, - wxT("This is a long hyperlink"), - wxT("www.wxwidgets.org"), + "This is a long hyperlink", + "www.wxwidgets.org", wxDefaultPosition, wxDefaultSize, style); @@ -365,7 +365,7 @@ void HyperlinkWidgetsPage::OnAlignment(wxCommandEvent& WXUNUSED(event)) { default: case Align_Max: - wxFAIL_MSG( wxT("unknown alignment") ); + wxFAIL_MSG( "unknown alignment" ); // fall through case Align_Left: diff --git a/samples/widgets/itemcontainer.cpp b/samples/widgets/itemcontainer.cpp index bb081c8419..d120895aac 100644 --- a/samples/widgets/itemcontainer.cpp +++ b/samples/widgets/itemcontainer.cpp @@ -76,12 +76,12 @@ ItemContainerWidgetsPage::ItemContainerWidgetsPage(WidgetsBookCtrl *book, #endif // __WXMSW__ || __WXGTK__ , m_trackedDataObjects(0) { - m_items.Add(wxT("This")); - m_items.Add(wxT("is")); - m_items.Add(wxT("a")); - m_items.Add(wxT("List")); - m_items.Add(wxT("of")); - m_items.Add(wxT("strings")); + m_items.Add("This"); + m_items.Add("is"); + m_items.Add("a"); + m_items.Add("List"); + m_items.Add("of"); + m_items.Add("strings"); m_itemsSorted = m_items; } @@ -108,11 +108,11 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed() { if ( m_trackedDataObjects ) { - wxString message = wxT("Bug in managing wxClientData: "); + wxString message = "Bug in managing wxClientData: "; if ( m_trackedDataObjects > 0 ) - message << m_trackedDataObjects << wxT(" lost objects"); + message << m_trackedDataObjects << " lost objects"; else - message << (-m_trackedDataObjects) << wxT(" extra deletes"); + message << (-m_trackedDataObjects) << " extra deletes"; wxFAIL_MSG(message); return false; } @@ -123,7 +123,7 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed() void ItemContainerWidgetsPage::StartTest(const wxString& label) { m_container->Clear(); - wxLogMessage(wxT("Test - %s:"), label.c_str()); + wxLogMessage("Test - %s:", label.c_str()); } void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) @@ -133,7 +133,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) bool ok = count == items.GetCount(); if ( !ok ) { - wxFAIL_MSG(wxT("Item count does not match.")); + wxFAIL_MSG("Item count does not match."); } else { @@ -143,7 +143,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) if ( str != items[i] ) { wxFAIL_MSG(wxString::Format( - wxT("Wrong string \"%s\" at position %d (expected \"%s\")"), + "Wrong string \"%s\" at position %d (expected \"%s\")", str.c_str(), i, items[i].c_str())); ok = false; break; @@ -178,19 +178,19 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) m_container->Clear(); ok &= VerifyAllClientDataDestroyed(); - wxLogMessage(wxT("...%s"), ok ? wxT("passed") : wxT("failed")); + wxLogMessage("...%s", ok ? "passed" : "failed"); } wxString ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const { wxString str; - str << wxT("Current content:\n"); + str << "Current content:\n"; unsigned i; for ( i = 0; i < m_container->GetCount(); ++i ) { - str << wxT(" - ") << m_container->GetString(i) << wxT(" ["); + str << " - " << m_container->GetString(i) << " ["; if ( m_container->HasClientObjectData() ) { TrackedClientData * @@ -204,20 +204,20 @@ ItemContainerWidgetsPage::DumpContainerData(const wxArrayString& expected) const if ( data ) str << (wxUIntPtr)data; } - str << wxT("]\n"); + str << "]\n"; } - str << wxT("Expected content:\n"); + str << "Expected content:\n"; for ( i = 0; i < expected.GetCount(); ++i ) { const wxString& item = expected[i]; - str << wxT(" - ") << item << wxT("["); + str << " - " << item << "["; for( unsigned j = 0; j < m_items.GetCount(); ++j ) { if ( m_items[j] == item ) str << j; } - str << wxT("]\n"); + str << "]\n"; } return str; @@ -227,7 +227,7 @@ bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str { if ( i > m_items.GetCount() || m_items[i] != str ) { - wxLogMessage(wxT("Client data for '%s' does not match."), str.c_str()); + wxLogMessage("Client data for '%s' does not match.", str.c_str()); return false; } @@ -251,9 +251,9 @@ ItemContainerWidgetsPage::MakeArray(const wxSortedArrayString& sorted) void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) { m_container = GetContainer(); - wxASSERT_MSG(m_container, wxT("Widget must have a test widget")); + wxASSERT_MSG(m_container, "Widget must have a test widget"); - wxLogMessage(wxT("wxItemContainer test for %s, %s:"), + wxLogMessage("wxItemContainer test for %s, %s:", GetWidget()->GetClassInfo()->GetClassName(), (m_container->IsSorted() ? "Sorted" : "Unsorted")); @@ -261,16 +261,16 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted) : m_items; - StartTest(wxT("Append one item")); + StartTest("Append one item"); wxString item = m_items[0]; m_container->Append(item); EndTest(wxArrayString(1, &item)); - StartTest(wxT("Append some items")); + StartTest("Append some items"); m_container->Append(m_items); EndTest(expected_result); - StartTest(wxT("Append some items with data objects")); + StartTest("Append some items with data objects"); wxClientData **objects = new wxClientData *[m_items.GetCount()]; for ( unsigned i = 0; i < m_items.GetCount(); ++i ) objects[i] = CreateClientData(i); @@ -278,7 +278,7 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) EndTest(expected_result); delete[] objects; - StartTest(wxT("Append some items with data")); + StartTest("Append some items with data"); void **data = new void *[m_items.GetCount()]; for ( unsigned i = 0; i < m_items.GetCount(); ++i ) data[i] = wxUIntToPtr(i); @@ -286,19 +286,19 @@ void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) EndTest(expected_result); delete[] data; - StartTest(wxT("Append some items with data, one by one")); + StartTest("Append some items with data, one by one"); for ( unsigned i = 0; i < m_items.GetCount(); ++i ) m_container->Append(m_items[i], wxUIntToPtr(i)); EndTest(expected_result); - StartTest(wxT("Append some items with data objects, one by one")); + StartTest("Append some items with data objects, one by one"); for ( unsigned i = 0; i < m_items.GetCount(); ++i ) m_container->Append(m_items[i], CreateClientData(i)); EndTest(expected_result); if ( !m_container->IsSorted() ) { - StartTest(wxT("Insert in reverse order with data, one by one")); + StartTest("Insert in reverse order with data, one by one"); for ( unsigned i = m_items.GetCount(); i; --i ) m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1)); EndTest(expected_result); diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index 22da0c9b4e..c8e567479e 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -244,7 +244,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, wxT("Listbox"), +IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, "Listbox", FAMILY_CTRLS | WITH_ITEMS_CTRLS ); @@ -278,17 +278,17 @@ void ListboxWidgetsPage::CreateContent() // left pane wxStaticBox *box = new wxStaticBox(this, wxID_ANY, - wxT("&Set listbox parameters")); + "&Set listbox parameters"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); static const wxString modes[] = { - wxT("single"), - wxT("extended"), - wxT("multiple"), + "single", + "extended", + "multiple", }; - m_radioSelMode = new wxRadioBox(this, wxID_ANY, wxT("Selection &mode:"), + m_radioSelMode = new wxRadioBox(this, wxID_ANY, "Selection &mode:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(modes), modes, 1, wxRA_SPECIFY_COLS); @@ -311,15 +311,15 @@ void ListboxWidgetsPage::CreateContent() m_chkVScroll = CreateCheckBoxAndAddToSizer ( sizerLeft, - wxT("Always show &vertical scrollbar") + "Always show &vertical scrollbar" ); m_chkHScroll = CreateCheckBoxAndAddToSizer ( sizerLeft, - wxT("Show &horizontal scrollbar") + "Show &horizontal scrollbar" ); - m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Sort items")); - m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Owner drawn")); + m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, "&Sort items"); + m_chkOwnerDraw = CreateCheckBoxAndAddToSizer(sizerLeft, "&Owner drawn"); sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(m_radioSelMode, 0, wxGROW | wxALL, 5); @@ -327,67 +327,67 @@ void ListboxWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(m_radioListType, 0, wxGROW | wxALL, 5); - wxButton *btn = new wxButton(this, ListboxPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, ListboxPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change listbox contents")); + "&Change listbox contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ListboxPage_Add, wxT("&Add this string")); - m_textAdd = new wxTextCtrl(this, ListboxPage_AddText, wxT("test item 0")); + btn = new wxButton(this, ListboxPage_Add, "&Add this string"); + m_textAdd = new wxTextCtrl(this, ListboxPage_AddText, "test item 0"); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textAdd, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_AddSeveral, wxT("&Insert a few strings")); + btn = new wxButton(this, ListboxPage_AddSeveral, "&Insert a few strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_AddMany, wxT("Add &many strings")); + btn = new wxButton(this, ListboxPage_AddMany, "Add &many strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ListboxPage_Change, wxT("C&hange current")); + btn = new wxButton(this, ListboxPage_Change, "C&hange current"); m_textChange = new wxTextCtrl(this, ListboxPage_ChangeText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textChange, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ListboxPage_EnsureVisible, wxT("Make item &visible")); + btn = new wxButton(this, ListboxPage_EnsureVisible, "Make item &visible"); m_textEnsureVisible = new wxTextCtrl(this, ListboxPage_EnsureVisibleText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textEnsureVisible, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = new wxBoxSizer(wxHORIZONTAL); - btn = new wxButton(this, ListboxPage_Delete, wxT("&Delete this item")); + btn = new wxButton(this, ListboxPage_Delete, "&Delete this item"); m_textDelete = new wxTextCtrl(this, ListboxPage_DeleteText, wxEmptyString); sizerRow->Add(btn, 0, wxRIGHT, 5); sizerRow->Add(m_textDelete, 1, wxLEFT, 5); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_DeleteSel, wxT("Delete &selection")); + btn = new wxButton(this, ListboxPage_DeleteSel, "Delete &selection"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_Clear, wxT("&Clear")); + btn = new wxButton(this, ListboxPage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_MoveUp, wxT("Move item &up")); + btn = new wxButton(this, ListboxPage_MoveUp, "Move item &up"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_MoveDown, wxT("Move item &down")); + btn = new wxButton(this, ListboxPage_MoveDown, "Move item &down"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_GetTopItem, wxT("Get top item")); + btn = new wxButton(this, ListboxPage_GetTopItem, "Get top item"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_GetCountPerPage, wxT("Get count per page")); + btn = new wxButton(this, ListboxPage_GetCountPerPage, "Get count per page"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ListboxPage_ContainerTests, wxT("Run &tests")); + btn = new wxButton(this, ListboxPage_ContainerTests, "Run &tests"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); // right pane @@ -431,7 +431,7 @@ void ListboxWidgetsPage::CreateLbox() switch ( m_radioSelMode->GetSelection() ) { default: - wxFAIL_MSG( wxT("unexpected radio box selection") ); + wxFAIL_MSG( "unexpected radio box selection" ); wxFALLTHROUGH; case LboxSel_Single: flags |= wxLB_SINGLE; break; @@ -617,7 +617,7 @@ void ListboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event)) if ( !m_textAdd->IsModified() ) { // update the default string - m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textAdd->SetValue(wxString::Format("test item %u", ++s_item)); } m_lbox->Append(s); @@ -628,16 +628,16 @@ void ListboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) // "many" means 1000 here for ( unsigned int n = 0; n < 1000; n++ ) { - m_lbox->Append(wxString::Format(wxT("item #%u"), n)); + m_lbox->Append(wxString::Format("item #%u", n)); } } void ListboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) { wxArrayString items; - items.Add(wxT("First")); - items.Add(wxT("another one")); - items.Add(wxT("and the last (very very very very very very very very very very long) one")); + items.Add("First"); + items.Add("another one"); + items.Add("and the last (very very very very very very very very very very long) one"); m_lbox->InsertItems(items, 0); } @@ -700,26 +700,26 @@ void ListboxWidgetsPage::OnUpdateUIMoveButtons(wxUpdateUIEvent& evt) void ListboxWidgetsPage::OnListbox(wxCommandEvent& event) { long sel = event.GetSelection(); - m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); + m_textDelete->SetValue(wxString::Format("%ld", sel)); if (event.IsSelection()) { - wxLogMessage(wxT("Listbox item %ld selected"), sel); + wxLogMessage("Listbox item %ld selected", sel); } else { - wxLogMessage(wxT("Listbox item %ld deselected"), sel); + wxLogMessage("Listbox item %ld deselected", sel); } } void ListboxWidgetsPage::OnListboxDClick(wxCommandEvent& event) { - wxLogMessage( wxT("Listbox item %d double clicked"), event.GetInt() ); + wxLogMessage( "Listbox item %d double clicked", event.GetInt() ); } void ListboxWidgetsPage::OnCheckListbox(wxCommandEvent& event) { - wxLogMessage( wxT("Listbox item %d toggled"), event.GetInt() ); + wxLogMessage( "Listbox item %d toggled", event.GetInt() ); } void ListboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/widgets/native.cpp b/samples/widgets/native.cpp index ba2cbd6b5f..d355a85251 100644 --- a/samples/widgets/native.cpp +++ b/samples/widgets/native.cpp @@ -272,7 +272,7 @@ private: // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, wxT("Native"), NATIVE_CTRLS); +IMPLEMENT_WIDGETS_PAGE(NativeWidgetsPage, "Native", NATIVE_CTRLS); NativeWidgetsPage::NativeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) : WidgetsPage(book, imaglist, native_xpm) diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index c8d94e86ed..08c51f1f3c 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -204,20 +204,20 @@ void BookWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); // must be in sync with Orient enum wxArrayString orientations; - orientations.Add(wxT("&top")); - orientations.Add(wxT("&bottom")); - orientations.Add(wxT("&left")); - orientations.Add(wxT("&right")); + orientations.Add("&top"); + orientations.Add("&bottom"); + orientations.Add("&left"); + orientations.Add("&right"); wxASSERT_MSG( orientations.GetCount() == Orient_Max, - wxT("forgot to update something") ); + "forgot to update something" ); - m_chkImages = new wxCheckBox(this, wxID_ANY, wxT("Show &images")); - m_radioOrient = new wxRadioBox(this, wxID_ANY, wxT("&Tab orientation"), + m_chkImages = new wxCheckBox(this, wxID_ANY, "Show &images"); + m_radioOrient = new wxRadioBox(this, wxID_ANY, "&Tab orientation", wxDefaultPosition, wxDefaultSize, orientations, 1, wxRA_SPECIFY_COLS); @@ -227,48 +227,48 @@ void BookWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer sizerLeft->Add(m_radioOrient, 0, wxALL, 5); - wxButton *btn = new wxButton(this, BookPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, BookPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Contents")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; - wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Number of pages: "), + wxSizer *sizerRow = CreateSizerWithTextAndLabel("Number of pages: ", BookPage_NumPagesText, &text); text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection: "), + sizerRow = CreateSizerWithTextAndLabel("Current selection: ", BookPage_CurSelectText, &text); text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage, - wxT("&Select page"), + "&Select page", BookPage_SelectText, &m_textSelect); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BookPage_AddPage, wxT("&Add page")); + btn = new wxButton(this, BookPage_AddPage, "&Add page"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage, - wxT("&Insert page at"), + "&Insert page at", BookPage_InsertText, &m_textInsert); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage, - wxT("&Remove page"), + "&Remove page", BookPage_RemoveText, &m_textRemove); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, BookPage_DeleteAll, wxT("&Delete All")); + btn = new wxButton(this, BookPage_DeleteAll, "&Delete All"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); // right pane @@ -342,7 +342,7 @@ void BookWidgetsPage::RecreateBook() switch ( m_radioOrient->GetSelection() ) { default: - wxFAIL_MSG( wxT("unknown orientation") ); + wxFAIL_MSG( "unknown orientation" ); // fall through case Orient_Top: @@ -429,7 +429,7 @@ int BookWidgetsPage::GetIconIndex() const wxWindow *BookWidgetsPage::CreateNewPage() { - return new wxTextCtrl(m_book, wxID_ANY, wxT("I'm a book page")); + return new wxTextCtrl(m_book, wxID_ANY, "I'm a book page"); } // ---------------------------------------------------------------------------- @@ -451,30 +451,30 @@ void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event)) void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event)) { int pos = GetTextValue(m_textSelect); - wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); + wxCHECK_RET( IsValidValue(pos), "button should be disabled" ); m_book->SetSelection(pos); } void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event)) { - m_book->AddPage(CreateNewPage(), wxT("Added page"), false, + m_book->AddPage(CreateNewPage(), "Added page", false, GetIconIndex()); } void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event)) { int pos = GetTextValue(m_textInsert); - wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); + wxCHECK_RET( IsValidValue(pos), "button should be disabled" ); - m_book->InsertPage(pos, CreateNewPage(), wxT("Inserted page"), false, + m_book->InsertPage(pos, CreateNewPage(), "Inserted page", false, GetIconIndex()); } void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event)) { int pos = GetTextValue(m_textRemove); - wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") ); + wxCHECK_RET( IsValidValue(pos), "button should be disabled" ); m_book->DeletePage(pos); } @@ -504,13 +504,13 @@ void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event) void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event) { if(m_book) - event.SetText( wxString::Format(wxT("%u"), unsigned(m_book->GetPageCount())) ); + event.SetText( wxString::Format("%u", unsigned(m_book->GetPageCount())) ); } void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event) { if(m_book) - event.SetText( wxString::Format(wxT("%d"), m_book->GetSelection()) ); + event.SetText( wxString::Format("%d", m_book->GetSelection()) ); } void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) @@ -573,13 +573,13 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, wxT("Notebook"), +IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, "Notebook", FAMILY_CTRLS | BOOK_CTRLS ); void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event) { - wxLogMessage(wxT("Notebook page changing from %d to %d (currently %d)."), + wxLogMessage("Notebook page changing from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); @@ -589,7 +589,7 @@ void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event) void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event) { - wxLogMessage(wxT("Notebook page changed from %d to %d (currently %d)."), + wxLogMessage("Notebook page changed from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); @@ -646,13 +646,13 @@ wxBEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage) EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged) wxEND_EVENT_TABLE() -IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, wxT("Listbook"), +IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, "Listbook", GENERIC_CTRLS | BOOK_CTRLS ); void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event) { - wxLogMessage(wxT("Listbook page changing from %d to %d (currently %d)."), + wxLogMessage("Listbook page changing from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); @@ -662,7 +662,7 @@ void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event) void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event) { - wxLogMessage(wxT("Listbook page changed from %d to %d (currently %d)."), + wxLogMessage("Listbook page changed from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); @@ -719,13 +719,13 @@ wxBEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage) EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged) wxEND_EVENT_TABLE() -IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, wxT("Choicebook"), +IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, "Choicebook", GENERIC_CTRLS | BOOK_CTRLS ); void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event) { - wxLogMessage(wxT("Choicebook page changing from %d to %d (currently %d)."), + wxLogMessage("Choicebook page changing from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); @@ -735,7 +735,7 @@ void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event) void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event) { - wxLogMessage(wxT("Choicebook page changed from %d to %d (currently %d)."), + wxLogMessage("Choicebook page changed from %d to %d (currently %d).", event.GetOldSelection(), event.GetSelection(), m_book->GetSelection()); diff --git a/samples/widgets/odcombobox.cpp b/samples/widgets/odcombobox.cpp index e3e9486def..0b30bf15d8 100644 --- a/samples/widgets/odcombobox.cpp +++ b/samples/widgets/odcombobox.cpp @@ -299,7 +299,7 @@ public: }; -IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, wxT("OwnerDrawnCombobox"), +IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, "OwnerDrawnCombobox", GENERIC_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS ); @@ -332,88 +332,88 @@ void ODComboboxWidgetsPage::CreateContent() wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL); // left pane - style box - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerStyle = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Sort items")); - m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Read only")); - m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Double-click Cycles")); + m_chkSort = CreateCheckBoxAndAddToSizer(sizerStyle, "&Sort items"); + m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerStyle, "&Read only"); + m_chkDclickcycles = CreateCheckBoxAndAddToSizer(sizerStyle, "&Double-click Cycles"); sizerStyle->AddSpacer(4); - m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("&Bitmap button")); - m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, wxT("B&lank button background")); + m_chkBitmapbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "&Bitmap button"); + m_chkStdbutton = CreateCheckBoxAndAddToSizer(sizerStyle, "B&lank button background"); - wxButton *btn = new wxButton(this, ODComboPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, ODComboPage_Reset, "&Reset"); sizerStyle->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 3); sizerLeft->Add(sizerStyle, wxSizerFlags().Expand()); // left pane - popup adjustment box - box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &popup")); + box = new wxStaticBox(this, wxID_ANY, "Adjust &popup"); wxSizer *sizerPopupPos = new wxStaticBoxSizer(box, wxVERTICAL); - sizerRow = CreateSizerWithTextAndLabel(wxT("Min. Width:"), + sizerRow = CreateSizerWithTextAndLabel("Min. Width:", ODComboPage_PopupMinWidth, &m_textPopupMinWidth); - m_textPopupMinWidth->SetValue(wxT("-1")); + m_textPopupMinWidth->SetValue("-1"); sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("Max. Height:"), + sizerRow = CreateSizerWithTextAndLabel("Max. Height:", ODComboPage_PopupHeight, &m_textPopupHeight); - m_textPopupHeight->SetValue(wxT("-1")); + m_textPopupHeight->SetValue("-1"); sizerPopupPos->Add(sizerRow, 0, wxALL | wxGROW, 5); - m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, wxT("Align Right")); + m_chkAlignpopupright = CreateCheckBoxAndAddToSizer(sizerPopupPos, "Align Right"); sizerLeft->Add(sizerPopupPos, wxSizerFlags().Expand().Border(wxTOP, 2)); // left pane - button adjustment box - box = new wxStaticBox(this, wxID_ANY, wxT("Adjust &button")); + box = new wxStaticBox(this, wxID_ANY, "Adjust &button"); wxSizer *sizerButtonPos = new wxStaticBoxSizer(box, wxVERTICAL); - sizerRow = CreateSizerWithTextAndLabel(wxT("Width:"), + sizerRow = CreateSizerWithTextAndLabel("Width:", ODComboPage_ButtonWidth, &m_textButtonWidth); - m_textButtonWidth->SetValue(wxT("-1")); + m_textButtonWidth->SetValue("-1"); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("VSpacing:"), + sizerRow = CreateSizerWithTextAndLabel("VSpacing:", ODComboPage_ButtonSpacing, &m_textButtonSpacing); - m_textButtonSpacing->SetValue(wxT("0")); + m_textButtonSpacing->SetValue("0"); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("Height:"), + sizerRow = CreateSizerWithTextAndLabel("Height:", ODComboPage_ButtonHeight, &m_textButtonHeight); - m_textButtonHeight->SetValue(wxT("-1")); + m_textButtonHeight->SetValue("-1"); sizerButtonPos->Add(sizerRow, 0, wxALL | wxGROW, 5); - m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, wxT("Align Left")); + m_chkAlignbutleft = CreateCheckBoxAndAddToSizer(sizerButtonPos, "Align Left"); sizerLeft->Add(sizerButtonPos, wxSizerFlags().Expand().Border(wxTOP, 2)); // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change combobox contents")); + "&Change combobox contents"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); - btn = new wxButton(this, ODComboPage_ContainerTests, wxT("Run &tests")); + btn = new wxButton(this, ODComboPage_ContainerTests, "Run &tests"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection"), + sizerRow = CreateSizerWithTextAndLabel("Current selection", ODComboPage_CurText, &text); text->SetEditable(false); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("Insertion Point"), + sizerRow = CreateSizerWithTextAndLabel("Insertion Point", ODComboPage_InsertionPointText, &text); text->SetEditable(false); @@ -421,39 +421,39 @@ void ODComboboxWidgetsPage::CreateContent() sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ODComboPage_Insert, - wxT("&Insert this string"), + "&Insert this string", ODComboPage_InsertText, &m_textInsert); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ODComboPage_Add, - wxT("&Add this string"), + "&Add this string", ODComboPage_AddText, &m_textAdd); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ODComboPage_AddSeveral, wxT("&Append a few strings")); + btn = new wxButton(this, ODComboPage_AddSeveral, "&Append a few strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ODComboPage_AddMany, wxT("Append &many strings")); + btn = new wxButton(this, ODComboPage_AddMany, "Append &many strings"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ODComboPage_Change, - wxT("C&hange current"), + "C&hange current", ODComboPage_ChangeText, &m_textChange); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(ODComboPage_Delete, - wxT("&Delete this item"), + "&Delete this item", ODComboPage_DeleteText, &m_textDelete); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ODComboPage_DeleteSel, wxT("Delete &selection")); + btn = new wxButton(this, ODComboPage_DeleteSel, "Delete &selection"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); - btn = new wxButton(this, ODComboPage_Clear, wxT("&Clear")); + btn = new wxButton(this, ODComboPage_Clear, "&Clear"); sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5); // right pane @@ -569,7 +569,7 @@ void ODComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event)) #ifndef __WXGTK__ m_combobox->SetString(sel, m_textChange->GetValue()); #else - wxLogMessage(wxT("Not implemented in wxGTK")); + wxLogMessage("Not implemented in wxGTK"); #endif } } @@ -608,7 +608,7 @@ void ODComboboxWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event)) if ( !m_textInsert->IsModified() ) { // update the default string - m_textInsert->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textInsert->SetValue(wxString::Format("test item %u", ++s_item)); } if (m_combobox->GetSelection() >= 0) @@ -623,7 +623,7 @@ void ODComboboxWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event)) if ( !m_textAdd->IsModified() ) { // update the default string - m_textAdd->SetValue(wxString::Format(wxT("test item %u"), ++s_item)); + m_textAdd->SetValue(wxString::Format("test item %u", ++s_item)); } m_combobox->Append(s); @@ -634,15 +634,15 @@ void ODComboboxWidgetsPage::OnButtonAddMany(wxCommandEvent& WXUNUSED(event)) // "many" means 1000 here for ( unsigned int n = 0; n < 1000; n++ ) { - m_combobox->Append(wxString::Format(wxT("item #%u"), n)); + m_combobox->Append(wxString::Format("item #%u", n)); } } void ODComboboxWidgetsPage::OnButtonAddSeveral(wxCommandEvent& WXUNUSED(event)) { - m_combobox->Append(wxT("First")); - m_combobox->Append(wxT("another one")); - m_combobox->Append(wxT("and the last (very very very very very very very very very very long) one")); + m_combobox->Append("First"); + m_combobox->Append("another one"); + m_combobox->Append("and the last (very very very very very very very very very very long) one"); } void ODComboboxWidgetsPage::OnTextPopupWidth(wxCommandEvent& WXUNUSED(event)) @@ -698,13 +698,13 @@ void ODComboboxWidgetsPage::OnTextButtonAll(wxCommandEvent& WXUNUSED(event)) void ODComboboxWidgetsPage::OnUpdateUICurText(wxUpdateUIEvent& event) { if (m_combobox) - event.SetText( wxString::Format(wxT("%d"), m_combobox->GetSelection()) ); + event.SetText( wxString::Format("%d", m_combobox->GetSelection()) ); } void ODComboboxWidgetsPage::OnUpdateUIInsertionPointText(wxUpdateUIEvent& event) { if (m_combobox) - event.SetText( wxString::Format(wxT("%ld"), m_combobox->GetInsertionPoint()) ); + event.SetText( wxString::Format("%ld", m_combobox->GetInsertionPoint()) ); } void ODComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event) @@ -761,26 +761,26 @@ void ODComboboxWidgetsPage::OnComboText(wxCommandEvent& event) wxString s = event.GetString(); wxASSERT_MSG( s == m_combobox->GetValue(), - wxT("event and combobox values should be the same") ); + "event and combobox values should be the same" ); if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage(wxT("OwnerDrawnCombobox enter pressed (now '%s')"), s.c_str()); + wxLogMessage("OwnerDrawnCombobox enter pressed (now '%s')", s.c_str()); } else { - wxLogMessage(wxT("OwnerDrawnCombobox text changed (now '%s')"), s.c_str()); + wxLogMessage("OwnerDrawnCombobox text changed (now '%s')", s.c_str()); } } void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) { long sel = event.GetInt(); - m_textDelete->SetValue(wxString::Format(wxT("%ld"), sel)); + m_textDelete->SetValue(wxString::Format("%ld", sel)); - wxLogMessage(wxT("OwnerDrawnCombobox item %ld selected"), sel); + wxLogMessage("OwnerDrawnCombobox item %ld selected", sel); - wxLogMessage(wxT("OwnerDrawnCombobox GetValue(): %s"), m_combobox->GetValue().c_str() ); + wxLogMessage("OwnerDrawnCombobox GetValue(): %s", m_combobox->GetValue().c_str() ); } void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event) @@ -849,12 +849,12 @@ wxBitmap ODComboboxWidgetsPage::CreateBitmap(const wxColour& colour) void ODComboboxWidgetsPage::OnDropDown(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox dropped down")); + wxLogMessage("Combobox dropped down"); } void ODComboboxWidgetsPage::OnCloseUp(wxCommandEvent& WXUNUSED(event)) { - wxLogMessage(wxT("Combobox closed up")); + wxLogMessage("Combobox closed up"); } #endif //wxUSE_ODCOMBOBOX diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 04d5721009..7af9465417 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -180,7 +180,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, wxT("Radio"), +IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, "Radio", FAMILY_CTRLS | WITH_ITEMS_CTRLS ); @@ -207,7 +207,7 @@ void RadioWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -219,12 +219,12 @@ void RadioWidgetsPage::CreateContent() static const wxString layoutDir[] = { - wxT("default"), - wxT("left to right"), - wxT("top to bottom") + "default", + "left to right", + "top to bottom" }; - m_radioDir = new wxRadioBox(this, wxID_ANY, wxT("Numbering:"), + m_radioDir = new wxRadioBox(this, wxID_ANY, "Numbering:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(layoutDir), layoutDir, 1, wxRA_SPECIFY_COLS); @@ -236,57 +236,57 @@ void RadioWidgetsPage::CreateContent() #endif // wxRA_LEFTTORIGHT wxSizer *sizerRow; - sizerRow = CreateSizerWithTextAndLabel(wxT("&Major dimension:"), + sizerRow = CreateSizerWithTextAndLabel("&Major dimension:", wxID_ANY, &m_textMajorDim); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); - sizerRow = CreateSizerWithTextAndLabel(wxT("&Number of buttons:"), + sizerRow = CreateSizerWithTextAndLabel("&Number of buttons:", wxID_ANY, &m_textNumBtns); sizerLeft->Add(sizerRow, 0, wxGROW | wxALL, 5); wxButton *btn; - btn = new wxButton(this, RadioPage_Update, wxT("&Update")); + btn = new wxButton(this, RadioPage_Update, "&Update"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5); sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - btn = new wxButton(this, RadioPage_Reset, wxT("&Reset")); + btn = new wxButton(this, RadioPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change parameters")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change parameters"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); - sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection:"), + sizerRow = CreateSizerWithTextAndLabel("Current selection:", wxID_ANY, &m_textCurSel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_Selection, - wxT("&Change selection:"), + "&Change selection:", wxID_ANY, &m_textSel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_Label, - wxT("&Label for box:"), + "&Label for box:", wxID_ANY, &m_textLabel); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); sizerRow = CreateSizerWithTextAndButton(RadioPage_LabelBtn, - wxT("&Label for buttons:"), + "&Label for buttons:", wxID_ANY, &m_textLabelBtns); sizerMiddle->Add(sizerRow, 0, wxGROW | wxALL, 5); m_chkEnableItem = CreateCheckBoxAndAddToSizer(sizerMiddle, - wxT("Disable &2nd item"), + "Disable &2nd item", RadioPage_EnableItem); m_chkShowItem = CreateCheckBoxAndAddToSizer(sizerMiddle, - wxT("Hide 2nd &item"), + "Hide 2nd &item", RadioPage_ShowItem); // right pane @@ -312,10 +312,10 @@ void RadioWidgetsPage::CreateContent() void RadioWidgetsPage::Reset() { - m_textMajorDim->SetValue(wxString::Format(wxT("%u"), DEFAULT_MAJOR_DIM)); - m_textNumBtns->SetValue(wxString::Format(wxT("%u"), DEFAULT_NUM_ENTRIES)); - m_textLabel->SetValue(wxT("I'm a radiobox")); - m_textLabelBtns->SetValue(wxT("item")); + m_textMajorDim->SetValue(wxString::Format("%u", DEFAULT_MAJOR_DIM)); + m_textNumBtns->SetValue(wxString::Format("%u", DEFAULT_NUM_ENTRIES)); + m_textLabel->SetValue("I'm a radiobox"); + m_textLabelBtns->SetValue("item"); m_chkSpecifyRows->SetValue(false); m_chkEnableItem->SetValue(true); @@ -342,7 +342,7 @@ void RadioWidgetsPage::CreateRadio() unsigned long count; if ( !m_textNumBtns->GetValue().ToULong(&count) ) { - wxLogWarning(wxT("Should have a valid number for number of items.")); + wxLogWarning("Should have a valid number for number of items."); // fall back to default count = DEFAULT_NUM_ENTRIES; @@ -351,7 +351,7 @@ void RadioWidgetsPage::CreateRadio() unsigned long majorDim; if ( !m_textMajorDim->GetValue().ToULong(&majorDim) ) { - wxLogWarning(wxT("Should have a valid major dimension number.")); + wxLogWarning("Should have a valid major dimension number."); // fall back to default majorDim = DEFAULT_MAJOR_DIM; @@ -362,7 +362,7 @@ void RadioWidgetsPage::CreateRadio() wxString labelBtn = m_textLabelBtns->GetValue(); for ( size_t n = 0; n < count; n++ ) { - items[n] = wxString::Format(wxT("%s %lu"), + items[n] = wxString::Format("%s %lu", labelBtn.c_str(), (unsigned long)n + 1); } @@ -375,7 +375,7 @@ void RadioWidgetsPage::CreateRadio() switch ( m_radioDir->GetSelection() ) { default: - wxFAIL_MSG( wxT("unexpected wxRadioBox layout direction") ); + wxFAIL_MSG( "unexpected wxRadioBox layout direction" ); // fall through case RadioDir_Default: @@ -434,12 +434,12 @@ void RadioWidgetsPage::OnRadioBox(wxCommandEvent& event) int event_sel = event.GetSelection(); wxUnusedVar(event_sel); - wxLogMessage(wxT("Radiobox selection changed, now %d"), sel); + wxLogMessage("Radiobox selection changed, now %d", sel); wxASSERT_MSG( sel == event_sel, - wxT("selection should be the same in event and radiobox") ); + "selection should be the same in event and radiobox" ); - m_textCurSel->SetValue(wxString::Format(wxT("%d"), sel)); + m_textCurSel->SetValue(wxString::Format("%d", sel)); } void RadioWidgetsPage::OnButtonRecreate(wxCommandEvent& WXUNUSED(event)) @@ -458,7 +458,7 @@ void RadioWidgetsPage::OnButtonSelection(wxCommandEvent& WXUNUSED(event)) if ( !m_textSel->GetValue().ToULong(&sel) || (sel >= (size_t)m_radio->GetCount()) ) { - wxLogWarning(wxT("Invalid number specified as new selection.")); + wxLogWarning("Invalid number specified as new selection."); } else { @@ -516,14 +516,14 @@ void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event) void RadioWidgetsPage::OnUpdateUIEnableItem(wxUpdateUIEvent& event) { - event.SetText(m_radio->IsItemEnabled(TEST_BUTTON) ? wxT("Disable &2nd item") - : wxT("Enable &2nd item")); + event.SetText(m_radio->IsItemEnabled(TEST_BUTTON) ? "Disable &2nd item" + : "Enable &2nd item"); } void RadioWidgetsPage::OnUpdateUIShowItem(wxUpdateUIEvent& event) { - event.SetText(m_radio->IsItemShown(TEST_BUTTON) ? wxT("Hide 2nd &item") - : wxT("Show 2nd &item")); + event.SetText(m_radio->IsItemShown(TEST_BUTTON) ? "Hide 2nd &item" + : "Show 2nd &item"); } #endif // wxUSE_RADIOBOX diff --git a/samples/widgets/searchctrl.cpp b/samples/widgets/searchctrl.cpp index ec295e87e9..91e45c64f0 100644 --- a/samples/widgets/searchctrl.cpp +++ b/samples/widgets/searchctrl.cpp @@ -130,7 +130,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, wxT("SearchCtrl"), +IMPLEMENT_WIDGETS_PAGE(SearchCtrlWidgetsPage, "SearchCtrl", FAMILY_CTRLS | EDITABLE_CTRLS | ALL_CTRLS); SearchCtrlWidgetsPage::SearchCtrlWidgetsPage(WidgetsBookCtrl *book, @@ -147,12 +147,12 @@ void SearchCtrlWidgetsPage::CreateContent() wxSizer* box = new wxStaticBoxSizer( - new wxStaticBox(this, -1, wxT("Options")), + new wxStaticBox(this, -1, "Options"), wxVERTICAL); - m_searchBtnCheck = new wxCheckBox(this, ID_SEARCH_CB, wxT("Search button")); - m_cancelBtnCheck = new wxCheckBox(this, ID_CANCEL_CB, wxT("Cancel button")); - m_menuBtnCheck = new wxCheckBox(this, ID_MENU_CB, wxT("Search menu")); + m_searchBtnCheck = new wxCheckBox(this, ID_SEARCH_CB, "Search button"); + m_cancelBtnCheck = new wxCheckBox(this, ID_CANCEL_CB, "Cancel button"); + m_menuBtnCheck = new wxCheckBox(this, ID_MENU_CB, "Search menu"); m_searchBtnCheck->SetValue(true); @@ -191,12 +191,12 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu() { wxMenu* menu = new wxMenu; const int SEARCH_MENU_SIZE = 5; - wxMenuItem* menuItem = menu->Append(wxID_ANY, wxT("Recent Searches"), wxT(""), wxITEM_NORMAL); + wxMenuItem* menuItem = menu->Append(wxID_ANY, "Recent Searches", "", wxITEM_NORMAL); menuItem->Enable(false); for ( int i = 0; i < SEARCH_MENU_SIZE; i++ ) { - wxString itemText = wxString::Format(wxT("item %i"),i); - wxString tipText = wxString::Format(wxT("tip %i"),i); + wxString itemText = wxString::Format("item %i",i); + wxString tipText = wxString::Format("tip %i",i); menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_NORMAL); } return menu; diff --git a/samples/widgets/slider.cpp b/samples/widgets/slider.cpp index e5a3b454d6..33edea188d 100644 --- a/samples/widgets/slider.cpp +++ b/samples/widgets/slider.cpp @@ -226,7 +226,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, wxT("Slider"), FAMILY_CTRLS ); +IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, "Slider", FAMILY_CTRLS ); SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) @@ -253,43 +253,43 @@ void SliderWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Inverse")); - m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &ticks")); - m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show min/max &labels")); - m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &value label")); + m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, "&Inverse"); + m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &ticks"); + m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, "Show min/max &labels"); + m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, "Show &value label"); static const wxString sides[] = { - wxT("default"), - wxT("top"), - wxT("bottom"), - wxT("left"), - wxT("right"), + "default", + "top", + "bottom", + "left", + "right", }; - m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, wxT("&Label position"), + m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, "&Label position", wxDefaultPosition, wxDefaultSize, WXSIZEOF(sides), sides, 1, wxRA_SPECIFY_COLS); sizerLeft->Add(m_radioSides, 0, wxGROW | wxALL, 5); m_chkBothSides = CreateCheckBoxAndAddToSizer - (sizerLeft, wxT("&Both sides"), SliderPage_BothSides); + (sizerLeft, "&Both sides", SliderPage_BothSides); #if wxUSE_TOOLTIPS - m_chkBothSides->SetToolTip( wxT("\"Both sides\" is only supported \nin Universal") ); + m_chkBothSides->SetToolTip("\"Both sides\" is only supported \nin Universal"); #endif // wxUSE_TOOLTIPS sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - wxButton *btn = new wxButton(this, SliderPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, SliderPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change slider value")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change slider value"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; - wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), + wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value", SliderPage_CurValueText, &text); text->SetEditable(false); @@ -297,49 +297,49 @@ void SliderWidgetsPage::CreateContent() sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue, - wxT("Set &value"), + "Set &value", SliderPage_ValueText, &m_textValue); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax, - wxT("&Min and max"), + "&Min and max", SliderPage_MinText, &m_textMin); m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); - m_textMin->SetValue( wxString::Format(wxT("%d"), m_min) ); - m_textMax->SetValue( wxString::Format(wxT("%d"), m_max) ); + m_textMin->SetValue( wxString::Format("%d", m_min) ); + m_textMax->SetValue( wxString::Format("%d", m_max) ); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetLineSize, - wxT("Li&ne size"), + "Li&ne size", SliderPage_LineSizeText, &m_textLineSize); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetPageSize, - wxT("P&age size"), + "P&age size", SliderPage_PageSizeText, &m_textPageSize); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq, - wxT("Tick &frequency"), + "Tick &frequency", SliderPage_TickFreqText, &m_textTickFreq); - m_textTickFreq->SetValue(wxT("10")); + m_textTickFreq->SetValue("10"); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen, - wxT("Thumb &length"), + "Thumb &length", SliderPage_ThumbLenText, &m_textThumbLen); @@ -353,8 +353,8 @@ void SliderWidgetsPage::CreateContent() Reset(); CreateSlider(); - m_textLineSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetLineSize())); - m_textPageSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetPageSize())); + m_textLineSize->SetValue(wxString::Format("%d", m_slider->GetLineSize())); + m_textPageSize->SetValue(wxString::Format("%d", m_slider->GetPageSize())); // the 3 panes panes compose the window sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10); @@ -429,7 +429,7 @@ void SliderWidgetsPage::CreateSlider() break; default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through } @@ -488,7 +488,7 @@ void SliderWidgetsPage::DoSetLineSize() long lineSize; if ( !m_textLineSize->GetValue().ToLong(&lineSize) ) { - wxLogWarning(wxT("Invalid slider line size")); + wxLogWarning("Invalid slider line size"); return; } @@ -497,7 +497,7 @@ void SliderWidgetsPage::DoSetLineSize() if ( m_slider->GetLineSize() != lineSize ) { - wxLogWarning(wxT("Invalid line size in slider.")); + wxLogWarning("Invalid line size in slider."); } } @@ -506,7 +506,7 @@ void SliderWidgetsPage::DoSetPageSize() long pageSize; if ( !m_textPageSize->GetValue().ToLong(&pageSize) ) { - wxLogWarning(wxT("Invalid slider page size")); + wxLogWarning("Invalid slider page size"); return; } @@ -515,7 +515,7 @@ void SliderWidgetsPage::DoSetPageSize() if ( m_slider->GetPageSize() != pageSize ) { - wxLogWarning(wxT("Invalid page size in slider.")); + wxLogWarning("Invalid page size in slider."); } } @@ -524,7 +524,7 @@ void SliderWidgetsPage::DoSetTickFreq() long freq; if ( !m_textTickFreq->GetValue().ToLong(&freq) ) { - wxLogWarning(wxT("Invalid slider tick frequency")); + wxLogWarning("Invalid slider tick frequency"); return; } @@ -537,7 +537,7 @@ void SliderWidgetsPage::DoSetThumbLen() long len; if ( !m_textThumbLen->GetValue().ToLong(&len) ) { - wxLogWarning(wxT("Invalid slider thumb length")); + wxLogWarning("Invalid slider thumb length"); return; } @@ -584,7 +584,7 @@ void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event)) !m_textMax->GetValue().ToLong(&maxNew) || minNew >= maxNew ) { - wxLogWarning(wxT("Invalid min/max values for the slider.")); + wxLogWarning("Invalid min/max values for the slider."); return; } @@ -597,7 +597,7 @@ void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event)) if ( m_slider->GetMin() != m_min || m_slider->GetMax() != m_max ) { - wxLogWarning(wxT("Invalid range in slider.")); + wxLogWarning("Invalid range in slider."); } } @@ -606,7 +606,7 @@ void SliderWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event)) long val; if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) ) { - wxLogWarning(wxT("Invalid slider value.")); + wxLogWarning("Invalid slider value."); return; } @@ -673,7 +673,7 @@ void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) { - event.SetText( wxString::Format(wxT("%d"), m_slider->GetValue()) ); + event.SetText( wxString::Format("%d", m_slider->GetValue()) ); } void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event) @@ -693,7 +693,7 @@ void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event) void SliderWidgetsPage::OnSlider(wxScrollEvent& event) { wxASSERT_MSG( event.GetInt() == m_slider->GetValue(), - wxT("slider value should be the same") ); + "slider value should be the same" ); wxEventType eventType = event.GetEventType(); @@ -702,17 +702,17 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event) include/wx/event.h (section "wxScrollBar and wxSlider event identifiers") */ - static const wxChar *eventNames[] = + static const wxString eventNames[] = { - wxT("wxEVT_SCROLL_TOP"), - wxT("wxEVT_SCROLL_BOTTOM"), - wxT("wxEVT_SCROLL_LINEUP"), - wxT("wxEVT_SCROLL_LINEDOWN"), - wxT("wxEVT_SCROLL_PAGEUP"), - wxT("wxEVT_SCROLL_PAGEDOWN"), - wxT("wxEVT_SCROLL_THUMBTRACK"), - wxT("wxEVT_SCROLL_THUMBRELEASE"), - wxT("wxEVT_SCROLL_CHANGED") + "wxEVT_SCROLL_TOP", + "wxEVT_SCROLL_BOTTOM", + "wxEVT_SCROLL_LINEUP", + "wxEVT_SCROLL_LINEDOWN", + "wxEVT_SCROLL_PAGEUP", + "wxEVT_SCROLL_PAGEDOWN", + "wxEVT_SCROLL_THUMBTRACK", + "wxEVT_SCROLL_THUMBRELEASE", + "wxEVT_SCROLL_CHANGED" }; int index = eventType - wxEVT_SCROLL_TOP; @@ -722,12 +722,12 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event) should be added to the above eventNames array. */ wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames), - wxT("Unknown slider event") ); + "Unknown slider event" ); static int s_numSliderEvents = 0; - wxLogMessage(wxT("Slider event #%d: %s (pos = %d, int value = %d)"), + wxLogMessage("Slider event #%d: %s (pos = %d, int value = %d)", s_numSliderEvents++, eventNames[index], event.GetPosition(), diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 391160fff6..b86f477fdf 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -211,7 +211,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, wxT("Spin"), +IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, "Spin", FAMILY_CTRLS | EDITABLE_CTRLS ); @@ -245,25 +245,25 @@ void SpinBtnWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set style"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Vertical")); - m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Arrow Keys")); - m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Wrap")); + m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, "&Vertical"); + m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, "&Arrow Keys"); + m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, "&Wrap"); m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeft, - wxT("Process &Enter")); + "Process &Enter"); sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer static const wxString halign[] = { - wxT("left"), - wxT("centre"), - wxT("right"), + "left", + "centre", + "right", }; - m_radioAlign = new wxRadioBox(this, wxID_ANY, wxT("&Text alignment"), + m_radioAlign = new wxRadioBox(this, wxID_ANY, "&Text alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign, 1); @@ -271,17 +271,17 @@ void SpinBtnWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - wxButton *btn = new wxButton(this, SpinBtnPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, SpinBtnPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, - wxT("&Change spinbtn value")); + "&Change spinbtn value"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxTextCtrl *text; - wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"), + wxSizer *sizerRow = CreateSizerWithTextAndLabel("Current value", SpinBtnPage_CurValueText, &text); text->SetEditable(false); @@ -289,21 +289,21 @@ void SpinBtnWidgetsPage::CreateContent() sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetValue, - wxT("Set &value"), + "Set &value", SpinBtnPage_ValueText, &m_textValue); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetMinAndMax, - wxT("&Min and max"), + "&Min and max", SpinBtnPage_MinText, &m_textMin); m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, wxEmptyString); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); - m_textMin->SetValue( wxString::Format(wxT("%d"), m_min) ); - m_textMax->SetValue( wxString::Format(wxT("%d"), m_max) ); + m_textMin->SetValue( wxString::Format("%d", m_min) ); + m_textMax->SetValue( wxString::Format("%d", m_max) ); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -367,7 +367,7 @@ void SpinBtnWidgetsPage::CreateSpin() switch ( m_radioAlign->GetSelection() ) { default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case Align_Left: @@ -403,28 +403,28 @@ void SpinBtnWidgetsPage::CreateSpin() m_spinbtn->SetRange(m_min, m_max); m_spinctrl = new wxSpinCtrl(this, SpinBtnPage_SpinCtrl, - wxString::Format(wxT("%d"), val), + wxString::Format("%d", val), wxDefaultPosition, wxDefaultSize, flags | textFlags, m_min, m_max, val); m_spinctrldbl = new wxSpinCtrlDouble(this, SpinBtnPage_SpinCtrlDouble, - wxString::Format(wxT("%d"), val), + wxString::Format("%d", val), wxDefaultPosition, wxDefaultSize, flags | textFlags, m_min, m_max, val, 0.1); // Add spacers, labels and spin controls to the sizer. m_sizerSpin->Add(0, 0, 1); - m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinButton")), + m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinButton"), 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinbtn, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(0, 0, 1); - m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinCtrl")), + m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrl"), 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinctrl, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(0, 0, 1); - m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, wxT("wxSpinCtrlDouble")), + m_sizerSpin->Add(new wxStaticText(this, wxID_ANY, "wxSpinCtrlDouble"), 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(m_spinctrldbl, 0, wxALIGN_CENTRE | wxALL, 5); m_sizerSpin->Add(0, 0, 1); @@ -451,7 +451,7 @@ void SpinBtnWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event)) !m_textMax->GetValue().ToLong(&maxNew) || minNew > maxNew ) { - wxLogWarning(wxT("Invalid min/max values for the spinbtn.")); + wxLogWarning("Invalid min/max values for the spinbtn."); return; } @@ -498,7 +498,7 @@ void SpinBtnWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event)) long val; if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) ) { - wxLogWarning(wxT("Invalid spinbtn value.")); + wxLogWarning("Invalid spinbtn value."); return; } @@ -542,7 +542,7 @@ void SpinBtnWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void SpinBtnWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event) { - event.SetText( wxString::Format(wxT("%d"), m_spinbtn->GetValue())); + event.SetText( wxString::Format("%d", m_spinbtn->GetValue())); } void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event) @@ -550,20 +550,20 @@ void SpinBtnWidgetsPage::OnSpinBtn(wxSpinEvent& event) int value = event.GetInt(); wxASSERT_MSG( value == m_spinbtn->GetValue(), - wxT("spinbtn value should be the same") ); + "spinbtn value should be the same" ); - wxLogMessage(wxT("Spin button value changed, now %d"), value); + wxLogMessage("Spin button value changed, now %d", value); } void SpinBtnWidgetsPage::OnSpinBtnUp(wxSpinEvent& event) { - wxLogMessage( wxT("Spin button value incremented, will be %d (was %d)"), + wxLogMessage( "Spin button value incremented, will be %d (was %d)", event.GetInt(), m_spinbtn->GetValue() ); } void SpinBtnWidgetsPage::OnSpinBtnDown(wxSpinEvent& event) { - wxLogMessage( wxT("Spin button value decremented, will be %d (was %d)"), + wxLogMessage( "Spin button value decremented, will be %d (was %d)", event.GetInt(), m_spinbtn->GetValue() ); } @@ -572,21 +572,21 @@ void SpinBtnWidgetsPage::OnSpinCtrl(wxSpinEvent& event) int value = event.GetInt(); wxASSERT_MSG( value == m_spinctrl->GetValue(), - wxT("spinctrl value should be the same") ); + "spinctrl value should be the same" ); - wxLogMessage(wxT("Spin control value changed, now %d"), value); + wxLogMessage("Spin control value changed, now %d", value); } void SpinBtnWidgetsPage::OnSpinCtrlDouble(wxSpinDoubleEvent& event) { double value = event.GetValue(); - wxLogMessage(wxT("Spin control value changed, now %g"), value); + wxLogMessage("Spin control value changed, now %g", value); } void SpinBtnWidgetsPage::OnSpinText(wxCommandEvent& event) { - wxLogMessage(wxT("Text changed in spin control, now \"%s\""), + wxLogMessage("Text changed in spin control, now \"%s\"", event.GetString().c_str()); } diff --git a/samples/widgets/statbmp.cpp b/samples/widgets/statbmp.cpp index 97ebb97030..c1842beb74 100644 --- a/samples/widgets/statbmp.cpp +++ b/samples/widgets/statbmp.cpp @@ -62,7 +62,7 @@ private: void OnMouseEvent(wxMouseEvent& WXUNUSED(event)) { - wxLogMessage(wxT("wxStaticBitmap clicked.")); + wxLogMessage("wxStaticBitmap clicked."); } wxStaticBitmapBase *m_statbmp; @@ -74,7 +74,7 @@ private: DECLARE_WIDGETS_PAGE(StatBmpWidgetsPage) }; -IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, wxT("StaticBitmap"), +IMPLEMENT_WIDGETS_PAGE(StatBmpWidgetsPage, "StaticBitmap", ALL_CTRLS); void StatBmpWidgetsPage::CreateContent() @@ -92,12 +92,12 @@ void StatBmpWidgetsPage::CreateContent() wxString testImage; #if wxUSE_LIBPNG wxPathList pathlist; - pathlist.Add(wxT(".")); - pathlist.Add(wxT("..")); - pathlist.Add(wxT("../image")); - pathlist.Add(wxT("../../../samples/image")); + pathlist.Add("."); + pathlist.Add(".."); + pathlist.Add("../image"); + pathlist.Add("../../../samples/image"); - wxFileName fn(pathlist.FindValidPath(wxT("toucan.png"))); + wxFileName fn(pathlist.FindValidPath("toucan.png")); if ( fn.FileExists() ) testImage = fn.GetFullPath(); #endif // wxUSE_LIBPNG diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index 143205238d..5ae946b9f8 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -200,7 +200,7 @@ wxEND_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, wxT("Static"), +IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, "Static", (int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS) ); @@ -260,22 +260,22 @@ void StaticWidgetsPage::CreateContent() static const wxString halign[] = { - wxT("left"), - wxT("centre"), - wxT("right"), + "left", + "centre", + "right", }; static const wxString valign[] = { - wxT("top"), - wxT("centre"), - wxT("bottom"), + "top", + "centre", + "bottom", }; - m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign, 3); - m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign, 3); @@ -285,23 +285,23 @@ void StaticWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Ellipsize")); + m_chkEllipsize = CreateCheckBoxAndAddToSizer(sizerLeft, "&Ellipsize"); static const wxString ellipsizeMode[] = { - wxT("&start"), - wxT("&middle"), - wxT("&end"), + "&start", + "&middle", + "&end", }; - m_radioEllipsize = new wxRadioBox(this, wxID_ANY, wxT("&Ellipsize mode"), + m_radioEllipsize = new wxRadioBox(this, wxID_ANY, "&Ellipsize mode", wxDefaultPosition, wxDefaultSize, WXSIZEOF(ellipsizeMode), ellipsizeMode, 3); sizerLeft->Add(m_radioEllipsize, 0, wxGROW | wxALL, 5); - wxButton *btn = new wxButton(this, StaticPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, StaticPage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane @@ -340,14 +340,14 @@ void StaticWidgetsPage::CreateContent() // NB: must be done _before_ calling CreateStatic() Reset(); - m_textBox->SetValue(wxT("This is a &box")); - m_textLabel->SetValue(wxT("And this is a\n\tlabel inside the box with a &mnemonic.\n") - wxT("Only this text is affected by the ellipsize settings.")); + m_textBox->SetValue("This is a &box"); + m_textLabel->SetValue("And this is a\n\tlabel inside the box with a &mnemonic.\n" + "Only this text is affected by the ellipsize settings."); #if wxUSE_MARKUP - m_textLabelWithMarkup->SetValue(wxT("Another label, this time decorated ") - wxT("with markup; here you need entities ") - wxT("for the symbols: < > & ' " ") - wxT(" but you can still place &mnemonics...")); + m_textLabelWithMarkup->SetValue("Another label, this time decorated " + "with markup; here you need entities " + "for the symbols: < > & ' " " + " but you can still place &mnemonics..."); #endif // wxUSE_MARKUP // right pane @@ -416,7 +416,7 @@ void StaticWidgetsPage::CreateStatic() switch ( m_radioHAlign->GetSelection() ) { default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case StaticHAlign_Left: @@ -435,7 +435,7 @@ void StaticWidgetsPage::CreateStatic() switch ( m_radioVAlign->GetSelection() ) { default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case StaticVAlign_Top: @@ -456,7 +456,7 @@ void StaticWidgetsPage::CreateStatic() switch ( m_radioEllipsize->GetSelection() ) { default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case StaticEllipsize_Start: @@ -603,9 +603,9 @@ void StaticWidgetsPage::OnButtonLabelText(wxCommandEvent& WXUNUSED(event)) // test GetLabel() and GetLabelText(); the first should return the // label as it is written in the relative text control; the second should // return the label as it's shown in the wxStaticText - wxLogMessage(wxT("The original label should be '%s'"), + wxLogMessage("The original label should be '%s'", m_statText->GetLabel()); - wxLogMessage(wxT("The label text is '%s'"), + wxLogMessage("The label text is '%s'", m_statText->GetLabelText()); } @@ -617,9 +617,9 @@ void StaticWidgetsPage::OnButtonLabelWithMarkupText(wxCommandEvent& WXUNUSED(eve // test GetLabel() and GetLabelText(); the first should return the // label as it is written in the relative text control; the second should // return the label as it's shown in the wxStaticText - wxLogMessage(wxT("The original label should be '%s'"), + wxLogMessage("The original label should be '%s'", m_statMarkup->GetLabel()); - wxLogMessage(wxT("The label text is '%s'"), + wxLogMessage("The label text is '%s'", m_statMarkup->GetLabelText()); } #endif // wxUSE_MARKUP diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index 96e5074954..4797c0100b 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -292,32 +292,32 @@ private: switch ( HitTest(event.GetPosition(), &x, &y) ) { default: - wxFAIL_MSG( wxT("unexpected HitTest() result") ); + wxFAIL_MSG( "unexpected HitTest() result" ); // fall through case wxTE_HT_UNKNOWN: x = y = -1; - where = wxT("nowhere near"); + where = "nowhere near"; break; case wxTE_HT_BEFORE: - where = wxT("before"); + where = "before"; break; case wxTE_HT_BELOW: - where = wxT("below"); + where = "below"; break; case wxTE_HT_BEYOND: - where = wxT("beyond"); + where = "beyond"; break; case wxTE_HT_ON_TEXT: - where = wxT("at"); + where = "at"; break; } - wxLogMessage(wxT("Mouse is %s (%ld, %ld)"), where.c_str(), x, y); + wxLogMessage("Mouse is %s (%ld, %ld)", where.c_str(), x, y); } }; @@ -366,7 +366,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, wxT("Text"), +IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, "Text", FAMILY_CTRLS | EDITABLE_CTRLS ); @@ -415,12 +415,12 @@ void TextWidgetsPage::CreateContent() // left pane static const wxString modes[] = { - wxT("single line"), - wxT("multi line"), + "single line", + "multi line", }; - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set textctrl parameters")); - m_radioTextLines = new wxRadioBox(this, wxID_ANY, wxT("&Number of lines:"), + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "&Set textctrl parameters"); + m_radioTextLines = new wxRadioBox(this, wxID_ANY, "&Number of lines:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(modes), modes, 1, wxRA_SPECIFY_COLS); @@ -431,22 +431,22 @@ void TextWidgetsPage::CreateContent() sizerLeft->AddSpacer(5); m_chkPassword = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("&Password control"), TextPage_Password + sizerLeft, "&Password control", TextPage_Password ); m_chkReadonly = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("&Read-only mode") + sizerLeft, "&Read-only mode" ); m_chkProcessEnter = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("Process &Enter") + sizerLeft, "Process &Enter" ); m_chkProcessTab = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("Process &Tab") + sizerLeft, "Process &Tab" ); m_chkFilename = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("&Filename control") + sizerLeft, "&Filename control" ); m_chkNoVertScrollbar = CreateCheckBoxAndAddToSizer( - sizerLeft, wxT("No &vertical scrollbar"), + sizerLeft, "No &vertical scrollbar", TextPage_NoVertScrollbar ); m_chkFilename->Disable(); // not implemented yet @@ -454,13 +454,13 @@ void TextWidgetsPage::CreateContent() static const wxString wrap[] = { - wxT("no wrap"), - wxT("word wrap"), - wxT("char wrap"), - wxT("best wrap"), + "no wrap", + "word wrap", + "char wrap", + "best wrap", }; - m_radioWrap = new wxRadioBox(this, TextPage_WrapLines, wxT("&Wrap style:"), + m_radioWrap = new wxRadioBox(this, TextPage_WrapLines, "&Wrap style:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(wrap), wrap, 1, wxRA_SPECIFY_COLS); @@ -481,12 +481,12 @@ void TextWidgetsPage::CreateContent() #ifdef __WXMSW__ static const wxString kinds[] = { - wxT("plain edit"), - wxT("rich edit"), - wxT("rich edit 2.0"), + "plain edit", + "rich edit", + "rich edit 2.0", }; - m_radioKind = new wxRadioBox(this, wxID_ANY, wxT("Control &kind"), + m_radioKind = new wxRadioBox(this, wxID_ANY, "Control &kind", wxDefaultPosition, wxDefaultSize, WXSIZEOF(kinds), kinds, 1, wxRA_SPECIFY_COLS); @@ -495,33 +495,33 @@ void TextWidgetsPage::CreateContent() sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5); #endif // __WXMSW__ - wxButton *btn = new wxButton(this, TextPage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, TextPage_Reset, "&Reset"); sizerLeft->Add(2, 2, 0, wxGROW | wxALL, 1); // spacer sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change contents:")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Change contents:"); wxSizer *sizerMiddleUp = new wxStaticBoxSizer(box2, wxVERTICAL); - btn = new wxButton(this, TextPage_Set, wxT("&Set text value")); + btn = new wxButton(this, TextPage_Set, "&Set text value"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - btn = new wxButton(this, TextPage_Add, wxT("&Append text")); + btn = new wxButton(this, TextPage_Add, "&Append text"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - btn = new wxButton(this, TextPage_Insert, wxT("&Insert text")); + btn = new wxButton(this, TextPage_Insert, "&Insert text"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - btn = new wxButton(this, TextPage_Load, wxT("&Load file")); + btn = new wxButton(this, TextPage_Load, "&Load file"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - btn = new wxButton(this, TextPage_Clear, wxT("&Clear")); + btn = new wxButton(this, TextPage_Clear, "&Clear"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - btn = new wxButton(this, TextPage_StreamRedirector, wxT("St&ream redirection")); + btn = new wxButton(this, TextPage_StreamRedirector, "St&ream redirection"); sizerMiddleUp->Add(btn, 0, wxALL | wxGROW, 1); - wxStaticBox *box4 = new wxStaticBox(this, wxID_ANY, wxT("&Info:")); + wxStaticBox *box4 = new wxStaticBox(this, wxID_ANY, "&Info:"); wxSizer *sizerMiddleDown = new wxStaticBoxSizer(box4, wxVERTICAL); m_textPosCur = CreateInfoText(); @@ -531,19 +531,19 @@ void TextWidgetsPage::CreateContent() wxSizer *sizerRow = new wxBoxSizer(wxHORIZONTAL); sizerRow->Add(CreateTextWithLabelSizer ( - wxT("Current pos:"), + "Current pos:", m_textPosCur ), 0, wxRIGHT, 5); sizerRow->Add(CreateTextWithLabelSizer ( - wxT("Col:"), + "Col:", m_textColCur ), 0, wxLEFT | wxRIGHT, 5); sizerRow->Add(CreateTextWithLabelSizer ( - wxT("Row:"), + "Row:", m_textRowCur ), 0, wxLEFT, 5); @@ -555,9 +555,9 @@ void TextWidgetsPage::CreateContent() ( CreateTextWithLabelSizer ( - wxT("Number of lines:"), + "Number of lines:", m_textLineLast, - wxT("Last position:"), + "Last position:", m_textPosLast ), 0, wxALL, 5 @@ -569,9 +569,9 @@ void TextWidgetsPage::CreateContent() ( CreateTextWithLabelSizer ( - wxT("Selection: from"), + "Selection: from", m_textSelFrom, - wxT("to"), + "to", m_textSelTo ), 0, wxALL, 5 @@ -584,7 +584,7 @@ void TextWidgetsPage::CreateContent() ( CreateTextWithLabelSizer ( - wxT("Range 10..20:"), + "Range 10..20:", m_textRange ), 0, wxALL, 5 @@ -606,7 +606,7 @@ void TextWidgetsPage::CreateContent() sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 5); // right pane - wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, wxT("&Text:")); + wxStaticBox *box3 = new wxStaticBox(this, wxID_ANY, "&Text:"); m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL); Reset(); CreateText(); @@ -631,7 +631,7 @@ wxTextCtrl *TextWidgetsPage::CreateInfoText() if ( !s_maxWidth ) { // calc it once only - GetTextExtent(wxT("9999999"), &s_maxWidth, NULL); + GetTextExtent("9999999", &s_maxWidth, NULL); } wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, @@ -689,7 +689,7 @@ void TextWidgetsPage::CreateText() switch ( m_radioTextLines->GetSelection() ) { default: - wxFAIL_MSG( wxT("unexpected lines radio box selection") ); + wxFAIL_MSG( "unexpected lines radio box selection" ); case TextLines_Single: break; @@ -714,7 +714,7 @@ void TextWidgetsPage::CreateText() switch ( m_radioWrap->GetSelection() ) { default: - wxFAIL_MSG( wxT("unexpected wrap style radio box selection") ); + wxFAIL_MSG( "unexpected wrap style radio box selection" ); wxFALLTHROUGH; case WrapStyle_None: @@ -754,7 +754,7 @@ void TextWidgetsPage::CreateText() switch ( m_radioKind->GetSelection() ) { default: - wxFAIL_MSG( wxT("unexpected kind radio box selection") ); + wxFAIL_MSG( "unexpected kind radio box selection" ); case TextKind_Plain: break; @@ -779,7 +779,7 @@ void TextWidgetsPage::CreateText() } else { - valueOld = wxT("Hello, Universe!"); + valueOld = "Hello, Universe!"; } m_text = new WidgetsTextCtrl(this, TextPage_Textctrl, valueOld, flags); @@ -839,7 +839,7 @@ void TextWidgetsPage::OnIdle(wxIdleEvent& WXUNUSED(event)) if ( m_textLineLast ) { m_textLineLast->SetValue( - wxString::Format(wxT("%d"), m_text->GetNumberOfLines()) ); + wxString::Format("%d", m_text->GetNumberOfLines()) ); } if ( m_textSelFrom && m_textSelTo ) @@ -884,8 +884,8 @@ void TextWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void TextWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event)) { m_text->SetValue(m_text->GetWindowStyle() & wxTE_MULTILINE - ? wxT("Here,\nthere and\neverywhere") - : wxT("Yellow submarine")); + ? "Here,\nthere and\neverywhere" + : "Yellow submarine"); m_text->SetFocus(); } @@ -894,18 +894,18 @@ void TextWidgetsPage::OnButtonAdd(wxCommandEvent& WXUNUSED(event)) { if ( m_text->GetWindowStyle() & wxTE_MULTILINE ) { - m_text->AppendText(wxT("We all live in a\n")); + m_text->AppendText("We all live in a\n"); } - m_text->AppendText(wxT("Yellow submarine")); + m_text->AppendText("Yellow submarine"); } void TextWidgetsPage::OnButtonInsert(wxCommandEvent& WXUNUSED(event)) { - m_text->WriteText(wxT("Is there anybody going to listen to my story")); + m_text->WriteText("Is there anybody going to listen to my story"); if ( m_text->GetWindowStyle() & wxTE_MULTILINE ) { - m_text->WriteText(wxT("\nall about the girl who came to stay")); + m_text->WriteText("\nall about the girl who came to stay"); } } @@ -919,15 +919,15 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event)) { // search for the file in several dirs where it's likely to be wxPathList pathlist; - pathlist.Add(wxT(".")); - pathlist.Add(wxT("..")); - pathlist.Add(wxT("../widgets")); - pathlist.Add(wxT("../../../samples/widgets")); + pathlist.Add("."); + pathlist.Add(".."); + pathlist.Add("../widgets"); + pathlist.Add("../../../samples/widgets"); - wxString filename = pathlist.FindValidPath(wxT("textctrl.cpp")); + wxString filename = pathlist.FindValidPath("textctrl.cpp"); if ( !filename ) { - wxLogError(wxT("File textctrl.cpp not found.")); + wxLogError("File textctrl.cpp not found."); } else // load it { @@ -935,12 +935,12 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event)) if ( !m_text->LoadFile(filename) ) { // this is not supposed to happen ... - wxLogError(wxT("Error loading file.")); + wxLogError("Error loading file."); } else { long elapsed = sw.Time(); - wxLogMessage(wxT("Loaded file '%s' in %lu.%us"), + wxLogMessage("Loaded file '%s' in %lu.%us", filename.c_str(), elapsed / 1000, (unsigned int) elapsed % 1000); } @@ -996,12 +996,12 @@ void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event)) return; } - wxLogMessage(wxT("Text ctrl value changed")); + wxLogMessage("Text ctrl value changed"); } void TextWidgetsPage::OnTextEnter(wxCommandEvent& event) { - wxLogMessage(wxT("Text entered: '%s'"), event.GetString().c_str()); + wxLogMessage("Text entered: '%s'", event.GetString().c_str()); event.Skip(); } @@ -1058,9 +1058,9 @@ void TextWidgetsPage::OnStreamRedirector(wxCommandEvent& WXUNUSED(event)) { #if wxHAS_TEXT_WINDOW_STREAM wxStreamToTextRedirector redirect(m_text); - wxString str( wxT("Outputed to cout, appears in wxTextCtrl!") ); + wxString str( "Outputed to cout, appears in wxTextCtrl!" ); wxSTD cout << str << wxSTD endl; #else - wxMessageBox(wxT("This wxWidgets build does not support wxStreamToTextRedirector")); + wxMessageBox("This wxWidgets build does not support wxStreamToTextRedirector"); #endif } diff --git a/samples/widgets/timepick.cpp b/samples/widgets/timepick.cpp index b8c0572b9a..303aee3f5d 100644 --- a/samples/widgets/timepick.cpp +++ b/samples/widgets/timepick.cpp @@ -119,7 +119,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS GENERIC_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(TimePickerWidgetsPage, wxT("TimePicker"), +IMPLEMENT_WIDGETS_PAGE(TimePickerWidgetsPage, "TimePicker", FAMILY_CTRLS | PICKER_CTRLS ); diff --git a/samples/widgets/toggle.cpp b/samples/widgets/toggle.cpp index 1bbdcab0ef..83289037bc 100644 --- a/samples/widgets/toggle.cpp +++ b/samples/widgets/toggle.cpp @@ -175,7 +175,7 @@ wxEND_EVENT_TABLE() #define FAMILY_CTRLS NATIVE_CTRLS #endif -IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, wxT("ToggleButton"), +IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, "ToggleButton", FAMILY_CTRLS ); @@ -213,14 +213,14 @@ void ToggleWidgetsPage::CreateContent() wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("Styles")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, "Styles"); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); #ifdef wxHAS_BITMAPTOGGLEBUTTON m_chkBitmapOnly = CreateCheckBoxAndAddToSizer(sizerLeft, "&Bitmap only"); m_chkTextAndBitmap = CreateCheckBoxAndAddToSizer(sizerLeft, "Text &and bitmap"); - m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Fit exactly")); + m_chkFit = CreateCheckBoxAndAddToSizer(sizerLeft, "&Fit exactly"); #endif // wxHAS_BITMAPTOGGLEBUTTON #if wxUSE_MARKUP m_chkUseMarkup = CreateCheckBoxAndAddToSizer(sizerLeft, "Interpret &markup"); @@ -261,22 +261,22 @@ void ToggleWidgetsPage::CreateContent() // should be in sync with enums Toggle[HV]Align! static const wxString halign[] = { - wxT("left"), - wxT("centre"), - wxT("right"), + "left", + "centre", + "right", }; static const wxString valign[] = { - wxT("top"), - wxT("centre"), - wxT("bottom"), + "top", + "centre", + "bottom", }; - m_radioHAlign = new wxRadioBox(this, wxID_ANY, wxT("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, "&Horz alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign); - m_radioVAlign = new wxRadioBox(this, wxID_ANY, wxT("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, "&Vert alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign); @@ -286,18 +286,18 @@ void ToggleWidgetsPage::CreateContent() sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer - wxButton *btn = new wxButton(this, TogglePage_Reset, wxT("&Reset")); + wxButton *btn = new wxButton(this, TogglePage_Reset, "&Reset"); sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Operations")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, "&Operations"); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = CreateSizerWithTextAndButton(TogglePage_ChangeLabel, - wxT("Change label"), + "Change label", wxID_ANY, &m_textLabel); - m_textLabel->SetValue(wxT("&Toggle me!")); + m_textLabel->SetValue("&Toggle me!"); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -378,7 +378,7 @@ void ToggleWidgetsPage::CreateToggle() break; default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case ToggleHAlign_Centre: @@ -396,7 +396,7 @@ void ToggleWidgetsPage::CreateToggle() break; default: - wxFAIL_MSG(wxT("unexpected radiobox selection")); + wxFAIL_MSG("unexpected radiobox selection"); // fall through case ToggleVAlign_Centre: @@ -419,22 +419,22 @@ void ToggleWidgetsPage::CreateToggle() if ( m_chkUseBitmapClass->GetValue() ) { btgl = new wxBitmapToggleButton(this, TogglePage_Picker, - CreateBitmap(wxT("normal"))); + CreateBitmap("normal")); } else { - btgl = new wxToggleButton(this, TogglePage_Picker, wxT("")); - btgl->SetBitmapLabel(CreateBitmap(wxT("normal"))); + btgl = new wxToggleButton(this, TogglePage_Picker, ""); + btgl->SetBitmapLabel(CreateBitmap("normal")); } #ifdef wxHAS_ANY_BUTTON if ( m_chkUsePressed->GetValue() ) - btgl->SetBitmapPressed(CreateBitmap(wxT("pushed"))); + btgl->SetBitmapPressed(CreateBitmap("pushed")); if ( m_chkUseFocused->GetValue() ) - btgl->SetBitmapFocus(CreateBitmap(wxT("focused"))); + btgl->SetBitmapFocus(CreateBitmap("focused")); if ( m_chkUseCurrent->GetValue() ) - btgl->SetBitmapCurrent(CreateBitmap(wxT("hover"))); + btgl->SetBitmapCurrent(CreateBitmap("hover")); if ( m_chkUseDisabled->GetValue() ) - btgl->SetBitmapDisabled(CreateBitmap(wxT("disabled"))); + btgl->SetBitmapDisabled(CreateBitmap("disabled")); #endif // wxHAS_ANY_BUTTON m_toggle = btgl; } @@ -527,8 +527,8 @@ wxBitmap ToggleWidgetsPage::CreateBitmap(const wxString& label) dc.SetBackground(*wxCYAN_BRUSH); dc.Clear(); dc.SetTextForeground(*wxBLACK); - dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + wxT("\n") - wxT("(") + label + wxT(" state)"), + dc.DrawLabel(wxStripMenuCodes(m_textLabel->GetValue()) + "\n" + "(" + label + " state)", wxArtProvider::GetBitmap(wxART_INFORMATION), wxRect(10, 10, bmp.GetWidth() - 20, bmp.GetHeight() - 20), wxALIGN_CENTRE); diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index c14cadcc26..63eee2c2f8 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -357,22 +357,22 @@ bool WidgetsApp::OnInit() // this sample side by side and it is useful to see which one is which wxString title; #if defined(__WXUNIVERSAL__) - title = wxT("wxUniv/"); + title = "wxUniv/"; #endif #if defined(__WXMSW__) - title += wxT("wxMSW"); + title += "wxMSW"; #elif defined(__WXGTK__) - title += wxT("wxGTK"); + title += "wxGTK"; #elif defined(__WXMAC__) - title += wxT("wxMAC"); + title += "wxMAC"; #elif defined(__WXMOTIF__) - title += wxT("wxMOTIF"); + title += "wxMOTIF"; #else - title += wxT("wxWidgets"); + title += "wxWidgets"; #endif - wxFrame *frame = new WidgetsFrame(title + wxT(" widgets demo")); + wxFrame *frame = new WidgetsFrame(title + " widgets demo"); frame->Show(); return true; @@ -400,25 +400,25 @@ WidgetsFrame::WidgetsFrame(const wxString& title) wxMenuBar *mbar = new wxMenuBar; wxMenu *menuWidget = new wxMenu; #if wxUSE_TOOLTIPS - menuWidget->Append(Widgets_SetTooltip, wxT("Set &tooltip...\tCtrl-T")); + menuWidget->Append(Widgets_SetTooltip, "Set &tooltip...\tCtrl-T"); menuWidget->AppendSeparator(); #endif // wxUSE_TOOLTIPS - menuWidget->Append(Widgets_SetFgColour, wxT("Set &foreground...\tCtrl-F")); - menuWidget->Append(Widgets_SetBgColour, wxT("Set &background...\tCtrl-B")); - menuWidget->Append(Widgets_SetPageBg, wxT("Set &page background...\tShift-Ctrl-B")); - menuWidget->Append(Widgets_SetFont, wxT("Set f&ont...\tCtrl-O")); - menuWidget->AppendCheckItem(Widgets_Enable, wxT("&Enable/disable\tCtrl-E")); - menuWidget->AppendCheckItem(Widgets_Show, wxT("Show/Hide")); + menuWidget->Append(Widgets_SetFgColour, "Set &foreground...\tCtrl-F"); + menuWidget->Append(Widgets_SetBgColour, "Set &background...\tCtrl-B"); + menuWidget->Append(Widgets_SetPageBg, "Set &page background...\tShift-Ctrl-B"); + menuWidget->Append(Widgets_SetFont, "Set f&ont...\tCtrl-O"); + menuWidget->AppendCheckItem(Widgets_Enable, "&Enable/disable\tCtrl-E"); + menuWidget->AppendCheckItem(Widgets_Show, "Show/Hide"); wxMenu *menuBorders = new wxMenu; - menuBorders->AppendRadioItem(Widgets_BorderDefault, wxT("De&fault\tCtrl-Shift-9")); - menuBorders->AppendRadioItem(Widgets_BorderNone, wxT("&None\tCtrl-Shift-0")); - menuBorders->AppendRadioItem(Widgets_BorderSimple, wxT("&Simple\tCtrl-Shift-1")); - menuBorders->AppendRadioItem(Widgets_BorderDouble, wxT("&Double\tCtrl-Shift-2")); - menuBorders->AppendRadioItem(Widgets_BorderStatic, wxT("Stati&c\tCtrl-Shift-3")); - menuBorders->AppendRadioItem(Widgets_BorderRaised, wxT("&Raised\tCtrl-Shift-4")); - menuBorders->AppendRadioItem(Widgets_BorderSunken, wxT("S&unken\tCtrl-Shift-5")); - menuWidget->AppendSubMenu(menuBorders, wxT("Set &border")); + menuBorders->AppendRadioItem(Widgets_BorderDefault, "De&fault\tCtrl-Shift-9"); + menuBorders->AppendRadioItem(Widgets_BorderNone, "&None\tCtrl-Shift-0"); + menuBorders->AppendRadioItem(Widgets_BorderSimple, "&Simple\tCtrl-Shift-1"); + menuBorders->AppendRadioItem(Widgets_BorderDouble, "&Double\tCtrl-Shift-2"); + menuBorders->AppendRadioItem(Widgets_BorderStatic, "Stati&c\tCtrl-Shift-3"); + menuBorders->AppendRadioItem(Widgets_BorderRaised, "&Raised\tCtrl-Shift-4"); + menuBorders->AppendRadioItem(Widgets_BorderSunken, "S&unken\tCtrl-Shift-5"); + menuWidget->AppendSubMenu(menuBorders, "Set &border"); wxMenu* const menuVariants = new wxMenu; menuVariants->AppendRadioItem(Widgets_VariantMini, "&Mini\tCtrl-Shift-6"); @@ -433,31 +433,31 @@ WidgetsFrame::WidgetsFrame(const wxString& title) menuWidget->AppendSeparator(); menuWidget->AppendCheckItem(Widgets_GlobalBusyCursor, - wxT("Toggle &global busy cursor\tCtrl-Shift-U")); + "Toggle &global busy cursor\tCtrl-Shift-U"); menuWidget->AppendCheckItem(Widgets_BusyCursor, - wxT("Toggle b&usy cursor\tCtrl-U")); + "Toggle b&usy cursor\tCtrl-U"); menuWidget->AppendSeparator(); - menuWidget->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q")); - mbar->Append(menuWidget, wxT("&Widget")); + menuWidget->Append(wxID_EXIT, "&Quit\tCtrl-Q"); + mbar->Append(menuWidget, "&Widget"); wxMenu *menuTextEntry = new wxMenu; menuTextEntry->AppendRadioItem(TextEntry_DisableAutoComplete, - wxT("&Disable auto-completion")); + "&Disable auto-completion"); menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFixed, - wxT("Fixed-&list auto-completion")); + "Fixed-&list auto-completion"); menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFilenames, - wxT("&Files names auto-completion")); + "&Files names auto-completion"); menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteDirectories, - wxT("&Directories names auto-completion")); + "&Directories names auto-completion"); menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteCustom, - wxT("&Custom auto-completion")); + "&Custom auto-completion"); menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteKeyLength, - wxT("Custom with &min length")); + "Custom with &min length"); menuTextEntry->AppendSeparator(); menuTextEntry->Append(TextEntry_SetHint, "Set help &hint"); - mbar->Append(menuTextEntry, wxT("&Text")); + mbar->Append(menuTextEntry, "&Text"); SetMenuBar(mbar); @@ -488,7 +488,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title) // the lower one only has the log listbox and a button to clear it #if USE_LOG wxSizer *sizerDown = new wxStaticBoxSizer( - new wxStaticBox( m_panel, wxID_ANY, wxT("&Log window") ), + new wxStaticBox( m_panel, wxID_ANY, "&Log window" ), wxVERTICAL); m_lboxLog = new wxListBox(m_panel, wxID_ANY); @@ -501,11 +501,11 @@ WidgetsFrame::WidgetsFrame(const wxString& title) wxBoxSizer *sizerBtns = new wxBoxSizer(wxHORIZONTAL); wxButton *btn; #if USE_LOG - btn = new wxButton(m_panel, Widgets_ClearLog, wxT("Clear &log")); + btn = new wxButton(m_panel, Widgets_ClearLog, "Clear &log"); sizerBtns->Add(btn); sizerBtns->Add(10, 0); // spacer #endif // USE_LOG - btn = new wxButton(m_panel, Widgets_Quit, wxT("E&xit")); + btn = new wxButton(m_panel, Widgets_Quit, "E&xit"); sizerBtns->Add(btn); sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5); @@ -601,7 +601,7 @@ void WidgetsFrame::InitBook() } } - GetMenuBar()->Append(menuPages, wxT("&Page")); + GetMenuBar()->Append(menuPages, "&Page"); m_book->AssignImageList(imageList); @@ -664,7 +664,7 @@ WidgetsPage *WidgetsFrame::CurrentPage() #if !USE_TREEBOOK WidgetsBookCtrl *subBook = wxStaticCast(page, WidgetsBookCtrl); - wxCHECK_MSG( subBook, NULL, wxT("no WidgetsBookCtrl?") ); + wxCHECK_MSG( subBook, NULL, "no WidgetsBookCtrl?" ); page = subBook->GetCurrentPage(); #endif // !USE_TREEBOOK @@ -771,8 +771,8 @@ void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event)) wxTextEntryDialog dialog ( this, - wxT("Tooltip text (may use \\n, leave empty to remove): "), - wxT("Widgets sample"), + "Tooltip text (may use \\n, leave empty to remove): ", + "Widgets sample", WidgetsPage::GetAttrs().m_tooltip ); @@ -780,7 +780,7 @@ void WidgetsFrame::OnSetTooltip(wxCommandEvent& WXUNUSED(event)) return; WidgetsPage::GetAttrs().m_tooltip = dialog.GetValue(); - WidgetsPage::GetAttrs().m_tooltip.Replace(wxT("\\n"), wxT("\n")); + WidgetsPage::GetAttrs().m_tooltip.Replace("\\n", "\n"); CurrentPage()->SetUpWidget(); } @@ -870,7 +870,7 @@ void WidgetsFrame::OnSetFont(wxCommandEvent& WXUNUSED(event)) // so re-layout to show it correctly. page->Layout(); #else - wxLogMessage(wxT("Font selection dialog not available in current build.")); + wxLogMessage("Font selection dialog not available in current build."); #endif } @@ -901,7 +901,7 @@ void WidgetsFrame::OnSetBorder(wxCommandEvent& event) case Widgets_BorderDouble: border = wxBORDER_DOUBLE; break; default: - wxFAIL_MSG( wxT("unknown border style") ); + wxFAIL_MSG( "unknown border style" ); // fall through case Widgets_BorderDefault: border = wxBORDER_DEFAULT; break; @@ -1210,7 +1210,7 @@ void WidgetsFrame::OnWidgetFocus(wxFocusEvent& event) // WidgetsPageInfo // ---------------------------------------------------------------------------- -WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label, int categories) +WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxString& label, int categories) : m_label(label) , m_categories(categories) { diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index 65d7708133..c632fffe6c 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -197,7 +197,7 @@ public: wxImageList *imaglist); // our ctor - WidgetsPageInfo(Constructor ctor, const wxChar *label, int categories); + WidgetsPageInfo(Constructor ctor, const wxString& label, int categories); // accessors const wxString& GetLabel() const { return m_label; } diff --git a/samples/xti/codereadercallback.cpp b/samples/xti/codereadercallback.cpp index e2a1d187b4..f48e61c348 100644 --- a/samples/xti/codereadercallback.cpp +++ b/samples/xti/codereadercallback.cpp @@ -90,7 +90,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class { // add corresponding header if not already included wxString include; - include.Printf(wxT("#include \"%s\"\n"),classInfo->GetIncludeName()); + include.Printf("#include \"%s\"\n",classInfo->GetIncludeName()); if ( m_headerincludes.Find(include) == wxNOT_FOUND) m_headerincludes += include; } @@ -155,12 +155,12 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m ) } else { - wxLogError ( _("Internal error, illegal wxCustomTypeInfo") ); + wxLogError ( "Internal error, illegal wxCustomTypeInfo" ); } } else if ( type->GetKind() == wxT_STRING ) { - value.Printf( wxT("\"%s\""), wxAnyGetAsString(param).c_str() ); + value.Printf( "\"%s\"", wxAnyGetAsString(param).c_str() ); } else if ( type->GetKind() == wxT_OBJECT ) { From ec5aacd2707e1b1379fa1b6076e01b47f799505e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 17:16:45 +0200 Subject: [PATCH 020/231] Define canonical email address for Blake Eryx --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index 3a58332ba7..3754838473 100644 --- a/.mailmap +++ b/.mailmap @@ -1,6 +1,7 @@ ARATA Mizuki Artur Wieczorek Daniel Kulp +Blake Eryx Bogdan Iordanescu Cătălin Răceanu From 829f181ccd4e2fda21cf493dc331b4a2112e1c87 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Sun, 23 Sep 2018 16:18:16 +0300 Subject: [PATCH 021/231] Get preferred UI languages from the LANGUAGE variable on *nix Obey the LANGUAGE environment variable (if set), which is GNU gettext's primary way of determining language preference. Apparently ignored by wx until now, even though wx attempts to be a reimplementation of GNU gettext. The LANGUAGE variable may contain a list of preferred languages, so use that list to find the best translation. GNU gettext has supported multiple preferred languages since forever (at least 15 years), and therefore it is odd that this wasn't already implemented in 01f953efb211daf5275cbb10aa3dd000eeed6d48. Instead, it was implied that Unix does not support such. (Even if GNU is not Unix, nothing stops a wxWidgets app supporting such nevertheless.) Closes https://github.com/wxWidgets/wxWidgets/pull/948 --- src/common/translation.cpp | 50 +++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/common/translation.cpp b/src/common/translation.cpp index b092eaa9f9..bf92ed2942 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -248,9 +248,53 @@ wxString GetPreferredUILanguage(const wxArrayString& available) #else -// On Unix, there's just one language=locale setting, so we should always -// use that. -#define GetPreferredUILanguage GetPreferredUILanguageFallback +// When the preferred UI language is determined, the LANGUAGE environment +// variable is the primary source of preference. +// http://www.gnu.org/software/gettext/manual/html_node/Locale-Environment-Variables.html +// +// The LANGUAGE variable may contain a colon separated list of language +// codes in the order of preference. +// http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html +wxString GetPreferredUILanguage(const wxArrayString& available) +{ + wxString languageFromEnv; + wxArrayString preferred; + if ( wxGetEnv("LANGUAGE", &languageFromEnv) ) + { + wxStringTokenizer tknzr(languageFromEnv, ":"); + while ( tknzr.HasMoreTokens() ) + { + const wxString tok = tknzr.GetNextToken(); + if ( const wxLanguageInfo *li = wxLocale::FindLanguageInfo(tok) ) + { + preferred.push_back(li->CanonicalName); + } + } + if ( preferred.empty() ) + { + wxLogTrace(TRACE_I18N, " - LANGUAGE was set, but it didn't contain any languages recognized by the system"); + } + } + + LogTraceArray(" - preferred languages from environment", preferred); + for ( wxArrayString::const_iterator j = preferred.begin(); + j != preferred.end(); + ++j ) + { + wxString lang(*j); + if ( available.Index(lang) != wxNOT_FOUND ) + return lang; + size_t pos = lang.find('_'); + if ( pos != wxString::npos ) + { + lang = lang.substr(0, pos); + if ( available.Index(lang) != wxNOT_FOUND ) + return lang; + } + } + + return GetPreferredUILanguageFallback(available); +} #endif From a8ac1e3240125ae903711e5347fb597967529939 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:30:53 +0200 Subject: [PATCH 022/231] Graphics benchmark compilation fix under Unix Only use wxMSW-specific wxBitmap::UseAlpha() when using this port. See 7ddb522ec2040eb0fb6472b104a19c727350ef7e --- tests/benchmarks/graphics.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index fd361bbffa..2d54a8adc8 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -152,7 +152,9 @@ public: Connect(wxEVT_SIZE, wxSizeEventHandler(GraphicsBenchmarkFrame::OnSize)); m_bitmapARGB.Create(64, 64, 32); +#ifdef __WXMSW__ m_bitmapARGB.UseAlpha(true); +#endif // __WXMSW__ m_bitmapRGB.Create(64, 64, 24); m_renderer = NULL; @@ -320,8 +322,12 @@ private: BenchmarkDCAndGC("RGB memory", dc, gcdc); } { +#ifdef __WXMSW__ wxBitmap bmp(opts.width, opts.height, 32); bmp.UseAlpha(false); +#else // !__WXMSW__ + wxBitmap bmp(opts.width, opts.height, 24); +#endif // __WXMSW__/!__WXMSW__ wxMemoryDC dc(bmp); wxGCDC gcdc; if ( m_renderer ) @@ -333,7 +339,9 @@ private: } { wxBitmap bmp(opts.width, opts.height, 32); +#ifdef __WXMSW__ bmp.UseAlpha(true); +#endif // __WXMSW__ wxMemoryDC dc(bmp); wxGCDC gcdc; if ( m_renderer ) From 21a5314c5292ca52615e52cf1e62a4e5781506f4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:31:41 +0200 Subject: [PATCH 023/231] Another graphics benchmark compilation fix for non-MSW Use GraphicsRenderer name for the enum in all ports. See 573cb961cba2470372f4bfb8592c98257c5ae809 --- tests/benchmarks/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/graphics.cpp b/tests/benchmarks/graphics.cpp index 2d54a8adc8..dd8aa48fca 100644 --- a/tests/benchmarks/graphics.cpp +++ b/tests/benchmarks/graphics.cpp @@ -99,11 +99,11 @@ struct GraphicsBenchmarkOptions useGL; #ifdef __WXMSW__ - enum GraphRenderer { Default, GDIPlus, Direct2D, Cairo }; + enum GraphicsRenderer { Default, GDIPlus, Direct2D, Cairo }; #else enum GraphicsRenderer { Default }; #endif // __WXMSW__ / !__WXMSW__ - GraphRenderer renderer; + GraphicsRenderer renderer; } opts; class GraphicsBenchmarkFrame : public wxFrame From 6db5b54fc7210f2bd6b16d9ece5090ae873a490c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:32:21 +0200 Subject: [PATCH 024/231] Fix wxHTML benchmarks compilation wx/crt.h must be included to use wxSscanf(). --- tests/benchmarks/htmlparser/htmlpars.cpp | 1 + tests/benchmarks/htmlparser/htmltag.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/htmlparser/htmlpars.cpp b/tests/benchmarks/htmlparser/htmlpars.cpp index 7a259a593d..5e0b2dc798 100644 --- a/tests/benchmarks/htmlparser/htmlpars.cpp +++ b/tests/benchmarks/htmlparser/htmlpars.cpp @@ -21,6 +21,7 @@ #include "wx/app.h" #endif +#include "wx/crt.h" #include "wx/tokenzr.h" #include "wx/wfstream.h" #include "wx/url.h" diff --git a/tests/benchmarks/htmlparser/htmltag.cpp b/tests/benchmarks/htmlparser/htmltag.cpp index 485e37fa58..7a76bff3e9 100644 --- a/tests/benchmarks/htmlparser/htmltag.cpp +++ b/tests/benchmarks/htmlparser/htmltag.cpp @@ -15,9 +15,8 @@ #include "htmltag.h" #include "htmlpars.h" -#include // for vsscanf -#include +#include "wx/crt.h" //----------------------------------------------------------------------------- // wx28HtmlTagsCache From bac28b95cdae86d1800e7e93ab5f31a0639c5b5d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 22 May 2018 23:10:45 +0200 Subject: [PATCH 025/231] Move wx/display_impl.h to wx/private/display.h This shows more clearly that this header is private to wxWidgets and can't be included by user code. No real changes. --- build/bakefiles/files.bkl | 1 - build/cmake/files.cmake | 1 - build/files | 1 - build/msw/wx_core.vcxproj | 1 - build/msw/wx_core.vcxproj.filters | 3 --- build/msw/wx_vc7_core.vcproj | 3 --- build/msw/wx_vc8_core.vcproj | 4 ---- build/msw/wx_vc9_core.vcproj | 4 ---- include/wx/{display_impl.h => private/display.h} | 9 ++++----- src/common/dpycmn.cpp | 2 +- src/gtk/display.cpp | 2 +- src/msw/display.cpp | 2 +- src/osx/core/display.cpp | 2 +- src/qt/display.cpp | 2 +- src/unix/displayx11.cpp | 2 +- 15 files changed, 10 insertions(+), 29 deletions(-) rename include/wx/{display_impl.h => private/display.h} (96%) diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 27339536a8..80b3217f79 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1124,7 +1124,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/dialup.h wx/dirctrl.h wx/display.h - wx/display_impl.h wx/dnd.h wx/docmdi.h wx/docview.h diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 7749731579..5af3d5ac77 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -1032,7 +1032,6 @@ set(GUI_CMN_HDR wx/dialup.h wx/dirctrl.h wx/display.h - wx/display_impl.h wx/dnd.h wx/docmdi.h wx/docview.h diff --git a/build/files b/build/files index ef98625be1..abe00f1361 100644 --- a/build/files +++ b/build/files @@ -967,7 +967,6 @@ GUI_CMN_HDR = wx/dirctrl.h wx/dirdlg.h wx/display.h - wx/display_impl.h wx/dnd.h wx/docmdi.h wx/docview.h diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj index 6c83436a0b..bf3ea86b5a 100644 --- a/build/msw/wx_core.vcxproj +++ b/build/msw/wx_core.vcxproj @@ -1280,7 +1280,6 @@ - diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters index d83e645ce5..7e17bd7ad0 100644 --- a/build/msw/wx_core.vcxproj.filters +++ b/build/msw/wx_core.vcxproj.filters @@ -1267,9 +1267,6 @@ Common Headers - - Common Headers - Common Headers diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 558ebba9fc..f64feb56e0 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -2270,9 +2270,6 @@ - - diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj index 59890d3916..b734aa02bd 100644 --- a/build/msw/wx_vc8_core.vcproj +++ b/build/msw/wx_vc8_core.vcproj @@ -3528,10 +3528,6 @@ RelativePath="..\..\include\wx\display.h" > - - diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index 0443a4194b..0b33c64c19 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -3524,10 +3524,6 @@ RelativePath="..\..\include\wx\display.h" > - - diff --git a/include/wx/display_impl.h b/include/wx/private/display.h similarity index 96% rename from include/wx/display_impl.h rename to include/wx/private/display.h index 40b4827885..cbaa3a2690 100644 --- a/include/wx/display_impl.h +++ b/include/wx/private/display.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/display_impl.h +// Name: wx/private/display.h // Purpose: wxDisplayImpl class declaration // Author: Vadim Zeitlin // Created: 2006-03-15 @@ -7,8 +7,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifndef _WX_DISPLAY_IMPL_H_BASE_ -#define _WX_DISPLAY_IMPL_H_BASE_ +#ifndef _WX_PRIVATE_DISPLAY_H_ +#define _WX_PRIVATE_DISPLAY_H_ #include "wx/gdicmn.h" // for wxRect @@ -105,5 +105,4 @@ public: virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; }; -#endif // _WX_DISPLAY_IMPL_H_BASE_ - +#endif // _WX_PRIVATE_DISPLAY_H_ diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index ecc744d4aa..ca4b1377a9 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -30,7 +30,7 @@ #endif //WX_PRECOMP #include "wx/display.h" -#include "wx/display_impl.h" +#include "wx/private/display.h" #if wxUSE_DISPLAY diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index d3fc6e465c..cc00c499dd 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -10,7 +10,7 @@ #if wxUSE_DISPLAY #include "wx/display.h" - #include "wx/display_impl.h" + #include "wx/private/display.h" #endif #include "wx/utils.h" // wxClientDisplayRect diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 3256c65cbc..b096d1895d 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -39,7 +39,7 @@ #include "wx/dynlib.h" #include "wx/sysopt.h" -#include "wx/display_impl.h" +#include "wx/private/display.h" #include "wx/msw/missing.h" #include "wx/msw/private.h" #include "wx/msw/private/hiddenwin.h" diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index fa4fec60a8..679312274b 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -33,7 +33,7 @@ #include "wx/gdicmn.h" #endif -#include "wx/display_impl.h" +#include "wx/private/display.h" #include "wx/scopedarray.h" #include "wx/osx/private.h" diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 28cc87358f..5b5dc228b9 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -9,7 +9,7 @@ #include "wx/wxprec.h" #include "wx/display.h" -#include "wx/display_impl.h" +#include "wx/private/display.h" #include #include #include "wx/qt/private/converter.h" diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 5b709ca0ff..41ab88060b 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -40,7 +40,7 @@ #if wxUSE_DISPLAY #include "wx/display.h" -#include "wx/display_impl.h" +#include "wx/private/display.h" #ifndef __WXGTK20__ From 587a510028a3157b71f967a0a7ee883bc3f9fd51 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 22 May 2018 23:23:49 +0200 Subject: [PATCH 026/231] Remove unnecessary wxUSE_DISPLAY preprocessor checks Most of the methods of wxDisplay are always available, they just only support primary display when wxUSE_DISPLAY==0, so there is no need to check for wxUSE_DISPLAY before using them as they already contain the only possible fallback anyhow and such checks are useless. This incidentally closes #18115, due to removing "#if wxUSE_DISPLAY" around wx/display.h inclusion. --- src/common/dlgcmn.cpp | 6 ------ src/msw/toplevel.cpp | 19 ++++++------------- src/stc/PlatWX.cpp | 8 +------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 9914266c05..55e37cc2e6 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -44,9 +44,7 @@ #include "wx/textwrapper.h" #include "wx/modalhook.h" -#if wxUSE_DISPLAY #include "wx/display.h" -#endif extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog"; @@ -873,11 +871,7 @@ int wxStandardDialogLayoutAdapter::DoMustScroll(wxDialog* dialog, wxSize& window wxSize minWindowSize = dialog->GetSizer()->GetMinSize(); windowSize = dialog->GetSize(); windowSize = wxSize(wxMax(windowSize.x, minWindowSize.x), wxMax(windowSize.y, minWindowSize.y)); -#if wxUSE_DISPLAY displaySize = wxDisplay(wxDisplay::GetFromWindow(dialog)).GetClientArea().GetSize(); -#else - displaySize = wxGetClientDisplayRect().GetSize(); -#endif int flags = 0; diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index a7d4bac9b6..d2b89ccc97 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -905,20 +905,13 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) // change our window style to be compatible with full-screen mode updateStyle.Apply(); - wxRect rect; -#if wxUSE_DISPLAY - // resize to the size of the display containing us + // resize to the size of the display containing us, falling back to the + // primary one int dpy = wxDisplay::GetFromWindow(this); - if ( dpy != wxNOT_FOUND ) - { - rect = wxDisplay(dpy).GetGeometry(); - } - else // fall back to the main desktop -#endif // wxUSE_DISPLAY - { - // resize to the size of the desktop - wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect); - } + if ( dpy == wxNOT_FOUND ) + dpy = 0; + + const wxRect rect = wxDisplay(dpy).GetGeometry(); SetSize(rect); diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 1efb9d9de0..a836c2cfc4 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -1953,17 +1953,11 @@ void Window::SetTitle(const char *s) { // Returns rectangle of monitor pt is on PRectangle Window::GetMonitorRect(Point pt) { - wxRect rect; if (! wid) return PRectangle(); -#if wxUSE_DISPLAY // Get the display the point is found on int n = wxDisplay::GetFromPoint(wxPoint(wxRound(pt.x), wxRound(pt.y))); wxDisplay dpy(n == wxNOT_FOUND ? 0 : n); - rect = dpy.GetGeometry(); -#else - wxUnusedVar(pt); -#endif - return PRectangleFromwxRect(rect); + return PRectangleFromwxRect(dpy.GetGeometry()); } //---------------------------------------------------------------------- From 141d7b826da1d6feb2b2a28b69d5c25d3c1c6972 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 22 May 2018 23:25:45 +0200 Subject: [PATCH 027/231] Fix weird indentation in X11 display code No real changes. --- src/unix/displayx11.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 41ab88060b..5c740ef4b0 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -44,9 +44,9 @@ #ifndef __WXGTK20__ - #include +#include - typedef XineramaScreenInfo ScreenInfo; +typedef XineramaScreenInfo ScreenInfo; // ---------------------------------------------------------------------------- // helper class storing information about all screens From 77e33d9e1beb86bff2133b536777312abfeb58f6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 23:01:36 +0200 Subject: [PATCH 028/231] Micro optimization in wxDisplay ctor Don't check for the index validity if it's 0, which is the most common case, as index 0 is always valid and so we can avoid calling GetCount(), which might have a non-trivial cost, completely. --- src/common/dpycmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index ca4b1377a9..e7cb12aee5 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -115,7 +115,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule); wxDisplay::wxDisplay(unsigned n) { - wxASSERT_MSG( n < GetCount(), + wxASSERT_MSG( n == 0 || n < GetCount(), wxT("An invalid index was passed to wxDisplay") ); m_impl = Factory().CreateDisplay(n); From 9f37d91498b9313ddef10de5ceea0954c8840c80 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 23:08:05 +0200 Subject: [PATCH 029/231] Fix wrong comment before wxDisplayFactorySingle::CreateDisplay() This method is not static. --- src/common/dpycmn.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index e7cb12aee5..8e14dde43f 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -241,7 +241,6 @@ int wxDisplayFactory::GetFromWindow(const wxWindow *window) // wxDisplayFactorySingle implementation // ============================================================================ -/* static */ wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) { // we recognize the main display only From 961995072183ea698911b6ffef65e40144ef00d6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 23:10:24 +0200 Subject: [PATCH 030/231] Use wxOVERRIDE for wxDisplay-related classes in wxQt No real changes. --- src/qt/display.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 5b5dc228b9..6e2fa75774 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -19,12 +19,12 @@ class wxDisplayImplQt : public wxDisplayImpl public: wxDisplayImplQt( unsigned n ); - virtual wxRect GetGeometry() const; - virtual wxString GetName() const; + virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE; - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const; - virtual wxVideoMode GetCurrentMode() const; - virtual bool ChangeMode(const wxVideoMode& mode); + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; }; wxDisplayImplQt::wxDisplayImplQt( unsigned n ) @@ -69,9 +69,9 @@ class wxDisplayFactoryQt : public wxDisplayFactory public: wxDisplayFactoryQt(); - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount(); - virtual int GetFromPoint(const wxPoint& pt); + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; }; From b4aaa1003247535675f21b69cf800353012ca81c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:24:32 +0200 Subject: [PATCH 031/231] Fix wx/display.h compilation when it's the first included header Include wx/defs.h to ensure that wxUSE_DISPLAY is defined before it is checked for. --- include/wx/display.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/wx/display.h b/include/wx/display.h index 4678672138..1c8d04379d 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -10,6 +10,8 @@ #ifndef _WX_DISPLAY_H_BASE_ #define _WX_DISPLAY_H_BASE_ +#include "wx/defs.h" + // NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but // not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 // it becomes just a trivial wrapper around the old wxDisplayXXX() functions From d6793893c044477f8ae55f8f4624f5d4a873956a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:29:02 +0200 Subject: [PATCH 032/231] Add a simple benchmark of wxDisplaySize() and related functions This benchmark shows that wxGetDisplaySize() has only minimal overhead compared to wxDisplaySize(), but wxDisplay().GetGeometry() is almost 3 times slower (under wxGTK). --- tests/benchmarks/Makefile.in | 4 +++ tests/benchmarks/bench.bkl | 1 + tests/benchmarks/bench_vc7_bench_gui.vcproj | 3 +++ tests/benchmarks/bench_vc8_bench_gui.vcproj | 4 +++ tests/benchmarks/bench_vc9_bench_gui.vcproj | 4 +++ tests/benchmarks/display.cpp | 30 +++++++++++++++++++++ tests/benchmarks/makefile.bcc | 4 +++ tests/benchmarks/makefile.gcc | 4 +++ tests/benchmarks/makefile.vc | 4 +++ 9 files changed, 58 insertions(+) create mode 100644 tests/benchmarks/display.cpp diff --git a/tests/benchmarks/Makefile.in b/tests/benchmarks/Makefile.in index 401b6e54b8..ab8a00ec9d 100644 --- a/tests/benchmarks/Makefile.in +++ b/tests/benchmarks/Makefile.in @@ -64,6 +64,7 @@ BENCH_GUI_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ BENCH_GUI_OBJECTS = \ $(__bench_gui___win32rc) \ bench_gui_bench.o \ + bench_gui_display.o \ bench_gui_image.o BENCH_GRAPHICS_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ @@ -306,6 +307,9 @@ bench_gui_sample_rc.o: $(srcdir)/../../samples/sample.rc bench_gui_bench.o: $(srcdir)/bench.cpp $(CXXC) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(srcdir)/bench.cpp +bench_gui_display.o: $(srcdir)/display.cpp + $(CXXC) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(srcdir)/display.cpp + bench_gui_image.o: $(srcdir)/image.cpp $(CXXC) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(srcdir)/image.cpp diff --git a/tests/benchmarks/bench.bkl b/tests/benchmarks/bench.bkl index acf774a861..f3efa94295 100644 --- a/tests/benchmarks/bench.bkl +++ b/tests/benchmarks/bench.bkl @@ -36,6 +36,7 @@ bench.cpp + display.cpp image.cpp core diff --git a/tests/benchmarks/bench_vc7_bench_gui.vcproj b/tests/benchmarks/bench_vc7_bench_gui.vcproj index 6556d7d2cf..d5393ca7ff 100644 --- a/tests/benchmarks/bench_vc7_bench_gui.vcproj +++ b/tests/benchmarks/bench_vc7_bench_gui.vcproj @@ -286,6 +286,9 @@ + + diff --git a/tests/benchmarks/bench_vc8_bench_gui.vcproj b/tests/benchmarks/bench_vc8_bench_gui.vcproj index 323f786d9f..fe30ed5fd1 100644 --- a/tests/benchmarks/bench_vc8_bench_gui.vcproj +++ b/tests/benchmarks/bench_vc8_bench_gui.vcproj @@ -810,6 +810,10 @@ RelativePath=".\bench.cpp" > + + diff --git a/tests/benchmarks/bench_vc9_bench_gui.vcproj b/tests/benchmarks/bench_vc9_bench_gui.vcproj index 45fc9f54ac..6f9f17cf00 100644 --- a/tests/benchmarks/bench_vc9_bench_gui.vcproj +++ b/tests/benchmarks/bench_vc9_bench_gui.vcproj @@ -782,6 +782,10 @@ RelativePath=".\bench.cpp" > + + diff --git a/tests/benchmarks/display.cpp b/tests/benchmarks/display.cpp new file mode 100644 index 0000000000..d9ad2cb7d5 --- /dev/null +++ b/tests/benchmarks/display.cpp @@ -0,0 +1,30 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tests/benchmarks/display.cpp +// Purpose: wxDisplay benchmarks +// Author: Vadim Zeitlin +// Created: 2018-09-30 +// Copyright: (c) 2018 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/display.h" +#include "wx/gdicmn.h" + +#include "bench.h" + +BENCHMARK_FUNC(DisplaySize) +{ + int w, h; + wxDisplaySize(&w, &h); + return w > 0; +} + +BENCHMARK_FUNC(GetDisplaySize) +{ + return wxGetDisplaySize().x > 0; +} + +BENCHMARK_FUNC(DisplayGetGeometry) +{ + return wxDisplay().GetGeometry().GetSize().x > 0; +} diff --git a/tests/benchmarks/makefile.bcc b/tests/benchmarks/makefile.bcc index b34d95adee..be62ce066f 100644 --- a/tests/benchmarks/makefile.bcc +++ b/tests/benchmarks/makefile.bcc @@ -54,6 +54,7 @@ BENCH_GUI_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(CPPFLAGS) $(CXXFLAGS) BENCH_GUI_OBJECTS = \ $(OBJS)\bench_gui_bench.obj \ + $(OBJS)\bench_gui_display.obj \ $(OBJS)\bench_gui_image.obj BENCH_GRAPHICS_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__OPTIMIZEFLAG) $(__THREADSFLAG_1) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ @@ -340,6 +341,9 @@ $(OBJS)\bench_gui_sample.res: .\..\..\samples\sample.rc $(OBJS)\bench_gui_bench.obj: .\bench.cpp $(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\bench.cpp +$(OBJS)\bench_gui_display.obj: .\display.cpp + $(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\display.cpp + $(OBJS)\bench_gui_image.obj: .\image.cpp $(CXX) -q -c -P -o$@ $(BENCH_GUI_CXXFLAGS) .\image.cpp diff --git a/tests/benchmarks/makefile.gcc b/tests/benchmarks/makefile.gcc index 54948a8494..6546847f3f 100644 --- a/tests/benchmarks/makefile.gcc +++ b/tests/benchmarks/makefile.gcc @@ -49,6 +49,7 @@ BENCH_GUI_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ BENCH_GUI_OBJECTS = \ $(OBJS)\bench_gui_sample_rc.o \ $(OBJS)\bench_gui_bench.o \ + $(OBJS)\bench_gui_display.o \ $(OBJS)\bench_gui_image.o BENCH_GRAPHICS_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ $(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ @@ -318,6 +319,9 @@ $(OBJS)\bench_gui_sample_rc.o: ./../../samples/sample.rc $(OBJS)\bench_gui_bench.o: ./bench.cpp $(CXX) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\bench_gui_display.o: ./display.cpp + $(CXX) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\bench_gui_image.o: ./image.cpp $(CXX) -c -o $@ $(BENCH_GUI_CXXFLAGS) $(CPPDEPS) $< diff --git a/tests/benchmarks/makefile.vc b/tests/benchmarks/makefile.vc index 784e045c6c..3dbf2a2da8 100644 --- a/tests/benchmarks/makefile.vc +++ b/tests/benchmarks/makefile.vc @@ -51,6 +51,7 @@ BENCH_GUI_CXXFLAGS = /M$(__RUNTIME_LIBS_26)$(__DEBUGRUNTIME) /DWIN32 \ /DNOPCH /D_CONSOLE $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) $(CXXFLAGS) BENCH_GUI_OBJECTS = \ $(OBJS)\bench_gui_bench.obj \ + $(OBJS)\bench_gui_display.obj \ $(OBJS)\bench_gui_image.obj BENCH_GUI_RESOURCES = \ $(OBJS)\bench_gui_sample.res @@ -512,6 +513,9 @@ $(OBJS)\bench_gui_sample.res: .\..\..\samples\sample.rc $(OBJS)\bench_gui_bench.obj: .\bench.cpp $(CXX) /c /nologo /TP /Fo$@ $(BENCH_GUI_CXXFLAGS) .\bench.cpp +$(OBJS)\bench_gui_display.obj: .\display.cpp + $(CXX) /c /nologo /TP /Fo$@ $(BENCH_GUI_CXXFLAGS) .\display.cpp + $(OBJS)\bench_gui_image.obj: .\image.cpp $(CXX) /c /nologo /TP /Fo$@ $(BENCH_GUI_CXXFLAGS) .\image.cpp From 990c8bfd733577885baad419025fc0580557ba8c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 00:53:59 +0200 Subject: [PATCH 033/231] Cache wxDisplayImpl object for faster access Avoid a heap allocation on every wxDisplay creation by caching the wxDisplayImpl objects once they're created. Currently we never invalidate the cache, but we should add a way to do it in the future. This speeds up wxDisplay::GetGeometry() benchmark by a factor of 4. --- include/wx/display.h | 1 - include/wx/private/display.h | 31 ++++++++++++++++++++++++++----- src/common/dpycmn.cpp | 16 ++++++++++------ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/include/wx/display.h b/include/wx/display.h index 1c8d04379d..3213d79d97 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -50,7 +50,6 @@ public: // dtor is not virtual as this is a concrete class not meant to be derived // from - ~wxDisplay(); // return the number of available displays, valid parameters to diff --git a/include/wx/private/display.h b/include/wx/private/display.h index cbaa3a2690..9e0f399c28 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -11,6 +11,7 @@ #define _WX_PRIVATE_DISPLAY_H_ #include "wx/gdicmn.h" // for wxRect +#include "wx/vector.h" // ---------------------------------------------------------------------------- // wxDisplayFactory: allows to create wxDisplay objects @@ -20,12 +21,20 @@ class WXDLLIMPEXP_CORE wxDisplayFactory { public: wxDisplayFactory() { } - virtual ~wxDisplayFactory() { } + virtual ~wxDisplayFactory(); - // create a new display object - // - // it can return a NULL pointer if the display creation failed - virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; + // Create the display if necessary using CreateDisplay(), otherwise just + // get it from cache. + wxDisplayImpl* GetDisplay(unsigned n) + { + if ( m_impls.empty() ) + m_impls.resize(GetCount()); + else if ( m_impls[n] ) + return m_impls[n]; + + m_impls[n] = CreateDisplay(n); + return m_impls[n]; + } // get the total number of displays virtual unsigned GetCount() = 0; @@ -37,6 +46,18 @@ public: // // the window pointer must not be NULL (i.e. caller should check it) virtual int GetFromWindow(const wxWindow *window); + +protected: + // create a new display object + // + // it can return a NULL pointer if the display creation failed + virtual wxDisplayImpl *CreateDisplay(unsigned n) = 0; + +private: + // On-demand populated vector of wxDisplayImpl objects. + wxVector m_impls; + + wxDECLARE_NO_COPY_CLASS(wxDisplayFactory); }; // ---------------------------------------------------------------------------- diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 8e14dde43f..9e59f0aeba 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -118,12 +118,7 @@ wxDisplay::wxDisplay(unsigned n) wxASSERT_MSG( n == 0 || n < GetCount(), wxT("An invalid index was passed to wxDisplay") ); - m_impl = Factory().CreateDisplay(n); -} - -wxDisplay::~wxDisplay() -{ - delete m_impl; + m_impl = Factory().GetDisplay(n); } // ---------------------------------------------------------------------------- @@ -230,6 +225,15 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode) // wxDisplayFactory implementation // ============================================================================ +wxDisplayFactory::~wxDisplayFactory() +{ + for ( size_t n = 0; n < m_impls.size(); ++n ) + { + // It can be null, that's ok. + delete m_impls[n]; + } +} + int wxDisplayFactory::GetFromWindow(const wxWindow *window) { // consider that the window belongs to the display containing its centre From 1d40b629a2cf61fda0a239e46bae8fd8c89fcd8f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 15:30:53 +0200 Subject: [PATCH 034/231] Remove the unused msw.display.directdraw system option This should have been part of 16e4586527d89f78c665efbc218dc32f7e19c4ca which removed the code this option pertained to. See #12387. --- configure | 8 -------- configure.in | 3 --- interface/wx/sysopt.h | 3 --- samples/display/display.cpp | 7 ------- 4 files changed, 21 deletions(-) diff --git a/configure b/configure index 47205af945..30fed661f2 100755 --- a/configure +++ b/configure @@ -27521,14 +27521,6 @@ fi $as_echo "$as_me: WARNING: Xinerama not found; disabling wxDisplay" >&2;} wxUSE_DISPLAY="no" fi - elif test "$wxUSE_MSW" = 1; then - ac_fn_c_check_header_compile "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "#include -" -if test "x$ac_cv_header_ddraw_h" = xyes; then : - -fi - - fi fi diff --git a/configure.in b/configure.in index 4ffb373d47..91a36fedd6 100644 --- a/configure.in +++ b/configure.in @@ -3472,9 +3472,6 @@ if test "$wxUSE_DISPLAY" = "yes"; then AC_MSG_WARN([Xinerama not found; disabling wxDisplay]) wxUSE_DISPLAY="no" fi - elif test "$wxUSE_MSW" = 1; then - dnl DirectDraw for MSW - optionally used by WxDisplay. - AC_CHECK_HEADER([ddraw.h], [], [], [#include ]) fi fi diff --git a/interface/wx/sysopt.h b/interface/wx/sysopt.h index cb789b3c04..47ac09624d 100644 --- a/interface/wx/sysopt.h +++ b/interface/wx/sysopt.h @@ -66,9 +66,6 @@ Setting this to 0 causes more flicker, but allows applications to paint graphics on the parent of a static box (the optimized refresh causes any such drawing to disappear). - @flag{msw.display.directdraw} - If set to 1, use DirectDraw-based implementation of wxDisplay. - By default the standard Win32 functions are used. @flag{msw.font.no-proof-quality} If set to 1, use default fonts quality instead of proof quality when creating fonts. With proof quality the fonts have slightly better diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 4f4be39b64..5ecdcfbb9b 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -170,13 +170,6 @@ bool MyApp::OnInit() if ( !wxApp::OnInit() ) return false; -#ifdef __WXMSW__ - if ( argc == 2 && !wxStricmp(argv[1], "/dx") ) - { - wxSystemOptions::SetOption("msw.display.directdraw", 1); - } -#endif // __WXMSW__ - // create the main application window MyFrame *frame = new MyFrame(_("Display wxWidgets Sample"), wxDefaultPosition, wxDefaultSize); From 58a1ee1633df30f50878fc2c55768d2c946192fd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 15:36:40 +0200 Subject: [PATCH 035/231] Show the result of wxDisplay::IsPrimary() in the sample too Just add a quick test of this function. --- samples/display/display.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 5ecdcfbb9b..a362ac0255 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -278,6 +278,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, sizer->Add(new wxStaticText(page, wxID_ANY, "Name: ")); sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName())); + sizer->Add(new wxStaticText(page, wxID_ANY, "Primary: ")); + sizer->Add(new wxStaticText(page, wxID_ANY, + display.IsPrimary() ? "yes" : "no")); + wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(sizer, 1, wxALL | wxEXPAND, 10); From 6883cd4b960b209ea2189fdec271850be53c6442 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 15:37:46 +0200 Subject: [PATCH 036/231] Fix harmless variable shadowing warning in the display sample Use different names to avoid warning C4456 given by MSVC 14. --- samples/display/display.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/display/display.cpp b/samples/display/display.cpp index a362ac0255..7c97a54c34 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -235,8 +235,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, wxPanel *panel = new wxPanel(this, wxID_ANY); m_book = new wxBookCtrl(panel, wxID_ANY); - const size_t count = wxDisplay::GetCount(); - for ( size_t nDpy = 0; nDpy < count; nDpy++ ) + const size_t countDpy = wxDisplay::GetCount(); + for ( size_t nDpy = 0; nDpy < countDpy; nDpy++ ) { wxDisplay display(nDpy); @@ -288,8 +288,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, #if wxUSE_DISPLAY wxChoice *choiceModes = new wxChoice(page, Display_ChangeMode); const wxArrayVideoModes modes = display.GetModes(); - const size_t count = modes.GetCount(); - for ( size_t nMode = 0; nMode < count; nMode++ ) + const size_t countModes = modes.GetCount(); + for ( size_t nMode = 0; nMode < countModes; nMode++ ) { const wxVideoMode& mode = modes[nMode]; From 771e01cc731ccd4185b7f38595bdbbc5aa56493d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 16:59:40 +0200 Subject: [PATCH 037/231] Remove unnecessary trivial wxDisplayFactoryQt default ctor No real changes, just remove useless lines. --- src/qt/display.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 6e2fa75774..a5d1d829dd 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -67,18 +67,11 @@ bool wxDisplayImplQt::ChangeMode(const wxVideoMode& WXUNUSED(mode)) class wxDisplayFactoryQt : public wxDisplayFactory { public: - wxDisplayFactoryQt(); - virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; virtual unsigned GetCount() wxOVERRIDE; virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; }; - -wxDisplayFactoryQt::wxDisplayFactoryQt() -{ -} - wxDisplayImpl *wxDisplayFactoryQt::CreateDisplay(unsigned n) { return new wxDisplayImplQt( n ); From c98d504b6d636365fd7543d74bcb646eecfc5d17 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 17:06:34 +0200 Subject: [PATCH 038/231] Implement wxDisplay::GetClientArea() for wxQt too This is as simple as implementing GetGeometry(), so just do it. --- src/qt/display.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qt/display.cpp b/src/qt/display.cpp index a5d1d829dd..9a39545451 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -20,6 +20,8 @@ public: wxDisplayImplQt( unsigned n ); virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxRect GetClientArea() const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE; virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; @@ -37,6 +39,11 @@ wxRect wxDisplayImplQt::GetGeometry() const return wxQtConvertRect( QApplication::desktop()->screenGeometry( GetIndex() )); } +wxRect wxDisplayImplQt::GetClientArea() const +{ + return wxQtConvertRect( QApplication::desktop()->availableGeometry( GetIndex() )); +} + wxString wxDisplayImplQt::GetName() const { return wxString(); From 959b67778666406ca867854d27646cca31a20b7c Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 21:17:29 +0200 Subject: [PATCH 039/231] Remove non-existing WXQT headers from build system --- Makefile.in | 7 ------- build/bakefiles/files.bkl | 7 ------- build/cmake/files.cmake | 7 ------- build/files | 8 -------- 4 files changed, 29 deletions(-) diff --git a/Makefile.in b/Makefile.in index 342a4d4a29..8eb734fbd4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3479,8 +3479,6 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \ COND_TOOLKIT_QT_GUI_HDR = \ wx/qt/accel.h \ wx/qt/app.h \ - wx/qt/apptbase.h \ - wx/qt/apptrait.h \ wx/qt/bitmap.h \ wx/qt/bmpbuttn.h \ wx/qt/brush.h \ @@ -3496,7 +3494,6 @@ COND_TOOLKIT_QT_GUI_HDR = \ wx/qt/colour.h \ wx/qt/combobox.h \ wx/qt/control.h \ - wx/qt/converter.h \ wx/qt/ctrlsub.h \ wx/qt/cursor.h \ wx/qt/dataform.h \ @@ -3547,16 +3544,12 @@ COND_TOOLKIT_QT_GUI_HDR = \ wx/qt/statusbar.h \ wx/qt/stattext.h \ wx/qt/textctrl.h \ - wx/qt/textdlg.h \ wx/qt/textentry.h \ wx/qt/tglbtn.h \ - wx/qt/timer.h \ wx/qt/toolbar.h \ wx/qt/tooltip.h \ wx/qt/toplevel.h \ - wx/qt/utils.h \ wx/qt/window.h \ - wx/qt/private/winevent.h \ wx/generic/fdrepdlg.h \ wx/generic/filepickerg.h \ wx/generic/clrpickerg.h \ diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 27339536a8..e501061a11 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -245,8 +245,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/qt/accel.h wx/qt/app.h - wx/qt/apptbase.h - wx/qt/apptrait.h wx/qt/bitmap.h wx/qt/bmpbuttn.h wx/qt/brush.h @@ -262,7 +260,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/qt/colour.h wx/qt/combobox.h wx/qt/control.h - wx/qt/converter.h wx/qt/ctrlsub.h wx/qt/cursor.h wx/qt/dataform.h @@ -313,17 +310,13 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/qt/statusbar.h wx/qt/stattext.h wx/qt/textctrl.h - wx/qt/textdlg.h wx/qt/textentry.h wx/qt/tglbtn.h - wx/qt/timer.h wx/qt/toolbar.h wx/qt/tooltip.h wx/qt/toplevel.h - wx/qt/utils.h wx/qt/window.h - wx/qt/private/winevent.h wx/generic/fdrepdlg.h wx/generic/filepickerg.h wx/generic/clrpickerg.h diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 7749731579..f0812e7474 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -168,8 +168,6 @@ set(BASE_OSX_NOTWXMAC_HDR set(QT_HDR wx/qt/accel.h wx/qt/app.h - wx/qt/apptbase.h - wx/qt/apptrait.h wx/qt/bitmap.h wx/qt/bmpbuttn.h wx/qt/brush.h @@ -187,7 +185,6 @@ set(QT_HDR wx/qt/colour.h wx/qt/combobox.h wx/qt/control.h - wx/qt/converter.h wx/qt/ctrlsub.h wx/qt/cursor.h wx/qt/dataform.h @@ -241,16 +238,12 @@ set(QT_HDR wx/qt/statusbar.h wx/qt/stattext.h wx/qt/textctrl.h - wx/qt/textdlg.h wx/qt/textentry.h wx/qt/tglbtn.h - wx/qt/timer.h wx/qt/toolbar.h wx/qt/tooltip.h wx/qt/toplevel.h - wx/qt/utils.h wx/qt/window.h - wx/qt/private/winevent.h wx/qt/dvrenderer.h wx/qt/dvrenderers.h wx/generic/animate.h diff --git a/build/files b/build/files index ef98625be1..7c3b433047 100644 --- a/build/files +++ b/build/files @@ -204,8 +204,6 @@ QT_HDR = wx/qt/accel.h wx/qt/anybutton.h wx/qt/app.h - wx/qt/apptbase.h - wx/qt/apptrait.h wx/qt/bitmap.h wx/qt/bmpbuttn.h wx/qt/brush.h @@ -220,7 +218,6 @@ QT_HDR = wx/qt/colour.h wx/qt/combobox.h wx/qt/control.h - wx/qt/converter.h wx/qt/ctrlsub.h wx/qt/cursor.h wx/qt/dataform.h @@ -258,7 +255,6 @@ QT_HDR = wx/qt/popupwin.h wx/qt/printdlg.h wx/qt/printqt.h - wx/qt/private/winevent.h wx/qt/radiobox.h wx/qt/radiobut.h wx/qt/region.h @@ -273,14 +269,11 @@ QT_HDR = wx/qt/statusbar.h wx/qt/taskbar.h wx/qt/textctrl.h - wx/qt/textdlg.h wx/qt/textentry.h wx/qt/tglbtn.h - wx/qt/timer.h wx/qt/toolbar.h wx/qt/tooltip.h wx/qt/toplevel.h - wx/qt/utils.h wx/qt/window.h QT_SRC= @@ -316,7 +309,6 @@ QT_SRC= src/qt/combobox.cpp src/qt/control.cpp src/qt/converter.cpp - src/qt/converter.cpp src/qt/ctrlsub.cpp src/qt/cursor.cpp src/qt/dataobj.cpp From 40d57a33deae90e0ebc6ad03eeeed824eaf175ee Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 30 Sep 2018 14:55:43 +0200 Subject: [PATCH 040/231] Remove remnants of OS/2 from build system --- autoconf_inc.m4 | 6 ------ configure | 6 ------ samples/dialogs/Makefile.in | 8 -------- 3 files changed, 20 deletions(-) diff --git a/autoconf_inc.m4 b/autoconf_inc.m4 index f3156ae24a..8367cfdd6d 100644 --- a/autoconf_inc.m4 +++ b/autoconf_inc.m4 @@ -530,12 +530,6 @@ dnl ### begin block 20_COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0[../../samples/dialogs/ COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0="" fi AC_SUBST(COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0) -dnl ### begin block 20_COND_SHARED_0_TOOLKIT_PM_WXUNIV_0[../../samples/dialogs/dialogs.bkl] ### - COND_SHARED_0_TOOLKIT_PM_WXUNIV_0="#" - if test "x$SHARED" = "x0" -a "x$TOOLKIT" = "xPM" -a "x$WXUNIV" = "x0" ; then - COND_SHARED_0_TOOLKIT_PM_WXUNIV_0="" - fi - AC_SUBST(COND_SHARED_0_TOOLKIT_PM_WXUNIV_0) dnl ### begin block 20_COND_SHARED_0_USE_GUI_1_USE_OPENGL_1[wx.bkl] ### COND_SHARED_0_USE_GUI_1_USE_OPENGL_1="#" if test "x$SHARED" = "x0" -a "x$USE_GUI" = "x1" -a "x$USE_OPENGL" = "x1" ; then diff --git a/configure b/configure index 47205af945..2cb0841699 100755 --- a/configure +++ b/configure @@ -745,7 +745,6 @@ COND_SHARED_0_USE_GUI_1_wxUSE_LIBTIFF_builtin COND_SHARED_0_USE_GUI_1_wxUSE_LIBPNG_builtin COND_SHARED_0_USE_GUI_1_wxUSE_LIBJPEG_builtin COND_SHARED_0_USE_GUI_1_USE_OPENGL_1 -COND_SHARED_0_TOOLKIT_PM_WXUNIV_0 COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0 COND_SHARED_0_TOOLKIT_MAC_WXUNIV_0 COND_SHARED_0 @@ -41107,11 +41106,6 @@ EOF COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0="" fi - COND_SHARED_0_TOOLKIT_PM_WXUNIV_0="#" - if test "x$SHARED" = "x0" -a "x$TOOLKIT" = "xPM" -a "x$WXUNIV" = "x0" ; then - COND_SHARED_0_TOOLKIT_PM_WXUNIV_0="" - fi - COND_SHARED_0_USE_GUI_1_USE_OPENGL_1="#" if test "x$SHARED" = "x0" -a "x$USE_GUI" = "x1" -a "x$USE_OPENGL" = "x1" ; then COND_SHARED_0_USE_GUI_1_USE_OPENGL_1="" diff --git a/samples/dialogs/Makefile.in b/samples/dialogs/Makefile.in index 83eea46a3c..f9e618bff3 100644 --- a/samples/dialogs/Makefile.in +++ b/samples/dialogs/Makefile.in @@ -106,8 +106,6 @@ COND_PLATFORM_OS2_1___dialogs___os2_emxbindcmd = $(NM) dialogs$(EXEEXT) | if \ @COND_SHARED_0_TOOLKIT_MAC_WXUNIV_0@ dialogs_filedlgg.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__GENERIC_DIALOGS_IN_NATIVE_BUILDS_OBJECTS \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = dialogs_filedlgg.o -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@__GENERIC_DIALOGS_IN_NATIVE_BUILDS_OBJECTS \ -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@ = dialogs_fontdlgg.o dialogs_filedlgg.o COND_MONOLITHIC_0___WXLIB_CORE_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p) @@ -221,16 +219,10 @@ dialogs_dialogs.o: $(srcdir)/dialogs.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@dialogs_filedlgg.o: $(srcdir)/../../src/generic/filedlgg.cpp @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ $(CXXC) -c -o $@ $(DIALOGS_CXXFLAGS) $(srcdir)/../../src/generic/filedlgg.cpp -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@dialogs_filedlgg.o: $(srcdir)/../../src/generic/filedlgg.cpp -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@ $(CXXC) -c -o $@ $(DIALOGS_CXXFLAGS) $(srcdir)/../../src/generic/filedlgg.cpp @COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0@dialogs_fontdlgg.o: $(srcdir)/../../src/generic/fontdlgg.cpp @COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0@ $(CXXC) -c -o $@ $(DIALOGS_CXXFLAGS) $(srcdir)/../../src/generic/fontdlgg.cpp -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@dialogs_fontdlgg.o: $(srcdir)/../../src/generic/fontdlgg.cpp -@COND_SHARED_0_TOOLKIT_PM_WXUNIV_0@ $(CXXC) -c -o $@ $(DIALOGS_CXXFLAGS) $(srcdir)/../../src/generic/fontdlgg.cpp - - # Include dependency info, if present: @IF_GNU_MAKE@-include ./.deps/*.d From 4c06c43f26e9b0be58e63652e877c2f06407e9df Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 30 Sep 2018 14:54:23 +0200 Subject: [PATCH 041/231] Include some Windows specific files in WXQT toolkit Similar as with WXGTK toolkit on Windows. --- Makefile.in | 177 ++++++++++++++++++++++++++++++++++++-- autoconf_inc.m4 | 6 ++ build/bakefiles/files.bkl | 33 +++++++ build/cmake/files.cmake | 25 ++++++ build/files | 23 +++++ configure | 6 ++ 6 files changed, 265 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8eb734fbd4..cef4b270d3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2176,6 +2176,16 @@ COND_USE_STC_1___wxscintilla___depname = \ @COND_PLATFORM_UNIX_1@PLUGIN_VERSION0 = $(WX_VERSION) @COND_PLATFORM_UNIX_0@PLUGVERDELIM = @COND_PLATFORM_UNIX_1@PLUGVERDELIM = - +COND_PLATFORM_WIN32_1_QT_PLATFORM_HDR = \ + wx/msw/dib.h \ + wx/msw/ole/automtn.h \ + wx/msw/joystick.h \ + wx/msw/sound.h \ + wx/msw/ole/safearray.h \ + wx/msw/ole/oleutils.h \ + wx/msw/ole/comimpl.h \ + wx/msw/ole/uuid.h +@COND_PLATFORM_WIN32_1@QT_PLATFORM_HDR = $(COND_PLATFORM_WIN32_1_QT_PLATFORM_HDR) COND_PLATFORM_MACOSX_1_GTK_PLATFORM_HDR = \ wx/generic/caret.h \ wx/generic/imaglist.h \ @@ -3561,7 +3571,8 @@ COND_TOOLKIT_QT_GUI_HDR = \ wx/qt/taskbar.h \ wx/generic/activityindicator.h \ wx/qt/dataview.h \ - wx/qt/dvrenderers.h + wx/qt/dvrenderers.h \ + $(QT_PLATFORM_HDR) @COND_TOOLKIT_QT@GUI_HDR = $(COND_TOOLKIT_QT_GUI_HDR) @COND_TOOLKIT_COCOA@MEDIA_PLATFORM_HDR = @COND_TOOLKIT_GTK@MEDIA_PLATFORM_HDR = @@ -5720,8 +5731,20 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS = \ monodll_qt_toplevel.o \ monodll_qt_uiaction.o \ monodll_qt_utils.o \ - monodll_qt_window.o + monodll_qt_window.o \ + $(__QT_PLATFORM_SRC_OBJECTS) @COND_TOOLKIT_QT@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS) +COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS = \ + monodll_comimpl.o \ + monodll_msw_dialup.o \ + monodll_dib.o \ + monodll_msw_joystick.o \ + monodll_oleutils.o \ + monodll_uuid.o \ + monodll_safearray.o \ + monodll_msw_sound.o \ + monodll_automtn.o +@COND_PLATFORM_WIN32_1@__QT_PLATFORM_SRC_OBJECTS = $(COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS) COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_fontmgrcmn.o \ monodll_animateg.o \ @@ -7685,8 +7708,20 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_1 = \ monolib_qt_toplevel.o \ monolib_qt_uiaction.o \ monolib_qt_utils.o \ - monolib_qt_window.o + monolib_qt_window.o \ + $(__QT_PLATFORM_SRC_OBJECTS_1) @COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_1) +COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_1 = \ + monolib_comimpl.o \ + monolib_msw_dialup.o \ + monolib_dib.o \ + monolib_msw_joystick.o \ + monolib_oleutils.o \ + monolib_uuid.o \ + monolib_safearray.o \ + monolib_msw_sound.o \ + monolib_automtn.o +@COND_PLATFORM_WIN32_1@__QT_PLATFORM_SRC_OBJECTS_1 = $(COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_1) COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_fontmgrcmn.o \ monolib_animateg.o \ @@ -9797,8 +9832,20 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_2 = \ coredll_qt_toplevel.o \ coredll_qt_uiaction.o \ coredll_qt_utils.o \ - coredll_qt_window.o + coredll_qt_window.o \ + $(__QT_PLATFORM_SRC_OBJECTS_2) @COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_2) +COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_2 = \ + coredll_comimpl.o \ + coredll_msw_dialup.o \ + coredll_dib.o \ + coredll_msw_joystick.o \ + coredll_oleutils.o \ + coredll_uuid.o \ + coredll_safearray.o \ + coredll_msw_sound.o \ + coredll_automtn.o +@COND_PLATFORM_WIN32_1@__QT_PLATFORM_SRC_OBJECTS_2 = $(COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_2) COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_fontmgrcmn.o \ coredll_animateg.o \ @@ -11504,8 +11551,20 @@ COND_TOOLKIT_QT___GUI_SRC_OBJECTS_3 = \ corelib_qt_toplevel.o \ corelib_qt_uiaction.o \ corelib_qt_utils.o \ - corelib_qt_window.o + corelib_qt_window.o \ + $(__QT_PLATFORM_SRC_OBJECTS_3) @COND_TOOLKIT_QT@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_QT___GUI_SRC_OBJECTS_3) +COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_3 = \ + corelib_comimpl.o \ + corelib_msw_dialup.o \ + corelib_dib.o \ + corelib_msw_joystick.o \ + corelib_oleutils.o \ + corelib_uuid.o \ + corelib_safearray.o \ + corelib_msw_sound.o \ + corelib_automtn.o +@COND_PLATFORM_WIN32_1@__QT_PLATFORM_SRC_OBJECTS_3 = $(COND_PLATFORM_WIN32_1___QT_PLATFORM_SRC_OBJECTS_3) COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_fontmgrcmn.o \ corelib_animateg.o \ @@ -17856,6 +17915,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@monodll_taskbarx11.o: $(srcdir)/src/unix/taskbarx11.cpp $(MONODLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/taskbarx11.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp @@ -17868,6 +17930,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp @@ -17880,6 +17945,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp @@ -17892,6 +17960,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp @@ -17904,6 +17975,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp @@ -17916,6 +17990,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp @@ -17928,6 +18005,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_dib.o: $(srcdir)/src/msw/dib.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dib.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_dib.o: $(srcdir)/src/msw/dib.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dib.cpp @@ -17964,6 +18044,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp @@ -17976,6 +18059,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONODLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONODLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp @@ -23106,6 +23192,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@monolib_taskbarx11.o: $(srcdir)/src/unix/taskbarx11.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/taskbarx11.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp @@ -23118,6 +23207,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp @@ -23130,6 +23222,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp @@ -23142,6 +23237,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp @@ -23154,6 +23252,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp @@ -23166,6 +23267,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp @@ -23178,6 +23282,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_dib.o: $(srcdir)/src/msw/dib.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dib.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_dib.o: $(srcdir)/src/msw/dib.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dib.cpp @@ -23214,6 +23321,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp @@ -23226,6 +23336,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(MONOLIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp @@ -28449,6 +28562,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@coredll_taskbarx11.o: $(srcdir)/src/unix/taskbarx11.cpp $(COREDLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/taskbarx11.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp @@ -28461,6 +28577,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp @@ -28473,6 +28592,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp @@ -28485,6 +28607,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp @@ -28497,6 +28622,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp @@ -28509,6 +28637,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp @@ -28521,6 +28652,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_dib.o: $(srcdir)/src/msw/dib.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dib.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_dib.o: $(srcdir)/src/msw/dib.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/dib.cpp @@ -28557,6 +28691,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp @@ -28569,6 +28706,9 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/sound.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(COREDLL_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(COREDLL_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp @@ -32694,6 +32834,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@corelib_taskbarx11.o: $(srcdir)/src/unix/taskbarx11.cpp $(CORELIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/taskbarx11.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp @@ -32706,6 +32849,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_automtn.o: $(srcdir)/src/msw/ole/automtn.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/automtn.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp @@ -32718,6 +32864,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_comimpl.o: $(srcdir)/src/msw/ole/comimpl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/comimpl.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp @@ -32730,6 +32879,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_oleutils.o: $(srcdir)/src/msw/ole/oleutils.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/oleutils.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp @@ -32742,6 +32894,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_safearray.o: $(srcdir)/src/msw/ole/safearray.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/safearray.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp @@ -32754,6 +32909,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp @@ -32766,6 +32924,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_msw_dialup.o: $(srcdir)/src/msw/dialup.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dialup.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_dib.o: $(srcdir)/src/msw/dib.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dib.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_dib.o: $(srcdir)/src/msw/dib.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/dib.cpp @@ -32802,6 +32963,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_utilswin.o: $(srcdir)/src/msw/utilswin.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/utilswin.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp @@ -32814,6 +32978,9 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_msw_sound.o: $(srcdir)/src/msw/sound.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/sound.cpp +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(CORELIB_ODEP) +@COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp + @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_msw_joystick.o: $(srcdir)/src/msw/joystick.cpp $(CORELIB_ODEP) @COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/joystick.cpp diff --git a/autoconf_inc.m4 b/autoconf_inc.m4 index 8367cfdd6d..8d9e122a8a 100644 --- a/autoconf_inc.m4 +++ b/autoconf_inc.m4 @@ -512,6 +512,12 @@ dnl ### begin block 20_COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_G COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1="" fi AC_SUBST(COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1) +dnl ### begin block 20_COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0[wx.bkl] ### + COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0="#" + if test "x$PLATFORM_WIN32" = "x1" -a "x$TOOLKIT" = "xQT" -a "x$USE_GUI" = "x1" -a "x$WXUNIV" = "x0" ; then + COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0="" + fi + AC_SUBST(COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0) dnl ### begin block 20_COND_SHARED_0[wx.bkl] ### COND_SHARED_0="#" if test "x$SHARED" = "x0" ; then diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index e501061a11..93c2d75a57 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -242,6 +242,37 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! + + src/msw/ole/comimpl.cpp + src/msw/dialup.cpp + src/msw/dib.cpp + src/msw/joystick.cpp + src/msw/ole/oleutils.cpp + src/msw/ole/uuid.cpp + src/msw/ole/safearray.cpp + src/msw/sound.cpp + src/msw/ole/automtn.cpp + + + + wx/msw/dib.h + wx/msw/ole/automtn.h + wx/msw/joystick.h + wx/msw/sound.h + wx/msw/ole/safearray.h + wx/msw/ole/oleutils.h + wx/msw/ole/comimpl.h + wx/msw/ole/uuid.h + + + + $(QT_WIN32_SRC) + + + + $(QT_WIN32_HDR) + + wx/qt/accel.h wx/qt/app.h @@ -329,6 +360,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/generic/activityindicator.h wx/qt/dataview.h wx/qt/dvrenderers.h + $(QT_PLATFORM_HDR) @@ -426,6 +458,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/qt/uiaction.cpp src/qt/utils.cpp src/qt/window.cpp + $(QT_PLATFORM_SRC) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index f0812e7474..acc11ed452 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -165,6 +165,29 @@ set(BASE_OSX_NOTWXMAC_HDR ${BASE_COREFOUNDATION_HDR} ) +set(QT_WIN32_SRC + src/msw/ole/automtn.cpp + src/msw/ole/safearray.cpp + src/msw/sound.cpp + src/msw/ole/oleutils.cpp + src/msw/ole/uuid.cpp + src/msw/ole/comimpl.cpp + src/msw/dialup.cpp + src/msw/dib.cpp + src/msw/joystick.cpp +) + +set(QT_WIN32_HDR + wx/msw/ole/automtn.h + wx/msw/joystick.h + wx/msw/dib.h + wx/msw/ole/uuid.h + wx/msw/ole/safearray.h + wx/msw/sound.h + wx/msw/ole/oleutils.h + wx/msw/ole/comimpl.h +) + set(QT_HDR wx/qt/accel.h wx/qt/app.h @@ -251,6 +274,7 @@ set(QT_HDR wx/qt/taskbar.h wx/qt/dataview.h wx/generic/activityindicator.h + ${QT_PLATFORM_HDR} ) set(QT_SRC @@ -348,6 +372,7 @@ set(QT_SRC src/qt/calctrl.cpp src/qt/dataview.cpp src/qt/taskbar.cpp + ${QT_PLATFORM_SRC} ) set(MEDIA_QT_SRC diff --git a/build/files b/build/files index 7c3b433047..19bdf348ec 100644 --- a/build/files +++ b/build/files @@ -189,7 +189,29 @@ BASE_OSX_NOTWXMAC_HDR = ## Qt +QT_WIN32_SRC= + src/msw/ole/automtn.cpp + src/msw/ole/comimpl.cpp + src/msw/ole/oleutils.cpp + src/msw/ole/safearray.cpp + src/msw/ole/uuid.cpp + src/msw/dialup.cpp + src/msw/dib.cpp + src/msw/joystick.cpp + src/msw/sound.cpp + +QT_WIN32_HDR= + wx/msw/ole/automtn.h + wx/msw/ole/comimpl.h + wx/msw/ole/oleutils.h + wx/msw/ole/safearray.h + wx/msw/ole/uuid.h + wx/msw/dib.h + wx/msw/joystick.h + wx/msw/sound.h + QT_HDR = + $(QT_PLATFORM_HDR) wx/generic/activityindicator.h wx/generic/animate.h wx/generic/caret.h @@ -277,6 +299,7 @@ QT_HDR = wx/qt/window.h QT_SRC= + $(QT_PLATFORM_SRC) src/common/taskbarcmn.cpp src/generic/activityindicator.cpp src/generic/animateg.cpp diff --git a/configure b/configure index 2cb0841699..a624aa99b5 100755 --- a/configure +++ b/configure @@ -748,6 +748,7 @@ COND_SHARED_0_USE_GUI_1_USE_OPENGL_1 COND_SHARED_0_TOOLKIT_MSW_WXUNIV_0 COND_SHARED_0_TOOLKIT_MAC_WXUNIV_0 COND_SHARED_0 +COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0 COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1 COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1 COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1 @@ -41091,6 +41092,11 @@ EOF COND_PLATFORM_WIN32_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1="" fi + COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0="#" + if test "x$PLATFORM_WIN32" = "x1" -a "x$TOOLKIT" = "xQT" -a "x$USE_GUI" = "x1" -a "x$WXUNIV" = "x0" ; then + COND_PLATFORM_WIN32_1_TOOLKIT_QT_USE_GUI_1_WXUNIV_0="" + fi + COND_SHARED_0="#" if test "x$SHARED" = "x0" ; then COND_SHARED_0="" From 1dfe088b4d940b2f5628160ec9fc1afbb7d5c439 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:41:17 +0200 Subject: [PATCH 042/231] Support WXQT in CMake --- build/cmake/files.cmake | 8 ++++++++ build/cmake/init.cmake | 12 +++++++++++- build/cmake/lib/core/CMakeLists.txt | 5 +++++ build/cmake/lib/gl/CMakeLists.txt | 4 +++- build/cmake/lib/media/CMakeLists.txt | 2 ++ build/cmake/options.cmake | 4 +--- build/cmake/samples/CMakeLists.txt | 18 ++++++++++-------- build/cmake/toolkit.cmake | 14 ++++++++++++++ build/files | 6 ++++++ 9 files changed, 60 insertions(+), 13 deletions(-) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index acc11ed452..d64208a00d 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -379,6 +379,14 @@ set(MEDIA_QT_SRC src/qt/mediactrl.cpp ) +set(OPENGL_QT_HDR + wx/qt/glcanvas.h +) + +set(OPENGL_QT_SRC + src/qt/glcanvas.cpp +) + set(BASE_CMN_SRC src/common/any.cpp src/common/appbase.cpp diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 4c93866c8f..f967050c5a 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -151,11 +151,21 @@ if(wxUSE_THREADS) endif() if(wxUSE_GUI) - if(WIN32 AND wxUSE_METAFILE) + if(WXMSW AND wxUSE_METAFILE) # this one should probably be made separately configurable set(wxUSE_ENH_METAFILE ON) endif() + # WXQT checks + if(WXQT) + wx_option_force_value(wxUSE_WEBVIEW OFF) + wx_option_force_value(wxUSE_METAFILE OFF) + if(WIN32) + wx_option_force_value(wxUSE_ACCESSIBILITY OFF) + endif() + endif() + + # extra dependencies if(wxUSE_OPENGL) find_package(OpenGL) if(NOT OPENGL_FOUND) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 3bd8719d91..20e4636cbf 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -41,6 +41,11 @@ elseif(WXOSX_COCOA) wx_append_sources(CORE_SRC OSX_LOWLEVEL) wx_append_sources(CORE_SRC OSX_SHARED) wx_append_sources(CORE_SRC OSX_COCOA) +elseif(WXQT) + wx_append_sources(CORE_SRC QT) + if(WIN32) + wx_append_sources(CORE_SRC QT_WIN32) + endif() endif() wx_add_library(core ${CORE_SRC}) diff --git a/build/cmake/lib/gl/CMakeLists.txt b/build/cmake/lib/gl/CMakeLists.txt index 18ac4ac855..605a2b4f66 100644 --- a/build/cmake/lib/gl/CMakeLists.txt +++ b/build/cmake/lib/gl/CMakeLists.txt @@ -11,12 +11,14 @@ include(../../source_groups.cmake) wx_append_sources(GL_FILES OPENGL_CMN) -if(WIN32) +if(WXMSW) wx_append_sources(GL_FILES OPENGL_MSW) elseif(WXGTK) wx_append_sources(GL_FILES OPENGL_GTK) elseif(APPLE) wx_append_sources(GL_FILES OPENGL_OSX_SHARED) +elseif(WXQT) + wx_append_sources(GL_FILES OPENGL_QT) endif() wx_add_library(gl ${GL_FILES}) diff --git a/build/cmake/lib/media/CMakeLists.txt b/build/cmake/lib/media/CMakeLists.txt index 5c536daa1a..7452774956 100644 --- a/build/cmake/lib/media/CMakeLists.txt +++ b/build/cmake/lib/media/CMakeLists.txt @@ -17,6 +17,8 @@ elseif(WXOSX_COCOA) wx_append_sources(MEDIA_FILES MEDIA_OSX_COCOA) elseif(UNIX) wx_append_sources(MEDIA_FILES MEDIA_UNIX) +elseif(WXQT) + wx_append_sources(MEDIA_FILES MEDIA_QT) endif() wx_add_library(media ${MEDIA_FILES}) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 48b2ddf70a..b399e7ec2f 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -353,9 +353,6 @@ wx_option(wxUSE_HOTKEY "use wxWindow::RegisterHotKey()") wx_option(wxUSE_JOYSTICK "use wxJoystick") wx_option(wxUSE_METAFILE "use wxMetaFile") wx_option(wxUSE_DRAGIMAGE "use wxDragImage") -if(WXMSW) - wx_option(wxUSE_ACCESSIBILITY "enable accessibility support") -endif() wx_option(wxUSE_UIACTIONSIMULATOR "use wxUIActionSimulator (experimental)") wx_option(wxUSE_DC_TRANSFORM_MATRIX "use wxDC::SetTransformMatrix and related") wx_option(wxUSE_WEBVIEW_WEBKIT "use wxWebView WebKit backend") @@ -403,6 +400,7 @@ if(WIN32) set(wxUSE_WINRT_DEFAULT OFF) endif() wx_option(wxUSE_WINRT "enable WinRT support" ${wxUSE_WINRT_DEFAULT}) + wx_option(wxUSE_ACCESSIBILITY "enable accessibility support") endif() # this one is not really MSW-specific but it exists mainly to be turned off diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 0e19f47d72..09a299ffbd 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -264,13 +264,15 @@ if(WIN32) wx_add_sample(dll sdk_exe.cpp my_dll.h NAME sdk_exe FOLDER dll LIBRARIES my_dll) endif() - if(MSVC) - wx_add_sample(flash) - endif() - #TODO: reenable when sample is fixed - #wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) - wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc) - wx_add_sample(oleauto DEPENDS wxUSE_OLE) + wx_add_sample(regtest RES regtest.rc DEPENDS wxUSE_REGKEY) - wx_add_sample(taskbarbutton DEPENDS wxUSE_TASKBARBUTTON) + wx_add_sample(oleauto DEPENDS wxUSE_OLE) + + if(WXMSW) + wx_add_sample(nativdlg nativdlg.cpp nativdlg.h resource.h RES nativdlg.rc) + #TODO: reenable when sample is fixed + #wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) + wx_add_sample(taskbarbutton DEPENDS wxUSE_TASKBARBUTTON) + wx_add_sample(flash DEPENDS wxUSE_ACTIVEX) + endif() endif() diff --git a/build/cmake/toolkit.cmake b/build/cmake/toolkit.cmake index 02f9982920..2117f7cace 100644 --- a/build/cmake/toolkit.cmake +++ b/build/cmake/toolkit.cmake @@ -46,6 +46,8 @@ if(wxBUILD_TOOLKIT MATCHES "^gtk*") set(WXGTK ON) elseif(wxBUILD_TOOLKIT MATCHES "^osx*") set(WXOSX ON) +elseif(wxBUILD_TOOLKIT MATCHES "qt") + set(WXQT ON) endif() set(wxTOOLKIT_DEFINITIONS __WX${toolkit_upper}__) @@ -113,7 +115,19 @@ if(WXGTK) endif() endif() +if(WXQT) + set(QT_COMPONENTS Core Widgets Gui OpenGL Test) + foreach(QT_COMPONENT ${QT_COMPONENTS}) + find_package(Qt5 COMPONENTS ${QT_COMPONENT} REQUIRED) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${Qt5${QT_COMPONENT}_INCLUDE_DIRS}) + list(APPEND wxTOOLKIT_LIBRARIES ${Qt5${QT_COMPONENT}_LIBRARIES}) + list(APPEND wxTOOLKIT_DEFINITIONS ${Qt5${QT_COMPONENT}_COMPILE_DEFINITIONS}) + endforeach() + set(wxTOOLKIT_VERSION ${Qt5Core_VERSION}) +endif() + if(APPLE) list(APPEND wxTOOLKIT_DEFINITIONS __WXMAC__ __WXOSX__) endif() + endif() # wxUSE_GUI diff --git a/build/files b/build/files index 19bdf348ec..13b2eae984 100644 --- a/build/files +++ b/build/files @@ -398,6 +398,12 @@ QT_SRC= MEDIA_QT_SRC= src/qt/mediactrl.cpp +OPENGL_QT_HDR= + wx/qt/glcanvas.h + +OPENGL_QT_SRC= + src/qt/glcanvas.cpp + ## Common BASE_CMN_SRC = From f5b4d707b82d95f50071354b3722d8206127183e Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:45:42 +0200 Subject: [PATCH 043/231] Do not use variable-length array in WXQT wxRegion This is not supported by MSVC compiler. --- src/qt/region.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qt/region.cpp b/src/qt/region.cpp index ad6551d3ea..45936ab577 100644 --- a/src/qt/region.cpp +++ b/src/qt/region.cpp @@ -10,6 +10,7 @@ #include "wx/region.h" #include "wx/bitmap.h" +#include "wx/scopedarray.h" #include "wx/qt/private/converter.h" #include "wx/qt/private/utils.h" @@ -106,8 +107,8 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance) return; } - unsigned char raw[bmp.GetWidth()*bmp.GetHeight()]; - memset(raw, 0, bmp.GetWidth()*bmp.GetHeight()); + wxScopedArray raw(bmp.GetWidth()*bmp.GetHeight()); + memset(raw.get(), 0, bmp.GetWidth()*bmp.GetHeight()); QImage img(bmp.GetHandle()->toImage()); int r = transp.Red(), g = transp.Green(), b = transp.Blue(); @@ -125,7 +126,7 @@ wxRegion::wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance) } } - m_refData = new wxRegionRefData(QBitmap::fromData(bmp.GetHandle()->size(), raw)); + m_refData = new wxRegionRefData(QBitmap::fromData(bmp.GetHandle()->size(), raw.get())); } bool wxRegion::IsEmpty() const From 8f017509f6e037cf150e472b63f9477709ebc38f Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:52:58 +0200 Subject: [PATCH 044/231] Remove wxConsoleEventLoop from WXQT The console event loop in the wxBase library is GUI toolkit independent. --- include/wx/qt/evtloop.h | 14 +------------- src/qt/evtloop.cpp | 12 ------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/include/wx/qt/evtloop.h b/include/wx/qt/evtloop.h index 6034a808a7..25ea24a8dc 100644 --- a/include/wx/qt/evtloop.h +++ b/include/wx/qt/evtloop.h @@ -10,7 +10,7 @@ class QTimer; -class WXDLLIMPEXP_BASE wxQtEventLoopBase : public wxEventLoopBase +class WXDLLIMPEXP_CORE wxQtEventLoopBase : public wxEventLoopBase { public: wxQtEventLoopBase(); @@ -44,18 +44,6 @@ public: wxGUIEventLoop(); }; -#else // !wxUSE_GUI - -#if wxUSE_CONSOLE_EVENTLOOP - -class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxQtEventLoopBase -{ -public: - wxConsoleEventLoop(); -}; - -#endif // wxUSE_CONSOLE_EVENTLOOP - #endif // wxUSE_GUI #endif // _WX_QT_EVTLOOP_H_ diff --git a/src/qt/evtloop.cpp b/src/qt/evtloop.cpp index a0f1d549f9..2cb13ba0f6 100644 --- a/src/qt/evtloop.cpp +++ b/src/qt/evtloop.cpp @@ -259,16 +259,4 @@ wxGUIEventLoop::wxGUIEventLoop() { } -#else // !wxUSE_GUI - -//############################################################################# - -#if wxUSE_CONSOLE_EVENTLOOP - -wxConsoleEventLoop::wxConsoleEventLoop() -{ -} - -#endif // wxUSE_CONSOLE_EVENTLOOP - #endif // wxUSE_GUI From 487a3854a3f551905e2531898a0cb625fdf96838 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 23:23:57 +0200 Subject: [PATCH 045/231] Fix building stc library with WXQT When using MSVC compiler, wxUSE_GRAPHICS_DIRECT2D is automatically enabled in setup.h. But it is only available with WXMSW toolkit, not WXGTK or WXQT. --- src/stc/PlatWX.cpp | 18 +++++++++++------- src/stc/ScintillaWX.cpp | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 1efb9d9de0..8a21bce9ab 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -44,7 +44,11 @@ #include "wx/stc/stc.h" #include "wx/stc/private.h" -#if wxUSE_GRAPHICS_DIRECT2D +#if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D +#define HAVE_DIRECTWRITE_TECHNOLOGY +#endif + +#ifdef HAVE_DIRECTWRITE_TECHNOLOGY #include "ScintillaWX.h" #include #include "wx/dcscreen.h" @@ -165,11 +169,11 @@ void Font::Create(const FontParameters &fp) { wxFontWithAscent* newFont = new wxFontWithAscent(font); fid = newFont; -#if wxUSE_GRAPHICS_DIRECT2D +#ifdef HAVE_DIRECTWRITE_TECHNOLOGY if ( fp.technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) { newFont->SetSurfaceFontData(new SurfaceFontDataD2D(fp)); } -#endif // wxUSE_GRAPHICS_DIRECT2D +#endif // HAVE_DIRECTWRITE_TECHNOLOGY } @@ -694,7 +698,7 @@ void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) { // dbcsMode = codePage == SC_CP_DBCS; } -#if wxUSE_GRAPHICS_DIRECT2D +#ifdef HAVE_DIRECTWRITE_TECHNOLOGY //---------------------------------------------------------------------- // SurfaceFontDataD2D @@ -1805,16 +1809,16 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, } } -#endif // wxUSE_GRAPHICS_DIRECT2D +#endif // HAVE_DIRECTWRITE_TECHNOLOGY Surface *Surface::Allocate(int technology) { wxUnusedVar(technology); -#if wxUSE_GRAPHICS_DIRECT2D +#ifdef HAVE_DIRECTWRITE_TECHNOLOGY if ( technology == wxSTC_TECHNOLOGY_DIRECTWRITE ) { return new SurfaceD2D; } -#endif // wxUSE_GRAPHICS_DIRECT2D +#endif // HAVE_DIRECTWRITE_TECHNOLOGY return new SurfaceImpl; } diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index ad5f506c35..dc65fcedf9 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -825,7 +825,7 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) } #endif -#if wxUSE_GRAPHICS_DIRECT2D +#if defined(__WXMSW__) && wxUSE_GRAPHICS_DIRECT2D case SCI_SETTECHNOLOGY: if ((wParam == SC_TECHNOLOGY_DEFAULT) || (wParam == SC_TECHNOLOGY_DIRECTWRITE)) { if (technology != static_cast(wParam)) { From bb82470640d9f9677de95112b43bfe92aa042f65 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 26 Sep 2018 19:57:42 +0200 Subject: [PATCH 046/231] Fix missing gl functions in WXQT --- include/wx/qt/glcanvas.h | 23 +++++++++++++++++++- src/qt/glcanvas.cpp | 45 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/include/wx/qt/glcanvas.h b/include/wx/qt/glcanvas.h index a67efa09b0..0e872e343f 100644 --- a/include/wx/qt/glcanvas.h +++ b/include/wx/qt/glcanvas.h @@ -17,7 +17,9 @@ class QGLFormat; class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase { public: - wxGLContext(wxGLCanvas *win, const wxGLContext* other = NULL); + wxGLContext(wxGLCanvas *win, + const wxGLContext *other = NULL, + const wxGLContextAttrs *ctxAttrs = NULL); /// virtual ~wxGLContext(); virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE; @@ -36,6 +38,16 @@ class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase { public: explicit // avoid implicitly converting a wxWindow* to wxGLCanvas + wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + explicit wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, const int *attribList = NULL, @@ -45,6 +57,15 @@ public: const wxString& name = wxGLCanvasName, const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, diff --git a/src/qt/glcanvas.cpp b/src/qt/glcanvas.cpp index ba8b49678b..2430d84384 100644 --- a/src/qt/glcanvas.cpp +++ b/src/qt/glcanvas.cpp @@ -329,7 +329,7 @@ void wxGLAttributes::AddDefaultsForWXBefore31() wxIMPLEMENT_CLASS(wxGLContext, wxWindow); -wxGLContext::wxGLContext(wxGLCanvas *WXUNUSED(win), const wxGLContext* WXUNUSED(other)) +wxGLContext::wxGLContext(wxGLCanvas *WXUNUSED(win), const wxGLContext* WXUNUSED(other), const wxGLContextAttrs *WXUNUSED(ctxAttrs)) { // m_glContext = win->GetHandle()->context(); } @@ -347,6 +347,18 @@ bool wxGLContext::SetCurrent(const wxGLCanvas&) const wxIMPLEMENT_CLASS(wxGLCanvas, wxWindow); +wxGLCanvas::wxGLCanvas(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) +{ + Create(parent, dispAttrs, id, pos, size, style, name, palette); +} + wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, const int *attribList, @@ -359,6 +371,19 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, Create(parent, id, pos, size, style, name, attribList, palette); } +bool wxGLCanvas::Create(wxWindow *parent, + const wxGLAttributes& dispAttrs, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + const wxPalette& palette) +{ + wxLogError("Missing implementation of " + wxString(__FUNCTION__)); + return false; +} + bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -509,4 +534,22 @@ wxGLCanvasBase::IsDisplaySupported(const int *attribList) return QGLWidget(format).isValid(); } +/* static */ +bool +wxGLCanvasBase::IsDisplaySupported(const wxGLAttributes& dispAttrs) +{ + wxLogError("Missing implementation of " + wxString(__FUNCTION__)); + return false; +} + +// ---------------------------------------------------------------------------- +// wxGLApp +// ---------------------------------------------------------------------------- + +bool wxGLApp::InitGLVisual(const int *attribList) +{ + wxLogError("Missing implementation of " + wxString(__FUNCTION__)); + return false; +} + #endif // wxUSE_GLCANVAS From 4e23b3e7f4c9106661c8f2584b3c33656d8fc28f Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 30 Sep 2018 00:25:29 +0200 Subject: [PATCH 047/231] Fix missing wxOwnerDrawn functions in WXQT wxMenuItem --- include/wx/qt/menuitem.h | 23 +++++++++++++++++++++++ src/qt/menuitem.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/wx/qt/menuitem.h b/include/wx/qt/menuitem.h index 158007fc4e..953e48c565 100644 --- a/include/wx/qt/menuitem.h +++ b/include/wx/qt/menuitem.h @@ -9,12 +9,20 @@ #define _WX_QT_MENUITEM_H_ #include "wx/menuitem.h" + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" +#endif + class QAction; class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase +#if wxUSE_OWNER_DRAWN + , public wxOwnerDrawnBase +#endif { public: wxMenuItem(wxMenu *parentMenu = NULL, @@ -33,15 +41,30 @@ public: virtual void Check(bool check = true); virtual bool IsChecked() const; + void SetBitmaps(const wxBitmap& bmpChecked, + const wxBitmap& bmpUnchecked = wxNullBitmap); void SetBitmap(const wxBitmap& bitmap); const wxBitmap& GetBitmap() const; virtual QAction *GetHandle() const; +#if wxUSE_OWNER_DRAWN + void SetDisabledBitmap(const wxBitmap& bmpDisabled); + const wxBitmap& GetDisabledBitmap() const; + + // override wxOwnerDrawn base class virtuals + virtual wxString GetName() const wxOVERRIDE; + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) wxOVERRIDE; +#endif // wxUSE_OWNER_DRAWN + private: // Qt is using an action instead of a menu item. QAction *m_qtAction; +#if wxUSE_OWNER_DRAWN + wxBitmap m_bmpDisabled; +#endif // wxUSE_OWNER_DRAWN + wxDECLARE_DYNAMIC_CLASS( wxMenuItem ); }; diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index eab049e342..85106eff59 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -106,6 +106,12 @@ bool wxMenuItem::IsChecked() const } +void wxMenuItem::SetBitmaps(const wxBitmap& WXUNUSED(bmpChecked), + const wxBitmap& WXUNUSED(bmpUnchecked)) +{ + wxMISSING_FUNCTION(); +} + void wxMenuItem::SetBitmap(const wxBitmap& WXUNUSED(bitmap)) { wxMISSING_FUNCTION(); @@ -125,6 +131,34 @@ QAction *wxMenuItem::GetHandle() const return m_qtAction; } +#if wxUSE_OWNER_DRAWN + +void wxMenuItem::SetDisabledBitmap(const wxBitmap& bmpDisabled) +{ + m_bmpDisabled = bmpDisabled; + wxMISSING_FUNCTION(); +} + +const wxBitmap& wxMenuItem::GetDisabledBitmap() const +{ + wxMISSING_FUNCTION(); + return m_bmpDisabled; +} + +wxString wxMenuItem::GetName() const +{ + return GetItemLabelText(); +} + +bool wxMenuItem::OnDrawItem(wxDC& WXUNUSED(dc), const wxRect& WXUNUSED(rc), + wxODAction WXUNUSED(act), wxODStatus WXUNUSED(stat)) +{ + wxMISSING_FUNCTION(); + return false; +} + +#endif // wxUSE_OWNER_DRAWN + //============================================================================= wxQtAction::wxQtAction( wxMenu *parent, int id, const wxString &text, const wxString &help, From 7f0d7ef5200e35ea50e7ea593804b455cb0a0a13 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 21:28:30 +0200 Subject: [PATCH 048/231] Fix several build errors in WXQT Move declaration of wxOwnerDrawnBase::ms_defaultMargin to correct file. Do not include headers when wxUSE_UIACTIONSIMULATOR is disabled. Add guards for wxUSE_DRAG_AND_DROP. Use a different wxFont constructor in printing sample, which is also available in WXQT. --- include/wx/qt/window.h | 2 ++ samples/printing/printing.cpp | 2 +- src/common/ownerdrwcmn.cpp | 6 ++++++ src/msw/ownerdrw.cpp | 6 ------ src/qt/dnd.cpp | 3 +++ src/qt/uiaction.cpp | 4 ++-- src/qt/window.cpp | 2 ++ 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index 192ae2b54a..df402a42d4 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -133,7 +133,9 @@ public: QWidget *GetHandle() const wxOVERRIDE; +#if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ) wxOVERRIDE; +#endif #if wxUSE_ACCEL // accelerators diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index 719ccb63bc..c3448b09f5 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -106,7 +106,7 @@ bool MyApp::OnInit(void) m_bitmap = image; #endif m_angle = 30; - m_testFont.Create(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); + m_testFont = wxFontInfo(10).Family(wxFONTFAMILY_SWISS); // Create the main frame window diff --git a/src/common/ownerdrwcmn.cpp b/src/common/ownerdrwcmn.cpp index 967a5a285b..faa6b4240a 100644 --- a/src/common/ownerdrwcmn.cpp +++ b/src/common/ownerdrwcmn.cpp @@ -36,6 +36,12 @@ #include "wx/utils.h" #endif +// ---------------------------------------------------------------------------- +// constants for base class +// ---------------------------------------------------------------------------- + +int wxOwnerDrawnBase::ms_defaultMargin = 3; + // ============================================================================ // implementation // ============================================================================ diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index 166e84542d..fa3ef819b7 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -23,12 +23,6 @@ #include "wx/msw/private/dc.h" #include "wx/msw/wrapcctl.h" // for HIMAGELIST -// ---------------------------------------------------------------------------- -// constants for base class -// ---------------------------------------------------------------------------- - -int wxOwnerDrawnBase::ms_defaultMargin = 3; - // ============================================================================ // implementation of wxOwnerDrawn class // ============================================================================ diff --git a/src/qt/dnd.cpp b/src/qt/dnd.cpp index 3b7fda37b8..7e99e94ec2 100644 --- a/src/qt/dnd.cpp +++ b/src/qt/dnd.cpp @@ -8,6 +8,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#if wxUSE_DRAG_AND_DROP + #include "wx/dnd.h" wxDropTarget::wxDropTarget(wxDataObject *WXUNUSED(dataObject)) @@ -58,3 +60,4 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) return wxDragResult(); } +#endif // wxUSE_DRAG_AND_DROP diff --git a/src/qt/uiaction.cpp b/src/qt/uiaction.cpp index 1ac40a3916..5ca92385b8 100644 --- a/src/qt/uiaction.cpp +++ b/src/qt/uiaction.cpp @@ -12,6 +12,8 @@ #pragma hdrstop #endif +#if wxUSE_UIACTIONSIMULATOR + #include "wx/uiaction.h" #include "wx/private/uiaction.h" @@ -24,8 +26,6 @@ #include "wx/qt/private/converter.h" -#if wxUSE_UIACTIONSIMULATOR - using namespace Qt; using namespace QTest; diff --git a/src/qt/window.cpp b/src/qt/window.cpp index b82a4e3054..183a277f89 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -650,10 +650,12 @@ void wxWindowQt::ScrollWindow( int dx, int dy, const wxRect *rect ) } +#if wxUSE_DRAG_AND_DROP void wxWindowQt::SetDropTarget( wxDropTarget * WXUNUSED( dropTarget ) ) { wxMISSING_IMPLEMENTATION( __FUNCTION__ ); } +#endif void wxWindowQt::SetWindowStyleFlag( long style ) { From bf823e0419f2abb3baac7a41eb0242cb6059397f Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:57:40 +0200 Subject: [PATCH 049/231] Check if AppVeyor should abort before cloning the repo --- appveyor.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5b3d335e05..5a416536d7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,6 +41,13 @@ clone_depth: 50 install: git submodule update --init +init: +- ps: | + if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` + https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` + Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` + throw "There are newer queued builds for this pull request, failing early." } + before_build: - ps: | $env:PATH = $env:PATH -replace "C:\\Program Files\\Git\\usr\\bin","" @@ -49,10 +56,6 @@ before_build: %{$_ -replace "define wxUSE_STL 0", "define wxUSE_STL $env:wxUSE_STL"} | sc include\wx\msw\setup.h } - if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } build_script: c:\projects\wxwidgets\build\tools\appveyor.bat From f7d1f46144a052ad271a151602da7e9c50e49d5b Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 25 Sep 2018 19:46:21 +0200 Subject: [PATCH 050/231] Build WXQT toolkit with AppVeyor --- appveyor.yml | 4 ++++ build/tools/appveyor-test.bat | 7 ++++++- build/tools/appveyor.bat | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5a416536d7..6737b09320 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,6 +36,10 @@ environment: GENERATOR: 'Visual Studio 12' SHARED: ON CONFIGURATION: Release + - TOOLSET: cmake_qt + GENERATOR: 'Visual Studio 14 2015 Win64' + SHARED: ON + CONFIGURATION: Release clone_depth: 50 diff --git a/build/tools/appveyor-test.bat b/build/tools/appveyor-test.bat index 3149c807eb..d9eb84dad4 100755 --- a/build/tools/appveyor-test.bat +++ b/build/tools/appveyor-test.bat @@ -42,10 +42,15 @@ echo --- Note: ignoring possible test failures under Cygwin echo. exit /b 0 +:cmake_qt +set CMAKE_TEST_REGEX="test_base" +goto :cmake + :cmake if "%CONFIGURATION%"=="" set CONFIGURATION=Release +if "%CMAKE_TEST_REGEX%"=="" set CMAKE_TEST_REGEX="test_[base|gui]" cd ..\build_cmake -ctest -V -C %CONFIGURATION% -R "test_[base|gui]" --output-on-failure --interactive-debug-mode 0 . +ctest -V -C %CONFIGURATION% -R %CMAKE_TEST_REGEX% --output-on-failure --interactive-debug-mode 0 . if %errorlevel% NEQ 0 goto :error goto :eof diff --git a/build/tools/appveyor.bat b/build/tools/appveyor.bat index c2bc21f345..17a14d0369 100644 --- a/build/tools/appveyor.bat +++ b/build/tools/appveyor.bat @@ -78,6 +78,12 @@ set SKIPTESTS=1 set CMAKE_NATIVE_FLAGS=-j3 goto cmake +:cmake_qt +set SKIPINSTALL=1 +set QT5DIR="C:\Qt\5.11\msvc2015_64" +set CMAKE_CONFIGURE_FLAGS=-DCMAKE_PREFIX_PATH=%QT5DIR% -DwxBUILD_TOOLKIT="qt" -DCMAKE_CXX_STANDARD=11 +goto cmake + :cmake echo --- Tools versions: cmake --version From fa19acacbecb6919a83519ebd09c7cc92999bffa Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 30 Sep 2018 19:49:54 +0200 Subject: [PATCH 051/231] Improve WXGTK build on Windows with CMake --- build/cmake/init.cmake | 27 ++++++++++ build/cmake/lib/core/CMakeLists.txt | 8 +++ build/cmake/modules/FindFontconfig.cmake | 69 ++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 build/cmake/modules/FindFontconfig.cmake diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index f967050c5a..919ce4c570 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -165,6 +165,25 @@ if(wxUSE_GUI) endif() endif() + # WXGTK checks, match include/wx/gtk/chkconf.h + if(WXGTK) + wx_option_force_value(wxUSE_METAFILE OFF) + + if(WIN32) + wx_option_force_value(wxUSE_CAIRO ON) + wx_option_force_value(wxUSE_ACCESSIBILITY OFF) + wx_option_force_value(wxUSE_OWNER_DRAWN OFF) + endif() + + if(NOT UNIX) + wx_option_force_value(wxUSE_WEBVIEW OFF) + wx_option_force_value(wxUSE_MEDIACTRL OFF) + wx_option_force_value(wxUSE_UIACTIONSIMULATOR OFF) + wx_option_force_value(wxUSE_OPENGL OFF) + set(wxUSE_GLCANVAS OFF) + endif() + endif() + # extra dependencies if(wxUSE_OPENGL) find_package(OpenGL) @@ -183,6 +202,14 @@ if(wxUSE_GUI) endif() endif() + if(wxUSE_PRIVATE_FONTS AND WXGTK) + find_package(Fontconfig) + if(NOT FONTCONFIG_FOUND) + message(WARNING "Fontconfig not found, Private fonts won't be available") + wx_option_force_value(wxUSE_PRIVATE_FONTS OFF) + endif() + endif() + if(wxUSE_MEDIACTRL AND UNIX AND NOT APPLE AND NOT WIN32) find_package(GStreamer) if(NOT GSTREAMER_FOUND) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 20e4636cbf..e7ed60ef67 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -71,5 +71,13 @@ if(WXOSX_COCOA) "-framework AudioToolbox" ) endif() +if(WXGTK AND wxUSE_PRIVATE_FONTS) + wx_lib_include_directories(core PUBLIC + ${FONTCONFIG_INCLUDE_DIR} + ) + wx_lib_link_libraries(core PUBLIC + ${FONTCONFIG_LIBRARIES} + ) +endif() wx_finalize_lib(core) diff --git a/build/cmake/modules/FindFontconfig.cmake b/build/cmake/modules/FindFontconfig.cmake new file mode 100644 index 0000000000..e6fa81d8ef --- /dev/null +++ b/build/cmake/modules/FindFontconfig.cmake @@ -0,0 +1,69 @@ +# - Try to find the Fontconfig +# Once done this will define +# +# FONTCONFIG_FOUND - system has Fontconfig +# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers +# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG +# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG + +# Copyright (c) 2006,2007 Laurent Montel, +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) + + # in cache already + set(FONTCONFIG_FOUND TRUE) + +else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) + + if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_FONTCONFIG fontconfig) + + set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) + endif (NOT WIN32) + + find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h + PATHS + ${PC_FONTCONFIG_INCLUDEDIR} + ${PC_FONTCONFIG_INCLUDE_DIRS} + /usr/X11/include + ) + + find_library(FONTCONFIG_LIBRARIES NAMES fontconfig + PATHS + ${PC_FONTCONFIG_LIBDIR} + ${PC_FONTCONFIG_LIBRARY_DIRS} + ) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR ) + + mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR) + +endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) From c2162792cf24f2d59024bd06a921fd1ffde4f937 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Sep 2018 22:18:02 +0200 Subject: [PATCH 052/231] Implement wxDisplaySize() and wxClientDisplayRect() via wxDisplay Instead of forwarding to these functions from wxDisplay implementation in wxUSE_DISPLAY==0 case, make the functions themselves wrappers around wxDisplay, which may, or not, depending on the platform, have a simpler implementation in wxUSE_DISPLAY==0 case, but is always available in any case. As part of this change, only use src/osx/core/display.cpp in macOS builds, not iOS ones and update the Xcode project accordingly too. This cuts down on code duplication, especially in wxGTK, and facilitates further additions to wxDisplay API. --- Makefile.in | 53 +++----- build/bakefiles/files.bkl | 2 +- build/cmake/files.cmake | 2 +- build/files | 2 +- build/osx/wxiphone.xcodeproj/project.pbxproj | 4 - include/wx/private/display.h | 52 +++++++- src/common/dpycmn.cpp | 62 +--------- src/common/gdicmn.cpp | 32 ++++- src/dfb/utils.cpp | 44 ++++--- src/gtk/display.cpp | 122 +++++++++---------- src/gtk/utilsgtk.cpp | 16 --- src/motif/utils.cpp | 11 -- src/msw/display.cpp | 60 ++++++--- src/msw/utilsgui.cpp | 11 -- src/osx/cocoa/utils.mm | 14 +-- src/osx/core/display.cpp | 68 ++++++++--- src/osx/iphone/utils.mm | 90 ++++++-------- src/osx/utils_osx.cpp | 11 -- src/qt/display.cpp | 24 ++++ src/qt/utils.cpp | 18 --- src/unix/displayx11.cpp | 91 +++++++++----- src/x11/utils.cpp | 11 -- 22 files changed, 406 insertions(+), 394 deletions(-) diff --git a/Makefile.in b/Makefile.in index 342a4d4a29..66087484d8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3783,7 +3783,6 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/dialup.h \ wx/dirctrl.h \ wx/display.h \ - wx/display_impl.h \ wx/dnd.h \ wx/docmdi.h \ wx/docview.h \ @@ -5606,7 +5605,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS = \ monodll_timectrl_osx.o \ monodll_taskbarcmn.o \ monodll_cocoa_activityindicator.o \ - monodll_cocoa_statbmp.o + monodll_cocoa_statbmp.o \ + monodll_core_display.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \ $(__OSX_COMMON_SRC_OBJECTS) \ @@ -7571,7 +7571,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1 = \ monolib_timectrl_osx.o \ monolib_taskbarcmn.o \ monolib_cocoa_activityindicator.o \ - monolib_cocoa_statbmp.o + monolib_cocoa_statbmp.o \ + monolib_core_display.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_1) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \ $(__OSX_COMMON_SRC_OBJECTS_0) \ @@ -9683,7 +9684,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2 = \ coredll_timectrl_osx.o \ coredll_taskbarcmn.o \ coredll_cocoa_activityindicator.o \ - coredll_cocoa_statbmp.o + coredll_cocoa_statbmp.o \ + coredll_core_display.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_2) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \ $(__OSX_COMMON_SRC_OBJECTS_8) \ @@ -11390,7 +11392,8 @@ COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3 = \ corelib_timectrl_osx.o \ corelib_taskbarcmn.o \ corelib_cocoa_activityindicator.o \ - corelib_cocoa_statbmp.o + corelib_cocoa_statbmp.o \ + corelib_core_display.o @COND_TOOLKIT_OSX_COCOA@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_OSX_COCOA___GUI_SRC_OBJECTS_3) COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \ $(__OSX_COMMON_SRC_OBJECTS_9) \ @@ -13193,7 +13196,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \ monodll_core_bitmap.o \ monodll_core_colour.o \ monodll_core_dcmemory.o \ - monodll_core_display.o \ monodll_core_fontenum.o \ monodll_hid.o \ monodll_printmac.o \ @@ -13337,7 +13339,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \ monolib_core_bitmap.o \ monolib_core_colour.o \ monolib_core_dcmemory.o \ - monolib_core_display.o \ monolib_core_fontenum.o \ monolib_hid.o \ monolib_printmac.o \ @@ -13481,7 +13482,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \ coredll_core_bitmap.o \ coredll_core_colour.o \ coredll_core_dcmemory.o \ - coredll_core_display.o \ coredll_core_fontenum.o \ coredll_hid.o \ coredll_printmac.o \ @@ -13622,7 +13622,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \ corelib_core_bitmap.o \ corelib_core_colour.o \ corelib_core_dcmemory.o \ - corelib_core_display.o \ corelib_core_fontenum.o \ corelib_hid.o \ corelib_printmac.o \ @@ -16471,6 +16470,9 @@ monodll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm monodll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm +monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp + monodll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -18748,12 +18750,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @@ -21721,6 +21717,9 @@ monolib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm monolib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm +monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp + monolib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -23998,12 +23997,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @@ -27634,6 +27627,9 @@ coredll_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm coredll_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm +coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP) + $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp + coredll_regiong.o: $(srcdir)/src/generic/regiong.cpp $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -29341,12 +29337,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_core_display.o: $(srcdir)/src/osx/core/display.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp @@ -31879,6 +31869,9 @@ corelib_cocoa_activityindicator.o: $(srcdir)/src/osx/cocoa/activityindicator.mm corelib_cocoa_statbmp.o: $(srcdir)/src/osx/cocoa/statbmp.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/statbmp.mm +corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP) + $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp + corelib_regiong.o: $(srcdir)/src/generic/regiong.cpp $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/regiong.cpp @@ -33586,12 +33579,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_dcmemory.o: $(srcdir)/src/osx/core/dcmemory.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/dcmemory.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_core_display.o: $(srcdir)/src/osx/core/display.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/display.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_core_fontenum.o: $(srcdir)/src/osx/core/fontenum.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/core/fontenum.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 80b3217f79..1ed7be89a5 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2381,7 +2381,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.cpp src/osx/core/printmac.cpp @@ -2628,6 +2627,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/taskbarcmn.cpp src/osx/cocoa/activityindicator.mm src/osx/cocoa/statbmp.mm + src/osx/core/display.cpp wx/osx/cocoa/chkconf.h diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 5af3d5ac77..5b80c492bd 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2258,7 +2258,6 @@ set(OSX_LOWLEVEL_SRC src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.cpp src/osx/core/printmac.cpp @@ -2500,6 +2499,7 @@ set(OSX_COCOA_SRC src/osx/datectrl_osx.cpp src/osx/core/sound.cpp src/osx/cocoa/statbmp.mm + src/osx/core/display.cpp ) set(OSX_COCOA_HDR diff --git a/build/files b/build/files index abe00f1361..1150ec1f6e 100644 --- a/build/files +++ b/build/files @@ -2246,7 +2246,6 @@ OSX_LOWLEVEL_SRC = src/osx/core/bitmap.cpp src/osx/core/colour.cpp src/osx/core/dcmemory.cpp - src/osx/core/display.cpp src/osx/core/fontenum.cpp src/osx/core/hid.cpp src/osx/core/printmac.cpp @@ -2477,6 +2476,7 @@ OSX_COCOA_SRC = src/osx/cocoa/toolbar.mm src/osx/cocoa/tooltip.mm src/osx/cocoa/window.mm + src/osx/core/display.cpp src/osx/core/hidjoystick.cpp src/osx/core/sound.cpp src/osx/dataview_osx.cpp diff --git a/build/osx/wxiphone.xcodeproj/project.pbxproj b/build/osx/wxiphone.xcodeproj/project.pbxproj index 422f721df1..0b90d8c331 100644 --- a/build/osx/wxiphone.xcodeproj/project.pbxproj +++ b/build/osx/wxiphone.xcodeproj/project.pbxproj @@ -803,7 +803,6 @@ F0B3F484C38C3BA0B9927CD9 /* docmdi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ECC9F5C21ACB31A0B24AEE35 /* docmdi.cpp */; }; F0D892C2618130FEAD46BB86 /* panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00969CBE3B8F32C78C195619 /* panel.cpp */; }; F1E4D7CA634E33808AE3B522 /* fontenumcmn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 373242CD08F330208A7CF438 /* fontenumcmn.cpp */; }; - F1F484DD591337399FCD0463 /* display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5617D10CB7136EC9A4194EF /* display.cpp */; }; F22C401903993639AE05A295 /* xh_stbox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 147800BBCB80346798B35D75 /* xh_stbox.cpp */; }; F24F637D59F637CA9A7E23C9 /* xh_filectrl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 60EE4448A28D38F5ADE17B5A /* xh_filectrl.cpp */; }; F2813BF297C73A3ABD02EC98 /* glcanvas_osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA59091E3ED83FB781FB9659 /* glcanvas_osx.cpp */; }; @@ -1402,7 +1401,6 @@ A46D50BEBF523B3F88831086 /* LexAsn1.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../src/stc/scintilla/lexers/LexAsn1.cxx; sourceTree = ""; }; A4A745D1821A32D591D76650 /* imagiff.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = imagiff.cpp; path = ../../src/common/imagiff.cpp; sourceTree = ""; }; A54B80C17F823CB5900AD2E8 /* framecmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = framecmn.cpp; path = ../../src/common/framecmn.cpp; sourceTree = ""; }; - A5617D10CB7136EC9A4194EF /* display.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = display.cpp; path = ../../src/osx/core/display.cpp; sourceTree = ""; }; A5794CD687013AF8A20A691A /* headerctrlcmn.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = headerctrlcmn.cpp; path = ../../src/common/headerctrlcmn.cpp; sourceTree = ""; }; A57CF60203F53459A03951A9 /* arrstr.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = arrstr.cpp; path = ../../src/common/arrstr.cpp; sourceTree = ""; }; A5BBC1E494D33D028CA547FF /* jddctmgr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jddctmgr.c; path = ../../src/jpeg/jddctmgr.c; sourceTree = ""; }; @@ -1953,7 +1951,6 @@ A1A53EC3A3463EFDB7614E93 /* bitmap.cpp */, 9D1F14339D1C331087650931 /* colour.cpp */, 343D4FDD5CC030618EF24729 /* dcmemory.cpp */, - A5617D10CB7136EC9A4194EF /* display.cpp */, 36E1DBA275AD325DB759C180 /* fontenum.cpp */, 160EB9744CB63A0B81DC651F /* hid.cpp */, 5CC5C13F8AA1387BADB7E60C /* printmac.cpp */, @@ -3008,7 +3005,6 @@ 03BF1610E2FC3BD5ACB754F0 /* bitmap.cpp in Sources */, FF50EC0EC5F23DF890C6E95F /* colour.cpp in Sources */, BD2B17EB72E73A6EB6E0B26F /* dcmemory.cpp in Sources */, - F1F484DD591337399FCD0463 /* display.cpp in Sources */, 371809DA4AD1382F8B532878 /* fontenum.cpp in Sources */, 86BE5213D3F131D8A6862679 /* hid.cpp in Sources */, AB58406CEBA13BC4A2A83B66 /* printmac.cpp in Sources */, diff --git a/include/wx/private/display.h b/include/wx/private/display.h index 9e0f399c28..2635758fe8 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -10,6 +10,7 @@ #ifndef _WX_PRIVATE_DISPLAY_H_ #define _WX_PRIVATE_DISPLAY_H_ +#include "wx/display.h" #include "wx/gdicmn.h" // for wxRect #include "wx/vector.h" @@ -112,18 +113,63 @@ protected: wxDECLARE_NO_COPY_CLASS(wxDisplayImpl); }; +// ---------------------------------------------------------------------------- +// wxDisplayImplSingle: the simplest possible impl for the main display only +// ---------------------------------------------------------------------------- + +// Note that this is still an ABC and GetGeometry() and GetClientArea() methods +// must be implemented in the derived classes. + +class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl +{ +public: + wxDisplayImplSingle() : wxDisplayImpl(0) { } + + virtual wxString GetName() const wxOVERRIDE { return wxString(); } + +#if wxUSE_DISPLAY + // no video modes support for us, provide just the stubs + virtual wxArrayVideoModes + GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE + { + return wxArrayVideoModes(); + } + + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE + { + return wxVideoMode(); + } + + virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE + { + return false; + } +#endif // wxUSE_DISPLAY + + wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle); +}; + // ---------------------------------------------------------------------------- // wxDisplayFactorySingle // ---------------------------------------------------------------------------- -// this is a stub implementation using single/main display only, it is -// available even if wxUSE_DISPLAY == 0 +// This is the simplest implementation of wxDisplayFactory using single/main +// display only. It is used when wxUSE_DISPLAY == 0 because getting the size of +// the main display is always needed. +// +// Note that this is still an ABC and derived classes must implement +// CreateSingleDisplay(). + class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory { public: - virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; virtual unsigned GetCount() wxOVERRIDE { return 1; } virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; + +protected: + virtual wxDisplayImpl *CreateDisplay(unsigned n) wxOVERRIDE; + + virtual wxDisplayImpl *CreateSingleDisplay() = 0; }; #endif // _WX_PRIVATE_DISPLAY_H_ diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 9e59f0aeba..cd49ae60ec 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -29,7 +29,6 @@ #include "wx/module.h" #endif //WX_PRECOMP -#include "wx/display.h" #include "wx/private/display.h" #if wxUSE_DISPLAY @@ -50,43 +49,6 @@ const wxVideoMode wxDefaultVideoMode; // created on demand and destroyed by wxDisplayModule static wxDisplayFactory *gs_factory = NULL; -// ---------------------------------------------------------------------------- -// wxDisplayImplSingle: trivial implementation working for main display only -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl -{ -public: - wxDisplayImplSingle() : wxDisplayImpl(0) { } - - virtual wxRect GetGeometry() const wxOVERRIDE - { - wxRect r; - wxDisplaySize(&r.width, &r.height); - return r; - } - - virtual wxRect GetClientArea() const wxOVERRIDE { return wxGetClientDisplayRect(); } - - virtual wxString GetName() const wxOVERRIDE { return wxString(); } - -#if wxUSE_DISPLAY - // no video modes support for us, provide just the stubs - - virtual wxArrayVideoModes GetModes(const wxVideoMode& WXUNUSED(mode)) const wxOVERRIDE - { - return wxArrayVideoModes(); - } - - virtual wxVideoMode GetCurrentMode() const wxOVERRIDE { return wxVideoMode(); } - - virtual bool ChangeMode(const wxVideoMode& WXUNUSED(mode)) wxOVERRIDE { return false; } -#endif // wxUSE_DISPLAY - - - wxDECLARE_NO_COPY_CLASS(wxDisplayImplSingle); -}; - // ---------------------------------------------------------------------------- // wxDisplayModule is used to cleanup gs_factory // ---------------------------------------------------------------------------- @@ -201,16 +163,6 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode) // static functions implementation // ---------------------------------------------------------------------------- -// if wxUSE_DISPLAY == 1 this is implemented in port-specific code -#if !wxUSE_DISPLAY - -/* static */ wxDisplayFactory *wxDisplay::CreateFactory() -{ - return new wxDisplayFactorySingle; -} - -#endif // !wxUSE_DISPLAY - /* static */ wxDisplayFactory& wxDisplay::Factory() { if ( !gs_factory ) @@ -248,20 +200,10 @@ int wxDisplayFactory::GetFromWindow(const wxWindow *window) wxDisplayImpl *wxDisplayFactorySingle::CreateDisplay(unsigned n) { // we recognize the main display only - return n != 0 ? NULL : new wxDisplayImplSingle; + return n != 0 ? NULL : CreateSingleDisplay(); } int wxDisplayFactorySingle::GetFromPoint(const wxPoint& pt) { - if ( pt.x >= 0 && pt.y >= 0 ) - { - int w, h; - wxDisplaySize(&w, &h); - - if ( pt.x < w && pt.y < h ) - return 0; - } - - // the point is outside of the screen - return wxNOT_FOUND; + return wxDisplay().GetGeometry().Contains(pt) ? 0 : wxNOT_FOUND; } diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 6d16a12d60..771db4ac72 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -16,6 +16,8 @@ #endif #include "wx/gdicmn.h" + +#include "wx/display.h" #include "wx/gdiobj.h" #ifndef WX_PRECOMP @@ -843,18 +845,36 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, return font; } +void wxDisplaySize(int *width, int *height) +{ + const wxSize size = wxGetDisplaySize(); + if ( width ) + *width = size.x; + if ( height ) + *height = size.y; +} + wxSize wxGetDisplaySize() { - int x, y; - wxDisplaySize(& x, & y); - return wxSize(x, y); + return wxDisplay().GetGeometry().GetSize(); +} + +void wxClientDisplayRect(int *x, int *y, int *width, int *height) +{ + const wxRect rect = wxGetClientDisplayRect(); + if ( x ) + *x = rect.x; + if ( y ) + *y = rect.y; + if ( width ) + *width = rect.width; + if ( height ) + *height = rect.height; } wxRect wxGetClientDisplayRect() { - int x, y, width, height; - wxClientDisplayRect(&x, &y, &width, &height); // call plat-specific version - return wxRect(x, y, width, height); + return wxDisplay().GetClientArea(); } wxSize wxGetDisplaySizeMM() diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index 57e9a3d1a1..76c84a5c50 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -17,6 +17,7 @@ #include "wx/utils.h" #include "wx/evtloop.h" #include "wx/apptrait.h" +#include "wx/private/display.h" #include "wx/unix/private/timer.h" #ifndef WX_PRECOMP @@ -56,6 +57,33 @@ wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) // display characteristics // ---------------------------------------------------------------------------- +// TODO: move into a separate src/dfb/display.cpp + +class wxDisplayImplSingleDFB : public wxDisplayImplSingle +{ +public: + virtual wxRect GetGeometry() const wxOVERRIDE + { + const wxVideoMode mode(wxTheApp->GetDisplayMode()); + + return wxRect(0, 0, mode.w, mode.h); + } +}; + +class wxDisplayFactorySingleDFB : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() + { + return new wxDisplayImplSingleDFB; + } +}; + +wxDisplayFactory* wxDisplay::CreateFactory() +{ + return new wxDisplayFactorySingleDFB; +} + bool wxColourDisplay() { #warning "FIXME: wxColourDisplay" @@ -67,13 +95,6 @@ int wxDisplayDepth() return wxTheApp->GetDisplayMode().bpp; } -void wxDisplaySize(int *width, int *height) -{ - wxVideoMode mode(wxTheApp->GetDisplayMode()); - if ( width ) *width = mode.w; - if ( height ) *height = mode.h; -} - void wxDisplaySizeMM(int *width, int *height) { // FIXME: there's no way to get physical resolution using the DirectDB @@ -89,15 +110,6 @@ void wxDisplaySizeMM(int *width, int *height) #undef PX_TO_MM } -void wxClientDisplayRect(int *x, int *y, int *width, int *height) -{ - // return desktop dimensions minus any panels, menus, trays: - if (x) *x = 0; - if (y) *y = 0; - wxDisplaySize(width, height); -} - - //----------------------------------------------------------------------------- // mouse //----------------------------------------------------------------------------- diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index cc00c499dd..eb68667724 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -8,11 +8,7 @@ #include "wx/wxprec.h" -#if wxUSE_DISPLAY - #include "wx/display.h" - #include "wx/private/display.h" -#endif -#include "wx/utils.h" // wxClientDisplayRect +#include "wx/private/display.h" #include "wx/gtk/private/wrapgtk.h" #ifdef GDK_WINDOWING_X11 @@ -75,61 +71,6 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* #endif // !__WXGTK4__ -void wxClientDisplayRect(int* x, int* y, int* width, int* height) -{ - GdkRectangle rect; - GdkWindow* window = wxGetTopLevelGDK(); -#ifdef __WXGTK4__ - GdkMonitor* monitor = - gdk_display_get_monitor_at_window(gdk_window_get_display(window), window); - gdk_monitor_get_workarea(monitor, &rect); -#else - GdkScreen* screen = gdk_window_get_screen(window); - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - int monitor = gdk_screen_get_monitor_at_window(screen, window); - gdk_screen_get_monitor_workarea(screen, monitor, &rect); - wxGCC_WARNING_RESTORE() -#endif - if (x) - *x = rect.x; - if (y) - *y = rect.y; - if (width) - *width = rect.width; - if (height) - *height = rect.height; -} -//----------------------------------------------------------------------------- - -#if wxUSE_DISPLAY -class wxDisplayFactoryGTK: public wxDisplayFactory -{ -public: - virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE; - virtual unsigned GetCount() wxOVERRIDE; - virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; -}; - -class wxDisplayImplGTK: public wxDisplayImpl -{ - typedef wxDisplayImpl base_type; -public: - wxDisplayImplGTK(unsigned i); - virtual wxRect GetGeometry() const wxOVERRIDE; - virtual wxRect GetClientArea() const wxOVERRIDE; - virtual wxString GetName() const wxOVERRIDE; - virtual bool IsPrimary() const wxOVERRIDE; - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; - virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; - virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; -#ifdef __WXGTK4__ - GdkMonitor* const m_monitor; -#else - GdkScreen* const m_screen; -#endif -}; -//----------------------------------------------------------------------------- - #ifdef __WXGTK4__ static inline GdkDisplay* GetDisplay() { @@ -142,6 +83,45 @@ static inline GdkScreen* GetScreen() } #endif +//----------------------------------------------------------------------------- + +// This class is always defined as it's used for the main display even when +// wxUSE_DISPLAY == 0. +class wxDisplayImplGTK : public wxDisplayImpl +{ + typedef wxDisplayImpl base_type; +public: + wxDisplayImplGTK(unsigned i); + virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxRect GetClientArea() const wxOVERRIDE; + +#if wxUSE_DISPLAY + virtual wxString GetName() const wxOVERRIDE; + virtual bool IsPrimary() const wxOVERRIDE; + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; +#endif // wxUSE_DISPLAY + +#ifdef __WXGTK4__ + GdkMonitor* const m_monitor; +#else + GdkScreen* const m_screen; +#endif +}; + +//----------------------------------------------------------------------------- + +// This class is only defined when we're built with full display support. +#if wxUSE_DISPLAY +class wxDisplayFactoryGTK: public wxDisplayFactory +{ +public: + virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; +}; + wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n) { return new wxDisplayImplGTK(n); @@ -185,6 +165,8 @@ int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) return monitor; #endif } +#endif // wxUSE_DISPLAY + //----------------------------------------------------------------------------- wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) @@ -223,6 +205,7 @@ wxRect wxDisplayImplGTK::GetClientArea() const return wxRect(rect.x, rect.y, rect.width, rect.height); } +#if wxUSE_DISPLAY wxString wxDisplayImplGTK::GetName() const { return wxString(); @@ -307,6 +290,23 @@ wxDisplayFactory* wxDisplay::CreateFactory() { return new wxDisplayFactoryGTK; } -#endif // wxUSE_DISPLAY + +#else // !wxUSE_DISPLAY + +class wxDisplayFactorySingleGTK : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() + { + return new wxDisplayImplGTK(0); + } +}; + +wxDisplayFactory* wxDisplay::CreateFactory() +{ + return wxDisplayFactorySingleGTK; +} + +#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY #endif // !defined(GDK_WINDOWING_WIN32) diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 7cdbd871c8..31a1d9a9ea 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -76,22 +76,6 @@ void *wxGetDisplay() } #endif -void wxDisplaySize( int *width, int *height ) -{ -#ifdef __WXGTK4__ - GdkMonitor* monitor = gdk_display_get_primary_monitor(gdk_display_get_default()); - GdkRectangle rect; - gdk_monitor_get_geometry(monitor, &rect); - if (width) *width = rect.width; - if (height) *height = rect.height; -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - if (width) *width = gdk_screen_width(); - if (height) *height = gdk_screen_height(); - wxGCC_WARNING_RESTORE() -#endif -} - void wxDisplaySizeMM( int *width, int *height ) { #ifdef __WXGTK4__ diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index d440bb0887..16c52e86a8 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -239,17 +239,6 @@ int wxDisplayDepth() return DefaultDepth (dpy, DefaultScreen (dpy)); } -// Get size of display -void wxDisplaySize(int *width, int *height) -{ - Display *dpy = wxGlobalDisplay(); - - if ( width ) - *width = DisplayWidth (dpy, DefaultScreen (dpy)); - if ( height ) - *height = DisplayHeight (dpy, DefaultScreen (dpy)); -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = wxGlobalDisplay(); diff --git a/src/msw/display.cpp b/src/msw/display.cpp index b096d1895d..771cb32132 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -24,11 +24,46 @@ #pragma hdrstop #endif +#include "wx/private/display.h" + +#include "wx/msw/private.h" #include "wx/msw/wrapwin.h" -#if wxUSE_DISPLAY +// This implementation is always available, whether wxUSE_DISPLAY is 1 or not, +// as we fall back to it in case of error. +class wxDisplayImplSingleMSW : public wxDisplayImplSingle +{ +public: + virtual wxRect GetGeometry() const wxOVERRIDE + { + ScreenHDC dc; -#include "wx/display.h" + return wxRect(0, 0, + ::GetDeviceCaps(dc, HORZRES), + ::GetDeviceCaps(dc, VERTRES)); + } + + virtual wxRect GetClientArea() const wxOVERRIDE + { + RECT rc; + SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); + + wxRect rectClient; + wxCopyRECTToRect(rc, rectClient); + return rectClient; + } +}; + +class wxDisplayFactorySingleMSW : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE + { + return new wxDisplayImplSingleMSW; + } +}; + +#if wxUSE_DISPLAY #ifndef WX_PRECOMP #include "wx/dynarray.h" @@ -39,9 +74,7 @@ #include "wx/dynlib.h" #include "wx/sysopt.h" -#include "wx/private/display.h" #include "wx/msw/missing.h" -#include "wx/msw/private.h" #include "wx/msw/private/hiddenwin.h" static const wxChar displayDllName[] = wxT("user32.dll"); @@ -170,7 +203,7 @@ wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; delete factoryMM; // fall back to a stub implementation if no multimon support (Win95?) - return new wxDisplayFactorySingle; + return new wxDisplayFactorySingleMSW; } @@ -507,17 +540,12 @@ int wxDisplayFactoryMSW::GetFromWindow(const wxWindow *window) #endif } -#endif // wxUSE_DISPLAY +#else // !wxUSE_DISPLAY -void wxClientDisplayRect(int *x, int *y, int *width, int *height) +// In this case, wxDisplayFactorySingleMSW is the only implementation. +wxDisplayFactory* wxDisplay::CreateFactory() { - // Determine the desktop dimensions minus the taskbar and any other - // special decorations... - RECT r; - - SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0); - if (x) *x = r.left; - if (y) *y = r.top; - if (width) *width = r.right - r.left; - if (height) *height = r.bottom - r.top; + return new wxDisplayFactorySingleMSW; } + +#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 98e985d6e1..1ebbd36259 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -145,17 +145,6 @@ int wxDisplayDepth() return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL); } -// Get size of display -void wxDisplaySize(int *width, int *height) -{ - ScreenHDC dc; - - if ( width ) - *width = ::GetDeviceCaps(dc, HORZRES); - if ( height ) - *height = ::GetDeviceCaps(dc, VERTRES); -} - void wxDisplaySizeMM(int *width, int *height) { ScreenHDC dc; diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 4e83ce9036..d41809fd1a 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -484,19 +484,11 @@ void wxApp::DoCleanUp() } } -void wxClientDisplayRect(int *x, int *y, int *width, int *height) +extern // used from src/osx/core/display.cpp +wxRect wxOSXGetMainDisplayClientArea() { NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame]; - wxRect r = wxFromNSRect( NULL, displayRect ); - if ( x ) - *x = r.x; - if ( y ) - *y = r.y; - if ( width ) - *width = r.GetWidth(); - if ( height ) - *height = r.GetHeight(); - + return wxFromNSRect( NULL, displayRect ); } void wxGetMousePosition( int* x, int* y ) diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 679312274b..fedbfb7d10 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -22,9 +22,7 @@ #pragma hdrstop #endif -#if wxUSE_DISPLAY - -#include "wx/display.h" +#include "wx/private/display.h" #ifndef WX_PRECOMP #include "wx/dynarray.h" @@ -33,11 +31,32 @@ #include "wx/gdicmn.h" #endif -#include "wx/private/display.h" -#include "wx/scopedarray.h" #include "wx/osx/private.h" -#if wxOSX_USE_COCOA_OR_CARBON +// ---------------------------------------------------------------------------- +// common helpers compiled even in wxUSE_DISPLAY==0 case +// ---------------------------------------------------------------------------- + +// This one is defined in Objective C++ code. +extern wxRect wxOSXGetMainDisplayClientArea(); + +namespace +{ + +wxRect wxGetDisplayGeometry(CGDirectDisplayID id) +{ + CGRect theRect = CGDisplayBounds(id); + return wxRect( (int)theRect.origin.x, + (int)theRect.origin.y, + (int)theRect.size.width, + (int)theRect.size.height ); //floats +} + +} // anonymous namespace + +#if wxUSE_DISPLAY + +#include "wx/scopedarray.h" // ---------------------------------------------------------------------------- // display classes implementation @@ -197,11 +216,7 @@ bool wxDisplayImplMacOSX::IsPrimary() const wxRect wxDisplayImplMacOSX::GetGeometry() const { - CGRect theRect = CGDisplayBounds(m_id); - return wxRect( (int)theRect.origin.x, - (int)theRect.origin.y, - (int)theRect.size.width, - (int)theRect.size.height ); //floats + return wxGetDisplayGeometry(m_id); } wxRect wxDisplayImplMacOSX::GetClientArea() const @@ -210,7 +225,7 @@ wxRect wxDisplayImplMacOSX::GetClientArea() const // wxGetClientDisplayRect() does work correctly for at least the main // one (TODO: do it correctly for the other displays too) if ( IsPrimary() ) - return wxGetClientDisplayRect(); + return wxOSXGetMainDisplayClientArea(); return wxDisplayImpl::GetClientArea(); } @@ -311,13 +326,34 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) return new wxDisplayFactoryMacOSX; } -#else +#else // !wxUSE_DISPLAY + +class wxDisplayImplSingleMacOSX : public wxDisplayImplSingle +{ +public: + virtual wxRect GetGeometry() const wxOVERRIDE + { + return wxGetDisplayGeometry(CGMainDisplayID()); + } + + virtual wxRect GetClientArea() const wxOVERRIDE + { + return wxOSXGetMainDisplayClientArea(); + } +}; + +class wxDisplayFactorySingleMacOSX : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE + { + return new wxDisplayImplSingleMacOSX; + } +}; /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { - return new wxDisplayFactorySingle; + return new wxDisplayFactorySingleMacOSX; } -#endif - #endif // wxUSE_DISPLAY diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index 92b2540149..f4cdcf47fc 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -25,6 +25,8 @@ #include "wx/apptrait.h" +#include "wx/private/display.h" + #include "wx/osx/private.h" #if wxUSE_GUI @@ -116,46 +118,6 @@ CFArrayRef CopyAvailableFontFamilyNames() return (CFArrayRef) [[UIFont familyNames] retain]; } -void wxClientDisplayRect(int *x, int *y, int *width, int *height) -{ -#if 0 - CGRect r = [[UIScreen mainScreen] applicationFrame]; - CGRect bounds = [[UIScreen mainScreen] bounds]; - if ( bounds.size.height > r.size.height ) - { - // portrait - if ( x ) - *x = r.origin.x; - if ( y ) - *y = r.origin.y; - if ( width ) - *width = r.size.width; - if ( height ) - *height = r.size.height; - } - else - { - // landscape - if ( x ) - *x = r.origin.y; - if ( y ) - *y = r.origin.x; - if ( width ) - *width = r.size.height; - if ( height ) - *height = r.size.width; - } -#else - // it's easier to treat the status bar as an element of the toplevel window - // instead of the desktop in order to support easy rotation - if ( x ) - *x = 0; - if ( y ) - *y = 0; - wxDisplaySize(width, height); -#endif -} - void wxGetMousePosition( int* x, int* y ) { if ( x ) @@ -177,26 +139,44 @@ int wxDisplayDepth() } // Get size of display -void wxDisplaySize(int *width, int *height) -{ - CGRect bounds = [[UIScreen mainScreen] bounds]; - if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ) +class wxDisplayImplSingleiOS : public wxDisplayImplSingle +{ +public: + virtual wxRect GetGeometry() const wxOVERRIDE { - // portrait - if ( width ) - *width = (int)bounds.size.width ; - if ( height ) - *height = (int)bounds.size.height; + CGRect bounds = [[UIScreen mainScreen] bounds]; + + int width, height; + if ( UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) ) + { + // portrait + width = (int)bounds.size.width ; + height = (int)bounds.size.height; + } + else + { + // landscape + width = (int)bounds.size.height ; + height = (int)bounds.size.width; + } + + return wxRect(0, 0, width, height); } - else +}; + +class wxDisplayFactorySingleiOS : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE { - // landscape - if ( width ) - *width = (int)bounds.size.height ; - if ( height ) - *height = (int)bounds.size.width; + return new wxDisplayImplSingleiOS; } +}; + +/* static */ wxDisplayFactory *wxDisplay::CreateFactory() +{ + return new wxDisplayFactorySingleiOS; } wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index bccc71b132..6860b5e088 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -87,17 +87,6 @@ int wxDisplayDepth() return theDepth; } -// Get size of display -void wxDisplaySize(int *width, int *height) -{ - // TODO adapt for multi-displays - CGRect bounds = CGDisplayBounds(CGMainDisplayID()); - if ( width ) - *width = (int)bounds.size.width ; - if ( height ) - *height = (int)bounds.size.height; -} - #if wxUSE_GUI // ---------------------------------------------------------------------------- diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 9a39545451..abf339321c 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -24,9 +24,11 @@ public: virtual wxString GetName() const wxOVERRIDE; +#if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; +#endif // wxUSE_DISPLAY }; wxDisplayImplQt::wxDisplayImplQt( unsigned n ) @@ -49,6 +51,7 @@ wxString wxDisplayImplQt::GetName() const return wxString(); } +#if wxUSE_DISPLAY wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const { return wxArrayVideoModes(); @@ -67,10 +70,13 @@ bool wxDisplayImplQt::ChangeMode(const wxVideoMode& WXUNUSED(mode)) { return false; } +#endif // wxUSE_DISPLAY //############################################################################## +#if wxUSE_DISPLAY + class wxDisplayFactoryQt : public wxDisplayFactory { public: @@ -100,3 +106,21 @@ int wxDisplayFactoryQt::GetFromPoint(const wxPoint& pt) { return new wxDisplayFactoryQt; } + +#else // wxUSE_DISPLAY + +class wxDisplayFactorySingleQt : public wxDisplayFactorySingleQt +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() wxOVERRIDE + { + return new wxDisplayImplQt(0); + } +}; + +/* static */ wxDisplayFactory *wxDisplay::CreateFactory() +{ + return new wxDisplayFactorySingleQt; +} + +#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index f1e9db341b..92957b8683 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -115,14 +115,6 @@ int wxDisplayDepth() return QApplication::desktop()->depth(); } -void wxDisplaySize(int *width, int *height) -{ - if ( width != NULL ) - *width = QApplication::desktop()->width(); - if ( height != NULL ) - *height = QApplication::desktop()->height(); -} - void wxDisplaySizeMM(int *width, int *height) { if ( width != NULL ) @@ -136,16 +128,6 @@ void wxBell() QApplication::beep(); } -void wxClientDisplayRect(int *x, int *y, int *width, int *height) -{ - QRect r = QApplication::desktop()->availableGeometry(); - - *x = r.x(); - *y = r.y(); - *width = r.width(); - *height = r.height(); -} - wxWindow *wxGetActiveWindow() { QWidget *w = QApplication::activeWindow(); diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 5c740ef4b0..93113a4886 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -37,13 +37,45 @@ #include #endif -#if wxUSE_DISPLAY - -#include "wx/display.h" #include "wx/private/display.h" #ifndef __WXGTK20__ +static wxRect wxGetMainScreenWorkArea(); + +class wxDisplayImplSingleX11 : public wxDisplayImplSingle +{ +public: + virtual wxRect GetGeometry() const wxOVERRIDE + { + Display* const dpy = wxGetX11Display(); + + return wxRect(0, 0, + DisplayWidth(dpy, DefaultScreen (dpy)), + DisplayHeight(dpy, DefaultScreen (dpy))); + } + + virtual wxRect GetClientArea() const wxOVERRIDE + { + return wxGetMainScreenWorkArea(); + } +}; + +class wxDisplayFactorySingleX11 : public wxDisplayFactorySingle +{ +protected: + virtual wxDisplayImpl *CreateSingleDisplay() + { + return new wxDisplayImplSingleX11; + } +}; + +#endif // !__WXGTK20__ + +#if wxUSE_DISPLAY + +#ifndef __WXGTK20__ + #include typedef XineramaScreenInfo ScreenInfo; @@ -97,7 +129,7 @@ public: // we intentionally don't cache the result here because the client // display area may change (e.g. the user resized or hid a panel) and // we don't currently react to its changes - return IsPrimary() ? wxGetClientDisplayRect() : m_rect; + return IsPrimary() ? wxGetMainScreenWorkArea() : m_rect; } virtual wxString GetName() const wxOVERRIDE { return wxString(); } @@ -347,13 +379,20 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { if ( !XineramaIsActive((Display*)wxGetDisplay()) ) - return new wxDisplayFactorySingle; + return new wxDisplayFactorySingleX11; return new wxDisplayFactoryX11; } #endif -#endif /* wxUSE_DISPLAY */ +#else // !wxUSE_DISPLAY + +/* static */ wxDisplayFactory *wxDisplay::CreateFactory() +{ + return new wxDisplayFactorySingleX11; +} + +#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY #if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) @@ -388,45 +427,33 @@ void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) #ifndef __WXGTK20__ -void wxClientDisplayRect(int *x, int *y, int *width, int *height) +wxRect wxGetMainScreenWorkArea() { + wxRect rect; + Display * const dpy = wxGetX11Display(); - wxCHECK_RET( dpy, wxT("can't be called before initializing the GUI") ); + wxCHECK_MSG( dpy, rect, "can't be called before initializing the GUI" ); - wxRect rectClient; wxGetWorkAreaX11(DefaultScreenOfDisplay(dpy), - rectClient.x, rectClient.y, rectClient.width, rectClient.height); + rect.x, rect.y, rect.width, rect.height); - // Although _NET_WORKAREA is supposed to return the client size of the - // screen, not all implementations are conforming, apparently, see #14419, - // so make sure we return a subset of the primary display. - wxRect rectFull; -#if wxUSE_DISPLAY - ScreensInfo screens; - const ScreenInfo& info = screens[0]; - rectFull = wxRect(info.x_org, info.y_org, info.width, info.height); -#else - wxDisplaySize(&rectFull.width, &rectFull.height); -#endif + const wxRect rectFull = wxDisplay().GetGeometry(); - if ( !rectClient.width || !rectClient.height ) + if ( !rect.width || !rect.height ) { // _NET_WORKAREA not available or didn't work, fall back to the total // display size. - rectClient = rectFull; + rect = rectFull; } else { - rectClient = rectClient.Intersect(rectFull); + // Although _NET_WORKAREA is supposed to return the client size of the + // screen, not all implementations are conforming, apparently, see + // #14419, so make sure we return a subset of the primary display. + rect = rect.Intersect(rectFull); } - if ( x ) - *x = rectClient.x; - if ( y ) - *y = rectClient.y; - if ( width ) - *width = rectClient.width; - if ( height ) - *height = rectClient.height; + return rect; } + #endif // !__WXGTK20__ diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index bd80ba5769..4312a3da8e 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -162,17 +162,6 @@ int wxDisplayDepth() return DefaultDepth (dpy, DefaultScreen (dpy)); } -// Get size of display -void wxDisplaySize(int *width, int *height) -{ - Display *dpy = (Display*) wxGetDisplay(); - - if ( width ) - *width = DisplayWidth (dpy, DefaultScreen (dpy)); - if ( height ) - *height = DisplayHeight (dpy, DefaultScreen (dpy)); -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = (Display*) wxGetDisplay(); From ddc88b74b6b75e3a8d19627425cb5500b52a79be Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 18:09:00 +0200 Subject: [PATCH 053/231] Remove unnecessary DLL export declarations for private classes wxDisplayFactory and wxDisplayImpl don't have to be exported from the wxWidgets shared libraries and, in fact, shouldn't be. --- include/wx/private/display.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/private/display.h b/include/wx/private/display.h index 2635758fe8..d1346fc4eb 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -18,7 +18,7 @@ // wxDisplayFactory: allows to create wxDisplay objects // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDisplayFactory +class wxDisplayFactory { public: wxDisplayFactory() { } @@ -65,7 +65,7 @@ private: // wxDisplayImpl: base class for all wxDisplay implementations // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxDisplayImpl +class wxDisplayImpl { public: // virtual dtor for this base class @@ -160,7 +160,7 @@ public: // Note that this is still an ABC and derived classes must implement // CreateSingleDisplay(). -class WXDLLIMPEXP_CORE wxDisplayFactorySingle : public wxDisplayFactory +class wxDisplayFactorySingle : public wxDisplayFactory { public: virtual unsigned GetCount() wxOVERRIDE { return 1; } From 0263ebfacaface453eec831201da4fd53063bd4a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2018 22:11:29 +0200 Subject: [PATCH 054/231] Remove duplicate wx/wxprec.h inclusion from wxiOSX code No real changes, just remove an unnecessary #include. --- src/osx/iphone/utils.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index f4cdcf47fc..2136055e74 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -10,8 +10,6 @@ #include "wx/wxprec.h" -#include "wx/wxprec.h" - #include "wx/utils.h" #ifndef WX_PRECOMP From ef48d7f1847d97352b0444d810169d3c54cfc7a6 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 1 Oct 2018 07:21:49 +0200 Subject: [PATCH 055/231] set wxOSX_USE_ICONREF to 0 if not defined --- include/wx/osx/cocoa/chkconf.h | 7 +++++++ include/wx/osx/iphone/chkconf.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/include/wx/osx/cocoa/chkconf.h b/include/wx/osx/cocoa/chkconf.h index aac5d4925e..5cc104b02d 100644 --- a/include/wx/osx/cocoa/chkconf.h +++ b/include/wx/osx/cocoa/chkconf.h @@ -40,6 +40,13 @@ */ #define wxHAVE_FSEVENTS_FILE_NOTIFICATIONS 1 +/* + * turn off old style icon format if not asked for + */ +#ifndef wxOSX_USE_ICONREF + #define wxOSX_USE_ICONREF 0 +#endif + /* * turning off capabilities that don't work under cocoa yet */ diff --git a/include/wx/osx/iphone/chkconf.h b/include/wx/osx/iphone/chkconf.h index a87d8e876f..9f313759d9 100644 --- a/include/wx/osx/iphone/chkconf.h +++ b/include/wx/osx/iphone/chkconf.h @@ -377,6 +377,11 @@ #define wxUSE_SECRETSTORE 0 #endif +// IconRef datatype does not exist on iOS + +#undef wxOSX_USE_ICONREF +#define wxOSX_USE_ICONREF 0 + #endif /* _WX_OSX_IPHONE_CHKCONF_H_ */ From c2ab36a2da8660f654c0c7ffc3fe3c2b4795a982 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 1 Oct 2018 08:10:13 +0200 Subject: [PATCH 056/231] add implicit conversion to NSArray* --- include/wx/osx/core/cfarray.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/wx/osx/core/cfarray.h b/include/wx/osx/core/cfarray.h index 1b58597bf0..2a5e215904 100644 --- a/include/wx/osx/core/cfarray.h +++ b/include/wx/osx/core/cfarray.h @@ -53,6 +53,8 @@ public: return wxCFRefFromGet((E)CFArrayGetValueAtIndex(this->m_ptr, idx)); } + operator WX_NSArray() { return (WX_NSArray) this->get(); } + wxCFRef operator[](size_type idx) { return at(idx); } wxCFRef front() { return at(0); } wxCFRef back() { return at(size() - 1); } From ca6cae20e84321845583739b59e9e5c6944525f6 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 1 Oct 2018 08:12:03 +0200 Subject: [PATCH 057/231] Adding more osx types as opaque public types --- include/wx/defs.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index c47e26ad79..27b175f910 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2607,12 +2607,14 @@ typedef void* WXDisplay; typedef const void * CFTypeRef; -/* typedef const struct __CFString * CFStringRef; */ - +DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFData ) DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString ) typedef struct __CFString * CFMutableStringRef; DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFDictionary ) +DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFArray ) +typedef struct __CFArray * CFMutableArrayRef; + DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource ) DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont ) DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor ) @@ -2645,7 +2647,7 @@ DECLARE_WXMAC_OPAQUE_REF( MenuRef ) typedef IconRef WXHICON ; typedef HIShapeRef WXHRGN; -#endif +#endif // __WXMAC__ #if defined(__WXMAC__) @@ -2712,6 +2714,13 @@ typedef struct objc_object *WX_##klass #endif /* (defined(__GNUC__) && defined(__APPLE__)) */ +DECLARE_WXCOCOA_OBJC_CLASS(NSArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSData); +DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); +DECLARE_WXCOCOA_OBJC_CLASS(NSString); + +#if wxOSX_USE_COCOA + DECLARE_WXCOCOA_OBJC_CLASS(NSApplication); DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep); DECLARE_WXCOCOA_OBJC_CLASS(NSBox); @@ -2729,7 +2738,6 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager); DECLARE_WXCOCOA_OBJC_CLASS(NSMenu); DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra); DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem); -DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray); DECLARE_WXCOCOA_OBJC_CLASS(NSNotification); DECLARE_WXCOCOA_OBJC_CLASS(NSObject); DECLARE_WXCOCOA_OBJC_CLASS(NSPanel); @@ -2747,20 +2755,14 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); DECLARE_WXCOCOA_OBJC_CLASS(NSView); DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext); DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat); -DECLARE_WXCOCOA_OBJC_CLASS( NSPrintInfo ); +DECLARE_WXCOCOA_OBJC_CLASS(NSPrintInfo); DECLARE_WXCOCOA_OBJC_CLASS(NSGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSPanGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSMagnificationGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSRotationGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSPressGestureRecognizer); DECLARE_WXCOCOA_OBJC_CLASS(NSTouch); -#endif /* __WXMAC__ &__DARWIN__ */ - -#ifdef __WXMAC__ - -DECLARE_WXCOCOA_OBJC_CLASS(NSString); - -#if wxOSX_USE_COCOA +DECLARE_WXCOCOA_OBJC_CLASS(NSPasteboard); typedef WX_NSWindow WXWindow; typedef WX_NSView WXWidget; @@ -2768,6 +2770,7 @@ typedef WX_NSImage WXImage; typedef WX_NSMenu WXHMENU; typedef WX_NSOpenGLPixelFormat WXGLPixelFormat; typedef WX_NSOpenGLContext WXGLContext; +typedef WX_NSPasteboard OSXPasteboard; #elif wxOSX_USE_IPHONE @@ -2780,6 +2783,7 @@ DECLARE_WXCOCOA_OBJC_CLASS(UIEvent); DECLARE_WXCOCOA_OBJC_CLASS(NSSet); DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext); DECLARE_WXCOCOA_OBJC_CLASS(UIWebView); +DECLARE_WXCOCOA_OBJC_CLASS(UIPasteboard); typedef WX_UIWindow WXWindow; typedef WX_UIView WXWidget; @@ -2787,6 +2791,7 @@ typedef WX_UIImage WXImage; typedef WX_EAGLContext WXGLContext; typedef WX_NSString WXGLPixelFormat; typedef WX_UIWebView OSXWebViewPtr; +typedef WX_UIPasteboard OSXPasteboard; #endif From 00197d0c75babfd9883503f4eb29ac6e1c9511e7 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 1 Oct 2018 08:28:41 +0200 Subject: [PATCH 058/231] removing the menu from the public API of wxChoice on osx on iOS pickers are having data sources that are not implemented using a menu, therefore the implementation API had to be changed --- include/wx/osx/choice.h | 1 - include/wx/osx/core/private.h | 37 ++++++++- src/osx/choice_osx.cpp | 18 ++--- src/osx/cocoa/choice.mm | 37 ++++++++- src/osx/iphone/choice.mm | 142 ++++++++++++++++++++++++++++++++++ 5 files changed, 217 insertions(+), 18 deletions(-) create mode 100644 src/osx/iphone/choice.mm diff --git a/include/wx/osx/choice.h b/include/wx/osx/choice.h index e261782ef6..4ef0b6b3aa 100644 --- a/include/wx/osx/choice.h +++ b/include/wx/osx/choice.h @@ -91,7 +91,6 @@ protected: wxArrayString m_strings; wxChoiceDataArray m_datas ; - wxMenu* m_popUpMenu ; private: // This should be called when the number of items in the control changes. diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 8b02bc0f41..af0657ce8f 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -726,7 +726,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxTextWidgetImpl); }; -// common interface for all implementations +// common interface for all combobox implementations class WXDLLIMPEXP_CORE wxComboWidgetImpl { @@ -753,6 +753,41 @@ public : virtual int FindString(const wxString& WXUNUSED(text)) const { return -1; } }; +// +// common interface for choice +// + +class WXDLLIMPEXP_CORE wxChoiceWidgetImpl + +{ +public : + wxChoiceWidgetImpl() {} + + virtual ~wxChoiceWidgetImpl() {} + + virtual int GetSelectedItem() const { return -1; } + + virtual void SetSelectedItem(int WXUNUSED(item)) {} + + virtual size_t GetNumberOfItems() const = 0; + + virtual void InsertItem(size_t pos, int itemid, const wxString& text) = 0; + + virtual void RemoveItem(size_t pos) = 0; + + virtual void Clear() + { + size_t count = GetNumberOfItems(); + for ( size_t i = 0 ; i < count ; i++ ) + { + RemoveItem( 0 ); + } + } + + virtual void SetItem(int pos, const wxString& item) = 0; +}; + + // // common interface for buttons // diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp index 72449ab64d..fac0ccb173 100644 --- a/src/osx/choice_osx.cpp +++ b/src/osx/choice_osx.cpp @@ -30,7 +30,6 @@ wxChoice::~wxChoice() for ( i = 0; i < max; ++i ) delete GetClientObject( i ); } - delete m_popUpMenu; } bool wxChoice::Create(wxWindow *parent, @@ -70,10 +69,7 @@ bool wxChoice::Create(wxWindow *parent, if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) ) return false; - m_popUpMenu = new wxMenu(); - m_popUpMenu->SetNoEventsMode(true); - - SetPeer(wxWidgetImpl::CreateChoice( this, parent, id, m_popUpMenu, pos, size, style, GetExtraStyle() )); + SetPeer(wxWidgetImpl::CreateChoice( this, parent, id, NULL, pos, size, style, GetExtraStyle() )); MacPostControlCreate( pos, size ); @@ -133,7 +129,7 @@ int wxChoice::DoInsertItems(const wxArrayStringsAdapter & items, wxString text = items[i]; if (text.empty()) text = " "; // menu items can't have empty labels - m_popUpMenu->Insert( idx, i+1, text ); + dynamic_cast(GetPeer())->InsertItem( idx, i+1, text ); m_datas.Insert( NULL, idx ); AssignNewItemClientData(idx, clientData, i, type); } @@ -150,8 +146,7 @@ void wxChoice::DoDeleteOneItem(unsigned int n) if ( HasClientObjectData() ) delete GetClientObject( n ); - m_popUpMenu->Delete( m_popUpMenu->FindItemByPosition( n ) ); - + dynamic_cast(GetPeer())->RemoveItem(n); m_strings.RemoveAt( n ) ; m_datas.RemoveAt( n ) ; @@ -160,10 +155,7 @@ void wxChoice::DoDeleteOneItem(unsigned int n) void wxChoice::DoClear() { - for ( unsigned int i = 0 ; i < GetCount() ; i++ ) - { - m_popUpMenu->Delete( m_popUpMenu->FindItemByPosition( 0 ) ); - } + dynamic_cast(GetPeer())->Clear(); m_strings.Empty() ; m_datas.Empty() ; @@ -210,7 +202,7 @@ void wxChoice::SetString(unsigned int n, const wxString& s) m_strings[n] = s ; - m_popUpMenu->FindItemByPosition( n )->SetItemLabel( s ) ; + dynamic_cast(GetPeer())->SetItem(n,s); } wxString wxChoice::GetString(unsigned int n) const diff --git a/src/osx/cocoa/choice.mm b/src/osx/cocoa/choice.mm index 26dccc9d4b..bcad4b29b3 100644 --- a/src/osx/cocoa/choice.mm +++ b/src/osx/cocoa/choice.mm @@ -55,12 +55,22 @@ - (NSControlSize)controlSize; @end -class wxChoiceCocoaImpl : public wxWidgetCocoaImpl +class wxChoiceCocoaImpl : public wxWidgetCocoaImpl, public wxChoiceWidgetImpl { public: wxChoiceCocoaImpl(wxWindowMac *wxpeer, wxNSPopUpButton *v) : wxWidgetCocoaImpl(wxpeer, v) { + m_popUpMenu = new wxMenu(); + m_popUpMenu->SetNoEventsMode(true); + [v setMenu: m_popUpMenu->GetHMenu()]; + [v setAutoenablesItems:NO]; + + } + + ~wxChoiceCocoaImpl() + { + delete m_popUpMenu; } void GetLayoutInset(int &left , int &top , int &right, int &bottom) const wxOVERRIDE @@ -96,6 +106,29 @@ public: break; } } + + void InsertItem( size_t pos, int itemid, const wxString& text) wxOVERRIDE + { + m_popUpMenu->Insert( pos, itemid, text ); + } + + size_t GetNumberOfItems() const wxOVERRIDE + { + return m_popUpMenu->GetMenuItemCount(); + } + + void RemoveItem( size_t pos ) wxOVERRIDE + { + m_popUpMenu->Delete( m_popUpMenu->FindItemByPosition( pos ) ); + } + + void SetItem(int pos, const wxString& s) wxOVERRIDE + { + m_popUpMenu->FindItemByPosition( pos )->SetItemLabel( s ) ; + } + +private: + wxMenu* m_popUpMenu; }; wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, @@ -109,8 +142,6 @@ wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, { NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSPopUpButton* v = [[wxNSPopUpButton alloc] initWithFrame:r pullsDown:NO]; - [v setMenu: menu->GetHMenu()]; - [v setAutoenablesItems:NO]; wxWidgetCocoaImpl* c = new wxChoiceCocoaImpl( wxpeer, v ); return c; } diff --git a/src/osx/iphone/choice.mm b/src/osx/iphone/choice.mm new file mode 100644 index 0000000000..931fd14509 --- /dev/null +++ b/src/osx/iphone/choice.mm @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/osx/cocoa/choice.mm +// Purpose: wxChoice +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/wxprec.h" + +#if wxUSE_CHOICE + +#include "wx/choice.h" + +#ifndef WX_PRECOMP + #include "wx/menu.h" + #include "wx/dcclient.h" +#endif + +#include "wx/osx/private.h" + +@interface wxUIPickerView : UIPickerView +{ +} + +@property (readonly) NSMutableArray *rows; + +@end + +@implementation wxUIPickerView + ++ (void)initialize +{ + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXIPhoneClassAddWXMethods( self ); + } +} + +- (id)initWithFrame:(CGRect)rectBox +{ + if ( self = [super initWithFrame:rectBox] ) + { + _rows = [[NSMutableArray alloc] init]; + } + return self; +} + +- (void)dealloc +{ + [_rows dealloc]; + [super dealloc]; +} + +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView +{ + return 1; +} + +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component +{ + if ( component == 0 ) + return [_rows count]; + + return 0; +} + +- (nullable NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component +{ + return [_rows objectAtIndex:row]; +} + +- (int) intValue +{ + return (int) [self selectedRowInComponent:0]; +} + +- (void) setIntValue: (int) v +{ + [self selectRow:v inComponent:0 animated:NO]; +} + + + +@end + +class wxChoiceIPhoneImpl : public wxWidgetIPhoneImpl, public wxChoiceWidgetImpl +{ +public: + wxChoiceIPhoneImpl(wxWindowMac *wxpeer, wxUIPickerView *v) + : wxWidgetIPhoneImpl(wxpeer, v) + { + [v setDelegate:v]; + [v setDataSource:v]; + } + + void InsertItem( size_t pos, int itemid, const wxString& text) wxOVERRIDE + { + wxCFStringRef cftext(text); + [((wxUIPickerView*)m_osxView).rows insertObject:cftext.AsNSString() atIndex:pos]; + } + + size_t GetNumberOfItems() const wxOVERRIDE + { + return [((wxUIPickerView*)m_osxView).rows count]; + } + + void RemoveItem( size_t pos ) wxOVERRIDE + { + [((wxUIPickerView*)m_osxView).rows removeObjectAtIndex:pos]; + } + + void SetItem(int pos, const wxString& text) wxOVERRIDE + { + wxCFStringRef cftext(text); + [((wxUIPickerView*)m_osxView).rows replaceObjectAtIndex:pos withObject:cftext.AsNSString()]; + } + +private: +}; + +wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), + wxMenu* menu, + const wxPoint& pos, + const wxSize& size, + long WXUNUSED(style), + long WXUNUSED(extraStyle)) +{ + CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; + wxUIPickerView* v = [[wxUIPickerView alloc] initWithFrame:r]; + + wxChoiceIPhoneImpl* c = new wxChoiceIPhoneImpl( wxpeer, v ); + return c; +} + +#endif // wxUSE_CHOICE From 4fb39beae12d6d1bfacf9706e33ee8e1200abfd0 Mon Sep 17 00:00:00 2001 From: Blake Eryx Date: Mon, 1 Oct 2018 13:55:42 +0200 Subject: [PATCH 059/231] Remove all wxS() macros from samples The use of wxS() is an optimization which can be used to avoid an implicit conversion from narrow to wide strings, but such optimizations are not really needed in the samples and just make their code less readable, so remove them. Closes https://github.com/wxWidgets/wxWidgets/pull/956 --- samples/drawing/drawing.cpp | 28 ++++++------ samples/image/canvas.cpp | 4 +- samples/image/image.cpp | 2 +- samples/printing/printing.cpp | 2 +- samples/propgrid/propgrid.cpp | 4 +- samples/propgrid/tests.cpp | 84 +++++++++++++++++------------------ samples/shaped/shaped.cpp | 2 +- samples/text/text.cpp | 2 +- samples/widgets/listbox.cpp | 8 ++-- samples/widgets/textctrl.cpp | 12 ++--- samples/xrc/myframe.cpp | 2 +- 11 files changed, 75 insertions(+), 75 deletions(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index cedf62803a..4079b4868b 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -227,7 +227,7 @@ public: void OnGraphicContextCairoUpdateUI(wxUpdateUIEvent& event) { - event.Check(m_canvas->IsRendererName(wxS("cairo"))); + event.Check(m_canvas->IsRendererName("cairo")); } #endif // wxUSE_CAIRO #ifdef __WXMSW__ @@ -239,7 +239,7 @@ public: void OnGraphicContextGDIPlusUpdateUI(wxUpdateUIEvent& event) { - event.Check(m_canvas->IsRendererName(wxS("gdiplus"))); + event.Check(m_canvas->IsRendererName("gdiplus")); } #endif #if wxUSE_GRAPHICS_DIRECT2D @@ -250,7 +250,7 @@ public: void OnGraphicContextDirect2DUpdateUI(wxUpdateUIEvent& event) { - event.Check(m_canvas->IsRendererName(wxS("direct2d"))); + event.Check(m_canvas->IsRendererName("direct2d")); } #endif #endif // __WXMSW__ @@ -1190,7 +1190,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc) gc->PushState(); gc->Translate(60, 400); - const wxString labelText(wxS("Scaled smiley inside a square")); + const wxString labelText("Scaled smiley inside a square"); gc->DrawText(labelText, 0, 0); // Center a bitmap horizontally wxDouble textWidth; @@ -1204,7 +1204,7 @@ void MyCanvas::DrawGraphics(wxGraphicsContext* gc) // Draw graphics bitmap and its subbitmap gc->PushState(); gc->Translate(300, 400); - gc->DrawText(wxS("Smiley as a graphics bitmap"), 0, 0); + gc->DrawText("Smiley as a graphics bitmap", 0, 0); wxGraphicsBitmap gbmp1 = gc->CreateBitmap(m_smile_bmp); gc->DrawBitmap(gbmp1, 0, BASE2, 50, 50); @@ -1616,7 +1616,7 @@ void MyCanvas::DrawSystemColours(wxDC& dc) wxSize textSize; { wxDCFontChanger setMono(dc, mono); - textSize = dc.GetTextExtent(wxS("#01234567")); + textSize = dc.GetTextExtent("#01234567"); } int lineHeight = textSize.GetHeight(); @@ -2120,8 +2120,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) #endif // __WXMSW__ #endif // wxUSE_GRAPHICS_CONTEXT menuFile->AppendSeparator(); - menuFile->AppendCheckItem(File_BBox, wxS("Show bounding box\tCtrl-E"), - wxS("Show extents used in drawing operations")); + menuFile->AppendCheckItem(File_BBox, "Show bounding box\tCtrl-E", + "Show extents used in drawing operations"); menuFile->AppendCheckItem(File_Clip, "&Clip\tCtrl-C", "Clip/unclip drawing"); menuFile->AppendCheckItem(File_Buffer, "&Use wx&BufferedPaintDC\tCtrl-Z", "Buffer painting"); menuFile->AppendSeparator(); @@ -2252,15 +2252,15 @@ void MyFrame::OnCopy(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { - wxString wildCard = wxS("Bitmap image (*.bmp)|*.bmp;*.BMP"); + wxString wildCard = "Bitmap image (*.bmp)|*.bmp;*.BMP"; #if wxUSE_LIBPNG - wildCard.Append(wxS("|PNG image (*.png)|*.png;*.PNG")); + wildCard.Append("|PNG image (*.png)|*.png;*.PNG"); #endif #if wxUSE_SVG - wildCard.Append(wxS("|SVG image (*.svg)|*.svg;*.SVG")); + wildCard.Append("|SVG image (*.svg)|*.svg;*.SVG"); #endif #if wxUSE_POSTSCRIPT - wildCard.Append(wxS("|PostScript file (*.ps)|*.ps;*.PS")); + wildCard.Append("|PostScript file (*.ps)|*.ps;*.PS"); #endif wxFileDialog dlg(this, "Save as bitmap", wxEmptyString, wxEmptyString, @@ -2294,7 +2294,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) else #endif #if wxUSE_POSTSCRIPT - if ( ext == wxS("ps") ) + if ( ext == "ps" ) { #if wxUSE_GRAPHICS_CONTEXT // Graphics screen can only be drawn using wxGraphicsContext @@ -2321,7 +2321,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event)) double sc = wxMin((double)w / width, (double)h / height); m_xUserScale *= sc; m_yUserScale *= sc; - psdc.StartDoc(wxS("Drawing sample")); + psdc.StartDoc("Drawing sample"); // Define default font. psdc.SetFont( wxFontInfo(10).Family(wxFONTFAMILY_MODERN) ); psdc.StartPage(); diff --git a/samples/image/canvas.cpp b/samples/image/canvas.cpp index d02ac51477..60b70e624f 100644 --- a/samples/image/canvas.cpp +++ b/samples/image/canvas.cpp @@ -62,7 +62,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, wxMemoryDC dc; dc.SelectObject( bitmap ); - dc.SetBrush( wxBrush( wxS("orange") ) ); + dc.SetBrush( wxBrush( "orange" ) ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 0, 0, 100, 100 ); dc.SetBrush( *wxWHITE_BRUSH ); @@ -406,7 +406,7 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) dc.DrawBitmap( my_square, 30, 30 ); dc.DrawText( "Drawn directly", 150, 10 ); - dc.SetBrush( wxBrush( wxS("orange") ) ); + dc.SetBrush( wxBrush( "orange" ) ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 150, 30, 100, 100 ); dc.SetBrush( *wxWHITE_BRUSH ); diff --git a/samples/image/image.cpp b/samples/image/image.cpp index ea59675422..ec4823385e 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -663,7 +663,7 @@ MyFrame::MyFrame() wxMenu *menuImage = new wxMenu; menuImage->Append( ID_NEW, "&Show any image...\tCtrl-O"); - menuImage->Append(ID_NEW_HIDPI, wxS("Show any image as &HiDPI...\tCtrl-H")); + menuImage->Append(ID_NEW_HIDPI, "Show any image as &HiDPI...\tCtrl-H"); menuImage->Append( ID_INFO, "Show image &information...\tCtrl-I"); #ifdef wxHAVE_RAW_BITMAP menuImage->AppendSeparator(); diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index c3448b09f5..bfac9abd3a 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -162,7 +162,7 @@ void MyApp::Draw(wxDC&dc) dc.DrawText( "Test message: this is in 10 point text", 10, 180); - dc.DrawRotatedText( wxS("This\nis\na multi-line\ntext"), 170, 100, -m_angle/1.5); + dc.DrawRotatedText( "This\nis\na multi-line\ntext", 170, 100, -m_angle/1.5); #if wxUSE_UNICODE const char *test = "Hebrew שלום -- Japanese (日本語)"; diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 7a0fb4a54d..591a7977c6 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -1339,9 +1339,9 @@ void FormMain::PopulateWithExamples () "Should have one extra item when compared to EnumProperty 3"); // Plus property value bitmap - pg->Append( new wxEnumProperty(wxS("EnumProperty With Bitmap"), wxS("EnumProperty 5"), + pg->Append( new wxEnumProperty("EnumProperty With Bitmap", "EnumProperty 5", soc, 280) ); - pg->SetPropertyHelpString(wxS("EnumProperty 5"), + pg->SetPropertyHelpString("EnumProperty 5", "Should have bitmap in front of the displayed value"); wxBitmap bmpVal = wxArtProvider::GetBitmap(wxART_REMOVABLE); pg->SetPropertyImage("EnumProperty 5", bmpVal); diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index 5f6cd552c5..b8e1032822 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -484,7 +484,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) it = pgman->GetVIterator(wxPG_ITERATE_ALL&~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); if ( !it.AtEnd() ) { - RT_FAILURE_MSG(wxString(wxS("Not all properties are deleted"))); + RT_FAILURE_MSG(wxString("Not all properties are deleted")); } // Recreate grid @@ -756,12 +756,12 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" ) { - RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Model=%s"), pgman->GetPropertyValueAsString(wxS("Car.Model")).c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Model=%s", pgman->GetPropertyValueAsString("Car.Model").c_str())); } if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 ) { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString(wxS("Car.Speeds.Max. Speed (mph)")).c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString("Car.Speeds.Max. Speed (mph)").c_str())); } if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 ) @@ -771,7 +771,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !pgman->GetPropertyValueAsBool("Car.Convertible") ) { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString(wxS("Car.Convertible")).c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString("Car.Convertible").c_str())); } // SetPropertyValueString for special cases such as wxColour @@ -1387,9 +1387,9 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { if ( !flags.empty() ) { - flags.append(wxS("|")); + flags.append("|"); } - flags.append(wxS("COLLAPSED")); + flags.append("COLLAPSED"); } } @@ -1397,58 +1397,58 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { if ( !flags.empty() ) { - flags.append(wxS("|")); + flags.append("|"); } - flags.append(wxS("DISABLED")); + flags.append("DISABLED"); } if ( GetRandomBooleanVal() ) { if ( !flags.empty() ) { - flags.append(wxS("|")); + flags.append("|"); } - flags.append(wxS("HIDDEN")); + flags.append("HIDDEN"); } // Set flags p->SetFlagsFromString(flags); // Verify if flags have been properly set - if ( flags.Find(wxS("COLLAPSED")) != wxNOT_FOUND && + if ( flags.Find("COLLAPSED") != wxNOT_FOUND && !p->HasFlag(wxPG_PROP_COLLAPSED) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error setting flag from string 'COLLAPSED' for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'COLLAPSED' for property '%s'", p->GetName().c_str())); } - if ( flags.Find(wxS("COLLAPSED")) == wxNOT_FOUND && + if ( flags.Find("COLLAPSED") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_COLLAPSED) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error resetting flag from string 'COLLAPSED'for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'COLLAPSED'for property '%s'", p->GetName().c_str())); } - if ( flags.Find(wxS("DISABLED")) != wxNOT_FOUND && + if ( flags.Find("DISABLED") != wxNOT_FOUND && !p->HasFlag(wxPG_PROP_DISABLED) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error setting flag from string 'DISABLED' for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'DISABLED' for property '%s'", p->GetName().c_str())); } - if ( flags.Find(wxS("DISABLED")) == wxNOT_FOUND && + if ( flags.Find("DISABLED") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_DISABLED) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error resetting flag from string 'DISABLED' for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'DISABLED' for property '%s'", p->GetName().c_str())); } - if ( flags.Find(wxS("HIDDEN")) != wxNOT_FOUND && + if ( flags.Find("HIDDEN") != wxNOT_FOUND && !p->HasFlag(wxPG_PROP_HIDDEN) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error setting flag from string 'HIDDEN' for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'HIDDEN' for property '%s'", p->GetName().c_str())); } - if ( flags.Find(wxS("HIDDEN")) == wxNOT_FOUND && + if ( flags.Find("HIDDEN") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_HIDDEN) ) { - RT_FAILURE_MSG(wxString::Format(wxS("Error resetting flag from string 'HIDDEN' for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'HIDDEN' for property '%s'", p->GetName().c_str())); } @@ -1458,7 +1458,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) flags = p->GetFlagsAsString(wxPG_PROP_COLLAPSED); if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) { - ok = (flags == wxS("COLLAPSED")); + ok = (flags == "COLLAPSED"); } else { @@ -1466,14 +1466,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", p->GetName().c_str())); } flags = p->GetFlagsAsString(wxPG_PROP_DISABLED); if ( p->HasFlag(wxPG_PROP_DISABLED) ) { - ok = (flags == wxS("DISABLED")); + ok = (flags == "DISABLED"); } else { @@ -1481,14 +1481,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_DISABLED flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISABLED flag for property '%s'", p->GetName().c_str())); } flags = p->GetFlagsAsString(wxPG_PROP_HIDDEN); if ( p->HasFlag(wxPG_PROP_HIDDEN) ) { - ok = (flags == wxS("HIDDEN")); + ok = (flags == "HIDDEN"); } else { @@ -1496,14 +1496,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", p->GetName().c_str())); } flags = p->GetFlagsAsString(wxPG_PROP_NOEDITOR); if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) { - ok = (flags == wxS("NOEDITOR")); + ok = (flags == "NOEDITOR"); } else { @@ -1511,7 +1511,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", p->GetName().c_str())); } @@ -1519,57 +1519,57 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) flags = p->GetFlagsAsString(wxPG_STRING_STORED_FLAGS); if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) { - ok = (flags.Find(wxS("COLLAPSED")) != wxNOT_FOUND); + ok = (flags.Find("COLLAPSED") != wxNOT_FOUND); } else { - ok = (flags.Find(wxS("COLLAPSED")) == wxNOT_FOUND); + ok = (flags.Find("COLLAPSED") == wxNOT_FOUND); } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", p->GetName().c_str())); } if ( p->HasFlag(wxPG_PROP_DISABLED) ) { - ok = (flags.Find(wxS("DISABLED")) != wxNOT_FOUND); + ok = (flags.Find("DISABLED") != wxNOT_FOUND); } else { - ok = (flags.Find(wxS("DISABLED")) == wxNOT_FOUND); + ok = (flags.Find("DISABLED") == wxNOT_FOUND); } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_DISBALED flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISBALED flag for property '%s'", p->GetName().c_str())); } if ( p->HasFlag(wxPG_PROP_HIDDEN) ) { - ok = (flags.Find(wxS("HIDDEN")) != wxNOT_FOUND); + ok = (flags.Find("HIDDEN") != wxNOT_FOUND); } else { - ok = (flags.Find(wxS("HIDDEN")) == wxNOT_FOUND); + ok = (flags.Find("HIDDEN") == wxNOT_FOUND); } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", p->GetName().c_str())); } if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) { - ok = (flags.Find(wxS("NOEDITOR")) != wxNOT_FOUND); + ok = (flags.Find("NOEDITOR") != wxNOT_FOUND); } else { - ok = (flags.Find(wxS("NOEDITOR")) == wxNOT_FOUND); + ok = (flags.Find("NOEDITOR") == wxNOT_FOUND); } if ( !ok ) { - RT_FAILURE_MSG(wxString::Format(wxS("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'"), + RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", p->GetName().c_str())); } diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp index 14036a5bcd..9b4985b223 100644 --- a/samples/shaped/shaped.cpp +++ b/samples/shaped/shaped.cpp @@ -285,7 +285,7 @@ void MainFrame::OnShowTransparent(wxCommandEvent& WXUNUSED(event)) seeThroughFrame->Show(true); } else - wxMessageBox(wxS("transparent window requires a composited screen")); + wxMessageBox("transparent window requires a composited screen"); } void MainFrame::OnShowEffect(wxCommandEvent& event) diff --git a/samples/text/text.cpp b/samples/text/text.cpp index fc20d792a0..c15ce480d8 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -455,7 +455,7 @@ bool MyApp::OnInit() return false; // Create the main frame window - MyFrame *frame = new MyFrame(wxS("Text wxWidgets sample"), 50, 50); + MyFrame *frame = new MyFrame("Text wxWidgets sample", 50, 50); wxMenu *file_menu = new wxMenu; file_menu->Append(TEXT_SAVE, "&Save file\tCtrl-S", diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index c8e567479e..19ca1db964 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -295,15 +295,15 @@ void ListboxWidgetsPage::CreateContent() static const wxString listTypes[] = { - wxS("list box") + "list box" #if wxUSE_CHECKLISTBOX - , wxS("check list box") + , "check list box" #endif // wxUSE_CHECKLISTBOX #if wxUSE_REARRANGECTRL - , wxS("rearrange list") + , "rearrange list" #endif // wxUSE_REARRANGECTRL }; - m_radioListType = new wxRadioBox(this, wxID_ANY, wxS("&List type:"), + m_radioListType = new wxRadioBox(this, wxID_ANY, "&List type:", wxDefaultPosition, wxDefaultSize, WXSIZEOF(listTypes), listTypes, 1, wxRA_SPECIFY_COLS); diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index 4797c0100b..5f53422a58 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -468,12 +468,12 @@ void TextWidgetsPage::CreateContent() static const wxString halign[] = { - wxS("left"), - wxS("centre"), - wxS("right"), + "left", + "centre", + "right", }; - m_radioAlign = new wxRadioBox(this, wxID_ANY, wxS("&Text alignment"), + m_radioAlign = new wxRadioBox(this, wxID_ANY, "&Text alignment", wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign, 1); sizerLeft->Add(m_radioAlign, 0, wxGROW | wxALL, 5); @@ -747,7 +747,7 @@ void TextWidgetsPage::CreateText() flags |= wxTE_RIGHT; break; default: - wxFAIL_MSG( wxS("unexpected alignment style radio box selection") ); + wxFAIL_MSG( "unexpected alignment style radio box selection" ); } #ifdef __WXMSW__ @@ -1033,7 +1033,7 @@ void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event) flags |= wxTE_RIGHT; break; default: - wxFAIL_MSG( wxS("unexpected alignment style radio box selection") ); + wxFAIL_MSG( "unexpected alignment style radio box selection" ); return; } diff --git a/samples/xrc/myframe.cpp b/samples/xrc/myframe.cpp index 579111a92d..f09eea2fdc 100644 --- a/samples/xrc/myframe.cpp +++ b/samples/xrc/myframe.cpp @@ -281,7 +281,7 @@ void MyFrame::OnAuiDemoToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) { #if wxUSE_AUI wxDialog dlg; - wxXmlResource::Get()->LoadDialog(&dlg, this, wxS("aui_dialog")); + wxXmlResource::Get()->LoadDialog(&dlg, this, "aui_dialog"); dlg.ShowModal(); #else wxLogWarning("wxUSE_AUI must be set to 1 in 'setup.h' to view the AUI demo."); From c0e7bd33bc336015c4ea16172ceef78ffbe3bf27 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 1 Oct 2018 14:02:48 +0200 Subject: [PATCH 060/231] Don't duplicate src/osx/cocoa/stdpaths.mm in wxiOS files list This file is already included in BASE_OSX_SHARED_SRC, which is part of wxiOS sources, so there is no need to repeat it in OSX_IPHONE_SRC as well. This fixes warnings about ignoring duplicate rules in the makefile in command line builds. --- Makefile.in | 28 ++++++---------------------- build/bakefiles/files.bkl | 1 - build/cmake/files.cmake | 1 - build/files | 1 - 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3608d2d88d..314c394af7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5630,7 +5630,6 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS = \ monodll_iphone_toolbar.o \ monodll_iphone_utils.o \ monodll_iphone_window.o \ - monodll_cocoa_stdpaths.o \ monodll_iphone_settings.o \ monodll_sound_osx.o \ monodll_core_sound.o \ @@ -7608,7 +7607,6 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_1 = \ monolib_iphone_toolbar.o \ monolib_iphone_utils.o \ monolib_iphone_window.o \ - monolib_cocoa_stdpaths.o \ monolib_iphone_settings.o \ monolib_sound_osx.o \ monolib_core_sound.o \ @@ -9733,7 +9731,6 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_2 = \ coredll_iphone_toolbar.o \ coredll_iphone_utils.o \ coredll_iphone_window.o \ - coredll_stdpaths.o \ coredll_iphone_settings.o \ coredll_sound_osx.o \ coredll_core_sound.o \ @@ -11453,7 +11450,6 @@ COND_TOOLKIT_OSX_IPHONE___GUI_SRC_OBJECTS_3 = \ corelib_iphone_toolbar.o \ corelib_iphone_utils.o \ corelib_iphone_window.o \ - corelib_stdpaths.o \ corelib_iphone_settings.o \ corelib_sound_osx.o \ corelib_core_sound.o \ @@ -15850,6 +15846,9 @@ monodll_core_secretstore.o: $(srcdir)/src/osx/core/secretstore.cpp $(MONODLL_ODE monodll_fswatcher_fsevents.o: $(srcdir)/src/osx/fswatcher_fsevents.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/fswatcher_fsevents.cpp +monodll_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm + monodll_event.o: $(srcdir)/src/common/event.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/event.cpp @@ -17503,12 +17502,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1@monodll_fswatcher_kqueue.o: $(srcdir)/src/unix/fswatcher_kqueue.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/fswatcher_kqueue.cpp -@COND_PLATFORM_MACOSX_1@monodll_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - -@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONODLL_ODEP) -@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - @COND_PLATFORM_UNIX_1@monodll_socketiohandler.o: $(srcdir)/src/common/socketiohandler.cpp $(MONODLL_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/socketiohandler.cpp @@ -21124,6 +21117,9 @@ monolib_core_secretstore.o: $(srcdir)/src/osx/core/secretstore.cpp $(MONOLIB_ODE monolib_fswatcher_fsevents.o: $(srcdir)/src/osx/fswatcher_fsevents.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/fswatcher_fsevents.cpp +monolib_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm + monolib_event.o: $(srcdir)/src/common/event.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/event.cpp @@ -22777,12 +22773,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1@monolib_fswatcher_kqueue.o: $(srcdir)/src/unix/fswatcher_kqueue.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/fswatcher_kqueue.cpp -@COND_PLATFORM_MACOSX_1@monolib_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - -@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_cocoa_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(MONOLIB_ODEP) -@COND_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - @COND_PLATFORM_UNIX_1@monolib_socketiohandler.o: $(srcdir)/src/common/socketiohandler.cpp $(MONOLIB_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/socketiohandler.cpp @@ -27784,9 +27774,6 @@ coredll_iphone_utils.o: $(srcdir)/src/osx/iphone/utils.mm $(COREDLL_ODEP) coredll_iphone_window.o: $(srcdir)/src/osx/iphone/window.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/window.mm -coredll_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(COREDLL_ODEP) - $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - coredll_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(COREDLL_ODEP) $(CXXC) -c -o $@ $(COREDLL_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm @@ -32053,9 +32040,6 @@ corelib_iphone_utils.o: $(srcdir)/src/osx/iphone/utils.mm $(CORELIB_ODEP) corelib_iphone_window.o: $(srcdir)/src/osx/iphone/window.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/window.mm -corelib_stdpaths.o: $(srcdir)/src/osx/cocoa/stdpaths.mm $(CORELIB_ODEP) - $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/stdpaths.mm - corelib_iphone_settings.o: $(srcdir)/src/osx/iphone/settings.mm $(CORELIB_ODEP) $(CXXC) -c -o $@ $(CORELIB_OBJCXXFLAGS) $(srcdir)/src/osx/iphone/settings.mm diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index e6fb2354fb..b4834f11f5 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2699,7 +2699,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/iphone/toolbar.mm src/osx/iphone/utils.mm src/osx/iphone/window.mm - src/osx/cocoa/stdpaths.mm src/osx/iphone/settings.mm src/osx/sound_osx.cpp src/osx/core/sound.cpp diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index c240f3df2a..75d55340a6 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2552,7 +2552,6 @@ set(OSX_COCOA_HDR set(OSX_IPHONE_SRC ${OSX_COMMON_SRC} src/generic/regiong.cpp - src/osx/cocoa/stdpaths.mm # iphone files src/osx/iphone/anybutton.mm src/osx/iphone/button.mm diff --git a/build/files b/build/files index 9194199f57..77280b9913 100644 --- a/build/files +++ b/build/files @@ -2534,7 +2534,6 @@ OSX_IPHONE_SRC = $(OSX_COMMON_SRC) src/generic/animateg.cpp src/generic/regiong.cpp - src/osx/cocoa/stdpaths.mm src/osx/core/sound.cpp src/osx/iphone/anybutton.mm src/osx/iphone/button.mm From 519d8fec8a4e4275f05916ee4ca17f046b8b9518 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Mon, 1 Oct 2018 21:43:19 +0200 Subject: [PATCH 061/231] Disable wxUSE_OWNER_DRAWN when using WXQT with CMake --- build/cmake/init.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 919ce4c570..3c07f15b21 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -162,6 +162,7 @@ if(wxUSE_GUI) wx_option_force_value(wxUSE_METAFILE OFF) if(WIN32) wx_option_force_value(wxUSE_ACCESSIBILITY OFF) + wx_option_force_value(wxUSE_OWNER_DRAWN OFF) endif() endif() From 32d32f8172d899f465b444b0a5026261cbbe6761 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Mon, 1 Oct 2018 21:47:33 +0200 Subject: [PATCH 062/231] Revert "Fix missing wxOwnerDrawn functions in WXQT wxMenuItem" This reverts commit 4e23b3e7f4c9106661c8f2584b3c33656d8fc28f. wxOwnerDrawn is only used with wxMSW toolkit. --- include/wx/qt/menuitem.h | 23 ----------------------- src/qt/menuitem.cpp | 34 ---------------------------------- 2 files changed, 57 deletions(-) diff --git a/include/wx/qt/menuitem.h b/include/wx/qt/menuitem.h index 953e48c565..158007fc4e 100644 --- a/include/wx/qt/menuitem.h +++ b/include/wx/qt/menuitem.h @@ -9,20 +9,12 @@ #define _WX_QT_MENUITEM_H_ #include "wx/menuitem.h" - -#if wxUSE_OWNER_DRAWN - #include "wx/ownerdrw.h" -#endif - class QAction; class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxMenu; class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase -#if wxUSE_OWNER_DRAWN - , public wxOwnerDrawnBase -#endif { public: wxMenuItem(wxMenu *parentMenu = NULL, @@ -41,30 +33,15 @@ public: virtual void Check(bool check = true); virtual bool IsChecked() const; - void SetBitmaps(const wxBitmap& bmpChecked, - const wxBitmap& bmpUnchecked = wxNullBitmap); void SetBitmap(const wxBitmap& bitmap); const wxBitmap& GetBitmap() const; virtual QAction *GetHandle() const; -#if wxUSE_OWNER_DRAWN - void SetDisabledBitmap(const wxBitmap& bmpDisabled); - const wxBitmap& GetDisabledBitmap() const; - - // override wxOwnerDrawn base class virtuals - virtual wxString GetName() const wxOVERRIDE; - virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat) wxOVERRIDE; -#endif // wxUSE_OWNER_DRAWN - private: // Qt is using an action instead of a menu item. QAction *m_qtAction; -#if wxUSE_OWNER_DRAWN - wxBitmap m_bmpDisabled; -#endif // wxUSE_OWNER_DRAWN - wxDECLARE_DYNAMIC_CLASS( wxMenuItem ); }; diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index 85106eff59..eab049e342 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -106,12 +106,6 @@ bool wxMenuItem::IsChecked() const } -void wxMenuItem::SetBitmaps(const wxBitmap& WXUNUSED(bmpChecked), - const wxBitmap& WXUNUSED(bmpUnchecked)) -{ - wxMISSING_FUNCTION(); -} - void wxMenuItem::SetBitmap(const wxBitmap& WXUNUSED(bitmap)) { wxMISSING_FUNCTION(); @@ -131,34 +125,6 @@ QAction *wxMenuItem::GetHandle() const return m_qtAction; } -#if wxUSE_OWNER_DRAWN - -void wxMenuItem::SetDisabledBitmap(const wxBitmap& bmpDisabled) -{ - m_bmpDisabled = bmpDisabled; - wxMISSING_FUNCTION(); -} - -const wxBitmap& wxMenuItem::GetDisabledBitmap() const -{ - wxMISSING_FUNCTION(); - return m_bmpDisabled; -} - -wxString wxMenuItem::GetName() const -{ - return GetItemLabelText(); -} - -bool wxMenuItem::OnDrawItem(wxDC& WXUNUSED(dc), const wxRect& WXUNUSED(rc), - wxODAction WXUNUSED(act), wxODStatus WXUNUSED(stat)) -{ - wxMISSING_FUNCTION(); - return false; -} - -#endif // wxUSE_OWNER_DRAWN - //============================================================================= wxQtAction::wxQtAction( wxMenu *parent, int id, const wxString &text, const wxString &help, From 20466d045f09e3f997932bde459dc127c5c1c5da Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 3 Oct 2018 01:12:47 +0200 Subject: [PATCH 063/231] Slightly simply wxScrollHelperBase::ScrollLayout() No real changes, just use wxPoint and wxSize instead of intermediate int variables. --- src/generic/scrlwing.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index c8256d61ca..aa269504c9 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -767,10 +767,8 @@ bool wxScrollHelperBase::ScrollLayout() // If we're the scroll target, take into account the // virtual size and scrolled position of the window. - int x = 0, y = 0, w = 0, h = 0; - CalcScrolledPosition(0,0, &x,&y); - m_win->GetVirtualSize(&w, &h); - m_win->GetSizer()->SetDimension(x, y, w, h); + m_win->GetSizer()->SetDimension(CalcScrolledPosition(wxPoint(0, 0)), + m_win->GetVirtualSize()); return true; } From 180fb2f35bd81bae890f4938d6a5c3e017475c7a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 3 Oct 2018 01:19:57 +0200 Subject: [PATCH 064/231] Restrict scrolled window virtual area in non-scrollable direction If a wxScrolledWindow is only scrollable in one direction, its virtual size should only extend beyond the actual size of the window in this direction, as any contents not fitting the window wouldn't be visible anyhow. --- src/generic/scrlwing.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index aa269504c9..a55f832d94 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -767,8 +767,18 @@ bool wxScrollHelperBase::ScrollLayout() // If we're the scroll target, take into account the // virtual size and scrolled position of the window. + wxSize size = m_win->GetVirtualSize(); + + // However we should use the real window size in the direction in which + // scrolling is disabled, if any. + const wxSize clientSize = m_win->GetClientSize(); + if ( !IsScrollbarShown(wxHORIZONTAL) ) + size.x = clientSize.x; + if ( !IsScrollbarShown(wxVERTICAL) ) + size.y = clientSize.y; + m_win->GetSizer()->SetDimension(CalcScrolledPosition(wxPoint(0, 0)), - m_win->GetVirtualSize()); + size); return true; } From dd9ef9e588a2a214658a4e8363729647474a21d8 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Tue, 2 Oct 2018 22:27:15 +0200 Subject: [PATCH 065/231] Select latest Windows 10 SDK when building with MSVS 2017 Unfortunately Visual Studio 2017 defaults to Windows SDK 8.1 which is not installed with it. This workaround automatically targets the latest Windows 10 SDK when building. Closes https://github.com/wxWidgets/wxWidgets/pull/959 Closes #18078. --- build/msw/wx_config.props | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/msw/wx_config.props b/build/msw/wx_config.props index 4419b2bb28..006464cc88 100644 --- a/build/msw/wx_config.props +++ b/build/msw/wx_config.props @@ -10,4 +10,10 @@ v140 v141 + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + $(LatestTargetPlatformVersion) + $(WindowsTargetPlatformVersion) + From 1b5e3649e51ca84e0ac7eb71a6bf86217197172e Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 3 Oct 2018 18:11:54 +0200 Subject: [PATCH 066/231] Integrate MSW, OS X and iOS build instructions into doxygen Make build instructions available in doxygen but keep the old folder structure. --- docs/doxygen/Doxyfile | 5 +- docs/doxygen/mainpages/platdetails.h | 7 +- docs/ios/install.md | 27 ++++ docs/ios/readme.txt | 29 ---- docs/msw/{gtk.txt => gtk.md} | 10 +- docs/msw/{install.txt => install.md} | 198 +++++++++++++++------------ docs/msw/msys2-gtk.md | 124 +++++++++++++++++ docs/msw/msys2-gtk.txt | 111 --------------- docs/msw/msys2-msw.md | 101 ++++++++++++++ docs/msw/msys2-msw.txt | 92 ------------- docs/msw/readme.txt | 2 +- docs/msw/{winxp.txt => winxp.md} | 48 ++++--- docs/osx/{install.txt => install.md} | 73 +++++----- docs/osx/readme.txt | 4 +- 14 files changed, 438 insertions(+), 393 deletions(-) create mode 100644 docs/ios/install.md rename docs/msw/{gtk.txt => gtk.md} (91%) rename docs/msw/{install.txt => install.md} (84%) create mode 100644 docs/msw/msys2-gtk.md delete mode 100644 docs/msw/msys2-gtk.txt create mode 100644 docs/msw/msys2-msw.md delete mode 100644 docs/msw/msys2-msw.txt rename docs/msw/{winxp.txt => winxp.md} (66%) rename docs/osx/{install.txt => install.md} (70%) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index bef0fc9a9d..717e859b79 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -100,7 +100,7 @@ ALIASES += appearance_brief{2}="\htmlonly
\endhtmlonly\n\1\htmlonly\endhtmlonly\n\image html generic/\2.png\n\htmlonly
\endhtmlonly" # aliases for the creation of "named member groups" -# USAGE: the first argument must not contain spaces and be a unique identifier +# USAGE: the first argument must not contain spaces and be a unique identifier # of the member group for the class being documented; # the second argument is the member group name and can contain spaces # See wxString as an usage example. @@ -292,6 +292,9 @@ WARN_LOGFILE = doxygen.log INPUT = mainpages \ groups \ overviews \ + ../ios \ + ../msw \ + ../osx \ ../../interface INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.h *.md diff --git a/docs/doxygen/mainpages/platdetails.h b/docs/doxygen/mainpages/platdetails.h index f4beee8625..ec95b1e25c 100644 --- a/docs/doxygen/mainpages/platdetails.h +++ b/docs/doxygen/mainpages/platdetails.h @@ -62,8 +62,7 @@ distribution. wxOSX/Cocoa is the port of wxWidgets for the OS X platform. It requires OS X 10.7 or later and fully supports 64 bit builds. -For further information, please see the files in @c docs/osx in the -distribution. +@subpage plat_osx_install "Build and Install Instructions" @@ -105,7 +104,7 @@ This port can be compiled with several compilers including Microsoft Studio VC++ 2003 or later, Borland 5.5, MinGW32, Cygwin as well as cross-compilation with a Linux-hosted MinGW32 tool chain. -For further information, please see the files in docs/msw in the distribution. +@subpage plat_msw_install "Build and Install Instructions" @subsection page_port_wxmsw_resources Resources and Application Icon @@ -175,7 +174,7 @@ wxiOS is a port of wxWidgets using Cocoa touch libraries for iOS. It is very basic in it current form, but is included for further improvements and very simple applications. It requires iOS 9 or later and fully supports 64 bit builds. -For further information, please see the files in docs/ios in the distribution. +@subpage plat_ios_install "Build Instructions" @section page_port_nativedocs Native Toolkit Documentation diff --git a/docs/ios/install.md b/docs/ios/install.md new file mode 100644 index 0000000000..9892c59e4d --- /dev/null +++ b/docs/ios/install.md @@ -0,0 +1,27 @@ +Building wxWidgets for iOS {#plat_ios_install} +---------------------------- + +wxiOS is far from a full supported port, but can be used +as base for simple applications and future improvements. + +It requires Xcode with iOS SDK 9.0 or later. Xcode is available +for free in the OS X app store. + +To build wxiOS you should use Xcode to open the minimal samples +Xcode project file located at: + + samples/minimal/minimal_iphone.xcodeproj + +That project files includes wxiphone.xcodeproj so you just need +to hit run in order to see the minimal sample running in the +simulator. + +The library can also be build via configure/make: + + mkdir build_ios + cd build_ios + ../configure --with-osx_iphone --enable-monolithic \ + --with-macosx-version-min=8.0 --disable-shared \ + --enable-macosx_arch=i386 \ + --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) + make diff --git a/docs/ios/readme.txt b/docs/ios/readme.txt index 573db30676..928ef715ef 100644 --- a/docs/ios/readme.txt +++ b/docs/ios/readme.txt @@ -4,35 +4,6 @@ wxiOS is far from a full supported port, but can be used as base for simple applications and future improvements. -It requires Xcode with iOS SDK 9.0 or later. Xcode is available -for free in the OS X app store. - -More info about the wxWidgets project (including all the -other ports and version of wxWidgets) can be found at the -main wxWidgets homepage at: - - https://www.wxwidgets.org/ - -To build wxiOS you should use Xcode to open the minimal samples -Xcode project file located at: - - samples/minimal/minimal_iphone.xcodeproj - -That project files includes wxiphone.xcodeproj so you just need -to hit run in order to see the minimal sample running in the -simulator. - -The library can also be build via configure/make: - - mkdir build_ios - cd build_ios - ../configure --with-osx_iphone --enable-monolithic \ - --with-macosx-version-min=8.0 --disable-shared \ - --enable-macosx_arch=i386 \ - --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) - make - - Please send problems concerning installation, feature requests, bug reports or comments to the wxWidgets users list. These can be found at https://www.wxwidgets.org/support/mailing-lists/ diff --git a/docs/msw/gtk.txt b/docs/msw/gtk.md similarity index 91% rename from docs/msw/gtk.txt rename to docs/msw/gtk.md index 6756ea61ec..631884bb18 100644 --- a/docs/msw/gtk.txt +++ b/docs/msw/gtk.md @@ -1,4 +1,4 @@ -Building wxGTK port with Win32 GDK backend +Building wxGTK port with Win32 GDK backend {#plat_msw_gtk} ------------------------------------------ GTK+ widget toolkit has multiple GDK backends and one of them is Win32. @@ -11,14 +11,15 @@ These notes don't consider building wxGTK with X11 backend under Windows. Building steps: 1. wxGTK/Win32 build is similar to wxMSW one and you should have configured -and be able to build wxWidgets as described in docs/msw/install.txt +and be able to build wxWidgets as described in @ref plat_msw_install 2. wxGTK/Win32 is disabled by default in wxWidgets, you need to enable it in bakefiles manually. Apply following patch manually or using Cygwin: - patch -p0 < docs/msw/gtkfix.patch + patch -p0 < docs/msw/gtkfix.patch Regenerate required make/project files: + cd build\bakefiles bakefile_gen @@ -31,6 +32,7 @@ in the C:\gtk directory. 4. Building 4.1 If you are using Visual C++ project files you need to setup GTK+ 2 include directories + C:\gtk\lib\include\gtk-2.0 C:\gtk\lib\include\glib-2.0 C:\gtk\lib\include\cairo @@ -44,7 +46,7 @@ and library directory C:\gtk\lib\ - See http://msdn.microsoft.com/en-us/library/t9az1d21(v=vs.90).aspx +See http://msdn.microsoft.com/en-us/library/t9az1d21(v=vs.90).aspx Open solution file in build\msw directory, select "GTK+ Debug" solution configuration and build the solution. To be sure that everything is as expected diff --git a/docs/msw/install.txt b/docs/msw/install.md similarity index 84% rename from docs/msw/install.txt rename to docs/msw/install.md index d3a69b8302..6e6e5f1146 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.md @@ -1,37 +1,28 @@ - Installing wxWidgets for Windows - -------------------------------- +Installing wxWidgets for Windows {#plat_msw_install} +-------------------------------- This is wxWidgets for Microsoft Windows (XP, Vista, 7, 8, 10, etc) including both 32 bit and 64 bit versions. +[TOC] -Table of Contents: - - Installation - - Building wxWidgets - - Configuring the Build - - Building Applications Using wxWidgets - - -Installation +Installation {#msw_install} ============ If you are using one of the supported compilers, you can download the pre-built in binaries from - https://github.com/wxWidgets/wxWidgets/releases/v3.1.1 +https://github.com/wxWidgets/wxWidgets/releases/v3.1.1 In this case, just uncompress the binaries archive under any directory -and skip to "Building Applications Using wxWidgets" part. +and skip to [Building Applications Using wxWidgets](#msw_build_apps) part. Otherwise, or if you want to build a configuration of the library different from the default one, you need to build the library from sources before using it. -If you use CMake, please see - - https://docs.wxwidgets.org/trunk/overview_cmake.html - -for building wxWidgets using it. +If you use CMake, please see @ref overview_cmake for +building wxWidgets using it. The first step, which you may have already performed, unless you are reading this file online, is to download the source archive and @@ -46,22 +37,22 @@ actually required, this makes using the library more convenient and this environment variable is used in the examples below. NB: If you checked your sources from version control repository and - didn't obtain them from a release file, you also need to copy - include/wx/msw/setup0.h to include/wx/msw/setup.h and to remember - to update the latter whenever the former changes, otherwise you - will get compilation errors if any new symbols are added to - setup0.h file in the repository. +didn't obtain them from a release file, you also need to copy +`include/wx/msw/setup0.h` to `include/wx/msw/setup.h` and to remember +to update the latter whenever the former changes, otherwise you +will get compilation errors if any new symbols are added to +setup0.h file in the repository. - If you have no intention of modifying setup.h, you may avoid this - problem by creating a symbolic link to setup0.h instead of making - a copy of it using mklink, from an admin command prompt: +If you have no intention of modifying setup.h, you may avoid this +problem by creating a symbolic link to setup0.h instead of making +a copy of it using mklink, from an admin command prompt: - cd %WXWIN%\include\wx\msw\ - mklink setup.h setup0.h + cd %WXWIN%\include\wx\msw\ + mklink setup.h setup0.h -Building wxWidgets +Building wxWidgets {#msw_build} ================== The following sections explain how to compile wxWidgets with each supported @@ -70,7 +61,7 @@ building your application using wxWidgets. All makefiles and project are located in build\msw directory. -Microsoft Visual C++ Compilation +Microsoft Visual C++ Compilation {#msw_build_msvs} ---------------------------------------------------------------- * From command line using the provided makefiles: @@ -79,7 +70,7 @@ Microsoft Visual C++ Compilation must have been installed to the "Start" menu or the "Start" screen by MSVS installation. -1. Change directory to %WXWIN%\build\msw and type +1. Change directory to \%WXWIN\%\build\msw and type > nmake /f makefile.vc @@ -99,7 +90,7 @@ Microsoft Visual C++ Compilation See "Configuring the Build" for more information about the additional parameters that can be specified on the command line. -2. To verify your build, change the directory to %WXWIN%\samples\minimal and +2. To verify your build, change the directory to \%WXWIN\%\samples\minimal and run the same nmake command (with the same parameters there), this should create a working minimal wxWidgets sample. @@ -120,7 +111,7 @@ are not always built in the correct order, and this may result in link errors. Simply do the build again, up to 3 times, to fix this. -Special notes for Visual Studio 2010+: +### Special notes for Visual Studio 2010+ For Visual Studio 2010+ solutions it is possible to customize the build by creating a wx_local.props file in the build\msw directory which is used, if it @@ -132,8 +123,8 @@ make the file is to copy wx_setup.props to wx_local.props and then edit local. For example, if you are building wxWidgets libraries using multiple versions of Visual Studio you could change wxCompilerPrefix to include the toolset: -- vc -+ vc$(PlatformToolsetVersion) + - vc + + vc$(PlatformToolsetVersion) Following that example if you are using Visual Studio 2013 and open wx_vc12.sln it will build using the "vc120" prefix for the build directories @@ -147,28 +138,31 @@ updated with it. For example the version information in wx_setup.props could change and the information in your wx_local.props would be outdated. It is your responsibility to monitor for such situations. -Improve debugging for Visual Studio 2012+: +### Improve debugging for Visual Studio 2012+ Debug visualizers for Visual Studio 2012+ are provided which makes inspecting various wxWidgets classes easier to view while debugging. To use them: -1. Open the folder %WXWIN%\misc\msvc -2. Open the folder %USERPROFILE%\My Documents\Visual Studio 2012\Visualizers\ +1. Open the folder \%WXWIN\%\misc\msvc +2. Open the folder \%USERPROFILE\%\My Documents\Visual Studio 2012\Visualizers\ (or the corresponding location for newer versions, e.g. ...2013\Visualizers) 3. Copy wxWidgets.natvis and autoexp.inc 4. For Visual Studio 2013+ additionally copy wxWidgets.2013.natvis -Cygwin/MinGW Compilation +Cygwin/MinGW Compilation {#msw_build_cygwin} ---------------------------------------------------------------- wxWidgets supports Cygwin, MinGW, MinGW-w64 and TDM-GCC tool chains under Windows. They can be downloaded from: - http://www.cygwin.com/ - http://www.mingw.org/ - http://mingw-w64.sourceforge.net/ - http://tdm-gcc.tdragon.net/ +http://www.cygwin.com/ + +http://www.mingw.org/ + +http://mingw-w64.sourceforge.net/ + +http://tdm-gcc.tdragon.net/ respectively. Please retrieve and install the latest version of your preferred tool chain by following the instructions provided by these packages. Notice @@ -189,7 +183,7 @@ All of these tool chains can be used either with Unix-like configure+make build process (preferred) or with the provided makefile.gcc makefiles without using configure: -* Using configure +### Using configure This method works in exactly the same way as under Unix systems, including OS X, and requires a Unix-like environment to work, i.e. @@ -231,7 +225,7 @@ either MSYS or Cygwin. so this step can usually be omitted. -* Using plain makefiles: +### Using plain makefiles: NOTE: The makefile.gcc makefiles are for compilation under MinGW using Windows command interpreter (command.com/cmd.exe), they won't work @@ -240,7 +234,7 @@ NOTE: The makefile.gcc makefiles are for compilation under MinGW using 0. Open DOS command line window (cmd.exe, *not* Bash sh.exe). -1. Change directory to %WXWIN%\build\msw and type +1. Change directory to \%WXWIN\%\build\msw and type > mingw32-make -f makefile.gcc @@ -263,7 +257,7 @@ NOTE: The makefile.gcc makefiles are for compilation under MinGW using -Borland C++ Compilation +Borland C++ Compilation {#msw_build_borland} ---------------------------------------------------------------- WARNING: Borland instructions are out of date, please send us your @@ -278,7 +272,7 @@ debugger is very good. To avoid linker errors you will need to add -DSHARED=1 to the makefile line for the library The version 5.6 included in Borland C++ Builder 2006 works as well after the -following small change: please remove the test for __WINDOWS__ from line 88 +following small change: please remove the test for `__WINDOWS__` from line 88 of the file BCCDIR\include\stl\_threads.h. Compiling using the makefiles: @@ -302,7 +296,7 @@ debug mode, edit makefile.bcc and change /aa to /Tpe in link commands. Using the Debugger and IDE in BDS or Turbo Explorer --------------------------------------------------- -Doubleclick / open %WXWIN%\samples\minimal\borland.bdsproj. The current version +Doubleclick / open \%WXWIN\%\samples\minimal\borland.bdsproj. The current version is to be used with a dynamic build of wxWidgets-made by running make -f Makefile.bcc -DBUILD=debug -DSHARED=1 in wxWidgets\build\msw. You also need the wxWidgets\lib\bcc_dll @@ -324,16 +318,16 @@ Compiling using the IDE files for Borland C++ 5.0 and using CBuilder IDE In all of your wxWidgets applications, your source code should include the following preprocessor directive: -#ifdef __BORLANDC__ -#pragma hdrstop -#endif + #ifdef __BORLANDC__ + #pragma hdrstop + #endif (check the samples -- e.g., \wx2\samples\minimal\minimal.cpp -- for more details) -Configuring the Build +Configuring the Build {#msw_build_config} ================================================================ NOTE: If you use configure to build the library with Cygwin/MinGW, the @@ -344,7 +338,7 @@ Library configuration ---------------------------------------------------------------- While it is never necessary to do it, you may want to change some of -the options in the %WXWIN%\include\wx\msw\setup.h file before building +the options in the \%WXWIN\%\\include\\wx\\msw\\setup.h file before building wxWidgets. This file is heavily commented, please read it and enable or disable the features you would like to compile wxWidgets with[out]. @@ -381,17 +375,20 @@ depending on the compiler used. The full list of the build settings follows: -BUILD=release +* BUILD=release + Builds release version of the library. It differs from default 'debug' in lack of appended 'd' in name of library and uses the release CRT libraries instead of debug ones. Notice that even release builds do include debug information by default, see DEBUG_FLAG for more information about it. -SHARED=1 +* SHARED=1 + Build shared libraries (DLLs). By default, DLLs are not built (SHARED=0). -UNICODE=0 +* UNICODE=0 + To completely disable Unicode support (default is UNICODE=1). It should not be necessary to do this. @@ -399,54 +396,62 @@ UNICODE=0 Unicode build) and the directory where the library and setup.h are stored (ditto). -WXUNIV=1 +* WXUNIV=1 + Build wxUniversal instead of native wxMSW -MONOLITHIC=1 +* MONOLITHIC=1 + Starting with version 2.5.1, wxWidgets has the ability to be built as several smaller libraries instead of single big one as used to be the case in 2.4 and older versions. This is called "multilib build" and is the default behaviour of makefiles. You can still build single library ("monolithic build") by setting MONOLITHIC variable to 1. -USE_GUI=0 +* USE_GUI=0 + Disable building GUI parts of the library, build only wxBase components used by console applications. Note that if you leave USE_GUI=1 then both wxBase and GUI libraries are built. -USE_$(LIBRARY)=0 +* USE_$(LIBRARY)=0 + Do not build the corresponding library (all libraries are built by default). Library which can be disabled in this way are: AUI, HTML, MEDIA, GL (the option name is USE_OPENGL for this one), PROPGRID, QA, RIBBON, RICHTEXT, STC, WEBVIEW, XRC. -RUNTIME_LIBS=static +* RUNTIME_LIBS=static + Links static version of C and C++ runtime libraries into the executable, so that the program does not depend on DLLs provided with the compiler (e.g. Visual C++'s msvcrt.dll or Borland's cc3250mt.dll). Caution: Do not use static runtime libraries when building DLL (SHARED=1)! -DEBUG_FLAG=0 -DEBUG_FLAG=1 -DEBUG_FLAG=2 +* DEBUG_FLAG=0 +* DEBUG_FLAG=1 +* DEBUG_FLAG=2 + Specifies the level of debug support in wxWidgets. Notice that this is independent from both BUILD and DEBUG_INFO options. By default always set to 1 meaning that debug support is enabled: asserts are compiled into the code (they are inactive by default in release builds of the application but can be enabled), wxLogDebug() and wxLogTrace() are available - and __WXDEBUG__ is defined. Setting it to 0 completely disables all + and `__WXDEBUG__` is defined. Setting it to 0 completely disables all debugging code in wxWidgets while setting it to 2 enables even the time consuming assertions and checks which are deemed to be unsuitable for production environment. -DEBUG_INFO=0 -DEBUG_INFO=1 +* DEBUG_INFO=0 +* DEBUG_INFO=1 + This option affects whether debugging information is generated. If omitted or set to 'default' its value is determined the value of the BUILD option. -DEBUG_RUNTIME_LIBS=0 -DEBUG_RUNTIME_LIBS=1 +* DEBUG_RUNTIME_LIBS=0 +* DEBUG_RUNTIME_LIBS=1 + (VC++ only.) If set to 1, msvcrtd.dll is used, if to 0, msvcrt.dll is used. By default msvcrtd.dll is used only if the executable contains debug info and msvcrt.dll if it doesn't. It is sometimes @@ -455,11 +460,13 @@ DEBUG_RUNTIME_LIBS=1 usable .pdb files with debug information) and this setting makes it possible. -TARGET_CPU=X64|ARM64|IA64 +* TARGET_CPU=X64|ARM64|IA64 + (VC++ only.) Set this variable to build for x86_64 systems. If unset, x86 build is performed. -VENDOR= +* VENDOR=\ + Set this to a short string identifying your company if you are planning to distribute wxWidgets DLLs with your application. Default value is 'custom'. This string is included as part of DLL name. wxWidgets DLLs contain compiler @@ -468,72 +475,74 @@ VENDOR= default settings. If you set VENDOR=mycorp, the name will change to wxmsw311u_core_vc_mycorp.dll. -CFG= +* CFG=\ + Sets configuration name so that you can have multiple wxWidgets builds with different setup.h settings coexisting in same tree. The value of this option is appended to the build directories names. This is useful for building the library in some non-default configuration, - e.g. you could change wxUSE_STL to 1 in %WXWIN%\include\wx\msw\setup.h and + e.g. you could change wxUSE_STL to 1 in \%WXWIN\%\include\wx\msw\setup.h and then build with "CFG=-stl". Alternatively, you could build with e.g. "RUNTIME_LIBS=static CFG=-mt" when using MSVC. -COMPILER_PREFIX= +* COMPILER_PREFIX=\ + If you build with multiple versions of the same compiler, you can put their outputs into directories like "vc6_lib", "vc8_lib" etc. instead of "vc_lib" by setting this variable to e.g. "vc6". This is merely a convenience variable, you can achieve the same effect (but different directory names) with the CFG option. -CFLAGS -CXXFLAGS -CPPFLAGS -LDFLAGS +* CFLAGS +* CXXFLAGS +* CPPFLAGS +* LDFLAGS + Additional flags to be used with C compiler, C++ compiler, C preprocessor (used for both C and C++ compilation) and linker, respectively. -Building Applications Using wxWidgets +Building Applications Using wxWidgets {#msw_build_apps} ===================================== If you want to use CMake for building your project, please see - - https://docs.wxwidgets.org/trunk/overview_cmake.html#cmake_apps +@ref overview_cmake. Otherwise follow the instructions below for "manual" setup of your project. We suppose that wxWidgets sources are under the directory $WXWIN (notice that different tool chains refer to environment variables such as WXWIN in different ways, e.g. MSVC users should use $(WXWIN) instead of just -$WXWIN). And we will use as a shortcut for the subdirectory of +$WXWIN). And we will use \ as a shortcut for the subdirectory of $WXWIN\lib which is composed from several parts separated by underscore: first, a compiler-specific prefix (e.g. "vc" for MSVC, "gcc" for g++ or the value of COMPILER_PREFIX if you set it explicitly), then optional "x64" if building in 64 bits and finally either "lib" or "dll" depending on whether static or dynamic wx libraries are being used. -For example, WXWIN could be "c:\wxWidgets\3.4.5" and could be +For example, WXWIN could be "c:\wxWidgets\3.4.5" and \ could be "c:\wxWidgets\3.4.5\lib\vc_x64_lib" for 64-bit static libraries built with MSVC. Here is what you need to do: -* Add $WXWIN\include to the +* Add $WXWIN\\include to the - compiler - resource compiler include paths. * If using MSVC, prepend $WXWIN\include\msvc to the include paths too. - Otherwise, append \mswu[d] to the include paths, where "d" should + Otherwise, append \\mswu[d] to the include paths, where "d" should be used for debug builds only. * Define the following symbols for the preprocessor: - - __WXMSW__ to ensure you use the correct wxWidgets port. + - `__WXMSW__` to ensure you use the correct wxWidgets port. - _UNICODE unless you want to use deprecated ANSI build of wxWidgets. - NDEBUG if you want to build in release mode, i.e. disable asserts. - WXUSINGDLL if you are using DLL build of wxWidgets. * If using MSVC 7 only (i.e. not for later versions), also define wxUSE_RC_MANIFEST=1 and WX_CPU_X86. -* Add directory described above to the libraries path. +* Add \ directory described above to the libraries path. When using MSVC, the libraries are linked automatically using "#pragma comment(lib)" feature of this compiler. With all the other compilers you also @@ -554,3 +563,18 @@ using wxWidgets and always work, so in case of a problem, e.g. if the instructions here are out of date, you can always simply copy a makefile or project file from $WXWIN\samples\minimal or some other sample and adapt it to your application. + +If you are not using Visual Studio 2010 or newer please see +@subpage plat_msw_winxp "Windows XP Support" to enable visual styles in your +application. + +Advanced Library Configurations {#msw_advanced} +=============================== +Build instructions to less common library configuartions using different UI +backends are avaiable here. + +@subpage plat_msw_msys2 "Building with Win32 MSys2 backend" + +@subpage plat_msw_msys2_gtk "Building with Win32 MSys2 GDK backend" + +@subpage plat_msw_gtk "Building wxGTK port with Win32 GDK backend" diff --git a/docs/msw/msys2-gtk.md b/docs/msw/msys2-gtk.md new file mode 100644 index 0000000000..e6cb03567a --- /dev/null +++ b/docs/msw/msys2-gtk.md @@ -0,0 +1,124 @@ +Building wxGTK port with Win32 MSys2 GDK backend {#plat_msw_msys2_gtk} +------------------------------------------------ + +GTK+ widget toolkit has multiple GDK backends and one of them is Win32. +It is a wrapper around Windows API. + +These notes don't consider building wxGTK with X11 backend under Windows. + +The MSys2 website is http://www.msys2.org/ + +These building steps are NOT the normal way to build MSys2 MinGW packages. +But, they are a way the wxWidgets developers can test that wxWidgets +can build the wxGTK/Win32 libraries under MSys2 MinGW. + +For the MSys2 way please see + https://github.com/Alexpux/MINGW-packages and + https://github.com/msys2/msys2/wiki/Creating-packages + +Building steps: + +**Warning**: At the time these directions were written the GTK version 3 + was NOT able to create wxGTK/Win32 libraries that were usable. + +1. Install the mingw32 packages needed to build wxGTK/Win32 using the + configure/make build method. + From the MSys2 prompt or MSys2 MinGW prompt: + + The 32 bit Mingw packages are prefixed with "mingw-w64-i686-"; + Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit. + + pacman -S --needed --noconfirm make + pacman -S --needed --noconfirm mingw-w64-i686-libjpeg-turbo + pacman -S --needed --noconfirm mingw-w64-i686-libpng + pacman -S --needed --noconfirm mingw-w64-i686-libtiff + pacman -S --needed --noconfirm mingw-w64-i686-gcc + pacman -S --needed --noconfirm mingw-w64-i686-pkg-config + ## gtk2 can take a long time to update/find fonts + pacman -S --needed --noconfirm mingw-w64-i686-gtk2 + + + Packages that are needed but are normally installed already. + + pacman -S --needed --noconfirm mingw-w64-i686-gcc-libs + pacman -S --needed --noconfirm mingw-w64-i686-expat + pacman -S --needed --noconfirm mingw-w64-i686-xz + pacman -S --needed --noconfirm mingw-w64-i686-zlib + pacman -S --needed --noconfirm mingw-w64-i686-gdk-pixbuf2 + + +2. Build the wxGTK/Win32 static library + 1. Open MSys2 MinGW Prompt + (These steps were tested on MinGW32; but, should work under MinGW64) + 2. Use the cd command to change directory to the wxWidgets top folder. + + 3. Create the "build-gtk2-static" folder to build the static libraries + + mkdir -p build-gtk2-static + + 4. Configure wxWidgets + Option "--disable-precomp-headers" is NOT needed. + It is being used to test for compile issues. + + Remove configure option "--disable-wxdib" to set wxUSE_WXDIB to 1. + The directions docs/msw/gtk.txt results in wxUSE_WXDIB set to 1. + + cd build-gtk2-static && \ + ../configure --with-gtk=2 \ + --disable-wxdib \ + --disable-shared \ + --disable-precomp-headers \ + && cd .. + + 5. clean the wxGTK static libraries + + cd build-gtk2-static && make clean && cd .. + + 6. make the wxGTK static libraries + + cd build-gtk2-static && make && cd .. + + +3. Build and run the minimal static sample + 1. Clean the minimal sample + + cd build-gtk2-static/samples/minimal && make clean && cd ../../.. + + 2. Build the minimal sample + + cd build-gtk2-static/samples/minimal && make && cd ../../.. + + 3. Run the minimal sample + + ./build-gtk2-static/samples/minimal/minimal.exe + + +4. Build most of the static samples + 1. Clean most of the static samples + + cd build-gtk2-static/samples && make clean && cd ../.. + + 2. Build most of the static samples + + cd build-gtk2-static/samples && make && cd ../.. + + +5. Run the drawing static sample + + cd samples/drawing && ../../build-gtk2-static/samples/drawing/drawing.exe && cd ../.. + +6. Run the splash static sample + + cd samples/splash && ../../build-gtk2-static/samples/splash/splash.exe && cd ../.. + +7. Run the widgets static sample + + cd samples/widgets && ../../build-gtk2-static/samples/widgets/widgets.exe && cd ../.. + +8. Run the toolbar static sample + + cd samples/toolbar && ../../build-gtk2-static/samples/toolbar/toolbar.exe && cd ../.. + +9. Run the image static sample + + cd samples/image && ../../build-gtk2-static/samples/image/image.exe && cd ../.. diff --git a/docs/msw/msys2-gtk.txt b/docs/msw/msys2-gtk.txt deleted file mode 100644 index bc7a08a9a5..0000000000 --- a/docs/msw/msys2-gtk.txt +++ /dev/null @@ -1,111 +0,0 @@ -Building wxGTK port with Win32 MSys2 GDK backend ------------------------------------------------- - -GTK+ widget toolkit has multiple GDK backends and one of them is Win32. -It is a wrapper around Windows API. - -These notes don't consider building wxGTK with X11 backend under Windows. - -The MSys2 website is http://www.msys2.org/ - -These building steps are NOT the normal way to build MSys2 MinGW packages. -But, they are a way the wxWidgets developers can test that wxWidgets -can build the wxGTK/Win32 libraries under MSys2 MinGW. - -For the MSys2 way please see - https://github.com/Alexpux/MINGW-packages and - https://github.com/msys2/msys2/wiki/Creating-packages - -Building steps: - -#Note: The "#" is used in front of a comment to help the people who cut -# and paste these directions. -#Warning: At the time these directions were written the GTK version 3 -# was NOT able to create wxGTK/Win32 libraries that were usable. - -#1. Install the mingw32 packages needed to build wxGTK/Win32 using the -# configure/make build method. -# From the MSys2 prompt or MSys2 MinGW prompt: - -# The 32 bit Mingw packages are prefixed with "mingw-w64-i686-"; -# Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit. - -pacman -S --needed --noconfirm make -pacman -S --needed --noconfirm mingw-w64-i686-libjpeg-turbo -pacman -S --needed --noconfirm mingw-w64-i686-libpng -pacman -S --needed --noconfirm mingw-w64-i686-libtiff -pacman -S --needed --noconfirm mingw-w64-i686-gcc -pacman -S --needed --noconfirm mingw-w64-i686-pkg-config -## gtk2 can take a long time to update/find fonts -pacman -S --needed --noconfirm mingw-w64-i686-gtk2 - - -# Packages that are needed but are normally installed already. -pacman -S --needed --noconfirm mingw-w64-i686-gcc-libs -pacman -S --needed --noconfirm mingw-w64-i686-expat -pacman -S --needed --noconfirm mingw-w64-i686-xz -pacman -S --needed --noconfirm mingw-w64-i686-zlib -pacman -S --needed --noconfirm mingw-w64-i686-gdk-pixbuf2 - - -#2. Build the wxGTK/Win32 static library -#2a.Open MSys2 MinGW Prompt -# (These steps were tested on MinGW32; but, should work under MinGW64) -#2b.Use the cd command to change directory to the wxWidgets top folder. - - -#2c.Create the "build-gtk2-static" folder to build the static libraries -mkdir -p build-gtk2-static - -#2d.Configure wxWidgets -# Option "--disable-precomp-headers" is NOT needed. -# It is being used to test for compile issues. -# -# Remove configure option "--disable-wxdib" to set wxUSE_WXDIB to 1. -# The directions docs/msw/gtk.txt results in wxUSE_WXDIB set to 1. -cd build-gtk2-static && \ - ../configure --with-gtk=2 \ - --disable-wxdib \ - --disable-shared \ - --disable-precomp-headers \ - && cd .. - -#2e.clean the wxGTK static libraries -cd build-gtk2-static && make clean && cd .. - -#2f.make the wxGTK static libraries -cd build-gtk2-static && make && cd .. - - -#3 Build and run the minimal static sample -#3a.Clean the minimal sample -cd build-gtk2-static/samples/minimal && make clean && cd ../../.. - -#3b.Build the minimal sample -cd build-gtk2-static/samples/minimal && make && cd ../../.. - -#3c.Run the minimal sample -./build-gtk2-static/samples/minimal/minimal.exe - - -#4 Build most of the static samples -#4a.Clean most of the static samples -cd build-gtk2-static/samples && make clean && cd ../.. -#4b.Build most of the static samples -cd build-gtk2-static/samples && make && cd ../.. - - -#5 Run the drawing static sample -cd samples/drawing && ../../build-gtk2-static/samples/drawing/drawing.exe && cd ../.. - -#6 Run the splash static sample -cd samples/splash && ../../build-gtk2-static/samples/splash/splash.exe && cd ../.. - -#7 Run the widgets static sample -cd samples/widgets && ../../build-gtk2-static/samples/widgets/widgets.exe && cd ../.. - -#8 Run the toolbar static sample -cd samples/toolbar && ../../build-gtk2-static/samples/toolbar/toolbar.exe && cd ../.. - -#9 Run the image static sample -cd samples/image && ../../build-gtk2-static/samples/image/image.exe && cd ../.. diff --git a/docs/msw/msys2-msw.md b/docs/msw/msys2-msw.md new file mode 100644 index 0000000000..a0bdedd853 --- /dev/null +++ b/docs/msw/msys2-msw.md @@ -0,0 +1,101 @@ +Building wxMSW port with Win32 MSys2 backend {#plat_msw_msys2} +------------------------------------------------ + +The MSys2 website is http://www.msys2.org/ + +These building steps are NOT the normal way to build MSys2 MinGW packages. +But, they are a way the wxWidgets developers can test that wxWidgets +can build the wxMSW libraries under MSys2 MinGW. + +For the MSys2 way please see https://github.com/Alexpux/MINGW-packages + +Building steps: + +1. Install the mingw32 packages needed to build wxMSW using the + configure/make build method. + From the MSys2 prompt or MSys2 MinGW prompt: + + The 32 bit Mingw packages are prefixed with "mingw-w64-i686-"; + Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit. + + pacman -S --needed --noconfirm make + pacman -S --needed --noconfirm mingw-w64-i686-libjpeg-turbo + pacman -S --needed --noconfirm mingw-w64-i686-libpng + pacman -S --needed --noconfirm mingw-w64-i686-libtiff + pacman -S --needed --noconfirm mingw-w64-i686-gcc + + Packages that are needed but are normally installed already. + + pacman -S --needed --noconfirm mingw-w64-i686-gcc-libs + pacman -S --needed --noconfirm mingw-w64-i686-expat + pacman -S --needed --noconfirm mingw-w64-i686-xz + pacman -S --needed --noconfirm mingw-w64-i686-zlib + + +2. Build the wxMSW static library + 1. Open MSys2 MinGW Prompt + (These steps were tested on MinGW32; but, should work under MinGW64) + 2. Use the cd command to change directory to the wxWidgets top folder. + + 3. Create the "build-msw-static" folder to build the static libraries + + mkdir -p build-msw-static + + 4. Configure wxWidgets + + Option "--disable-precomp-headers" is NOT needed. + I am doing it to check for compile issues; + And, I think my old 32 bit Windows machine + works best with it disabled. + + cd build-msw-static && \ + ../configure --with-msw \ + --disable-shared \ + --disable-precomp-headers \ + && cd .. + + 5. make the wxMSW static libraries + + cd build-msw-static && make && cd .. + +3. Build and run the minimal static sample + + 1. Clean the minimal sample + + cd build-msw-static/samples/minimal && make clean && cd ../../.. + + 2. Build the minimal sample + + cd build-msw-static/samples/minimal && make && cd ../../.. + + 3. Run the minimal sample + + ./build-msw-static/samples/minimal/minimal.exe + +4. Clean the static samples + + cd build-msw-static/samples && make clean && cd ../.. + +5. Build and run the typetest static sample to verify MIME database works + + cd build-msw-static/samples/typetest && make && cd ../../.. + ./build-msw-static/samples/typetest/typetest.exe + +6. Build and run the drawing static sample + + cd build-msw-static/samples/drawing && make && cd ../../.. + cd samples/drawing && ../../build-msw-static/samples/drawing/drawing.exe && cd ../.. + +7. Build and run the splash static sample + + cd build-msw-static/samples/splash && make && cd ../../.. + cd samples/splash && ../../build-msw-static/samples/splash/splash.exe && cd ../.. + +8. Build and run the widgets static sample + + cd build-msw-static/samples/widgets && make && cd ../../.. + cd samples/widgets && ../../build-msw-static/samples/widgets/widgets.exe && cd ../.. + +9. Build all the rest of the static samples + + cd build-msw-static/samples && make && cd ../.. diff --git a/docs/msw/msys2-msw.txt b/docs/msw/msys2-msw.txt deleted file mode 100644 index a88366b2aa..0000000000 --- a/docs/msw/msys2-msw.txt +++ /dev/null @@ -1,92 +0,0 @@ -Building wxMSW port with Win32 MSys2 backend ------------------------------------------------- - -The MSys2 website is http://www.msys2.org/ - -These building steps are NOT the normal way to build MSys2 MinGW packages. -But, they are a way the wxWidgets developers can test that wxWidgets -can build the wxMSW libraries under MSys2 MinGW. - -For the MSys2 way please see https://github.com/Alexpux/MINGW-packages - -Building steps: - -#Note: The "#" is used in front of a comment to help the people who cut -# and paste these directions. - -#1. Install the mingw32 packages needed to build wxMSW using the -# configure/make build method. -# From the MSys2 prompt or MSys2 MinGW prompt: - -# The 32 bit Mingw packages are prefixed with "mingw-w64-i686-"; -# Change the prefix to "mingw-w64-x86_64-" if you wish to do 64 bit. - -pacman -S --needed --noconfirm make -pacman -S --needed --noconfirm mingw-w64-i686-libjpeg-turbo -pacman -S --needed --noconfirm mingw-w64-i686-libpng -pacman -S --needed --noconfirm mingw-w64-i686-libtiff -pacman -S --needed --noconfirm mingw-w64-i686-gcc - -# Packages that are needed but are normally installed already. -pacman -S --needed --noconfirm mingw-w64-i686-gcc-libs -pacman -S --needed --noconfirm mingw-w64-i686-expat -pacman -S --needed --noconfirm mingw-w64-i686-xz -pacman -S --needed --noconfirm mingw-w64-i686-zlib - - -#2. Build the wxMSW static library -#2a.Open MSys2 MinGW Prompt -# (These steps were tested on MinGW32; but, should work under MinGW64) -#2b.Use the cd command to change directory to the wxWidgets top folder. - - -#2c.Create the "build-msw-static" folder to build the static libraries -mkdir -p build-msw-static - -#2d.Configure wxWidgets -# Option "--disable-precomp-headers" is NOT needed. -# I am doing it to check for compile issues; -# And, I think my old 32 bit Windows machine -# works best with it disabled. -cd build-msw-static && \ - ../configure --with-msw \ - --disable-shared \ - --disable-precomp-headers \ - && cd .. - -#2e.make the wxMSW static libraries -cd build-msw-static && make && cd .. - - -#3 Build and run the minimal static sample -#3a.Clean the minimal sample -cd build-msw-static/samples/minimal && make clean && cd ../../.. - -#3b.Build the minimal sample -cd build-msw-static/samples/minimal && make && cd ../../.. - -#3c.Run the minimal sample -./build-msw-static/samples/minimal/minimal.exe - - -#4 Clean the static samples -cd build-msw-static/samples && make clean && cd ../.. - -#5 Build and run the typetest static sample to verify MIME database works -cd build-msw-static/samples/typetest && make && cd ../../.. -./build-msw-static/samples/typetest/typetest.exe - -#6 Build and run the drawing static sample -cd build-msw-static/samples/drawing && make && cd ../../.. -cd samples/drawing && ../../build-msw-static/samples/drawing/drawing.exe && cd ../.. - -#7 Build and run the splash static sample -cd build-msw-static/samples/splash && make && cd ../../.. -cd samples/splash && ../../build-msw-static/samples/splash/splash.exe && cd ../.. - -#8 Build and run the widgets static sample -cd build-msw-static/samples/widgets && make && cd ../../.. -cd samples/widgets && ../../build-msw-static/samples/widgets/widgets.exe && cd ../.. - -#9 Build all the rest of the static samples -cd build-msw-static/samples && make && cd ../.. diff --git a/docs/msw/readme.txt b/docs/msw/readme.txt index 75c619c10b..00511b290a 100644 --- a/docs/msw/readme.txt +++ b/docs/msw/readme.txt @@ -1,7 +1,7 @@ This is wxWidgets for Windows (wxMSW) ------------------------------------- -For information on installing wxWidgets, please see install.txt. +For information on installing wxWidgets, please see install.md. For further information, please see docs/html/index.htm and the wxWidgets reference manual. diff --git a/docs/msw/winxp.txt b/docs/msw/winxp.md similarity index 66% rename from docs/msw/winxp.txt rename to docs/msw/winxp.md index 6c03f97760..a690ced463 100644 --- a/docs/msw/winxp.txt +++ b/docs/msw/winxp.md @@ -1,4 +1,4 @@ -Microsoft Windows XP Support from wxWidgets +Microsoft Windows XP Support from wxWidgets {#plat_msw_winxp} ------------------------------------------- Windows XP introduces the themes (called "visual styles" in the Microsoft @@ -30,27 +30,25 @@ for more details. Here is the example manifest which you can put into controls.exe.manifest file to test theme support using the controls sample: ---- cut here --- - - - -Controls: wxWidgets sample application - - - - - - ---- cut here --- + + + + Controls: wxWidgets sample application + + + + + + diff --git a/docs/osx/install.txt b/docs/osx/install.md similarity index 70% rename from docs/osx/install.txt rename to docs/osx/install.md index 57157981ac..9313a6f737 100644 --- a/docs/osx/install.txt +++ b/docs/osx/install.md @@ -1,58 +1,57 @@ -wxWidgets for OS X installation +wxWidgets for OS X installation {#plat_osx_install} ----------------------------------- +[TOC] + wxWidgets can be compiled using Apple's Cocoa library. -Most OS X developers should start by downloading and installing Xcode +Most OS X developers should start by downloading and installing Xcode from the App Store. It is a free IDE from Apple that provides all of the tools you need for working with wxWidgets. -After Xcode is installed, download wxWidgets-{version}.tar.bz2 and then +After Xcode is installed, download wxWidgets-{version}.tar.bz2 and then double-click on it to unpack it to create a wxWidgets directory. -Next use Terminal (under Applications, Utilities, Terminal) to access a command -prompt. Use cd to change directories to your wxWidgets directory and execute +Next use Terminal (under Applications, Utilities, Terminal) to access a command +prompt. Use cd to change directories to your wxWidgets directory and execute the following sets of commands from the wxWidgets directory. ---------- + mkdir build-cocoa-debug + cd build-cocoa-debug + ../configure --enable-debug + make -mkdir build-cocoa-debug -cd build-cocoa-debug -../configure --enable-debug -make -# Build the samples and demos -cd samples; make;cd .. -cd demos; make;cd .. +Build the samples and demos ---------- + cd samples; make;cd .. + cd demos; make;cd .. After the compilation completes, use Finder to run the samples and demos - Go to build-cocoa-debug/samples to experiment with the Cocoa samples. - Go to build-cocoa-debug/demos to experiment with the Cocoa demos. -Double-click on the executables which have an icon showing three small squares. -The source code for the samples is in wxWidgets/samples -The source code for the demos is in wxWidgets/demos - ---------- +* Go to build-cocoa-debug/samples to experiment with the Cocoa samples. +* Go to build-cocoa-debug/demos to experiment with the Cocoa demos. +* Double-click on the executables which have an icon showing three small squares. +* The source code for the samples is in wxWidgets/samples +* The source code for the demos is in wxWidgets/demos More information about building on OS X is available in the wxWiki. Here are two useful links - https://wiki.wxwidgets.org/Guides_%26_Tutorials - https://wiki.wxwidgets.org/Development:_wxMac + * https://wiki.wxwidgets.org/Guides_%26_Tutorials + * https://wiki.wxwidgets.org/Development:_wxMac ---------- -More advanced topics are covered below. +Advanced topics {#osx_advanced} +=============== ---------- +Installing library {#osx_install} +------------------ If you want to install the library into the system directories you'll need to do this as root. The accepted way of running commands as root is to use the built-in sudo mechanism. First of all, you must be using an account marked as a "Computer Administrator". Then -6) sudo make install -7) type + sudo make install + type \ Note that while using this method is okay for development, it is not recommended that you require endusers to install wxWidgets into their @@ -61,13 +60,13 @@ is to configure wxWidgets with --disable-shared. Another way to avoid it is to make a framework for wxWidgets. Making frameworks is beyond the scope of this document. -Note: +**Note:** It is rarely desirable to install non-Apple software into system directories. By configuring the library with --disable-shared and using the full path to wx-config with the --in-place option you can avoid installing the library. -Apple Developer Tools: Xcode +Apple Developer Tools: Xcode {#osx_xcode} ---------------------------- You can use the project in build/osx/wxcocoa.xcodeproj to build the Cocoa @@ -79,10 +78,10 @@ also wxrc tool which doesn't have its own Xcode project. If you need this tool, the simplest possibility is to build it from the command line after installing the libraries using commands like this: -$ cd utils/wxrc -$ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml` + $ cd utils/wxrc + $ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml` -Creating universal binaries +Creating universal binaries {#osx_universal_bin} --------------------------- The Xcode projects for the wxWidgets library and minimal project are set up @@ -108,11 +107,11 @@ binaries together. Assuming building on a PPC system: 2. Then, build for Intel, in a different folder. This time use: -export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386" -export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.7.sdk" + export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386" + export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.7.sdk" -./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \ - --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8 + ./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \ + --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8 You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel machine. diff --git a/docs/osx/readme.txt b/docs/osx/readme.txt index 766c099a10..28c11e87a0 100644 --- a/docs/osx/readme.txt +++ b/docs/osx/readme.txt @@ -2,9 +2,9 @@ Welcome to wxWidgets/Mac More Information is available from the wxWidgets project home page at -https://www.wxwidgets.org +https://www.wxwidgets.org -For more information, please see install.txt and the manuals. +For more information, please see install.md and the manuals. Please send problems concerning installation, feature requests, bug reports or comments to the wxWidgets users list. Information From f8460059cdb52c9153e0c99712294bdc201a2733 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 3 Oct 2018 18:55:02 +0200 Subject: [PATCH 067/231] Integrate GTK documentation into doxygen --- docs/doxygen/Doxyfile | 1 + docs/doxygen/mainpages/platdetails.h | 5 +- docs/gtk/{install.txt => install.md} | 143 ++++++++++++++------------- docs/gtk/overview.md | 2 +- 4 files changed, 77 insertions(+), 74 deletions(-) rename docs/gtk/{install.txt => install.md} (83%) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 717e859b79..56e567fd2e 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -292,6 +292,7 @@ WARN_LOGFILE = doxygen.log INPUT = mainpages \ groups \ overviews \ + ../gtk \ ../ios \ ../msw \ ../osx \ diff --git a/docs/doxygen/mainpages/platdetails.h b/docs/doxygen/mainpages/platdetails.h index ec95b1e25c..8d0a799201 100644 --- a/docs/doxygen/mainpages/platdetails.h +++ b/docs/doxygen/mainpages/platdetails.h @@ -52,8 +52,9 @@ GTK+ 1.2 can still be used, albeit discouraged. For that you can pass Support for GTK+ 3 is available starting with wxWidgets 2.9.4, use @c configure option @c \--with-gtk=3 to enable it. -For further information, please see the files in @c docs/gtk in the -distribution. +@subpage plat_gtk_install "Build and Install Instructions" + +@subpage plat_gtk_overview "wxWidgets on the GNOME Desktop" diff --git a/docs/gtk/install.txt b/docs/gtk/install.md similarity index 83% rename from docs/gtk/install.txt rename to docs/gtk/install.md index 965822c89a..11e37bc11a 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.md @@ -1,6 +1,8 @@ -wxWidgets for GTK+ installation +wxWidgets for GTK+ installation {#plat_gtk_install} ------------------------------- +[TOC] + IMPORTANT NOTE: If you experience problems installing, please re-read these @@ -13,19 +15,24 @@ IMPORTANT NOTE: using (including the beta) and what compiler on what system. One example: wxGTK 3.0.0, GCC 4.8.1, Fedora 19 -* The simplest case +Installation {#gtk_install} +============ + + +The simplest case {#gtk_simple} ------------------- If you compile wxWidgets on Linux for the first time and don't like to read install instructions just do (in the base dir): -> mkdir buildgtk -> cd buildgtk -> ../configure --with-gtk -> make -> su -> make install -> ldconfig + > mkdir buildgtk + > cd buildgtk + > ../configure --with-gtk + > make + > su + > make install + > ldconfig + [if you get "ldconfig: command not found", try using "/sbin/ldconfig"] If you don't do the 'make install' part, you can still use the libraries from @@ -33,14 +40,14 @@ the buildgtk directory, but they may not be available to other users. If you want to remove wxWidgets on Unix you can do this: -> su -> make uninstall -> ldconfig + > su + > make uninstall + > ldconfig Note that by default, GTK+ 2.x is used. GTK+ 3 can be specified with --with-gtk=3. -* The expert case +The expert case {#gtk_expert} ----------------- If you want to do some more serious cross-platform programming with wxWidgets, @@ -53,28 +60,28 @@ with --enable-debug and one without. For building three versions (one GTK+, one Motif and a debug version of the GTK source) you'd do this: -mkdir buildmotif -cd buildmotif -../configure --with-motif -make -cd .. + mkdir buildmotif + cd buildmotif + ../configure --with-motif + make + cd .. -mkdir buildgtk -cd buildgtk -../configure --with-gtk -make -cd .. + mkdir buildgtk + cd buildgtk + ../configure --with-gtk + make + cd .. -mkdir buildgtkd -cd buildgtkd -../configure --with-gtk --enable-debug -make -cd .. + mkdir buildgtkd + cd buildgtkd + ../configure --with-gtk --enable-debug + make + cd .. Note that you can install all those libraries concurrently, you just need to pass the appropriate flags when using them. -* The simplest errors +The simplest errors {#gtk_errors_simple} --------------------- For any configure errors: please look at config.log file which was generated @@ -101,18 +108,18 @@ GCC 2.95 or later. You get immediate segfault when starting any sample or application: This is either due to having compiled the library with different flags or options than -your program - typically you might have the __WXDEBUG__ option set for the +your program - typically you might have the `__WXDEBUG__` option set for the library but not for your program - or due to using a compiler with optimisation bugs. -* The simplest program +The simplest program {#gtk_simple_app} ---------------------- Now create your super-application myfoo.cpp and compile anywhere with -g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo -* GUI libraries +GUI libraries {#gtk_libs_gui} --------------- wxWidgets/GTK+ requires the GTK+ library to be installed on your system. It has @@ -127,7 +134,7 @@ You can get the newest version of the GTK+ from the GTK+ homepage at: We also mirror GTK+ at my ftp site. You'll find information about downloading at my homepage. -* Additional libraries +Additional libraries {#gtk_libs_misc} ---------------------- wxWidgets/Gtk requires a thread library and X libraries known to work with @@ -138,14 +145,14 @@ correct glibc 2 support. You can disable thread support by running -./configure --disable-threads -make -su -make install -ldconfig -exit + ./configure --disable-threads + make + su + make install + ldconfig + exit -* Building wxGTK on Cygwin +Building wxGTK on Cygwin {#gtk_cygwin} -------------------------- The normal build instructions should work fine on Cygwin. The one difference @@ -159,10 +166,11 @@ will see linking errors. If this happens then you can work around the problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know about it on the wx-dev mailing list. -* Create your configuration +Create your configuration {#gtk_config} --------------------------- Usage: + ./configure options If you want to use system's C and C++ compiler, @@ -182,7 +190,7 @@ have multiple configurations (for example, debug and release or GTK and Motif) simultaneously. -* General options +General options {#gtk_options} ----------------- Given below are the commands to change the default behaviour, @@ -259,7 +267,7 @@ The following options handle the kind of library you want to build. option instead of --enable-debug_info/flag ones separately. -* Feature Options +Feature Options {#gtk_feature_options} ----------------- When producing an executable that is linked statically with wxGTK @@ -316,7 +324,7 @@ Please see the output of "./configure --help" for comprehensive list of all configurable options. -* Compiling +Compiling {#gtk_compling} ----------- The following must be done in the base directory (e.g. ~/wxGTK @@ -352,43 +360,36 @@ make clean in the various directories will do the work for you. -* Creating a new Project +Creating a new Project {#gtk_new_project} -------------------------- -1) The first way uses the installed libraries and header files -automatically using wx-config +1. The first way uses the installed libraries and header files + automatically using wx-config -g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo + g++ myfoo.cpp `wx-config --cxxflags --libs` -o myfoo -Using this way, a make file for the minimal sample would look -like this + Using this way, a make file for the minimal sample would look + like this -CXX = g++ + CXX = g++ -minimal: minimal.o - $(CXX) -o minimal minimal.o `wx-config --libs` + minimal: minimal.o + $(CXX) -o minimal minimal.o `wx-config --libs` -minimal.o: minimal.cpp - $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o + minimal.o: minimal.cpp + $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o -clean: - rm -f *.o minimal + clean: + rm -f *.o minimal -If your application uses only some of wxWidgets libraries, you can -specify required libraries when running wx-config. For example, -`wx-config --libs=html,core` will only output link command to link -with libraries required by core GUI classes and wxHTML classes. See -the manual for more information on the libraries. + If your application uses only some of wxWidgets libraries, you can + specify required libraries when running wx-config. For example, + `wx-config --libs=html,core` will only output link command to link + with libraries required by core GUI classes and wxHTML classes. See + the manual for more information on the libraries. -2) The other way creates a project within the source code +2. The other way creates a project within the source code directories of wxWidgets. For this endeavour, you'll need GNU autoconf version 2.14 and add an entry to your Makefile.in to the bottom of the configure.in script and run autoconf and configure before you can type make. - ----------------------- - -In the hope that it will be useful, - - Robert Roebling - diff --git a/docs/gtk/overview.md b/docs/gtk/overview.md index 0ae6a19157..60d5265670 100644 --- a/docs/gtk/overview.md +++ b/docs/gtk/overview.md @@ -1,4 +1,4 @@ -# wxWidgets on the GNOME Desktop +# wxWidgets on the GNOME Desktop {#plat_gtk_overview} wxWidgets is a C++ cross-platform GUI library, whose distintive feature is the use of native calls and native widgets on the respective platform, i.e. an From 141b5bdf0f99fea40f235c240b212ca8363b8b9f Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 3 Oct 2018 19:16:39 +0200 Subject: [PATCH 068/231] Integrate QT documentation into doxygen --- docs/doxygen/Doxyfile | 1 + docs/doxygen/mainpages/platdetails.h | 4 +- docs/qt/architecture.md | 18 ++-- docs/qt/{install.txt => install.md} | 138 ++++++++++++++------------- 4 files changed, 83 insertions(+), 78 deletions(-) rename docs/qt/{install.txt => install.md} (67%) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 56e567fd2e..79e80eb90d 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -296,6 +296,7 @@ INPUT = mainpages \ ../ios \ ../msw \ ../osx \ + ../qt \ ../../interface INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.h *.md diff --git a/docs/doxygen/mainpages/platdetails.h b/docs/doxygen/mainpages/platdetails.h index 8d0a799201..4826fd1ce9 100644 --- a/docs/doxygen/mainpages/platdetails.h +++ b/docs/doxygen/mainpages/platdetails.h @@ -167,7 +167,9 @@ wxWindowBase::GetDefaultBorder(), returning wxBORDER_NONE. wxQt is a port of wxWidgets using Qt libraries. It requires Qt 5 or later. -For further information, please see the files in docs/qt in the distribution. +@subpage plat_qt_install "Build Instructions" + +@subpage plat_qt_architecture "Architecture Overview" @section page_port_wxiOS wxiOS diff --git a/docs/qt/architecture.md b/docs/qt/architecture.md index 557de91312..5804db42ac 100644 --- a/docs/qt/architecture.md +++ b/docs/qt/architecture.md @@ -1,4 +1,4 @@ -# wxQt Architecture +# wxQt Architecture {#plat_qt_architecture} ## Internals @@ -7,11 +7,11 @@ wxQT uses the same techniques like other ports to wrap the Qt toolkit classes in ### Current (original) Approach An '''internal pointer m_qtWindow''' in wxWindow holds the reference to the QWidget (or derived) counterpart, and is accesible through the virtual method '''GetHandle'''. -This pointer and other window styles are set up in the '''PostCreation''' method that must be called by the derived classes (mostly controls) to initialize the widget correctly. +This pointer and other window styles are set up in the '''PostCreation''' method that must be called by the derived classes (mostly controls) to initialize the widget correctly. Not doing so will cause painting and deletion issues, as the base class will not know how to handle the Qt widget. wxControl even provides a protected method '''QtCreateControl''' that will do the common initialization (including post creation step, moving, sizing, etc., and calling the base to add the child to the parent). -'''Warning:''' Take care of not calling any function that can raise an assertion before `PostCreation`, for example wxFAIL_MSG, as it will interrupt the normal initialization, hence the later cleanup will crash. +'''Warning:''' Take care of not calling any function that can raise an assertion before `PostCreation`, for example wxFAIL_MSG, as it will interrupt the normal initialization, hence the later cleanup will crash. For example, this issue was caused by WXValidateStyle in wxCheckBox::Create, that was "failing silently" in unit tests, and then raising segmentation faults when the object was later deleted (as Qt checkbox counterpart was never being deleted due the aborted initialization). Many controls have also other pointers to allow to map different sub-widgets and other features. @@ -28,9 +28,9 @@ Note that some special cases are '''not real windows''' like the `wxTabFrame` (A ### Scroll Areas In both approaches, special care should be taken with scrolling areas, as Qt manages this ones slightly different to wxWidgets. -'''QtGetScrollBarsContainer''' should be reimplemented to return the QScrollArea widget or similar (where the scroll bars are places). +'''QtGetScrollBarsContainer''' should be reimplemented to return the QScrollArea widget or similar (where the scroll bars are places). -That widget should implement a '''viewport()''' (Qt idiom to differentiate the draw-able area). +That widget should implement a '''viewport()''' (Qt idiom to differentiate the draw-able area). Attempts to paint directly to the scroll area itself will fail. This is already handled in the QtHandlePaintEvent wxWindowQt method. @@ -54,19 +54,19 @@ Qt objects needs to be sub-classed to '''re-implement events''' and '''connect s The approach chosen was to use templates to help inherit QObject's (QWidget), providing a common base to handle events and signal infrastructure: -* '''wxQtSignalHandler< wxWindow >:''' allows emitting wx events for Qt events & signals. This should be used used for all QObjects derivatives that are not widgets, for example QAction (used for shortcut / accelerators). +* '''wxQtSignalHandler< wxWindow >:''' allows emitting wx events for Qt events & signals. This should be used used for all QObjects derivatives that are not widgets, for example QAction (used for shortcut / accelerators). * '''wxQtEventSignalHandler< QWidget, wxWindow >:''' derived from `wxQtSignalHandler`, also handles basic events (change, focus, mouse, keyboard, paint, close, etc.). This should be used for all QWidget derivatives (controls, top level windows, etc.) ### Delete later -Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reseted to NULL when the wx counterpart is marked to deletion). +Both templates also have some safety checks to avoid invalid spurious access to deleted wx objects (using a special pointer to the wx instance stored in the Qt object, that is reseted to NULL when the wx counterpart is marked to deletion). This is due that in some situations, Qt object could still be referenced in the Qt event queue, so it cannot be removed immediately. -'''Important:''' Currently wxQT is using Qt's '''deleteLater''' method to avoid this kind of issues. +'''Important:''' Currently wxQT is using Qt's '''deleteLater''' method to avoid this kind of issues. Please, don't use delete directly except you're confident it will not cause faults or other issues. -Note that no public wxWidget class should be derived directly from QWidget as they could have different lifespans and other implications to run time type systems (RTTI). +Note that no public wxWidget class should be derived directly from QWidget as they could have different lifespans and other implications to run time type systems (RTTI). Some QObjects are even owned by Qt (for example: menubar, statusbar) and some parents (ie. `QTabWidget`) cannot be deleted immediately in some circumstances (they would cause segmentation faults due spurious events / signals caused by the children destruction if not correctly handled as explained previously) For more information about the deletion issues, see [deleteLater](https://github.com/reingart/wxWidgets/wiki/WxQtDeleteLaterNotes ) notes and [wx-dev thread](https://groups.google.com/d/msg/wx-dev/H0Xc9aQzaH4/crjFDPsEA0cJ) discussion. diff --git a/docs/qt/install.txt b/docs/qt/install.md similarity index 67% rename from docs/qt/install.txt rename to docs/qt/install.md index f53c602b8c..293999385a 100644 --- a/docs/qt/install.txt +++ b/docs/qt/install.md @@ -1,6 +1,8 @@ -wxWidgets for Qt installation +wxWidgets for Qt installation {#plat_qt_install} ----------------------------- +[TOC] + IMPORTANT NOTE: If you experience problems installing, please re-read these @@ -13,19 +15,23 @@ IMPORTANT NOTE: using (including the beta) and what compiler on what system. One example: wxQt 3.1.0, GCC 4.8.1, Ubuntu 14.04 -* The simplest case +Installation {#qt_install} +============ + +The simplest case {#qt_simple} ------------------- If you compile wxWidgets on Linux for the first time and don't like to read install instructions just do (in the base dir): -> mkdir buildqt -> cd buildqt -> ../configure --with-qt -> make -> su -> make install -> ldconfig + > mkdir buildqt + > cd buildqt + > ../configure --with-qt + > make + > su + > make install + > ldconfig + [if you get "ldconfig: command not found", try using "/sbin/ldconfig"] If you don't do the 'make install' part, you can still use the libraries from @@ -33,65 +39,65 @@ the buildgtk directory, but they may not be available to other users. If you want to remove wxWidgets on Unix you can do this: -> su -> make uninstall -> ldconfig + > su + > make uninstall + > ldconfig -* The simplest errors +The simplest errors {#qt_error_simple} --------------------- For any configure errors: please look at config.log file which was generated during configure run, it usually contains some useful information. -configure reports, that you don't have Qt installed although you are very +configure reports, that you don't have Qt installed although you are very sure you have. Well, you have installed it, but you also have another -version of the Qt installed, which you may need to remove. Or maybe you -installed it in a non-default location and configure can't find it there, -so please check that your PATH variable includes the path to the correct -qtconfig/pkg-config. Also check that your LD_LIBRARY_PATH or equivalent -variable contains the path to Qt libraries if they were installed in a +version of the Qt installed, which you may need to remove. Or maybe you +installed it in a non-default location and configure can't find it there, +so please check that your PATH variable includes the path to the correct +qtconfig/pkg-config. Also check that your LD_LIBRARY_PATH or equivalent +variable contains the path to Qt libraries if they were installed in a non-default location. -* The simplest program +The simplest program {#qt_simple_app} ---------------------- Now create your super-application myfoo.cpp and compile anywhere with -g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo -* GUI libraries +GUI libraries {#qt_libs_ui} --------------- wxWidgets/Qt requires the Qt library to be installed on your system. It has to be a stable version, preferably Qt 5.2.1 or later. -* Building wxQT on Ubuntu +Building wxQT on Ubuntu {#qt_build_ubuntu} ------------------------- Install latest Qt5 packages (qt5-default). To build unit tests, libcppunit-dev is required. You will need to install other dependencies to compile wxWidgets -depending on the features you'll want to use (build-essential libjpeg-dev +depending on the features you'll want to use (build-essential libjpeg-dev libtiff5-dev ubuntu-restricted-extras freeglut3 freeglut3-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev) Then create a build directory, configure and compile: -mkdir bldqt5 -cd bldqt5 -../configure --with-qt --enable-debug -make -make samples + mkdir bldqt5 + cd bldqt5 + ../configure --with-qt --enable-debug + make + make samples If everything is ok, you can do the make install as specified before. Optionally, you can build and run Unit Tests: -cd tests -make -./test_gui + cd tests + make + ./test_gui -* Building wxQT, using qt-unified-XXX-online installer +Building wxQT, using qt-unified-XXX-online installer {#qt_build} ------------------------------------------------------ Download qt-unified-XXX-online installer from the qt website. @@ -100,56 +106,59 @@ restriction as above). The same build instructions apply, except that you need to explicitly pass to configure the Qt dir of the build intended to use as QT5_CUSTOM_DIR, i.e. -# for Linux: -../configure --with-qt --enable-debug QT5_CUSTOM_DIR=~/Qt/5.11.0/gcc_64 +for Linux: -# for Windows (ran from Git Bash, or any other Unix-like shell): -# (the syntax for the drive in the path is required by ar and ld) -../configure --with-qt --enable-debug QT5_CUSTOM_DIR=c:/Qt/5.11.0/mingw53_32 + ../configure --with-qt --enable-debug QT5_CUSTOM_DIR=~/Qt/5.11.0/gcc_64 -* Building wxGT on Android +for Windows (ran from Git Bash, or any other Unix-like shell): +(the syntax for the drive in the path is required by ar and ld) + + ../configure --with-qt --enable-debug QT5_CUSTOM_DIR=c:/Qt/5.11.0/mingw53_32 + +Building wxGT on Android {#qt_android} -------------------------- Download Android Native Development Kit (NDK), tandalone Android Software Development Kit (SDK), install them and perform the following instructions to prepare the cross-compilation tool-chain to (change NDK and other paths): -NDK=~/src/android-ndk-r9d -SDK=~/src/android-sdk-linux -export ANDROID_NDK_ROOT=$NDK -$NDK/build/tools/make-standalone-toolchain.sh \ - --toolchain=arm-linux-androideabi-4.8 --platform=android-9 \ - --install-dir=/tmp/ndk + NDK=~/src/android-ndk-r9d + SDK=~/src/android-sdk-linux + export ANDROID_NDK_ROOT=$NDK + $NDK/build/tools/make-standalone-toolchain.sh \ + --toolchain=arm-linux-androideabi-4.8 --platform=android-9 \ + --install-dir=/tmp/ndk -export PATH=/tmp/ndk/bin:$PATH -export CC=arm-linux-androideabi-gcc -export CXX=arm-linux-androideabi-g++ + export PATH=/tmp/ndk/bin:$PATH + export CC=arm-linux-androideabi-gcc + export CXX=arm-linux-androideabi-g++ Also, you'll need to download the Qt library bundle that matches your operating -system installed package (5.2.1 in this case installed in ~/src/qt, you'll need +system installed package (5.2.1 in this case installed in ~/src/qt, you'll need the android_armv5/ android_armv7/ android_x86/ pre-compiled folders to cross-compile for that architectures) -Then, create a build directory (under the wxWidgets folder), configure for +Then, create a build directory (under the wxWidgets folder), configure for Andrid (disable currently unsupported/uneeded features) and run make: -cd ~/src/wxWidgets -mkdir bldqt5droid -cd bldqt5droid -../configure --with-qt --enable-debug --build=x86_64-unknown-linux-gnu \ - --host=arm-linux-androideabi --disable-compat28 --disable-shared \ - --disable-arttango --enable-image --disable-dragimage --disable-sockets \ - --with-libtiff=no --without-opengl --disable-baseevtloop --disable-utf8 -make + cd ~/src/wxWidgets + mkdir bldqt5droid + cd bldqt5droid + ../configure --with-qt --enable-debug --build=x86_64-unknown-linux-gnu \ + --host=arm-linux-androideabi --disable-compat28 --disable-shared \ + --disable-arttango --enable-image --disable-dragimage --disable-sockets \ + --with-libtiff=no --without-opengl --disable-baseevtloop --disable-utf8 + make You can now compile and link your app against this build, and finally package it for Android using standard APK tools. -* Create your configuration +Create your configuration {#qt_config} --------------------------- Usage: + ./configure options If you want to use system's C and C++ compiler, @@ -168,13 +177,13 @@ subdirectory of your wxWidgets installation) as this allows you to have multiple configurations (for example, debug and release or GTK and Motif) simultaneously. -* Feature Options +Feature Options {#qt_feature_options} ----------------- When producing an executable that is linked statically with wxQt you'll be surprised at its immense size. This can sometimes be drastically reduced by removing features from wxWidgets that -are not used in your program. +are not used in your program. Please see the output of "./configure --help" for comprehensive list of all configurable options. @@ -182,10 +191,3 @@ of all configurable options. Apart from disabling certain features you can very often "strip" the program of its debugging information resulting in a significant reduction in size. - ----------------------- - -In the hope that it will be useful, - - The wxWidgets Team - From da04a0a8e7f1c61047f54eca871e4e07c07ae870 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 3 Oct 2018 19:42:32 +0200 Subject: [PATCH 069/231] Integrate X11 and Motif install instructions into doxygen --- docs/doxygen/Doxyfile | 2 + docs/doxygen/mainpages/platdetails.h | 9 +- docs/motif/{install.txt => install.md} | 189 ++++++++++++------------ docs/x11/{install.txt => install.md} | 191 ++++++++++++------------- 4 files changed, 189 insertions(+), 202 deletions(-) rename docs/motif/{install.txt => install.md} (79%) rename docs/x11/{install.txt => install.md} (77%) diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 79e80eb90d..e6e63965c5 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -294,9 +294,11 @@ INPUT = mainpages \ overviews \ ../gtk \ ../ios \ + ../motif \ ../msw \ ../osx \ ../qt \ + ../x11 \ ../../interface INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.h *.md diff --git a/docs/doxygen/mainpages/platdetails.h b/docs/doxygen/mainpages/platdetails.h index 4826fd1ce9..40df3949c4 100644 --- a/docs/doxygen/mainpages/platdetails.h +++ b/docs/doxygen/mainpages/platdetails.h @@ -80,8 +80,9 @@ In order to configure wxWidgets to compile wxX11 you will need to type: @verbatim configure --with-x11 --with-universal @endverbatim -For further information, please see the files in @c docs/x11 in the -distribution. There is also a page on the use of wxWidgets for embedded +@subpage plat_x11_install "Build Instructions" + +There is also a page on the use of wxWidgets for embedded applications on the wxWidgets web site. @@ -92,8 +93,8 @@ wxMotif is a port of wxWidgets for X11 systems using Motif libraries. Motif libraries provide a clean and fast user interface at the expense of the beauty and candy of newer interfaces like GTK. -For further information, please see the files in @c docs/motif in the -distribution. +@subpage plat_motif_install "Build Instructions" + diff --git a/docs/motif/install.txt b/docs/motif/install.md similarity index 79% rename from docs/motif/install.txt rename to docs/motif/install.md index 1b937c304a..322aa0096c 100644 --- a/docs/motif/install.txt +++ b/docs/motif/install.md @@ -1,6 +1,8 @@ -wxWidgets for Motif installation +wxWidgets for Motif installation {#plat_motif_install} -------------------------------- +[TOC] + IMPORTANT NOTE: If you experience problems installing, please re-read these @@ -40,38 +42,38 @@ First steps config.log file). -COMPILING USING CONFIGURE +Compiling using configure {#motif_configure} ========================= -* The simplest case +The simplest case {#motif_simple} ------------------- If you compile wxWidgets on Linux for the first time and don't like to read install instructions just do (in the base dir): -> ./configure --with-motif -> make -> su -> make install -> ldconfig -> exit + > ./configure --with-motif + > make + > su + > make install + > ldconfig + > exit Afterwards you can continue with -> make -> su -> make install -> ldconfig -> exit + > make + > su + > make install + > ldconfig + > exit If you want to remove wxWidgets on Unix you can do this: -> su -> make uninstall -> ldconfig -> exit + > su + > make uninstall + > ldconfig + > exit -* The expert case +The expert case {#motif_expert} ----------------- If you want to do some more serious cross-platform programming with wxWidgets, @@ -84,28 +86,28 @@ with --enable-debug and one without. For building three versions (one GTK, one Motif and a debug version of the GTK source) you'd do this: -mkdir buildmotif -cd buildmotif -../configure --with-motif -make -cd .. + mkdir buildmotif + cd buildmotif + ../configure --with-motif + make + cd .. -mkdir buildgtk -cd buildgtk -../configure --with-gtk -make -cd .. + mkdir buildgtk + cd buildgtk + ../configure --with-gtk + make + cd .. -mkdir buildgtkd -cd buildgtkd -../configure --with-gtk --enable-debug -make -cd .. + mkdir buildgtkd + cd buildgtkd + ../configure --with-gtk --enable-debug + make + cd .. Note that since wxWidgets-2.6.0 you can install all those libraries concurrently, you just need to pass the appropriate flags when using them. -* The simplest errors +The simplest errors {#motif_error_simple} --------------------- You get errors during compilation: The reason is that you probably have a @@ -115,18 +117,18 @@ GCC 2.95 or later. You get immediate segfault when starting any sample or application: This is either due to having compiled the library with different flags or options than -your program - typically you might have the __WXDEBUG__ option set for the +your program - typically you might have the `__WXDEBUG__` option set for the library but not for your program - or due to using a compiler with optimisation bugs. -* The simplest program +The simplest program {#motif_simple_app} ---------------------- Now create your super-application myfoo.app and compile anywhere with -g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo -* General +General {#motif_general} --------- The Unix variants of wxWidgets use GNU configure. If you have problems with @@ -134,7 +136,7 @@ your make use GNU make instead. If you have general problems with installation, see the wxWidgets website at - https://www.wxwidgets.org/ +https://www.wxwidgets.org/ for newest information. If you still don't have any success, please send a bug report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF @@ -142,7 +144,7 @@ YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF MOTIF, WXMOTIF, WHAT DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried... -* GUI libraries +GUI libraries {#motif_libs_gui} --------------- wxWidgets/Motif requires the Motif library to be installed on your system. As @@ -151,9 +153,9 @@ most of the Motif API without the licence restrictions of Motif. You can get the newest version of the Lesstif from the lesstif homepage at: - http://lesstif.sourceforge.net/ +http://lesstif.sourceforge.net/ -* Additional libraries +Additional libraries {#motif_libs_misc} ---------------------- wxWidgets/Motif requires a thread library and X libraries known to work with @@ -164,14 +166,14 @@ correct glibc 2 support. You can disable thread support by running -./configure --disable-threads -make -su -make install -ldconfig -exit + ./configure --disable-threads + make + su + make install + ldconfig + exit -* Building wxMotif on Cygwin +Building wxMotif on Cygwin {#motif_cygwin} ---------------------------- The normal build instructions should work fine on Cygwin. The one difference @@ -185,10 +187,11 @@ will see linking errors. If this happens then you can work around the problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know about it on the wx-dev mailing list. -* Create your configuration +Create your configuration {#motif_config} --------------------------- Usage: + ./configure [options] If you want to use system's C and C++ compiler, @@ -216,7 +219,7 @@ Configure will complain if the system variable OSTYPE has not been defined. And Make in some circumstances as well... -* General options +General options {#motif_options} ------------------- Given below are the commands to change the default behaviour, @@ -289,7 +292,7 @@ The following options handle the kind of library you want to build. must be compiled with the same debug options. -* Feature Options +Feature Options {#motif_feature_options} ----------------- Many of the configure options have been thoroughly tested @@ -338,7 +341,7 @@ Please see the output of "./configure --help" for comprehensive list of all configurable options. -* Compiling +Compiling {#motif_compile} ----------- The following must be done in the base directory (e.g. ~/wxMotif @@ -374,41 +377,41 @@ object-files: in the various directories will do the work for you. -* Creating a new Project +Creating a new Project {#motif_new_project} ------------------------ -1) The first way uses the installed libraries and header files +1. The first way uses the installed libraries and header files automatically using wx-config -g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo -Using this way, a make file for the minimal sample would look -like this + Using this way, a make file for the minimal sample would look + like this -CXX = g++ + CXX = g++ -minimal: minimal.o - $(CXX) -o minimal minimal.o `wx-config --libs` + minimal: minimal.o + $(CXX) -o minimal minimal.o `wx-config --libs` -minimal.o: minimal.cpp - $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o + minimal.o: minimal.cpp + $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o -clean: - rm -f *.o minimal + clean: + rm -f *.o minimal -If your application uses only some of wxWidgets libraries, you can -specify required libraries when running wx-config. For example, -`wx-config --libs=html,core` will only output link command to link -with libraries required by core GUI classes and wxHTML classes. See -the manual for more information on the libraries. + If your application uses only some of wxWidgets libraries, you can + specify required libraries when running wx-config. For example, + `wx-config --libs=html,core` will only output link command to link + with libraries required by core GUI classes and wxHTML classes. See + the manual for more information on the libraries. -2) The other way creates a project within the source code +2. The other way creates a project within the source code directories of wxWidgets. For this endeavour, you'll need GNU autoconf version 2.14 and add an entry to your Makefile.in to the bottom of the configure.in script and run autoconf and configure before you can type make. -* Further notes by Julian Smart +Further notes by Julian Smart {#motif_notes} --------------------------------- - You may find the following script useful for compiling wxMotif, @@ -416,25 +419,23 @@ and configure before you can type make. permissions). Make this script executable with the command chmod a+x makewxmotif. - -------:x-----Cut here-----:x----- - # makewxmotif - # Sets permissions (in case we extracted wxMotif from zip files) - # and makes wxMotif. - # Call from top-level wxWidgets directory. - # Note that this uses standard (but commonly-used) configure options; - # if you're feeling brave, you may wish to compile with threads: - # if they're not supported by the target platform, they will be disabled - # anyhow - # -- Julian Smart - chmod a+x configure config.sub config.guess - ./configure --with-shared --with-motif --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc - make - -------:x-----Cut here-----:x----- + # makewxmotif + # Sets permissions (in case we extracted wxMotif from zip files) + # and makes wxMotif. + # Call from top-level wxWidgets directory. + # Note that this uses standard (but commonly-used) configure options; + # if you're feeling brave, you may wish to compile with threads: + # if they're not supported by the target platform, they will be disabled + # anyhow + # -- Julian Smart + chmod a+x configure config.sub config.guess + ./configure --with-shared --with-motif --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc + make This script will build wxMotif using shared libraries. If you want to build a static wxWidgets library, use --disable-shared. -Troubleshooting +Troubleshooting {#motif_troubleshoot} --------------- - Solaris compilation with gcc: if the compiler has problems with the variable @@ -458,20 +459,10 @@ Troubleshooting If you find any incorrect instances, though, such as a missing 'const' in an overridden function, please let us know. -Other Notes +Other Notes {#motif_misc} ----------- - Using configure will create a release build of the library by default: it's recommended to use --enable-debug configure switch while developing your application. To compile in non-debug mode, use --disable-debug configure switch. - -Bug reports ------------ - -Please send bug reports with a description of your environment, -compiler and the error message(s) to the developers mailing list at: - - https://www.wxwidgets.org/support/mailing-lists/ - -Julian Smart, Robert Roebling and Vadim Zeitlin, November 1999. diff --git a/docs/x11/install.txt b/docs/x11/install.md similarity index 77% rename from docs/x11/install.txt rename to docs/x11/install.md index 61d252b010..579bd88fc8 100644 --- a/docs/x11/install.txt +++ b/docs/x11/install.md @@ -1,6 +1,8 @@ -wxWidgets for X11 installation +wxWidgets for X11 installation {#plat_x11_install} ------------------------------ +[TOC] + IMPORTANT NOTE: If you experience problems installing, please re-read these @@ -13,7 +15,7 @@ IMPORTANT NOTE: using (including the beta) and what compiler on what system. One example: wxX11 2.8.0, gcc 2.95.4, Redhat 6.2 -First steps +First steps {#x11_first_steps} ----------- - Download wxX11-x.y.z.tgz, where x.y.z is the version number. @@ -34,38 +36,38 @@ First steps information about your platform and the (relevant part of) contents of config.log file). -COMPILING USING CONFIGURE +Compiling using configure {#x11_configure} ========================= -* The simplest case +The simplest case {#x11_simple} ------------------- If you compile wxWidgets on Linux for the first time and don't like to read install instructions just do (in the base dir): -> ./configure --with-x11 -> make -> su -> make install -> ldconfig -> exit + > ./configure --with-x11 + > make + > su + > make install + > ldconfig + > exit Afterwards you can continue with -> make -> su -> make install -> ldconfig -> exit + > make + > su + > make install + > ldconfig + > exit If you want to remove wxWidgets on Unix you can do this: -> su -> make uninstall -> ldconfig -> exit + > su + > make uninstall + > ldconfig + > exit -* The expert case +The expert case {#x11_expert} ----------------- If you want to do some more serious cross-platform programming with wxWidgets, @@ -80,25 +82,25 @@ that purpose. For building three versions (one GTK, one X11 and a debug version of the GTK source) you'd do this: -md buildx11 -cd buildx11 -../configure --with-x11 -make -cd .. + md buildx11 + cd buildx11 + ../configure --with-x11 + make + cd .. -md buildgtk -cd buildgtk -../configure --with-gtk -make -cd .. + md buildgtk + cd buildgtk + ../configure --with-gtk + make + cd .. -md buildgtkd -cd buildgtkd -../configure --with-gtk --enable-debug_flag -make -cd .. + md buildgtkd + cd buildgtkd + ../configure --with-gtk --enable-debug_flag + make + cd .. -* The simplest errors +The simplest errors {#x11_errors} --------------------- You get errors during compilation: The reason is that you probably have a @@ -108,18 +110,18 @@ GCC 2.95 or later. You get immediate segfault when starting any sample or application: This is either due to having compiled the library with different flags or options than -your program - typically you might have the __WXDEBUG__ option set for the +your program - typically you might have the `__WXDEBUG__` option set for the library but not for your program - or due to using a compiler with optimisation bugs. -* The simplest program +The simplest program {#x11_simple_app} ---------------------- Now create your super-application myfoo.cpp and compile anywhere with -g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo -* General +General {#x11_general} --------- The Unix variants of wxWidgets use GNU configure. If you have problems with @@ -127,19 +129,19 @@ your make use GNU make instead. If you have general problems with installation, see the wxWidgets website at - https://www.wxwidgets.org/ +https://www.wxwidgets.org/ for newest information. If you still don't have any success, please send a bug report to one of our mailing lists (see my homepage) INCLUDING A DESCRIPTION OF YOUR SYSTEM AND YOUR PROBLEM, SUCH AS YOUR VERSION OF X, WHAT DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know this has no effect, but I tried... -* GUI libraries +GUI libraries {#x11_libs_gui} --------------- wxWidgets/X11 requires the X11 library to be installed on your system. -* Additional libraries +Additional libraries {#x11_libs_misc} ---------------------- wxWidgets/X11 requires a thread library and X libraries known to work with @@ -150,14 +152,14 @@ many aspects. As of writing this, virtually all Linux distributions have You can disable thread support by running -./configure --disable-threads -make -su -make install -ldconfig -exit + ./configure --disable-threads + make + su + make install + ldconfig + exit -* Building wxX11 on Cygwin +Building wxX11 on Cygwin {#x11_cygwin} -------------------------- The normal build instructions should work fine on Cygwin. The one difference @@ -171,10 +173,11 @@ will see linking errors. If this happens then you can work around the problem by setting LDFLAGS=-Wl,--export-all-symbols. Please also let us know about it on the wx-dev mailing list. -* Create your configuration +Create your configuration {#x11_config} --------------------------- Usage: + ./configure [options] If you want to use system's C and C++ compiler, @@ -202,7 +205,7 @@ Configure will complain if the system variable OSTYPE has not been defined. And Make in some circumstances as well... -* General options +General options {#x11_options} ----------------- Given below are the commands to change the default behaviour, @@ -268,7 +271,7 @@ The following options handle the kind of library you want to build. must be compiled with the same debug options. -* Feature Options +Feature Options {#x11_feature_options} ----------------- Many of the configure options have been thoroughly tested @@ -320,7 +323,7 @@ Please see the output of "./configure --help" for comprehensive list of all configurable options. -* Compiling +Compiling {#x11_compiling} ----------- The following must be done in the base directory (e.g. ~/wxX11 @@ -356,44 +359,44 @@ object-files: in the various directories will do the work for you. -* Creating a new Project +Creating a new Project {#x11_new_app} ------------------------ -1) The first way uses the installed libraries and header files +1. The first way uses the installed libraries and header files automatically using wx-config -g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo + g++ myfoo.cpp `wx-config --libs` `wx-config --cxxflags` -o myfoo -Using this way, a make file for the minimal sample would look -like this + Using this way, a make file for the minimal sample would look + like this -CXX = g++ + CXX = g++ -minimal: minimal.o - $(CXX) -o minimal minimal.o `wx-config --libs` + minimal: minimal.o + $(CXX) -o minimal minimal.o `wx-config --libs` -minimal.o: minimal.cpp - $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o + minimal.o: minimal.cpp + $(CXX) `wx-config --cxxflags` -c minimal.cpp -o minimal.o -clean: - rm -f *.o minimal + clean: + rm -f *.o minimal -This is certain to become the standard way unless we decide -to stick to tmake. + This is certain to become the standard way unless we decide + to stick to tmake. -If your application uses only some of wxWidgets libraries, you can -specify required libraries when running wx-config. For example, -`wx-config --libs=html,core` will only output link command to link -with libraries required by core GUI classes and wxHTML classes. See -the manual for more information on the libraries. + If your application uses only some of wxWidgets libraries, you can + specify required libraries when running wx-config. For example, + `wx-config --libs=html,core` will only output link command to link + with libraries required by core GUI classes and wxHTML classes. See + the manual for more information on the libraries. -2) The other way creates a project within the source code +2. The other way creates a project within the source code directories of wxWidgets. For this endeavour, you'll need GNU autoconf version 2.14 and add an entry to your Makefile.in to the bottom of the configure.in script and run autoconf and configure before you can type make. -* Further notes by Julian Smart +Further notes by Julian Smart {#x11_notes} ------------------------------- - You may find the following script useful for compiling wxX11, @@ -401,25 +404,23 @@ and configure before you can type make. permissions). Make this script executable with the command chmod a+x makewxx11. - -------:x-----Cut here-----:x----- - # makewxx11 - # Sets permissions (in case we extracted wxX11 from zip files) - # and makes wxX11. - # Call from top-level wxWidgets directory. - # Note that this uses standard (but commonly-used) configure options; - # if you're feeling brave, you may wish to compile with threads: - # if they're not supported by the target platform, they will be disabled - # anyhow - # -- Julian Smart - chmod a+x configure config.sub config.guess - ./configure --with-x11 --with-shared --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc - make - -------:x-----Cut here-----:x----- + # makewxx11 + # Sets permissions (in case we extracted wxX11 from zip files) + # and makes wxX11. + # Call from top-level wxWidgets directory. + # Note that this uses standard (but commonly-used) configure options; + # if you're feeling brave, you may wish to compile with threads: + # if they're not supported by the target platform, they will be disabled + # anyhow + # -- Julian Smart + chmod a+x configure config.sub config.guess + ./configure --with-x11 --with-shared --with-debug_flag --with-debug_info --enable-debug --without-threads --without-sockets --without-odbc + make This script will build wxX11 using shared libraries. If you want to build a static wxWidgets library, use --disable-shared. -Troubleshooting +Troubleshooting {#x11_troubleshooting} --------------- - Solaris compilation with gcc: if the compiler has problems with the variable @@ -437,7 +438,7 @@ Troubleshooting If you find any incorrect instances, though, such as a missing 'const' in an overridden function, please let us know. -Other Notes +Other Notes {#x11_misc_notes} ----------- - Debugging mode is switched on by default in the makefiles, but using @@ -448,11 +449,3 @@ Other Notes configure system, change --with-debug_flag to --without-debug_flag and --with-debug_info to --without-debug_info in the makewxx11 script). - -Bug reports ------------ - -Please send bug reports with a description of your environment, -compiler and the error message(s) to the developers mailing list at: - - https://www.wxwidgets.org/support/mailing-lists/ From 26b2e9f5c7326727a55ae12c6bb9fd491f2ce2b4 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 3 Oct 2018 22:13:31 +0200 Subject: [PATCH 070/231] Add information on how to use pre-built MSW binaries to doxygen The text is collected from docs/contributing/release.md and the blog post explaining usage of binaries. --- docs/doxygen/mainpages/platdetails.h | 2 + docs/msw/binaries.md | 90 ++++++++++++++++++++++++++++ docs/msw/install.md | 6 +- 3 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 docs/msw/binaries.md diff --git a/docs/doxygen/mainpages/platdetails.h b/docs/doxygen/mainpages/platdetails.h index 40df3949c4..4330322178 100644 --- a/docs/doxygen/mainpages/platdetails.h +++ b/docs/doxygen/mainpages/platdetails.h @@ -108,6 +108,8 @@ with a Linux-hosted MinGW32 tool chain. @subpage plat_msw_install "Build and Install Instructions" +@subpage plat_msw_binaries "Using pre-built binaries" + @subsection page_port_wxmsw_resources Resources and Application Icon All applications using wxMSW should have a Windows resource file (@c .rc diff --git a/docs/msw/binaries.md b/docs/msw/binaries.md new file mode 100644 index 0000000000..e5aceba9c3 --- /dev/null +++ b/docs/msw/binaries.md @@ -0,0 +1,90 @@ +How to use wxMSW binaries {#plat_msw_binaries} +========================= + +[TOC] + +Supported Compilers +------------------- +We provide pre-built binary files for the following compilers: + +* Microsoft Visual C++ compiler versions 9.0, 10.0, 11.0, 12.0, 14.0 and 14.1 + (corresponding to marketing product names of Microsoft Visual Studio 2008, 2010, 2012, 2013, 2015 and 2017 respectively). +* TDM-GCC version 5.1 and MinGW-w64 version 7.2 (with the default SJLJ + exceptions propagation method, using C++11). Please note that you need to use + the very latest MinGW-w64 7.2 compiler release with this version of the + compiler which can be downloaded from + [here for 32 bits](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/7.2.0/threads-win32/sjlj/i686-7.2.0-release-win32-sjlj-rt_v5-rev1.7z/download) + and + [here for 64 bits](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.2.0/threads-win32/seh/x86_64-7.2.0-release-win32-seh-rt_v5-rev1.7z/download), + the older "rev0" release has a known bug affecting building wxWidgets in + some scenarios. + + +Getting the files +----------------- + +First, you need to get the correct files. You will always need the +`wxWidgets-3.1.1-headers.7z` one but the rest depends on your compiler version +and architecture: as different versions of MSVC compiler are not binary +compatible, you should select the files with the correct +`vc80`, `vc90`, `vc100`, `vc110`, `vc120`, `vc140` or `vc141` +suffix depending on whether you use +Visual Studio 2005, 2008, 2010, 2012, 2013, 2015 or 2017 respectively. +You also need to decide whether you use the `x64` files for 64-bit development +or the ones without this suffix for the still more common 32-bit builds. After +determining the combination of suffixes you need, you should download the +"Dev" and the "ReleaseDLL" files in addition to the "Headers" one above, +e.g. for 32-bit MSVS 2017 development you need +`wxMSW-3.1.1_vc141_Dev.7z` and `wxMSW-3.1.1_vc141_ReleaseDLL.7z`. + +All binaries are available at: + +https://github.com/wxWidgets/wxWidgets/releases/v3.1.1 + +Once you have the files you need, unzip all of them into the same directory, for +example `c:\wx\3.1.1`. You should have only include and lib subdirectories under +it, nothing else. To avoid hard-coding this path into your projects, define +`wxwin` environment variable containing it: although it's a little known fact, +all versions of MSVC support environment variable expansion in the C++ projects +(but not, unfortunately, in the solution files). + +Using Binaries with Visual Studio +--------------------------------- + +Next step is to set up your project to use these files. You need to do the +following: + +* In the compiler options, i.e. "C/C++" properties: + * Add `$(wxwin)/include/msvc;$(wxwin)/include` to the "Additional Include + Directories". Notice that the order is important here, putting the + MSVC-specific directory first ensures that you use `wx/setup.h` + automatically linking in wxWidgets libraries. + * Add `WXUSINGDLL` and `wxMSVC_VERSION_AUTO` to the list of defined + symbols in "Preprocessor Definitions". The first should be + self-explanatory (we only provide DLLs, not static libraries) while the + second one is necessary to use the libraries from e.g. `lib\vc100_dll` + directory and not the default `lib\vc_dll`. + * Also check that `_UNICODE` and `UNICODE` symbols are defined in the same + "Preprocessor Definitions" section. This should already be the case for + the newly created projects but it might be necessary to add them if + you're upgrading an existing one. + * Check that you use "Multi-threaded \[Debug\] DLL" in the "Run-time + library" option under "Code Generation" to ensure that your build uses + the same CRT version as our binaries. +* In the linker options you only need to add `$(wxwin)\lib\vc141_dll` (with + the compiler-version-dependent suffix, of course) to "Additional Library + Directories" under "Linker\\General" in the options. Thanks to the use of + MSVC-specific `setup.h` you don't need to list wxWidgets libraries manually, + i.e. you do **not** need to put anything in the list of "Additional + Dependencies". + +Now you should be able to build your project successfully, both in "Debug" and +"Release" configurations. With MSVS 10 or newer it can also be done from the +command line using `msbuild.exe`. Of course, to run the generated executable +you will need to either add the directory containing wxWidgets DLLs to your PATH +or copy the DLL files to a directory already on it. Finally, if you want to +distribute the binaries created using these options, you will need to install +Microsoft Visual C++ run-time DLLs. Again, MSVC 10 or newer has an advantage +here as you can simply copy `msvcp100.dll` and `msvcr100.dll` as any other DLL, +while you need to install specially for the previous compiler versions that +use WinSxS ("side-by-side") for them. diff --git a/docs/msw/install.md b/docs/msw/install.md index 6e6e5f1146..2399ffbbe2 100644 --- a/docs/msw/install.md +++ b/docs/msw/install.md @@ -9,10 +9,8 @@ including both 32 bit and 64 bit versions. Installation {#msw_install} ============ -If you are using one of the supported compilers, you can download the -pre-built in binaries from - -https://github.com/wxWidgets/wxWidgets/releases/v3.1.1 +If you are using one of the supported compilers, you can use +[pre-built binaries](@ref plat_msw_binaries). In this case, just uncompress the binaries archive under any directory and skip to [Building Applications Using wxWidgets](#msw_build_apps) part. From f704c40207df2b518ed5105c23ea1cd2199291f4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 16:31:55 +0200 Subject: [PATCH 071/231] Don't use wxDisplayFactorySingleX11 in wxGTK if wxUSE_DISPLAY==0 wxDisplay::CreateFactory() shouldn't be defined in this file when building wxGTK, whether wxUSE_DISPLAY==1 or 0. --- src/unix/displayx11.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 93113a4886..7c376bf83c 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -370,6 +370,7 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) #endif // !__WXGTK20__ #endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H #endif // !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) +#endif // wxUSE_DISPLAY // ============================================================================ // wxDisplay::CreateFactory() @@ -378,21 +379,14 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) #ifndef __WXGTK20__ /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { - if ( !XineramaIsActive((Display*)wxGetDisplay()) ) - return new wxDisplayFactorySingleX11; +#if wxUSE_DISPLAY + if ( XineramaIsActive((Display*)wxGetDisplay()) ) + return new wxDisplayFactoryX11; +#endif // wxUSE_DISPLAY - return new wxDisplayFactoryX11; -} -#endif - -#else // !wxUSE_DISPLAY - -/* static */ wxDisplayFactory *wxDisplay::CreateFactory() -{ return new wxDisplayFactorySingleX11; } - -#endif // wxUSE_DISPLAY/!wxUSE_DISPLAY +#endif #if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) From 9cc1424b84ae464cdaa9c4f2b0bb18e41da71f00 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 16:37:12 +0200 Subject: [PATCH 072/231] Return empty string from wxDisplayImpl::GetName() by default Simplify the code by not making this function pure virtual as all the ports except MSW had to override it just to return an empty string. Instead, just return empty string by default as it's not critical to force the derived classes to override this function. --- include/wx/private/display.h | 4 +--- src/gtk/display.cpp | 6 ------ src/osx/core/display.cpp | 1 - src/qt/display.cpp | 7 ------- src/unix/displayx11.cpp | 2 -- 5 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/wx/private/display.h b/include/wx/private/display.h index d1346fc4eb..9f0dce0ad2 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -79,7 +79,7 @@ public: virtual wxRect GetClientArea() const { return GetGeometry(); } // return the name (may be empty) - virtual wxString GetName() const = 0; + virtual wxString GetName() const { return wxString(); } // return the index of this display unsigned GetIndex() const { return m_index; } @@ -125,8 +125,6 @@ class WXDLLEXPORT wxDisplayImplSingle : public wxDisplayImpl public: wxDisplayImplSingle() : wxDisplayImpl(0) { } - virtual wxString GetName() const wxOVERRIDE { return wxString(); } - #if wxUSE_DISPLAY // no video modes support for us, provide just the stubs virtual wxArrayVideoModes diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index eb68667724..dda71d6dcf 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -96,7 +96,6 @@ public: virtual wxRect GetClientArea() const wxOVERRIDE; #if wxUSE_DISPLAY - virtual wxString GetName() const wxOVERRIDE; virtual bool IsPrimary() const wxOVERRIDE; virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; @@ -206,11 +205,6 @@ wxRect wxDisplayImplGTK::GetClientArea() const } #if wxUSE_DISPLAY -wxString wxDisplayImplGTK::GetName() const -{ - return wxString(); -} - bool wxDisplayImplGTK::IsPrimary() const { #ifdef __WXGTK4__ diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index fedbfb7d10..3f35ccc1e4 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -73,7 +73,6 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; - virtual wxString GetName() const wxOVERRIDE { return wxString(); } virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; diff --git a/src/qt/display.cpp b/src/qt/display.cpp index abf339321c..52b6af8373 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -22,8 +22,6 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; - virtual wxString GetName() const wxOVERRIDE; - #if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; @@ -46,11 +44,6 @@ wxRect wxDisplayImplQt::GetClientArea() const return wxQtConvertRect( QApplication::desktop()->availableGeometry( GetIndex() )); } -wxString wxDisplayImplQt::GetName() const -{ - return wxString(); -} - #if wxUSE_DISPLAY wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const { diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 7c376bf83c..b1794b5127 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -132,8 +132,6 @@ public: return IsPrimary() ? wxGetMainScreenWorkArea() : m_rect; } - virtual wxString GetName() const wxOVERRIDE { return wxString(); } - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; From de840d1813c30b4c31f5ac5ea6ef619185c4c328 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 16:38:10 +0200 Subject: [PATCH 073/231] Document that wxDisplay::GetName() is only non-empty under MSW "Not available on all platforms" was an understatement: the string returned by this function is only non-empty under MSW. --- interface/wx/display.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/wx/display.h b/interface/wx/display.h index 1566d21df6..7e82ef1af1 100644 --- a/interface/wx/display.h +++ b/interface/wx/display.h @@ -102,7 +102,10 @@ public: wxArrayVideoModes GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; /** - Returns the display's name. A name is not available on all platforms. + Returns the display's name. + + The returned value is currently an empty string under all platforms + except MSW. */ wxString GetName() const; From c38a8f960edbc85245408e3b809c81182c97a91b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 16:39:40 +0200 Subject: [PATCH 074/231] Fix wxGTK build with wxUSE_DISPLAY==0 Add the missing "new" keyword. --- src/gtk/display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index dda71d6dcf..5f9c28c2d5 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -298,7 +298,7 @@ protected: wxDisplayFactory* wxDisplay::CreateFactory() { - return wxDisplayFactorySingleGTK; + return new wxDisplayFactorySingleGTK; } #endif // wxUSE_DISPLAY/!wxUSE_DISPLAY From e0ba727decea4e1519c69e87232bb42019d18b2a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 17:07:11 +0200 Subject: [PATCH 075/231] Extract X11 functions used by wxGTK in a separate header This makes src/unix/displayx11.cpp almost readable as it's not littered by "#ifndef __WXGTK20__" checks everywhere any more -- instead this file is just not compiled as part of wxGTK2 at all any longer (it is still included in wxGTK1 as well as wxX11 itself and wxMotif). wxGTK code also can just include the new wx/unix/private/displayx11.h instead of having to declare all the X11 functions it uses manually. There should be no changes in behaviour, this is just a clean up. --- Makefile.in | 248 +++++++++------------------ build/bakefiles/files.bkl | 4 +- build/cmake/files.cmake | 4 +- build/files | 4 +- include/wx/unix/private/displayx11.h | 177 +++++++++++++++++++ src/gtk/display.cpp | 27 ++- src/unix/displayx11.cpp | 185 +------------------- 7 files changed, 284 insertions(+), 365 deletions(-) create mode 100644 include/wx/unix/private/displayx11.h diff --git a/Makefile.in b/Makefile.in index 314c394af7..9ed6afed87 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4875,7 +4875,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -4915,7 +4914,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS = \ monodll_gtk1_toplevel.o \ monodll_gtk1_utilsgtk.o \ monodll_gtk1_win_gtk.o \ - monodll_gtk1_window.o + monodll_gtk1_window.o \ + monodll_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS = \ $(__GTK_PLATFORM_SRC_OBJECTS) \ @@ -5035,7 +5035,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -5050,7 +5049,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS = \ monodll_x11_palette.o \ monodll_x11_pen.o \ monodll_x11_region.o \ - monodll_utilsx.o + monodll_utilsx.o \ + monodll_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \ monodll_activex.o \ @@ -5128,7 +5128,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -5165,7 +5164,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS = \ monodll_x11_toplevel.o \ monodll_x11_utils.o \ monodll_utilsx.o \ - monodll_x11_window.o + monodll_x11_window.o \ + monodll_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS) COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS = \ monodll_generic_accel.o \ @@ -5779,7 +5779,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_1 = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -5819,7 +5818,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_1 = \ monodll_gtk1_toplevel.o \ monodll_gtk1_utilsgtk.o \ monodll_gtk1_win_gtk.o \ - monodll_gtk1_window.o + monodll_gtk1_window.o \ + monodll_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_1 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_1) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_1 = \ $(__GTK_PLATFORM_SRC_OBJECTS) \ @@ -5939,7 +5939,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -5954,7 +5953,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_x11_palette.o \ monodll_x11_pen.o \ monodll_x11_region.o \ - monodll_utilsx.o + monodll_utilsx.o \ + monodll_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_1 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_1) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_activex.o \ @@ -6032,7 +6032,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -6069,7 +6068,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_x11_toplevel.o \ monodll_x11_utils.o \ monodll_utilsx.o \ - monodll_x11_window.o + monodll_x11_window.o \ + monodll_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_1 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__UNIV_PLATFORM_SRC_OBJECTS \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monodll_animateg.o @@ -6852,7 +6852,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_2 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -6892,7 +6891,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_2 = \ monolib_gtk1_toplevel.o \ monolib_gtk1_utilsgtk.o \ monolib_gtk1_win_gtk.o \ - monolib_gtk1_window.o + monolib_gtk1_window.o \ + monolib_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_2 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_2) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_2 = \ $(__GTK_PLATFORM_SRC_OBJECTS_27) \ @@ -7012,7 +7012,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -7027,7 +7026,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_x11_palette.o \ monolib_x11_pen.o \ monolib_x11_region.o \ - monolib_utilsx.o + monolib_utilsx.o \ + monolib_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_2 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_2) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_activex.o \ @@ -7105,7 +7105,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -7142,7 +7141,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_x11_toplevel.o \ monolib_x11_utils.o \ monolib_utilsx.o \ - monolib_x11_window.o + monolib_x11_window.o \ + monolib_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_2 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_2) COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_1 = \ monolib_generic_accel.o \ @@ -7756,7 +7756,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_3 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -7796,7 +7795,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_3 = \ monolib_gtk1_toplevel.o \ monolib_gtk1_utilsgtk.o \ monolib_gtk1_win_gtk.o \ - monolib_gtk1_window.o + monolib_gtk1_window.o \ + monolib_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_3 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_3) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_3 = \ $(__GTK_PLATFORM_SRC_OBJECTS_27) \ @@ -7916,7 +7916,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -7931,7 +7930,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_x11_palette.o \ monolib_x11_pen.o \ monolib_x11_region.o \ - monolib_utilsx.o + monolib_utilsx.o \ + monolib_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_3 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_3) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_activex.o \ @@ -8009,7 +8009,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -8046,7 +8045,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_x11_toplevel.o \ monolib_x11_utils.o \ monolib_utilsx.o \ - monolib_x11_window.o + monolib_x11_window.o \ + monolib_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_3 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__UNIV_PLATFORM_SRC_OBJECTS_1 \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = monolib_animateg.o @@ -8976,7 +8976,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_4 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -9016,7 +9015,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_4 = \ coredll_gtk1_toplevel.o \ coredll_gtk1_utilsgtk.o \ coredll_gtk1_win_gtk.o \ - coredll_gtk1_window.o + coredll_gtk1_window.o \ + coredll_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_4 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_4) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_4 = \ $(__GTK_PLATFORM_SRC_OBJECTS_1_4) \ @@ -9136,7 +9136,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -9151,7 +9150,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_x11_palette.o \ coredll_x11_pen.o \ coredll_x11_region.o \ - coredll_utilsx.o + coredll_utilsx.o \ + coredll_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_4 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_4) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_activex.o \ @@ -9229,7 +9229,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -9266,7 +9265,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_x11_toplevel.o \ coredll_x11_utils.o \ coredll_utilsx.o \ - coredll_x11_window.o + coredll_x11_window.o \ + coredll_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_4 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_4) COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_2 = \ coredll_generic_accel.o \ @@ -9880,7 +9880,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_5 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -9920,7 +9919,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_5 = \ coredll_gtk1_toplevel.o \ coredll_gtk1_utilsgtk.o \ coredll_gtk1_win_gtk.o \ - coredll_gtk1_window.o + coredll_gtk1_window.o \ + coredll_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_5 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_5) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_5 = \ $(__GTK_PLATFORM_SRC_OBJECTS_1_4) \ @@ -10040,7 +10040,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -10055,7 +10054,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_x11_palette.o \ coredll_x11_pen.o \ coredll_x11_region.o \ - coredll_utilsx.o + coredll_utilsx.o \ + coredll_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_5 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_5) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_activex.o \ @@ -10133,7 +10133,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -10170,7 +10169,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_x11_toplevel.o \ coredll_x11_utils.o \ coredll_utilsx.o \ - coredll_x11_window.o + coredll_x11_window.o \ + coredll_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_5 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_5) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__UNIV_PLATFORM_SRC_OBJECTS_2 \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = coredll_animateg.o @@ -10695,7 +10695,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_6 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -10735,7 +10734,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_6 = \ corelib_gtk1_toplevel.o \ corelib_gtk1_utilsgtk.o \ corelib_gtk1_win_gtk.o \ - corelib_gtk1_window.o + corelib_gtk1_window.o \ + corelib_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_6 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_6) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_6 = \ $(__GTK_PLATFORM_SRC_OBJECTS_2_2) \ @@ -10855,7 +10855,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -10870,7 +10869,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_x11_palette.o \ corelib_x11_pen.o \ corelib_x11_region.o \ - corelib_utilsx.o + corelib_utilsx.o \ + corelib_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_6 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_6) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_activex.o \ @@ -10948,7 +10948,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -10985,7 +10984,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_x11_toplevel.o \ corelib_x11_utils.o \ corelib_utilsx.o \ - corelib_x11_window.o + corelib_x11_window.o \ + corelib_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_6 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_6) COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_3 = \ corelib_generic_accel.o \ @@ -11599,7 +11599,6 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_7 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -11639,7 +11638,8 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_7 = \ corelib_gtk1_toplevel.o \ corelib_gtk1_utilsgtk.o \ corelib_gtk1_win_gtk.o \ - corelib_gtk1_window.o + corelib_gtk1_window.o \ + corelib_displayx11.o @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__LOWLEVEL_SRC_OBJECTS_7 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____LOWLEVEL_SRC_OBJECTS_7) COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_7 = \ $(__GTK_PLATFORM_SRC_OBJECTS_2_2) \ @@ -11759,7 +11759,6 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -11774,7 +11773,8 @@ COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_x11_palette.o \ corelib_x11_pen.o \ corelib_x11_region.o \ - corelib_utilsx.o + corelib_utilsx.o \ + corelib_displayx11.o @COND_TOOLKIT_MOTIF@__LOWLEVEL_SRC_OBJECTS_7 = $(COND_TOOLKIT_MOTIF___LOWLEVEL_SRC_OBJECTS_7) COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_activex.o \ @@ -11852,7 +11852,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -11889,7 +11888,8 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_x11_toplevel.o \ corelib_x11_utils.o \ corelib_utilsx.o \ - corelib_x11_window.o + corelib_x11_window.o \ + corelib_displayx11.o @COND_TOOLKIT_X11@__LOWLEVEL_SRC_OBJECTS_7 = $(COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_7) @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__UNIV_PLATFORM_SRC_OBJECTS_3 \ @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@ = corelib_animateg.o @@ -13185,7 +13185,6 @@ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -13199,7 +13198,6 @@ COND_PLATFORM_UNIX_1___GTK_PLATFORM_SRC_OBJECTS = \ monodll_generic_caret.o \ monodll_generic_imaglist.o \ monodll_unix_dialup.o \ - monodll_displayx11.o \ monodll_unix_fontenum.o \ monodll_unix_fontutil.o \ monodll_uiactionx11.o \ @@ -13328,7 +13326,6 @@ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -13342,7 +13339,6 @@ COND_PLATFORM_UNIX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \ monolib_generic_caret.o \ monolib_generic_imaglist.o \ monolib_unix_dialup.o \ - monolib_displayx11.o \ monolib_unix_fontenum.o \ monolib_unix_fontutil.o \ monolib_uiactionx11.o \ @@ -13471,7 +13467,6 @@ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -13485,7 +13480,6 @@ COND_PLATFORM_UNIX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \ coredll_generic_caret.o \ coredll_generic_imaglist.o \ coredll_unix_dialup.o \ - coredll_displayx11.o \ coredll_unix_fontenum.o \ coredll_unix_fontutil.o \ coredll_uiactionx11.o \ @@ -13611,7 +13605,6 @@ COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -13625,7 +13618,6 @@ COND_PLATFORM_UNIX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \ corelib_generic_caret.o \ corelib_generic_imaglist.o \ corelib_unix_dialup.o \ - corelib_displayx11.o \ corelib_unix_fontenum.o \ corelib_unix_fontutil.o \ corelib_uiactionx11.o \ @@ -17631,33 +17623,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@monodll_unix_dialup.o: $(srcdir)/src/unix/dialup.cpp $(MONODLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/dialup.cpp -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_MOTIF_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_X11_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monodll_unix_fontenum.o: $(srcdir)/src/unix/fontenum.cpp $(MONODLL_ODEP) @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/fontenum.cpp @@ -18513,6 +18478,15 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monodll_gtk1_window.o: $(srcdir)/src/gtk1/window.cpp $(MONODLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/window.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_MOTIF_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_X11_USE_GUI_1@monodll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONODLL_ODEP) +@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + @COND_TOOLKIT_MOTIF_USE_GUI_1@monodll_x11_bitmap.o: $(srcdir)/src/x11/bitmap.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/x11/bitmap.cpp @@ -22902,33 +22876,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@monolib_unix_dialup.o: $(srcdir)/src/unix/dialup.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/dialup.cpp -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_MOTIF_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_X11_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@monolib_unix_fontenum.o: $(srcdir)/src/unix/fontenum.cpp $(MONOLIB_ODEP) @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/fontenum.cpp @@ -23784,6 +23731,15 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monolib_gtk1_window.o: $(srcdir)/src/gtk1/window.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/window.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_MOTIF_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_X11_USE_GUI_1@monolib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(MONOLIB_ODEP) +@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + @COND_TOOLKIT_MOTIF_USE_GUI_1@monolib_x11_bitmap.o: $(srcdir)/src/x11/bitmap.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/x11/bitmap.cpp @@ -28266,33 +28222,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@coredll_unix_dialup.o: $(srcdir)/src/unix/dialup.cpp $(COREDLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/dialup.cpp -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_MOTIF_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_X11_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@coredll_unix_fontenum.o: $(srcdir)/src/unix/fontenum.cpp $(COREDLL_ODEP) @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/fontenum.cpp @@ -29148,6 +29077,15 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@coredll_gtk1_window.o: $(srcdir)/src/gtk1/window.cpp $(COREDLL_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/window.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_MOTIF_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_X11_USE_GUI_1@coredll_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(COREDLL_ODEP) +@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + @COND_TOOLKIT_MOTIF_USE_GUI_1@coredll_x11_bitmap.o: $(srcdir)/src/x11/bitmap.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/x11/bitmap.cpp @@ -32532,33 +32470,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@corelib_unix_dialup.o: $(srcdir)/src/unix/dialup.cpp $(CORELIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/dialup.cpp -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_MOTIF_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - -@COND_TOOLKIT_X11_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp - @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@corelib_unix_fontenum.o: $(srcdir)/src/unix/fontenum.cpp $(CORELIB_ODEP) @COND_PLATFORM_UNIX_1_TOOLKIT_GTK_TOOLKIT_VERSION_4_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/fontenum.cpp @@ -33414,6 +33325,15 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@corelib_gtk1_window.o: $(srcdir)/src/gtk1/window.cpp $(CORELIB_ODEP) @COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/window.cpp +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_GTK_TOOLKIT_VERSION__USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_MOTIF_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + +@COND_TOOLKIT_X11_USE_GUI_1@corelib_displayx11.o: $(srcdir)/src/unix/displayx11.cpp $(CORELIB_ODEP) +@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/unix/displayx11.cpp + @COND_TOOLKIT_MOTIF_USE_GUI_1@corelib_x11_bitmap.o: $(srcdir)/src/x11/bitmap.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MOTIF_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/x11/bitmap.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index b4834f11f5..328e0c3b68 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1311,7 +1311,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/caret.cpp src/generic/imaglist.cpp src/unix/dialup.cpp - src/unix/displayx11.cpp src/unix/fontenum.cpp src/unix/fontutil.cpp src/unix/uiactionx11.cpp @@ -1629,6 +1628,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/gtk1/utilsgtk.cpp src/gtk1/win_gtk.c src/gtk1/window.cpp + src/unix/displayx11.cpp
$(XWIN_LOWLEVEL_HDR) @@ -1774,6 +1774,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/x11/pen.cpp src/x11/region.cpp src/x11/utilsx.cpp + src/unix/displayx11.cpp $(XWIN_LOWLEVEL_HDR) @@ -1965,6 +1966,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/x11/utils.cpp src/x11/utilsx.cpp src/x11/window.cpp + src/unix/displayx11.cpp $(XWIN_LOWLEVEL_HDR) diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 75d55340a6..f8c6c12d39 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -1206,7 +1206,6 @@ set(XWIN_LOWLEVEL_SRC src/generic/caret.cpp src/generic/imaglist.cpp src/unix/dialup.cpp - src/unix/displayx11.cpp src/unix/fontenum.cpp src/unix/fontutil.cpp src/unix/uiactionx11.cpp @@ -1513,6 +1512,7 @@ set(GTK1_LOWLEVEL_SRC src/gtk1/utilsgtk.cpp src/gtk1/win_gtk.c src/gtk1/window.cpp + src/unix/displayx11.cpp ) set(GTK1_LOWLEVEL_HDR @@ -1656,6 +1656,7 @@ set(MOTIF_LOWLEVEL_SRC src/x11/pen.cpp src/x11/region.cpp src/x11/utilsx.cpp + src/unix/displayx11.cpp ) set(MOTIF_LOWLEVEL_HDR @@ -1844,6 +1845,7 @@ set(X11_LOWLEVEL_SRC src/x11/utils.cpp src/x11/utilsx.cpp src/x11/window.cpp + src/unix/displayx11.cpp ) set(X11_LOWLEVEL_HDR diff --git a/build/files b/build/files index 77280b9913..03bf2cbcea 100644 --- a/build/files +++ b/build/files @@ -1221,7 +1221,6 @@ XWIN_LOWLEVEL_SRC = src/generic/caret.cpp src/generic/imaglist.cpp src/unix/dialup.cpp - src/unix/displayx11.cpp src/unix/fontenum.cpp src/unix/fontutil.cpp src/unix/joystick.cpp @@ -1486,6 +1485,7 @@ GTK2_HDR = GTK1_LOWLEVEL_SRC = $(XWIN_LOWLEVEL_SRC) + src/unix/displayx11.cpp src/generic/icon.cpp src/generic/paletteg.cpp src/generic/textmeasure.cpp @@ -1651,6 +1651,7 @@ GTK1_HDR = MOTIF_LOWLEVEL_SRC = $(XWIN_LOWLEVEL_SRC) + src/unix/displayx11.cpp src/generic/textmeasure.cpp src/x11/bitmap.cpp src/x11/brush.cpp @@ -1814,6 +1815,7 @@ MOTIF_HDR = X11_LOWLEVEL_SRC = $(XWIN_LOWLEVEL_SRC) + src/unix/displayx11.cpp src/generic/icon.cpp src/generic/textmeasure.cpp src/generic/timer.cpp diff --git a/include/wx/unix/private/displayx11.h b/include/wx/unix/private/displayx11.h new file mode 100644 index 0000000000..ea993ca249 --- /dev/null +++ b/include/wx/unix/private/displayx11.h @@ -0,0 +1,177 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/unix/private/displayx11.h +// Purpose: Helper functions used by wxX11 and wxGTK ports +// Author: Vadim Zeitlin +// Created: 2018-10-04 (extracted from src/unix/displayx11.cpp) +// Copyright: (c) 2002-2018 wxWindows team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIX_PRIVATE_DISPLAYX11_H_ +#define _WX_UNIX_PRIVATE_DISPLAYX11_H_ + +#include "wx/log.h" +#include "wx/translation.h" + +#include +#include + +#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H + +#include + +// +// See (http://www.xfree86.org/4.2.0/XF86VidModeDeleteModeLine.3.html) for more +// info about xf86 video mode extensions +// + +//free private data common to x (usually s3) servers +#define wxClearXVM(vm) if(vm.privsize) XFree(vm.c_private) + +// 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, 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 wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* display, int nScreen) +{ + XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) + int nNumModes; //Number of modes enumerated.... + + wxArrayVideoModes Modes; //modes to return... + + if (XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) + { + for (int i = 0; i < nNumModes; ++i) + { + XF86VidModeModeInfo& info = *ppXModes[i]; + const wxVideoMode vm = wxCVM(info, display, nScreen); + if (vm.Matches(mode)) + { + Modes.Add(vm); + } + wxClearXVM(info); + // XFree(ppXModes[i]); //supposed to free? + } + XFree(ppXModes); + } + else //OOPS! + { + wxLogSysError(_("Failed to enumerate video modes")); + } + + return Modes; +} + +wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen) +{ + XF86VidModeModeLine VM; + int nDotClock; + if ( !XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM) ) + return wxVideoMode(); + + wxClearXVM(VM); + return wxCVM2(VM, nDotClock, display, nScreen); +} + +bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen) +{ + XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) + int nNumModes; //Number of modes enumerated.... + + if(!XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) + { + wxLogSysError(_("Failed to change video mode")); + return false; + } + + bool bRet = false; + if (mode == wxDefaultVideoMode) + { + bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[0]) != 0; + + for (int i = 0; i < nNumModes; ++i) + { + wxClearXVM((*ppXModes[i])); + // XFree(ppXModes[i]); //supposed to free? + } + } + else + { + for (int i = 0; i < nNumModes; ++i) + { + if (!bRet && + ppXModes[i]->hdisplay == mode.GetWidth() && + ppXModes[i]->vdisplay == mode.GetHeight() && + wxCRR((*ppXModes[i])) == mode.GetRefresh()) + { + //switch! + bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[i]) != 0; + } + wxClearXVM((*ppXModes[i])); + // XFree(ppXModes[i]); //supposed to free? + } + } + + XFree(ppXModes); + + return bRet; +} + +#else // !HAVE_X11_EXTENSIONS_XF86VMODE_H + +wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display) +{ + int count_return; + int* depths = XListDepths(display, 0, &count_return); + wxArrayVideoModes modes; + if ( depths ) + { + const wxRect rect = impl->GetGeometry(); + for ( int x = 0; x < count_return; ++x ) + { + wxVideoMode mode(rect.width, rect.height, depths[x]); + if ( mode.Matches(modeMatch) ) + { + modes.Add(mode); + } + } + + XFree(depths); + } + return modes; +} + +#endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H + +void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) +{ + Display* display = DisplayOfScreen(screen); + Atom property = XInternAtom(display, "_NET_WORKAREA", true); + if (property) + { + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char* data = NULL; + Status status = XGetWindowProperty( + display, RootWindowOfScreen(screen), property, + 0, 4, false, XA_CARDINAL, + &actual_type, &actual_format, &nitems, &bytes_after, &data); + if (status == Success && actual_type == XA_CARDINAL && + actual_format == 32 && nitems == 4) + { + const long* p = (long*)data; + x = p[0]; + y = p[1]; + width = p[2]; + height = p[3]; + } + if (data) + XFree(data); + } +} + +#endif // _WX_UNIX_PRIVATE_DISPLAYX11_H_ diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index 5f9c28c2d5..b9eedf910b 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -12,6 +12,12 @@ #include "wx/gtk/private/wrapgtk.h" #ifdef GDK_WINDOWING_X11 + #ifndef __WXGTK4__ + #include "wx/unix/private/displayx11.h" + + #define wxGTK_HAVE_X11_DISPLAY + #endif + #include #endif @@ -23,10 +29,6 @@ GdkWindow* wxGetTopLevelGDK(); #ifndef __WXGTK4__ -#ifdef GDK_WINDOWING_X11 -void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height); -#endif - #ifndef __WXGTK3__ static inline int wx_gdk_screen_get_primary_monitor(GdkScreen* screen) { @@ -51,7 +53,7 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* #endif { gdk_screen_get_monitor_geometry(screen, monitor, dest); -#ifdef GDK_WINDOWING_X11 +#ifdef wxGTK_HAVE_X11_DISPLAY #ifdef __WXGTK3__ if (GDK_IS_X11_SCREEN(screen)) #endif @@ -63,7 +65,7 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* if (rect.width && rect.height) gdk_rectangle_intersect(dest, &rect, dest); } -#endif // GDK_WINDOWING_X11 +#endif // wxGTK_HAVE_X11_DISPLAY } wxGCC_WARNING_RESTORE() } @@ -216,17 +218,10 @@ bool wxDisplayImplGTK::IsPrimary() const #endif } -#if defined(GDK_WINDOWING_X11) && !defined(__WXGTK4__) -wxArrayVideoModes wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* pDisplay, int nScreen); -wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen); -bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen); -wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display); -#endif - wxArrayVideoModes wxDisplayImplGTK::GetModes(const wxVideoMode& mode) const { wxArrayVideoModes modes; -#if defined(GDK_WINDOWING_X11) && !defined(__WXGTK4__) +#ifdef wxGTK_HAVE_X11_DISPLAY #ifdef __WXGTK3__ if (GDK_IS_X11_SCREEN(m_screen)) #endif @@ -248,7 +243,7 @@ wxArrayVideoModes wxDisplayImplGTK::GetModes(const wxVideoMode& mode) const wxVideoMode wxDisplayImplGTK::GetCurrentMode() const { wxVideoMode mode; -#if defined(GDK_WINDOWING_X11) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) && !defined(__WXGTK4__) +#if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) #ifdef __WXGTK3__ if (GDK_IS_X11_SCREEN(m_screen)) #endif @@ -264,7 +259,7 @@ wxVideoMode wxDisplayImplGTK::GetCurrentMode() const bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& mode) { bool success = false; -#if defined(GDK_WINDOWING_X11) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) && !defined(__WXGTK4__) +#if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) #ifdef __WXGTK3__ if (GDK_IS_X11_SCREEN(m_screen)) #endif diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index b1794b5127..4e317ca6a0 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -29,17 +29,8 @@ #include "wx/log.h" #endif /* WX_PRECOMP */ -#ifdef __WXGTK20__ - #include // GDK_WINDOWING_X11 -#endif -#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) - #include - #include -#endif - #include "wx/private/display.h" - -#ifndef __WXGTK20__ +#include "wx/unix/private/displayx11.h" static wxRect wxGetMainScreenWorkArea(); @@ -70,12 +61,8 @@ protected: } }; -#endif // !__WXGTK20__ - #if wxUSE_DISPLAY -#ifndef __WXGTK20__ - #include typedef XineramaScreenInfo ScreenInfo; @@ -189,118 +176,13 @@ wxDisplayImpl *wxDisplayFactoryX11::CreateDisplay(unsigned n) return n < screens.GetCount() ? new wxDisplayImplX11(n, screens[n]) : NULL; } -#endif // !__WXGTK20__ // ============================================================================ // wxDisplayImplX11 implementation // ============================================================================ -#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) - #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H -#include - -// -// See (http://www.xfree86.org/4.2.0/XF86VidModeDeleteModeLine.3.html) for more -// info about xf86 video mode extensions -// - -//free private data common to x (usually s3) servers -#define wxClearXVM(vm) if(vm.privsize) XFree(vm.c_private) - -// 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, 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 wxXF86VidMode_GetModes(const wxVideoMode& mode, Display* display, int nScreen) -{ - XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) - int nNumModes; //Number of modes enumerated.... - - wxArrayVideoModes Modes; //modes to return... - - if (XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) - { - for (int i = 0; i < nNumModes; ++i) - { - XF86VidModeModeInfo& info = *ppXModes[i]; - const wxVideoMode vm = wxCVM(info, display, nScreen); - if (vm.Matches(mode)) - { - Modes.Add(vm); - } - wxClearXVM(info); - // XFree(ppXModes[i]); //supposed to free? - } - XFree(ppXModes); - } - else //OOPS! - { - wxLogSysError(_("Failed to enumerate video modes")); - } - - return Modes; -} - -wxVideoMode wxXF86VidMode_GetCurrentMode(Display* display, int nScreen) -{ - XF86VidModeModeLine VM; - int nDotClock; - if ( !XF86VidModeGetModeLine(display, nScreen, &nDotClock, &VM) ) - return wxVideoMode(); - - wxClearXVM(VM); - return wxCVM2(VM, nDotClock, display, nScreen); -} - -bool wxXF86VidMode_ChangeMode(const wxVideoMode& mode, Display* display, int nScreen) -{ - XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :)) - int nNumModes; //Number of modes enumerated.... - - if(!XF86VidModeGetAllModeLines(display, nScreen, &nNumModes, &ppXModes)) - { - wxLogSysError(_("Failed to change video mode")); - return false; - } - - bool bRet = false; - if (mode == wxDefaultVideoMode) - { - bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[0]) != 0; - - for (int i = 0; i < nNumModes; ++i) - { - wxClearXVM((*ppXModes[i])); - // XFree(ppXModes[i]); //supposed to free? - } - } - else - { - for (int i = 0; i < nNumModes; ++i) - { - if (!bRet && - ppXModes[i]->hdisplay == mode.GetWidth() && - ppXModes[i]->vdisplay == mode.GetHeight() && - wxCRR((*ppXModes[i])) == mode.GetRefresh()) - { - //switch! - bRet = XF86VidModeSwitchToMode(display, nScreen, ppXModes[i]) != 0; - } - wxClearXVM((*ppXModes[i])); - // XFree(ppXModes[i]); //supposed to free? - } - } - - XFree(ppXModes); - - return bRet; -} - -#ifndef __WXGTK20__ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const { Display* display = static_cast(wxGetDisplay()); @@ -321,33 +203,9 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& mode) int nScreen = DefaultScreen(display); return wxXF86VidMode_ChangeMode(mode, display, nScreen); } -#endif // !__WXGTK20__ #else // !HAVE_X11_EXTENSIONS_XF86VMODE_H -wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& modeMatch, Display* display) -{ - int count_return; - int* depths = XListDepths(display, 0, &count_return); - wxArrayVideoModes modes; - if ( depths ) - { - const wxRect rect = impl->GetGeometry(); - for ( int x = 0; x < count_return; ++x ) - { - wxVideoMode mode(rect.width, rect.height, depths[x]); - if ( mode.Matches(modeMatch) ) - { - modes.Add(mode); - } - } - - XFree(depths); - } - return modes; -} - -#ifndef __WXGTK20__ wxArrayVideoModes wxDisplayImplX11::GetModes(const wxVideoMode& modeMatch) const { Display* display = static_cast(wxGetDisplay()); @@ -365,16 +223,15 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) // Not implemented return false; } -#endif // !__WXGTK20__ + #endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H -#endif // !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) + #endif // wxUSE_DISPLAY // ============================================================================ // wxDisplay::CreateFactory() // ============================================================================ -#ifndef __WXGTK20__ /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { #if wxUSE_DISPLAY @@ -384,40 +241,6 @@ bool wxDisplayImplX11::ChangeMode(const wxVideoMode& WXUNUSED(mode)) return new wxDisplayFactorySingleX11; } -#endif - -#if !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) -void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) -{ - Display* display = DisplayOfScreen(screen); - Atom property = XInternAtom(display, "_NET_WORKAREA", true); - if (property) - { - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char* data = NULL; - Status status = XGetWindowProperty( - display, RootWindowOfScreen(screen), property, - 0, 4, false, XA_CARDINAL, - &actual_type, &actual_format, &nitems, &bytes_after, &data); - if (status == Success && actual_type == XA_CARDINAL && - actual_format == 32 && nitems == 4) - { - const long* p = (long*)data; - x = p[0]; - y = p[1]; - width = p[2]; - height = p[3]; - } - if (data) - XFree(data); - } -} -#endif // !defined(__WXGTK20__) || defined(GDK_WINDOWING_X11) - -#ifndef __WXGTK20__ wxRect wxGetMainScreenWorkArea() { @@ -447,5 +270,3 @@ wxRect wxGetMainScreenWorkArea() return rect; } - -#endif // !__WXGTK20__ From 5e6e7aa7698b0b64dda557d51fe83f06bab07263 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 23:01:27 +0200 Subject: [PATCH 076/231] Separate GTK+ 4 wxDisplay implementation from previous versions This makes the code more readable, even though it almost doubles its size -- but the corresponding reduction in the number of preprocessor checks is still worth it. --- src/gtk/display.cpp | 284 ++++++++++++++++++++++++++------------------ 1 file changed, 171 insertions(+), 113 deletions(-) diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index b9eedf910b..a9ddf52d83 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -21,71 +21,20 @@ #include #endif +// This file is not used at all when using Win32. #if !defined(GDK_WINDOWING_WIN32) GdkWindow* wxGetTopLevelGDK(); -//----------------------------------------------------------------------------- - -#ifndef __WXGTK4__ - -#ifndef __WXGTK3__ -static inline int wx_gdk_screen_get_primary_monitor(GdkScreen* screen) -{ - int monitor = 0; -#if GTK_CHECK_VERSION(2,20,0) - if (wx_is_at_least_gtk2(20)) - monitor = gdk_screen_get_primary_monitor(screen); -#endif - return monitor; -} -#define gdk_screen_get_primary_monitor wx_gdk_screen_get_primary_monitor -#endif // !__WXGTK3__ - -static inline void -wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* dest) -{ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) -#if GTK_CHECK_VERSION(3,4,0) - if (gtk_check_version(3,4,0) == NULL) - gdk_screen_get_monitor_workarea(screen, monitor, dest); - else -#endif - { - gdk_screen_get_monitor_geometry(screen, monitor, dest); -#ifdef wxGTK_HAVE_X11_DISPLAY -#ifdef __WXGTK3__ - if (GDK_IS_X11_SCREEN(screen)) -#endif - { - GdkRectangle rect = { 0, 0, 0, 0 }; - wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen), - rect.x, rect.y, rect.width, rect.height); - // in case _NET_WORKAREA result is too large - if (rect.width && rect.height) - gdk_rectangle_intersect(dest, &rect, dest); - } -#endif // wxGTK_HAVE_X11_DISPLAY - } - wxGCC_WARNING_RESTORE() -} -#define gdk_screen_get_monitor_workarea wx_gdk_screen_get_monitor_workarea - -#endif // !__WXGTK4__ +// There are 2 quite different implementations here: one for GTK+ 4 and the +// other one for the previous versions. #ifdef __WXGTK4__ + static inline GdkDisplay* GetDisplay() { return gdk_window_get_display(wxGetTopLevelGDK()); } -#else -static inline GdkScreen* GetScreen() -{ - return gdk_window_get_screen(wxGetTopLevelGDK()); -} -#endif - -//----------------------------------------------------------------------------- // This class is always defined as it's used for the main display even when // wxUSE_DISPLAY == 0. @@ -104,15 +53,9 @@ public: virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; #endif // wxUSE_DISPLAY -#ifdef __WXGTK4__ GdkMonitor* const m_monitor; -#else - GdkScreen* const m_screen; -#endif }; -//----------------------------------------------------------------------------- - // This class is only defined when we're built with full display support. #if wxUSE_DISPLAY class wxDisplayFactoryGTK: public wxDisplayFactory @@ -130,20 +73,13 @@ wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n) unsigned wxDisplayFactoryGTK::GetCount() { -#ifdef __WXGTK4__ - return gdk_display_get_n_monitors(GetDisplay()); -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return gdk_screen_get_n_monitors(GetScreen()); - wxGCC_WARNING_RESTORE() -#endif + return gdk_display_get_n_monitors(::GetDisplay()); } int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) { GdkRectangle rect; -#ifdef __WXGTK4__ - GdkDisplay* display = GetDisplay(); + GdkDisplay* display = ::GetDisplay(); GdkMonitor* monitor = gdk_display_get_monitor_at_point(display, pt.x, pt.y); gdk_monitor_get_geometry(monitor, &rect); if (wxRect(rect.x, rect.y, rect.width, rect.height).Contains(pt)) @@ -155,76 +91,195 @@ int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) } } return wxNOT_FOUND; -#else - GdkScreen* screen = GetScreen(); - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - int monitor = gdk_screen_get_monitor_at_point(screen, pt.x, pt.y); - gdk_screen_get_monitor_geometry(screen, monitor, &rect); - wxGCC_WARNING_RESTORE() - if (!wxRect(rect.x, rect.y, rect.width, rect.height).Contains(pt)) - monitor = wxNOT_FOUND; - return monitor; -#endif } #endif // wxUSE_DISPLAY -//----------------------------------------------------------------------------- - wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) : base_type(i) -#ifdef __WXGTK4__ , m_monitor(gdk_display_get_monitor(GetDisplay(), i)) -#else - , m_screen(GetScreen()) -#endif { } wxRect wxDisplayImplGTK::GetGeometry() const { GdkRectangle rect; -#ifdef __WXGTK4__ gdk_monitor_get_geometry(m_monitor, &rect); -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - gdk_screen_get_monitor_geometry(m_screen, m_index, &rect); - wxGCC_WARNING_RESTORE() -#endif return wxRect(rect.x, rect.y, rect.width, rect.height); } wxRect wxDisplayImplGTK::GetClientArea() const { GdkRectangle rect; -#ifdef __WXGTK4__ gdk_monitor_get_workarea(m_monitor, &rect); -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - gdk_screen_get_monitor_workarea(m_screen, m_index, &rect); - wxGCC_WARNING_RESTORE() -#endif return wxRect(rect.x, rect.y, rect.width, rect.height); } #if wxUSE_DISPLAY bool wxDisplayImplGTK::IsPrimary() const { -#ifdef __WXGTK4__ return gdk_monitor_is_primary(m_monitor) != 0; -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return gdk_screen_get_primary_monitor(m_screen) == int(m_index); - wxGCC_WARNING_RESTORE() +} + +wxArrayVideoModes +wxDisplayImplGTK::GetModes(const wxVideoMode& WXUNUSED(mode)) const +{ + return wxArrayVideoModes(); +} + +wxVideoMode wxDisplayImplGTK::GetCurrentMode() const +{ + return wxVideoMode(); +} + +bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& WXUNUSED(mode)) +{ + return false; +} +#endif // wxUSE_DISPLAY + +#else // !__WXGTK4__ + +#ifdef __WXGTK3__ + +static inline bool gdk_is_x11_screen(GdkScreen* screen) +{ + return GDK_IS_X11_SCREEN(screen); +} + +#else // !__WXGTK3__ + +static inline int wx_gdk_screen_get_primary_monitor(GdkScreen* screen) +{ + int monitor = 0; +#if GTK_CHECK_VERSION(2,20,0) + if (wx_is_at_least_gtk2(20)) + monitor = gdk_screen_get_primary_monitor(screen); #endif + return monitor; +} +#define gdk_screen_get_primary_monitor wx_gdk_screen_get_primary_monitor + +static inline bool gdk_is_x11_screen(GdkScreen* WXUNUSED(screen)) +{ + return true; +} + +#endif // __WXGTK3__/!__WXGTK3__ + +static inline void +wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* dest) +{ + wxGCC_WARNING_SUPPRESS(deprecated-declarations) +#if GTK_CHECK_VERSION(3,4,0) + if (gtk_check_version(3,4,0) == NULL) + gdk_screen_get_monitor_workarea(screen, monitor, dest); + else +#endif + { + gdk_screen_get_monitor_geometry(screen, monitor, dest); +#ifdef wxGTK_HAVE_X11_DISPLAY + if ( gdk_is_x11_screen(screen) ) + { + GdkRectangle rect = { 0, 0, 0, 0 }; + wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen), + rect.x, rect.y, rect.width, rect.height); + // in case _NET_WORKAREA result is too large + if (rect.width && rect.height) + gdk_rectangle_intersect(dest, &rect, dest); + } +#endif // wxGTK_HAVE_X11_DISPLAY + } + wxGCC_WARNING_RESTORE() +} +#define gdk_screen_get_monitor_workarea wx_gdk_screen_get_monitor_workarea + +static inline GdkScreen* GetScreen() +{ + return gdk_window_get_screen(wxGetTopLevelGDK()); +} + +class wxDisplayImplGTK : public wxDisplayImpl +{ + typedef wxDisplayImpl base_type; +public: + wxDisplayImplGTK(unsigned i); + virtual wxRect GetGeometry() const wxOVERRIDE; + virtual wxRect GetClientArea() const wxOVERRIDE; + +#if wxUSE_DISPLAY + virtual bool IsPrimary() const wxOVERRIDE; + virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; + virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; + virtual bool ChangeMode(const wxVideoMode& mode) wxOVERRIDE; +#endif // wxUSE_DISPLAY + + GdkScreen* const m_screen; +}; + +#if wxUSE_DISPLAY +class wxDisplayFactoryGTK: public wxDisplayFactory +{ +public: + virtual wxDisplayImpl* CreateDisplay(unsigned n) wxOVERRIDE; + virtual unsigned GetCount() wxOVERRIDE; + virtual int GetFromPoint(const wxPoint& pt) wxOVERRIDE; +}; + +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + +wxDisplayImpl* wxDisplayFactoryGTK::CreateDisplay(unsigned n) +{ + return new wxDisplayImplGTK(n); +} + +unsigned wxDisplayFactoryGTK::GetCount() +{ + return gdk_screen_get_n_monitors(GetScreen()); +} + +int wxDisplayFactoryGTK::GetFromPoint(const wxPoint& pt) +{ + GdkRectangle rect; + GdkScreen* screen = GetScreen(); + int monitor = gdk_screen_get_monitor_at_point(screen, pt.x, pt.y); + gdk_screen_get_monitor_geometry(screen, monitor, &rect); + if (!wxRect(rect.x, rect.y, rect.width, rect.height).Contains(pt)) + monitor = wxNOT_FOUND; + return monitor; +} +#endif // wxUSE_DISPLAY + +wxDisplayImplGTK::wxDisplayImplGTK(unsigned i) + : base_type(i) + , m_screen(GetScreen()) +{ +} + +wxRect wxDisplayImplGTK::GetGeometry() const +{ + GdkRectangle rect; + gdk_screen_get_monitor_geometry(m_screen, m_index, &rect); + return wxRect(rect.x, rect.y, rect.width, rect.height); +} + +wxRect wxDisplayImplGTK::GetClientArea() const +{ + GdkRectangle rect; + gdk_screen_get_monitor_workarea(m_screen, m_index, &rect); + return wxRect(rect.x, rect.y, rect.width, rect.height); +} + +#if wxUSE_DISPLAY +bool wxDisplayImplGTK::IsPrimary() const +{ + return gdk_screen_get_primary_monitor(m_screen) == int(m_index); } wxArrayVideoModes wxDisplayImplGTK::GetModes(const wxVideoMode& mode) const { wxArrayVideoModes modes; #ifdef wxGTK_HAVE_X11_DISPLAY -#ifdef __WXGTK3__ - if (GDK_IS_X11_SCREEN(m_screen)) -#endif + if ( gdk_is_x11_screen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H @@ -244,9 +299,7 @@ wxVideoMode wxDisplayImplGTK::GetCurrentMode() const { wxVideoMode mode; #if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) -#ifdef __WXGTK3__ - if (GDK_IS_X11_SCREEN(m_screen)) -#endif + if ( gdk_is_x11_screen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); int nScreen = gdk_x11_screen_get_screen_number(m_screen); @@ -260,9 +313,7 @@ bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& mode) { bool success = false; #if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) -#ifdef __WXGTK3__ - if (GDK_IS_X11_SCREEN(m_screen)) -#endif + if ( gdk_is_x11_screen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); int nScreen = gdk_x11_screen_get_screen_number(m_screen); @@ -273,7 +324,14 @@ bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& mode) #endif return success; } -//----------------------------------------------------------------------------- + +wxGCC_WARNING_RESTORE() + +#endif // wxUSE_DISPLAY + +#endif // __WXGTK4__/!__WXGTK4__ + +#if wxUSE_DISPLAY wxDisplayFactory* wxDisplay::CreateFactory() { From 162ea7b1ef85197fa40203ea58166a6cdbaa2c54 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 5 Oct 2018 15:01:24 +0200 Subject: [PATCH 077/231] bringing back old style macOS icons loading see https://github.com/wxWidgets/wxWidgets/pull/925 --- src/osx/carbon/utilscocoa.mm | 2 +- src/osx/core/bitmap.cpp | 115 +++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) diff --git a/src/osx/carbon/utilscocoa.mm b/src/osx/carbon/utilscocoa.mm index 6c5ace2279..b134feb8e9 100644 --- a/src/osx/carbon/utilscocoa.mm +++ b/src/osx/carbon/utilscocoa.mm @@ -218,7 +218,7 @@ WXImage wxOSXGetImageFromCGImage( CGImageRef image, double scaleFactor, bool is #endif } -#if wxOSX_USE_ICONREF +#if wxOSX_USE_COCOA WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromIconRef( WXHICON iconref ) { NSImage *newImage = [[NSImage alloc] initWithIconRef:iconref]; diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 41162af49d..f5240f99fd 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -1778,6 +1778,8 @@ public: wxIMPLEMENT_DYNAMIC_CLASS(wxJPEGResourceHandler, wxBundleResourceHandler); +#if wxOSX_USE_COCOA + class WXDLLEXPORT wxICNSResourceHandler: public wxBundleResourceHandler { wxDECLARE_DYNAMIC_CLASS(wxICNSResourceHandler); @@ -1789,10 +1791,123 @@ public: SetExtension("icns"); SetType(wxBITMAP_TYPE_ICON_RESOURCE); } + + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + int desiredWidth, + int desiredHeight) wxOVERRIDE; + }; wxIMPLEMENT_DYNAMIC_CLASS(wxICNSResourceHandler, wxBundleResourceHandler); +bool wxICNSResourceHandler::LoadFile(wxBitmap *bitmap, + const wxString& resourceName, + wxBitmapType type, + int desiredWidth, + int desiredHeight) +{ + OSType theId = 0 ; + + if ( resourceName == wxT("wxICON_INFORMATION") ) + { + theId = kAlertNoteIcon ; + } + else if ( resourceName == wxT("wxICON_QUESTION") ) + { + theId = kAlertCautionIcon ; + } + else if ( resourceName == wxT("wxICON_WARNING") ) + { + theId = kAlertCautionIcon ; + } + else if ( resourceName == wxT("wxICON_ERROR") ) + { + theId = kAlertStopIcon ; + } + else if ( resourceName == wxT("wxICON_FOLDER") ) + { + theId = kGenericFolderIcon ; + } + else if ( resourceName == wxT("wxICON_FOLDER_OPEN") ) + { + theId = kOpenFolderIcon ; + } + else if ( resourceName == wxT("wxICON_NORMAL_FILE") ) + { + theId = kGenericDocumentIcon ; + } + else if ( resourceName == wxT("wxICON_EXECUTABLE_FILE") ) + { + theId = kGenericApplicationIcon ; + } + else if ( resourceName == wxT("wxICON_CDROM") ) + { + theId = kGenericCDROMIcon ; + } + else if ( resourceName == wxT("wxICON_FLOPPY") ) + { + theId = kGenericFloppyIcon ; + } + else if ( resourceName == wxT("wxICON_HARDDISK") ) + { + theId = kGenericHardDiskIcon ; + } + else if ( resourceName == wxT("wxICON_REMOVABLE") ) + { + theId = kGenericRemovableMediaIcon ; + } + else if ( resourceName == wxT("wxICON_DELETE") ) + { + theId = kToolbarDeleteIcon ; + } + else if ( resourceName == wxT("wxICON_GO_BACK") ) + { + theId = kBackwardArrowIcon ; + } + else if ( resourceName == wxT("wxICON_GO_FORWARD") ) + { + theId = kForwardArrowIcon ; + } + else if ( resourceName == wxT("wxICON_GO_HOME") ) + { + theId = kToolbarHomeIcon ; + } + else if ( resourceName == wxT("wxICON_HELP_SETTINGS") ) + { + theId = kGenericFontIcon ; + } + else if ( resourceName == wxT("wxICON_HELP_PAGE") ) + { + theId = kGenericDocumentIcon ; + } + else if ( resourceName == wxT( "wxICON_PRINT" ) ) + { + theId = kPrintMonitorFolderIcon; + } + else if ( resourceName == wxT( "wxICON_HELP_FOLDER" ) ) + { + theId = kHelpFolderIcon; + } + + if ( theId != 0 ) + { + IconRef iconRef = NULL ; + __Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ; + if ( iconRef ) + { + WXImage img = wxOSXGetNSImageFromIconRef(iconRef); + bitmap->Create(img); + return true; + } + } + + return wxBundleResourceHandler::LoadFile( bitmap, resourceName, type, desiredWidth, desiredHeight); +} + +#endif // wxOSX_USE_COCOA + bool wxBundleResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, wxBitmapType WXUNUSED(type), From 86ba770cd022db187da6d98f37fbadc89ceca622 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Oct 2018 18:52:30 +0200 Subject: [PATCH 078/231] Rename helper display function to use wx naming convention Don't pretend to be a GDK function, even if it's only a thin wrapper for a GDK macro. --- src/gtk/display.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index a9ddf52d83..2576d0d6c2 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -141,7 +141,7 @@ bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& WXUNUSED(mode)) #ifdef __WXGTK3__ -static inline bool gdk_is_x11_screen(GdkScreen* screen) +static inline bool wxIsX11GDKScreen(GdkScreen* screen) { return GDK_IS_X11_SCREEN(screen); } @@ -159,7 +159,7 @@ static inline int wx_gdk_screen_get_primary_monitor(GdkScreen* screen) } #define gdk_screen_get_primary_monitor wx_gdk_screen_get_primary_monitor -static inline bool gdk_is_x11_screen(GdkScreen* WXUNUSED(screen)) +static inline bool wxIsX11GDKScreen(GdkScreen* WXUNUSED(screen)) { return true; } @@ -178,7 +178,7 @@ wx_gdk_screen_get_monitor_workarea(GdkScreen* screen, int monitor, GdkRectangle* { gdk_screen_get_monitor_geometry(screen, monitor, dest); #ifdef wxGTK_HAVE_X11_DISPLAY - if ( gdk_is_x11_screen(screen) ) + if ( wxIsX11GDKScreen(screen) ) { GdkRectangle rect = { 0, 0, 0, 0 }; wxGetWorkAreaX11(GDK_SCREEN_XSCREEN(screen), @@ -279,7 +279,7 @@ wxArrayVideoModes wxDisplayImplGTK::GetModes(const wxVideoMode& mode) const { wxArrayVideoModes modes; #ifdef wxGTK_HAVE_X11_DISPLAY - if ( gdk_is_x11_screen(m_screen) ) + if ( wxIsX11GDKScreen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H @@ -299,7 +299,7 @@ wxVideoMode wxDisplayImplGTK::GetCurrentMode() const { wxVideoMode mode; #if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) - if ( gdk_is_x11_screen(m_screen) ) + if ( wxIsX11GDKScreen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); int nScreen = gdk_x11_screen_get_screen_number(m_screen); @@ -313,7 +313,7 @@ bool wxDisplayImplGTK::ChangeMode(const wxVideoMode& mode) { bool success = false; #if defined(wxGTK_HAVE_X11_DISPLAY) && defined(HAVE_X11_EXTENSIONS_XF86VMODE_H) - if ( gdk_is_x11_screen(m_screen) ) + if ( wxIsX11GDKScreen(m_screen) ) { Display* display = GDK_DISPLAY_XDISPLAY(gdk_screen_get_display(m_screen)); int nScreen = gdk_x11_screen_get_screen_number(m_screen); From 2ea9548ffb220b8979bf8bc3b50fbc3f2acbda5e Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:51:18 +0200 Subject: [PATCH 079/231] Add default argument values to wxToolBar::CreateTool() in wxQt Make the API consistent with the other ports. --- include/wx/qt/toolbar.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index 9df7555e80..b0da1958d4 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -48,11 +48,11 @@ public: virtual wxToolBarToolBase *CreateTool(int toolid, const wxString& label, const wxBitmap& bmpNormal, - const wxBitmap& bmpDisabled, - wxItemKind kind, - wxObject *clientData, - const wxString& shortHelp, - const wxString& longHelp) wxOVERRIDE; + const wxBitmap& bmpDisabled = wxNullBitmap, + wxItemKind kind = wxITEM_NORMAL, + wxObject *clientData = NULL, + const wxString& shortHelp = wxEmptyString, + const wxString& longHelp = wxEmptyString) wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(wxControl *control, const wxString& label) wxOVERRIDE; From f8c14d1176cbbed9e8265e6cde24e6485531d13d Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:53:11 +0200 Subject: [PATCH 080/231] Define more wxToolBar::SetToolXXX() methods in wxQt Provide a stub for SetToolShortHelp() and really implement SetTool{Normal,Disabled}Bitmap(). --- include/wx/qt/toolbar.h | 6 +++++- src/qt/toolbar.cpp | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/include/wx/qt/toolbar.h b/include/wx/qt/toolbar.h index b0da1958d4..6e9822b7c1 100644 --- a/include/wx/qt/toolbar.h +++ b/include/wx/qt/toolbar.h @@ -43,6 +43,11 @@ public: virtual QToolBar *GetQToolBar() const { return m_qtToolBar; } virtual void SetWindowStyleFlag( long style ) wxOVERRIDE; + + virtual void SetToolShortHelp(int id, const wxString& helpString) wxOVERRIDE; + virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; + virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap) wxOVERRIDE; + virtual bool Realize() wxOVERRIDE; virtual wxToolBarToolBase *CreateTool(int toolid, @@ -59,7 +64,6 @@ public: QWidget *GetHandle() const wxOVERRIDE; protected: - QActionGroup* GetActionGroup(size_t pos); virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxOVERRIDE; diff --git a/src/qt/toolbar.cpp b/src/qt/toolbar.cpp index c6ec8adc5c..dc307e086b 100644 --- a/src/qt/toolbar.cpp +++ b/src/qt/toolbar.cpp @@ -185,6 +185,41 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x), return NULL; } +void wxToolBar::SetToolShortHelp( int id, const wxString& helpString ) +{ + wxToolBarTool* tool = static_cast(FindById(id)); + if ( tool ) + { + (void)tool->SetShortHelp(helpString); + //TODO - other qt actions for tool tip string +// if (tool->m_item) +// {} + } +} + +void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) +{ + wxToolBarTool* tool = static_cast(FindById(id)); + if ( tool ) + { + wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); + + tool->SetNormalBitmap(bitmap); + tool->SetIcon(); + } +} + +void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) +{ + wxToolBarTool* tool = static_cast(FindById(id)); + if ( tool ) + { + wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); + + tool->SetDisabledBitmap(bitmap); + } +} + void wxToolBar::SetWindowStyleFlag( long style ) { wxToolBarBase::SetWindowStyleFlag(style); @@ -249,7 +284,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase) { wxToolBarTool* tool = static_cast(toolBase); QAction *before = NULL; - if (pos >= 0 && pos < (size_t)m_qtToolBar->actions().size()) + if (pos < (size_t)m_qtToolBar->actions().size()) before = m_qtToolBar->actions().at(pos); QAction *action; From 0d63351eefe56fe13b845450cb998770da267806 Mon Sep 17 00:00:00 2001 From: Scott Furry Date: Fri, 14 Jul 2017 16:54:17 +0200 Subject: [PATCH 081/231] Fix wxQt compilation in STL build Use compatibility_iterator instead of Node* for iterating over wxList, the latter doesn't compile when wxUSE_STD_CONTAINERS==1. --- src/qt/accel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/accel.cpp b/src/qt/accel.cpp index 1ecb0c85fb..046c504a20 100644 --- a/src/qt/accel.cpp +++ b/src/qt/accel.cpp @@ -86,7 +86,7 @@ QList< QShortcut* > *wxAcceleratorTable::ConvertShortcutTable( QWidget *parent ) { QList< QShortcut* > *qtList = new QList< QShortcut* >; - for ( wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() ) + for ( wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() ) { qtList->push_back(ConvertAccelerator( node->GetData(), parent )); } From b368fa2de5148e9381d816f1e3180d9045a33e47 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Jul 2017 16:56:33 +0200 Subject: [PATCH 082/231] Remove casts from wxString to "const char*" in wxQt code These casts didn't compile in Unicode build and were completely unnecessary anyhow, just remove them. --- src/qt/window.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qt/window.cpp b/src/qt/window.cpp index b82a4e3054..c36177e52b 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -194,8 +194,7 @@ wxWindowQt::~wxWindowQt() // Delete only if the qt widget was created or assigned to this base class if (m_qtWindow) { - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow=%p"), - (const char*)GetName(), m_qtWindow); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow=%p"), GetName(), m_qtWindow); // Avoid sending further signals (i.e. if deleting the current page) m_qtWindow->blockSignals(true); // Reset the pointer to avoid handling pending event and signals @@ -206,8 +205,7 @@ wxWindowQt::~wxWindowQt() } else { - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), - (const char*)GetName()); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::~wxWindow %s m_qtWindow is NULL"), GetName()); } } @@ -260,8 +258,7 @@ void wxWindowQt::PostCreation(bool generic) // store pointer to the QWidget subclass (to be used in the destructor) m_qtWindow = GetHandle(); } - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Create %s m_qtWindow=%p"), - (const char*)GetName(), m_qtWindow); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Create %s m_qtWindow=%p"), GetName(), m_qtWindow); // set the background style after creation (not before like in wxGTK) // (only for generic controls, to use qt defaults elsewere) @@ -395,7 +392,7 @@ void wxWindowQt::WarpPointer(int x, int y) void wxWindowQt::Update() { - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Update %s"), (const char*)GetName()); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Update %s"), GetName()); // send the paint event to the inner widget in scroll areas: if ( QtGetScrollBarsContainer() ) { @@ -422,14 +419,13 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect ) if ( rect != NULL ) { wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s rect %d %d %d %d"), - (const char*)GetName(), + GetName(), rect->x, rect->y, rect->width, rect->height); widget->update( wxQtConvertRect( *rect )); } else { - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"), - (const char*)GetName()); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::Refresh %s"), GetName()); widget->update(); } } @@ -1081,7 +1077,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) if ( UseBgCol() && !GetHandle()->autoFillBackground() ) { wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s clearing DC to %s"), - (const char*)GetName(), GetBackgroundColour().GetAsString() + GetName(), GetBackgroundColour().GetAsString() ); dc.SetBackground(GetBackgroundColour()); dc.Clear(); @@ -1130,8 +1126,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) else { // Painter didn't begun, not handled by wxWidgets: - wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"), - (const char*)GetName() ); + wxLogTrace(TRACE_QT_WINDOW, wxT("wxWindow::QtHandlePaintEvent %s Qt widget painter begin failed"), GetName() ); return false; } } From 1614f7337d7f85da26681d1e1aaf700448c8544e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 4 Oct 2018 15:28:56 +0200 Subject: [PATCH 083/231] Mention that wxDisplaySize() shouldn't be used in the new code Prefer to use wxDisplay::GetGeometry() which works for any display, not just the primary one. --- interface/wx/gdicmn.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h index 6e98d29d88..fe7a62a783 100644 --- a/interface/wx/gdicmn.h +++ b/interface/wx/gdicmn.h @@ -1262,6 +1262,10 @@ wxSize wxGetDisplayPPI(); /** Returns the display size in pixels. + @note Use of this function is not recommended in the new code as it only + works for the primary display. Use wxDisplay::GetGeometry() to retrieve + the size of the appropriate display instead. + Either of output pointers can be @NULL if the caller is not interested in the corresponding value. @@ -1277,6 +1281,10 @@ void wxDisplaySize(int* width, int* height); /** Returns the display size in pixels. + @note Use of this function is not recommended in the new code as it only + works for the primary display. Use wxDisplay::GetGeometry() to retrieve + the size of the appropriate display instead. + @see wxDisplay @header{wx/gdicmn.h} From e834585cf78cbf411eb7f66e6755e4be3257dddd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Oct 2018 15:24:13 +0200 Subject: [PATCH 084/231] Remove wxDisplaySize() implementation from wxGTK1 This is now implemented in common code, in terms of wxDisplay. --- src/gtk1/utilsgtk.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index c912fc9a9a..9f18a26436 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -86,12 +86,6 @@ void *wxGetDisplay() return GDK_DISPLAY(); } -void wxDisplaySize( int *width, int *height ) -{ - if (width) *width = gdk_screen_width(); - if (height) *height = gdk_screen_height(); -} - void wxDisplaySizeMM( int *width, int *height ) { if (width) *width = gdk_screen_width_mm(); From 24b5e256df5a1593c6f47eabc077a017e47350fe Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Oct 2018 15:28:11 +0200 Subject: [PATCH 085/231] Add wxDisplay::GetDepth() and use it for wxDisplayDepth() Allow getting the depth of any display, not just the primary one, even though this is not implemented for Unix ports currently. Mostly do this for consistency with the other display-related functions. --- include/wx/display.h | 3 ++ include/wx/private/display.h | 3 ++ interface/wx/gdicmn.h | 4 +++ samples/display/display.cpp | 4 +++ src/common/dpycmn.cpp | 7 +++++ src/common/gdicmn.cpp | 5 ++++ src/dfb/utils.cpp | 10 +++---- src/gtk/display.cpp | 13 +++++++++ src/gtk/utilsgtk.cpp | 9 ------ src/gtk1/utilsgtk.cpp | 5 ---- src/motif/utils.cpp | 8 ------ src/msw/display.cpp | 55 ++++++++++++++++++++++++++++-------- src/msw/utilsgui.cpp | 7 ----- src/osx/core/display.cpp | 34 ++++++++++++++++++++++ src/osx/iphone/utils.mm | 11 ++++---- src/osx/utils_osx.cpp | 24 ---------------- src/qt/display.cpp | 6 ++++ src/qt/utils.cpp | 5 ---- src/unix/displayx11.cpp | 26 ++++++++++++++++- src/x11/utils.cpp | 8 ------ 20 files changed, 157 insertions(+), 90 deletions(-) diff --git a/include/wx/display.h b/include/wx/display.h index 3213d79d97..726dfee418 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -74,6 +74,9 @@ public: // get the client area of the display, i.e. without taskbars and such wxRect GetClientArea() const; + // get the depth, i.e. number of bits per pixel (0 if unknown) + int GetDepth() const; + // name may be empty wxString GetName() const; diff --git a/include/wx/private/display.h b/include/wx/private/display.h index 9f0dce0ad2..686e703101 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -78,6 +78,9 @@ public: // return the area of the display available for normal windows virtual wxRect GetClientArea() const { return GetGeometry(); } + // return the depth or 0 if unknown + virtual int GetDepth() const = 0; + // return the name (may be empty) virtual wxString GetName() const { return wxString(); } diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h index fe7a62a783..fc27e066d9 100644 --- a/interface/wx/gdicmn.h +++ b/interface/wx/gdicmn.h @@ -1191,6 +1191,10 @@ bool wxColourDisplay(); Returns the depth of the display (a value of 1 denotes a monochrome display). + @note Use of this function is not recommended in the new code as it only + works for the primary display. Use wxDisplay::GetDepth() to retrieve + the depth of the appropriate display instead. + @header{wx/gdicmn.h} */ int wxDisplayDepth(); diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 7c97a54c34..5b715f88ec 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -275,6 +275,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, rc.x, rc.y, rc.width, rc.height) )); + sizer->Add(new wxStaticText(page, wxID_ANY, "Depth: ")); + sizer->Add(new wxStaticText(page, wxID_ANY, + wxString::Format("%d", display.GetDepth()))); + sizer->Add(new wxStaticText(page, wxID_ANY, "Name: ")); sizer->Add(new wxStaticText(page, wxID_ANY, display.GetName())); diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index cd49ae60ec..9968f3cbfa 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -122,6 +122,13 @@ wxRect wxDisplay::GetClientArea() const return m_impl->GetClientArea(); } +int wxDisplay::GetDepth() const +{ + wxCHECK_MSG( IsOk(), 0, wxT("invalid wxDisplay object") ); + + return m_impl->GetDepth(); +} + wxString wxDisplay::GetName() const { wxCHECK_MSG( IsOk(), wxString(), wxT("invalid wxDisplay object") ); diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 771db4ac72..22ba30ef37 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -845,6 +845,11 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize, return font; } +int wxDisplayDepth() +{ + return wxDisplay().GetDepth(); +} + void wxDisplaySize(int *width, int *height) { const wxSize size = wxGetDisplaySize(); diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index 76c84a5c50..7226d63002 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -68,6 +68,11 @@ public: return wxRect(0, 0, mode.w, mode.h); } + + virtual int GetDepth() const wxOVERRIDE + { + return wxTheApp->GetDisplayMode().bpp; + } }; class wxDisplayFactorySingleDFB : public wxDisplayFactorySingle @@ -90,11 +95,6 @@ bool wxColourDisplay() return true; } -int wxDisplayDepth() -{ - return wxTheApp->GetDisplayMode().bpp; -} - void wxDisplaySizeMM(int *width, int *height) { // FIXME: there's no way to get physical resolution using the DirectDB diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index 2576d0d6c2..2cc424c8db 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -45,6 +45,7 @@ public: wxDisplayImplGTK(unsigned i); virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; #if wxUSE_DISPLAY virtual bool IsPrimary() const wxOVERRIDE; @@ -114,6 +115,11 @@ wxRect wxDisplayImplGTK::GetClientArea() const return wxRect(rect.x, rect.y, rect.width, rect.height); } +int wxDisplayImplGTK::GetDepth() const +{ + return 24; +} + #if wxUSE_DISPLAY bool wxDisplayImplGTK::IsPrimary() const { @@ -205,6 +211,7 @@ public: wxDisplayImplGTK(unsigned i); virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; #if wxUSE_DISPLAY virtual bool IsPrimary() const wxOVERRIDE; @@ -269,6 +276,12 @@ wxRect wxDisplayImplGTK::GetClientArea() const return wxRect(rect.x, rect.y, rect.width, rect.height); } +int wxDisplayImplGTK::GetDepth() const +{ + // TODO: How to get the depth of the specific display? + return gdk_visual_get_depth(gdk_window_get_visual(wxGetTopLevelGDK())); +} + #if wxUSE_DISPLAY bool wxDisplayImplGTK::IsPrimary() const { diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 31a1d9a9ea..2ce561ff13 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -95,15 +95,6 @@ bool wxColourDisplay() return true; } -int wxDisplayDepth() -{ -#ifdef __WXGTK4__ - return 24; -#else - return gdk_visual_get_depth(gdk_window_get_visual(wxGetTopLevelGDK())); -#endif -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index 9f18a26436..c027686ad5 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -102,11 +102,6 @@ bool wxColourDisplay() return true; } -int wxDisplayDepth() -{ - return gdk_window_get_visual( wxGetRootWindow()->window )->depth; -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 16c52e86a8..621b89cc27 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -231,14 +231,6 @@ bool wxColourDisplay() return wxDisplayDepth() > 1; } -// Returns depth of screen -int wxDisplayDepth() -{ - Display *dpy = wxGlobalDisplay(); - - return DefaultDepth (dpy, DefaultScreen (dpy)); -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = wxGlobalDisplay(); diff --git a/src/msw/display.cpp b/src/msw/display.cpp index 771cb32132..e6ea6486a8 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -29,6 +29,11 @@ #include "wx/msw/private.h" #include "wx/msw/wrapwin.h" +int wxGetHDCDepth(HDC hdc) +{ + return ::GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); +} + // This implementation is always available, whether wxUSE_DISPLAY is 1 or not, // as we fall back to it in case of error. class wxDisplayImplSingleMSW : public wxDisplayImplSingle @@ -52,6 +57,11 @@ public: wxCopyRECTToRect(rc, rectClient); return rectClient; } + + virtual int GetDepth() const wxOVERRIDE + { + return wxGetHDCDepth(ScreenHDC()); + } }; class wxDisplayFactorySingleMSW : public wxDisplayFactorySingle @@ -79,6 +89,20 @@ protected: static const wxChar displayDllName[] = wxT("user32.dll"); +namespace +{ + +// Simple struct storing the information needed by wxDisplayMSW. +struct wxDisplayInfo +{ + wxDisplayInfo(HMONITOR hmon_, int depth_) : hmon(hmon_), depth(depth_) {} + + HMONITOR hmon; + int depth; +}; + +} // anonymous namespace + // ---------------------------------------------------------------------------- // wxDisplayMSW declaration // ---------------------------------------------------------------------------- @@ -86,14 +110,15 @@ static const wxChar displayDllName[] = wxT("user32.dll"); class wxDisplayMSW : public wxDisplayImpl { public: - wxDisplayMSW(unsigned n, HMONITOR hmon) + wxDisplayMSW(unsigned n, const wxDisplayInfo& info) : wxDisplayImpl(n), - m_hmon(hmon) + m_info(info) { } virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; virtual wxString GetName() const wxOVERRIDE; virtual bool IsPrimary() const wxOVERRIDE; @@ -118,7 +143,7 @@ protected: // it succeeded, otherwise return false. bool GetMonInfo(MONITORINFOEX& monInfo) const; - HMONITOR m_hmon; + wxDisplayInfo m_info; private: wxDECLARE_NO_COPY_CLASS(wxDisplayMSW); @@ -129,8 +154,6 @@ private: // wxDisplayFactoryMSW declaration // ---------------------------------------------------------------------------- -WX_DEFINE_ARRAY(HMONITOR, wxMonitorHandleArray); - class wxDisplayFactoryMSW : public wxDisplayFactory { public: @@ -177,7 +200,7 @@ private: // the array containing information about all available displays, filled by // MultimonEnumProc() - wxMonitorHandleArray m_displays; + wxVector m_displays; // The hidden window we use for receiving WM_SETTINGCHANGE and its class // name. @@ -213,7 +236,7 @@ wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; bool wxDisplayMSW::GetMonInfo(MONITORINFOEX& monInfo) const { - if ( !::GetMonitorInfo(m_hmon, &monInfo) ) + if ( !::GetMonitorInfo(m_info.hmon, &monInfo) ) { wxLogLastError(wxT("GetMonitorInfo")); return false; @@ -244,6 +267,11 @@ wxRect wxDisplayMSW::GetClientArea() const return rectClient; } +int wxDisplayMSW::GetDepth() const +{ + return m_info.depth; +} + wxString wxDisplayMSW::GetName() const { WinStruct monInfo; @@ -469,9 +497,12 @@ wxDisplayFactoryMSW::~wxDisplayFactoryMSW() void wxDisplayFactoryMSW::DoRefreshMonitors() { - m_displays.Clear(); + m_displays.clear(); - if ( !::EnumDisplayMonitors(NULL, NULL, MultimonEnumProc, (LPARAM)this) ) + // We need to pass a valid HDC here in order to get valid hdcMonitor in our + // callback. + ScreenHDC dc; + if ( !::EnumDisplayMonitors(dc, NULL, MultimonEnumProc, (LPARAM)this) ) { wxLogLastError(wxT("EnumDisplayMonitors")); } @@ -481,13 +512,13 @@ void wxDisplayFactoryMSW::DoRefreshMonitors() BOOL CALLBACK wxDisplayFactoryMSW::MultimonEnumProc( HMONITOR hMonitor, // handle to display monitor - HDC WXUNUSED(hdcMonitor), // handle to monitor-appropriate device context + HDC hdcMonitor, // handle to monitor-appropriate device context LPRECT WXUNUSED(lprcMonitor), // pointer to monitor intersection rectangle LPARAM dwData) // data passed from EnumDisplayMonitors (this) { wxDisplayFactoryMSW *const self = (wxDisplayFactoryMSW *)dwData; - self->m_displays.Add(hMonitor); + self->m_displays.push_back(wxDisplayInfo(hMonitor, wxGetHDCDepth(hdcMonitor))); // continue the enumeration return TRUE; @@ -508,7 +539,7 @@ int wxDisplayFactoryMSW::FindDisplayFromHMONITOR(HMONITOR hmon) const const size_t count = m_displays.size(); for ( size_t n = 0; n < count; n++ ) { - if ( hmon == m_displays[n] ) + if ( hmon == m_displays[n].hmon ) return n; } } diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 1ebbd36259..a475bc6290 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -138,13 +138,6 @@ bool wxColourDisplay() return s_isColour != 0; } -// Returns depth of screen -int wxDisplayDepth() -{ - ScreenHDC dc; - return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL); -} - void wxDisplaySizeMM(int *width, int *height) { ScreenHDC dc; diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 3f35ccc1e4..2e55b346b8 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -52,6 +52,29 @@ wxRect wxGetDisplayGeometry(CGDirectDisplayID id) (int)theRect.size.height ); //floats } +int wxGetDisplayDepth(CGDirectDisplayID id) +{ + CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(id); + CFStringRef encoding = CGDisplayModeCopyPixelEncoding(currentMode); + + int theDepth = 32; // some reasonable default + if(encoding) + { + if(CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 32; + else if(CFStringCompare(encoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 16; + else if(CFStringCompare(encoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) + theDepth = 8; + + CFRelease(encoding); + } + + CGDisplayModeRelease(currentMode); + + return theDepth; +} + } // anonymous namespace #if wxUSE_DISPLAY @@ -73,6 +96,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; @@ -229,6 +253,11 @@ wxRect wxDisplayImplMacOSX::GetClientArea() const return wxDisplayImpl::GetClientArea(); } +int wxDisplayImplMacOSX::GetDepth() const +{ + return wxGetDisplayDepth(m_id); +} + static int wxOSXCGDisplayModeGetBitsPerPixel( CGDisplayModeRef theValue ) { wxCFRef pixelEncoding( CGDisplayModeCopyPixelEncoding(theValue) ); @@ -339,6 +368,11 @@ public: { return wxOSXGetMainDisplayClientArea(); } + + virtual int GetDepth() const wxOVERRIDE + { + return wxGetDisplayDepth(CGMainDisplayID()); + } }; class wxDisplayFactorySingleMacOSX : public wxDisplayFactorySingle diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index 2136055e74..dd77cfd5e6 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -130,12 +130,6 @@ wxMouseState wxGetMouseState() return ms; } -// Returns depth of screen -int wxDisplayDepth() -{ - return 32; // TODO can we determine this ? -} - // Get size of display class wxDisplayImplSingleiOS : public wxDisplayImplSingle @@ -161,6 +155,11 @@ public: return wxRect(0, 0, width, height); } + + virtual int GetDepth() const wxOVERRIDE + { + return 32; // TODO can we determine this ? + } }; class wxDisplayFactorySingleiOS : public wxDisplayFactorySingle diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 6860b5e088..d53c47f753 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -63,30 +63,6 @@ bool wxColourDisplay() #if wxOSX_USE_COCOA_OR_CARBON -// Returns depth of screen -int wxDisplayDepth() -{ - CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(kCGDirectMainDisplay); - CFStringRef encoding = CGDisplayModeCopyPixelEncoding(currentMode); - - int theDepth = 32; // some reasonable default - if(encoding) - { - if(CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 32; - else if(CFStringCompare(encoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 16; - else if(CFStringCompare(encoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - theDepth = 8; - - CFRelease(encoding); - } - - CGDisplayModeRelease(currentMode); - - return theDepth; -} - #if wxUSE_GUI // ---------------------------------------------------------------------------- diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 52b6af8373..6d3de3ac2e 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -21,6 +21,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; + virtual int GetDepth() const wxOVERRIDE; #if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; @@ -44,6 +45,11 @@ wxRect wxDisplayImplQt::GetClientArea() const return wxQtConvertRect( QApplication::desktop()->availableGeometry( GetIndex() )); } +int wxDisplayImplQt::GetDepth() const +{ + return IsPrimary() ? QApplication::desktop()->depth() : 0; +} + #if wxUSE_DISPLAY wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const { diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index 92957b8683..bcaedc95e2 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -110,11 +110,6 @@ bool wxGetKeyState(wxKeyCode key) } } -int wxDisplayDepth() -{ - return QApplication::desktop()->depth(); -} - void wxDisplaySizeMM(int *width, int *height) { if ( width != NULL ) diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index 4e317ca6a0..b352e5392f 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -34,6 +34,16 @@ static wxRect wxGetMainScreenWorkArea(); +namespace +{ + +inline int wxGetMainScreenDepth() +{ + Display* const dpy = wxGetX11Display(); + + return DefaultDepth(dpy, DefaultScreen (dpy)); +} + class wxDisplayImplSingleX11 : public wxDisplayImplSingle { public: @@ -50,6 +60,11 @@ public: { return wxGetMainScreenWorkArea(); } + + virtual int GetDepth() const wxOVERRIDE + { + return wxGetMainScreenDepth(); + } }; class wxDisplayFactorySingleX11 : public wxDisplayFactorySingle @@ -61,6 +76,8 @@ protected: } }; +} // anonymous namespace + #if wxUSE_DISPLAY #include @@ -118,6 +135,14 @@ public: // we don't currently react to its changes return IsPrimary() ? wxGetMainScreenWorkArea() : m_rect; } + virtual int GetDepth() const wxOVERRIDE + { + const wxVideoMode& mode = GetCurrentMode(); + if ( mode.bpp ) + return mode.bpp; + + return wxGetMainScreenDepth(); + } virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; @@ -125,7 +150,6 @@ public: private: wxRect m_rect; - int m_depth; wxDECLARE_NO_COPY_CLASS(wxDisplayImplX11); }; diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 4312a3da8e..7a917354ab 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -154,14 +154,6 @@ bool wxColourDisplay() return wxDisplayDepth() > 1; } -// Returns depth of screen -int wxDisplayDepth() -{ - Display *dpy = (Display*) wxGetDisplay(); - - return DefaultDepth (dpy, DefaultScreen (dpy)); -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = (Display*) wxGetDisplay(); From 382404f0a7389a547aab5c3ecd7ee53b49679074 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Oct 2018 16:12:48 +0200 Subject: [PATCH 086/231] Stop using wxColourDisplay() inside wxWidgets code This function always returns true in practice and it's completely useless to call it during each wxDC object construction, especially because wxDC::m_colour itself is not used anywhere. --- demos/poem/wxpoem.cpp | 31 +++++++++++++------------------ src/common/dcbase.cpp | 2 +- src/common/dcsvg.cpp | 1 - src/motif/dcclient.cpp | 1 - 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp index cfca656f6e..36206c8753 100644 --- a/demos/poem/wxpoem.cpp +++ b/demos/poem/wxpoem.cpp @@ -163,7 +163,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) height = *max_y; } - if (DrawIt && wxColourDisplay()) + if (DrawIt) { dc->SetBrush(*wxLIGHT_GREY_BRUSH); dc->SetPen(*wxGREY_PEN); @@ -347,20 +347,18 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) if (DrawIt) { // Draw dark grey thick border - if (wxColourDisplay()) - { - dc->SetBrush(*wxGREY_BRUSH); - dc->SetPen(*wxGREY_PEN); + dc->SetBrush(*wxGREY_BRUSH); + dc->SetPen(*wxGREY_PEN); + + // Left side + dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height); + // Top side + dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER); + // Right side + dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER); + // Bottom side + dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height); - // Left side - dc->DrawRectangle(0, 0, THIN_LINE_BORDER, height); - // Top side - dc->DrawRectangle(THIN_LINE_BORDER, 0, width-THIN_LINE_BORDER, THIN_LINE_BORDER); - // Right side - dc->DrawRectangle(width-THIN_LINE_BORDER, THIN_LINE_BORDER, width, height-THIN_LINE_BORDER); - // Bottom side - dc->DrawRectangle(THIN_LINE_BORDER, height-THIN_LINE_BORDER, width-THIN_LINE_BORDER, height); - } // Draw border // Have grey background, plus 3-d border - // One black rectangle. @@ -376,10 +374,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) // Right and bottom white lines - 'grey' (black!) if // we're running on a mono display. - if (wxColourDisplay()) - dc->SetPen(*wxWHITE_PEN); - else - dc->SetPen(*wxBLACK_PEN); + dc->SetPen(*wxWHITE_PEN); dc->DrawLine(width-THICK_LINE_BORDER, THICK_LINE_BORDER, width-THICK_LINE_BORDER, height-THICK_LINE_BORDER); diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 1363984b7e..8b070995d8 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -318,7 +318,7 @@ wxIMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject); wxDCImpl::wxDCImpl( wxDC *owner ) : m_window(NULL) - , m_colour(wxColourDisplay()) + , m_colour(true) , m_ok(true) , m_clipping(false) , m_isInteractive(0) diff --git a/src/common/dcsvg.cpp b/src/common/dcsvg.cpp index 7a02bebb4f..2913548a12 100644 --- a/src/common/dcsvg.cpp +++ b/src/common/dcsvg.cpp @@ -402,7 +402,6 @@ void wxSVGFileDCImpl::Init(const wxString &filename, int Width, int Height, m_backgroundBrush = *wxTRANSPARENT_BRUSH; m_textForegroundColour = *wxBLACK; m_textBackgroundColour = *wxWHITE; - m_colour = wxColourDisplay(); m_pen = *wxBLACK_PEN; m_font = *wxNORMAL_FONT; diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 6bf809572f..a85f36bfc2 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -139,7 +139,6 @@ void wxWindowDCImpl::Init() m_currentPenDash = NULL; m_currentStyle = -1; m_currentFill = -1; - m_colour = wxColourDisplay(); m_display = NULL; m_pixmap = (WXPixmap) 0; m_autoSetting = 0; From e3e883bbd226c9fe6308b47e5842940129cc9f5f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Oct 2018 16:14:45 +0200 Subject: [PATCH 087/231] Implement wxColourDisplay() in terms of wxDisplay::GetDepth() Get rid of another global display-related function, even though this one only had non-trivial implementation under MSW. --- interface/wx/gdicmn.h | 4 ++++ src/common/gdicmn.cpp | 7 +++++++ src/dfb/utils.cpp | 6 ------ src/gtk/utilsgtk.cpp | 5 ----- src/gtk1/utilsgtk.cpp | 5 ----- src/motif/utils.cpp | 6 ------ src/msw/utilsgui.cpp | 21 --------------------- src/osx/utils_osx.cpp | 8 -------- src/qt/utils.cpp | 5 ----- src/x11/utils.cpp | 6 ------ 10 files changed, 11 insertions(+), 62 deletions(-) diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h index fc27e066d9..2033b5461d 100644 --- a/interface/wx/gdicmn.h +++ b/interface/wx/gdicmn.h @@ -1183,6 +1183,10 @@ const wxSize wxDefaultSize; /** Returns @true if the display is colour, @false otherwise. + @note Use of this function is not recommended in the new code as it only + works for the primary display. Use wxDisplay::GetDepth() to retrieve + the depth of the appropriate display and compare it with 1 instead. + @header{wx/gdicmn.h} */ bool wxColourDisplay(); diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 22ba30ef37..a584eccc5f 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -850,6 +850,13 @@ int wxDisplayDepth() return wxDisplay().GetDepth(); } +bool wxColourDisplay() +{ + // If GetDepth() returns 0, meaning unknown, we assume it's a colour + // display, hence the use of "!=" rather than ">" here. + return wxDisplay().GetDepth() != 1; +} + void wxDisplaySize(int *width, int *height) { const wxSize size = wxGetDisplaySize(); diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index 7226d63002..b4e97dc727 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -89,12 +89,6 @@ wxDisplayFactory* wxDisplay::CreateFactory() return new wxDisplayFactorySingleDFB; } -bool wxColourDisplay() -{ - #warning "FIXME: wxColourDisplay" - return true; -} - void wxDisplaySizeMM(int *width, int *height) { // FIXME: there's no way to get physical resolution using the DirectDB diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 2ce561ff13..f0a36126f1 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -90,11 +90,6 @@ void wxDisplaySizeMM( int *width, int *height ) #endif } -bool wxColourDisplay() -{ - return true; -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index c027686ad5..bdcadfa5e7 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -97,11 +97,6 @@ void wxGetMousePosition( int* x, int* y ) gdk_window_get_pointer( NULL, x, y, NULL ); } -bool wxColourDisplay() -{ - return true; -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 621b89cc27..87a1af7da0 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -225,12 +225,6 @@ void wxGetMousePosition( int* x, int* y ) #endif } -// Return true if we have a colour display -bool wxColourDisplay() -{ - return wxDisplayDepth() > 1; -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = wxGlobalDisplay(); diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index a475bc6290..9ac17ef4b1 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -117,27 +117,6 @@ void wxGetMousePosition( int* x, int* y ) if ( y ) *y = pt.y; } -// Return true if we have a colour display -bool wxColourDisplay() -{ - // this function is called from wxDC ctor so it is called a *lot* of times - // hence we optimize it a bit but doing the check only once - // - // this should be MT safe as only the GUI thread (holding the GUI mutex) - // can call us - static int s_isColour = -1; - - if ( s_isColour == -1 ) - { - ScreenHDC dc; - int noCols = ::GetDeviceCaps(dc, NUMCOLORS); - - s_isColour = (noCols == -1) || (noCols > 2); - } - - return s_isColour != 0; -} - void wxDisplaySizeMM(int *width, int *height) { ScreenHDC dc; diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index d53c47f753..b1c1975997 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -53,14 +53,6 @@ bool wxCheckForInterrupt(wxWindow *WXUNUSED(wnd)) return false; } -// Return true if we have a colour display -bool wxColourDisplay() -{ - // always the case on OS X - return true; -} - - #if wxOSX_USE_COCOA_OR_CARBON #if wxUSE_GUI diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index bcaedc95e2..fb6dce807e 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -140,11 +140,6 @@ wxWindow *wxGetActiveWindow() return NULL; } -bool wxColourDisplay() -{ - return QApplication::desktop()->depth() > 1; -} - bool wxLaunchDefaultApplication(const wxString& path, int WXUNUSED( flags ) ) { return QDesktopServices::openUrl( QUrl::fromLocalFile( wxQtConvertString( path ) ) ); diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index 7a917354ab..a5d71d4046 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -148,12 +148,6 @@ void wxGetMousePosition( int* x, int* y ) #endif }; -// Return true if we have a colour display -bool wxColourDisplay() -{ - return wxDisplayDepth() > 1; -} - void wxDisplaySizeMM(int *width, int *height) { Display *dpy = (Display*) wxGetDisplay(); From ded2894b787b647f1f311c5954c95c7042f9bf5f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Oct 2018 23:21:45 +0200 Subject: [PATCH 088/231] Add wxDisplay::GetPPI() to use instead of wxGetDisplayPPI() While this is not done for all the ports yet, the new API allows returning different PPI values for different monitors, unlike the old (and still existing, but implemented in terms of the new one) global function. --- docs/changes.txt | 1 + include/wx/display.h | 4 ++ include/wx/gdicmn.h | 3 + include/wx/private/display.h | 9 +++ interface/wx/display.h | 15 ++++- interface/wx/gdicmn.h | 4 ++ interface/wx/vidmode.h | 2 - samples/display/display.cpp | 5 ++ src/common/dpycmn.cpp | 29 ++++++++++ src/common/gdicmn.cpp | 25 +++++--- src/dfb/utils.cpp | 22 +++---- src/gtk/display.cpp | 39 +++++++++++++ src/gtk/utilsgtk.cpp | 14 ----- src/gtk1/utilsgtk.cpp | 6 -- src/motif/utils.cpp | 10 ---- src/msw/display.cpp | 108 +++++++++++++++++++++++++++++++++++ src/msw/utilsgui.cpp | 10 ---- src/osx/core/display.cpp | 17 ++++++ src/osx/iphone/utils.mm | 5 ++ src/osx/utils_osx.cpp | 22 ------- src/qt/display.cpp | 8 +++ src/qt/utils.cpp | 8 --- src/unix/displayx11.cpp | 21 +++++++ src/x11/utils.cpp | 10 ---- 24 files changed, 290 insertions(+), 107 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index f229181029..f7fc4f8e2f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -127,6 +127,7 @@ All (GUI): - Allow binding to events generated by their items in submenus too. - Add wxGrid::SetCornerLabelValue() (Pavel Kalugin). - Add strikethrough support for fonts defined in XRC. +- Add wxDisplay::GetPPI(). wxGTK: diff --git a/include/wx/display.h b/include/wx/display.h index 726dfee418..af299a74e0 100644 --- a/include/wx/display.h +++ b/include/wx/display.h @@ -11,6 +11,7 @@ #define _WX_DISPLAY_H_BASE_ #include "wx/defs.h" +#include "wx/gdicmn.h" // wxSize // NB: no #if wxUSE_DISPLAY here, the display geometry part of this class (but // not the video mode stuff) is always available but if wxUSE_DISPLAY == 0 @@ -77,6 +78,9 @@ public: // get the depth, i.e. number of bits per pixel (0 if unknown) int GetDepth() const; + // get the resolution of this monitor in pixels per inch + wxSize GetPPI() const; + // name may be empty wxString GetName() const; diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index f7d39c017b..e415f1c115 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -1080,6 +1080,9 @@ extern WXDLLIMPEXP_DATA_CORE(const wxPoint) wxDefaultPosition; extern void WXDLLIMPEXP_CORE wxInitializeStockLists(); extern void WXDLLIMPEXP_CORE wxDeleteStockLists(); +// Note: all the display-related functions here exist for compatibility only, +// please use wxDisplay class in the new code + // is the display colour (or monochrome)? extern bool WXDLLIMPEXP_CORE wxColourDisplay(); diff --git a/include/wx/private/display.h b/include/wx/private/display.h index 686e703101..1cd7bae8d0 100644 --- a/include/wx/private/display.h +++ b/include/wx/private/display.h @@ -81,6 +81,15 @@ public: // return the depth or 0 if unknown virtual int GetDepth() const = 0; + // return the resolution of the display, uses GetSizeMM() by default but + // can be also overridden directly + virtual wxSize GetPPI() const; + + // return the physical size of the display or (0, 0) if unknown: this is + // only used by GetPPI() implementation in the base class, so if GetPPI() + // is overridden, this one doesn't have to be implemented + virtual wxSize GetSizeMM() const { return wxSize(0, 0); } + // return the name (may be empty) virtual wxString GetName() const { return wxString(); } diff --git a/interface/wx/display.h b/interface/wx/display.h index 7e82ef1af1..1a3ca71450 100644 --- a/interface/wx/display.h +++ b/interface/wx/display.h @@ -12,8 +12,6 @@ @library{wxcore} @category{cfg} - - @see wxClientDisplayRect(), wxDisplaySize(), wxDisplaySizeMM() */ class wxDisplay { @@ -109,6 +107,19 @@ public: */ wxString GetName() const; + /** + Returns display resolution in pixels per inch. + + Horizontal and vertical resolution are returned in @c x and @c y + components of the wxSize object respectively. + + If the resolution information is not available, returns @code wxSize(0, + 0) @endcode. + + @since 3.1.2 + */ + wxSize GetPPI() const; + /** Returns @true if the display is the primary display. The primary display is the one whose index is 0. diff --git a/interface/wx/gdicmn.h b/interface/wx/gdicmn.h index 2033b5461d..0e8ffd53c8 100644 --- a/interface/wx/gdicmn.h +++ b/interface/wx/gdicmn.h @@ -1256,6 +1256,10 @@ wxRect wxGetClientDisplayRect(); The @c x component of the returned wxSize object contains the horizontal resolution and the @c y one -- the vertical resolution. + @note Use of this function is not recommended in the new code as it only + works for the primary display. Use wxDisplay::GetPPI() to retrieve + the resolution of the appropriate display instead. + @header{wx/gdicmn.h} @see wxDisplay diff --git a/interface/wx/vidmode.h b/interface/wx/vidmode.h index b8a1bcf7ff..9097e67b23 100644 --- a/interface/wx/vidmode.h +++ b/interface/wx/vidmode.h @@ -15,8 +15,6 @@ @stdobjects ::wxDefaultVideoMode - - @see wxClientDisplayRect(), wxDisplaySize(), wxDisplaySizeMM() */ struct wxVideoMode { diff --git a/samples/display/display.cpp b/samples/display/display.cpp index 5b715f88ec..7996eac945 100644 --- a/samples/display/display.cpp +++ b/samples/display/display.cpp @@ -275,6 +275,11 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, rc.x, rc.y, rc.width, rc.height) )); + sizer->Add(new wxStaticText(page, wxID_ANY, "Resolution: ")); + const wxSize ppi = display.GetPPI(); + sizer->Add(new wxStaticText(page, wxID_ANY, + wxString::Format("%d*%d", ppi.x, ppi.y))); + sizer->Add(new wxStaticText(page, wxID_ANY, "Depth: ")); sizer->Add(new wxStaticText(page, wxID_ANY, wxString::Format("%d", display.GetDepth()))); diff --git a/src/common/dpycmn.cpp b/src/common/dpycmn.cpp index 9968f3cbfa..d0073ee32c 100644 --- a/src/common/dpycmn.cpp +++ b/src/common/dpycmn.cpp @@ -29,6 +29,8 @@ #include "wx/module.h" #endif //WX_PRECOMP +#include "wx/math.h" + #include "wx/private/display.h" #if wxUSE_DISPLAY @@ -122,6 +124,13 @@ wxRect wxDisplay::GetClientArea() const return m_impl->GetClientArea(); } +wxSize wxDisplay::GetPPI() const +{ + wxCHECK_MSG( IsOk(), wxSize(), wxT("invalid wxDisplay object") ); + + return m_impl->GetPPI(); +} + int wxDisplay::GetDepth() const { wxCHECK_MSG( IsOk(), 0, wxT("invalid wxDisplay object") ); @@ -180,6 +189,26 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode) return *gs_factory; } +// ============================================================================ +// wxDisplayImpl implementation +// ============================================================================ + +wxSize wxDisplayImpl::GetPPI() const +{ + const wxSize pixels = GetGeometry().GetSize(); + const wxSize mm = GetSizeMM(); + + if ( !mm.x || !mm.y ) + { + // Physical size is unknown, return a special value indicating that we + // can't compute the resolution -- what else can we do? + return wxSize(0, 0); + } + + return wxSize(wxRound((pixels.x * inches2mm) / mm.x), + wxRound((pixels.y * inches2mm) / mm.y)); +} + // ============================================================================ // wxDisplayFactory implementation // ============================================================================ diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index a584eccc5f..0b2d514408 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -889,20 +889,29 @@ wxRect wxGetClientDisplayRect() return wxDisplay().GetClientArea(); } +void wxDisplaySizeMM(int *width, int *height) +{ + const wxSize size = wxGetDisplaySizeMM(); + if ( width ) + *width = size.x; + if ( height ) + *height = size.y; +} + wxSize wxGetDisplaySizeMM() { - int x, y; - wxDisplaySizeMM(& x, & y); - return wxSize(x, y); + const wxSize ppi = wxGetDisplayPPI(); + if ( !ppi.x || !ppi.y ) + return wxSize(0, 0); + + const wxSize pixels = wxGetDisplaySize(); + return wxSize(wxRound(pixels.x * inches2mm / ppi.x), + wxRound(pixels.y * inches2mm / ppi.y)); } wxSize wxGetDisplayPPI() { - const wxSize pixels = wxGetDisplaySize(); - const wxSize mm = wxGetDisplaySizeMM(); - - return wxSize((int)((pixels.x * inches2mm) / mm.x), - (int)((pixels.y * inches2mm) / mm.y)); + return wxDisplay().GetPPI(); } wxResourceCache::~wxResourceCache () diff --git a/src/dfb/utils.cpp b/src/dfb/utils.cpp index b4e97dc727..4cbd60253f 100644 --- a/src/dfb/utils.cpp +++ b/src/dfb/utils.cpp @@ -73,6 +73,13 @@ public: { return wxTheApp->GetDisplayMode().bpp; } + + virtual wxSize GetPPI() const wxOVERRIDE + { + // FIXME: there's no way to get physical resolution using the DirectDB + // API, we hardcode a commonly used value of 72dpi + return wxSize(72, 72); + } }; class wxDisplayFactorySingleDFB : public wxDisplayFactorySingle @@ -89,21 +96,6 @@ wxDisplayFactory* wxDisplay::CreateFactory() return new wxDisplayFactorySingleDFB; } -void wxDisplaySizeMM(int *width, int *height) -{ - // FIXME: there's no way to get physical resolution using the DirectDB - // API, we hardcode a commonly used value of 72dpi - #define DPI 72.0 - #define PX_TO_MM(x) (int(((x) / DPI) * inches2mm)) - - wxDisplaySize(width, height); - if ( width ) *width = PX_TO_MM(*width); - if ( height ) *height = PX_TO_MM(*height); - - #undef DPI - #undef PX_TO_MM -} - //----------------------------------------------------------------------------- // mouse //----------------------------------------------------------------------------- diff --git a/src/gtk/display.cpp b/src/gtk/display.cpp index 2cc424c8db..07e1fc45f3 100644 --- a/src/gtk/display.cpp +++ b/src/gtk/display.cpp @@ -46,6 +46,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetSizeMM() const wxOVERRIDE; #if wxUSE_DISPLAY virtual bool IsPrimary() const wxOVERRIDE; @@ -120,6 +121,15 @@ int wxDisplayImplGTK::GetDepth() const return 24; } +wxSize wxDisplayImplGTK::GetSizeMM() const +{ + return wxSize + ( + gdk_monitor_get_width_mm(m_monitor), + gdk_monitor_get_height_mm(m_monitor) + ); +} + #if wxUSE_DISPLAY bool wxDisplayImplGTK::IsPrimary() const { @@ -212,6 +222,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetSizeMM() const wxOVERRIDE; #if wxUSE_DISPLAY virtual bool IsPrimary() const wxOVERRIDE; @@ -282,6 +293,34 @@ int wxDisplayImplGTK::GetDepth() const return gdk_visual_get_depth(gdk_window_get_visual(wxGetTopLevelGDK())); } +wxSize wxDisplayImplGTK::GetSizeMM() const +{ + // At least in some configurations, gdk_screen_xxx_mm() functions return + // valid values when gdk_screen_get_monitor_xxx_mm() only return -1, so + // handle this case specially. + if ( IsPrimary() ) + { + return wxSize(gdk_screen_width_mm(), gdk_screen_height_mm()); + } + + wxSize sizeMM; +#if GTK_CHECK_VERSION(2,14,0) + if ( wx_is_at_least_gtk2(14) ) + { + // Take care not to return (-1, -1) from here, the caller expects us to + // return (0, 0) if we can't retrieve this information. + int rc = gdk_screen_get_monitor_width_mm(m_screen, m_index); + if ( rc != -1 ) + sizeMM.x = rc; + + rc = gdk_screen_get_monitor_height_mm(m_screen, m_index); + if ( rc != -1 ) + sizeMM.y = rc; + } +#endif // GTK+ 2.14 + return sizeMM; +} + #if wxUSE_DISPLAY bool wxDisplayImplGTK::IsPrimary() const { diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index f0a36126f1..137fb2cf16 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -76,20 +76,6 @@ void *wxGetDisplay() } #endif -void wxDisplaySizeMM( int *width, int *height ) -{ -#ifdef __WXGTK4__ - GdkMonitor* monitor = gdk_display_get_primary_monitor(gdk_display_get_default()); - if (width) *width = gdk_monitor_get_width_mm(monitor); - if (height) *height = gdk_monitor_get_height_mm(monitor); -#else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - if (width) *width = gdk_screen_width_mm(); - if (height) *height = gdk_screen_height_mm(); - wxGCC_WARNING_RESTORE() -#endif -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index bdcadfa5e7..b84627535e 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -86,12 +86,6 @@ void *wxGetDisplay() return GDK_DISPLAY(); } -void wxDisplaySizeMM( int *width, int *height ) -{ - if (width) *width = gdk_screen_width_mm(); - if (height) *height = gdk_screen_height_mm(); -} - void wxGetMousePosition( int* x, int* y ) { gdk_window_get_pointer( NULL, x, y, NULL ); diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 87a1af7da0..480faad86e 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -225,16 +225,6 @@ void wxGetMousePosition( int* x, int* y ) #endif } -void wxDisplaySizeMM(int *width, int *height) -{ - Display *dpy = wxGlobalDisplay(); - - if ( width ) - *width = DisplayWidthMM(dpy, DefaultScreen (dpy)); - if ( height ) - *height = DisplayHeightMM(dpy, DefaultScreen (dpy)); -} - // Configurable display in wxX11 and wxMotif static WXDisplay *gs_currentDisplay = NULL; static wxString gs_displayName; diff --git a/src/msw/display.cpp b/src/msw/display.cpp index e6ea6486a8..6fd48acd44 100644 --- a/src/msw/display.cpp +++ b/src/msw/display.cpp @@ -26,9 +26,14 @@ #include "wx/private/display.h" +#include "wx/dynlib.h" + #include "wx/msw/private.h" #include "wx/msw/wrapwin.h" +namespace +{ + int wxGetHDCDepth(HDC hdc) { return ::GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL); @@ -62,6 +67,13 @@ public: { return wxGetHDCDepth(ScreenHDC()); } + + virtual wxSize GetSizeMM() const wxOVERRIDE + { + ScreenHDC dc; + + return wxSize(::GetDeviceCaps(dc, HORZSIZE), ::GetDeviceCaps(dc, VERTSIZE)); + } }; class wxDisplayFactorySingleMSW : public wxDisplayFactorySingle @@ -73,6 +85,8 @@ protected: } }; +} // anonymous namespace + #if wxUSE_DISPLAY #ifndef WX_PRECOMP @@ -87,6 +101,10 @@ protected: #include "wx/msw/missing.h" #include "wx/msw/private/hiddenwin.h" +#ifndef DPI_ENUMS_DECLARED + #define MDT_EFFECTIVE_DPI 0 +#endif + static const wxChar displayDllName[] = wxT("user32.dll"); namespace @@ -119,6 +137,8 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetPPI() const wxOVERRIDE; + virtual wxString GetName() const wxOVERRIDE; virtual bool IsPrimary() const wxOVERRIDE; @@ -176,6 +196,13 @@ public: // handles. static void RefreshMonitors() { ms_factory->DoRefreshMonitors(); } + // Declare the second argument as int to avoid problems with older SDKs not + // declaring MONITOR_DPI_TYPE enum. + typedef HRESULT (WINAPI *GetDpiForMonitor_t)(HMONITOR, int, UINT*, UINT*); + + // Return the pointer to GetDpiForMonitor() function which may be null if + // not running under new enough Windows version. + static GetDpiForMonitor_t GetDpiForMonitorPtr(); private: // EnumDisplayMonitors() callback @@ -197,6 +224,48 @@ private: // variable (also making it of correct type for us) here). static wxDisplayFactoryMSW* ms_factory; + // The pointer to GetDpiForMonitorPtr(), retrieved on demand, and the + // related data, including the DLL containing the function that we must + // keep loaded. + struct GetDpiForMonitorData + { + GetDpiForMonitorData() + { + m_pfnGetDpiForMonitor = NULL; + m_initialized = false; + } + + bool TryLoad() + { + if ( !m_dllShcore.Load("shcore.dll", wxDL_VERBATIM | wxDL_QUIET) ) + return false; + + wxDL_INIT_FUNC(m_pfn, GetDpiForMonitor, m_dllShcore); + + if ( !m_pfnGetDpiForMonitor ) + { + m_dllShcore.Unload(); + return false; + } + + return true; + } + + void UnloadIfNecessary() + { + if ( m_dllShcore.IsLoaded() ) + { + m_dllShcore.Unload(); + m_pfnGetDpiForMonitor = NULL; + } + } + + wxDynamicLibrary m_dllShcore; + GetDpiForMonitor_t m_pfnGetDpiForMonitor; + bool m_initialized; + }; + static GetDpiForMonitorData ms_getDpiForMonitorData; + // the array containing information about all available displays, filled by // MultimonEnumProc() @@ -211,6 +280,8 @@ private: }; wxDisplayFactoryMSW* wxDisplayFactoryMSW::ms_factory = NULL; +wxDisplayFactoryMSW::GetDpiForMonitorData + wxDisplayFactoryMSW::ms_getDpiForMonitorData; // ---------------------------------------------------------------------------- // wxDisplay implementation @@ -272,6 +343,24 @@ int wxDisplayMSW::GetDepth() const return m_info.depth; } +wxSize wxDisplayMSW::GetPPI() const +{ + if ( const wxDisplayFactoryMSW::GetDpiForMonitor_t + getFunc = wxDisplayFactoryMSW::GetDpiForMonitorPtr() ) + { + UINT dpiX = 0, + dpiY = 0; + const HRESULT + hr = (*getFunc)(m_info.hmon, MDT_EFFECTIVE_DPI, &dpiX, &dpiY); + if ( SUCCEEDED(hr) ) + return wxSize(dpiX, dpiY); + + wxLogApiError("GetDpiForMonitor", hr); + } + + return IsPrimary() ? wxDisplayImplSingleMSW().GetPPI() : wxSize(0, 0); +} + wxString wxDisplayMSW::GetName() const { WinStruct monInfo; @@ -492,9 +581,28 @@ wxDisplayFactoryMSW::~wxDisplayFactoryMSW() } } + if ( ms_getDpiForMonitorData.m_initialized ) + { + ms_getDpiForMonitorData.UnloadIfNecessary(); + ms_getDpiForMonitorData.m_initialized = false; + } + ms_factory = NULL; } +/* static */ +wxDisplayFactoryMSW::GetDpiForMonitor_t +wxDisplayFactoryMSW::GetDpiForMonitorPtr() +{ + if ( !ms_getDpiForMonitorData.m_initialized ) + { + ms_getDpiForMonitorData.m_initialized = true; + ms_getDpiForMonitorData.TryLoad(); + } + + return ms_getDpiForMonitorData.m_pfnGetDpiForMonitor; +} + void wxDisplayFactoryMSW::DoRefreshMonitors() { m_displays.clear(); diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index 9ac17ef4b1..7c7bfcf07c 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -117,16 +117,6 @@ void wxGetMousePosition( int* x, int* y ) if ( y ) *y = pt.y; } -void wxDisplaySizeMM(int *width, int *height) -{ - ScreenHDC dc; - - if ( width ) - *width = ::GetDeviceCaps(dc, HORZSIZE); - if ( height ) - *height = ::GetDeviceCaps(dc, VERTSIZE); -} - // --------------------------------------------------------------------------- // window information functions // --------------------------------------------------------------------------- diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 2e55b346b8..395ef7a8c2 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -75,6 +75,12 @@ int wxGetDisplayDepth(CGDirectDisplayID id) return theDepth; } +wxSize wxGetDisplaySizeMM(CGDirectDisplayID id) +{ + const CGSize size = CGDisplayScreenSize(id); + return wxSize(wxRound(size.width), wxRound(size.height)); +} + } // anonymous namespace #if wxUSE_DISPLAY @@ -97,6 +103,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetSizeMM() const wxOVERRIDE; virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; @@ -258,6 +265,11 @@ int wxDisplayImplMacOSX::GetDepth() const return wxGetDisplayDepth(m_id); } +wxSize wxDisplayImplMacOSX::GetSizeMM() const +{ + return wxGetDisplaySizeMM(m_id); +} + static int wxOSXCGDisplayModeGetBitsPerPixel( CGDisplayModeRef theValue ) { wxCFRef pixelEncoding( CGDisplayModeCopyPixelEncoding(theValue) ); @@ -373,6 +385,11 @@ public: { return wxGetDisplayDepth(CGMainDisplayID()); } + + virtual wxSize GetSizeMM() const wxOVERRIDE + { + return wxGetDisplaySizeMM(CGMainDisplayID()); + } }; class wxDisplayFactorySingleMacOSX : public wxDisplayFactorySingle diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index dd77cfd5e6..af0239e939 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -160,6 +160,11 @@ public: { return 32; // TODO can we determine this ? } + + virtual wxSize GetPPI() const wxOVERRIDE + { + return wxSize(72, 72); + } }; class wxDisplayFactorySingleiOS : public wxDisplayFactorySingle diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index b1c1975997..2350f16cb6 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -106,28 +106,6 @@ bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) #endif -void wxDisplaySizeMM(int *width, int *height) -{ -#if wxOSX_USE_IPHONE - wxDisplaySize(width, height); - // on mac 72 is fixed (at least now;-) - double cvPt2Mm = 25.4 / 72; - - if (width != NULL) - *width = int( *width * cvPt2Mm ); - - if (height != NULL) - *height = int( *height * cvPt2Mm ); -#else - CGSize size = CGDisplayScreenSize(CGMainDisplayID()); - if ( width ) - *width = (int)size.width ; - if ( height ) - *height = (int)size.height; -#endif -} - - wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin, int *verMicro) const diff --git a/src/qt/display.cpp b/src/qt/display.cpp index 6d3de3ac2e..18eb47e286 100644 --- a/src/qt/display.cpp +++ b/src/qt/display.cpp @@ -22,6 +22,7 @@ public: virtual wxRect GetGeometry() const wxOVERRIDE; virtual wxRect GetClientArea() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE; + virtual wxSize GetSizeMM() const wxOVERRIDE; #if wxUSE_DISPLAY virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; @@ -50,6 +51,13 @@ int wxDisplayImplQt::GetDepth() const return IsPrimary() ? QApplication::desktop()->depth() : 0; } +wxSize wxDisplayImplQt::GetSizeMM() const +{ + return IsPrimary() ? wxSize(QApplication::desktop()->widthMM(), + QApplication::desktop()->heightMM()) + : wxSize(0, 0); +} + #if wxUSE_DISPLAY wxArrayVideoModes wxDisplayImplQt::GetModes(const wxVideoMode& WXUNUSED(mode)) const { diff --git a/src/qt/utils.cpp b/src/qt/utils.cpp index fb6dce807e..428e9e3dd5 100644 --- a/src/qt/utils.cpp +++ b/src/qt/utils.cpp @@ -110,14 +110,6 @@ bool wxGetKeyState(wxKeyCode key) } } -void wxDisplaySizeMM(int *width, int *height) -{ - if ( width != NULL ) - *width = QApplication::desktop()->widthMM(); - if ( height != NULL ) - *height = QApplication::desktop()->heightMM(); -} - void wxBell() { QApplication::beep(); diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp index b352e5392f..e2e67970c0 100644 --- a/src/unix/displayx11.cpp +++ b/src/unix/displayx11.cpp @@ -44,6 +44,17 @@ inline int wxGetMainScreenDepth() return DefaultDepth(dpy, DefaultScreen (dpy)); } +inline wxSize wxGetMainScreenSizeMM() +{ + Display* const dpy = wxGetX11Display(); + + return wxSize + ( + DisplayWidthMM(dpy, DefaultScreen(dpy)), + DisplayHeightMM(dpy, DefaultScreen(dpy)) + ); +} + class wxDisplayImplSingleX11 : public wxDisplayImplSingle { public: @@ -65,6 +76,11 @@ public: { return wxGetMainScreenDepth(); } + + virtual wxSize GetSizeMM() const wxOVERRIDE + { + return wxGetMainScreenSizeMM(); + } }; class wxDisplayFactorySingleX11 : public wxDisplayFactorySingle @@ -143,6 +159,11 @@ public: return wxGetMainScreenDepth(); } + virtual wxSize GetSizeMM() const wxOVERRIDE + { + // TODO: how to get physical size or resolution of the other monitors? + return IsPrimary() ? wxGetMainScreenSizeMM() : wxSize(0, 0); + } virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const wxOVERRIDE; virtual wxVideoMode GetCurrentMode() const wxOVERRIDE; diff --git a/src/x11/utils.cpp b/src/x11/utils.cpp index a5d71d4046..16e7995eba 100644 --- a/src/x11/utils.cpp +++ b/src/x11/utils.cpp @@ -148,16 +148,6 @@ void wxGetMousePosition( int* x, int* y ) #endif }; -void wxDisplaySizeMM(int *width, int *height) -{ - Display *dpy = (Display*) wxGetDisplay(); - - if ( width ) - *width = DisplayWidthMM(dpy, DefaultScreen (dpy)); - if ( height ) - *height = DisplayHeightMM(dpy, DefaultScreen (dpy)); -} - wxWindow* wxFindWindowAtPoint(const wxPoint& pt) { return wxGenericFindWindowAtPoint(pt); From 5d3d6135e07741c630992afdf26e11e2d27c132d Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 8 Oct 2018 21:47:46 -0700 Subject: [PATCH 089/231] Fix wxRenderer for GTK+2 with wxGCDC created from wxMemoryDC See #18242 --- src/gtk/renderer.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 55ad311725..32433bdf0e 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -34,7 +34,11 @@ #include "wx/dcgraph.h" #ifndef __WXGTK3__ -#include "wx/gtk/dc.h" + #include "wx/gtk/dc.h" + #if wxUSE_GRAPHICS_CONTEXT + #include + #include + #endif #endif #include "wx/gtk/private.h" @@ -166,14 +170,25 @@ static const GtkStateFlags stateTypeToFlags[] = { #define NULL_RECT NULL, typedef GdkWindow wxGTKDrawable; -static GdkWindow* wxGetGTKDrawable(wxWindow* win, wxDC& dc) +static GdkWindow* wxGetGTKDrawable(wxWindow*, wxDC& dc) { GdkWindow* gdk_window = NULL; #if wxUSE_GRAPHICS_CONTEXT - if ( wxDynamicCast(&dc, wxGCDC) ) - gdk_window = win->GTKGetDrawingWindow(); - else + cairo_t* cr = NULL; + wxGraphicsContext* gc = dc.GetGraphicsContext(); + if (gc) + cr = static_cast(gc->GetNativeContext()); + if (cr) + { + cairo_surface_t* surf = cairo_get_target(cr); + if (cairo_surface_get_type(surf) == CAIRO_SURFACE_TYPE_XLIB) + { + gdk_window = static_cast( + gdk_xid_table_lookup(cairo_xlib_surface_get_drawable(surf))); + } + } + if (gdk_window == NULL) #endif { wxDCImpl *impl = dc.GetImpl(); @@ -184,10 +199,6 @@ static GdkWindow* wxGetGTKDrawable(wxWindow* win, wxDC& dc) wxFAIL_MSG("cannot use wxRendererNative on wxDC of this type"); } -#if !wxUSE_GRAPHICS_CONTEXT - wxUnusedVar(win); -#endif - return gdk_window; } #endif From e160cb37b643bc24cbaaccf8496cfe3c021f80ef Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 8 Oct 2018 22:01:05 -0700 Subject: [PATCH 090/231] Remove unused wxWindow parameter --- src/gtk/renderer.cpp | 47 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 32433bdf0e..1c425261dc 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -153,7 +153,7 @@ wxRendererNative& wxRendererNative::GetDefault() #define NULL_RECT typedef cairo_t wxGTKDrawable; -static cairo_t* wxGetGTKDrawable(wxWindow*, const wxDC& dc) +static cairo_t* wxGetGTKDrawable(const wxDC& dc) { wxGraphicsContext* gc = dc.GetGraphicsContext(); wxCHECK_MSG(gc, NULL, "cannot use wxRendererNative on wxDC of this type"); @@ -170,7 +170,7 @@ static const GtkStateFlags stateTypeToFlags[] = { #define NULL_RECT NULL, typedef GdkWindow wxGTKDrawable; -static GdkWindow* wxGetGTKDrawable(wxWindow*, wxDC& dc) +static GdkWindow* wxGetGTKDrawable(wxDC& dc) { GdkWindow* gdk_window = NULL; @@ -235,7 +235,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, } #ifdef __WXGTK3__ - cairo_t* cr = wxGetGTKDrawable(win, dc); + cairo_t* cr = wxGetGTKDrawable(dc); if (cr == NULL) return 0; @@ -266,7 +266,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, gtk_style_context_restore(sc); } #else - GdkWindow* gdk_window = wxGetGTKDrawable(win, dc); + GdkWindow* gdk_window = wxGetGTKDrawable(dc); gtk_paint_box ( gtk_widget_get_style(button), @@ -308,7 +308,7 @@ void wxRendererGTK::DrawTreeItemButton(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -417,7 +417,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, return; } - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -458,7 +458,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, flags & wxCONTROL_CURRENT ? GTK_STATE_FLAG_PRELIGHT : GTK_STATE_FLAG_NORMAL); gtk_render_handle(sc, drawable, rect.x - x_diff, rect.y, rect.width, rect.height); #else - GdkWindow* gdk_window = wxGetGTKDrawable(win, dc); + GdkWindow* gdk_window = wxGetGTKDrawable(dc); if (gdk_window == NULL) return; gtk_paint_handle @@ -480,7 +480,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, } void -wxRendererGTK::DrawDropArrow(wxWindow* win, +wxRendererGTK::DrawDropArrow(wxWindow*, wxDC& dc, const wxRect& rect, int flags) @@ -511,7 +511,7 @@ wxRendererGTK::DrawDropArrow(wxWindow* win, state = GTK_STATE_NORMAL; #ifdef __WXGTK3__ - cairo_t* cr = wxGetGTKDrawable(win, dc); + cairo_t* cr = wxGetGTKDrawable(dc); if (cr) { gtk_widget_set_state_flags(button, stateTypeToFlags[state], true); @@ -519,7 +519,7 @@ wxRendererGTK::DrawDropArrow(wxWindow* win, gtk_render_arrow(sc, cr, G_PI, x, y, size); } #else - GdkWindow* gdk_window = wxGetGTKDrawable(win, dc); + GdkWindow* gdk_window = wxGetGTKDrawable(dc); if (gdk_window == NULL) return; // draw arrow on button @@ -593,7 +593,7 @@ wxRendererGTK::GetCheckBoxSize(wxWindow *WXUNUSED(win)) } void -wxRendererGTK::DrawCheckBox(wxWindow* win, +wxRendererGTK::DrawCheckBox(wxWindow*, wxDC& dc, const wxRect& rect, int flags ) @@ -629,7 +629,7 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, #endif #ifdef __WXGTK3__ - cairo_t* cr = wxGetGTKDrawable(win, dc); + cairo_t* cr = wxGetGTKDrawable(dc); if (cr == NULL) return; @@ -677,7 +677,7 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, gtk_render_check(sc, cr, x, y, min_width, min_height); gtk_style_context_restore(sc); #else - GdkWindow* gdk_window = wxGetGTKDrawable(win, dc); + GdkWindow* gdk_window = wxGetGTKDrawable(dc); if (gdk_window == NULL) return; @@ -698,7 +698,7 @@ wxRendererGTK::DrawCheckBox(wxWindow* win, } void -wxRendererGTK::DrawPushButton(wxWindow* win, +wxRendererGTK::DrawPushButton(wxWindow*, wxDC& dc, const wxRect& rect, int flags) @@ -718,7 +718,7 @@ wxRendererGTK::DrawPushButton(wxWindow* win, state = GTK_STATE_NORMAL; #ifdef __WXGTK3__ - cairo_t* cr = wxGetGTKDrawable(win, dc); + cairo_t* cr = wxGetGTKDrawable(dc); if (cr) { GtkStyleContext* sc = gtk_widget_get_style_context(button); @@ -729,7 +729,7 @@ wxRendererGTK::DrawPushButton(wxWindow* win, gtk_style_context_restore(sc); } #else - GdkWindow* gdk_window = wxGetGTKDrawable(win, dc); + GdkWindow* gdk_window = wxGetGTKDrawable(dc); if (gdk_window == NULL) return; @@ -756,7 +756,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, const wxRect& rect, int flags ) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -801,7 +801,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win, void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -832,9 +832,9 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i } // Uses the theme to draw the border and fill for something like a wxTextCtrl -void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) +void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int flags) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -880,7 +880,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in // Draw the equivalent of a wxComboBox void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; @@ -904,6 +904,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in r.width = r.height; DrawComboBoxDropButton(win, dc, r, flags); #else + wxUnusedVar(win); gtk_paint_shadow ( gtk_widget_get_style(combo), @@ -972,9 +973,9 @@ void wxRendererGTK::DrawChoice(wxWindow* win, wxDC& dc, // Draw a themed radio button -void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags) +void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int flags) { - wxGTKDrawable* drawable = wxGetGTKDrawable(win, dc); + wxGTKDrawable* drawable = wxGetGTKDrawable(dc); if (drawable == NULL) return; From 11f80e3e34ed147155c228cce1d99836bc67cce1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Oct 2018 15:10:11 +0200 Subject: [PATCH 091/231] Clarify wording of wxDataViewEvent::GetColumn() documentation Just that the column is -1 if it's not available instead of speaking about "event emitter" that people find confusing. --- interface/wx/dataview.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index e3e10e25fc..84c7479df8 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -3746,10 +3746,9 @@ public: */ wxDataViewEvent(const wxDataViewEvent& event); - /** Returns the position of the column in the control or -1 - if no column field was set by the event emitter. + if column field is unavailable for this event. For wxEVT_DATAVIEW_COLUMN_REORDERED, this is the new position of the column. From 818d69f11390ba7efc31e1365fe41fd5dbf92441 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Oct 2018 15:12:42 +0200 Subject: [PATCH 092/231] Make wxDataViewCtrl::FromGTKColumn() public and rename This function has to be called from a GTK+ callback, so make it public and also rename to GTKColumnToWX() to conform to the naming convention mandating the use of "GTK" prefix for the public methods which are not part of the public API. --- include/wx/gtk/dataview.h | 12 ++++++------ src/gtk/dataview.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/wx/gtk/dataview.h b/include/wx/gtk/dataview.h index c6724e7e97..77a06dc6e6 100644 --- a/include/wx/gtk/dataview.h +++ b/include/wx/gtk/dataview.h @@ -185,6 +185,12 @@ public: // failed. wxDataViewItem GTKPathToItem(struct _GtkTreePath *path) const; + // Return wxDataViewColumn matching the given GtkTreeViewColumn. + // + // If the input argument is NULL, return NULL too. Otherwise we must find + // the matching column and assert if we didn't. + wxDataViewColumn* GTKColumnToWX(GtkTreeViewColumn *gtk_col) const; + virtual void OnInternalIdle() wxOVERRIDE; int GTKGetUniformRowHeight() const { return m_uniformRowHeight; } @@ -222,12 +228,6 @@ private: virtual wxDataViewItem DoGetCurrentItem() const wxOVERRIDE; virtual void DoSetCurrentItem(const wxDataViewItem& item) wxOVERRIDE; - // Return wxDataViewColumn matching the given GtkTreeViewColumn. - // - // If the input argument is NULL, return NULL too. Otherwise we must find - // the matching column and assert if we didn't. - wxDataViewColumn* FromGTKColumn(GtkTreeViewColumn *gtk_col) const; - friend class wxDataViewCtrlDCImpl; friend class wxDataViewColumn; friend class wxDataViewCtrlInternal; diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 97476600e1..b0ab353be1 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -4617,7 +4617,7 @@ wxDataViewCtrl::~wxDataViewCtrl() GtkTreeViewColumn *col; gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); - wxDataViewColumn * const wxcol = FromGTKColumn(col); + wxDataViewColumn * const wxcol = GTKColumnToWX(col); if ( wxcol ) { // This won't do anything if we're not editing it @@ -4862,7 +4862,7 @@ unsigned int wxDataViewCtrl::GetColumnCount() const return m_cols.GetCount(); } -wxDataViewColumn* wxDataViewCtrl::FromGTKColumn(GtkTreeViewColumn *gtk_col) const +wxDataViewColumn* wxDataViewCtrl::GTKColumnToWX(GtkTreeViewColumn *gtk_col) const { if ( !gtk_col ) return NULL; @@ -4886,7 +4886,7 @@ wxDataViewColumn* wxDataViewCtrl::GetColumn( unsigned int pos ) const { GtkTreeViewColumn *gtk_col = gtk_tree_view_get_column( GTK_TREE_VIEW(m_treeview), pos ); - return FromGTKColumn(gtk_col); + return GTKColumnToWX(gtk_col); } bool wxDataViewCtrl::DeleteColumn( wxDataViewColumn *column ) @@ -5058,7 +5058,7 @@ wxDataViewColumn *wxDataViewCtrl::GetCurrentColumn() const GtkTreeViewColumn *col; gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), NULL, &col); - return FromGTKColumn(col); + return GTKColumnToWX(col); } void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) From aafb87b40d340ae199baaa5d9145ed450df02bb7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Oct 2018 15:13:53 +0200 Subject: [PATCH 093/231] Set the column for wxEVT_DATAVIEW_ITEM_ACTIVATED in wxGTK The column is available in the GTK+ callback, so just pass it along to avoid gratuitous inconsistency with the generic version. Also update the sample to show the column value for these events. --- docs/changes.txt | 1 + samples/dataview/dataview.cpp | 3 ++- src/gtk/dataview.cpp | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index f229181029..f255964d9d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -135,6 +135,7 @@ wxGTK: - Fix not showing wxInfoBar with GTK+ 3 < 3.22.29. - Fix the build with glib < 2.32 (e.g. CentOS 6). - Fix field widths in wxStatusBar showing a size grip. +- Fill column value in wxEVT_DATAVIEW_ITEM_ACTIVATED events. wxMSW: diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index 852be2f15f..51273a6106 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -1214,7 +1214,8 @@ void MyFrame::OnValueChanged( wxDataViewEvent &event ) void MyFrame::OnActivated( wxDataViewEvent &event ) { wxString title = m_music_model->GetTitle( event.GetItem() ); - wxLogMessage( "wxEVT_DATAVIEW_ITEM_ACTIVATED, Item: %s", title ); + wxLogMessage( "wxEVT_DATAVIEW_ITEM_ACTIVATED, Item: %s; Column: %d", + title, event.GetColumn() ); if (m_ctrl[0]->IsExpanded( event.GetItem() )) { diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index b0ab353be1..8e1a6503a3 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -4461,10 +4461,11 @@ wxdataview_selection_changed_callback( GtkTreeSelection* WXUNUSED(selection), wx static void wxdataview_row_activated_callback( GtkTreeView* WXUNUSED(treeview), GtkTreePath *path, - GtkTreeViewColumn *WXUNUSED(column), wxDataViewCtrl *dv ) + GtkTreeViewColumn *column, wxDataViewCtrl *dv ) { wxDataViewItem item(dv->GTKPathToItem(path)); - wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_ACTIVATED, dv, item); + wxDataViewEvent + event(wxEVT_DATAVIEW_ITEM_ACTIVATED, dv, dv->GTKColumnToWX(column), item); dv->HandleWindowEvent( event ); } From 1a58c9c8ba4b09679537877491458116d57794a6 Mon Sep 17 00:00:00 2001 From: oneeyeman1 Date: Tue, 9 Oct 2018 15:25:18 +0200 Subject: [PATCH 094/231] Also fill the column for wxEVT_DATAVIEW_ITEM_ACTIVATED in wxOSX Similar to the previous commit. Closes https://github.com/wxWidgets/wxWidgets/pull/967 --- docs/changes.txt | 1 + src/osx/cocoa/dataview.mm | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index f255964d9d..0f8e04e1e5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -160,6 +160,7 @@ wxOSX: - Implement wxDataViewColumn::UnsetAsSortKey() (Daniel Kulp). - supporting native image formst like NSImage and UIImage in wxBitmap - native implementation for wxStaticBitmap for correct rendering of template images +- Fill column value in wxEVT_DATAVIEW_ITEM_ACTIVATED events (Igor Korot). wxQt: diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index eefabd7ed1..d7f6fc362b 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -1657,6 +1657,7 @@ outlineView:(NSOutlineView*)outlineView const wxDataViewItem item = wxDataViewItemFromItem([self itemAtRow:[self clickedRow]]); wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_ACTIVATED, dvc, item); + event.SetColumn( [self clickedColumn] ); dvc->GetEventHandler()->ProcessEvent(event); } From 28ab24cd5596e40cda866427ffa6cd16eff73e58 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Oct 2018 15:28:28 +0200 Subject: [PATCH 095/231] Add missing wxUSE_DISPLAY check to X11 display header Don't define functions dealing with video modes etc when wxUSE_DISPLAY==0. --- include/wx/unix/private/displayx11.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/wx/unix/private/displayx11.h b/include/wx/unix/private/displayx11.h index ea993ca249..0a139a1d3e 100644 --- a/include/wx/unix/private/displayx11.h +++ b/include/wx/unix/private/displayx11.h @@ -10,6 +10,10 @@ #ifndef _WX_UNIX_PRIVATE_DISPLAYX11_H_ #define _WX_UNIX_PRIVATE_DISPLAYX11_H_ +#include "wx/defs.h" + +#if wxUSE_DISPLAY + #include "wx/log.h" #include "wx/translation.h" @@ -145,6 +149,8 @@ wxArrayVideoModes wxX11_GetModes(const wxDisplayImpl* impl, const wxVideoMode& m #endif // !HAVE_X11_EXTENSIONS_XF86VMODE_H +#endif // wxUSE_DISPLAY + void wxGetWorkAreaX11(Screen* screen, int& x, int& y, int& width, int& height) { Display* display = DisplayOfScreen(screen); From 0db1d68084d81f8d52ea23b42e613d707a75db8e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Oct 2018 16:30:50 +0200 Subject: [PATCH 096/231] Document that wxHTML tag supports "bgcolor" attribute --- docs/doxygen/overviews/html.h | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/doxygen/overviews/html.h b/docs/doxygen/overviews/html.h index 623f98064f..6f12e32c35 100644 --- a/docs/doxygen/overviews/html.h +++ b/docs/doxygen/overviews/html.h @@ -505,6 +505,7 @@ DL DT EM FONT COLOR=[color] + BGCOLOR=[color] SIZE=[fontsize] FACE=[comma-separated list of facenames] HR ALIGN=[alignment] From 66e07d64659c64c4bd7032d4fb4579debd7a6b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 9 Oct 2018 16:48:57 +0200 Subject: [PATCH 097/231] Fix crash in wxMenu::MSWCommand if item is NULL --- src/msw/menu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 4705b802c9..5647690c01 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -793,9 +793,13 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_) UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND); checked = (menuState & MF_CHECKED) != 0; } - } - item->GetMenu()->SendEvent(id, checked); + item->GetMenu()->SendEvent(id, checked); + } + else + { + SendEvent(id, checked); + } } return true; From e351bd513b6361524637891a3fc87809415e1477 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 9 Oct 2018 22:18:34 -0700 Subject: [PATCH 098/231] Fix timepick configure option --- configure | 15 ++++++++------- configure.in | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 85663737e5..83e07fdcc2 100755 --- a/configure +++ b/configure @@ -1285,6 +1285,7 @@ enable_statusbar enable_taskbaricon enable_tbarnative enable_textctrl +enable_timepick enable_tipwindow enable_togglebtn enable_toolbar @@ -10905,23 +10906,23 @@ fi fi fi - # Check whether --enable-datepick was given. -if test "${enable_datepick+set}" = set; then : - enableval=$enable_datepick; + # Check whether --enable-timepick was given. +if test "${enable_timepick+set}" = set; then : + enableval=$enable_timepick; if test "$enableval" = yes; then - wx_cv_use_datepick='wxUSE_TIMEPICKCTRL=yes' + wx_cv_use_timepick='wxUSE_TIMEPICKCTRL=yes' else - wx_cv_use_datepick='wxUSE_TIMEPICKCTRL=no' + wx_cv_use_timepick='wxUSE_TIMEPICKCTRL=no' fi else - wx_cv_use_datepick='wxUSE_TIMEPICKCTRL=${'DEFAULT_wxUSE_TIMEPICKCTRL":-$defaultval}" + wx_cv_use_timepick='wxUSE_TIMEPICKCTRL=${'DEFAULT_wxUSE_TIMEPICKCTRL":-$defaultval}" fi - eval "$wx_cv_use_datepick" + eval "$wx_cv_use_timepick" enablestring= diff --git a/configure.in b/configure.in index 91a36fedd6..0678a9b1d6 100644 --- a/configure.in +++ b/configure.in @@ -952,7 +952,7 @@ WX_ARG_FEATURE(statusbar, [ --enable-statusbar use wxStatusBar class], w WX_ARG_FEATURE(taskbaricon, [ --enable-taskbaricon use wxTaskBarIcon class], wxUSE_TASKBARICON) WX_ARG_FEATURE(tbarnative, [ --enable-tbarnative use native wxToolBar class], wxUSE_TOOLBAR_NATIVE) WX_ARG_FEATURE(textctrl, [ --enable-textctrl use wxTextCtrl class], wxUSE_TEXTCTRL) -WX_ARG_FEATURE(datepick, [ --enable-timepick use wxTimePickerCtrl class], wxUSE_TIMEPICKCTRL) +WX_ARG_FEATURE(timepick, [ --enable-timepick use wxTimePickerCtrl class], wxUSE_TIMEPICKCTRL) WX_ARG_FEATURE(tipwindow, [ --enable-tipwindow use wxTipWindow class], wxUSE_TIPWINDOW) WX_ARG_FEATURE(togglebtn, [ --enable-togglebtn use wxToggleButton class], wxUSE_TOGGLEBTN) WX_ARG_FEATURE(toolbar, [ --enable-toolbar use wxToolBar class], wxUSE_TOOLBAR) From 4ad6f67147022535909159a9764e24f602402267 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 9 Oct 2018 22:24:58 -0700 Subject: [PATCH 099/231] Fix build with wxUSE_PALETTE==0 --- include/wx/dcsvg.h | 2 ++ include/wx/generic/dcpsg.h | 2 ++ include/wx/gtk/print.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h index 488d0c3057..0c4fdd575a 100644 --- a/include/wx/dcsvg.h +++ b/include/wx/dcsvg.h @@ -86,10 +86,12 @@ public: virtual wxCoord GetCharHeight() const wxOVERRIDE; virtual wxCoord GetCharWidth() const wxOVERRIDE; +#if wxUSE_PALETTE virtual void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented")); } +#endif virtual void SetLogicalFunction(wxRasterOperationMode WXUNUSED(function)) wxOVERRIDE { diff --git a/include/wx/generic/dcpsg.h b/include/wx/generic/dcpsg.h index 972f533475..84f9e6690e 100644 --- a/include/wx/generic/dcpsg.h +++ b/include/wx/generic/dcpsg.h @@ -79,7 +79,9 @@ public: virtual void ComputeScaleAndOrigin() wxOVERRIDE; void SetBackgroundMode(int WXUNUSED(mode)) wxOVERRIDE { } +#if wxUSE_PALETTE void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } +#endif void SetPrintData(const wxPrintData& data); wxPrintData& GetPrintData() { return m_printData; } diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index 66e42100f3..5c54286eb3 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -245,7 +245,9 @@ public: wxSize GetPPI() const wxOVERRIDE; virtual int GetDepth() const wxOVERRIDE { return 24; } void SetBackgroundMode(int mode) wxOVERRIDE; +#if wxUSE_PALETTE void SetPalette(const wxPalette& WXUNUSED(palette)) wxOVERRIDE { } +#endif void SetResolution(int ppi); // overridden for wxPrinterDC Impl From fe9f25c7ce11d7e84c0aaba7a11fa0b1a4aaae56 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 10 Oct 2018 11:08:31 +0000 Subject: [PATCH 100/231] Add download update instructions "how to release" documentation --- docs/contributing/how-to-release.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/contributing/how-to-release.md b/docs/contributing/how-to-release.md index 1e7b1a74f2..1bb19afe71 100644 --- a/docs/contributing/how-to-release.md +++ b/docs/contributing/how-to-release.md @@ -117,8 +117,12 @@ Create https://docs.wxwidgets.org/x.y.z/ (ask Bryan to do it if not done yet). ## Announcement -Update https://www.wxwidgets.org, usually a news item is enough but something -more can be called for for major releases. +Update https://www.wxwidgets.org: +* Update release information (at least `version` and `released`) in `_data/relases.yml`. +* Download information can then be updated by running `update_release_info.rb`. + This will update the asset information from GitHub. +* Add a news item. Usually a news item is enough but something + more can be called for for major releases Post `docs/publicity/announce.txt` at least to wx-announce@googlegroups.com and to wx-users for the important releases. From 4b8dee1066c41f3d629fd1822df9982c8c633a66 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 10 Oct 2018 11:59:10 +0000 Subject: [PATCH 101/231] Update where to post in "How to release" documentation --- docs/contributing/how-to-release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing/how-to-release.md b/docs/contributing/how-to-release.md index 1bb19afe71..18d59664f8 100644 --- a/docs/contributing/how-to-release.md +++ b/docs/contributing/how-to-release.md @@ -125,7 +125,7 @@ Update https://www.wxwidgets.org: more can be called for for major releases Post `docs/publicity/announce.txt` at least to wx-announce@googlegroups.com and -to wx-users for the important releases. +to wx-users. Submit a link to https://www.reddit.com/r/programming From e9ecc6728f45eee7eebe4691a55181ac90f8b281 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Oct 2018 14:14:48 +0200 Subject: [PATCH 102/231] Always include X11 headers from the private X11 display header Commit 28ab24cd5596e40cda866427ffa6cd16eff73e58 excluded too much in wxUSE_DISPLAY==0 case, we still need X11 headers when not using wxUSE_DISPLAY. --- include/wx/unix/private/displayx11.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/unix/private/displayx11.h b/include/wx/unix/private/displayx11.h index 0a139a1d3e..c78b213b09 100644 --- a/include/wx/unix/private/displayx11.h +++ b/include/wx/unix/private/displayx11.h @@ -12,14 +12,14 @@ #include "wx/defs.h" +#include +#include + #if wxUSE_DISPLAY #include "wx/log.h" #include "wx/translation.h" -#include -#include - #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H #include From b0c025e9fda24751e878b93d3740fc96fa458ba4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Oct 2018 19:06:11 +0200 Subject: [PATCH 103/231] Build fix for wxUSE_CONSOLE_EVENTLOOP==0 under Unix Don't declare GetEventLoopSourcesManager() in Unix wxAppTraits if console event loops are not used. See https://github.com/wxWidgets/wxWidgets/pull/953 --- include/wx/unix/apptbase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index ff41981407..5ce97d6837 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -48,11 +48,11 @@ public: virtual wxFDIOManager *GetFDIOManager(); #endif // wxUSE_SOCKETS -#if wxUSE_EVENTLOOP_SOURCE +#if wxUSE_CONSOLE_EVENTLOOP && wxUSE_EVENTLOOP_SOURCE // Return a non-NULL pointer to the object responsible for managing the // event loop sources in this kind of application. virtual wxEventLoopSourcesManagerBase* GetEventLoopSourcesManager(); -#endif // wxUSE_CONSOLE_EVENTLOOP +#endif // wxUSE_CONSOLE_EVENTLOOP && wxUSE_CONSOLE_EVENTLOOP protected: // Wait for the process termination by running the given event loop until From 1a31420e92c38c5a14ea65588db8ecdfd331a0eb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 10 Oct 2018 10:52:36 -0700 Subject: [PATCH 104/231] Add wxACC_SELF and fix parameter name (cherry picked from commit b75f473ea3e2ee081a4ce0038a3102fa7a000b34) --- interface/wx/access.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/wx/access.h b/interface/wx/access.h index 53284b525d..068f76e057 100644 --- a/interface/wx/access.h +++ b/interface/wx/access.h @@ -25,6 +25,11 @@ enum wxAccStatus }; +/** Child ids are integer identifiers from 1 up. + So zero represents 'this' object. +*/ +#define wxACC_SELF 0 + /** This enum represents directions of navigation used in wxAccessible::Navigate(). @@ -495,7 +500,7 @@ public: */ static void NotifyEvent(int eventType, wxWindow* window, wxAccObject objectType, - int objectType); + int objectId); /** Selects the object or child. See wxAccSelectionFlags for a list From a36868b391c79137d39720b276ee55f5dafeeec4 Mon Sep 17 00:00:00 2001 From: Maarten Date: Wed, 10 Oct 2018 23:53:38 +0200 Subject: [PATCH 105/231] CMake: only enable flash sample for MSVC Fixes a regression from 1dfe088b. See https://github.com/wxWidgets/wxWidgets/pull/974 --- build/cmake/samples/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 09a299ffbd..47230283ba 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -273,6 +273,8 @@ if(WIN32) #TODO: reenable when sample is fixed #wx_add_sample(mfc mfctest.cpp mfctest.h resource.h stdafx.h RES mfctest.rc) wx_add_sample(taskbarbutton DEPENDS wxUSE_TASKBARBUTTON) - wx_add_sample(flash DEPENDS wxUSE_ACTIVEX) + if(MSVC) + wx_add_sample(flash DEPENDS wxUSE_ACTIVEX) + endif() endif() endif() From ea71ea1259bc3f1bc3b8d0763cb53981db7de08a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 11 Oct 2018 00:01:00 +0200 Subject: [PATCH 106/231] Check for non-null window in wxRendererNative::GetCheckBoxSize() Instead of running normally under some platforms and crashing under MSW (when using themes) when passing NULL to GetCheckBoxSize(), now consistently assert and return zero size everywhere. Closes #18241. --- interface/wx/renderer.h | 4 +++- src/generic/renderg.cpp | 2 ++ src/gtk/renderer.cpp | 7 ++++++- src/msw/renderer.cpp | 8 +++++++- src/osx/carbon/renderer.cpp | 7 ++++++- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/interface/wx/renderer.h b/interface/wx/renderer.h index 2a3772b78a..ddd4d3a1f8 100644 --- a/interface/wx/renderer.h +++ b/interface/wx/renderer.h @@ -552,7 +552,9 @@ public: /** Returns the size of a check box. - The @a win parameter is not used currently and can be @NULL. + + @param win A valid, i.e. non-null, window pointer which is used to get + the theme defining the checkbox size under some platforms. */ virtual wxSize GetCheckBoxSize(wxWindow* win) = 0; diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index fc2f39645d..eb5e1442c4 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -714,6 +714,8 @@ wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win), wxSize wxRendererGeneric::GetCheckBoxSize(wxWindow *win) { + wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" ); + return win->FromDIP(wxSize(16, 16)); } diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 1c425261dc..a65d6f27f6 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -551,8 +551,13 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win, } wxSize -wxRendererGTK::GetCheckBoxSize(wxWindow *WXUNUSED(win)) +wxRendererGTK::GetCheckBoxSize(wxWindow* win) { + // Even though we don't use the window in this implementation, still check + // that it's valid to avoid surprises when running the same code under the + // other platforms. + wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" ); + #ifdef __WXGTK3__ int min_width, min_height; wxGtkStyleContext sc; diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp index d94f0c582f..6d529a1946 100644 --- a/src/msw/renderer.cpp +++ b/src/msw/renderer.cpp @@ -521,8 +521,12 @@ wxRendererMSW::DrawTitleBarBitmap(wxWindow *win, DoDrawFrameControl(DFC_CAPTION, kind, win, dc, rect, flags); } -wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win)) +wxSize wxRendererMSW::GetCheckBoxSize(wxWindow* win) { + // Even though we don't use the window in this implementation, still check + // that it's valid to avoid surprises when using themes. + wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" ); + return wxSize(::GetSystemMetrics(SM_CXMENUCHECK), ::GetSystemMetrics(SM_CYMENUCHECK)); } @@ -830,6 +834,8 @@ wxRendererXP::DrawTitleBarBitmap(wxWindow *win, wxSize wxRendererXP::GetCheckBoxSize(wxWindow* win) { + wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" ); + wxUxThemeHandle hTheme(win, L"BUTTON"); if (hTheme) { diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp index 0f777377ac..aa124a816d 100644 --- a/src/osx/carbon/renderer.cpp +++ b/src/osx/carbon/renderer.cpp @@ -484,8 +484,13 @@ wxRendererMac::DrawCheckBox(wxWindow *win, kind, kThemeAdornmentNone); } -wxSize wxRendererMac::GetCheckBoxSize(wxWindow* WXUNUSED(win)) +wxSize wxRendererMac::GetCheckBoxSize(wxWindow* win) { + // Even though we don't use the window in this implementation, still check + // that it's valid to avoid surprises when running the same code under the + // other platforms. + wxCHECK_MSG( win, wxSize(0, 0), "Must have a valid window" ); + wxSize size; SInt32 width, height; OSStatus errStatus; From 8e1c4e92388c26223af0a5ae0b0fa63043fed63f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 11 Oct 2018 01:05:43 +0200 Subject: [PATCH 107/231] Avoid harmless signed/unsigned warning in g++ 5.4 wxGTK build Change GTKGetEntryTextLength() to return a signed value, as it's always either assigned to or compared with the signed variables anyhow. This avoids a couple of -Wsign-compare warnings when building with g++ 5.4 from Ubuntu 16.04. --- include/wx/gtk/textentry.h | 2 +- src/gtk/textentry.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/gtk/textentry.h b/include/wx/gtk/textentry.h index e55fad8d4c..757917e5a8 100644 --- a/include/wx/gtk/textentry.h +++ b/include/wx/gtk/textentry.h @@ -84,7 +84,7 @@ protected: // Override the base class method to use GtkEntry IM context. virtual int GTKIMFilterKeypress(GdkEventKey* event) const; - static unsigned int GTKGetEntryTextLength(GtkEntry* entry); + static int GTKGetEntryTextLength(GtkEntry* entry); private: // implement this to return the associated GtkEntry or another widget diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index bc4735a8a7..2a442b009a 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -41,7 +41,7 @@ // helper function to get the length of the text //----------------------------------------------------------------------------- -static unsigned int GetEntryTextLength(GtkEntry* entry) +static int GetEntryTextLength(GtkEntry* entry) { #if GTK_CHECK_VERSION(2, 14, 0) if ( wx_is_at_least_gtk2(14) ) @@ -582,7 +582,7 @@ void wxTextEntry::Remove(long from, long to) } // static -unsigned int wxTextEntry::GTKGetEntryTextLength(GtkEntry* entry) +int wxTextEntry::GTKGetEntryTextLength(GtkEntry* entry) { return GetEntryTextLength(entry); } From 8ace56a84e4584ae259ec5b034e6b7292b40232d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 11 Oct 2018 08:43:12 +0200 Subject: [PATCH 108/231] Adjust NSOpenGLView subclass use for glcanvas on macOS makes this not fully a user pane, leave default handling for most things, but indicate that we can have the focus, fixes #18237 --- src/osx/cocoa/glcanvas.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/glcanvas.mm b/src/osx/cocoa/glcanvas.mm index cc889507e7..de9ff18901 100644 --- a/src/osx/cocoa/glcanvas.mm +++ b/src/osx/cocoa/glcanvas.mm @@ -135,6 +135,11 @@ WXGLPixelFormat WXGLChoosePixelFormat(const int *GLAttrs, return YES; } +- (BOOL) acceptsFirstResponder +{ + return YES; +} + @end bool wxGLCanvas::DoCreate(wxWindow *parent, @@ -154,7 +159,7 @@ bool wxGLCanvas::DoCreate(wxWindow *parent, NSRect r = wxOSXGetFrameForControl( this, pos , size ) ; wxNSCustomOpenGLView* v = [[wxNSCustomOpenGLView alloc] initWithFrame:r]; - wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( this, v, false, true ); + wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( this, v ); SetPeer(c); MacPostControlCreate(pos, size) ; return true; From 17e243a5e43f3d0d452f57c87d8c97cf3da2cf63 Mon Sep 17 00:00:00 2001 From: Jouk Date: Thu, 11 Oct 2018 11:41:55 +0200 Subject: [PATCH 109/231] Update OpenVMS build support --- lib/vms_gtk2.opt | 1 + src/unix/descrip.mms | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/vms_gtk2.opt b/lib/vms_gtk2.opt index 490b2440cb..4edff31f42 100644 --- a/lib/vms_gtk2.opt +++ b/lib/vms_gtk2.opt @@ -15,5 +15,6 @@ sys$share:libglib2.exe/share sys$share:freetype2shr/share sys$share:libfontconfig/share sys$share:pthread$rtl.exe/share +sys$share:libXrender.exe/share sys$library:decw$xextlibshr.exe/share sys$library:decw$xlibshr.exe/share diff --git a/src/unix/descrip.mms b/src/unix/descrip.mms index 5681043bc8..4ebf993a1e 100644 --- a/src/unix/descrip.mms +++ b/src/unix/descrip.mms @@ -2,7 +2,7 @@ # * # Make file for VMS * # Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * -# Date : 22 May 2018 * +# Date : 11 October 2018 * # * #***************************************************************************** .first @@ -46,7 +46,6 @@ CC_DEFINE = OBJECTS = appunix.obj,apptraits.obj,\ dialup.obj,\ dir.obj,\ - displayx11.obj,\ dlunix.obj,\ fontenum.obj,\ fontutil.obj,\ @@ -64,6 +63,9 @@ OBJECTS = appunix.obj,apptraits.obj,\ timerunx.obj,evtloopunix.obj,fdiounix.obj,uiactionx11.obj,\ mediactrl.obj,wakeuppipe.obj,mimetype.obj +OBJECTS2=displayx11.obj + + SOURCES = appunix.cpp,apptraits.cpp,\ dialup.cpp,\ dir.cpp,\ @@ -89,21 +91,28 @@ all : $(SOURCES) $(MMS)$(MMSQUALIFIERS) $(OBJECTS) .ifdef __WXMOTIF__ library [--.lib]libwx_motif.olb $(OBJECTS) + $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) + library [--.lib]libwx_motif.olb $(OBJECTS2) .else .ifdef __WXGTK__ library [--.lib]libwx_gtk.olb $(OBJECTS) + $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) + library [--.lib]libwx_motif.olb $(OBJECTS2) .else .ifdef __WXGTK2__ library [--.lib]libwx_gtk2.olb $(OBJECTS) .else .ifdef __WXX11__ library [--.lib]libwx_x11_univ.olb $(OBJECTS) + $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) + library [--.lib]libwx_motif.olb $(OBJECTS2) .endif .endif .endif .endif $(OBJECTS) : [--.include.wx]setup.h +$(OBJECTS2) : [--.include.wx]setup.h appunix.obj : appunix.cpp apptraits.obj : apptraits.cpp From bc974910ec91c34d8890a6828f9d012f8d40d430 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 11 Oct 2018 14:40:20 +0200 Subject: [PATCH 110/231] Implement setting bitmaps for the menu item for wxQt Closes https://github.com/wxWidgets/wxWidgets/pull/975 --- docs/changes.txt | 1 + include/wx/qt/menuitem.h | 7 +++++-- src/qt/menuitem.cpp | 21 ++++++++++----------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 3278de9e9d..f35cb268d6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -166,6 +166,7 @@ wxOSX: wxQt: - Fix menu bar background colour (Naser Buhamad). +- Add support for bitmaps in menu items (Igor Korot). 3.1.1: (released 2018-02-19) diff --git a/include/wx/qt/menuitem.h b/include/wx/qt/menuitem.h index 158007fc4e..769f4a9e8e 100644 --- a/include/wx/qt/menuitem.h +++ b/include/wx/qt/menuitem.h @@ -9,6 +9,8 @@ #define _WX_QT_MENUITEM_H_ #include "wx/menuitem.h" +#include "wx/bitmap.h" + class QAction; class WXDLLIMPEXP_FWD_CORE wxBitmap; @@ -33,14 +35,15 @@ public: virtual void Check(bool check = true); virtual bool IsChecked() const; - void SetBitmap(const wxBitmap& bitmap); - const wxBitmap& GetBitmap() const; + virtual void SetBitmap(const wxBitmap& bitmap); + virtual const wxBitmap& GetBitmap() const { return m_bitmap; }; virtual QAction *GetHandle() const; private: // Qt is using an action instead of a menu item. QAction *m_qtAction; + wxBitmap m_bitmap; wxDECLARE_DYNAMIC_CLASS( wxMenuItem ); }; diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index eab049e342..6ce89dc5be 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -106,18 +106,17 @@ bool wxMenuItem::IsChecked() const } -void wxMenuItem::SetBitmap(const wxBitmap& WXUNUSED(bitmap)) +void wxMenuItem::SetBitmap(const wxBitmap& bitmap) { - wxMISSING_FUNCTION(); -} - -const wxBitmap &wxMenuItem::GetBitmap() const -{ - wxMISSING_FUNCTION(); - - static wxBitmap s_bitmap; - - return s_bitmap; + if ( m_kind == wxITEM_NORMAL ) + { + m_bitmap = bitmap; + m_qtAction->setIcon( QIcon( *m_bitmap.GetHandle() ) ); + } + else + { + wxFAIL_MSG("only normal menu items can have bitmaps"); + } } QAction *wxMenuItem::GetHandle() const From 60f2c09bb1aa0f81e28d1a625678fc60b4981e4b Mon Sep 17 00:00:00 2001 From: Jouk Date: Thu, 11 Oct 2018 14:50:48 +0200 Subject: [PATCH 111/231] Update OpenVMS build support (correction on previous commit) --- src/unix/descrip.mms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/descrip.mms b/src/unix/descrip.mms index 4ebf993a1e..982c78bdc6 100644 --- a/src/unix/descrip.mms +++ b/src/unix/descrip.mms @@ -97,7 +97,7 @@ all : $(SOURCES) .ifdef __WXGTK__ library [--.lib]libwx_gtk.olb $(OBJECTS) $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) - library [--.lib]libwx_motif.olb $(OBJECTS2) + library [--.lib]libwx_gtk.olb $(OBJECTS2) .else .ifdef __WXGTK2__ library [--.lib]libwx_gtk2.olb $(OBJECTS) @@ -105,7 +105,7 @@ all : $(SOURCES) .ifdef __WXX11__ library [--.lib]libwx_x11_univ.olb $(OBJECTS) $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) - library [--.lib]libwx_motif.olb $(OBJECTS2) + library [--.lib]libwx_x11.olb $(OBJECTS2) .endif .endif .endif From 76f9d6baa976322779f6bc532238dbd55696bb1c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 11 Oct 2018 20:33:37 +0200 Subject: [PATCH 112/231] Output EXTRALIBS_MEDIA from wx-config when using static media lib This should fix linking of the applications using static media library, notably under macOS, where they must link with AV{Foundation,Kit} frameworks. --- wx-config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/wx-config.in b/wx-config.in index 3b347fa85b..a2a1706d48 100755 --- a/wx-config.in +++ b/wx-config.in @@ -1029,6 +1029,7 @@ ldlibs_base="@WXCONFIG_LIBS@" ldlibs_core="@EXTRALIBS_GUI@ @EXTRALIBS_SDL@" ldlibs_gl="@OPENGL_LIBS@" ldlibs_html="@EXTRALIBS_HTML@" +ldlibs_media="@EXTRALIBS_MEDIA@" ldlibs_xml="@EXTRALIBS_XML@" ldlibs_stc="@EXTRALIBS_STC@" ldlibs_webview="@EXTRALIBS_WEBVIEW@" From 12a755acf854be699e17b6bea36bfdc35b5e3c5e Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:07:01 +0200 Subject: [PATCH 113/231] Declare array explicitly as a wxVector instead of using wxArrayPGProperty alias --- src/propgrid/propgrid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 0c00b79ee1..7bdc51d985 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -2160,7 +2160,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, // // Pre-generate list of visible properties. - wxArrayPGProperty visPropArray; + wxVector visPropArray; visPropArray.reserve((m_height/m_lineHeight)+6); for ( ; !it.AtEnd(); it.Next() ) From 56fa1e0f565ce7040187eff0fa7d5b7cdd442bb5 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:09:08 +0200 Subject: [PATCH 114/231] Remove declaration of unused variable --- src/propgrid/propgridiface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 9d2e86c45c..d5083ecac5 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -942,7 +942,6 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const } if ( includedStates & ExpandedState ) { - wxArrayPGProperty ptrs; wxPropertyGridConstIterator it = wxPropertyGridConstIterator( pageState, wxPG_ITERATE_ALL_PARENTS_RECURSIVELY|wxPG_ITERATE_HIDDEN, From 5fb9d8d2443e6073c3a2b23499c80e1146c4abdb Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:14:52 +0200 Subject: [PATCH 115/231] Use dedicated function to change flag --- include/wx/propgrid/property.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index 82b5c3bb83..d93595cf0e 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -1792,8 +1792,7 @@ public: // (i.e. cancel 'true' returned by StringToValue() or IntToValue()). void SetWasModified( bool set = true ) { - if ( set ) m_flags |= wxPG_PROP_WAS_MODIFIED; - else m_flags &= ~wxPG_PROP_WAS_MODIFIED; + ChangeFlag(wxPG_PROP_WAS_MODIFIED, set); } // Returns property's help or description text. From fe924be26179f178dc2cb8381bff8aacc1f2175d Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:21:28 +0200 Subject: [PATCH 116/231] Use dedicated function to check if property is a wxRootProperty --- src/propgrid/propgrid.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 7bdc51d985..0bd991cabc 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -2608,8 +2608,7 @@ void wxPropertyGrid::DrawItemAndValueRelated( wxPGProperty* p ) wxPGProperty* parent = p->GetParent(); while ( parent && - !parent->IsCategory() && - parent->GetParent() ) + !parent->IsCategory() && !parent->IsRoot() ) { DrawItem(parent); parent = parent->GetParent(); From b894ea1ce32935371ca699adfee1552b36975e57 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:32:07 +0200 Subject: [PATCH 117/231] Use dedicated function to check wxPGProperty flag --- src/propgrid/propgrid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 0bd991cabc..0d1ff356e6 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3677,7 +3677,7 @@ bool wxPropertyGrid::HandleCustomEditorEvent( wxEvent &event ) // SetValueInEvent(), as called in one of the functions referred above // overrides editor's value. - if ( m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT ) + if ( WasValueChangedInEvent() ) { valueIsPending = true; pendingValue = m_changeInEventValue; From 09ff7edfbe4c7fbd7140d245aac978d122eb78aa Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 22:46:20 +0200 Subject: [PATCH 118/231] Redraw only wxPGProperties within update region Currently all properties within client area are processed for drawing whether they lie inside the update region or not. Processing for drawing is an expensive operation so doing this only for properties being actually repainted should improve performance. --- src/propgrid/propgrid.cpp | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 0d1ff356e6..3b1acf5eff 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1861,8 +1861,8 @@ void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) ) } // Find out where the window is scrolled to - int vx,vy; // Top left corner of client - GetViewStart(&vx,&vy); + int vy; // Top of the client + GetViewStart(NULL, &vy); vy *= wxPG_PIXELS_PER_UNIT; // Update everything inside the box @@ -1875,11 +1875,8 @@ void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) ) r.x = 0; r.width = GetClientSize().x; - r.y = vy; - r.height = GetClientSize().y; - // Repaint this rectangle - DrawItems(*dcPtr, r.y, r.y + r.height, &r); + DrawItems(*dcPtr, r.y, r.y + r.height-1, &r); // This blits the buffer (if used) to the window DC. delete dcPtr; @@ -1985,7 +1982,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc, { tempItemsRect = wxRect(0, topItemY, m_pState->GetVirtualWidth(), - bottomItemY); + bottomItemY - topItemY + 1); itemsRect = &tempItemsRect; } @@ -1999,9 +1996,8 @@ void wxPropertyGrid::DrawItems( wxDC& dc, if ( m_pState->DoGetRoot()->GetChildCount() > 0 ) { - // paintFinishY and drawBottomY are in buffer/physical space - int paintFinishY = DoDrawItems(dc, itemsRect); - int drawBottomY = itemsRect->y + itemsRect->height - vy; + int paintFinishY = DoDrawItems(dc, itemsRect) + 1 - vy; + int drawBottomY = itemsRect->y + itemsRect->height - 1 - vy; // Clear area beyond last painted property if ( paintFinishY < drawBottomY ) @@ -2010,7 +2006,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc, dc.SetBrush(m_colEmptySpace); dc.DrawRectangle(0, paintFinishY, m_width, - drawBottomY ); + drawBottomY-paintFinishY+1); } } else @@ -2047,10 +2043,14 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, if ( !lastItem ) lastItem = GetLastItem( wxPG_ITERATE_VISIBLE ); - if ( IsFrozen() || m_height < 1 || firstItem == NULL ) - return itemsRect->y; + int vy; + GetViewStart(NULL, &vy); + vy *= wxPG_PIXELS_PER_UNIT; - wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->y, + if ( IsFrozen() || m_height < 1 || firstItem == NULL ) + return vy - 1; + + wxCHECK_MSG( !m_pState->m_itemsAdded, vy - 1, wxS("no items added") ); wxASSERT( m_pState->DoGetRoot()->GetChildCount() ); @@ -2060,7 +2060,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, int lastItemBottomY; firstItemTopY = itemsRect->y; - lastItemBottomY = itemsRect->y + itemsRect->height; + lastItemBottomY = itemsRect->y + itemsRect->height - 1; // Align y coordinates to item boundaries firstItemTopY -= firstItemTopY % lh; @@ -2093,20 +2093,18 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, #if WXWIN_COMPATIBILITY_3_0 int xRelMod = 0; - // Buffer's y = 0, so align itemsRect and coordinates to that if ( isBuffered ) { xRelMod = itemsRect->x; // itemsRect conversion - firstItemTopY -= itemsRect->y; - lastItemBottomY -= itemsRect->y; + firstItemTopY -= vy; + lastItemBottomY -= vy; } #else - // Buffer's y = 0, so align itemsRect and coordinates to that int xRelMod = itemsRect->x; // itemsRect conversion - firstItemTopY -= itemsRect->y; - lastItemBottomY -= itemsRect->y; + firstItemTopY -= vy; + lastItemBottomY -= vy; #endif int x = m_marginWidth - xRelMod; @@ -2512,7 +2510,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, y += rowHeight; } - return y; + return y - 1 + vy; } // ----------------------------------------------------------------------- @@ -2580,6 +2578,7 @@ void wxPropertyGrid::DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 ) r.x -= vx; r.y -= vy; RefreshRect(r); + Update(); } } From 8429fd0229577fb231f4b6a004c0517288874d98 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 12 Oct 2018 23:29:02 +0200 Subject: [PATCH 119/231] Don't explicitly refresh entire wxPropertyGrid while refreshing wxPropertyGridManager wxPG is a child of wxPGManager and is refreshed automatically when updated region of wxPGManager contains wxPG window. --- src/propgrid/manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 67edffed93..0f6e3bd17c 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -1454,8 +1454,7 @@ void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) ) void wxPropertyGridManager::Refresh(bool eraseBackground, const wxRect* rect ) { - m_pPropGrid->Refresh(eraseBackground); - wxWindow::Refresh(eraseBackground,rect); + wxPanel::Refresh(eraseBackground, rect); } // ----------------------------------------------------------------------- From a33b364d84fd6b5a39f2ea4907015ad516c02f3b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 13 Oct 2018 11:20:01 +0200 Subject: [PATCH 120/231] Add tests of retrieving main parent of wxPGProperty This is to test wxPGProperty::GetMainParent() function. --- samples/propgrid/tests.cpp | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index b8e1032822..d5a02aca99 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -870,6 +870,65 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) RT_ASSERT( !pg->IsPropertySelected(prop3) ) } + { + // + // Test retrieving main parent of the property + RT_START_TEST(GetMainParent) + pgman = m_pPropGridManager; + + // Simple properties + wxPGProperty* prop = pgman->GetProperty("DateProperty"); + wxPGProperty* parent = prop->GetMainParent(); + RT_ASSERT(parent->GetName() == "DateProperty"); + + prop = pgman->GetProperty("Label"); + parent = prop->GetMainParent(); + RT_ASSERT(parent->GetName() == "Label"); + + // Properties with children + prop = pgman->GetProperty("Font"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "Font"); + + prop = pgman->GetProperty("Font.Style"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "Font"); + + prop = pgman->GetProperty("Car"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "Car"); + + prop = pgman->GetProperty("Car.Model"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "Car"); + + prop = pgman->GetProperty("Car.Speeds"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "Car"); + + prop = pgman->GetProperty("3D Object.Triangle 3.A"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "3D Object"); + + prop = pgman->GetProperty("3D Object.Triangle 3.A.Z"); + RT_ASSERT(prop); + parent = prop->GetMainParent(); + RT_ASSERT(parent); + RT_ASSERT(parent->GetName() == "3D Object"); + } + { // // Test label editing From 7a7777cb4a6935980c6e76b577e728b1e7a796b6 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 13 Oct 2018 11:27:27 +0200 Subject: [PATCH 121/231] Fix wxPGProperty::GetMainParent() function Traversing upwards in the tree should be stopped when parent is root or category property. --- src/propgrid/property.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index 5cfa571546..a09beb72e1 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -2254,7 +2254,7 @@ wxPGProperty* wxPGProperty::GetMainParent() const const wxPGProperty* curChild = this; const wxPGProperty* curParent = m_parent; - while ( curParent && !curParent->IsCategory() ) + while ( !curParent->IsRoot() && !curParent->IsCategory() ) { curChild = curParent; curParent = curParent->m_parent; From 7c0eac050ea7cd3e7fc453adb82f143d075e9ca0 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 13 Oct 2018 11:37:27 +0200 Subject: [PATCH 122/231] Use dedicated function to obtain highest level parent of the just changed property --- src/propgrid/propgrid.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 3b1acf5eff..1fa1201b27 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3368,14 +3368,6 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags ) // If property's value is being changed, assume it is valid OnValidationFailureReset(selected); - wxPGProperty* topPaintedProperty = changedProperty; - - while ( !topPaintedProperty->IsCategory() && - !topPaintedProperty->IsRoot() ) - { - topPaintedProperty = topPaintedProperty->GetParent(); - } - changedProperty->SetValue(value, &m_chgInfo_valueList, wxPG_SETVAL_BY_USER); // NB: Call GetEditorControl() as late as possible, because OnSetValue() @@ -3393,10 +3385,9 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags ) } } - wxPGProperty* pwc; - // Propagate updates to parent(s) - pwc = p; + wxPGProperty* topPaintedProperty = changedProperty->GetMainParent(); + wxPGProperty* pwc = p; wxPGProperty* prevPwc = NULL; while ( prevPwc != topPaintedProperty ) From 028cfb1ba4f110b6a75cef152050b53b34b8125d Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 13 Oct 2018 11:51:01 +0200 Subject: [PATCH 123/231] Refresh wxPropertGrid after resetting the status This is to visualize the effect of the modification. --- samples/propgrid/propgrid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 591a7977c6..6f35b6147a 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -2658,6 +2658,7 @@ void FormMain::OnTestReplaceClick( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnClearModifyStatusClick( wxCommandEvent& WXUNUSED(event) ) { m_pPropGridManager->ClearModifiedStatus(); + m_pPropGridManager->Refresh(); } // ----------------------------------------------------------------------- From 652765e614538454bceee0c3c59f24cb772084b7 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 13 Oct 2018 22:13:49 +0200 Subject: [PATCH 124/231] Fix calculating size of the caption of the description text in wxPropertyGridManager Using font height to determine required height of wxStaticText control used to display a title is not sufficient because this doesn't take into account internal margins, borders etc. around displayed text within the control. Because this internal positioning depends on the port it's better to delegate calculation of the required height to the control itself. Closes #17662. --- src/propgrid/manager.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 0f6e3bd17c..9437e48c89 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -1283,12 +1283,13 @@ void wxPropertyGridManager::RepaintDescBoxDecorations( wxDC& dc, void wxPropertyGridManager::UpdateDescriptionBox( int new_splittery, int new_width, int new_height ) { - int use_hei = new_height; - use_hei--; + int use_hei = new_height-1; + int use_width = new_width-6; // Fix help control positions. - int cap_hei = m_pPropGrid->GetFontHeight(); int cap_y = new_splittery+m_splitterHeight+5; + m_pTxtHelpCaption->SetSize(3, cap_y, use_width, wxDefaultCoord, wxSIZE_AUTO_HEIGHT); + int cap_hei = m_pTxtHelpCaption->GetSize().GetHeight(); int cnt_y = cap_y+cap_hei+3; int sub_cap_hei = cap_y+cap_hei-use_hei; int cnt_hei = use_hei-cnt_y; @@ -1304,7 +1305,6 @@ void wxPropertyGridManager::UpdateDescriptionBox( int new_splittery, int new_wid } else { - m_pTxtHelpCaption->SetSize(3,cap_y,new_width-6,cap_hei); m_pTxtHelpCaption->Wrap(-1); m_pTxtHelpCaption->Show( true ); if ( cnt_hei <= 2 ) @@ -1313,7 +1313,8 @@ void wxPropertyGridManager::UpdateDescriptionBox( int new_splittery, int new_wid } else { - m_pTxtHelpContent->SetSize(3,cnt_y,new_width-6,cnt_hei); + m_pTxtHelpContent->SetSize(3,cnt_y,use_width,cnt_hei); + m_pTxtHelpContent->Wrap(use_width); m_pTxtHelpContent->Show( true ); } } From 41bddbd85fe90db6ff726d4da30946884740c842 Mon Sep 17 00:00:00 2001 From: Jouk Date: Tue, 16 Oct 2018 11:54:12 +0200 Subject: [PATCH 125/231] update for OpenVMS compilation of wxX11 --- src/unix/descrip.mms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/descrip.mms b/src/unix/descrip.mms index 982c78bdc6..93adf416c4 100644 --- a/src/unix/descrip.mms +++ b/src/unix/descrip.mms @@ -2,7 +2,7 @@ # * # Make file for VMS * # Author : J.Jansen (joukj@hrem.nano.tudelft.nl) * -# Date : 11 October 2018 * +# Date : 16 October 2018 * # * #***************************************************************************** .first @@ -105,7 +105,7 @@ all : $(SOURCES) .ifdef __WXX11__ library [--.lib]libwx_x11_univ.olb $(OBJECTS) $(MMS)$(MMSQUALIFIERS) $(OBJECTS2) - library [--.lib]libwx_x11.olb $(OBJECTS2) + library [--.lib]libwx_x11_univ.olb $(OBJECTS2) .endif .endif .endif From 99d082cae79ef4561f910b13ab6aedfdec0208fe Mon Sep 17 00:00:00 2001 From: Tim S Date: Sun, 14 Oct 2018 21:56:36 -0400 Subject: [PATCH 126/231] Add WXUNIVERSAL guard for wxMSW/Univ --- src/aui/tabartmsw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aui/tabartmsw.cpp b/src/aui/tabartmsw.cpp index 2ba5961a63..5768ba34e1 100644 --- a/src/aui/tabartmsw.cpp +++ b/src/aui/tabartmsw.cpp @@ -23,7 +23,7 @@ #include "wx/msw/private.h" #include "wx/renderer.h" -#if wxUSE_AUI +#if wxUSE_AUI && !defined(__WXUNIVERSAL__) wxAuiMSWTabArt::wxAuiMSWTabArt() { From 09aa8c741e9412cec46b031a69a6e0e0560215e1 Mon Sep 17 00:00:00 2001 From: Tim S Date: Sat, 13 Oct 2018 22:26:03 -0400 Subject: [PATCH 127/231] Move msw/evtloop.{h,cpp} from MSW_{HDR,SRC} to under MSW_LOWLEVEL_{HDR,SRC} --- build/files | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/files b/build/files index 03bf2cbcea..7197738944 100644 --- a/build/files +++ b/build/files @@ -1903,6 +1903,7 @@ MSW_LOWLEVEL_SRC = src/msw/dib.cpp src/msw/display.cpp src/msw/enhmeta.cpp + src/msw/evtloop.cpp src/msw/font.cpp src/msw/fontenum.cpp src/msw/fontutil.cpp @@ -1952,6 +1953,7 @@ MSW_LOWLEVEL_SRC = MSW_LOWLEVEL_HDR = wx/generic/activityindicator.h + wx/msw/evtloop.h wx/msw/helpchm.h wx/msw/helpwin.h wx/msw/htmlhelp.h @@ -1993,7 +1995,6 @@ MSW_SRC = src/msw/dialog.cpp src/msw/dirdlg.cpp src/msw/dragimag.cpp - src/msw/evtloop.cpp src/msw/filedlg.cpp src/msw/frame.cpp src/msw/gauge.cpp @@ -2075,7 +2076,6 @@ MSW_HDR = wx/msw/dirdlg.h wx/msw/dragimag.h wx/msw/enhmeta.h - wx/msw/evtloop.h wx/msw/filedlg.h wx/msw/font.h wx/msw/frame.h From d9891c4aa16a2a6070434e9462040840ac2611d2 Mon Sep 17 00:00:00 2001 From: Tim S Date: Sun, 14 Oct 2018 14:58:54 -0400 Subject: [PATCH 128/231] Remove msw/evtloop.{h,cpp} from UNIV_PLATFORM_{HDR,SRC} --- build/bakefiles/files.bkl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 328e0c3b68..6482166980 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2730,9 +2730,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - - src/msw/evtloop.cpp - diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index f8c6c12d39..999faa219e 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -1947,8 +1947,8 @@ set(MSW_LOWLEVEL_SRC src/msw/notifmsg.cpp src/msw/ole/automtn.cpp src/msw/taskbar.cpp - src/generic/activityindicator.cpp src/msw/richtooltip.cpp + src/msw/evtloop.cpp ) set(MSW_LOWLEVEL_HDR @@ -1959,10 +1959,10 @@ set(MSW_LOWLEVEL_HDR wx/msw/htmlhelp.h wx/msw/helpchm.h wx/msw/sound.h - wx/generic/activityindicator.h wx/msw/joystick.h wx/msw/helpwin.h wx/msw/taskbar.h + wx/msw/evtloop.h ) set(MSW_DESKTOP_LOWLEVEL_SRC @@ -2000,7 +2000,6 @@ set(MSW_SRC src/msw/dialog.cpp src/msw/dirdlg.cpp src/msw/dragimag.cpp - src/msw/evtloop.cpp src/msw/filedlg.cpp src/msw/frame.cpp src/msw/gauge.cpp @@ -2047,6 +2046,7 @@ set(MSW_SRC src/msw/commandlinkbutton.cpp src/msw/datetimectrl.cpp src/msw/hyperlink.cpp + src/generic/activityindicator.cpp ) set(MSW_HDR @@ -2084,7 +2084,6 @@ set(MSW_HDR wx/msw/dirdlg.h wx/msw/dragimag.h wx/msw/enhmeta.h - wx/msw/evtloop.h wx/msw/filedlg.h wx/msw/font.h wx/msw/frame.h @@ -2155,6 +2154,7 @@ set(MSW_HDR wx/msw/datetimectrl.h wx/msw/timectrl.h wx/generic/animate.h + wx/generic/activityindicator.h ) set(MSW_RSC @@ -2596,7 +2596,6 @@ set(UNIV_THEMES_SRC set(UNIV_SRC ${UNIV_PLATFORM_SRC} src/generic/accel.cpp - src/generic/activityindicator.cpp src/generic/clrpickerg.cpp src/generic/collpaneg.cpp src/generic/colrdlgg.cpp @@ -2646,12 +2645,12 @@ set(UNIV_SRC src/univ/toolbar.cpp src/univ/topluniv.cpp src/univ/winuniv.cpp + src/generic/activityindicator.cpp ) set(UNIV_HDR ${UNIV_PLATFORM_HDR} wx/generic/accel.h - wx/generic/activityindicator.h wx/generic/animate.h wx/generic/clrpickerg.h wx/generic/collpaneg.h @@ -2708,6 +2707,7 @@ set(UNIV_HDR wx/univ/toolbar.h wx/univ/toplevel.h wx/univ/window.h + wx/generic/activityindicator.h ) set(MEDIA_CMN_SRC diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 36967bced7..24a3687ebe 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1851,8 +1851,8 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.obj \ $(OBJS)\monodll_automtn.obj \ $(OBJS)\monodll_notifmsgrt.obj \ - $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_uuid.obj \ + $(OBJS)\monodll_evtloop.obj \ $(OBJS)\monodll_clrpickerg.obj \ $(OBJS)\monodll_collpaneg.obj \ $(OBJS)\monodll_filepickerg.obj \ @@ -1874,7 +1874,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_dialog.obj \ $(OBJS)\monodll_dirdlg.obj \ $(OBJS)\monodll_dragimag.obj \ - $(OBJS)\monodll_evtloop.obj \ $(OBJS)\monodll_filedlg.obj \ $(OBJS)\monodll_frame.obj \ $(OBJS)\monodll_msw_gauge.obj \ @@ -1922,6 +1921,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_datetimectrl.obj \ $(OBJS)\monodll_timectrl.obj \ $(OBJS)\monodll_datecontrols.obj \ + $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_fontdlg.obj \ @@ -2192,9 +2192,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.obj \ $(OBJS)\monodll_automtn.obj \ $(OBJS)\monodll_notifmsgrt.obj \ - $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_uuid.obj \ $(OBJS)\monodll_evtloop.obj \ + $(OBJS)\monodll_animateg.obj \ $(OBJS)\monodll_generic_accel.obj \ $(OBJS)\monodll_clrpickerg.obj \ $(OBJS)\monodll_collpaneg.obj \ @@ -2680,8 +2680,8 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.obj \ $(OBJS)\monolib_automtn.obj \ $(OBJS)\monolib_notifmsgrt.obj \ - $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_uuid.obj \ + $(OBJS)\monolib_evtloop.obj \ $(OBJS)\monolib_clrpickerg.obj \ $(OBJS)\monolib_collpaneg.obj \ $(OBJS)\monolib_filepickerg.obj \ @@ -2703,7 +2703,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_dialog.obj \ $(OBJS)\monolib_dirdlg.obj \ $(OBJS)\monolib_dragimag.obj \ - $(OBJS)\monolib_evtloop.obj \ $(OBJS)\monolib_filedlg.obj \ $(OBJS)\monolib_frame.obj \ $(OBJS)\monolib_msw_gauge.obj \ @@ -2751,6 +2750,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_datetimectrl.obj \ $(OBJS)\monolib_timectrl.obj \ $(OBJS)\monolib_datecontrols.obj \ + $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_fontdlg.obj \ @@ -3021,9 +3021,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.obj \ $(OBJS)\monolib_automtn.obj \ $(OBJS)\monolib_notifmsgrt.obj \ - $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_uuid.obj \ $(OBJS)\monolib_evtloop.obj \ + $(OBJS)\monolib_animateg.obj \ $(OBJS)\monolib_generic_accel.obj \ $(OBJS)\monolib_clrpickerg.obj \ $(OBJS)\monolib_collpaneg.obj \ @@ -3384,8 +3384,8 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.obj \ $(OBJS)\coredll_automtn.obj \ $(OBJS)\coredll_notifmsgrt.obj \ - $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_uuid.obj \ + $(OBJS)\coredll_evtloop.obj \ $(OBJS)\coredll_clrpickerg.obj \ $(OBJS)\coredll_collpaneg.obj \ $(OBJS)\coredll_filepickerg.obj \ @@ -3407,7 +3407,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_dialog.obj \ $(OBJS)\coredll_dirdlg.obj \ $(OBJS)\coredll_dragimag.obj \ - $(OBJS)\coredll_evtloop.obj \ $(OBJS)\coredll_filedlg.obj \ $(OBJS)\coredll_frame.obj \ $(OBJS)\coredll_msw_gauge.obj \ @@ -3455,6 +3454,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_datetimectrl.obj \ $(OBJS)\coredll_timectrl.obj \ $(OBJS)\coredll_datecontrols.obj \ + $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_fontdlg.obj \ @@ -3725,9 +3725,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.obj \ $(OBJS)\coredll_automtn.obj \ $(OBJS)\coredll_notifmsgrt.obj \ - $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_uuid.obj \ $(OBJS)\coredll_evtloop.obj \ + $(OBJS)\coredll_animateg.obj \ $(OBJS)\coredll_generic_accel.obj \ $(OBJS)\coredll_clrpickerg.obj \ $(OBJS)\coredll_collpaneg.obj \ @@ -4054,8 +4054,8 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.obj \ $(OBJS)\corelib_automtn.obj \ $(OBJS)\corelib_notifmsgrt.obj \ - $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_uuid.obj \ + $(OBJS)\corelib_evtloop.obj \ $(OBJS)\corelib_clrpickerg.obj \ $(OBJS)\corelib_collpaneg.obj \ $(OBJS)\corelib_filepickerg.obj \ @@ -4077,7 +4077,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_dialog.obj \ $(OBJS)\corelib_dirdlg.obj \ $(OBJS)\corelib_dragimag.obj \ - $(OBJS)\corelib_evtloop.obj \ $(OBJS)\corelib_filedlg.obj \ $(OBJS)\corelib_frame.obj \ $(OBJS)\corelib_msw_gauge.obj \ @@ -4125,6 +4124,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_datetimectrl.obj \ $(OBJS)\corelib_timectrl.obj \ $(OBJS)\corelib_datecontrols.obj \ + $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_fdrepdlg.obj \ $(OBJS)\corelib_fontdlg.obj \ @@ -4395,9 +4395,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.obj \ $(OBJS)\corelib_automtn.obj \ $(OBJS)\corelib_notifmsgrt.obj \ - $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_uuid.obj \ $(OBJS)\corelib_evtloop.obj \ + $(OBJS)\corelib_animateg.obj \ $(OBJS)\corelib_generic_accel.obj \ $(OBJS)\corelib_clrpickerg.obj \ $(OBJS)\corelib_collpaneg.obj \ @@ -6934,9 +6934,6 @@ $(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monodll_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\monodll_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\monodll_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -7888,18 +7885,13 @@ $(OBJS)\monodll_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\monodll_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -7928,8 +7920,13 @@ $(OBJS)\monodll_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\monodll_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -9478,9 +9475,6 @@ $(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monolib_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\monolib_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\monolib_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -10432,18 +10426,13 @@ $(OBJS)\monolib_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\monolib_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -10472,8 +10461,13 @@ $(OBJS)\monolib_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\monolib_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -12436,9 +12430,6 @@ $(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\coredll_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\coredll_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\coredll_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -12940,18 +12931,13 @@ $(OBJS)\coredll_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\coredll_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -12980,8 +12966,13 @@ $(OBJS)\coredll_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\coredll_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -14167,9 +14158,6 @@ $(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\corelib_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\corelib_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\corelib_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -14671,18 +14659,13 @@ $(OBJS)\corelib_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\corelib_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -14711,8 +14694,13 @@ $(OBJS)\corelib_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\corelib_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 65681bb814..18792ec66d 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1877,8 +1877,8 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.o \ $(OBJS)\monodll_automtn.o \ $(OBJS)\monodll_notifmsgrt.o \ - $(OBJS)\monodll_activityindicator.o \ $(OBJS)\monodll_uuid.o \ + $(OBJS)\monodll_evtloop.o \ $(OBJS)\monodll_clrpickerg.o \ $(OBJS)\monodll_collpaneg.o \ $(OBJS)\monodll_filepickerg.o \ @@ -1900,7 +1900,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_dialog.o \ $(OBJS)\monodll_dirdlg.o \ $(OBJS)\monodll_dragimag.o \ - $(OBJS)\monodll_evtloop.o \ $(OBJS)\monodll_filedlg.o \ $(OBJS)\monodll_frame.o \ $(OBJS)\monodll_msw_gauge.o \ @@ -1948,6 +1947,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_datetimectrl.o \ $(OBJS)\monodll_timectrl.o \ $(OBJS)\monodll_datecontrols.o \ + $(OBJS)\monodll_activityindicator.o \ $(OBJS)\monodll_msw_checklst.o \ $(OBJS)\monodll_msw_fdrepdlg.o \ $(OBJS)\monodll_fontdlg.o \ @@ -2220,9 +2220,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.o \ $(OBJS)\monodll_automtn.o \ $(OBJS)\monodll_notifmsgrt.o \ - $(OBJS)\monodll_activityindicator.o \ $(OBJS)\monodll_uuid.o \ $(OBJS)\monodll_evtloop.o \ + $(OBJS)\monodll_animateg.o \ $(OBJS)\monodll_generic_accel.o \ $(OBJS)\monodll_clrpickerg.o \ $(OBJS)\monodll_collpaneg.o \ @@ -2712,8 +2712,8 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.o \ $(OBJS)\monolib_automtn.o \ $(OBJS)\monolib_notifmsgrt.o \ - $(OBJS)\monolib_activityindicator.o \ $(OBJS)\monolib_uuid.o \ + $(OBJS)\monolib_evtloop.o \ $(OBJS)\monolib_clrpickerg.o \ $(OBJS)\monolib_collpaneg.o \ $(OBJS)\monolib_filepickerg.o \ @@ -2735,7 +2735,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_dialog.o \ $(OBJS)\monolib_dirdlg.o \ $(OBJS)\monolib_dragimag.o \ - $(OBJS)\monolib_evtloop.o \ $(OBJS)\monolib_filedlg.o \ $(OBJS)\monolib_frame.o \ $(OBJS)\monolib_msw_gauge.o \ @@ -2783,6 +2782,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_datetimectrl.o \ $(OBJS)\monolib_timectrl.o \ $(OBJS)\monolib_datecontrols.o \ + $(OBJS)\monolib_activityindicator.o \ $(OBJS)\monolib_msw_checklst.o \ $(OBJS)\monolib_msw_fdrepdlg.o \ $(OBJS)\monolib_fontdlg.o \ @@ -3055,9 +3055,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.o \ $(OBJS)\monolib_automtn.o \ $(OBJS)\monolib_notifmsgrt.o \ - $(OBJS)\monolib_activityindicator.o \ $(OBJS)\monolib_uuid.o \ $(OBJS)\monolib_evtloop.o \ + $(OBJS)\monolib_animateg.o \ $(OBJS)\monolib_generic_accel.o \ $(OBJS)\monolib_clrpickerg.o \ $(OBJS)\monolib_collpaneg.o \ @@ -3432,8 +3432,8 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.o \ $(OBJS)\coredll_automtn.o \ $(OBJS)\coredll_notifmsgrt.o \ - $(OBJS)\coredll_activityindicator.o \ $(OBJS)\coredll_uuid.o \ + $(OBJS)\coredll_evtloop.o \ $(OBJS)\coredll_clrpickerg.o \ $(OBJS)\coredll_collpaneg.o \ $(OBJS)\coredll_filepickerg.o \ @@ -3455,7 +3455,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_dialog.o \ $(OBJS)\coredll_dirdlg.o \ $(OBJS)\coredll_dragimag.o \ - $(OBJS)\coredll_evtloop.o \ $(OBJS)\coredll_filedlg.o \ $(OBJS)\coredll_frame.o \ $(OBJS)\coredll_msw_gauge.o \ @@ -3503,6 +3502,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_datetimectrl.o \ $(OBJS)\coredll_timectrl.o \ $(OBJS)\coredll_datecontrols.o \ + $(OBJS)\coredll_activityindicator.o \ $(OBJS)\coredll_msw_checklst.o \ $(OBJS)\coredll_msw_fdrepdlg.o \ $(OBJS)\coredll_fontdlg.o \ @@ -3775,9 +3775,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.o \ $(OBJS)\coredll_automtn.o \ $(OBJS)\coredll_notifmsgrt.o \ - $(OBJS)\coredll_activityindicator.o \ $(OBJS)\coredll_uuid.o \ $(OBJS)\coredll_evtloop.o \ + $(OBJS)\coredll_animateg.o \ $(OBJS)\coredll_generic_accel.o \ $(OBJS)\coredll_clrpickerg.o \ $(OBJS)\coredll_collpaneg.o \ @@ -4110,8 +4110,8 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.o \ $(OBJS)\corelib_automtn.o \ $(OBJS)\corelib_notifmsgrt.o \ - $(OBJS)\corelib_activityindicator.o \ $(OBJS)\corelib_uuid.o \ + $(OBJS)\corelib_evtloop.o \ $(OBJS)\corelib_clrpickerg.o \ $(OBJS)\corelib_collpaneg.o \ $(OBJS)\corelib_filepickerg.o \ @@ -4133,7 +4133,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_dialog.o \ $(OBJS)\corelib_dirdlg.o \ $(OBJS)\corelib_dragimag.o \ - $(OBJS)\corelib_evtloop.o \ $(OBJS)\corelib_filedlg.o \ $(OBJS)\corelib_frame.o \ $(OBJS)\corelib_msw_gauge.o \ @@ -4181,6 +4180,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_datetimectrl.o \ $(OBJS)\corelib_timectrl.o \ $(OBJS)\corelib_datecontrols.o \ + $(OBJS)\corelib_activityindicator.o \ $(OBJS)\corelib_msw_checklst.o \ $(OBJS)\corelib_msw_fdrepdlg.o \ $(OBJS)\corelib_fontdlg.o \ @@ -4453,9 +4453,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.o \ $(OBJS)\corelib_automtn.o \ $(OBJS)\corelib_notifmsgrt.o \ - $(OBJS)\corelib_activityindicator.o \ $(OBJS)\corelib_uuid.o \ $(OBJS)\corelib_evtloop.o \ + $(OBJS)\corelib_animateg.o \ $(OBJS)\corelib_generic_accel.o \ $(OBJS)\corelib_clrpickerg.o \ $(OBJS)\corelib_collpaneg.o \ @@ -7116,9 +7116,6 @@ $(OBJS)\monodll_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\monodll_customdraw.o: ../../src/msw/customdraw.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\monodll_animateg.o: ../../src/generic/animateg.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\monodll_commandlinkbutton.o: ../../src/msw/commandlinkbutton.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -8069,23 +8066,16 @@ $(OBJS)\monodll_notifmsgrt.o: ../../src/msw/rt/notifmsgrt.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monodll_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -endif - -ifeq ($(USE_GUI),1) -ifeq ($(WXUNIV),1) -$(OBJS)\monodll_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -endif -endif - ifeq ($(USE_GUI),1) $(OBJS)\monodll_uuid.o: ../../src/msw/ole/uuid.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_evtloop.o: ../../src/msw/evtloop.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monodll_clrpickerg.o: ../../src/generic/clrpickerg.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -8112,7 +8102,12 @@ $(OBJS)\monodll_prntdlgg.o: ../../src/generic/prntdlgg.cpp endif ifeq ($(USE_GUI),1) -$(OBJS)\monodll_evtloop.o: ../../src/msw/evtloop.cpp +$(OBJS)\monodll_animateg.o: ../../src/generic/animateg.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) +$(OBJS)\monodll_activityindicator.o: ../../src/generic/activityindicator.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif @@ -9662,9 +9657,6 @@ $(OBJS)\monolib_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\monolib_customdraw.o: ../../src/msw/customdraw.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\monolib_animateg.o: ../../src/generic/animateg.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\monolib_commandlinkbutton.o: ../../src/msw/commandlinkbutton.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -10615,23 +10607,16 @@ $(OBJS)\monolib_notifmsgrt.o: ../../src/msw/rt/notifmsgrt.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monolib_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -endif - -ifeq ($(USE_GUI),1) -ifeq ($(WXUNIV),1) -$(OBJS)\monolib_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -endif -endif - ifeq ($(USE_GUI),1) $(OBJS)\monolib_uuid.o: ../../src/msw/ole/uuid.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_evtloop.o: ../../src/msw/evtloop.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\monolib_clrpickerg.o: ../../src/generic/clrpickerg.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -10658,7 +10643,12 @@ $(OBJS)\monolib_prntdlgg.o: ../../src/generic/prntdlgg.cpp endif ifeq ($(USE_GUI),1) -$(OBJS)\monolib_evtloop.o: ../../src/msw/evtloop.cpp +$(OBJS)\monolib_animateg.o: ../../src/generic/animateg.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) +$(OBJS)\monolib_activityindicator.o: ../../src/generic/activityindicator.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif @@ -12622,9 +12612,6 @@ $(OBJS)\coredll_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\coredll_customdraw.o: ../../src/msw/customdraw.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\coredll_animateg.o: ../../src/generic/animateg.cpp - $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\coredll_commandlinkbutton.o: ../../src/msw/commandlinkbutton.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -13125,23 +13112,16 @@ $(OBJS)\coredll_notifmsgrt.o: ../../src/msw/rt/notifmsgrt.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\coredll_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< -endif - -ifeq ($(USE_GUI),1) -ifeq ($(WXUNIV),1) -$(OBJS)\coredll_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< -endif -endif - ifeq ($(USE_GUI),1) $(OBJS)\coredll_uuid.o: ../../src/msw/ole/uuid.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_evtloop.o: ../../src/msw/evtloop.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\coredll_clrpickerg.o: ../../src/generic/clrpickerg.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -13168,7 +13148,12 @@ $(OBJS)\coredll_prntdlgg.o: ../../src/generic/prntdlgg.cpp endif ifeq ($(USE_GUI),1) -$(OBJS)\coredll_evtloop.o: ../../src/msw/evtloop.cpp +$(OBJS)\coredll_animateg.o: ../../src/generic/animateg.cpp + $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) +$(OBJS)\coredll_activityindicator.o: ../../src/generic/activityindicator.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif @@ -14355,9 +14340,6 @@ $(OBJS)\corelib_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\corelib_customdraw.o: ../../src/msw/customdraw.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\corelib_animateg.o: ../../src/generic/animateg.cpp - $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< - $(OBJS)\corelib_commandlinkbutton.o: ../../src/msw/commandlinkbutton.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< @@ -14858,23 +14840,16 @@ $(OBJS)\corelib_notifmsgrt.o: ../../src/msw/rt/notifmsgrt.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\corelib_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< -endif - -ifeq ($(USE_GUI),1) -ifeq ($(WXUNIV),1) -$(OBJS)\corelib_activityindicator.o: ../../src/generic/activityindicator.cpp - $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< -endif -endif - ifeq ($(USE_GUI),1) $(OBJS)\corelib_uuid.o: ../../src/msw/ole/uuid.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_evtloop.o: ../../src/msw/evtloop.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + ifeq ($(USE_GUI),1) $(OBJS)\corelib_clrpickerg.o: ../../src/generic/clrpickerg.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< @@ -14901,7 +14876,12 @@ $(OBJS)\corelib_prntdlgg.o: ../../src/generic/prntdlgg.cpp endif ifeq ($(USE_GUI),1) -$(OBJS)\corelib_evtloop.o: ../../src/msw/evtloop.cpp +$(OBJS)\corelib_animateg.o: ../../src/generic/animateg.cpp + $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< +endif + +ifeq ($(USE_GUI),1) +$(OBJS)\corelib_activityindicator.o: ../../src/generic/activityindicator.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 63065472da..60db1ec578 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2168,8 +2168,8 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.obj \ $(OBJS)\monodll_automtn.obj \ $(OBJS)\monodll_notifmsgrt.obj \ - $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_uuid.obj \ + $(OBJS)\monodll_evtloop.obj \ $(OBJS)\monodll_clrpickerg.obj \ $(OBJS)\monodll_collpaneg.obj \ $(OBJS)\monodll_filepickerg.obj \ @@ -2191,7 +2191,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_dialog.obj \ $(OBJS)\monodll_dirdlg.obj \ $(OBJS)\monodll_dragimag.obj \ - $(OBJS)\monodll_evtloop.obj \ $(OBJS)\monodll_filedlg.obj \ $(OBJS)\monodll_frame.obj \ $(OBJS)\monodll_msw_gauge.obj \ @@ -2239,6 +2238,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_datetimectrl.obj \ $(OBJS)\monodll_timectrl.obj \ $(OBJS)\monodll_datecontrols.obj \ + $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_fontdlg.obj \ @@ -2509,9 +2509,9 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_sound.obj \ $(OBJS)\monodll_automtn.obj \ $(OBJS)\monodll_notifmsgrt.obj \ - $(OBJS)\monodll_activityindicator.obj \ $(OBJS)\monodll_uuid.obj \ $(OBJS)\monodll_evtloop.obj \ + $(OBJS)\monodll_animateg.obj \ $(OBJS)\monodll_generic_accel.obj \ $(OBJS)\monodll_clrpickerg.obj \ $(OBJS)\monodll_collpaneg.obj \ @@ -3003,8 +3003,8 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.obj \ $(OBJS)\monolib_automtn.obj \ $(OBJS)\monolib_notifmsgrt.obj \ - $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_uuid.obj \ + $(OBJS)\monolib_evtloop.obj \ $(OBJS)\monolib_clrpickerg.obj \ $(OBJS)\monolib_collpaneg.obj \ $(OBJS)\monolib_filepickerg.obj \ @@ -3026,7 +3026,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_dialog.obj \ $(OBJS)\monolib_dirdlg.obj \ $(OBJS)\monolib_dragimag.obj \ - $(OBJS)\monolib_evtloop.obj \ $(OBJS)\monolib_filedlg.obj \ $(OBJS)\monolib_frame.obj \ $(OBJS)\monolib_msw_gauge.obj \ @@ -3074,6 +3073,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_datetimectrl.obj \ $(OBJS)\monolib_timectrl.obj \ $(OBJS)\monolib_datecontrols.obj \ + $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_fontdlg.obj \ @@ -3344,9 +3344,9 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_sound.obj \ $(OBJS)\monolib_automtn.obj \ $(OBJS)\monolib_notifmsgrt.obj \ - $(OBJS)\monolib_activityindicator.obj \ $(OBJS)\monolib_uuid.obj \ $(OBJS)\monolib_evtloop.obj \ + $(OBJS)\monolib_animateg.obj \ $(OBJS)\monolib_generic_accel.obj \ $(OBJS)\monolib_clrpickerg.obj \ $(OBJS)\monolib_collpaneg.obj \ @@ -3773,8 +3773,8 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.obj \ $(OBJS)\coredll_automtn.obj \ $(OBJS)\coredll_notifmsgrt.obj \ - $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_uuid.obj \ + $(OBJS)\coredll_evtloop.obj \ $(OBJS)\coredll_clrpickerg.obj \ $(OBJS)\coredll_collpaneg.obj \ $(OBJS)\coredll_filepickerg.obj \ @@ -3796,7 +3796,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_dialog.obj \ $(OBJS)\coredll_dirdlg.obj \ $(OBJS)\coredll_dragimag.obj \ - $(OBJS)\coredll_evtloop.obj \ $(OBJS)\coredll_filedlg.obj \ $(OBJS)\coredll_frame.obj \ $(OBJS)\coredll_msw_gauge.obj \ @@ -3844,6 +3843,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_datetimectrl.obj \ $(OBJS)\coredll_timectrl.obj \ $(OBJS)\coredll_datecontrols.obj \ + $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_fontdlg.obj \ @@ -4114,9 +4114,9 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_sound.obj \ $(OBJS)\coredll_automtn.obj \ $(OBJS)\coredll_notifmsgrt.obj \ - $(OBJS)\coredll_activityindicator.obj \ $(OBJS)\coredll_uuid.obj \ $(OBJS)\coredll_evtloop.obj \ + $(OBJS)\coredll_animateg.obj \ $(OBJS)\coredll_generic_accel.obj \ $(OBJS)\coredll_clrpickerg.obj \ $(OBJS)\coredll_collpaneg.obj \ @@ -4449,8 +4449,8 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.obj \ $(OBJS)\corelib_automtn.obj \ $(OBJS)\corelib_notifmsgrt.obj \ - $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_uuid.obj \ + $(OBJS)\corelib_evtloop.obj \ $(OBJS)\corelib_clrpickerg.obj \ $(OBJS)\corelib_collpaneg.obj \ $(OBJS)\corelib_filepickerg.obj \ @@ -4472,7 +4472,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_dialog.obj \ $(OBJS)\corelib_dirdlg.obj \ $(OBJS)\corelib_dragimag.obj \ - $(OBJS)\corelib_evtloop.obj \ $(OBJS)\corelib_filedlg.obj \ $(OBJS)\corelib_frame.obj \ $(OBJS)\corelib_msw_gauge.obj \ @@ -4520,6 +4519,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_datetimectrl.obj \ $(OBJS)\corelib_timectrl.obj \ $(OBJS)\corelib_datecontrols.obj \ + $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_fdrepdlg.obj \ $(OBJS)\corelib_fontdlg.obj \ @@ -4790,9 +4790,9 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_sound.obj \ $(OBJS)\corelib_automtn.obj \ $(OBJS)\corelib_notifmsgrt.obj \ - $(OBJS)\corelib_activityindicator.obj \ $(OBJS)\corelib_uuid.obj \ $(OBJS)\corelib_evtloop.obj \ + $(OBJS)\corelib_animateg.obj \ $(OBJS)\corelib_generic_accel.obj \ $(OBJS)\corelib_clrpickerg.obj \ $(OBJS)\corelib_collpaneg.obj \ @@ -7643,9 +7643,6 @@ $(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monodll_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\monodll_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\monodll_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -8597,18 +8594,13 @@ $(OBJS)\monodll_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\monodll_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -8637,8 +8629,13 @@ $(OBJS)\monodll_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monodll_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\monodll_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\monodll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -10187,9 +10184,6 @@ $(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monolib_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\monolib_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\monolib_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -11141,18 +11135,13 @@ $(OBJS)\monolib_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\monolib_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -11181,8 +11170,13 @@ $(OBJS)\monolib_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\monolib_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\monolib_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\monolib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -13145,9 +13139,6 @@ $(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\coredll_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\coredll_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\coredll_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -13649,18 +13640,13 @@ $(OBJS)\coredll_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\coredll_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -13689,8 +13675,13 @@ $(OBJS)\coredll_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\coredll_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\coredll_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\coredll_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" @@ -14876,9 +14867,6 @@ $(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\corelib_customdraw.obj: ..\..\src\msw\customdraw.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp -$(OBJS)\corelib_animateg.obj: ..\..\src\generic\animateg.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\animateg.cpp - $(OBJS)\corelib_commandlinkbutton.obj: ..\..\src\msw\commandlinkbutton.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\commandlinkbutton.cpp @@ -15380,18 +15368,13 @@ $(OBJS)\corelib_notifmsgrt.obj: ..\..\src\msw\rt\notifmsgrt.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp -!endif - -!if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "1" -$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp +$(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\ole\uuid.cpp +$(OBJS)\corelib_evtloop.obj: ..\..\src\msw\evtloop.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp !endif !if "$(USE_GUI)" == "1" @@ -15420,8 +15403,13 @@ $(OBJS)\corelib_prntdlgg.obj: ..\..\src\generic\prntdlgg.cpp !endif !if "$(USE_GUI)" == "1" -$(OBJS)\corelib_evtloop.obj: ..\..\src\msw\evtloop.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\evtloop.cpp +$(OBJS)\corelib_animateg.obj: ..\..\src\generic\animateg.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\animateg.cpp +!endif + +!if "$(USE_GUI)" == "1" +$(OBJS)\corelib_activityindicator.obj: ..\..\src\generic\activityindicator.cpp + $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\generic\activityindicator.cpp !endif !if "$(USE_GUI)" == "1" diff --git a/configure b/configure index 83e07fdcc2..41fb46ae93 100755 --- a/configure +++ b/configure @@ -1023,6 +1023,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -1444,6 +1445,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1696,6 +1698,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1833,7 +1844,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1986,6 +1997,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] From 095176f8401ff8e5f2c951134602035f07f5f39c Mon Sep 17 00:00:00 2001 From: Tim S Date: Mon, 15 Oct 2018 00:53:24 -0400 Subject: [PATCH 131/231] Add GDK_WINDOWING_X11 guard for wxGTK/Win32 --- src/gtk/renderer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index a65d6f27f6..479a6a279d 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -35,7 +35,8 @@ #include "wx/dcgraph.h" #ifndef __WXGTK3__ #include "wx/gtk/dc.h" - #if wxUSE_GRAPHICS_CONTEXT + #include "wx/gtk/private/wrapgtk.h" + #if wxUSE_GRAPHICS_CONTEXT && defined(GDK_WINDOWING_X11) #include #include #endif @@ -174,7 +175,7 @@ static GdkWindow* wxGetGTKDrawable(wxDC& dc) { GdkWindow* gdk_window = NULL; -#if wxUSE_GRAPHICS_CONTEXT +#if wxUSE_GRAPHICS_CONTEXT && defined(GDK_WINDOWING_X11) cairo_t* cr = NULL; wxGraphicsContext* gc = dc.GetGraphicsContext(); if (gc) From 5231dc8bb6e45bf4e87ea935fb5e32c16e7a3fc0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Oct 2018 18:10:05 +0200 Subject: [PATCH 132/231] Rerun autoconf 2.69 to undo changes in the previous commit Remove "runstatedir" addition, probably due to using a newer version of autoconf than is currently used for configure generation. --- configure | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/configure b/configure index 41fb46ae93..83e07fdcc2 100755 --- a/configure +++ b/configure @@ -1023,7 +1023,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -1445,7 +1444,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1698,15 +1696,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1844,7 +1833,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1997,7 +1986,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] From 3beefd7e5fb9ac3a46253cb73ca0317c62073a20 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Oct 2018 19:03:42 +0200 Subject: [PATCH 133/231] Standardize Tim Stahlhut name and email in git-log Extend .mailmap entry to cover all combinations and use the preferred email. See https://github.com/wxWidgets/wxWidgets/pull/981 --- .mailmap | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 3754838473..79a840e34a 100644 --- a/.mailmap +++ b/.mailmap @@ -32,7 +32,9 @@ Richard Fath Steve Browne Tim Kosse -Tim Stahlhut +Tim Stahlhut +Tim Stahlhut +Tim Stahlhut Tobias Taschner Václav Slavík From aab02ec1ceb4602ea1da23a5d422af0f7abea21d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Oct 2018 19:13:00 +0200 Subject: [PATCH 134/231] Link wxCore with SDL libraries Now that wxSound class, which can optionally use SDL, is in wxCore, we need to link it with the SDL libraries to fix link errors in this case. Closes #18251. --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 83e07fdcc2..f16d012a6c 100755 --- a/configure +++ b/configure @@ -38984,7 +38984,7 @@ EXTRALIBS_HTML="$MSPACK_LINK" EXTRALIBS_MEDIA="$GST_LIBS" EXTRALIBS_STC="-lwxscintilla${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}" if test "$wxUSE_GUI" = "yes"; then - EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK $LZMA_LINK $JBIG_LINK $WEBKIT_LINK` + EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $SDL_LIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $LZMA_LINK $JBIG_LINK $WEBKIT_LINK` fi if test "$wxUSE_OPENGL" = "yes"; then EXTRALIBS_OPENGL="$LDFLAGS_GL $OPENGL_LIBS" diff --git a/configure.in b/configure.in index 0678a9b1d6..dd079889cb 100644 --- a/configure.in +++ b/configure.in @@ -7932,7 +7932,7 @@ EXTRALIBS_HTML="$MSPACK_LINK" EXTRALIBS_MEDIA="$GST_LIBS" EXTRALIBS_STC="-lwxscintilla${WX_LIB_FLAVOUR}-${WX_RELEASE}${HOST_SUFFIX}" if test "$wxUSE_GUI" = "yes"; then - EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $PNG_LINK $JPEG_LINK $TIFF_LINK $LZMA_LINK $JBIG_LINK $WEBKIT_LINK` + EXTRALIBS_GUI=`echo $GUI_TK_LIBRARY $SDL_LIBS $PNG_LINK $JPEG_LINK $TIFF_LINK $LZMA_LINK $JBIG_LINK $WEBKIT_LINK` fi if test "$wxUSE_OPENGL" = "yes"; then EXTRALIBS_OPENGL="$LDFLAGS_GL $OPENGL_LIBS" From 88b7ef2fabdaa38c86dae59e13772cb4573fca98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20R=C4=83ceanu?= Date: Tue, 16 Oct 2018 05:58:27 +0300 Subject: [PATCH 135/231] Fix wxRA_SPECIFY_{ROWS,COLS} handling in wxQt wxRadioBox Their meanings were previously reversed. Closes https://github.com/wxWidgets/wxWidgets/pull/978 --- src/qt/radiobox.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp index da8c90baa6..32ccb686b1 100644 --- a/src/qt/radiobox.cpp +++ b/src/qt/radiobox.cpp @@ -135,9 +135,13 @@ bool wxRadioBox::Create(wxWindow *parent, m_qtGroupBox->setTitle( wxQtConvertString( title ) ); m_qtButtonGroup = new wxQtButtonGroup( m_qtGroupBox, this ); - if ( style & wxRA_SPECIFY_ROWS ) + // wxRA_SPECIFY_COLS means that we arrange buttons in + // left to right order and GetMajorDim() is the number of columns while + // wxRA_SPECIFY_ROWS means that the buttons are arranged top to bottom and + // GetMajorDim() is the number of rows. + if ( style & wxRA_SPECIFY_COLS ) m_qtBoxLayout = new QHBoxLayout; - else if ( style & wxRA_SPECIFY_COLS ) + else if ( style & wxRA_SPECIFY_ROWS ) m_qtBoxLayout = new QVBoxLayout; AddChoices< QRadioButton >( m_qtButtonGroup, m_qtBoxLayout, n, choices ); From b5face97bc662bd1305dc6a1d816b11d3842456d Mon Sep 17 00:00:00 2001 From: jgehw Date: Tue, 16 Oct 2018 10:44:01 +0200 Subject: [PATCH 136/231] Fix QA build options check when wxUSE_DEBUGREPORT==0 Compile this check even if wxDebugReport itself is not used. Closes https://github.com/wxWidgets/wxWidgets/pull/979 --- src/common/debugrpt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/debugrpt.cpp b/src/common/debugrpt.cpp index 7bc0ed32cb..b271547974 100644 --- a/src/common/debugrpt.cpp +++ b/src/common/debugrpt.cpp @@ -29,6 +29,8 @@ #include "wx/utils.h" #endif // WX_PRECOMP +WX_CHECK_BUILD_OPTIONS("wxQA") + #if wxUSE_DEBUGREPORT && wxUSE_XML #include "wx/debugrpt.h" @@ -57,8 +59,6 @@ #include "wx/zipstrm.h" #endif // wxUSE_ZIPSTREAM -WX_CHECK_BUILD_OPTIONS("wxQA") - // ---------------------------------------------------------------------------- // XmlStackWalker: stack walker specialization which dumps stack in XML // ---------------------------------------------------------------------------- From b9e813f9d3155c67be695bbc63810daafb4e81a5 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Wed, 17 Oct 2018 22:23:04 +0300 Subject: [PATCH 137/231] Fix ANSI build for GTK+ 2 Operands of the ?: had different types, so add an explicit conversion to wxString. Closes https://github.com/wxWidgets/wxWidgets/pull/983 --- src/gtk/infobar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index ea7be9274b..453e11448d 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -239,7 +239,7 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label) #if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0) wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(btnid))) #else - wxGetStockGtkID(btnid) + wxString(wxGetStockGtkID(btnid)) #endif // GTK >= 3.10 / < 3.10 : wxGTK_CONV(label), btnid From cca0921400a1cc0ff0ed421008dd251a8c1532d3 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Wed, 17 Oct 2018 19:50:09 -0400 Subject: [PATCH 138/231] Fix file names in header comments No real changes, just fix comments containing copy-and-paste typos. Closes https://github.com/wxWidgets/wxWidgets/pull/984 --- src/aui/tabartmsw.cpp | 4 ++-- src/generic/bannerwindow.cpp | 2 +- src/qt/clipbrd.cpp | 2 +- src/qt/colour.cpp | 2 +- src/qt/dataobj.cpp | 2 +- src/qt/nonownedwnd.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aui/tabartmsw.cpp b/src/aui/tabartmsw.cpp index 5768ba34e1..9f17fa27fe 100644 --- a/src/aui/tabartmsw.cpp +++ b/src/aui/tabartmsw.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/aui/tabartmsw.h -// Purpose: wxAuiMSWTabArt declaration +// Name: src/aui/tabartmsw.cpp +// Purpose: wxAuiMSWTabArt implementation // Author: Tobias Taschner // Created: 2015-09-26 // Copyright: (c) 2015 wxWidgets development team diff --git a/src/generic/bannerwindow.cpp b/src/generic/bannerwindow.cpp index 15c2719b67..6c0b234747 100644 --- a/src/generic/bannerwindow.cpp +++ b/src/generic/bannerwindow.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: wx/bannerwindow.h +// Name: src/generic/bannerwindow.cpp // Purpose: wxBannerWindow class implementation // Author: Vadim Zeitlin // Created: 2011-08-16 diff --git a/src/qt/clipbrd.cpp b/src/qt/clipbrd.cpp index 5a39a623c2..5479fe3109 100644 --- a/src/qt/clipbrd.cpp +++ b/src/qt/clipbrd.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/qt/toolbar.h +// Name: src/qt/clipbrd.cpp // Author: Sean D'Epagnier // Copyright: (c) Sean D'Epagnier 2014 // Licence: wxWindows licence diff --git a/src/qt/colour.cpp b/src/qt/colour.cpp index 4192179d7b..e851d00caf 100644 --- a/src/qt/colour.cpp +++ b/src/qt/colour.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/qt/colour.h +// Name: src/qt/colour.cpp // Purpose: wxColour class implementation for wxQt // Author: Kolya Kosenko // Created: 2010-05-12 diff --git a/src/qt/dataobj.cpp b/src/qt/dataobj.cpp index 040ad0a419..27108b1a46 100644 --- a/src/qt/dataobj.cpp +++ b/src/qt/dataobj.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/qt/dataform.h +// Name: src/qt/dataobj.cpp // Author: Peter Most // Copyright: (c) Peter Most // Licence: wxWindows licence diff --git a/src/qt/nonownedwnd.cpp b/src/qt/nonownedwnd.cpp index 91ed44e740..dfb48fbb6f 100644 --- a/src/qt/nonownedwnd.cpp +++ b/src/qt/nonownedwnd.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: wx/qt/nonownedwnd.h +// Name: src/qt/nonownedwnd.cpp // Author: Sean D'Epagnier // Copyright: (c) 2016 wxWidgets dev team // Licence: wxWindows licence From ccd2862d233a21f9824d898239dccbda17d375ed Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2018 13:39:27 +0200 Subject: [PATCH 139/231] Use SDK options with cpp too in configure under macOS Otherwise trying to compile and preprocess a file could behave differently because the format could not find a header existing in the system due to the use of -isysroot option, confusing configure. --- configure | 2 ++ configure.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configure b/configure index f16d012a6c..cb8efcf19d 100755 --- a/configure +++ b/configure @@ -20194,6 +20194,7 @@ elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then fi if test "x$MACOSX_SDK_OPTS" != "x"; then + eval "CPP=\"$CPP $MACOSX_SDK_OPTS\"" eval "CC=\"$CC $MACOSX_SDK_OPTS\"" eval "CXX=\"$CXX $MACOSX_SDK_OPTS\"" eval "LD=\"$LD $MACOSX_SDK_OPTS\"" @@ -20206,6 +20207,7 @@ if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then else MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN" fi + eval "CPP=\"$CPP $MACOSX_VERSION_MIN_OPTS\"" eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\"" eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\"" eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\"" diff --git a/configure.in b/configure.in index dd079889cb..326c675a04 100644 --- a/configure.in +++ b/configure.in @@ -1279,6 +1279,7 @@ elif test "x$wxUSE_MACOSX_VERSION_MIN" = "x"; then fi if test "x$MACOSX_SDK_OPTS" != "x"; then + eval "CPP=\"$CPP $MACOSX_SDK_OPTS\"" eval "CC=\"$CC $MACOSX_SDK_OPTS\"" eval "CXX=\"$CXX $MACOSX_SDK_OPTS\"" eval "LD=\"$LD $MACOSX_SDK_OPTS\"" @@ -1291,6 +1292,7 @@ if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then else MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN" fi + eval "CPP=\"$CPP $MACOSX_VERSION_MIN_OPTS\"" eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\"" eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\"" eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\"" From 2242e98a4c0821ea352ffa22b57d9c32d242fc5c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2018 18:14:47 +0200 Subject: [PATCH 140/231] Disable the use of liblzma in libtiff if detecting it failed We only disabled LZMA support in libtiff if --without-liblzma was explicitly specified, but we need to do it also if liblzma wasn't detected because libtiff configure might erroneously decide that it's available under macOS when using -isysroot, which would result in compilation errors later. And even if there were no such problem, it's still worth disabling LZMA support explicitly to skip unnecessary checking for it again in libtiff configure. --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index cb8efcf19d..a13a739ad2 100755 --- a/configure +++ b/configure @@ -23371,7 +23371,7 @@ fi fi fi -if test "$HAVE_LZMA" = "no" -o "$wxUSE_LIBTIFF" = "builtin"; then +if test "$wxUSE_LIBLZMA" = "no" -a "$wxUSE_LIBTIFF" = "builtin"; then ac_configure_args="$ac_configure_args --disable-lzma" fi diff --git a/configure.in b/configure.in index 326c675a04..e168e56e6f 100644 --- a/configure.in +++ b/configure.in @@ -2585,7 +2585,7 @@ dnl We need to disable the use of lzma in built-in libtiff explicitly, as dnl otherwise we'd depend on the system lzma library, which is typically dnl undesirable when using builtin libraries. We also disable the use of lzma dnl if it's not available anyhow, just to speed up libtiff configure a little. -if test "$HAVE_LZMA" = "no" -o "$wxUSE_LIBTIFF" = "builtin"; then +if test "$wxUSE_LIBLZMA" = "no" -a "$wxUSE_LIBTIFF" = "builtin"; then ac_configure_args="$ac_configure_args --disable-lzma" fi From 35a9f134cc138fbfffa482c5b0086e57eda98af4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 20 Oct 2018 09:58:30 -0700 Subject: [PATCH 141/231] Fix build with wxUSE_UNICODE_UTF8 wxString is not implicitly convertible to const char* in that configuration. Also, stock IDs work fine with GTK+3 despite being deprecated, so only avoid them for GTK+4. --- src/gtk/infobar.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index 453e11448d..55859bca32 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -139,7 +139,6 @@ bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid) // finish creation and connect to all the signals we're interested in m_parent->DoAddChild(this); - PostCreation(wxDefaultSize); GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response)); @@ -232,18 +231,13 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label) // our best size (at least in vertical direction) InvalidateBestSize(); - GtkWidget *button = gtk_info_bar_add_button - ( - GTK_INFO_BAR(m_widget), - label.empty() ? -#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0) - wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(btnid))) + GtkWidget* button = gtk_info_bar_add_button(GTK_INFO_BAR(m_widget), +#ifdef __WXGTK4__ + wxGTK_CONV(label.empty() ? wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)) : label), #else - wxString(wxGetStockGtkID(btnid)) -#endif // GTK >= 3.10 / < 3.10 - : wxGTK_CONV(label), - btnid - ); + label.empty() ? wxGetStockGtkID(btnid) : static_cast(wxGTK_CONV(label)), +#endif + btnid); wxASSERT_MSG( button, "unexpectedly failed to add button to info bar" ); From 17055fb8c6fdbba5fb92b6519b801da7a7e77491 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2018 19:04:02 +0200 Subject: [PATCH 142/231] Don't assert in focus code for buttons inside a wxPopupWindow IsTopLevel() returns true for wxPopupWindow, even if it's not a subclass of wxTopLevelWindow, so GetTLWParentIfNotBeingDeleted() asserted when called with a button inside a wxPopupWindow. Just return null from it instead for now. A better solution could be to return wxNonOwnedWindow from GetTLWParentIfNotBeingDeleted() (which would need to be renamed to something more suitable) and move the {Get,Set}TmpDefaultItem() methods into it. --- src/msw/button.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 8211259dcb..ae3cf19601 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -252,28 +252,14 @@ wxWindow *wxButton::SetDefault() // return NULL static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win) { - for ( ;; ) - { - // IsTopLevel() will return false for a wxTLW being deleted, so we also - // need the parent test for this case - wxWindow * const parent = win->GetParent(); - if ( !parent || win->IsTopLevel() ) - { - if ( win->IsBeingDeleted() ) - return NULL; + wxWindow* const parent = wxGetTopLevelParent(win); + wxASSERT_MSG( parent, wxT("button without top level parent?") ); - break; - } + if ( parent->IsBeingDeleted() ) + return NULL; - win = parent; - } - - wxASSERT_MSG( win, wxT("button without top level parent?") ); - - wxTopLevelWindow * const tlw = wxDynamicCast(win, wxTopLevelWindow); - wxASSERT_MSG( tlw, wxT("logic error in GetTLWParentIfNotBeingDeleted()") ); - - return tlw; + // Note that this may still return null for a button inside wxPopupWindow. + return wxDynamicCast(parent, wxTopLevelWindow); } // set this button as being currently default From 56c419116838045f23f046112960d4e42f98f80d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2018 18:44:18 +0200 Subject: [PATCH 143/231] Reimplement wxPopupWindow as a WS_POPUP window under MSW Don't use the child window of the desktop window for popup windows under MSW, while this worked in simplest cases, it didn't allow having functional controls inside a wxPopupWindow as e.g. wxTextCtrl didn't accept input it at all if created as a child of such window. Instead, switch to using a top-level window, with WS_POPUP style, and fix the problem with the loss of activation by explicitly pretending to still be active in the owner window when losing activation to our own popup (thanks to Barmak Shemirani for providing this solution). Also use an MSW-specific and much simpler implementation of detecting when the popup should be dismissed in wxPopupTransientWindow: instead of capturing mouse or tracking focus, just react to activation loss directly. Add a wxTextCtrl to the popup in samples/popup to show that editing it works now. --- include/wx/msw/popupwin.h | 15 +++--- include/wx/popupwin.h | 88 ++++++++++++++++++++++++-------- samples/popup/popup.cpp | 2 + src/common/popupcmn.cpp | 85 ++++++++++++++----------------- src/msw/popupwin.cpp | 103 ++++++++++++++++++++++++++------------ src/msw/window.cpp | 22 ++++++++ 6 files changed, 206 insertions(+), 109 deletions(-) diff --git a/include/wx/msw/popupwin.h b/include/wx/msw/popupwin.h index 5ac4a09c03..d41dda58e5 100644 --- a/include/wx/msw/popupwin.h +++ b/include/wx/msw/popupwin.h @@ -18,25 +18,28 @@ class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase { public: - wxPopupWindow() { } + wxPopupWindow() { m_owner = NULL; } wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) { (void)Create(parent, flags); } bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - virtual void SetFocus() wxOVERRIDE; virtual bool Show(bool show = true) wxOVERRIDE; // return the style to be used for the popup windows virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const wxOVERRIDE; - // get the HWND to be used as parent of this window with CreateWindow() - virtual WXHWND MSWGetParent() const wxOVERRIDE; -protected: + // Implementation only from now on. + + // Return the top level window parent of this popup or null. + wxWindow* MSWGetOwner() const { return m_owner; } + +private: + wxWindow* m_owner; + wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow); }; #endif // _WX_MSW_POPUPWIN_H_ - diff --git a/include/wx/popupwin.h b/include/wx/popupwin.h index ea6a4427a4..3d20bf4a7b 100644 --- a/include/wx/popupwin.h +++ b/include/wx/popupwin.h @@ -76,24 +76,16 @@ public: // when the user clicks mouse outside it or if it loses focus in any other way // ---------------------------------------------------------------------------- -class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; -class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; - -class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupWindow +// Define the public API of wxPopupTransientWindow: +class WXDLLIMPEXP_CORE wxPopupTransientWindowBase : public wxPopupWindow { public: - // ctors - wxPopupTransientWindow() { Init(); } - wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); - - virtual ~wxPopupTransientWindow(); - // popup the window (this will show it too) and keep focus at winFocus // (or itself if it's NULL), dismiss the popup if we lose focus - virtual void Popup(wxWindow *focus = NULL); + virtual void Popup(wxWindow *focus = NULL) = 0; // hide the window - virtual void Dismiss(); + virtual void Dismiss() = 0; // can the window be dismissed now? // @@ -104,24 +96,74 @@ public: // called when a mouse is pressed while the popup is shown: return true // from here to prevent its normal processing by the popup (which consists // in dismissing it if the mouse is clicked outside it) - virtual bool ProcessLeftDown(wxMouseEvent& event); - - // Overridden to grab the input on some plaforms - virtual bool Show( bool show = true ) wxOVERRIDE; + virtual bool ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) + { return false; } // Override to implement delayed destruction of this window. virtual bool Destroy() wxOVERRIDE; protected: - // common part of all ctors - void Init(); - // this is called when the popup is disappeared because of anything // else but direct call to Dismiss() - virtual void OnDismiss(); + virtual void OnDismiss() { } // dismiss and notify the derived class - void DismissAndNotify(); + void DismissAndNotify() + { + Dismiss(); + OnDismiss(); + } +}; + +#ifdef __WXMSW__ + +class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupTransientWindowBase +{ +public: + // ctors + wxPopupTransientWindow() { } + wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE) + { Create(parent, style); } + + // Implement base class pure virtuals. + virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; + virtual void Dismiss() wxOVERRIDE; + + // Override to handle WM_NCACTIVATE. + virtual bool MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) wxOVERRIDE; + +private: + wxDECLARE_DYNAMIC_CLASS(wxPopupTransientWindow); + wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); +}; + +#else // !__WXMSW__ + +class WXDLLIMPEXP_FWD_CORE wxPopupWindowHandler; +class WXDLLIMPEXP_FWD_CORE wxPopupFocusHandler; + +class WXDLLIMPEXP_CORE wxPopupTransientWindow : public wxPopupTransientWindowBase +{ +public: + // ctors + wxPopupTransientWindow() { Init(); } + wxPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); + + virtual ~wxPopupTransientWindow(); + + // Implement base class pure virtuals. + virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; + virtual void Dismiss() wxOVERRIDE; + + // Overridden to grab the input on some plaforms + virtual bool Show( bool show = true ) wxOVERRIDE; + +protected: + // common part of all ctors + void Init(); // remove our event handlers void PopHandlers(); @@ -129,7 +171,7 @@ protected: // get alerted when child gets deleted from under us void OnDestroy(wxWindowDestroyEvent& event); -#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON) +#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON // Check if the mouse needs to be captured or released: we must release // when it's inside our window if we want the embedded controls to work. void OnIdle(wxIdleEvent& event); @@ -154,6 +196,8 @@ protected: wxDECLARE_NO_COPY_CLASS(wxPopupTransientWindow); }; +#endif // __WXMSW__/!__WXMSW__ + #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) // ---------------------------------------------------------------------------- diff --git a/samples/popup/popup.cpp b/samples/popup/popup.cpp index 0d1bc729e2..1e0cf61912 100644 --- a/samples/popup/popup.cpp +++ b/samples/popup/popup.cpp @@ -135,6 +135,8 @@ SimpleTransientPopup::SimpleTransientPopup( wxWindow *parent, bool scrolled ) topSizer->Add( text, 0, wxALL, 5 ); topSizer->Add( m_button, 0, wxALL, 5 ); topSizer->Add( m_spinCtrl, 0, wxALL, 5 ); + topSizer->Add( new wxTextCtrl(m_panel, wxID_ANY, "Try to type here"), + 0, wxEXPAND|wxALL, 5 ); topSizer->Add( m_mouseText, 0, wxCENTRE|wxALL, 5 ); if ( scrolled ) diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index e69ad0d2ad..19c16e4fb5 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -46,8 +46,6 @@ #elif defined(__WXGTK__) #include #define gtk_widget_get_window(x) x->window -#elif defined(__WXMSW__) - #include "wx/msw/private.h" #elif defined(__WXX11__) #include "wx/x11/private.h" #endif @@ -59,6 +57,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxPopupTransientWindow, wxPopupWindow); wxIMPLEMENT_DYNAMIC_CLASS(wxPopupComboWindow, wxPopupTransientWindow); #endif +#ifndef __WXMSW__ + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -113,11 +113,13 @@ wxBEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler) wxEND_EVENT_TABLE() wxBEGIN_EVENT_TABLE(wxPopupTransientWindow, wxPopupWindow) -#if defined(__WXMSW__) || (defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON) +#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON EVT_IDLE(wxPopupTransientWindow::OnIdle) #endif wxEND_EVENT_TABLE() +#endif // !__WXMSW__ + // ============================================================================ // implementation // ============================================================================ @@ -201,6 +203,27 @@ void wxPopupWindowBase::Position(const wxPoint& ptOrigin, Move(x, y, wxSIZE_NO_ADJUSTMENTS); } +// ---------------------------------------------------------------------------- +// wxPopupTransientWindowBase +// ---------------------------------------------------------------------------- + +bool wxPopupTransientWindowBase::Destroy() +{ + // The popup window can be deleted at any moment, even while some events + // are still being processed for it, so delay its real destruction until + // the next idle time when we're sure that it's safe to really destroy it. + + wxCHECK_MSG( !wxPendingDelete.Member(this), false, + wxS("Shouldn't destroy the popup twice.") ); + + wxPendingDelete.Append(this); + + return true; +} + +// MSW implementation is in platform-specific src/msw/popupwin.cpp. +#ifndef __WXMSW__ + // ---------------------------------------------------------------------------- // wxPopupTransientWindow // ---------------------------------------------------------------------------- @@ -292,18 +315,10 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_child->PushEventHandler(m_handlerPopup); -#if defined(__WXMSW__) - // Focusing on child of popup window does not work on MSW unless WS_POPUP - // style is set. We do not even want to try to set the focus, as it may - // provoke errors on some Windows versions (Vista and later). - if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & WS_POPUP ) -#endif - { - m_focus = winFocus ? winFocus : this; - m_focus->SetFocus(); - } + m_focus = winFocus ? winFocus : this; + m_focus->SetFocus(); -#if defined( __WXMSW__ ) || (defined( __WXMAC__) && wxOSX_USE_COCOA_OR_CARBON) +#if defined( __WXMAC__) && wxOSX_USE_COCOA_OR_CARBON // MSW doesn't allow to set focus to the popup window, but we need to // subclass the window which has the focus, and not winFocus passed in or // otherwise everything else breaks down @@ -354,7 +369,7 @@ bool wxPopupTransientWindow::Show( bool show ) } #endif -#if defined( __WXMSW__ ) || defined( __WXMAC__) +#if defined( __WXMAC__) if (!show && m_child && m_child->HasCapture()) { m_child->ReleaseMouse(); @@ -414,7 +429,7 @@ bool wxPopupTransientWindow::Show( bool show ) } #endif -#if defined( __WXMSW__ ) || defined( __WXMAC__) +#if defined( __WXMAC__) if (show && m_child) { // Assume that the mouse is outside the popup to begin with @@ -425,44 +440,13 @@ bool wxPopupTransientWindow::Show( bool show ) return ret; } -bool wxPopupTransientWindow::Destroy() -{ - // The popup window can be deleted at any moment, even while some events - // are still being processed for it, so delay its real destruction until - // the next idle time when we're sure that it's safe to really destroy it. - - wxCHECK_MSG( !wxPendingDelete.Member(this), false, - wxS("Shouldn't destroy the popup twice.") ); - - wxPendingDelete.Append(this); - - return true; -} - void wxPopupTransientWindow::Dismiss() { Hide(); PopHandlers(); } -void wxPopupTransientWindow::DismissAndNotify() -{ - Dismiss(); - OnDismiss(); -} - -void wxPopupTransientWindow::OnDismiss() -{ - // nothing to do here - but it may be interesting for derived class -} - -bool wxPopupTransientWindow::ProcessLeftDown(wxMouseEvent& WXUNUSED(event)) -{ - // no special processing here - return false; -} - -#if defined(__WXMSW__) ||(defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON) +#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) { event.Skip(); @@ -500,6 +484,7 @@ void wxPopupTransientWindow::OnIdle(wxIdleEvent& event) } #endif // wxOSX/Carbon +#endif // !__WXMSW__ #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) @@ -555,6 +540,8 @@ void wxPopupComboWindow::OnKeyDown(wxKeyEvent& event) #endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) +#ifndef __WXMSW__ + // ---------------------------------------------------------------------------- // wxPopupWindowHandler // ---------------------------------------------------------------------------- @@ -696,4 +683,6 @@ void wxPopupFocusHandler::OnChar(wxKeyEvent& event) } } +#endif // !__WXMSW__ + #endif // wxUSE_POPUPWIN diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index f1ed6258ba..eea9c444bc 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -32,19 +32,28 @@ #include "wx/msw/private.h" // for GetDesktopWindow() +// Set to the popup window currently being shown, if any. +extern wxPopupWindow* wxCurrentPopupWindow = NULL; + // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + bool wxPopupWindow::Create(wxWindow *parent, int flags) { // popup windows are created hidden by default Hide(); + m_owner = wxGetTopLevelParent(parent); + return wxPopupWindowBase::Create(parent) && wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, - flags | wxPOPUP_WINDOW); + flags); } WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const @@ -52,6 +61,14 @@ WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const // we only honour the border flags, the others don't make sense for us WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle); + // We need to be a popup (i.e. not a child) window in order to not be + // confined to the parent window area, as is required for a drop down, for + // example. Old implementation used WS_CHILD and made this window a child + // of the desktop window, but this resulted in problems with handling input + // in the popup children, and so was changed to the current version. + style &= ~WS_CHILD; + style |= WS_POPUP; + if ( exstyle ) { // a popup window floats on top of everything @@ -61,45 +78,65 @@ WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const return style; } -WXHWND wxPopupWindow::MSWGetParent() const -{ - // we must be a child of the desktop to be able to extend beyond the parent - // window client area (like the comboboxes drop downs do) - // - // NB: alternative implementation would be to use WS_POPUP instead of - // WS_CHILD but then showing a popup would deactivate the parent which - // is ugly and working around this, although possible, is even more - // ugly - return (WXHWND)::GetDesktopWindow(); -} - -void wxPopupWindow::SetFocus() -{ - // Focusing on a popup window does not work on MSW unless WS_POPUP style is - // set (which is never the case currently, see the note in MSWGetParent()). - // We do not even want to try to set the focus, as it returns an error from - // SetFocus() on recent Windows versions (since Vista) and the resulting - // debug message is annoying. -} - bool wxPopupWindow::Show(bool show) { - if ( !wxWindowMSW::Show(show) ) - return false; + // It's important to update wxCurrentPopupWindow before showing the window, + // to ensure that it already set by the time the owner gets WM_NCACTIVATE + // from inside Show() so that it knows to remain [appearing] active. + wxCurrentPopupWindow = show ? this : NULL; - if ( show ) + return wxPopupWindowBase::Show(show); +} + +// ---------------------------------------------------------------------------- +// wxPopupTransientWindow +// ---------------------------------------------------------------------------- + +void wxPopupTransientWindow::Popup(wxWindow* focus) +{ + Show(); + + if ( focus ) + focus->SetFocus(); +} + +void wxPopupTransientWindow::Dismiss() +{ + Hide(); +} + +bool +wxPopupTransientWindow::MSWHandleMessage(WXLRESULT *result, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + switch ( message ) { - // raise to top of z order - if (!::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)) - { - wxLogLastError(wxT("SetWindowPos")); - } + case WM_NCACTIVATE: + if ( !wParam ) + { + // Hide the window automatically when it loses activation. + Dismiss(); - // and set it as the foreground window so the mouse can be captured - ::SetForegroundWindow(GetHwnd()); + // Activation might have gone to a different window or maybe + // even a different application, don't let our owner continue + // to appear active in this case. + wxWindow* const owner = MSWGetOwner(); + if ( owner ) + { + const HWND hwndActive = ::GetActiveWindow(); + if ( hwndActive != GetHwndOf(owner) ) + { + ::SendMessage(GetHwndOf(owner), WM_NCACTIVATE, FALSE, 0); + } + } + } + break; } - return true; + return wxPopupTransientWindowBase::MSWHandleMessage(result, message, + wParam, lParam); } #endif // #if wxUSE_POPUPWIN diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 83add1d1d8..d17cf3f39e 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -60,6 +60,7 @@ #include "wx/hashmap.h" #include "wx/evtloop.h" +#include "wx/popupwin.h" #include "wx/power.h" #include "wx/scopeguard.h" #include "wx/sysopt.h" @@ -134,6 +135,10 @@ extern wxMenu *wxCurrentPopupMenu; #endif +#if wxUSE_POPUPWIN +extern wxPopupWindow* wxCurrentPopupWindow; +#endif // wxUSE_POPUPWIN + #if wxUSE_UXTHEME // This is a hack used by the owner-drawn wxButton implementation to ensure // that the brush used for erasing its background is correctly aligned with the @@ -3677,6 +3682,23 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } break; + case WM_NCACTIVATE: + // When we're losing activation to our own popup window, we want to + // retain the "active" appearance of the title bar, as dropping + // down a combobox popup shouldn't deactivate the window containing + // the combobox, for example. Explicitly calling DefWindowProc() to + // draw the window as active seems to be the only way of achieving + // this (thanks to Barmak Shemirani for suggesting it at + // https://stackoverflow.com/a/52808753/15275). + if ( !wParam && + wxCurrentPopupWindow && + wxCurrentPopupWindow->MSWGetOwner() == this ) + { + rc.result = MSWDefWindowProc(message, TRUE, lParam); + processed = true; + } + break; + #if wxUSE_UXTHEME // If we want the default themed border then we need to draw it ourselves case WM_NCCALCSIZE: From ef2b015e399e192050fad5eca5b5f125dfa54946 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 20 Oct 2018 22:58:48 +0200 Subject: [PATCH 144/231] Export CC and similar variables for sub-configure scripts This is especially important under macOS where we modify CC, CPP and CXX to use the specified SDK, and it's important to compile the code of 3rd party libtiff and expat libraries using the same SDK, but also matters for the other platforms when using non-default CC and CXX values. By exporting these values we ensure that tiff and expat use the same compilers and flags as the main libraries linking with them. --- configure | 2 ++ configure.in | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/configure b/configure index a13a739ad2..2378cc74fd 100755 --- a/configure +++ b/configure @@ -20494,6 +20494,8 @@ if test "$USE_UNIX" = 1 ; then fi +export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } diff --git a/configure.in b/configure.in index e168e56e6f..1159b013c6 100644 --- a/configure.in +++ b/configure.in @@ -1477,6 +1477,10 @@ if test "$USE_UNIX" = 1 ; then AC_DEFINE(__UNIX__) fi +dnl Values of these variables shouldn't change any longer from now on, we +dnl export them to ensure they're picked up by sub-configure scripts. +export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + dnl ------------------------------------------------------------------------ dnl Check for headers dnl ------------------------------------------------------------------------ From e397d5d82535652319a348f348f8f968d5348910 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 21 Oct 2018 15:58:33 +0200 Subject: [PATCH 145/231] Propagate InformFirstDirection() calls to wxBoxSizer children InformFirstDirection() is required to let wxWrapSizer calculate its best height from its current width (or vice versa, but usually in this sense), but it only worked if wxWrapSizer was an immediate child of another size doing layout but not if wxWrapSizer was inside another wxBoxSizer which was contained in a top-level sizer. Explicitly forward calls to InformFirstDirection() to wxBoxSizer children to fix this and make wxWrapSizers nested in wxBoxSizer work. Note that there are still many problems in this code, including but not limited to: - Doing this forwarding for the sizer minor direction only. - Not passing the correct value of "availableOtherDir". - Still calling InformFirstDirection() from RecalcSizes(), when it's too late to change the min size returned by CalcMin(). - Inconsistency: wxGridSizer calls InformFirstDirection() from its CalcMin(), wxFlexGridSizer calls it from its RecalcSizes(), wxGridBagSizer doesn't call it at all. All this size-in-first-direction logic really needs to be completely reviewed, but for now at least make wxWrapSizer inside a wxBoxSizer work as well, or as badly, as wxWrapSizer on its own. --- include/wx/sizer.h | 8 ++++++++ src/common/sizer.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/wx/sizer.h b/include/wx/sizer.h index 14b446a71a..16c86222a1 100644 --- a/include/wx/sizer.h +++ b/include/wx/sizer.h @@ -619,6 +619,10 @@ public: // Inform sizer about the first direction that has been decided (by parent item) // Returns true if it made use of the information (and recalculated min size) + // + // Note that while this method doesn't do anything by default, it should + // almost always be overridden in the derived classes and should have been + // pure virtual if not for backwards compatibility constraints. virtual bool InformFirstDirection( int WXUNUSED(direction), int WXUNUSED(size), int WXUNUSED(availableOtherDir) ) { return false; } @@ -958,6 +962,10 @@ public: virtual wxSize CalcMin() wxOVERRIDE; virtual void RecalcSizes() wxOVERRIDE; + virtual bool InformFirstDirection(int direction, + int size, + int availableOtherDir) wxOVERRIDE; + protected: // Only overridden to perform extra debugging checks. virtual wxSizerItem *DoInsert(size_t index, wxSizerItem *item) wxOVERRIDE; diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index ba50b6c9c0..fa42c07497 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -2544,6 +2544,31 @@ wxSize wxBoxSizer::CalcMin() return m_calculatedMinSize; } +bool +wxBoxSizer::InformFirstDirection(int direction, int size, int availableOtherDir) +{ + // In principle, we could propagate the information about the size in the + // sizer major direction too, but this would require refactoring CalcMin() + // to determine the actual sizes all our items would have with the given + // size and we don't do this yet, so for now handle only the simpler case + // of informing all our items about their size in the orthogonal direction. + if ( direction == GetOrientation() ) + return false; + + bool didUse = false; + + for ( wxSizerItemList::compatibility_iterator node = m_children.GetFirst(); + node; + node = node->GetNext() ) + { + didUse |= node->GetData()->InformFirstDirection(direction, + size, + availableOtherDir); + } + + return didUse; +} + //--------------------------------------------------------------------------- // wxStaticBoxSizer //--------------------------------------------------------------------------- From c6cc416977228b35d161cbc3a506e993922e7573 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 21 Oct 2018 16:45:24 +0200 Subject: [PATCH 146/231] Propagate InformFirstDirection() to wxCollapsiblePane pane As wxCollapsiblePane doesn't use sizers for layout (and while this could be changed for the generic version, it still wouldn't fix the problem for the native one), default InformFirstDirection() implementation forwarding it to the window sizer doesn't work for it and we need to explicitly let the contents of wxCollapsiblePane know about the available size. --- include/wx/collpane.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/wx/collpane.h b/include/wx/collpane.h index 54ccd73650..168dc7c06e 100644 --- a/include/wx/collpane.h +++ b/include/wx/collpane.h @@ -43,6 +43,23 @@ public: virtual wxString GetLabel() const wxOVERRIDE = 0; virtual void SetLabel(const wxString& label) wxOVERRIDE = 0; + + virtual bool + InformFirstDirection(int direction, + int size, + int availableOtherDir) wxOVERRIDE + { + wxWindow* const p = GetPane(); + if ( !p ) + return false; + + if ( !p->InformFirstDirection(direction, size, availableOtherDir) ) + return false; + + InvalidateBestSize(); + + return true; + } }; From d62c284f03cb03c2853ba0f13e4615eeafc182e0 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:56 -0400 Subject: [PATCH 147/231] Non PCH fix by adding include of "wx/wxcrtvararg.h" PCH: Precompiled Header The problem happens when wxUSE_SPINCTRL=0 --- src/generic/numdlgg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/generic/numdlgg.cpp b/src/generic/numdlgg.cpp index 17c15f8788..0c0262384a 100644 --- a/src/generic/numdlgg.cpp +++ b/src/generic/numdlgg.cpp @@ -35,6 +35,7 @@ #include "wx/textctrl.h" #include "wx/intl.h" #include "wx/sizer.h" + #include "wx/wxcrtvararg.h" #endif #if wxUSE_STATLINE From 71a2fc0706eef9e20bc9e2e769d249f21b35a69e Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:56 -0400 Subject: [PATCH 148/231] Forward declare wxQt template class --- include/wx/qt/window.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h index df402a42d4..3a07aed4c4 100644 --- a/include/wx/qt/window.h +++ b/include/wx/qt/window.h @@ -11,6 +11,9 @@ #include +class QShortcut; +template < class T > class QList; + class QWidget; class QScrollWindow; class QAbstractScrollArea; From caa6e5de2f7104930ec4ef2524779f389dfa8a3b Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:56 -0400 Subject: [PATCH 149/231] Add message "wxStyledTextCtrl requires wxUSE_SCROLLBAR" --- include/wx/chkconf.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 586680b307..82bb132b8a 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -2345,6 +2345,15 @@ # define wxUSE_STC 0 # endif # endif + +# if !wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxStyledTextCtrl requires wxUSE_SCROLLBAR" +# else +# undef wxUSE_STC +# define wxUSE_STC 0 +# endif +# endif #endif /* wxUSE_STC */ #if wxUSE_RICHTEXT From f1fa6d5ea25bed5870c7933176f2332205009f12 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:57 -0400 Subject: [PATCH 150/231] Add guard over wxMSWDateControls --- include/wx/msw/private/datecontrols.h | 2 ++ src/msw/datetimectrl.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/wx/msw/private/datecontrols.h b/include/wx/msw/private/datecontrols.h index 9794cfae89..b38723a40a 100644 --- a/include/wx/msw/private/datecontrols.h +++ b/include/wx/msw/private/datecontrols.h @@ -14,6 +14,7 @@ #include "wx/msw/wrapwin.h" +#if wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL // namespace for the helper functions related to the date controls namespace wxMSWDateControls { @@ -24,6 +25,7 @@ namespace wxMSWDateControls extern bool CheckInitialization(); } // namespace wxMSWDateControls +#endif // wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL #endif // _MSW_PRIVATE_DATECONTROLS_H_ diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index 18eed3d105..cbc65b42a2 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -62,8 +62,10 @@ wxDateTimePickerCtrl::MSWCreateDateTimePicker(wxWindow *parent, const wxValidator& validator, const wxString& name) { +#if wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL if ( !wxMSWDateControls::CheckInitialization() ) return false; +#endif // wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL // initialize the base class if ( !CreateControl(parent, id, pos, size, style, validator, name) ) From 93d71116b7d3805c72e8b4e48f6807f7b9b545a3 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:57 -0400 Subject: [PATCH 151/231] Change guard to wxUSE_TIMEPICKCTRL from wxUSE_DATEPICKCTRL --- src/msw/timectrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/timectrl.cpp b/src/msw/timectrl.cpp index 7469e12c3c..b5cad7fc9b 100644 --- a/src/msw/timectrl.cpp +++ b/src/msw/timectrl.cpp @@ -21,7 +21,7 @@ #pragma hdrstop #endif -#if wxUSE_DATEPICKCTRL +#if wxUSE_TIMEPICKCTRL #ifndef WX_PRECOMP #include "wx/msw/wrapcctl.h" From 09aa25ab4aaca0984419635852a8961c432445e0 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Sun, 21 Oct 2018 21:58:57 -0400 Subject: [PATCH 152/231] Add wxUSE_SCROLLBAR guards in wxUniversal --- include/wx/univ/scrarrow.h | 2 ++ src/univ/scrarrow.cpp | 2 ++ src/univ/scrolbar.cpp | 4 ++-- src/univ/scrthumb.cpp | 2 ++ src/univ/winuniv.cpp | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/wx/univ/scrarrow.h b/include/wx/univ/scrarrow.h index 6e6997c687..5746c7607a 100644 --- a/include/wx/univ/scrarrow.h +++ b/include/wx/univ/scrarrow.h @@ -11,6 +11,7 @@ #ifndef _WX_UNIV_SCRARROW_H_ #define _WX_UNIV_SCRARROW_H_ +#if wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // wxScrollArrows is not a control but just a class containing the common // functionality of scroll arrows, whether part of scrollbars, spin ctrls or @@ -107,5 +108,6 @@ public: // false to stop it virtual bool OnArrow(wxScrollArrows::Arrow arrow) = 0; }; +#endif // wxUSE_SCROLLBAR #endif // _WX_UNIV_SCRARROW_H_ diff --git a/src/univ/scrarrow.cpp b/src/univ/scrarrow.cpp index a540046aea..f693b8bbff 100644 --- a/src/univ/scrarrow.cpp +++ b/src/univ/scrarrow.cpp @@ -33,6 +33,7 @@ #include "wx/univ/inphand.h" #include "wx/univ/theme.h" +#if wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // wxScrollArrowCaptureData: contains the data used while the arrow is being // pressed by the user @@ -298,3 +299,4 @@ bool wxScrollArrows::HandleMouse(const wxMouseEvent& event) const return true; } +#endif // wxUSE_SCROLLBAR diff --git a/src/univ/scrolbar.cpp b/src/univ/scrolbar.cpp index 61da0cf772..0f63eabd08 100644 --- a/src/univ/scrolbar.cpp +++ b/src/univ/scrolbar.cpp @@ -1153,7 +1153,7 @@ bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer, #endif // wxUSE_SCROLLBAR -#if wxUSE_TIMER +#if wxUSE_TIMER && wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // wxScrollTimer @@ -1198,4 +1198,4 @@ void wxScrollTimer::Notify() } } -#endif // wxUSE_TIMER +#endif // wxUSE_TIMER && wxUSE_SCROLLBAR diff --git a/src/univ/scrthumb.cpp b/src/univ/scrthumb.cpp index 604c4044b5..33b7806d31 100644 --- a/src/univ/scrthumb.cpp +++ b/src/univ/scrthumb.cpp @@ -30,6 +30,7 @@ #include "wx/univ/scrtimer.h" #include "wx/univ/scrthumb.h" +#if wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // wxScrollThumbCaptureData: the struct used while dragging the scroll thumb // ---------------------------------------------------------------------------- @@ -290,3 +291,4 @@ int wxScrollThumb::GetThumbPos(const wxMouseEvent& event) const int x = GetMouseCoord(event) - m_captureData->m_ofsMouse; return m_control->PixelToThumbPos(x); } +#endif // wxUSE_SCROLLBAR diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 553d9cb151..ac4b4bfc92 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -59,6 +59,7 @@ // implementation // ============================================================================ +#if wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- // scrollbars class // ---------------------------------------------------------------------------- @@ -80,6 +81,7 @@ public: virtual bool CanBeOutsideClientArea() const { return true; } }; +#endif // wxUSE_SCROLLBAR // ---------------------------------------------------------------------------- From 0955143e6561a82c1c37e169b767a2205b66d0f2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Oct 2018 13:59:09 +0200 Subject: [PATCH 153/231] Don't output flags for "adv" library in wx-config This allows to keep the existing makefiles or configure scripts for building wxWidgets applications using wx-config unchanged to keep them working with the existing wxWidgets releases without adding an unnecessary dependency on the "adv" library when using the latest Git or 3.1.2, when it's released. --- wx-config.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wx-config.in b/wx-config.in index a2a1706d48..d132e3182f 100755 --- a/wx-config.in +++ b/wx-config.in @@ -1242,6 +1242,10 @@ else # MONOLITHIC = 0 fi fi + # Existing scripts may use "wx-config --libs std,adv" or similar, but "adv" + # library is not used any longer. + wx_libs=`remove_field adv $wx_libs` + if [ -n "$output_option_libs" ]; then using_gui=no for i in $wx_libs ; do From a69a43bc538bcdb805e8eea3bf6c01bec506469c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 22 Oct 2018 16:27:22 +0200 Subject: [PATCH 154/231] fixing warning for unused param --- src/osx/core/bitmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index f5240f99fd..5170f3f53b 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -272,7 +272,7 @@ bool wxBitmapRefData::Create(CGContextRef context) return IsOk() ; } -bool wxBitmapRefData::Create(int w, int h, int d, double logicalscale) +bool wxBitmapRefData::Create(int w, int h, int WXUNUSED(d), double logicalscale) { size_t m_width = wxMax(1, w); size_t m_height = wxMax(1, h); From 7dfbe50fc0da9f129091fb18c7d584be89190607 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 22 Oct 2018 17:43:31 +0200 Subject: [PATCH 155/231] fixing proper font rendering color when using emulated bold when the stroke width is set in macOS (emulated bold), the stroke color was not correctly set - unless text color was black --- include/wx/osx/core/cfdictionary.h | 5 +++++ src/osx/carbon/graphics.cpp | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/wx/osx/core/cfdictionary.h b/include/wx/osx/core/cfdictionary.h index fddbb52654..d27c0f5891 100644 --- a/include/wx/osx/core/cfdictionary.h +++ b/include/wx/osx/core/cfdictionary.h @@ -90,6 +90,11 @@ public: { return CFDictionaryCreateCopy(kCFAllocatorDefault, this->m_ptr); } + + CFMutableDictionaryRef CreateMutableCopy() const + { + return CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, this->m_ptr); + } }; class wxCFMutableDictionaryRef : public wxCFDictionaryRefCommon diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index cd99421373..16f58329da 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -39,6 +39,7 @@ #include "wx/osx/dcclient.h" #include "wx/osx/dcmemory.h" #include "wx/osx/private.h" + #include "wx/osx/core/cfdictionary.h" #else #include "CoreServices/CoreServices.h" #include "ApplicationServices/ApplicationServices.h" @@ -2298,7 +2299,23 @@ void wxMacCoreGraphicsContext::DoDrawText( const wxString &str, wxDouble x, wxDo CGColorRef col = wxMacCreateCGColor( fref->GetColour() ); CTFontRef font = fref->OSXGetCTFont(); - wxCFRef attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, fref->OSXGetCTFontAttributes()) ); + wxCFDictionaryRef fontattr(wxCFRetain(fref->OSXGetCTFontAttributes())); + wxCFMutableDictionaryRef inlinefontattr; + + bool setColorsInLine = false; + + // if we emulate boldness the stroke color is not taken from the current context + // therefore we have to set it explicitly + if ( fontattr.GetValue(kCTStrokeWidthAttributeName) != NULL) + { + setColorsInLine = true; + inlinefontattr = fontattr.CreateMutableCopy(); + inlinefontattr.SetValue(kCTForegroundColorFromContextAttributeName, kCFBooleanFalse); + inlinefontattr.SetValue(kCTForegroundColorAttributeName,col); + inlinefontattr.SetValue(kCTStrokeColorAttributeName,col); + } + + wxCFRef attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, setColorsInLine ? inlinefontattr : fontattr ) ); wxCFRef line( CTLineCreateWithAttributedString(attrtext) ); y += CTFontGetAscent(font); From 651e1cd1b58e25e180904a721a64ea0c82c6bad3 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 22 Oct 2018 22:36:42 +0200 Subject: [PATCH 156/231] Supporting newer transparent background API --- include/wx/osx/window.h | 3 ++- src/osx/cocoa/nonownedwnd.mm | 7 +++++++ src/osx/nonownedwnd_osx.cpp | 3 ++- src/osx/window_osx.cpp | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h index caee9c1659..b192b44b47 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -91,7 +91,8 @@ public: virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE; virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE; - + virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE; + virtual int GetCharHeight() const wxOVERRIDE; virtual int GetCharWidth() const wxOVERRIDE; diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 9a7bb661e6..b21d2d2e14 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -778,6 +778,13 @@ long style, long extraStyle, const wxString& WXUNUSED(name) ) if ( !(style & wxFRAME_TOOL_WINDOW) ) [m_macWindow setHidesOnDeactivate:NO]; + + if ( GetWXPeer()->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) + { + [m_macWindow setOpaque:NO]; + [m_macWindow setAlphaValue:1.0]; + [m_macWindow setBackgroundColor:[NSColor clearColor]]; + } } void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), WXWindow nativeWindow ) diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 3f46bca9e2..d8883120ac 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -152,7 +152,8 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxWindowCreateEvent event(this); HandleWindowEvent(event); - SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); + if ( GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) + SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); if ( parent ) parent->AddChild(this); diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 8ec3e2500a..a8242fc83c 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -518,6 +518,11 @@ bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style) return true; } +bool wxWindowMac::IsTransparentBackgroundSupported(wxString* WXUNUSED(reason)) const +{ + return true; +} + bool wxWindowMac::SetBackgroundColour(const wxColour& col ) { if (m_growBox) From a94325a76abe24a96ca0223f684b0ef3ca939c1f Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 23 Oct 2018 21:01:31 +0200 Subject: [PATCH 157/231] fix transparency problems on macOS under mojave any backgroundColor destroys transparency --- src/osx/cocoa/nonownedwnd.mm | 7 ++++++- src/osx/nonownedwnd_osx.cpp | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index b21d2d2e14..64a6b3b74f 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -914,7 +914,12 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) { - [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; + // only set the native background color if the toplevel window's + // background is not supposed to be transparent, otherwise the + // transparency is lost + if( GetWXPeer()->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT && + !(GetWXPeer()->GetWindowStyle() & wxFRAME_SHAPED) ) + [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; return true; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index d8883120ac..3f46bca9e2 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -152,8 +152,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxWindowCreateEvent event(this); HandleWindowEvent(event); - if ( GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) - SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); + SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE )); if ( parent ) parent->AddChild(this); From 708a408733bbfbca3d79042463f2882c0f40c6de Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 23 Oct 2018 21:12:48 +0200 Subject: [PATCH 158/231] move macOS transparency fix one level up --- src/osx/cocoa/nonownedwnd.mm | 7 +------ src/osx/nonownedwnd_osx.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 64a6b3b74f..b21d2d2e14 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -914,12 +914,7 @@ bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha) bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& col ) { - // only set the native background color if the toplevel window's - // background is not supposed to be transparent, otherwise the - // transparency is lost - if( GetWXPeer()->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT && - !(GetWXPeer()->GetWindowStyle() & wxFRAME_SHAPED) ) - [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; + [m_macWindow setBackgroundColor:col.OSXGetNSColor()]; return true; } diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 3f46bca9e2..d43a4eba65 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -254,6 +254,13 @@ wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c ) { + // only set the native background color if the toplevel window's + // background is not supposed to be transparent, otherwise the + // transparency is lost + if( GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT || + (GetWindowStyle() & wxFRAME_SHAPED) ) + return false; + if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol ) return false ; From 67e51e7b6df53c4bbc37afcf6c5d9c521aa09592 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Oct 2018 01:37:44 +0200 Subject: [PATCH 159/231] Show the reason transparent windows can't be used in shaped sample IsTransparentBackgroundSupported() may return more information about why exactly are transparent windows not supported, show it if available. --- samples/shaped/shaped.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/shaped/shaped.cpp b/samples/shaped/shaped.cpp index 9b4985b223..25c6b6e83c 100644 --- a/samples/shaped/shaped.cpp +++ b/samples/shaped/shaped.cpp @@ -278,14 +278,17 @@ void MainFrame::OnShowShaped(wxCommandEvent& WXUNUSED(event)) void MainFrame::OnShowTransparent(wxCommandEvent& WXUNUSED(event)) { - if (IsTransparentBackgroundSupported()) + wxString reason; + if (IsTransparentBackgroundSupported(&reason)) { SeeThroughFrame *seeThroughFrame = new SeeThroughFrame; seeThroughFrame->Create(); seeThroughFrame->Show(true); } else - wxMessageBox("transparent window requires a composited screen"); + { + wxLogError("%s, can't create transparent window.", reason); + } } void MainFrame::OnShowEffect(wxCommandEvent& event) From 9562ca2b70c5421a9f3e94d6ea818efad0ac265b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Oct 2018 02:06:46 +0200 Subject: [PATCH 160/231] Block child window events propagation beyond wxPopupWindow Set wxWS_EX_BLOCK_EVENTS to prevent events bubbling up to the popup parent as it doesn't make much sense. See #18243. --- src/common/popupcmn.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index 19c16e4fb5..f3ebf49c90 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -135,6 +135,12 @@ wxPopupWindowBase::~wxPopupWindowBase() bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags)) { + // By default, block event propagation at this window as it usually + // doesn't make sense. This notably prevents wxScrolledWindow from trying + // to scroll popup contents into view if a popup is shown from it but + // extends beyond its window boundaries. + SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); + return true; } From 2ad0c1b7e16c2830e632e42246c9f6deb62df589 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 24 Oct 2018 10:30:49 +0200 Subject: [PATCH 161/231] Include CMake in how to add wxUSE_ documentation --- docs/contributing/how-to-add-new-wxUSE_XXX.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/contributing/how-to-add-new-wxUSE_XXX.md b/docs/contributing/how-to-add-new-wxUSE_XXX.md index 8d99eb1536..19807eafd4 100644 --- a/docs/contributing/how-to-add-new-wxUSE_XXX.md +++ b/docs/contributing/how-to-add-new-wxUSE_XXX.md @@ -72,6 +72,16 @@ c) configure.in If you have a sample/foo which should be only built when `wxUSE_FOO==1`, then only add it to the SAMPLES_SUBDIRS if `wxUSE_FOO=yes` in configure. -d) docs/doxygen/mainpages/const_wxusedef.h +d) build/cmake/options.cmake + + To include the option in CMake, add a new line in the appropriate + section of options.cmake. + + wx_option(wxUSE_FOO "enable FOO") + + As an optional third parameter you may specify `OFF` when the option + should be disabled by default. + +e) docs/doxygen/mainpages/const_wxusedef.h Add a brief description of the new constant. From d433aa7821e76a2103ddda33de7dc30132b3a790 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 24 Oct 2018 10:37:52 +0200 Subject: [PATCH 162/231] Include CMake in how to add new sample docs --- docs/contributing/how-to-add-new-sample.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/contributing/how-to-add-new-sample.md b/docs/contributing/how-to-add-new-sample.md index aeaafe5705..ae1c933c73 100644 --- a/docs/contributing/how-to-add-new-sample.md +++ b/docs/contributing/how-to-add-new-sample.md @@ -43,12 +43,20 @@ samples/ with demos/ where needed). After this, regenerate configure from configure.in by running "autoconf" on a Unix system in the corresponding directory. -5. Add a short description of what the sample does and how does it work +5. Modify `build/cmake/samples/CMakeLists.txt` to include the sample in + CMake. Add a new line like this: + + wx_add_sample(foo DEPENDS wxUSE_FOO) + + For a complete list of parameters to the `wx_add_sample()` function see + the description in `build/cmake/functions.cmake`. + +6. Add a short description of what the sample does and how does it work to the "samples overview" section in the wxWidgets manual. That section lives in docs/doxygen/mainpages/samples.h; look at the descriptions for other samples, if you are not familiar with Doxygen. -6. Add any non-standard sample's files to build/bakefiles/make_dist.mk (the +7. Add any non-standard sample's files to build/bakefiles/make_dist.mk (the makefiles copies all bmp, cpp, h, ico, png, rc, xpm and makefiles by default, you only need to update it if the sample uses some other files) and run the ./update-manifests.sh script in distrib/scripts (don't forget From a52393267a382bf80605d42ec2729e0f942ac1b9 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 24 Oct 2018 10:52:47 +0200 Subject: [PATCH 163/231] CMake: Enable highest warning level for MSVC This is not enabled for third party libaries as they are currently producing too many warnings. --- build/cmake/functions.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 00e3ed09e1..b12e60d13c 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -75,6 +75,8 @@ endmacro() # Set properties common to builtin third party libraries and wx libs function(wx_set_common_target_properties target_name) + cmake_parse_arguments(wxCOMMON_TARGET_PROPS "DEFAULT_WARNINGS" "" "" ${ARGN}) + if(DEFINED wxBUILD_CXX_STANDARD AND NOT wxBUILD_CXX_STANDARD STREQUAL COMPILER_DEFAULT) # TODO: implement for older CMake versions ? set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${wxBUILD_CXX_STANDARD}) @@ -96,6 +98,13 @@ function(wx_set_common_target_properties target_name) ARCHIVE_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" RUNTIME_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" ) + if(NOT wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS) + # Enable higher warnings for most compilers/IDEs + if(MSVC) + target_compile_options(${target_name} PRIVATE /W4) + endif() + # TODO: add warning flags for other compilers + endif() endfunction() # Set common properties on wx library target @@ -446,7 +455,7 @@ function(wx_set_builtin_target_properties target_name) set_target_properties(${target_name} PROPERTIES FOLDER "Third Party Libraries") - wx_set_common_target_properties(${target_name}) + wx_set_common_target_properties(${target_name} DEFAULT_WARNINGS) if(NOT wxBUILD_SHARED) wx_install(TARGETS ${name} ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}") endif() From e285b3dfef6e9110b71a48dfdea98371f2a902dd Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 24 Oct 2018 10:53:53 +0200 Subject: [PATCH 164/231] Silence harmless MSVC warning (hidden local var) --- src/msw/iniconf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp index 34748ac826..565b6b8c15 100644 --- a/src/msw/iniconf.cpp +++ b/src/msw/iniconf.cpp @@ -288,8 +288,8 @@ bool wxIniConfig::DoReadString(const wxString& szKey, wxString *pstr) const m_strLocalFilename.t_str()); if ( wxIsEmpty(szBuf) ) { // now look in win.ini - wxString strKey = GetKeyName(path.Name()); - GetProfileString(m_strGroup.t_str(), strKey.t_str(), + wxString strWinKey = GetKeyName(path.Name()); + GetProfileString(m_strGroup.t_str(), strWinKey.t_str(), wxT(""), szBuf, WXSIZEOF(szBuf)); } From c41255bd985d259bf32c25a2d86bf3a97fb3999b Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 24 Oct 2018 19:30:41 +0200 Subject: [PATCH 165/231] Add recent macOS setup.h defines to correct file It was added to setup.h, not setup_inc.h. Regenerating setup.h would remove the defines. --- include/wx/osx/setup_inc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/wx/osx/setup_inc.h b/include/wx/osx/setup_inc.h index 45dad65ca7..f1ad88dd74 100644 --- a/include/wx/osx/setup_inc.h +++ b/include/wx/osx/setup_inc.h @@ -60,3 +60,10 @@ // make sure we have the proper dispatcher for the console event loop #define wxUSE_SELECT_DISPATCHER 1 #define wxUSE_EPOLL_DISPATCHER 0 + +// set to 1 if you have older code that still needs icon refs +#define wxOSX_USE_ICONREF 0 + +// set to 0 if you have code that has problems with the new bitmap implementation +#define wxOSX_BITMAP_NATIVE_ACCESS 1 + From f2577807711d0785eb351512ee02b17b94dde857 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 25 Oct 2018 20:13:40 +0200 Subject: [PATCH 166/231] Implement shaped windows closer to other platforms wxFRAME_SHAPED is not needed anymore under OSX and a shaped window can just have a background color, does not need a paint handler. --- src/osx/cocoa/nonownedwnd.mm | 6 ------ src/osx/cocoa/window.mm | 11 ++++++++++- src/osx/nonownedwnd_osx.cpp | 16 ++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index b21d2d2e14..a1084ccc15 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -769,12 +769,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) ) [m_macWindow setDelegate:controller]; [controller addObservers:m_macWindow]; - - if ( ( style & wxFRAME_SHAPED) ) - { - [m_macWindow setOpaque:NO]; - [m_macWindow setAlphaValue:1.0]; - } if ( !(style & wxFRAME_TOOL_WINDOW) ) [m_macWindow setHidesOnDeactivate:NO]; diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index eaddbc7cad..b32f5aef66 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -3136,7 +3136,14 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col ) if ( [targetView respondsToSelector:@selector(setBackgroundColor:) ] ) { - [targetView setBackgroundColor: col.OSXGetNSColor()]; + wxWindow* peer = GetWXPeer(); + if ( peer->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) + { + wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow); + + if ( toplevel == NULL || toplevel->GetShape().IsEmpty() ) + [targetView setBackgroundColor: col.OSXGetNSColor()]; + } } } @@ -3147,6 +3154,8 @@ bool wxWidgetCocoaImpl::SetBackgroundStyle( wxBackgroundStyle style ) if ( [m_osxView respondsToSelector:@selector(setOpaque:) ] ) { [m_osxView setOpaque: opaque]; + if ( style == wxBG_STYLE_TRANSPARENT ) + [m_osxView setBackgroundColor:[NSColor clearColor]]; } return true ; diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index d43a4eba65..cbc20eda73 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -254,17 +254,13 @@ wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c ) { + if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol ) + return false ; + // only set the native background color if the toplevel window's // background is not supposed to be transparent, otherwise the // transparency is lost - if( GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT || - (GetWindowStyle() & wxFRAME_SHAPED) ) - return false; - - if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol ) - return false ; - - if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM ) + if ( GetBackgroundStyle() != wxBG_STYLE_PAINT && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT) { if ( m_nowpeer ) return m_nowpeer->SetBackgroundColour(c); @@ -522,6 +518,10 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region) { m_shape = region; + // set the native content view to transparency, this is an implementation detail + // no reflected in the wx BackgroundStyle + GetPeer()->SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); + return m_nowpeer->SetShape(region); } From 828c3ce50dddc4080884d7634dfc72df4f0ec763 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 24 Oct 2018 19:35:05 +0200 Subject: [PATCH 167/231] Remove duplicate line from update-setup-h It was intended to be update_osx_setup_h but resulting setup.h.in would not work because the macOS options are not initialized by configure or CMake. --- build/update-setup-h | 1 - 1 file changed, 1 deletion(-) diff --git a/build/update-setup-h b/build/update-setup-h index 5f8b05c3dd..924cde642c 100755 --- a/build/update-setup-h +++ b/build/update-setup-h @@ -116,7 +116,6 @@ update_msw_setup_h setup.h.in update_msw_setup_h build/cmake/setup.h.in update_osx_setup_h include/wx/osx/setup0.h -update_msw_setup_h setup.h.in update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup0.h From 6363db488f52773c743674b65a57ce13958a3048 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 24 Oct 2018 19:45:40 +0200 Subject: [PATCH 168/231] Make CMake setup.h.in an exact copy of setup.h.in Except use cmakedefine and cmakedefine01 to declare the variables. --- build/cmake/setup.h.in | 149 ++++++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 69 deletions(-) diff --git a/build/cmake/setup.h.in b/build/cmake/setup.h.in index ae4ade5175..8b3788591c 100644 --- a/build/cmake/setup.h.in +++ b/build/cmake/setup.h.in @@ -68,6 +68,9 @@ /* Define this if your version of GTK+ is >= 3.0 */ #cmakedefine __WXGTK3__ 1 +/* Define this if your version of GTK+ is >= 3.90.0 */ +#cmakedefine __WXGTK4__ 1 + /* Define this if you want to use GPE features */ #cmakedefine __WXGPE__ 1 @@ -105,12 +108,21 @@ #cmakedefine __UNIXWARE__ 1 #cmakedefine __VMS__ 1 -#undef __IA64__ -#undef __ALPHA__ +#cmakedefine __IA64__ 1 +#cmakedefine __ALPHA__ 1 + +/* NanoX (with wxX11) */ +#cmakedefine01 wxUSE_NANOX + +/* PowerPC Darwin & Mac OS X */ +#cmakedefine __POWERPC__ 1 /* Hack to make IOGraphicsTypes.h not define Point conflicting with MacTypes */ #undef __Point__ +/* MS-DOS with DJGPP */ +#cmakedefine __DOS__ 1 + /* Stupid hack; __WINDOWS__ clashes with wx/defs.h */ #ifndef __WINDOWS__ #cmakedefine __WINDOWS__ 1 @@ -123,10 +135,10 @@ #cmakedefine __GNUWIN32__ 1 #endif #ifndef STRICT -#undef STRICT +#cmakedefine STRICT #endif #ifndef WINVER -#undef WINVER +#cmakedefine WINVER #endif /* --- start common options --- */ @@ -640,9 +652,9 @@ Recommended setting: 1 (wxMediaCtrl won't work by default without it). */ -#define wxUSE_GSTREAMER 0 +#cmakedefine01 wxUSE_GSTREAMER -#define wxUSE_GSTREAMER_PLAYER 0 +#cmakedefine01 wxUSE_GSTREAMER_PLAYER /* Use XTest extension to implement wxUIActionSimulator? @@ -652,7 +664,7 @@ Recommended setting: 1, wxUIActionSimulator won't work in wxGTK3 without it. */ -#define wxUSE_XTEST 0 +#cmakedefine01 wxUSE_XTEST /* --- start MSW options --- */ @@ -749,39 +761,39 @@ /* * Define if your compiler has */ -#undef HAVE_HASH_MAP +#cmakedefine HAVE_HASH_MAP 1 /* * Define if your compiler has */ -#undef HAVE_EXT_HASH_MAP +#cmakedefine HAVE_EXT_HASH_MAP 1 /* * Define if your compiler has std::hash_map/hash_set */ -#undef HAVE_STD_HASH_MAP +#cmakedefine HAVE_STD_HASH_MAP 1 /* * Define if your compiler has __gnu_cxx::hash_map/hash_set */ -#undef HAVE_GNU_CXX_HASH_MAP +#cmakedefine HAVE_GNU_CXX_HASH_MAP 1 /* * Define if your compiler has std::unordered_map */ -#undef HAVE_STD_UNORDERED_MAP +#cmakedefine HAVE_STD_UNORDERED_MAP 1 /* * Define if your compiler has std::unordered_set */ -#undef HAVE_STD_UNORDERED_SET +#cmakedefine HAVE_STD_UNORDERED_SET 1 /* * Define if your compiler has std::tr1::unordered_map */ -#undef HAVE_TR1_UNORDERED_MAP +#cmakedefine HAVE_TR1_UNORDERED_MAP 1 /* * Define if your compiler has std::tr1::unordered_set */ -#undef HAVE_TR1_UNORDERED_SET +#cmakedefine HAVE_TR1_UNORDERED_SET 1 /* * Define if your compiler has @@ -806,49 +818,49 @@ /* * Define if compiler's visibility support in libstdc++ is broken */ -#undef HAVE_BROKEN_LIBSTDCXX_VISIBILITY +#cmakedefine HAVE_BROKEN_LIBSTDCXX_VISIBILITY /* * The built-in regex supports advanced REs in additional to POSIX's basic * and extended. Your system regex probably won't support this, and in this * case WX_NO_REGEX_ADVANCED should be defined. */ -#undef WX_NO_REGEX_ADVANCED +#cmakedefine WX_NO_REGEX_ADVANCED /* * On GNU systems use re_search instead of regexec, since the latter does a * strlen on the search text affecting the performance of some operations. */ -#undef HAVE_RE_SEARCH +#cmakedefine HAVE_RE_SEARCH /* * Use SDL for audio (Unix) */ -#define wxUSE_LIBSDL 0 +#cmakedefine01 wxUSE_LIBSDL /* * Compile sound backends as plugins */ -#define wxUSE_PLUGINS 0 +#cmakedefine01 wxUSE_PLUGINS /* * Use GTK print for printing under GTK+ 2.10+ */ -#define wxUSE_GTKPRINT 0 +#cmakedefine01 wxUSE_GTKPRINT /* * Use GNOME VFS for MIME types */ -#define wxUSE_LIBGNOMEVFS 0 +#cmakedefine01 wxUSE_LIBGNOMEVFS /* * Use libnotify library. */ -#define wxUSE_LIBNOTIFY 0 +#cmakedefine01 wxUSE_LIBNOTIFY /* * Use libnotify 0.7+ API. */ -#define wxUSE_LIBNOTIFY_0_7 0 +#cmakedefine01 wxUSE_LIBNOTIFY_0_7 /* * Use libXpm */ -#define wxHAVE_LIB_XPM 0 +#cmakedefine01 wxHAVE_LIB_XPM /* * Define if you have pthread_cleanup_push/pop() */ @@ -860,7 +872,7 @@ /* * Define if large (64 bit file offsets) files are supported. */ -#undef HAVE_LARGEFILE_SUPPORT +#cmakedefine HAVE_LARGEFILE_SUPPORT 1 /* * Use OpenGL @@ -870,22 +882,17 @@ /* * Use MS HTML Help via libmspack (Unix) */ -#define wxUSE_LIBMSPACK 0 +#cmakedefine01 wxUSE_LIBMSPACK /* * Matthews garbage collection (used for MrEd?) */ -#define WXGARBAGE_COLLECTION_ON 0 +#cmakedefine01 WXGARBAGE_COLLECTION_ON /* * wxWebKitCtrl */ -#define wxUSE_WEBKIT 0 - -/* - * Objective-C class name uniquifying - */ -#define wxUSE_OBJC_UNIQUIFYING 0 +#cmakedefine01 wxUSE_WEBKIT /* * The const keyword is being introduced more in wxWindows. @@ -901,7 +908,7 @@ /* * use the session manager to detect KDE/GNOME */ -#define wxUSE_DETECT_SM 0 +#cmakedefine01 wxUSE_DETECT_SM /* define with the name of timezone variable */ @@ -921,13 +928,16 @@ /* gettimeofday() usually takes 2 arguments, but some really old systems might * have only one, in which case define WX_GETTIMEOFDAY_NO_TZ */ -#undef WX_GETTIMEOFDAY_NO_TZ +#cmakedefine WX_GETTIMEOFDAY_NO_TZ 1 /* struct tm doesn't always have the tm_gmtoff field, define this if it does */ #cmakedefine WX_GMTOFF_IN_TM 1 +/* check if nl_langinfo() can be called with argument _NL_TIME_FIRST_WEEKDAY */ +#cmakedefine HAVE_NL_TIME_FIRST_WEEKDAY 1 + /* Define if you have poll(2) function */ -#undef HAVE_POLL +#cmakedefine HAVE_POLL 1 /* Define if you have pw_gecos field in struct passwd */ #cmakedefine HAVE_PW_GECOS 1 @@ -954,7 +964,7 @@ #cmakedefine HAVE_NANOSLEEP 1 /* Define if you have sched_yield */ -#undef HAVE_SCHED_YIELD +#cmakedefine HAVE_SCHED_YIELD 1 /* Define if you have pthread_mutexattr_t and functions to work with it */ #cmakedefine HAVE_PTHREAD_MUTEXATTR_T 1 @@ -966,13 +976,13 @@ #cmakedefine HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER 1 /* Define if you have pthread_cancel */ -#undef HAVE_PTHREAD_CANCEL +#cmakedefine HAVE_PTHREAD_CANCEL 1 /* Define if you have pthread_mutex_timedlock */ -#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK +#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDLOCK 1 /* Define if you have pthread_attr_setstacksize */ -#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE +#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 /* Define if you have shl_load() */ #cmakedefine HAVE_SHL_LOAD 1 @@ -981,7 +991,7 @@ #cmakedefine HAVE_SNPRINTF 1 /* Define if you have snprintf() declaration in the header */ -#undef HAVE_SNPRINTF_DECL +#cmakedefine HAVE_SNPRINTF_DECL 1 /* Define if you have a snprintf() which supports positional arguments (defined in the unix98 standard) */ @@ -997,30 +1007,30 @@ #cmakedefine HAVE_STATVFS 1 /* Define if you have strtoull() and strtoll() */ -#undef HAVE_STRTOULL +#cmakedefine HAVE_STRTOULL 1 /* Define if you have all functions to set thread priority */ -#undef HAVE_THREAD_PRIORITY_FUNCTIONS +#cmakedefine HAVE_THREAD_PRIORITY_FUNCTIONS 1 /* Define if you have vsnprintf() */ #cmakedefine HAVE_VSNPRINTF 1 /* Define if you have vsnprintf() declaration in the header */ -#undef HAVE_VSNPRINTF_DECL +#cmakedefine HAVE_VSNPRINTF_DECL 1 /* Define if you have a _broken_ vsnprintf() declaration in the header, * with 'char*' for the 3rd parameter instead of 'const char*' */ -#undef HAVE_BROKEN_VSNPRINTF_DECL +#cmakedefine HAVE_BROKEN_VSNPRINTF_DECL 1 /* Define if you have a _broken_ vsscanf() declaration in the header, * with 'char*' for the 1st parameter instead of 'const char*' */ -#undef HAVE_BROKEN_VSSCANF_DECL +#cmakedefine HAVE_BROKEN_VSSCANF_DECL 1 /* Define if you have vsscanf() */ #cmakedefine HAVE_VSSCANF 1 /* Define if you have vsscanf() declaration in the header */ -#undef HAVE_VSSCANF_DECL +#cmakedefine HAVE_VSSCANF_DECL 1 /* Define if you have usleep() */ #cmakedefine HAVE_USLEEP 1 @@ -1092,7 +1102,7 @@ #cmakedefine HAVE_FLOCK 1 /* Define if you have getaddrinfo function. */ -#undef HAVE_GETADDRINFO +#cmakedefine HAVE_GETADDRINFO 1 /* Define if you have a gethostbyname_r function taking 6 arguments. */ #cmakedefine HAVE_FUNC_GETHOSTBYNAME_R_6 1 @@ -1110,13 +1120,13 @@ #cmakedefine HAVE_GETHOSTNAME 1 /* Define if you have a getservbyname_r function taking 6 arguments. */ -#undef HAVE_FUNC_GETSERVBYNAME_R_6 +#cmakedefine HAVE_FUNC_GETSERVBYNAME_R_6 1 /* Define if you have a getservbyname_r function taking 5 arguments. */ -#undef HAVE_FUNC_GETSERVBYNAME_R_5 +#cmakedefine HAVE_FUNC_GETSERVBYNAME_R_5 1 /* Define if you have a getservbyname_r function taking 4 arguments. */ -#undef HAVE_FUNC_GETSERVBYNAME_R_4 +#cmakedefine HAVE_FUNC_GETSERVBYNAME_R_4 1 /* Define if you only have a getservbyname function */ #cmakedefine HAVE_GETSERVBYNAME 1 @@ -1149,10 +1159,10 @@ #cmakedefine HAVE_STRTOK_R 1 /* Define if you have thr_setconcurrency function */ -#undef HAVE_THR_SETCONCURRENCY +#cmakedefine HAVE_THR_SETCONCURRENCY 1 /* Define if you have pthread_setconcurrency function */ -#undef HAVE_PTHREAD_SET_CONCURRENCY +#cmakedefine HAVE_PTHREAD_SET_CONCURRENCY 1 /* Define if you have the uname function. */ #cmakedefine HAVE_UNAME 1 @@ -1161,10 +1171,10 @@ #cmakedefine HAVE_UNSETENV 1 /* Define if you have the header file. */ -#undef HAVE_X11_XKBLIB_H +#cmakedefine HAVE_X11_XKBLIB_H 1 /* Define if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XF86VMODE_H +#cmakedefine HAVE_X11_EXTENSIONS_XF86VMODE_H 1 /* Define if you have the header file. */ #cmakedefine HAVE_SCHED_H 1 @@ -1182,13 +1192,13 @@ #cmakedefine HAVE_WCSTR_H 1 /* Define if you have (Solaris only) */ -#undef HAVE_WIDEC_H +#cmakedefine HAVE_WIDEC_H 1 /* Define if you have the header file and iconv() symbol. */ #cmakedefine HAVE_ICONV 1 /* Define as "const" if the declaration of iconv() needs const. */ -#define ICONV_CONST @ICONV_CONST@ +#cmakedefine ICONV_CONST @ICONV_CONST@ /* Define if you have the header file. */ #cmakedefine HAVE_LANGINFO_H 1 @@ -1215,28 +1225,28 @@ #cmakedefine HAVE_VSWPRINTF 1 /* Define this if you have _vsnwprintf */ -#undef HAVE__VSNWPRINTF +#cmakedefine HAVE__VSNWPRINTF 1 /* vswscanf() */ #cmakedefine HAVE_VSWSCANF 1 /* Define if fseeko and ftello are available. */ -#undef HAVE_FSEEKO +#cmakedefine HAVE_FSEEKO 1 /* Define this if you are using gtk and gdk contains support for X11R6 XIM */ -#undef HAVE_XIM +#cmakedefine HAVE_XIM 1 /* Define this if you have X11/extensions/shape.h */ -#undef HAVE_XSHAPE +#cmakedefine HAVE_XSHAPE 1 /* Define this if you have type SPBCDATA */ -#undef HAVE_SPBCDATA +#cmakedefine HAVE_SPBCDATA 1 /* Define if you have pango_font_family_is_monospace() (Pango >= 1.3.3) */ -#undef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE +#cmakedefine HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE 1 /* Define if you have Pango xft support */ -#undef HAVE_PANGO_XFT +#cmakedefine HAVE_PANGO_XFT 1 /* Define if you have the header file. */ #cmakedefine HAVE_SYS_SELECT_H 1 @@ -1279,10 +1289,10 @@ /* When using an external jpeg library and the Windows headers already define * boolean, define to the type used by the jpeg library for boolean. */ -#undef wxHACK_BOOLEAN +#cmakedefine wxHACK_BOOLEAN /* Define if the header pbt.h is missing. */ -#undef NEED_PBT_H +#cmakedefine NEED_PBT_H #endif /* __WIN32__ */ @@ -1297,9 +1307,10 @@ */ /* wxLogChain class available */ -#define wxHAS_LOG_CHAIN +#cmakedefine wxHAS_LOG_CHAIN /* define this when wxDC::Blit() respects SetDeviceOrigin() in wxGTK */ -#undef wxHAS_WORKING_GTK_DC_BLIT +#cmakedefine wxHAS_WORKING_GTK_DC_BLIT #endif /* __WX_SETUP_H__ */ + From a02bb61e902064d0a50264cb15cb8906cc5a414a Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 24 Oct 2018 22:40:39 +0200 Subject: [PATCH 169/231] Fix build errors after modifying CMake setup.h.in Always set a value to ICONV_CONST so it will be defined in setup.h. Add a check for strtoull to prevent a macro redefined warning. Link with WebKit framework to fix macOS build with wxUSE_WEBKIT. --- build/cmake/lib/core/CMakeLists.txt | 5 +++++ build/cmake/setup.cmake | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index e7ed60ef67..e0a0a2a52e 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -70,6 +70,11 @@ if(WXOSX_COCOA) wx_lib_link_libraries(core PUBLIC "-framework AudioToolbox" ) + if(wxUSE_WEBKIT) + wx_lib_link_libraries(core PUBLIC + "-framework WebKit" + ) + endif() endif() if(WXGTK AND wxUSE_PRIVATE_FONTS) wx_lib_include_directories(core PUBLIC diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 46092b0797..5656b9dc30 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -221,6 +221,7 @@ if(NOT WIN32) if(wxUSE_LIBICONV AND NOT APPLE) find_package(Iconv REQUIRED) set(HAVE_ICONV ON) + set(ICONV_CONST " ") if(ICONV_SECOND_ARGUMENT_IS_CONST) set(ICONV_CONST "const") endif() @@ -554,7 +555,7 @@ endforeach() # Check various functions foreach(func fsync - snprintf vsnprintf strnlen + snprintf vsnprintf strnlen strtoull setpriority ) string(TOUPPER ${func} func_upper) From f1cf5259448b76457a4e0820446e383e8c247a7f Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 24 Oct 2018 19:47:18 +0200 Subject: [PATCH 170/231] Add CMake option to set wxDEBUG_LEVEL It is no use adding it to the generated setup.h because this section is commented out, so add it as compiler option instead. The default option is 'Default' in which case no compiler option is added. --- build/cmake/init.cmake | 4 ++++ build/cmake/options.cmake | 3 +++ 2 files changed, 7 insertions(+) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 3c07f15b21..fac5a2be3d 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -121,6 +121,10 @@ if(wxUSE_ON_FATAL_EXCEPTION AND MSVC AND (MSVC_VERSION GREATER 1800) ) add_compile_options("/EHa") endif() +if(NOT wxBUILD_DEBUG_LEVEL STREQUAL "Default") + add_compile_options("-DwxDEBUG_LEVEL=${wxBUILD_DEBUG_LEVEL}") +endif() + # Constants for setup.h creation set(wxUSE_STD_DEFAULT ON) if(wxUSE_UNICODE) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index b399e7ec2f..19c7344b80 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -23,6 +23,9 @@ wx_option(wxBUILD_COMPATIBILITY set(wxBUILD_CUSTOM_SETUP_HEADER_PATH "" CACHE PATH "Include path containing custom wx/setup.h") mark_as_advanced(wxBUILD_CUSTOM_SETUP_HEADER_PATH) +wx_option(wxBUILD_DEBUG_LEVEL "Debug Level" Default STRINGS Default 0 1 2) +mark_as_advanced(wxBUILD_DEBUG_LEVEL) + if(MSVC) wx_option(wxBUILD_USE_STATIC_RUNTIME "Link using the static runtime library" OFF) wx_option(wxBUILD_MSVC_MULTIPROC "Enable multi-processor compilation for MSVC") From f11849b7e8df2e6f9cd68701e8458f61b0d49d7c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 26 Oct 2018 01:35:28 +0200 Subject: [PATCH 171/231] Document not completely obvious wxRearrangeList::Set() behaviour Calling Set() resets the existing items order, which makes sense from the implementation point of view, but not necessarily expected by the users. See #18262. --- interface/wx/rearrangectrl.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface/wx/rearrangectrl.h b/interface/wx/rearrangectrl.h index c6cceaded1..fa4d40eb5e 100644 --- a/interface/wx/rearrangectrl.h +++ b/interface/wx/rearrangectrl.h @@ -41,6 +41,12 @@ is to use wxRearrangeCtrl which combines it with two standard buttons to move the current item up or down. + Note that while most of the methods for items manipulation such as + Append(), Insert() or Delete(), inherited from wxItemContainer work as + expected for this class, Set() somewhat unexpectedly resets the order of + the items as it clears the control first, also clearing the order as a side + effect, before adding the new items. + @since 2.9.0 @library{wxcore} From 965f8909193fad2fa7f400a5088efc79c5ef9cf8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 26 Oct 2018 04:01:04 +0200 Subject: [PATCH 172/231] Fix regression in wxTopLevelWindowMSW::IsMaximized() This fixes another bug from 3518f1a7d8b27877183b0aa2338a59dec836ae3c (after the one fixed in 57662803113247619921dcfb414736e09529ef87): if a window was maximized by user and then hidden, its IsMaximized() returned false because it examined m_showCmd which didn't have SW_MAXIMIZE value in this case. The same was true for IsMinimised() as well. Fix both problems by updating the value of m_showCmd when hiding the window. --- src/msw/toplevel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index d2b89ccc97..df9e001c93 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -579,6 +579,15 @@ bool wxTopLevelWindowMSW::Show(bool show) } else // hide { + // When hiding the window, remember if it was maximized or iconized in + // order to return the correct value from Is{Maximized,Iconized}(). + if ( ::IsZoomed(GetHwnd()) ) + m_showCmd = SW_MAXIMIZE; + else if ( ::IsIconic(GetHwnd()) ) + m_showCmd = SW_MINIMIZE; + else + m_showCmd = SW_SHOW; + nShowCmd = SW_HIDE; } From 79a37a2a65d8bde315bcd863838f21c72912840a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Oct 2018 15:06:42 +0200 Subject: [PATCH 173/231] Don't try to set focus outside of popup window in wxMSW This will just hide the window immediately, so prefer to ignore the "focus" argument of Popup() but show the popup instead. Update the documentation to mention that setting focus outside of popup is not supported under all platforms. --- interface/wx/popupwin.h | 8 ++++---- src/msw/popupwin.cpp | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/interface/wx/popupwin.h b/interface/wx/popupwin.h index fb1030b171..01af6cfa63 100644 --- a/interface/wx/popupwin.h +++ b/interface/wx/popupwin.h @@ -84,10 +84,10 @@ public: /** Popup the window (this will show it too). - If @a winFocus is non-@NULL, it will be kept focused while this window - is shown, otherwise this window itself will receive focus. In any case, - the popup will disappear automatically if it loses focus because of a - user action. + If @a focus is non-@NULL, it will be kept focused while this window + is shown if supported by the current platform, otherwise the popup + itself will receive focus. In any case, the popup will disappear + automatically if it loses focus because of a user action. @see Dismiss() */ diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index eea9c444bc..406733d73d 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -96,7 +96,10 @@ void wxPopupTransientWindow::Popup(wxWindow* focus) { Show(); - if ( focus ) + // We can only set focus to one of our children as setting it to another + // window would result in an immediate loss of activation and popup + // disappearance. + if ( focus && IsDescendant(focus) ) focus->SetFocus(); } From dd1a6a6d35cf53f5a93d88a469584dbc3b1960ce Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 28 Oct 2018 09:15:33 -0700 Subject: [PATCH 174/231] Avoid NULL pointer dereference when calling GetScaleFactor() on invalid bitmap with GTK+3 --- src/gtk/bitmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 40f04c0b3c..cfd87549d9 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -981,6 +981,8 @@ bool wxBitmap::CreateScaled(int w, int h, int depth, double scale) double wxBitmap::GetScaleFactor() const { + wxCHECK_MSG(m_refData, -1, "invalid bitmap"); + return M_BMPDATA->m_scaleFactor; } From 25a54a9b56d9a3eda3f9c657f4aa438b1d5932a4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 28 Oct 2018 09:16:06 -0700 Subject: [PATCH 175/231] build fix for wxUniversal --- src/gtk/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 99fc8eebfa..64a633afaf 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -310,7 +310,7 @@ static wxPoint gs_lastGesturePoint; // Function used to dump a brief description of a window. static -wxString wxDumpWindow(wxWindow* win) +wxString wxDumpWindow(wxWindowGTK* win) { if ( !win ) return "(no window)"; From 5d06593ae17232a140c5997a4c123ebc774cfba5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Jul 2018 19:01:38 +0200 Subject: [PATCH 176/231] Ensure that wxThread::Pause() suspends the thread immediately Surprisingly, ::SuspendThread() doesn't actually do it, but only schedules the thread for suspension in some undetermined near future. This could result in problems as Pause() could exit, releasing the CS protecting wxThread internal data in the main thread, and allowing the worker thread to enter it (e.g. in its TestDestroy()) before being actually suspended, meaning that the thread got suspended inside a CS, which resulted in later deadlocks. Fix this by calling ::GetThreadContext() which is supposed to ensure that the scheduler does really suspend the thread before it returns (as it's impossible to get the context of a thread while it's running). Closes #18137. --- src/msw/thread.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 0805e1e19a..5c94613f46 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -875,6 +875,20 @@ bool wxThreadInternal::Suspend() return false; } + // Calling GetThreadContext() forces the thread to actually be suspended: + // just calling SuspendThread() is not enough, it just asks the scheduler + // to suspend the thread at the next opportunity and by then we may already + // exit wxThread::Pause() and leave m_critsect, meaning that the thread + // could enter it and end up suspended inside a CS, which will inevitably + // result in a deadlock later. + CONTEXT ctx; + // We don't really need the context, but we still must initialize it. + ctx.ContextFlags = CONTEXT_FULL; + if ( !::GetThreadContext(m_hThread, &ctx) ) + { + wxLogLastError(wxS("GetThreadContext")); + } + m_state = STATE_PAUSED; return true; From 18db61d56862e15aa700d6826b9cd2e102ea5e9d Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Mon, 22 Oct 2018 15:13:10 +0200 Subject: [PATCH 177/231] Fix MSW wxCheckOsVersion() without manifest Reimplement wxCheckOsVersion() to use wxGetOsVersion() on windows. An executable without the Windows 8.1+ compatibility info in a manifest would not detect the version based on the VerifyVersionInfo() API previously used. Closes https://github.com/wxWidgets/wxWidgets/pull/992 --- src/msw/utils.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 90708c2b04..2fc500a202 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1225,24 +1225,12 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro) bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn) { - OSVERSIONINFOEX osvi; - wxZeroMemory(osvi); - osvi.dwOSVersionInfoSize = sizeof(osvi); + int majorCur, minorCur, microCur; + wxGetOsVersion(&majorCur, &minorCur, µCur); - DWORDLONG const dwlConditionMask = - ::VerSetConditionMask( - ::VerSetConditionMask( - ::VerSetConditionMask( - 0, VER_MAJORVERSION, VER_GREATER_EQUAL), - VER_MINORVERSION, VER_GREATER_EQUAL), - VER_BUILDNUMBER, VER_GREATER_EQUAL); - - osvi.dwMajorVersion = majorVsn; - osvi.dwMinorVersion = minorVsn; - osvi.dwBuildNumber = microVsn; - - return ::VerifyVersionInfo(&osvi, - VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask) != FALSE; + return majorCur > majorVsn + || (majorCur == majorVsn && minorCur > minorVsn) + || (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn); } wxWinVersion wxGetWinVersion() From a34bedd7b54933ebd279f28d2a7908647aec89fe Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 29 Oct 2018 23:12:57 +0100 Subject: [PATCH 178/231] Revert "Add guard over wxMSWDateControls" This reverts commit f1fa6d5ea25bed5870c7933176f2332205009f12 which doesn't seem correct nor necessary. --- include/wx/msw/private/datecontrols.h | 2 -- src/msw/datetimectrl.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/include/wx/msw/private/datecontrols.h b/include/wx/msw/private/datecontrols.h index b38723a40a..9794cfae89 100644 --- a/include/wx/msw/private/datecontrols.h +++ b/include/wx/msw/private/datecontrols.h @@ -14,7 +14,6 @@ #include "wx/msw/wrapwin.h" -#if wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL // namespace for the helper functions related to the date controls namespace wxMSWDateControls { @@ -25,7 +24,6 @@ namespace wxMSWDateControls extern bool CheckInitialization(); } // namespace wxMSWDateControls -#endif // wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL #endif // _MSW_PRIVATE_DATECONTROLS_H_ diff --git a/src/msw/datetimectrl.cpp b/src/msw/datetimectrl.cpp index cbc65b42a2..18eed3d105 100644 --- a/src/msw/datetimectrl.cpp +++ b/src/msw/datetimectrl.cpp @@ -62,10 +62,8 @@ wxDateTimePickerCtrl::MSWCreateDateTimePicker(wxWindow *parent, const wxValidator& validator, const wxString& name) { -#if wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL if ( !wxMSWDateControls::CheckInitialization() ) return false; -#endif // wxUSE_DATEPICKCTRL || wxUSE_CALENDARCTRL // initialize the base class if ( !CreateControl(parent, id, pos, size, style, validator, name) ) From 9d717a1204c4c779797a10a2cc9c3c6af341c9b5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 29 Oct 2018 23:14:30 +0100 Subject: [PATCH 179/231] Replace wxUSE_DATEPICKCTRL with wxUSE_TIMEPICKCTRL in #endif too Complete the change of 93d71116b7d3805c72e8b4e48f6807f7b9b545a3 --- src/msw/timectrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/timectrl.cpp b/src/msw/timectrl.cpp index b5cad7fc9b..e02af0d273 100644 --- a/src/msw/timectrl.cpp +++ b/src/msw/timectrl.cpp @@ -61,4 +61,4 @@ bool wxTimePickerCtrl::MSWOnDateTimeChange(const NMDATETIMECHANGE& dtch) wxDateEvent event(this, m_date, wxEVT_TIME_CHANGED); return HandleWindowEvent(event); } -#endif // wxUSE_DATEPICKCTRL +#endif // wxUSE_TIMEPICKCTRL From 602b4a6863592af4b10c0141b6ce711c82d74425 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 01:34:27 +0100 Subject: [PATCH 180/231] Run all wxTextEntry unit tests for wxTextCtrl too Comment stated that InsertionPoint() didn't pass, but it was actually already running (and passing) and the only excluded test was the TextChangeEvents() one which really should pass for multiline controls as well, so run it too. --- tests/controls/textctrltest.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 753890f85c..7d594ca77a 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -65,19 +65,9 @@ private: // Now switch to the multi-line text controls. CPPUNIT_TEST( PseudoTestSwitchToMultiLineStyle ); - // Rerun some of the tests above. Notice that not all of them pass, so - // we can't just use wxTEXT_ENTRY_TESTS() here. For some of them it's - // normal, e.g. Hint() test isn't supposed to work for multi-line - // controls. Others, such as InsertionPoint() and TextChangeEvents() - // don't pass neither but this could be a bug. - CPPUNIT_TEST( SetValue ); - CPPUNIT_TEST( Selection ); - CPPUNIT_TEST( InsertionPoint ); - CPPUNIT_TEST( Replace ); - WXUISIM_TEST( Editable ); - CPPUNIT_TEST( CopyPaste ); - CPPUNIT_TEST( UndoRedo ); - + // Rerun the text entry tests not specific to single line controls for + // multiline ones now. + wxTEXT_ENTRY_TESTS(); SINGLE_AND_MULTI_TESTS(); From f3c148cd4adb3c4c5983549bdd44bafc5c851678 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 01:35:32 +0100 Subject: [PATCH 181/231] Verify that wxTextCtrl::ChangeValue("") doesn't generate events Check that changing the value of an already empty control to empty doesn't result in any events. See #18264. --- tests/controls/textentrytest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index 96b121de84..5ae7c53179 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -83,6 +83,10 @@ void TextEntryTestCase::TextChangeEvents() entry->Clear(); CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() ); updated.Clear(); + + entry->ChangeValue(""); + CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() ); + updated.Clear(); } void TextEntryTestCase::CheckStringSelection(const char *sel) From d118ca6c5689f8ba4fac2e96b9354e80d9a42627 Mon Sep 17 00:00:00 2001 From: VZ Date: Tue, 30 Oct 2018 09:31:15 +0100 Subject: [PATCH 182/231] Remove wxImageList::Add() overload taking wxIcon from wxOSX (#997) This is not necessary as wxIcon is implicitly convertible to wxBitmap anyhow, so calling Add(icon) works using the existing Add(wxBitmap) overload, and is actually harmful because of the wrong icon size check in this function, which used physical bitmap size instead of the logical (scaled) size. Closes #18188. --- include/wx/osx/imaglist.h | 1 - src/osx/imaglist.cpp | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h index 0173832e75..fdab2447bd 100644 --- a/include/wx/osx/imaglist.h +++ b/include/wx/osx/imaglist.h @@ -32,7 +32,6 @@ public: virtual bool GetSize( int index, int &width, int &height ) const; virtual wxSize GetSize() const { return wxSize(m_width, m_height); } - int Add( const wxIcon& bitmap ); int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); int Add( const wxBitmap& bitmap, const wxColour& maskColour ); diff --git a/src/osx/imaglist.cpp b/src/osx/imaglist.cpp index 32f12fb4ee..d487bd8bc6 100644 --- a/src/osx/imaglist.cpp +++ b/src/osx/imaglist.cpp @@ -53,24 +53,6 @@ bool wxImageList::Create() return true; } -int wxImageList::Add( const wxIcon &bitmap ) -{ - wxASSERT_MSG( (bitmap.GetWidth() == m_width && bitmap.GetHeight() == m_height) - || (m_width == 0 && m_height == 0), - wxT("invalid bitmap size in wxImageList: this might work ") - wxT("on this platform but definitely won't under Windows.") ); - - m_images.Append( new wxIcon( bitmap ) ); - - if (m_width == 0 && m_height == 0) - { - m_width = bitmap.GetWidth(); - m_height = bitmap.GetHeight(); - } - - return m_images.GetCount() - 1; -} - int wxImageList::Add( const wxBitmap &bitmap ) { wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height) From 3ab2bfd62ad37113aab36ec98172368c4b165f12 Mon Sep 17 00:00:00 2001 From: VZ Date: Tue, 30 Oct 2018 09:34:19 +0100 Subject: [PATCH 183/231] Remove unused wx/osx/icon.h header (#998) This header isn't necessary any longer after the changes of 0bdd7e5f480a005d259d45a964cd145bf53ad1fe --- include/wx/osx/icon.h | 106 ------------------------------------------ 1 file changed, 106 deletions(-) delete mode 100644 include/wx/osx/icon.h diff --git a/include/wx/osx/icon.h b/include/wx/osx/icon.h deleted file mode 100644 index bc493392db..0000000000 --- a/include/wx/osx/icon.h +++ /dev/null @@ -1,106 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/icon.h -// Purpose: wxIcon class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ICON_H_ -#define _WX_ICON_H_ - -#include "wx/bitmap.h" - -// Icon -class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject -{ -public: - wxIcon(); - - wxIcon(const char* const* data); - wxIcon(const char bits[], int width , int height ); - wxIcon(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, - int desiredWidth = -1, int desiredHeight = -1); - wxIcon(const wxIconLocation& loc) - { - LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); - } - - wxIcon(WXHICON icon, const wxSize& size); - - virtual ~wxIcon(); - - bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, - int desiredWidth = -1, int desiredHeight = -1); - - - // create from bitmap (which should have a mask unless it's monochrome): - // there shouldn't be any implicit bitmap -> icon conversion (i.e. no - // ctors, assignment operators...), but it's ok to have such function - void CopyFromBitmap(const wxBitmap& bmp); - - int GetWidth() const; - int GetHeight() const; - int GetDepth() const; -#if WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") - void SetWidth(int width); - wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") - void SetHeight(int height); - wxDEPRECATED_MSG("this value is determined during creation, this method could lead to inconsistencies") - void SetDepth(int depth); -#endif - - wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } - -#if wxOSX_USE_ICONREF - WXHICON GetHICON() const; -#endif - -#if wxOSX_USE_COCOA - WX_NSImage GetNSImage() const ; -#endif - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - -private: - wxDECLARE_DYNAMIC_CLASS(wxIcon); - - bool LoadIconFromSystemResource(const wxString& resourceName, int desiredWidth, int desiredHeight); - bool LoadIconFromBundleResource(const wxString& resourceName, int desiredWidth, int desiredHeight); - bool LoadIconFromFile(const wxString& filename, int desiredWidth, int desiredHeight); - bool LoadIconAsBitmap(const wxString& filename, wxBitmapType flags = wxICON_DEFAULT_TYPE, int desiredWidth = -1, int desiredHeight = -1); -}; - -class WXDLLIMPEXP_CORE wxICONResourceHandler: public wxBitmapHandler -{ -public: - wxICONResourceHandler() - { - SetName(wxT("ICON resource")); - SetExtension(wxEmptyString); - SetType(wxBITMAP_TYPE_ICON_RESOURCE); - } - - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - wxBitmapType flags, - int desiredWidth = -1, - int desiredHeight = -1); - - // unhide the base class virtual - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - wxBitmapType flags) - { return LoadFile(bitmap, name, flags, -1, -1); } - -private: - wxDECLARE_DYNAMIC_CLASS(wxICONResourceHandler); -}; - -#endif - // _WX_ICON_H_ From a2a3518b71c8fe521435875753aae6de5f4c02c4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 02:05:52 +0100 Subject: [PATCH 184/231] Also remove wxImageList::Replace(wxIcon) overload from wxOSX This one is harmless, unless Add() overload removed by the previous commit, but still unnecessary. --- include/wx/osx/imaglist.h | 1 - src/osx/imaglist.cpp | 25 ------------------------- 2 files changed, 26 deletions(-) diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h index fdab2447bd..42ef66377f 100644 --- a/include/wx/osx/imaglist.h +++ b/include/wx/osx/imaglist.h @@ -37,7 +37,6 @@ public: int Add( const wxBitmap& bitmap, const wxColour& maskColour ); wxBitmap GetBitmap(int index) const; wxIcon GetIcon(int index) const; - bool Replace( int index, const wxIcon &bitmap ); bool Replace( int index, const wxBitmap &bitmap ); bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ); bool Remove( int index ); diff --git a/src/osx/imaglist.cpp b/src/osx/imaglist.cpp index d487bd8bc6..863e8ce6ba 100644 --- a/src/osx/imaglist.cpp +++ b/src/osx/imaglist.cpp @@ -165,31 +165,6 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap ) return true; } -bool wxImageList::Replace( int index, const wxIcon &bitmap ) -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxIcon* newBitmap = new wxIcon( bitmap ); - - if (index == (int) m_images.GetCount() - 1) - { - delete node->GetData(); - m_images.Erase( node ); - m_images.Append( newBitmap ); - } - else - { - wxList::compatibility_iterator next = node->GetNext(); - delete node->GetData(); - m_images.Erase( node ); - m_images.Insert( next, newBitmap ); - } - - return true; -} - bool wxImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ) { wxList::compatibility_iterator node = m_images.Item( index ); From c374eefd348cec06323a14dbe5a5c06261225c5a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 02:42:32 +0100 Subject: [PATCH 185/231] Fold wxOSX-specific wxImageList into generic version Get rid of wxOSX wxImageList implementation as it was 99% identical to the generic version and the non-identical parts should really have been made part of the generic version too from the beginning. Notably, use GetScaled{Width,Height}() in Add() method in the generic version too now. --- Makefile.in | 68 +++++----- build/bakefiles/files.bkl | 4 +- build/cmake/files.cmake | 4 +- build/files | 4 +- include/wx/imaglist.h | 13 +- include/wx/osx/imaglist.h | 59 --------- src/generic/imaglist.cpp | 36 +++--- src/osx/imaglist.cpp | 265 -------------------------------------- 8 files changed, 64 insertions(+), 389 deletions(-) delete mode 100644 include/wx/osx/imaglist.h delete mode 100644 src/osx/imaglist.cpp diff --git a/Makefile.in b/Makefile.in index 76f9337520..04eaa957f2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3314,7 +3314,6 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \ wx/osx/fontdlg.h \ wx/osx/frame.h \ wx/osx/gauge.h \ - wx/osx/imaglist.h \ wx/osx/listbox.h \ wx/osx/listctrl.h \ wx/osx/mdi.h \ @@ -3368,6 +3367,7 @@ COND_TOOLKIT_OSX_COCOA_GUI_HDR = \ wx/generic/statusbr.h \ wx/osx/appprogress.h \ wx/generic/icon.h \ + wx/generic/imaglist.h \ wx/osx/cocoa/chkconf.h \ wx/osx/cocoa/evtloop.h \ wx/osx/cocoa/private.h \ @@ -3424,7 +3424,6 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \ wx/osx/fontdlg.h \ wx/osx/frame.h \ wx/osx/gauge.h \ - wx/osx/imaglist.h \ wx/osx/listbox.h \ wx/osx/listctrl.h \ wx/osx/mdi.h \ @@ -3478,6 +3477,7 @@ COND_TOOLKIT_OSX_IPHONE_GUI_HDR = \ wx/generic/statusbr.h \ wx/osx/appprogress.h \ wx/generic/icon.h \ + wx/generic/imaglist.h \ wx/osx/iphone/chkconf.h \ wx/osx/iphone/evtloop.h \ wx/osx/iphone/private.h \ @@ -13174,7 +13174,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS = \ monodll_generic_statusbr.o \ monodll_generic_textmeasure.o \ monodll_generic_icon.o \ - monodll_statbmp_osx.o + monodll_statbmp_osx.o \ + monodll_generic_imaglist.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS = \ monodll_generic_caret.o \ @@ -13225,7 +13226,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \ monodll_osx_brush.o \ monodll_dialog_osx.o \ monodll_osx_fontutil.o \ - monodll_osx_imaglist.o \ monodll_osx_minifram.o \ monodll_nonownedwnd_osx.o \ monodll_osx_palette.o \ @@ -13315,7 +13315,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \ monolib_generic_statusbr.o \ monolib_generic_textmeasure.o \ monolib_generic_icon.o \ - monolib_statbmp_osx.o + monolib_statbmp_osx.o \ + monolib_generic_imaglist.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_0 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_27 = \ monolib_generic_caret.o \ @@ -13366,7 +13367,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_17 = \ monolib_osx_brush.o \ monolib_dialog_osx.o \ monolib_osx_fontutil.o \ - monolib_osx_imaglist.o \ monolib_osx_minifram.o \ monolib_nonownedwnd_osx.o \ monolib_osx_palette.o \ @@ -13456,7 +13456,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8 = \ coredll_generic_statusbr.o \ coredll_generic_textmeasure.o \ coredll_generic_icon.o \ - coredll_statbmp_osx.o + coredll_statbmp_osx.o \ + coredll_generic_imaglist.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_8 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_8) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_1_4 = \ coredll_generic_caret.o \ @@ -13507,7 +13508,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_1 = \ coredll_osx_brush.o \ coredll_dialog_osx.o \ coredll_osx_fontutil.o \ - coredll_osx_imaglist.o \ coredll_osx_minifram.o \ coredll_nonownedwnd_osx.o \ coredll_osx_palette.o \ @@ -13594,7 +13594,8 @@ COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9 = \ corelib_generic_statusbr.o \ corelib_generic_textmeasure.o \ corelib_generic_icon.o \ - corelib_statbmp_osx.o + corelib_statbmp_osx.o \ + corelib_generic_imaglist.o @COND_PLATFORM_MACOSX_1@__OSX_COMMON_SRC_OBJECTS_9 = $(COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_9) COND_PLATFORM_MACOSX_1___GTK_PLATFORM_SRC_OBJECTS_2_2 = \ corelib_generic_caret.o \ @@ -13645,7 +13646,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \ corelib_osx_brush.o \ corelib_dialog_osx.o \ corelib_osx_fontutil.o \ - corelib_osx_imaglist.o \ corelib_osx_minifram.o \ corelib_nonownedwnd_osx.o \ corelib_osx_palette.o \ @@ -17549,6 +17549,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@monodll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONODLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monodll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONODLL_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @@ -18704,12 +18710,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monodll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monodll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @@ -22802,6 +22802,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@monolib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@monolib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @@ -23957,12 +23963,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@monolib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@monolib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @@ -28148,6 +28148,12 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@coredll_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(COREDLL_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/caret.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@coredll_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(COREDLL_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @@ -29303,12 +29309,6 @@ coredll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@coredll_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@coredll_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp @@ -32396,6 +32396,12 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@corelib_generic_caret.o: $(srcdir)/src/generic/caret.cpp $(CORELIB_ODEP) @COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/caret.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp + @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@corelib_generic_imaglist.o: $(srcdir)/src/generic/imaglist.cpp $(CORELIB_ODEP) @COND_TOOLKIT_QT_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/imaglist.cpp @@ -33551,12 +33557,6 @@ corelib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_osx_fontutil.o: $(srcdir)/src/osx/fontutil.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/fontutil.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@corelib_osx_imaglist.o: $(srcdir)/src/osx/imaglist.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/imaglist.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@corelib_osx_minifram.o: $(srcdir)/src/osx/minifram.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/minifram.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index 52d42891fe..863a733a94 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -2395,7 +2395,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/osx/brush.cpp src/osx/dialog_osx.cpp src/osx/fontutil.cpp - src/osx/imaglist.cpp src/osx/minifram.cpp src/osx/nonownedwnd_osx.cpp src/osx/palette.cpp @@ -2495,6 +2494,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/generic/textmeasure.cpp src/generic/icon.cpp src/osx/statbmp_osx.cpp + src/generic/imaglist.cpp @@ -2538,7 +2538,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/osx/fontdlg.h wx/osx/frame.h wx/osx/gauge.h - wx/osx/imaglist.h wx/osx/listbox.h wx/osx/listctrl.h wx/osx/mdi.h @@ -2593,6 +2592,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/generic/statusbr.h wx/osx/appprogress.h wx/generic/icon.h + wx/generic/imaglist.h
diff --git a/build/cmake/files.cmake b/build/cmake/files.cmake index 999faa219e..455e2d2f11 100644 --- a/build/cmake/files.cmake +++ b/build/cmake/files.cmake @@ -2274,7 +2274,6 @@ set(OSX_LOWLEVEL_SRC src/osx/brush.cpp src/osx/dialog_osx.cpp src/osx/fontutil.cpp - src/osx/imaglist.cpp src/osx/minifram.cpp src/osx/nonownedwnd_osx.cpp src/osx/palette.cpp @@ -2373,6 +2372,7 @@ set(OSX_COMMON_SRC src/generic/icon.cpp #TODO: src/osx/statbmp_osx.cpp + src/generic/imaglist.cpp ) set(OSX_SHARED_HDR @@ -2414,7 +2414,6 @@ set(OSX_SHARED_HDR wx/osx/fontdlg.h wx/osx/frame.h wx/osx/gauge.h - wx/osx/imaglist.h wx/osx/listbox.h wx/osx/listctrl.h wx/osx/mdi.h @@ -2469,6 +2468,7 @@ set(OSX_SHARED_HDR wx/generic/statusbr.h wx/osx/appprogress.h wx/generic/icon.h + wx/generic/imaglist.h ) set(OSX_COCOA_SRC diff --git a/build/files b/build/files index d6fd3ea446..93c9fec7dd 100644 --- a/build/files +++ b/build/files @@ -2256,7 +2256,6 @@ OSX_LOWLEVEL_SRC = src/osx/brush.cpp src/osx/dialog_osx.cpp src/osx/fontutil.cpp - src/osx/imaglist.cpp src/osx/minifram.cpp src/osx/nonownedwnd_osx.cpp src/osx/palette.cpp @@ -2347,6 +2346,7 @@ OSX_COMMON_SRC = src/generic/fontdlgg.cpp src/generic/fontpickerg.cpp src/generic/icon.cpp + src/generic/imaglist.cpp src/generic/listctrl.cpp src/generic/prntdlgg.cpp src/generic/statusbr.cpp @@ -2393,7 +2393,6 @@ OSX_SHARED_HDR = wx/osx/fontdlg.h wx/osx/frame.h wx/osx/gauge.h - wx/osx/imaglist.h wx/osx/listbox.h wx/osx/listctrl.h wx/osx/mdi.h @@ -2444,6 +2443,7 @@ OSX_SHARED_HDR = wx/generic/fontdlgg.h wx/generic/fontpickerg.h wx/generic/icon.h + wx/generic/imaglist.h wx/generic/listctrl.h wx/generic/prntdlgg.h wx/generic/statusbr.h diff --git a/include/wx/imaglist.h b/include/wx/imaglist.h index d625eff324..5fd6a9f9a3 100644 --- a/include/wx/imaglist.h +++ b/include/wx/imaglist.h @@ -41,16 +41,11 @@ enum #define wxIMAGELIST_DRAW_SELECTED 0x0004 #define wxIMAGELIST_DRAW_FOCUSED 0x0008 -#if defined(__WXMSW__) || defined(__WXMAC__) - #define wxHAS_NATIVE_IMAGELIST -#endif - -#if !defined(wxHAS_NATIVE_IMAGELIST) - #include "wx/generic/imaglist.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/imaglist.h" -#elif defined(__WXMAC__) - #include "wx/osx/imaglist.h" + #define wxHAS_NATIVE_IMAGELIST +#else + #include "wx/generic/imaglist.h" #endif #endif // _WX_IMAGLIST_H_BASE_ diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h deleted file mode 100644 index 42ef66377f..0000000000 --- a/include/wx/osx/imaglist.h +++ /dev/null @@ -1,59 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/imaglist.h -// Purpose: -// Author: Robert Roebling, Stefan Csomor -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_ -#define _WX_IMAGLIST_H_ - -#include "wx/defs.h" -#include "wx/list.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxColour; - -class WXDLLIMPEXP_CORE wxImageList: public wxObject -{ -public: - wxImageList() { m_width = m_height = 0; } - wxImageList( int width, int height, bool mask = true, int initialCount = 1 ); - virtual ~wxImageList(); - bool Create( int width, int height, bool mask = true, int initialCount = 1 ); - bool Create(); - - virtual int GetImageCount() const; - virtual bool GetSize( int index, int &width, int &height ) const; - virtual wxSize GetSize() const { return wxSize(m_width, m_height); } - - int Add( const wxBitmap& bitmap ); - int Add( const wxBitmap& bitmap, const wxBitmap& mask ); - int Add( const wxBitmap& bitmap, const wxColour& maskColour ); - wxBitmap GetBitmap(int index) const; - wxIcon GetIcon(int index) const; - bool Replace( int index, const wxBitmap &bitmap ); - bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ); - bool Remove( int index ); - bool RemoveAll(); - - virtual bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, - bool solidBackground = false); - -private: - wxList m_images; - - int m_width; - int m_height; - - wxDECLARE_DYNAMIC_CLASS(wxImageList); -}; - -#endif // _WX_IMAGLIST_H_ - diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 14c8127a80..97f4b83208 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -60,13 +60,11 @@ bool wxGenericImageList::Create() int wxGenericImageList::Add( const wxBitmap &bitmap ) { - wxASSERT_MSG( (bitmap.GetWidth() >= m_width && bitmap.GetHeight() == m_height) + wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height) || (m_width == 0 && m_height == 0), wxT("invalid bitmap size in wxImageList: this might work ") wxT("on this platform but definitely won't under Windows.") ); - const int index = int(m_images.GetCount()); - if (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) { m_images.Append( new wxIcon( (const wxIcon&) bitmap ) ); @@ -75,9 +73,9 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) { // Mimic behaviour of Windows ImageList_Add that automatically breaks up the added // bitmap into sub-images of the correct size - if (m_width > 0 && bitmap.GetWidth() > m_width && bitmap.GetHeight() >= m_height) + if (m_width > 0 && bitmap.GetScaledWidth() > m_width && bitmap.GetScaledHeight() >= m_height) { - int numImages = bitmap.GetWidth() / m_width; + int numImages = bitmap.GetScaledWidth() / m_width; for (int subIndex = 0; subIndex < numImages; subIndex++) { wxRect rect(m_width * subIndex, 0, m_width, m_height); @@ -93,11 +91,11 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) if (m_width == 0 && m_height == 0) { - m_width = bitmap.GetWidth(); - m_height = bitmap.GetHeight(); + m_width = bitmap.GetScaledWidth(); + m_height = bitmap.GetScaledHeight(); } - return index; + return m_images.GetCount() - 1; } int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) @@ -128,24 +126,30 @@ const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const wxBitmap wxGenericImageList::GetBitmap(int index) const { const wxBitmap* bmp = GetBitmapPtr(index); - if (bmp) - return *bmp; - else + if (!bmp) return wxNullBitmap; + + if ( bmp->IsKindOf(wxCLASSINFO(wxIcon)) ) + return wxBitmap( *(static_cast(bmp)) ); + else + return *bmp; } // Get the icon wxIcon wxGenericImageList::GetIcon(int index) const { const wxBitmap* bmp = GetBitmapPtr(index); - if (bmp) + if (!bmp) + return wxNullIcon; + + if ( bmp->IsKindOf(wxCLASSINFO(wxIcon)) ) + return *(static_cast(bmp)); + else { wxIcon icon; icon.CopyFromBitmap(*bmp); return icon; } - else - return wxNullIcon; } bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) @@ -235,8 +239,8 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const wxCHECK_MSG( node, false, wxT("wrong index in image list") ); wxBitmap *bm = (wxBitmap*)node->GetData(); - width = bm->GetWidth(); - height = bm->GetHeight(); + width = bm->GetScaledWidth(); + height = bm->GetScaledHeight(); return true; } diff --git a/src/osx/imaglist.cpp b/src/osx/imaglist.cpp deleted file mode 100644 index 863e8ce6ba..0000000000 --- a/src/osx/imaglist.cpp +++ /dev/null @@ -1,265 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/imaglist.cpp -// Purpose: -// Author: Robert Roebling -// Copyright: (c) 1998 Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#if wxUSE_IMAGLIST - -#include "wx/imaglist.h" - -#ifndef WX_PRECOMP - #include "wx/dc.h" - #include "wx/icon.h" - #include "wx/image.h" -#endif - -wxIMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject); - - -wxImageList::wxImageList( int width, int height, bool mask, int initialCount ) -{ - (void)Create(width, height, mask, initialCount); -} - -wxImageList::~wxImageList() -{ - (void)RemoveAll(); -} - -int wxImageList::GetImageCount() const -{ - return m_images.GetCount(); -} - -bool wxImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) -{ - m_width = width; - m_height = height; - - return Create(); -} - -bool wxImageList::Create() -{ - return true; -} - -int wxImageList::Add( const wxBitmap &bitmap ) -{ - wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height) - || (m_width == 0 && m_height == 0), - wxT("invalid bitmap size in wxImageList: this might work ") - wxT("on this platform but definitely won't under Windows.") ); - - // Mimic behaviour of Windows ImageList_Add that automatically breaks up the added - // bitmap into sub-images of the correct size - if (m_width > 0 && bitmap.GetScaledWidth() > m_width && bitmap.GetScaledHeight() >= m_height) - { - int numImages = bitmap.GetScaledWidth() / m_width; - for (int subIndex = 0; subIndex < numImages; subIndex++) - { - wxRect rect(m_width * subIndex, 0, m_width, m_height); - wxBitmap tmpBmp = bitmap.GetSubBitmap(rect); - m_images.Append( new wxBitmap(tmpBmp) ); - } - } - else - { - m_images.Append( new wxBitmap(bitmap) ); - } - - if (m_width == 0 && m_height == 0) - { - m_width = bitmap.GetScaledWidth(); - m_height = bitmap.GetScaledHeight(); - } - - return m_images.GetCount() - 1; -} - -int wxImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) -{ - wxBitmap bmp( bitmap ); - if (mask.IsOk()) - bmp.SetMask( new wxMask( mask ) ); - - return Add( bmp ); -} - -int wxImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour ) -{ - wxImage img = bitmap.ConvertToImage(); - img.SetMaskColour( maskColour.Red(), maskColour.Green(), maskColour.Blue() ); - - return Add( wxBitmap( img ) ); -} - -// Get the bitmap -wxBitmap wxImageList::GetBitmap(int index) const -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, wxNullBitmap , wxT("wrong index in image list") ); - - wxObject* obj = (wxObject*) node->GetData(); - if ( obj == NULL ) - return wxNullBitmap ; - else if ( obj->IsKindOf(CLASSINFO(wxIcon)) ) - return wxBitmap( *(static_cast(obj)) ) ; - else - return *(static_cast(obj)) ; -} - -// Get the icon -wxIcon wxImageList::GetIcon(int index) const -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, wxNullIcon , wxT("wrong index in image list") ); - - wxObject* obj = (wxObject*) node->GetData(); - if ( obj == NULL ) - return wxNullIcon ; - if ( obj->IsKindOf(CLASSINFO(wxBitmap)) ) - { - wxIcon icon; - icon.CopyFromBitmap(*static_cast(obj)); - return icon; - } - return *(static_cast(obj)) ; -} - -bool wxImageList::Replace( int index, const wxBitmap &bitmap ) -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxBitmap* newBitmap = new wxBitmap( bitmap ); - - if (index == (int) m_images.GetCount() - 1) - { - delete node->GetData(); - - m_images.Erase( node ); - m_images.Append( newBitmap ); - } - else - { - wxList::compatibility_iterator next = node->GetNext(); - delete node->GetData(); - - m_images.Erase( node ); - m_images.Insert( next, newBitmap ); - } - - return true; -} - -bool wxImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ) -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxBitmap* newBitmap = new wxBitmap(bitmap); - - if (index == (int) m_images.GetCount() - 1) - { - delete node->GetData(); - m_images.Erase( node ); - m_images.Append( newBitmap ); - } - else - { - wxList::compatibility_iterator next = node->GetNext(); - delete node->GetData(); - m_images.Erase( node ); - m_images.Insert( next, newBitmap ); - } - - if (mask.IsOk()) - newBitmap->SetMask(new wxMask(mask)); - - return true; -} - -bool wxImageList::Remove( int index ) -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - delete node->GetData(); - m_images.Erase( node ); - - return true; -} - -bool wxImageList::RemoveAll() -{ - WX_CLEAR_LIST(wxList, m_images); - m_images.Clear(); - - return true; -} - -bool wxImageList::GetSize( int index, int &width, int &height ) const -{ - width = 0; - height = 0; - - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxObject *obj = (wxObject*)node->GetData(); - if (obj->IsKindOf(CLASSINFO(wxIcon))) - { - wxIcon *bm = static_cast< wxIcon* >(obj ) ; - width = bm->GetWidth(); - height = bm->GetHeight(); - } - else - { - wxBitmap *bm = static_cast< wxBitmap* >(obj ) ; - width = bm->GetScaledWidth(); - height = bm->GetScaledHeight(); - } - - return true; -} - -bool wxImageList::Draw( - int index, wxDC &dc, int x, int y, - int flags, bool WXUNUSED(solidBackground) ) -{ - wxList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxObject *obj = (wxObject*)node->GetData(); - if (obj->IsKindOf(CLASSINFO(wxIcon))) - { - wxIcon *bm = static_cast< wxIcon* >(obj ) ; - dc.DrawIcon( *bm , x, y ); - } - else - { - wxBitmap *bm = static_cast< wxBitmap* >(obj ) ; - dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 ); - } - - return true; -} - -#endif // wxUSE_IMAGLIST From 9a054104700c972a64140d73486502070a709090 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 30 Oct 2018 20:53:35 +0100 Subject: [PATCH 186/231] Adding IsSolid to wxColour Under macOS colors can be patterns, then accessors for RGB values are useless, IsSolid returns true if the color can be expressed in RGB values at all. --- include/wx/colour.h | 3 +++ include/wx/osx/core/colour.h | 7 ++++++- interface/wx/colour.h | 5 +++++ src/osx/cocoa/colour.mm | 7 +++++++ src/osx/core/colour.cpp | 7 +++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/wx/colour.h b/include/wx/colour.h index aa50b349ec..7565f09162 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -118,6 +118,9 @@ public: virtual ChannelType Blue() const = 0; virtual ChannelType Alpha() const { return wxALPHA_OPAQUE ; } + + virtual bool IsSolid() const + { return true; } // implemented in colourcmn.cpp virtual wxString GetAsString(long flags = wxC2S_NAME | wxC2S_CSS_SYNTAX) const; diff --git a/include/wx/osx/core/colour.h b/include/wx/osx/core/colour.h index b862332173..d3b6ec4eb6 100644 --- a/include/wx/osx/core/colour.h +++ b/include/wx/osx/core/colour.h @@ -34,6 +34,8 @@ public: virtual ChannelType Blue() const wxOVERRIDE; virtual ChannelType Alpha() const wxOVERRIDE; + virtual bool IsSolid() const wxOVERRIDE; + wxColour& operator=(const wxColour& col); // comparison @@ -90,7 +92,10 @@ public: virtual CGFloat Green() const = 0; virtual CGFloat Blue() const = 0; virtual CGFloat Alpha() const = 0; - + + virtual bool IsSolid() const + { return true; } + virtual CGColorRef GetCGColor() const = 0; virtual wxColourRefData* Clone() const = 0; diff --git a/interface/wx/colour.h b/interface/wx/colour.h index 09c1c242a6..cd217d853a 100644 --- a/interface/wx/colour.h +++ b/interface/wx/colour.h @@ -182,6 +182,11 @@ public: */ virtual unsigned char Red() const; + /** + Returns @true if the color can be described using RGB values, ie is solid, + @false if it is a pattern (currently only possible on macOS) + */ + virtual bool IsSolid() const; //@{ /** Sets the RGB intensity values using the given values (first overload), diff --git a/src/osx/cocoa/colour.mm b/src/osx/cocoa/colour.mm index d7fc6ec81d..32d6ae8c8c 100644 --- a/src/osx/cocoa/colour.mm +++ b/src/osx/cocoa/colour.mm @@ -27,6 +27,8 @@ public: virtual CGFloat Blue() const wxOVERRIDE; virtual CGFloat Alpha() const wxOVERRIDE; + virtual bool IsSolid() const wxOVERRIDE; + CGColorRef GetCGColor() const wxOVERRIDE; virtual wxColourRefData* Clone() const wxOVERRIDE { return new wxNSColorRefData(*this); } @@ -94,6 +96,11 @@ CGFloat wxNSColorRefData::Alpha() const return 0.0; } +bool wxNSColorRefData::IsSolid() const +{ + return [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace] != nil; +} + CGColorRef wxNSColorRefData::GetCGColor() const { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 diff --git a/src/osx/core/colour.cpp b/src/osx/core/colour.cpp index 8edb7f0669..3f15e6edeb 100644 --- a/src/osx/core/colour.cpp +++ b/src/osx/core/colour.cpp @@ -189,6 +189,13 @@ wxColour::ChannelType wxColour::Alpha() const return wxRound(M_COLDATA->Alpha() * 255.0); } +bool wxColour::IsSolid() const +{ + wxCHECK_MSG( IsOk(), false, "invalid colour" ); + + return M_COLDATA->IsSolid(); +} + #if wxOSX_USE_COCOA_OR_CARBON void wxColour::GetRGBColor(RGBColor* col) const { From 26c6db4b90e88554387a0672b8224aa0ed5cf750 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 22:01:32 +0100 Subject: [PATCH 187/231] Replace wxGenericImageList::m_{width,height} with m_size Using a single wxSize variable is slightly simpler and shorter than using 2 ints. No real changes. --- include/wx/generic/imaglist.h | 8 ++++---- src/generic/imaglist.cpp | 18 ++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index f87e19b43c..25157a04f2 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -21,7 +21,7 @@ class WXDLLIMPEXP_FWD_CORE wxColour; class WXDLLIMPEXP_CORE wxGenericImageList: public wxObject { public: - wxGenericImageList() { m_width = m_height = 0; } + wxGenericImageList() { } wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); virtual ~wxGenericImageList(); bool Create( int width, int height, bool mask = true, int initialCount = 1 ); @@ -29,7 +29,7 @@ public: virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; - virtual wxSize GetSize() const { return wxSize(m_width, m_height); } + virtual wxSize GetSize() const { return m_size; } int Add( const wxBitmap& bitmap ); int Add( const wxBitmap& bitmap, const wxBitmap& mask ); @@ -50,8 +50,8 @@ public: private: wxObjectList m_images; - int m_width; - int m_height; + // Size of a single bitmap in the list. + wxSize m_size; wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericImageList); }; diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 97f4b83208..d4a716c831 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -47,8 +47,7 @@ int wxGenericImageList::GetImageCount() const bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) { - m_width = width; - m_height = height; + m_size = wxSize(width, height); return Create(); } @@ -60,8 +59,8 @@ bool wxGenericImageList::Create() int wxGenericImageList::Add( const wxBitmap &bitmap ) { - wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_width && bitmap.GetScaledHeight() == m_height) - || (m_width == 0 && m_height == 0), + wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_size.x && bitmap.GetScaledHeight() == m_size.y) + || m_size == wxSize(0, 0), wxT("invalid bitmap size in wxImageList: this might work ") wxT("on this platform but definitely won't under Windows.") ); @@ -73,12 +72,12 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) { // Mimic behaviour of Windows ImageList_Add that automatically breaks up the added // bitmap into sub-images of the correct size - if (m_width > 0 && bitmap.GetScaledWidth() > m_width && bitmap.GetScaledHeight() >= m_height) + if (m_size.x > 0 && bitmap.GetScaledWidth() > m_size.x && bitmap.GetScaledHeight() >= m_size.y) { - int numImages = bitmap.GetScaledWidth() / m_width; + int numImages = bitmap.GetScaledWidth() / m_size.x; for (int subIndex = 0; subIndex < numImages; subIndex++) { - wxRect rect(m_width * subIndex, 0, m_width, m_height); + wxRect rect(m_size.x * subIndex, 0, m_size.x, m_size.y); wxBitmap tmpBmp = bitmap.GetSubBitmap(rect); m_images.Append( new wxBitmap(tmpBmp) ); } @@ -89,10 +88,9 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) } } - if (m_width == 0 && m_height == 0) + if ( m_size == wxSize(0, 0) ) { - m_width = bitmap.GetScaledWidth(); - m_height = bitmap.GetScaledHeight(); + m_size = bitmap.GetScaledSize(); } return m_images.GetCount() - 1; From 28e9ea6bd6dc6a794d978499e5c5035e4ccd45c0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 22:40:48 +0100 Subject: [PATCH 188/231] Simplify wxGenericImageList::Add() logic Also improve the readability of the assert condition in it, this should hopefully make it simpler to understand. No real changes. --- src/generic/imaglist.cpp | 56 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index d4a716c831..aeb31ba57f 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -59,10 +59,36 @@ bool wxGenericImageList::Create() int wxGenericImageList::Add( const wxBitmap &bitmap ) { - wxASSERT_MSG( (bitmap.GetScaledWidth() >= m_size.x && bitmap.GetScaledHeight() == m_size.y) - || m_size == wxSize(0, 0), - wxT("invalid bitmap size in wxImageList: this might work ") - wxT("on this platform but definitely won't under Windows.") ); + // We use the scaled, i.e. logical, size here as image list images size is + // specified in logical pixels, just as window coordinates and sizes are. + const wxSize bitmapSize = bitmap.GetScaledSize(); + + if ( m_size == wxSize(0, 0) ) + { + // This is the first time Add() is called and we hadn't had any fixed + // size: adopt the size of our first bitmap as image size. + m_size = bitmapSize; + } + else // We already have a fixed size, check that the bitmap conforms to it. + { + // There is a special case: a bitmap may contain more than one image, + // in which case we're supposed to chop it in parts, just as Windows + // ImageList_Add() does. + if ( bitmapSize.x > m_size.x && (bitmapSize.x % m_size.x == 0) ) + { + const int numImages = bitmapSize.x / m_size.x; + for (int subIndex = 0; subIndex < numImages; subIndex++) + { + wxRect rect(m_size.x * subIndex, 0, m_size.x, m_size.y); + Add(bitmap.GetSubBitmap(rect)); + } + + return m_images.GetCount() - 1; + } + + wxASSERT_MSG( bitmapSize == m_size, + "All bitmaps in wxImageList must have the same size" ); + } if (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) { @@ -70,27 +96,7 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) } else { - // Mimic behaviour of Windows ImageList_Add that automatically breaks up the added - // bitmap into sub-images of the correct size - if (m_size.x > 0 && bitmap.GetScaledWidth() > m_size.x && bitmap.GetScaledHeight() >= m_size.y) - { - int numImages = bitmap.GetScaledWidth() / m_size.x; - for (int subIndex = 0; subIndex < numImages; subIndex++) - { - wxRect rect(m_size.x * subIndex, 0, m_size.x, m_size.y); - wxBitmap tmpBmp = bitmap.GetSubBitmap(rect); - m_images.Append( new wxBitmap(tmpBmp) ); - } - } - else - { - m_images.Append( new wxBitmap(bitmap) ); - } - } - - if ( m_size == wxSize(0, 0) ) - { - m_size = bitmap.GetScaledSize(); + m_images.Append( new wxBitmap(bitmap) ); } return m_images.GetCount() - 1; From 6fff1c37b54e272e0c1f6065ee9726258fc9871e Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 30 Oct 2018 22:01:46 +0100 Subject: [PATCH 189/231] Avoid using mismatched translations for wxWizard buttons Cache labels for "Next>" or "Finish" button in wxWizard so that their translations stay consistent throughout wizard's lifetime: previously, this button could use a label in a different language if the currently used translations have changed since the wizard creation, as this label was recreated on every page change, unlike the other labels which were only translated once in the very beginning. Closes https://github.com/wxWidgets/wxWidgets/pull/1000 --- include/wx/generic/wizard.h | 4 ++++ src/generic/wizard.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index 7b820a4f26..2b512ec5e3 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -132,6 +132,10 @@ protected: *m_btnNext; // the "Next>" or "Finish" button wxStaticBitmap *m_statbmp; // the control for the bitmap + // cached labels so their translations stay consistent + wxString m_nextLabel, + m_finishLabel; + // Border around page area sizer requested using SetBorder() int m_border; diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index 666ab84f47..3960216686 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -429,7 +429,10 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) btnHelp=new wxButton(this, wxID_HELP, wxEmptyString, wxDefaultPosition, wxDefaultSize, buttonStyle); #endif - m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >")); + m_nextLabel = _("&Next >"); + m_finishLabel = _("&Finish"); + + m_btnNext = new wxButton(this, wxID_FORWARD, m_nextLabel); // Avoid Cmd+C closing dialog on Mac. wxString cancelLabel(_("&Cancel")); #ifdef __WXMAC__ @@ -629,7 +632,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) m_btnPrev->Enable(m_page != m_firstpage); const bool hasNext = HasNextPage(m_page); - const wxString label = hasNext ? _("&Next >") : _("&Finish"); + const wxString& label = hasNext ? m_nextLabel : m_finishLabel; if ( label != m_btnNext->GetLabel() ) m_btnNext->SetLabel(label); From e5beb4e93f90ab6185b0bb194dc2c23ff1519cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Tue, 9 Oct 2018 16:53:59 +0200 Subject: [PATCH 190/231] Improve wxDataViewMainWindow::RefreshRow speed RefreshRow() is called very frequently, and in particular after every ItemChanged notification. Calling GetEndOfLastCol() in it repeatedly is extremely inefficient in presence of auto-sizing columns, and doesn't make much sense anyway - controls with significant space unoccupied by columns are rare, and rendering of such unused space is efficient (just background erase). It is therefore more performant to simply refresh the entire row instead of repeatedly and expensively calculating the smallest rectangle that needs repainting. Fixes previously wrong calculation of the refreshed rectangle in RefreshRows() in the process. Fixes major performance regression introduced in 77c7c80696a4566e10719e6b154b5d07717a3323. Closes https://github.com/wxWidgets/wxWidgets/pull/970 --- src/generic/datavgen.cpp | 46 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 719f6ee122..2e1d1887e1 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -806,7 +806,7 @@ public: bool IsRowSelected( unsigned int row ); void SendSelectionChangedEvent( const wxDataViewItem& item); - void RefreshRow( unsigned int row ); + void RefreshRow( unsigned int row ) { RefreshRows(row, row); } void RefreshRows( unsigned int from, unsigned int to ); void RefreshRowsAfter( unsigned int firstRow ); @@ -816,7 +816,7 @@ public: return wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); } - wxRect GetLineRect( unsigned int row ) const; + wxRect GetLinesRect( unsigned int rowFrom, unsigned int rowTo ) const; int GetLineStart( unsigned int row ) const; // row * m_lineHeight in fixed mode int GetLineHeight( unsigned int row ) const; // m_lineHeight in fixed mode @@ -3275,34 +3275,16 @@ void wxDataViewMainWindow::SendSelectionChangedEvent( const wxDataViewItem& item m_owner->ProcessWindowEvent(le); } -void wxDataViewMainWindow::RefreshRow( unsigned int row ) -{ - wxRect rect( 0, GetLineStart( row ), GetEndOfLastCol(), GetLineHeight( row ) ); - m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); - - wxSize client_size = GetClientSize(); - wxRect client_rect( 0, 0, client_size.x, client_size.y ); - wxRect intersect_rect = client_rect.Intersect( rect ); - if (intersect_rect.width > 0) - Refresh( true, &intersect_rect ); -} - void wxDataViewMainWindow::RefreshRows( unsigned int from, unsigned int to ) { - if (from > to) - { - unsigned int tmp = to; - to = from; - from = tmp; - } + wxRect rect = GetLinesRect(from, to); - wxRect rect( 0, GetLineStart( from ), GetEndOfLastCol(), GetLineStart( (to-from+1) ) ); - m_owner->CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); + m_owner->CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y); wxSize client_size = GetClientSize(); wxRect client_rect( 0, 0, client_size.x, client_size.y ); wxRect intersect_rect = client_rect.Intersect( rect ); - if (intersect_rect.width > 0) + if (!intersect_rect.IsEmpty()) Refresh( true, &intersect_rect ); } @@ -3318,14 +3300,22 @@ void wxDataViewMainWindow::RefreshRowsAfter( unsigned int firstRow ) Refresh( true, &rect ); } -wxRect wxDataViewMainWindow::GetLineRect( unsigned int row ) const +wxRect wxDataViewMainWindow::GetLinesRect( unsigned int rowFrom, unsigned int rowTo ) const { + if (rowFrom > rowTo) + wxSwap(rowFrom, rowTo); + wxRect rect; rect.x = 0; - rect.y = GetLineStart( row ); - rect.width = GetEndOfLastCol(); - rect.height = GetLineHeight( row ); - + rect.y = GetLineStart(rowFrom); + // Don't calculate exact width of the row, because GetEndOfLastCol() is + // expensive to call, and controls with rows not spanning entire width rare. + // It is more efficient to e.g. repaint empty parts of the window needlessly. + rect.width = INT_MAX; + if (rowFrom == rowTo) + rect.height = GetLineHeight(rowFrom); + else + rect.height = GetLineStart(rowTo) - rect.y + GetLineHeight(rowTo); return rect; } From 8c99df373ad62501bca85ffe0146172bdfe75f51 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 30 Oct 2018 22:59:07 -0700 Subject: [PATCH 191/231] Fix handling of scaled bitmaps in wxToolBar with GTK+3 We have to draw them ourselves to get the size right. See #18225 --- src/gtk/toolbar.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp index d857972eff..b700308c87 100644 --- a/src/gtk/toolbar.cpp +++ b/src/gtk/toolbar.cpp @@ -180,15 +180,20 @@ image_draw(GtkWidget* widget, cairo_t* cr, wxToolBarTool* tool) image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool) #endif { +#ifdef __WXGTK3__ + const wxBitmap& bitmap = tool->GetBitmap(); + if (!bitmap.IsOk() || (tool->IsEnabled() && bitmap.GetScaleFactor() <= 1)) + return false; +#else const wxBitmap& bitmap = tool->GetDisabledBitmap(); if (tool->IsEnabled() || !bitmap.IsOk()) return false; +#endif - // draw disabled bitmap ourselves, GtkImage has no way to specify it GtkAllocation alloc; gtk_widget_get_allocation(widget, &alloc); - int x = (alloc.width - bitmap.GetWidth()) / 2; - int y = (alloc.height - bitmap.GetHeight()) / 2; + int x = (alloc.width - bitmap.GetScaledWidth()) / 2; + int y = (alloc.height - bitmap.GetScaledHeight()) / 2; #ifdef __WXGTK3__ bitmap.Draw(cr, x, y); #else @@ -266,9 +271,24 @@ void wxToolBarTool::SetImage() wxCHECK_RET(bitmap.IsOk(), "invalid bitmap for wxToolBar icon"); GtkWidget* image = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item)); - // always use pixbuf, because pixmap mask does not - // work with disabled images in some themes - gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf()); +#ifdef __WXGTK3__ + if (bitmap.GetScaleFactor() > 1) + { + // Use a scaled pixbuf with the correct logical size. It will be used + // for the disabled state if no disabled bitmap is specifed, otherwise + // the original will be used by our "draw" signal handler. + GdkPixbuf* pixbuf = gdk_pixbuf_scale_simple(bitmap.GetPixbuf(), + bitmap.GetScaledWidth(), bitmap.GetScaledHeight(), GDK_INTERP_BILINEAR); + gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); + g_object_unref(pixbuf); + } + else +#endif + { + // always use pixbuf, because pixmap mask does not + // work with disabled images in some themes + gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf()); + } } // helper to create a dropdown menu item From 394b26bc36c09fd7fd47999715ca2eee7db696a4 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Wed, 31 Oct 2018 10:26:11 +0100 Subject: [PATCH 192/231] Fix wxGetDiskSpace() documentation The function is actually declared in utils.h and not in filefn.h --- interface/wx/filefn.h | 20 -------------------- interface/wx/utils.h | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/interface/wx/filefn.h b/interface/wx/filefn.h index a9392c3db2..45a94d22f7 100644 --- a/interface/wx/filefn.h +++ b/interface/wx/filefn.h @@ -129,26 +129,6 @@ typedef off_t wxFileOffset; */ #define wxCHANGE_UMASK(mask) -/** - This function returns the total number of bytes and number of free bytes on - the disk containing the directory @a path (it should exist). Both @a total - and @a free parameters may be @NULL if the corresponding information is not - needed. - - @since 2.3.2 - - @note The generic Unix implementation depends on the system having the - @c statfs() or @c statvfs() function. - - @return @true on success, @false if an error occurred (for example, the - directory doesn’t exist). - - @header{wx/filefn.h} -*/ -bool wxGetDiskSpace(const wxString& path, - wxLongLong total = NULL, - wxLongLong free = NULL); - /** Returns the Windows directory under Windows; other platforms return an empty string. diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 990920ab77..c981365e37 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -365,6 +365,26 @@ wxPowerType wxGetPowerType(); */ wxString wxGetDisplayName(); +/** + This function returns the total number of bytes and number of free bytes on + the disk containing the directory @a path (it should exist). Both @a total + and @a free parameters may be @NULL if the corresponding information is not + needed. + + @since 2.3.2 + + @note The generic Unix implementation depends on the system having the + @c statfs() or @c statvfs() function. + + @return @true on success, @false if an error occurred (for example, the + directory doesn’t exist). + + @header{wx/utils.h} +*/ +bool wxGetDiskSpace(const wxString& path, + wxLongLong total = NULL, + wxLongLong free = NULL); + /** For normal keys, returns @true if the specified key is currently down. From 61e4534bd24136df6c2009878570fdfca1a2e770 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 22:47:21 +0100 Subject: [PATCH 193/231] Deprecate useless wxGenericImageList::Create() overload This overload doesn't do anything and doesn't exist in the MSW version, so deprecate it. --- include/wx/generic/imaglist.h | 6 +++++- src/generic/imaglist.cpp | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index 25157a04f2..227f0c7114 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -25,7 +25,6 @@ public: wxGenericImageList( int width, int height, bool mask = true, int initialCount = 1 ); virtual ~wxGenericImageList(); bool Create( int width, int height, bool mask = true, int initialCount = 1 ); - bool Create(); virtual int GetImageCount() const; virtual bool GetSize( int index, int &width, int &height ) const; @@ -45,6 +44,11 @@ public: int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = false); +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing") + bool Create() { return true; } +#endif // WXWIN_COMPATIBILITY_3_0 + // Internal use only const wxBitmap *GetBitmapPtr(int index) const; private: diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index aeb31ba57f..5613be69f0 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -49,11 +49,6 @@ bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int { m_size = wxSize(width, height); - return Create(); -} - -bool wxGenericImageList::Create() -{ return true; } From 3b5441f59e6ab3c28679f45a39fb3a37f0b06514 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 23:15:49 +0100 Subject: [PATCH 194/231] Deprecate wxGenericImageList::GetBitmapPtr() This function was in effect deprecated since 2.5.5 (!) and it's not finally time to do it formally and to stop using it in wxWidgets own code. --- include/wx/generic/imaglist.h | 7 +++++-- src/generic/imaglist.cpp | 6 +++--- src/gtk/notebook.cpp | 12 +++++------- src/gtk1/notebook.cpp | 16 ++++++++-------- src/qt/listctrl.cpp | 9 +++------ src/qt/notebook.cpp | 10 ++++------ 6 files changed, 28 insertions(+), 32 deletions(-) diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index 227f0c7114..a98973487e 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -47,11 +47,14 @@ public: #if WXWIN_COMPATIBILITY_3_0 wxDEPRECATED_MSG("Don't use this overload: it's not portable and does nothing") bool Create() { return true; } + + wxDEPRECATED_MSG("Use GetBitmap() instead") + const wxBitmap *GetBitmapPtr(int index) const { return DoGetPtr(index); } #endif // WXWIN_COMPATIBILITY_3_0 - // Internal use only - const wxBitmap *GetBitmapPtr(int index) const; private: + const wxBitmap *DoGetPtr(int index) const; + wxObjectList m_images; // Size of a single bitmap in the list. diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 5613be69f0..502d5fdcbf 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -112,7 +112,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour return Add(wxBitmap(img)); } -const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const +const wxBitmap *wxGenericImageList::DoGetPtr( int index ) const { wxObjectList::compatibility_iterator node = m_images.Item( index ); @@ -124,7 +124,7 @@ const wxBitmap *wxGenericImageList::GetBitmapPtr( int index ) const // Get the bitmap wxBitmap wxGenericImageList::GetBitmap(int index) const { - const wxBitmap* bmp = GetBitmapPtr(index); + const wxBitmap* bmp = DoGetPtr(index); if (!bmp) return wxNullBitmap; @@ -137,7 +137,7 @@ wxBitmap wxGenericImageList::GetBitmap(int index) const // Get the icon wxIcon wxGenericImageList::GetIcon(int index) const { - const wxBitmap* bmp = GetBitmapPtr(index); + const wxBitmap* bmp = DoGetPtr(index); if (!bmp) return wxNullIcon; diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 93878cceb6..31978cb2b0 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -284,17 +284,15 @@ bool wxNotebook::SetPageImage( size_t page, int image ) if (image >= 0) { wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist"); - const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(image); - if (bitmap == NULL) - return false; + const wxBitmap bitmap = GetImageList()->GetBitmap(image); if (pageData->m_image) { gtk_image_set_from_pixbuf( - GTK_IMAGE(pageData->m_image), bitmap->GetPixbuf()); + GTK_IMAGE(pageData->m_image), bitmap.GetPixbuf()); } else { - pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf()); + pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf()); gtk_widget_show(pageData->m_image); gtk_box_pack_start(GTK_BOX(pageData->m_box), pageData->m_image, false, false, m_padding); @@ -443,8 +441,8 @@ bool wxNotebook::InsertPage( size_t position, { if (HasImageList()) { - const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); - pageData->m_image = gtk_image_new_from_pixbuf(bitmap->GetPixbuf()); + const wxBitmap bitmap = GetImageList()->GetBitmap(imageId); + pageData->m_image = gtk_image_new_from_pixbuf(bitmap.GetPixbuf()); gtk_box_pack_start(GTK_BOX(pageData->m_box), pageData->m_image, false, false, m_padding); } diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 6dc0752862..cb17186a51 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -512,12 +512,12 @@ bool wxNotebook::SetPageImage( size_t page, int image ) wxASSERT( HasImageList() ); /* Just in case */ /* Construct the new pixmap */ - const wxBitmap *bmp = GetImageList()->GetBitmapPtr(image); - GdkPixmap *pixmap = bmp->GetPixmap(); + const wxBitmap bmp = GetImageList()->GetBitmap(image); + GdkPixmap *pixmap = bmp.GetPixmap(); GdkBitmap *mask = NULL; - if ( bmp->GetMask() ) + if ( bmp.GetMask() ) { - mask = bmp->GetMask()->GetBitmap(); + mask = bmp.GetMask()->GetBitmap(); } if (pixmapwid == NULL) @@ -679,12 +679,12 @@ bool wxNotebook::InsertPage( size_t position, { wxASSERT( HasImageList() ); - const wxBitmap *bmp = GetImageList()->GetBitmapPtr(imageId); - GdkPixmap *pixmap = bmp->GetPixmap(); + const wxBitmap bmp = GetImageList()->GetBitmap(imageId); + GdkPixmap *pixmap = bmp.GetPixmap(); GdkBitmap *mask = NULL; - if ( bmp->GetMask() ) + if ( bmp.GetMask() ) { - mask = bmp->GetMask()->GetBitmap(); + mask = bmp.GetMask()->GetBitmap(); } GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask ); diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index 7ddd3b8d79..8a087ef07d 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -329,12 +329,9 @@ bool wxListCtrl::SetItem(wxListItem& info) { wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL); wxCHECK_MSG(imglst, false, "invalid listctrl imagelist"); - const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image); - if (bitmap != NULL) - { - // set the new image: - qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() )); - } + const wxBitmap bitmap = imglst->GetBitmap(info.m_image); + // set the new image: + qitem->setIcon( info.GetColumn(), QIcon( *bitmap.GetHandle() )); } else { diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp index 8fd294f1f5..3730c67782 100644 --- a/src/qt/notebook.cpp +++ b/src/qt/notebook.cpp @@ -112,11 +112,9 @@ bool wxNotebook::SetPageImage(size_t n, int imageId) if (imageId >= 0) { wxCHECK_MSG(HasImageList(), false, "invalid notebook imagelist"); - const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); - if (bitmap == NULL) - return false; + const wxBitmap bitmap = GetImageList()->GetBitmap(imageId); // set the new image: - m_qtTabWidget->setTabIcon( n, QIcon( *bitmap->GetHandle() )); + m_qtTabWidget->setTabIcon( n, QIcon( *bitmap.GetHandle() )); } else { @@ -137,8 +135,8 @@ bool wxNotebook::InsertPage(size_t n, wxWindow *page, const wxString& text, { if (HasImageList()) { - const wxBitmap* bitmap = GetImageList()->GetBitmapPtr(imageId); - m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap->GetHandle() ), wxQtConvertString( text )); + const wxBitmap bitmap = GetImageList()->GetBitmap(imageId); + m_qtTabWidget->insertTab( n, page->GetHandle(), QIcon( *bitmap.GetHandle() ), wxQtConvertString( text )); } else { From 83a7b499540a577ddef00ae9d0d51b41ea86d3f2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Oct 2018 23:35:10 +0100 Subject: [PATCH 195/231] Always store wxBitmap objects in wxGenericImageList There doesn't seem to be any point in storing pointers to wxBitmap or wxIcon and storing the objects directly allows to avoid an extra heap allocation and all the code dealing with freeing memory when replacing or removing images from the list, making things much simpler. Also use wxVector<> for storage instead of the obsolete and ugly wxObjectList. There shouldn't be any user-visible changes. --- include/wx/generic/imaglist.h | 10 ++- src/generic/imaglist.cpp | 139 +++++++++------------------------- 2 files changed, 42 insertions(+), 107 deletions(-) diff --git a/include/wx/generic/imaglist.h b/include/wx/generic/imaglist.h index a98973487e..a3189e4b5a 100644 --- a/include/wx/generic/imaglist.h +++ b/include/wx/generic/imaglist.h @@ -10,10 +10,11 @@ #ifndef _WX_IMAGLISTG_H_ #define _WX_IMAGLISTG_H_ +#include "wx/bitmap.h" #include "wx/gdicmn.h" +#include "wx/vector.h" class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxBitmap; class WXDLLIMPEXP_FWD_CORE wxIcon; class WXDLLIMPEXP_FWD_CORE wxColour; @@ -35,8 +36,9 @@ public: int Add( const wxBitmap& bitmap, const wxColour& maskColour ); wxBitmap GetBitmap(int index) const; wxIcon GetIcon(int index) const; - bool Replace( int index, const wxBitmap &bitmap ); - bool Replace( int index, const wxBitmap &bitmap, const wxBitmap& mask ); + bool Replace( int index, + const wxBitmap& bitmap, + const wxBitmap& mask = wxNullBitmap ); bool Remove( int index ); bool RemoveAll(); @@ -55,7 +57,7 @@ public: private: const wxBitmap *DoGetPtr(int index) const; - wxObjectList m_images; + wxVector m_images; // Size of a single bitmap in the list. wxSize m_size; diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 502d5fdcbf..771373ce00 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -42,7 +42,7 @@ wxGenericImageList::~wxGenericImageList() int wxGenericImageList::GetImageCount() const { - return m_images.GetCount(); + return static_cast(m_images.size()); } bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int WXUNUSED(initialCount) ) @@ -78,23 +78,16 @@ int wxGenericImageList::Add( const wxBitmap &bitmap ) Add(bitmap.GetSubBitmap(rect)); } - return m_images.GetCount() - 1; + return GetImageCount() - 1; } wxASSERT_MSG( bitmapSize == m_size, "All bitmaps in wxImageList must have the same size" ); } - if (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) - { - m_images.Append( new wxIcon( (const wxIcon&) bitmap ) ); - } - else - { - m_images.Append( new wxBitmap(bitmap) ); - } + m_images.push_back(bitmap); - return m_images.GetCount() - 1; + return GetImageCount() - 1; } int wxGenericImageList::Add( const wxBitmap& bitmap, const wxBitmap& mask ) @@ -114,11 +107,10 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour const wxBitmap *wxGenericImageList::DoGetPtr( int index ) const { - wxObjectList::compatibility_iterator node = m_images.Item( index ); + wxCHECK_MSG( index >= 0 && (size_t)index < m_images.size(), + NULL, wxT("wrong index in image list") ); - wxCHECK_MSG( node, NULL, wxT("wrong index in image list") ); - - return (wxBitmap*)node->GetData(); + return &m_images[index]; } // Get the bitmap @@ -128,10 +120,7 @@ wxBitmap wxGenericImageList::GetBitmap(int index) const if (!bmp) return wxNullBitmap; - if ( bmp->IsKindOf(wxCLASSINFO(wxIcon)) ) - return wxBitmap( *(static_cast(bmp)) ); - else - return *bmp; + return *bmp; } // Get the icon @@ -141,105 +130,54 @@ wxIcon wxGenericImageList::GetIcon(int index) const if (!bmp) return wxNullIcon; - if ( bmp->IsKindOf(wxCLASSINFO(wxIcon)) ) - return *(static_cast(bmp)); - else - { - wxIcon icon; - icon.CopyFromBitmap(*bmp); - return icon; - } + wxIcon icon; + icon.CopyFromBitmap(*bmp); + return icon; } -bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap ) +bool +wxGenericImageList::Replace(int index, + const wxBitmap& bitmap, + const wxBitmap& mask) { - wxObjectList::compatibility_iterator node = m_images.Item( index ); + // Call DoGetPtr() just to check the index validity. + if ( !DoGetPtr(index) ) + return false; - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); + m_images[index] = bitmap; - wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ? - new wxBitmap( (const wxIcon&) bitmap ) - : new wxBitmap(bitmap) ; - - if (index == (int) m_images.GetCount() - 1) - { - delete node->GetData(); - m_images.Erase( node ); - m_images.Append( newBitmap ); - } - else - { - wxObjectList::compatibility_iterator next = node->GetNext(); - delete node->GetData(); - m_images.Erase( node ); - m_images.Insert( next, newBitmap ); - } - - return true; -} - -bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ) -{ - wxObjectList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxBitmap* newBitmap = (bitmap.IsKindOf(wxCLASSINFO(wxIcon))) ? - new wxBitmap( (const wxIcon&) bitmap ) - : new wxBitmap(bitmap) ; - - if (index == (int) m_images.GetCount() - 1) - { - delete node->GetData(); - m_images.Erase( node ); - m_images.Append( newBitmap ); - } - else - { - wxObjectList::compatibility_iterator next = node->GetNext(); - delete node->GetData(); - m_images.Erase( node ); - m_images.Insert( next, newBitmap ); - } - - if (mask.IsOk()) - newBitmap->SetMask(new wxMask(mask)); + if ( mask.IsOk() ) + m_images[index].SetMask(new wxMask(mask)); return true; } bool wxGenericImageList::Remove( int index ) { - wxObjectList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - delete node->GetData(); - m_images.Erase( node ); + m_images.erase(m_images.begin() + index); return true; } bool wxGenericImageList::RemoveAll() { - WX_CLEAR_LIST(wxObjectList, m_images); - m_images.Clear(); + m_images.clear(); return true; } bool wxGenericImageList::GetSize( int index, int &width, int &height ) const { - width = 0; - height = 0; + const wxBitmap* bmp = DoGetPtr(index); + if ( !bmp ) + { + width = 0; + height = 0; + return false; + } - wxObjectList::compatibility_iterator node = m_images.Item( index ); - - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxBitmap *bm = (wxBitmap*)node->GetData(); - width = bm->GetScaledWidth(); - height = bm->GetScaledHeight(); + width = bmp->GetScaledWidth(); + height = bmp->GetScaledHeight(); return true; } @@ -247,16 +185,11 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y, int flags, bool WXUNUSED(solidBackground) ) { - wxObjectList::compatibility_iterator node = m_images.Item( index ); + const wxBitmap* bmp = DoGetPtr(index); + if ( !bmp ) + return false; - wxCHECK_MSG( node, false, wxT("wrong index in image list") ); - - wxBitmap *bm = (wxBitmap*)node->GetData(); - - if (bm->IsKindOf(wxCLASSINFO(wxIcon))) - dc.DrawIcon( * ((wxIcon*) bm), x, y); - else - dc.DrawBitmap( *bm, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 ); + dc.DrawBitmap(*bmp, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) != 0); return true; } From 28f7e6130d484b4f615cebd00ff232f639113941 Mon Sep 17 00:00:00 2001 From: Evileye Date: Wed, 31 Oct 2018 23:16:03 +0100 Subject: [PATCH 196/231] Fix wxDateTime::ParseFormat() when matching TZ offset and in DST Don't skip MakeFromTimeZone() for the current time zone, this is still necessary. Fixes a failure in the unit tests when running during a DST period with TZ=Europe/London, for example. Closes https://github.com/wxWidgets/wxWidgets/pull/966 --- docs/changes.txt | 1 + src/common/datetimefmt.cpp | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index f35cb268d6..672b4d6b85 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -106,6 +106,7 @@ All: - Fix problem with wx-config installation and use under NetBSD (wiz). - Avoid spurious errors on thread creation under NetBSD. - Improve high DPI support in wxAui (Simon Rozman). +- Fix a bug with parsing time zones in wxDateTime::ParseFormat() (evileye). All (GUI): diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 721a149da0..d1454c28d1 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -1647,12 +1647,7 @@ wxDateTime::ParseFormat(const wxString& date, Set(tm); - // If a time zone was specified and it is not the local time zone, we need - // to shift the time accordingly. - // - // Note that avoiding the call to MakeFromTimeZone is necessary to avoid - // DST problems. - if ( haveTimeZone && timeZone != -wxGetTimeZone() ) + if ( haveTimeZone ) MakeFromTimezone(timeZone); // finally check that the week day is consistent -- if we had it From c1a2d2c967c76d9c7f0cc1d6d8714be07936c1a9 Mon Sep 17 00:00:00 2001 From: Blake Eryx Date: Tue, 2 Oct 2018 20:26:49 -0400 Subject: [PATCH 197/231] Show using dynamic splash screen contents in the sample Demonstrate how dynamic information can be shown in the splash screen overlaying the static bitmap. Closes https://github.com/wxWidgets/wxWidgets/pull/958 --- samples/splash/splash.cpp | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/samples/splash/splash.cpp b/samples/splash/splash.cpp index 3721e0ed57..af7036446e 100644 --- a/samples/splash/splash.cpp +++ b/samples/splash/splash.cpp @@ -62,6 +62,8 @@ public: // initialization (doing it here and not in the ctor allows to have an error // return: if OnInit() returns false, the application terminates) virtual bool OnInit() wxOVERRIDE; + + void DecorateSplashScreen(wxBitmap& bmp); }; // Define a new frame type: this is going to be our main frame @@ -141,6 +143,10 @@ bool MyApp::OnInit() if (ok) { + // we can even draw dynamic artwork onto our splashscreen + DecorateSplashScreen(bitmap); + + // show the splashscreen new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize, @@ -162,6 +168,41 @@ bool MyApp::OnInit() return true; } +// Draws artwork onto our splashscreen at runtime +void MyApp::DecorateSplashScreen(wxBitmap& bmp) +{ + // use a memory DC to draw directly onto the bitmap + wxMemoryDC memDc(bmp); + + // draw an orange box (with black outline) at the bottom of the splashscreen. + // this box will be 10% of the height of the bitmap, and be at the bottom. + const wxRect bannerRect(wxPoint(0, (bmp.GetHeight() / 10)*9), + wxPoint(bmp.GetWidth(), bmp.GetHeight())); + wxDCBrushChanger bc(memDc, wxBrush(wxColour(255, 102, 0))); + memDc.DrawRectangle(bannerRect); + memDc.DrawLine(bannerRect.GetTopLeft(), bannerRect.GetTopRight()); + + // dynamically get the wxWidgets version to display + wxString description = wxString::Format("wxWidgets %s", wxVERSION_NUM_DOT_STRING); + // create a copyright notice that uses the year that this file was compiled + wxString year(__DATE__); + wxString copyrightLabel = wxString::Format("%s%s wxWidgets. %s", + wxString::FromUTF8("\xc2\xa9"), year.Mid(year.Length() - 4), + "All rights reserved."); + + // draw the (white) labels inside of our orange box (at the bottom of the splashscreen) + memDc.SetTextForeground(*wxWHITE); + // draw the "wxWidget" label on the left side, vertically centered. + // note that we deflate the banner rect a little bit horizontally + // so that the text has some padding to its left. + memDc.DrawLabel(description, bannerRect.Deflate(5, 0), wxALIGN_CENTRE_VERTICAL|wxALIGN_LEFT); + + // draw the copyright label on the right side + memDc.SetFont(wxFontInfo(8)); + memDc.DrawLabel(copyrightLabel, bannerRect.Deflate(5, 0), wxALIGN_CENTRE_VERTICAL | wxALIGN_RIGHT); +} + + // ---------------------------------------------------------------------------- // main frame // ---------------------------------------------------------------------------- From a316942c18e516ba212dd7f537173485285c7a90 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 31 Oct 2018 23:26:02 +0100 Subject: [PATCH 198/231] Don't use "extern" when initializing wxCurrentPopupWindow Avoid (harmless) warning about the variable being initialized and declared "extern" added by 56c419116838045f23f046112960d4e42f98f80d. --- src/msw/popupwin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index 406733d73d..3784c52a98 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -33,7 +33,10 @@ #include "wx/msw/private.h" // for GetDesktopWindow() // Set to the popup window currently being shown, if any. -extern wxPopupWindow* wxCurrentPopupWindow = NULL; +// +// Note that this global variable is used in src/msw/window.cpp and so must be +// extern. +wxPopupWindow* wxCurrentPopupWindow = NULL; // ============================================================================ // implementation From c01328c2da67aa489d824282fea2e49be8393acd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 31 Oct 2018 23:43:17 +0100 Subject: [PATCH 199/231] Don't crash due to accessing invalid bitmaps in wxAUI code Neither GetWidth() nor GetScaledWidth() (nor the corresponding height-related methods) can be called if the bitmap is invalid and the resulting assert led to a crash when it happened in wxAuiToolBarArt drawing code, as it was triggered on each redraw. Just use bitmap size of (0, 0) if we're not going to draw it anyhow. Closes #18263. --- src/aui/auibar.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index e4027d7d5c..b2dc732a66 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -293,15 +293,21 @@ void wxAuiGenericToolBarArt::DrawButton( int bmpX = 0, bmpY = 0; int textX = 0, textY = 0; + const wxBitmap& bmp = item.GetState() & wxAUI_BUTTON_STATE_DISABLED + ? item.GetDisabledBitmap() + : item.GetBitmap(); + + const wxSize bmpSize = bmp.IsOk() ? bmp.GetScaledSize() : wxSize(0, 0); + if (m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) { bmpX = rect.x + (rect.width/2) - - (item.GetBitmap().GetScaledWidth()/2); + (bmpSize.x/2); bmpY = rect.y + ((rect.height-textHeight)/2) - - (item.GetBitmap().GetScaledHeight()/2); + (bmpSize.y/2); textX = rect.x + (rect.width/2) - (textWidth/2) + 1; textY = rect.y + rect.height - textHeight - 1; @@ -312,9 +318,9 @@ void wxAuiGenericToolBarArt::DrawButton( bmpY = rect.y + (rect.height/2) - - (item.GetBitmap().GetScaledHeight()/2); + (bmpSize.y/2); - textX = bmpX + wnd->FromDIP(3) + item.GetBitmap().GetScaledWidth(); + textX = bmpX + wnd->FromDIP(3) + bmpSize.x; textY = rect.y + (rect.height/2) - (textHeight/2); @@ -351,12 +357,6 @@ void wxAuiGenericToolBarArt::DrawButton( } } - wxBitmap bmp; - if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) - bmp = item.GetDisabledBitmap(); - else - bmp = item.GetBitmap(); - if ( bmp.IsOk() ) dc.DrawBitmap(bmp, bmpX, bmpY, true); @@ -596,8 +596,9 @@ wxSize wxAuiGenericToolBarArt::GetToolSize( if (!item.GetBitmap().IsOk() && !(m_flags & wxAUI_TB_TEXT)) return wnd->FromDIP(wxSize(16,16)); - int width = item.GetBitmap().GetScaledWidth(); - int height = item.GetBitmap().GetScaledHeight(); + const wxBitmap& bmp = item.GetBitmap(); + int width = bmp.IsOk() ? bmp.GetScaledWidth() : 0; + int height = bmp.IsOk() ? bmp.GetScaledHeight() : 0; if (m_flags & wxAUI_TB_TEXT) { From 8e817f8a0e2dbfe61dfa51ffcde4d4a667863eb4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 31 Oct 2018 22:58:26 +0100 Subject: [PATCH 200/231] Don't send events from wxTextCtrl::ChangeValue("") in wxGTK ChangeValue() must not send events, but did in wxGTK when changing the contents of a wxTextCtrl to be empty when it had been non-empty before. Closes #18264. --- docs/changes.txt | 1 + src/gtk/textentry.cpp | 16 +++++++++++++--- tests/controls/textentrytest.cpp | 8 ++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 672b4d6b85..2b3971365f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -133,6 +133,7 @@ All (GUI): wxGTK: - Implement wxTextCtrl::HitTest() for single line controls. +- Fix bug with wxTextCtrl::ChangeValue("") sending an unwanted event. - Implement wxDataViewColumn::UnsetAsSortKey(). - Fix not showing wxInfoBar with GTK+ 3 < 3.22.29. - Fix the build with glib < 2.32 (e.g. CentOS 6). diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp index 2a442b009a..824514fed6 100644 --- a/src/gtk/textentry.cpp +++ b/src/gtk/textentry.cpp @@ -559,10 +559,20 @@ void wxTextEntry::DoSetValue(const wxString& value, int flags) EventsSuppressor noevents(this); Remove(0, -1); } - EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent)); - WriteText(value); + + // Testing whether value is empty here is more than just an + // optimization: WriteText() always generates an explicit event in + // wxGTK, which we need to avoid unless SetValue_SendEvent is given. + if ( !value.empty() ) + { + // Suppress events from here even if we do need them, it's simpler + // to send the event below in all cases. + EventsSuppressor noevents(this); + WriteText(value); + } } - else if (flags & SetValue_SendEvent) + + if ( flags & SetValue_SendEvent ) SendTextUpdatedEvent(GetEditableWindow()); SetInsertionPoint(0); diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index 5ae7c53179..8bf279c2fc 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -87,6 +87,14 @@ void TextEntryTestCase::TextChangeEvents() entry->ChangeValue(""); CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() ); updated.Clear(); + + entry->ChangeValue("non-empty"); + CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() ); + updated.Clear(); + + entry->ChangeValue(""); + CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() ); + updated.Clear(); } void TextEntryTestCase::CheckStringSelection(const char *sel) From 4405176bb978a46ec8b03378e87d02d690e0ca1c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 31 Oct 2018 20:42:10 +0100 Subject: [PATCH 201/231] Return correct scale factor for not yet realized windows in wxGTK wxWindow::GetContentScaleFactor() always returned 1 before the window was shown in wxGTK, which was rather annoying as typically icons are initialized on application startup, i.e. before showing the windows, and so the wrong scale factor was silently used for them. --- src/gtk/window.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 64a633afaf..e440422ab7 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -4314,9 +4314,7 @@ double wxWindowGTK::GetContentScaleFactor() const #if GTK_CHECK_VERSION(3,10,0) if (m_widget && gtk_check_version(3,10,0) == NULL) { - GdkWindow* window = gtk_widget_get_window(m_widget); - if (window) - scaleFactor = gdk_window_get_scale_factor(window); + scaleFactor = gtk_widget_get_scale_factor(m_widget); } #endif return scaleFactor; From 5ff0d3a458cb4f7763c2d7797d41fa19d88025e7 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Nov 2018 00:11:31 -0700 Subject: [PATCH 202/231] Improve wxRendererGTK drawing with HiDPI --- include/wx/gtk/private/stylecontext.h | 3 ++- src/gtk/renderer.cpp | 12 ++++++------ src/gtk/settings.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/wx/gtk/private/stylecontext.h b/include/wx/gtk/private/stylecontext.h index a81ac3823e..6a5deef9c1 100644 --- a/include/wx/gtk/private/stylecontext.h +++ b/include/wx/gtk/private/stylecontext.h @@ -15,7 +15,7 @@ class wxGtkStyleContext { public: - wxGtkStyleContext(); + wxGtkStyleContext(double scale = 1); ~wxGtkStyleContext(); wxGtkStyleContext& Add(GType type, const char* objectName, ...) G_GNUC_NULL_TERMINATED; wxGtkStyleContext& Add(const char* objectName); @@ -38,6 +38,7 @@ public: private: GtkStyleContext* m_context; GtkWidgetPath* const m_path; + const int m_scale; wxDECLARE_NO_COPY_CLASS(wxGtkStyleContext); }; diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index 479a6a279d..cac350e8cb 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -249,7 +249,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, if (flags & wxCONTROL_DIRTY) pos = 2; - wxGtkStyleContext sc; + wxGtkStyleContext sc(dc.GetContentScaleFactor()); sc.AddTreeviewHeaderButton(pos); gtk_style_context_set_state(sc, stateTypeToFlags[state]); @@ -450,7 +450,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win, x_diff = rect.width; #ifdef __WXGTK3__ - wxGtkStyleContext sc; + wxGtkStyleContext sc(dc.GetContentScaleFactor()); sc.Add(GTK_TYPE_PANED, "paned", "pane-separator", NULL); if (gtk_check_version(3,20,0) == NULL) sc.Add("separator"); @@ -561,7 +561,7 @@ wxRendererGTK::GetCheckBoxSize(wxWindow* win) #ifdef __WXGTK3__ int min_width, min_height; - wxGtkStyleContext sc; + wxGtkStyleContext sc(win->GetContentScaleFactor()); sc.AddCheckButton(); if (gtk_check_version(3,20,0) == NULL) { @@ -654,7 +654,7 @@ wxRendererGTK::DrawCheckBox(wxWindow*, state |= GTK_STATE_FLAG_PRELIGHT; int min_width, min_height; - wxGtkStyleContext sc; + wxGtkStyleContext sc(dc.GetContentScaleFactor()); sc.AddCheckButton(); if (gtk_check_version(3,20,0) == NULL) { @@ -851,7 +851,7 @@ void wxRendererGTK::DrawTextCtrl(wxWindow*, wxDC& dc, const wxRect& rect, int fl if (flags & wxCONTROL_DISABLED) state = GTK_STATE_FLAG_INSENSITIVE; - wxGtkStyleContext sc; + wxGtkStyleContext sc(dc.GetContentScaleFactor()); sc.Add(GTK_TYPE_ENTRY, "entry", "entry", NULL); gtk_style_context_set_state(sc, GtkStateFlags(state)); @@ -1001,7 +1001,7 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow*, wxDC& dc, const wxRect& rect, int state |= GTK_STATE_FLAG_PRELIGHT; int min_width, min_height; - wxGtkStyleContext sc; + wxGtkStyleContext sc(dc.GetContentScaleFactor()); sc.Add(GTK_TYPE_RADIO_BUTTON, "radiobutton", NULL); #if GTK_CHECK_VERSION(3,20,0) if (gtk_check_version(3,20,0) == NULL) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 2c8132cbbe..1e3a553340 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -209,8 +209,9 @@ private: // wxGtkStyleContext //----------------------------------------------------------------------------- -wxGtkStyleContext::wxGtkStyleContext() +wxGtkStyleContext::wxGtkStyleContext(double scale) : m_path(gtk_widget_path_new()) + , m_scale(int(scale)) { m_context = NULL; } @@ -233,6 +234,10 @@ wxGtkStyleContext& wxGtkStyleContext::Add(GType type, const char* objectName, .. va_end(args); GtkStyleContext* sc = gtk_style_context_new(); +#if GTK_CHECK_VERSION(3,10,0) + if (gtk_check_version(3,10,0) == NULL) + gtk_style_context_set_scale(sc, m_scale); +#endif gtk_style_context_set_path(sc, m_path); if (m_context) { From e13a2cfd03226d3713af9777eac323cee60cd82c Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Nov 2018 08:50:59 -0700 Subject: [PATCH 203/231] Make wxGtkStyleContext ctor explicit, just to be safe --- include/wx/gtk/private/stylecontext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/gtk/private/stylecontext.h b/include/wx/gtk/private/stylecontext.h index 6a5deef9c1..229b4f29a8 100644 --- a/include/wx/gtk/private/stylecontext.h +++ b/include/wx/gtk/private/stylecontext.h @@ -15,7 +15,7 @@ class wxGtkStyleContext { public: - wxGtkStyleContext(double scale = 1); + explicit wxGtkStyleContext(double scale = 1); ~wxGtkStyleContext(); wxGtkStyleContext& Add(GType type, const char* objectName, ...) G_GNUC_NULL_TERMINATED; wxGtkStyleContext& Add(const char* objectName); From dc0cf732a299cb3bc4402bea6fb0535d7ae9898c Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Nov 2018 09:58:27 -0700 Subject: [PATCH 204/231] Provide scale factor to wxGtkStyleContext where it might matter. --- src/gtk/settings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 1e3a553340..c7f3a092a2 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -790,7 +790,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) g_signal_connect(gtk_settings_get_default(), "notify::gtk-font-name", G_CALLBACK(notify_gtk_font_name), NULL); } - wxGtkStyleContext sc; + ContainerWidget(); + wxGtkStyleContext sc(gtk_widget_get_scale_factor(gs_tlw_parent)); sc.AddButton().AddLabel(); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &info.description, NULL); @@ -874,7 +875,7 @@ static int GetScrollbarWidth() if (wx_is_at_least_gtk3(20)) { GtkBorder border; - wxGtkStyleContext sc; + wxGtkStyleContext sc(gtk_widget_get_scale_factor(ScrollBarWidget())); sc.Add(GTK_TYPE_SCROLLBAR, "scrollbar", "scrollbar", "vertical", "right", NULL); gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); From 5fbe3cab7600d40f5f4dcd952c83b2f1b749d74e Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 1 Nov 2018 18:11:57 +0100 Subject: [PATCH 205/231] Don't reset wxPGProperty editor if focus is switched between its components As long as focus is being switched only between subcontrols of the active editor the state of the edited wxPGProperty remains unchanged and there is no need to explicitly reset the editor. Unwanted editor resets could happen if such internal focus changes would be captured in EVT_IDLE handler. Closes #18162. --- .editorconfig | 2 +- src/propgrid/propgrid.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index e980c39bd4..2ab7c9a47f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ root = true [*] charset = utf-8 -end_of_line = lf +end_of_line = crlf insert_final_newline = true indent_style = space indent_size = 4 diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 1fa1201b27..6fb3782835 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5961,6 +5961,11 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused ) { if ( parent == wndEditor ) { + // If editor is active consider focus set on its components + // as a focus set on the editor itself (to prevent doing actions + // when focus is switched between subcontrols of a compound + // editor like e.g. wxComboCtrl). + newFocused = wndEditor; wasEditorFocused = true; } // Use m_eventObject, which is either wxPropertyGrid or From e7357eafa29cd50e9a66a77c2cd8ff9787fd6b1f Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 1 Nov 2018 18:19:55 +0100 Subject: [PATCH 206/231] Declare array explicitly as a wxVector instead of using wxArrayPGProperty alias --- include/wx/propgrid/propgrid.h | 8 ++-- src/propgrid/propgrid.cpp | 26 +++++----- src/propgrid/propgridpagestate.cpp | 77 ++++++++++++++++++------------ 3 files changed, 65 insertions(+), 46 deletions(-) diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 99f899a0ed..9239043908 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1572,8 +1572,8 @@ protected: wxPGCell m_unspecifiedAppearance; // List of properties to be deleted/removed in idle event handler. - wxArrayPGProperty m_deletedProperties; - wxArrayPGProperty m_removedProperties; + wxVector m_deletedProperties; + wxVector m_removedProperties; #if !WXWIN_COMPATIBILITY_3_0 // List of editors and their event handlers to be deleted in idle event handler. @@ -2280,7 +2280,7 @@ public: // added. wxPGProperty* GetCurParent() const { - return (wxPGProperty*) m_propHierarchy[m_propHierarchy.size()-1]; + return m_propHierarchy.back(); } wxPropertyGridPageState* GetState() { return m_state; } @@ -2309,7 +2309,7 @@ protected: wxPropertyGridPageState* m_state; // Tree-hierarchy of added properties (that can have children). - wxArrayPGProperty m_propHierarchy; + wxVector m_propHierarchy; // Hashmap for string-id to wxPGChoicesData mapping. wxPGHashMapS2P m_dictIdChoices; diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 6fb3782835..1981069b3b 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5588,17 +5588,20 @@ void wxPropertyGrid::ClearActionTriggers( int action ) } #if WXWIN_COMPATIBILITY_3_0 -// Utility to find if specific item is in a vector. Returns index to -// the item, or wxNOT_FOUND if not present. -template -int wxPGFindInVector( CONTAINER vector, const T& item ) +// Utility to check if specific item is in a vector. +template +static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) { - for ( unsigned int i=0; i::const_iterator it = vector.begin(); it != vector.end(); ++it) { - if ( vector[i] == item ) - return (int) i; + if ( *it == item ) + return true; } - return wxNOT_FOUND; + return false; +#endif // wxUSE_STL/!wxUSE_STL } #endif // WXWIN_COMPATIBILITY_3_0 @@ -5706,7 +5709,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild ) if ( fromChild && #if WXWIN_COMPATIBILITY_3_0 // Deprecated: use a hash set instead. - wxPGFindInVector(m_dedicatedKeys, keycode) == wxNOT_FOUND ) + !wxPGItemExistsInVector(m_dedicatedKeys, keycode) ) #else m_dedicatedKeys.find(keycode) == m_dedicatedKeys.end() ) #endif @@ -6602,11 +6605,10 @@ bool wxPropertyGridPopulator::AddAttribute( const wxString& name, const wxString& type, const wxString& value ) { - int l = m_propHierarchy.size(); - if ( !l ) + if ( m_propHierarchy.empty() ) return false; - wxPGProperty* p = m_propHierarchy[l-1]; + wxPGProperty* p = m_propHierarchy.back(); wxString valuel = value.Lower(); wxVariant variant; diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 870354a27f..679c39b405 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -43,6 +43,43 @@ #define wxPG_DEFAULT_SPLITTERX 110 +// Utility to remove given item from the vector. +template +static void wxPGRemoveItemFromVector(wxVector& vector, const T& item) +{ +#if wxUSE_STL + wxVector::iterator it = std::find(vector.begin(), vector.end(), item); + if ( it != vector.end() ) + { + vector.erase(it); + } +#else + for (wxVector::iterator it = vector.begin(); it != vector.end(); ++it) + { + if ( *it == item ) + { + vector.erase(it); + return; + } + } +#endif // wxUSE_STL/!wxUSE_STL +} + +// Utility to check if specific item is in a vector. +template +static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) +{ +#if wxUSE_STL + return std::find(vector.begin(), vector.end(), item) != vector.end(); +#else + for (wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it) + { + if ( *it == item ) + return true; + } + return false; +#endif // wxUSE_STL/!wxUSE_STL +} // ----------------------------------------------------------------------- // wxPropertyGridIterator @@ -303,16 +340,8 @@ void wxPropertyGridPageState::DoClear() for (unsigned int i = 0; i < m_regularArray.GetChildCount(); i++) { wxPGProperty* p = m_regularArray.Item(i); - int index = m_pPropGrid->m_deletedProperties.Index(p); - if (index != wxNOT_FOUND) - { - m_pPropGrid->m_deletedProperties.RemoveAt(index); - } - index = m_pPropGrid->m_removedProperties.Index(p); - if (index != wxNOT_FOUND) - { - m_pPropGrid->m_removedProperties.RemoveAt(index); - } + wxPGRemoveItemFromVector(m_pPropGrid->m_deletedProperties, p); + wxPGRemoveItemFromVector(m_pPropGrid->m_removedProperties, p); } m_regularArray.Empty(); @@ -2004,14 +2033,14 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) // Prevent adding duplicates to the lists. if ( doDelete ) { - if ( pg->m_deletedProperties.Index(item) != wxNOT_FOUND ) + if ( wxPGItemExistsInVector(pg->m_deletedProperties, item) ) return; pg->m_deletedProperties.push_back(item); } else { - if ( pg->m_removedProperties.Index(item) != wxNOT_FOUND ) + if ( wxPGItemExistsInVector(pg->m_removedProperties, item) ) return; pg->m_removedProperties.push_back(item); @@ -2112,20 +2141,12 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) { // Remove the item from both lists of pending operations. // (Deleted item cannot be also the subject of further removal.) - int index = pg->m_deletedProperties.Index(item); - if ( index != wxNOT_FOUND ) - { - pg->m_deletedProperties.RemoveAt(index); - } - wxASSERT_MSG( pg->m_deletedProperties.Index(item) == wxNOT_FOUND, + wxPGRemoveItemFromVector(pg->m_deletedProperties, item); + wxASSERT_MSG( !wxPGItemExistsInVector(pg->m_deletedProperties, item), wxS("Too many occurrences of the item")); - index = pg->m_removedProperties.Index(item); - if ( index != wxNOT_FOUND ) - { - pg->m_removedProperties.RemoveAt(index); - } - wxASSERT_MSG( pg->m_removedProperties.Index(item) == wxNOT_FOUND, + wxPGRemoveItemFromVector(pg->m_removedProperties, item); + wxASSERT_MSG( !wxPGItemExistsInVector(pg->m_removedProperties, item), wxS("Too many occurrences of the item")); delete item; @@ -2133,12 +2154,8 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete ) else { // Remove the item from the list of pending removals. - int index = pg->m_removedProperties.Index(item); - if ( index != wxNOT_FOUND ) - { - pg->m_removedProperties.RemoveAt(index); - } - wxASSERT_MSG( pg->m_removedProperties.Index(item) == wxNOT_FOUND, + wxPGRemoveItemFromVector(pg->m_removedProperties, item); + wxASSERT_MSG( !wxPGItemExistsInVector(pg->m_removedProperties, item), wxS("Too many occurrences of the item")); item->OnDetached(this, pg); From 161bb592ce9d58fecf0b906a0f04019a8b04e14b Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 1 Nov 2018 18:22:22 +0100 Subject: [PATCH 207/231] Use wxVector instead of wxArrayInt --- include/wx/propgrid/propgridpagestate.h | 6 ++-- src/propgrid/propgrid.cpp | 40 ++++++++++++------------- src/propgrid/propgridpagestate.cpp | 7 ++--- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h index 2dc6d1eb27..246f23dec0 100644 --- a/include/wx/propgrid/propgridpagestate.h +++ b/include/wx/propgrid/propgridpagestate.h @@ -642,13 +642,13 @@ protected: wxPGHashMapS2P m_dictName; // List of column widths (first column does not include margin). - wxArrayInt m_colWidths; + wxVector m_colWidths; // List of indices of columns the user can edit by clicking it. - wxArrayInt m_editableColumns; + wxVector m_editableColumns; // Column proportions. - wxArrayInt m_columnProportions; + wxVector m_columnProportions; double m_fSplitterX; diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 1981069b3b..826317cb4d 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -137,6 +137,22 @@ DeletedObjects gs_deletedEditorObjects; } // anonymous namespace #endif + // Utility to check if specific item is in a vector. +template +static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) +{ +#if wxUSE_STL + return std::find(vector.begin(), vector.end(), item) != vector.end(); +#else + for ( wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it ) + { + if ( *it == item ) + return true; + } + return false; +#endif // wxUSE_STL/!wxUSE_STL +} + // ----------------------------------------------------------------------- #if wxUSE_INTL @@ -802,7 +818,7 @@ bool wxPropertyGrid::DoSelectAndEdit( wxPGProperty* prop, // send event DoClearSelection(false, wxPG_SEL_NO_REFRESH); - if ( m_pState->m_editableColumns.Index(colIndex) == wxNOT_FOUND ) + if ( !wxPGItemExistsInVector(m_pState->m_editableColumns, colIndex) ) { res = DoAddToSelection(prop, selFlags); } @@ -972,7 +988,7 @@ void wxPropertyGrid::MakeColumnEditable( unsigned int column, wxS("Set wxPG_PROP_READONLY property flag instead") ); - wxArrayInt& cols = m_pState->m_editableColumns; + wxVector& cols = m_pState->m_editableColumns; if ( editable ) { @@ -2145,7 +2161,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, const wxPGProperty* firstSelected = GetSelection(); const wxPropertyGridPageState* state = m_pState; - const wxArrayInt& colWidths = state->m_colWidths; + const wxVector& colWidths = state->m_colWidths; const unsigned int colCount = state->GetColumnCount(); // TODO: Only render columns that are within clipping region. @@ -5587,24 +5603,6 @@ void wxPropertyGrid::ClearActionTriggers( int action ) while ( didSomething ); } -#if WXWIN_COMPATIBILITY_3_0 -// Utility to check if specific item is in a vector. -template -static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) -{ -#if wxUSE_STL - return std::find(vector.begin(), vector.end(), item) != vector.end(); -#else - for (wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it) - { - if ( *it == item ) - return true; - } - return false; -#endif // wxUSE_STL/!wxUSE_STL -} -#endif // WXWIN_COMPATIBILITY_3_0 - void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild ) { // diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 679c39b405..9833b65dc9 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -1219,11 +1219,8 @@ void wxPropertyGridPageState::ResetColumnSizes( int setSplitterFlags ) void wxPropertyGridPageState::SetColumnCount( int colCount ) { wxASSERT( colCount >= 2 ); - m_colWidths.SetCount( colCount, wxPG_DRAG_MARGIN ); - m_columnProportions.SetCount( colCount, 1 ); - if ( m_colWidths.size() > (unsigned int)colCount ) - m_colWidths.RemoveAt( m_colWidths.size()-1, - m_colWidths.size() - colCount ); + m_colWidths.resize(colCount, wxPG_DRAG_MARGIN); + m_columnProportions.resize(colCount, 1); if ( m_pPropGrid->GetState() == this ) m_pPropGrid->RecalculateVirtualSize(); From abf96783375bee23effe1bfcce723fdffd0f264c Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 1 Nov 2018 18:37:34 +0100 Subject: [PATCH 208/231] Revert changes in Editor Config file made by mistake in 5fbe3cab --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 2ab7c9a47f..e980c39bd4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ root = true [*] charset = utf-8 -end_of_line = crlf +end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 From ed442cd57492e1b6559a8c03e63e758b40b3935c Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Nov 2018 11:05:41 -0700 Subject: [PATCH 209/231] Draw background before drawing toolbar bitmap. The background may not have been painted for us. --- src/gtk/toolbar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp index b700308c87..d6d399b4a7 100644 --- a/src/gtk/toolbar.cpp +++ b/src/gtk/toolbar.cpp @@ -195,6 +195,8 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool) int x = (alloc.width - bitmap.GetScaledWidth()) / 2; int y = (alloc.height - bitmap.GetScaledHeight()) / 2; #ifdef __WXGTK3__ + gtk_render_background(gtk_widget_get_style_context(widget), + cr, alloc.x, alloc.y, alloc.width, alloc.height); bitmap.Draw(cr, x, y); #else x += alloc.x; From dfb48b47f5fcd5748b0abcb6200b42ae98e8c6ec Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Nov 2018 11:06:53 -0700 Subject: [PATCH 210/231] Add version checks for gtk_widget_get_scale_factor() --- src/gtk/settings.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index c7f3a092a2..fbbe942ab8 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -791,7 +791,12 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) G_CALLBACK(notify_gtk_font_name), NULL); } ContainerWidget(); - wxGtkStyleContext sc(gtk_widget_get_scale_factor(gs_tlw_parent)); + int scale = 1; +#if GTK_CHECK_VERSION(3,10,0) + if (wx_is_at_least_gtk3(10)) + scale = gtk_widget_get_scale_factor(gs_tlw_parent); +#endif + wxGtkStyleContext sc(scale); sc.AddButton().AddLabel(); gtk_style_context_get(sc, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &info.description, NULL); @@ -875,7 +880,11 @@ static int GetScrollbarWidth() if (wx_is_at_least_gtk3(20)) { GtkBorder border; +#if GTK_CHECK_VERSION(3,10,0) wxGtkStyleContext sc(gtk_widget_get_scale_factor(ScrollBarWidget())); +#else + wxGtkStyleContext sc; +#endif sc.Add(GTK_TYPE_SCROLLBAR, "scrollbar", "scrollbar", "vertical", "right", NULL); gtk_style_context_get_border(sc, GTK_STATE_FLAG_NORMAL, &border); From 63c602c3d268bdbaf6d98d9ca743af2c9278e508 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 2 Nov 2018 12:10:22 +0100 Subject: [PATCH 211/231] Explicitly declare iterators in the function templates --- src/propgrid/propgrid.cpp | 2 +- src/propgrid/propgridpagestate.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 826317cb4d..9ea2aeba5f 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -144,7 +144,7 @@ static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) #if wxUSE_STL return std::find(vector.begin(), vector.end(), item) != vector.end(); #else - for ( wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it ) + for (typename wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it) { if ( *it == item ) return true; diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 9833b65dc9..be18422604 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -48,13 +48,13 @@ template static void wxPGRemoveItemFromVector(wxVector& vector, const T& item) { #if wxUSE_STL - wxVector::iterator it = std::find(vector.begin(), vector.end(), item); + typename wxVector::iterator it = std::find(vector.begin(), vector.end(), item); if ( it != vector.end() ) { vector.erase(it); } #else - for (wxVector::iterator it = vector.begin(); it != vector.end(); ++it) + for (typename wxVector::iterator it = vector.begin(); it != vector.end(); ++it) { if ( *it == item ) { @@ -72,7 +72,7 @@ static bool wxPGItemExistsInVector(const wxVector& vector, const T& item) #if wxUSE_STL return std::find(vector.begin(), vector.end(), item) != vector.end(); #else - for (wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it) + for (typename wxVector::const_iterator it = vector.begin(); it != vector.end(); ++it) { if ( *it == item ) return true; From 18e2b58e5bf00cdc18c1be869fb222cd7ce4af52 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 3 Nov 2018 22:39:57 +0100 Subject: [PATCH 212/231] Remove unnecessary border around wxEditableListBox buttons This border was added under MSW for some reason, but doesn't seem to be necessary (any longer?). Closes #18265. --- src/generic/editlbox.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp index 074fa5fac2..a2616297d3 100644 --- a/src/generic/editlbox.cpp +++ b/src/generic/editlbox.cpp @@ -123,45 +123,36 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, wxSizer *subsizer = new wxBoxSizer(wxHORIZONTAL); subsizer->Add(new wxStaticText(subp, wxID_ANY, label), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT, 4); -#ifdef __WXMSW__ - #define BTN_BORDER 4 - // FIXME - why is this needed? There's some reason why sunken border is - // ignored by sizers in wxMSW but not in wxGTK that I can't - // figure out... -#else - #define BTN_BORDER 0 -#endif - if ( m_style & wxEL_ALLOW_EDIT ) { m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); - subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); + subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL); } if ( m_style & wxEL_ALLOW_NEW ) { m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); - subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); + subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL); } if ( m_style & wxEL_ALLOW_DELETE ) { m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); - subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); + subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL); } if (!(m_style & wxEL_NO_REORDER)) { m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); - subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); + subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL); m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); - subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER); + subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL); } #if wxUSE_TOOLTIPS From 397b5ff01e987736d938976026701de7d23af5a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 3 Nov 2018 22:43:10 +0100 Subject: [PATCH 213/231] Use wxSizerFlags-based API in wxEditableListBox No real changes, just make the code more clear by using wxSizerFlags. --- src/generic/editlbox.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp index a2616297d3..f8ab2b737f 100644 --- a/src/generic/editlbox.cpp +++ b/src/generic/editlbox.cpp @@ -121,38 +121,42 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, wxPanel *subp = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL); wxSizer *subsizer = new wxBoxSizer(wxHORIZONTAL); - subsizer->Add(new wxStaticText(subp, wxID_ANY, label), 1, wxALIGN_CENTRE_VERTICAL | wxLEFT, 4); + + subsizer->Add(new wxStaticText(subp, wxID_ANY, label), + wxSizerFlags(1).Center().Border(wxLEFT)); + + const wxSizerFlags centered = wxSizerFlags().Center(); if ( m_style & wxEL_ALLOW_EDIT ) { m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); - subsizer->Add(m_bEdit, 0, wxALIGN_CENTRE_VERTICAL); + subsizer->Add(m_bEdit, centered); } if ( m_style & wxEL_ALLOW_NEW ) { m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); - subsizer->Add(m_bNew, 0, wxALIGN_CENTRE_VERTICAL); + subsizer->Add(m_bNew, centered); } if ( m_style & wxEL_ALLOW_DELETE ) { m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); - subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL); + subsizer->Add(m_bDel, centered); } if (!(m_style & wxEL_NO_REORDER)) { m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); - subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL); + subsizer->Add(m_bUp, centered); m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); - subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL); + subsizer->Add(m_bDown, centered); } #if wxUSE_TOOLTIPS @@ -166,7 +170,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, subp->SetSizer(subsizer); subsizer->Fit(subp); - sizer->Add(subp, 0, wxEXPAND); + sizer->Add(subp, wxSizerFlags().Expand()); long st = wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL | wxSUNKEN_BORDER; if ( style & wxEL_ALLOW_EDIT ) @@ -176,7 +180,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, wxArrayString empty_ar; SetStrings(empty_ar); - sizer->Add(m_listCtrl, 1, wxEXPAND); + sizer->Add(m_listCtrl, wxSizerFlags(1).Expand()); SetSizer(sizer); Layout(); From f24892127dac0a8e7105f91fdb6c7e6391cd0a4d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 3 Nov 2018 22:45:37 +0100 Subject: [PATCH 214/231] Remove unnecessary wxUSE_TOOLTIPS check in wxEditableListBox code SetToolTip() is defined (as doing nothing) even if wxUSE_TOOLTIPS==0, so just call it directly as this allows to save on both the preprocessor check and the check for the button validity. --- src/generic/editlbox.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp index f8ab2b737f..3ad94a4ce9 100644 --- a/src/generic/editlbox.cpp +++ b/src/generic/editlbox.cpp @@ -131,6 +131,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, { m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); + m_bEdit->SetToolTip(_("Edit item")); subsizer->Add(m_bEdit, centered); } @@ -138,6 +139,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, { m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); + m_bNew->SetToolTip(_("New item")); subsizer->Add(m_bNew, centered); } @@ -145,6 +147,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, { m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); + m_bDel->SetToolTip(_("Delete item")); subsizer->Add(m_bDel, centered); } @@ -152,21 +155,15 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, { m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); + m_bUp->SetToolTip(_("Move up")); subsizer->Add(m_bUp, centered); m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); + m_bDown->SetToolTip(_("Move down")); subsizer->Add(m_bDown, centered); } -#if wxUSE_TOOLTIPS - if ( m_bEdit ) m_bEdit->SetToolTip(_("Edit item")); - if ( m_bNew ) m_bNew->SetToolTip(_("New item")); - if ( m_bDel ) m_bDel->SetToolTip(_("Delete item")); - if ( m_bUp ) m_bUp->SetToolTip(_("Move up")); - if ( m_bDown ) m_bDown->SetToolTip(_("Move down")); -#endif - subp->SetSizer(subsizer); subsizer->Fit(subp); From 65827a05728388704fe643875788b629dd91cca4 Mon Sep 17 00:00:00 2001 From: Blake Eryx Date: Thu, 1 Nov 2018 19:32:02 -0400 Subject: [PATCH 215/231] Remove unnecessary c_str() calls from the samples Pass wxStrings directly to wxString::Format("%s") and similar pseudo-vararg functions, there is no need for c_str() there since wxWidgets 2.9. Closes https://github.com/wxWidgets/wxWidgets/pull/1009 --- samples/access/accesstest.cpp | 6 +- samples/calendar/calendar.cpp | 8 +-- samples/combo/combo.cpp | 6 +- samples/config/conftest.cpp | 2 +- samples/debugrpt/debugrpt.cpp | 4 +- samples/dialogs/dialogs.cpp | 36 ++++++------ samples/dnd/dnd.cpp | 4 +- samples/drawing/drawing.cpp | 2 +- samples/exec/exec.cpp | 36 ++++++------ samples/font/font.cpp | 18 +++--- samples/grid/griddemo.cpp | 8 +-- samples/htlbox/htlbox.cpp | 8 +-- samples/html/test/test.cpp | 4 +- samples/image/image.cpp | 4 +- samples/internat/internat.cpp | 8 +-- samples/ipc/client.cpp | 2 +- samples/ipc/connection.h | 8 +-- samples/joytest/joytest.cpp | 2 +- samples/listctrl/listtest.cpp | 10 ++-- samples/mediaplayer/mediaplayer.cpp | 4 +- samples/menu/menu.cpp | 14 ++--- samples/notebook/notebook.cpp | 10 ++-- samples/opengl/isosurf/isosurf.cpp | 4 +- samples/power/power.cpp | 4 +- samples/propgrid/propgrid.cpp | 26 ++++----- samples/propgrid/propgrid_minimal.cpp | 4 +- samples/propgrid/tests.cpp | 82 +++++++++++++-------------- samples/regtest/regtest.cpp | 22 +++---- samples/render/render.cpp | 4 +- samples/richtext/richtext.cpp | 2 +- samples/sockets/baseclient.cpp | 30 +++++----- samples/sockets/baseserver.cpp | 2 +- samples/taborder/taborder.cpp | 2 +- samples/text/text.cpp | 12 ++-- samples/toolbar/toolbar.cpp | 2 +- samples/treectrl/treetest.cpp | 12 ++-- samples/typetest/typetest.cpp | 10 ++-- samples/webview/webview.cpp | 2 +- samples/widgets/bmpcombobox.cpp | 6 +- samples/widgets/clrpicker.cpp | 2 +- samples/widgets/combobox.cpp | 6 +- samples/widgets/dirpicker.cpp | 2 +- samples/widgets/filepicker.cpp | 2 +- samples/widgets/fontpicker.cpp | 2 +- samples/widgets/itemcontainer.cpp | 6 +- samples/widgets/odcombobox.cpp | 6 +- samples/widgets/radiobox.cpp | 2 +- samples/widgets/spinbtn.cpp | 2 +- samples/widgets/statbmp.cpp | 2 +- samples/widgets/textctrl.cpp | 6 +- samples/xti/codereadercallback.cpp | 52 ++++++++--------- 51 files changed, 260 insertions(+), 260 deletions(-) diff --git a/samples/access/accesstest.cpp b/samples/access/accesstest.cpp index 4bd8a63209..e73fdee3ee 100644 --- a/samples/access/accesstest.cpp +++ b/samples/access/accesstest.cpp @@ -455,7 +455,7 @@ void MyFrame::OnQuery(wxCommandEvent& WXUNUSED(event)) wxString name, role; GetInfo(childAccessible, 0, name, role); wxString str; - str.Printf("Found child %s/%s", name.c_str(), role.c_str()); + str.Printf("Found child %s/%s", name, role); Log(str); childAccessible->Release(); } @@ -499,7 +499,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) GetInfo(obj, 0, name, role); wxString str; - str.Printf("Name = %s; Role = %s", name.c_str(), role.c_str()); + str.Printf("Name = %s; Role = %s", name, role); str.Pad(indent, ' ', false); Log(str); } @@ -520,7 +520,7 @@ void MyFrame::LogObject(int indent, IAccessible* obj) GetInfo(obj, i, name, role); wxString str; - str.Printf("%d) Name = %s; Role = %s", i, name.c_str(), role.c_str()); + str.Printf("%d) Name = %s; Role = %s", i, name, role); str.Pad(indent, ' ', false); Log(str); diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 047736f057..14e1f616bd 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -735,7 +735,7 @@ MyPanel::MyPanel(wxWindow *parent) wxString date; date.Printf("Selected date: %s", - wxDateTime::Today().FormatISODate().c_str()); + wxDateTime::Today().FormatISODate()); m_date = new wxStaticText(this, wxID_ANY, date); m_calendar = DoCreateCalendar(wxDefaultDateTime, wxCAL_SHOW_HOLIDAYS); @@ -761,13 +761,13 @@ void MyPanel::OnCalendar(wxCalendarEvent& event) m_calendar->Mark(event.GetDate().GetDay(), mark); wxLogMessage("Selected (and %smarked) %s from calendar.", - mark ? "" : "un", s_dateLast.FormatISODate().c_str()); + mark ? "" : "un", s_dateLast.FormatISODate()); } void MyPanel::OnCalendarChange(wxCalendarEvent& event) { wxString s; - s.Printf("Selected date: %s", event.GetDate().FormatISODate().c_str()); + s.Printf("Selected date: %s", event.GetDate().FormatISODate()); m_date->SetLabel(s); wxLogStatus(s); @@ -783,7 +783,7 @@ void MyPanel::OnCalMonthChange(wxCalendarEvent& event) void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event) { wxLogMessage("Clicked on %s", - wxDateTime::GetWeekDayName(event.GetWeekDay()).c_str()); + wxDateTime::GetWeekDayName(event.GetWeekDay())); } void MyPanel::OnCalendarWeekClick(wxCalendarEvent& event) diff --git a/samples/combo/combo.cpp b/samples/combo/combo.cpp index 479b30cb7c..c489504194 100644 --- a/samples/combo/combo.cpp +++ b/samples/combo/combo.cpp @@ -944,12 +944,12 @@ void MyFrame::OnComboBoxUpdate( wxCommandEvent& event ) } else if ( event.GetEventType() == wxEVT_TEXT ) { - wxLogDebug("EVT_TEXT(id=%i,string=\"%s\")",event.GetId(),event.GetString().c_str()); + wxLogDebug("EVT_TEXT(id=%i,string=\"%s\")",event.GetId(),event.GetString()); } else if ( event.GetEventType() == wxEVT_TEXT_ENTER ) { wxLogDebug("EVT_TEXT_ENTER(id=%i,string=\"%s\")", - event.GetId(), event.GetString().c_str()); + event.GetId(), event.GetString()); } } @@ -1123,7 +1123,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) "This is the wxWidgets wxComboCtrl and wxOwnerDrawnComboBox sample\n" "running under %s.", wxVERSION_STRING, - wxGetOsDescription().c_str() + wxGetOsDescription() ), "About wxComboCtrl sample", wxOK | wxICON_INFORMATION, diff --git a/samples/config/conftest.cpp b/samples/config/conftest.cpp index 941da4dda8..7b05918175 100644 --- a/samples/config/conftest.cpp +++ b/samples/config/conftest.cpp @@ -210,7 +210,7 @@ MyFrame::MyFrame() wxString s; if ( pConfig->Read("TestValue", &s) ) { - wxLogStatus(this, "TestValue from config is '%s'", s.c_str()); + wxLogStatus(this, "TestValue from config is '%s'", s); } else { diff --git a/samples/debugrpt/debugrpt.cpp b/samples/debugrpt/debugrpt.cpp index ecf09b2aac..730504cab6 100644 --- a/samples/debugrpt/debugrpt.cpp +++ b/samples/debugrpt/debugrpt.cpp @@ -80,7 +80,7 @@ protected: s << '\t' << reply[n] << '\n'; } - wxLogMessage("%s", s.c_str()); + wxLogMessage("%s", s); return true; } @@ -467,7 +467,7 @@ void MyApp::GenerateReport(wxDebugReport::Context ctx) else { wxLogMessage("Report generated in \"%s\".", - report->GetCompressedFileName().c_str()); + report->GetCompressedFileName()); report->Reset(); } } diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 303ff8d9b8..011ca273c9 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -1049,7 +1049,7 @@ void MyFrame::PasswordEntry(wxCommandEvent& WXUNUSED(event)) this); if ( !pwd.empty() ) { - wxMessageBox(wxString::Format("Your password is '%s'", pwd.c_str()), + wxMessageBox(wxString::Format("Your password is '%s'", pwd), "Got password", wxOK | wxICON_INFORMATION, this); } } @@ -1133,7 +1133,7 @@ void MyFrame::MultiChoice(wxCommandEvent& WXUNUSED(event) ) { msg += wxString::Format("\t%u: %u (%s)\n", (unsigned)n, (unsigned)selections[n], - choices[selections[n]].c_str()); + choices[selections[n]]); } } wxLogMessage(msg); @@ -1568,9 +1568,9 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) ) "Path: %s\n" "Name: %s\n" "Custom window: %s", - dialog.GetPath().c_str(), - dialog.GetDirectory().c_str(), - dialog.GetFilename().c_str(), + dialog.GetPath(), + dialog.GetDirectory(), + dialog.GetFilename(), extra ? static_cast(extra)->GetInfo() : wxString("None")); wxMessageDialog dialog2(this, info, "Selected file"); @@ -1637,7 +1637,7 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) ) for ( size_t n = 0; n < count; n++ ) { s.Printf("File %d: %s (%s)\n", - (int)n, paths[n].c_str(), filenames[n].c_str()); + (int)n, paths[n], filenames[n]); msg += s; } @@ -1663,7 +1663,7 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) if (dialog.ShowModal() == wxID_OK) { wxLogMessage("%s, filter %d", - dialog.GetPath().c_str(), dialog.GetFilterIndex()); + dialog.GetPath(), dialog.GetFilterIndex()); } } #endif // wxUSE_FILEDLG @@ -1689,9 +1689,9 @@ void MyFrame::FileOpenGeneric(wxCommandEvent& WXUNUSED(event) ) info.Printf("Full file name: %s\n" "Path: %s\n" "Name: %s", - dialog.GetPath().c_str(), - dialog.GetDirectory().c_str(), - dialog.GetFilename().c_str()); + dialog.GetPath(), + dialog.GetDirectory(), + dialog.GetFilename()); wxMessageDialog dialog2(this, info, "Selected file"); dialog2.ShowModal(); } @@ -1716,7 +1716,7 @@ void MyFrame::FilesOpenGeneric(wxCommandEvent& WXUNUSED(event) ) for ( size_t n = 0; n < count; n++ ) { s.Printf("File %d: %s (%s)\n", - (int)n, paths[n].c_str(), filenames[n].c_str()); + (int)n, paths[n], filenames[n]); msg += s; } @@ -1742,7 +1742,7 @@ void MyFrame::FileSaveGeneric(wxCommandEvent& WXUNUSED(event) ) if (dialog.ShowModal() == wxID_OK) { wxLogMessage("%s, filter %d", - dialog.GetPath().c_str(), dialog.GetFilterIndex()); + dialog.GetPath(), dialog.GetFilterIndex()); } } #endif // USE_FILEDLG_GENERIC @@ -1758,7 +1758,7 @@ void MyFrame::DoDirChoose(int style) if (dialog.ShowModal() == wxID_OK) { - wxLogMessage("Selected path: %s", dialog.GetPath().c_str()); + wxLogMessage("Selected path: %s", dialog.GetPath()); } } @@ -3018,17 +3018,17 @@ void MyFrame::OnFindDialog(wxFindDialogEvent& event) { wxLogMessage("Find %s'%s' (flags: %s)", type == wxEVT_FIND_NEXT ? "next " : "", - event.GetFindString().c_str(), - DecodeFindDialogEventFlags(event.GetFlags()).c_str()); + event.GetFindString(), + DecodeFindDialogEventFlags(event.GetFlags())); } else if ( type == wxEVT_FIND_REPLACE || type == wxEVT_FIND_REPLACE_ALL ) { wxLogMessage("Replace %s'%s' with '%s' (flags: %s)", type == wxEVT_FIND_REPLACE_ALL ? "all " : "", - event.GetFindString().c_str(), - event.GetReplaceString().c_str(), - DecodeFindDialogEventFlags(event.GetFlags()).c_str()); + event.GetFindString(), + event.GetReplaceString(), + DecodeFindDialogEventFlags(event.GetFlags())); } else if ( type == wxEVT_FIND_CLOSE ) { diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 37744f6178..daa78a4a25 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -1523,7 +1523,7 @@ void DnDFrame::OnCopy(wxCommandEvent& WXUNUSED(event)) } else { - wxLogMessage("Text '%s' put on the clipboard", m_strText.c_str()); + wxLogMessage("Text '%s' put on the clipboard", m_strText); } wxTheClipboard->Close(); @@ -1554,7 +1554,7 @@ void DnDFrame::OnPaste(wxCommandEvent& WXUNUSED(event)) else { wxLogMessage("Text '%s' pasted from the clipboard", - text.GetText().c_str()); + text.GetText()); } wxTheClipboard->Close(); diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 4079b4868b..b9da4ce65a 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -2018,7 +2018,7 @@ void MyCanvas::UseGraphicRenderer(wxGraphicsRenderer* renderer) int major, minor, micro; renderer->GetVersion(&major, &minor, µ); wxString str = wxString::Format("Graphics renderer: %s %i.%i.%i", - renderer->GetName().c_str(), major, minor, micro); + renderer->GetName(), major, minor, micro); m_owner->SetStatusText(str, 1); } else diff --git a/samples/exec/exec.cpp b/samples/exec/exec.cpp index b88e3ff441..ae5ed8f8ed 100644 --- a/samples/exec/exec.cpp +++ b/samples/exec/exec.cpp @@ -854,13 +854,13 @@ void MyFrame::DoAsyncExec(const wxString& cmd) m_pidLast = wxExecute(cmd, wxEXEC_ASYNC | GetExecFlags(), process); if ( !m_pidLast ) { - wxLogError("Execution of '%s' failed.", cmd.c_str()); + wxLogError("Execution of '%s' failed.", cmd); delete process; } else { - wxLogStatus("Process %ld (%s) launched.", m_pidLast, cmd.c_str()); + wxLogStatus("Process %ld (%s) launched.", m_pidLast, cmd); m_cmdLast = cmd; @@ -877,12 +877,12 @@ void MyFrame::OnSyncExec(wxCommandEvent& WXUNUSED(event)) if ( !QueryExec(cmd, env) ) return; - wxLogStatus( "'%s' is running please wait...", cmd.c_str() ); + wxLogStatus( "'%s' is running please wait...", cmd ); int code = wxExecute(cmd, wxEXEC_SYNC | GetExecFlags(), NULL, &env); wxLogStatus("Process '%s' terminated with exit code %d.", - cmd.c_str(), code); + cmd, code); m_cmdLast = cmd; } @@ -910,7 +910,7 @@ void MyFrame::OnShell(wxCommandEvent& WXUNUSED(event)) int code = wxShell(cmd); wxLogStatus("Shell command '%s' terminated with exit code %d.", - cmd.c_str(), code); + cmd, code); m_cmdLast = cmd; } @@ -969,7 +969,7 @@ void MyFrame::OnExecWithRedirect(wxCommandEvent& WXUNUSED(event)) MyPipedProcess *process = new MyPipedProcess(this, cmd); if ( !wxExecute(cmd, wxEXEC_ASYNC, process) ) { - wxLogError("Execution of '%s' failed.", cmd.c_str()); + wxLogError("Execution of '%s' failed.", cmd); delete process; } @@ -1004,13 +1004,13 @@ void MyFrame::OnExecWithPipe(wxCommandEvent& WXUNUSED(event)) long pid = wxExecute(cmd, wxEXEC_ASYNC, process); if ( pid ) { - wxLogStatus("Process %ld (%s) launched.", pid, cmd.c_str()); + wxLogStatus("Process %ld (%s) launched.", pid, cmd); AddPipedProcess(process); } else { - wxLogError("Execution of '%s' failed.", cmd.c_str()); + wxLogError("Execution of '%s' failed.", cmd); delete process; } @@ -1083,7 +1083,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event)) if ( !ft ) { wxLogError("Impossible to determine the file type for extension '%s'", - ext.c_str()); + ext); return; } @@ -1101,7 +1101,7 @@ void MyFrame::OnFileExec(wxCommandEvent& WXUNUSED(event)) if ( !ok ) { wxLogError("Impossible to find out how to open files of extension '%s'", - ext.c_str()); + ext); return; } @@ -1173,7 +1173,7 @@ void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event)) if ( !wxLaunchDefaultBrowser(s_url) ) { - wxLogError("Failed to open URL \"%s\"", s_url.c_str()); + wxLogError("Failed to open URL \"%s\"", s_url); } } @@ -1217,14 +1217,14 @@ void MyFrame::OnDDEExec(wxCommandEvent& WXUNUSED(event)) if ( !conn ) { wxLogError("Failed to connect to the DDE server '%s'.", - m_server.c_str()); + m_server); } else { if ( !conn->Execute(m_cmdDde) ) { wxLogError("Failed to execute command '%s' via DDE.", - m_cmdDde.c_str()); + m_cmdDde); } else { @@ -1243,14 +1243,14 @@ void MyFrame::OnDDERequest(wxCommandEvent& WXUNUSED(event)) if ( !conn ) { wxLogError("Failed to connect to the DDE server '%s'.", - m_server.c_str()); + m_server); } else { if ( !conn->Request(m_cmdDde) ) { wxLogError("Failed to send request '%s' via DDE.", - m_cmdDde.c_str()); + m_cmdDde); } else { @@ -1336,7 +1336,7 @@ void MyFrame::ShowOutput(const wxString& cmd, return; m_lbox->Append(wxString::Format("--- %s of '%s' ---", - title.c_str(), cmd.c_str())); + title, cmd)); for ( size_t n = 0; n < count; n++ ) { @@ -1344,7 +1344,7 @@ void MyFrame::ShowOutput(const wxString& cmd, } m_lbox->Append(wxString::Format("--- End of %s ---", - title.Lower().c_str())); + title.Lower())); } // ---------------------------------------------------------------------------- @@ -1354,7 +1354,7 @@ void MyFrame::ShowOutput(const wxString& cmd, void MyProcess::OnTerminate(int pid, int status) { wxLogStatus(m_parent, "Process %u ('%s') terminated with exit code %d.", - pid, m_cmd.c_str(), status); + pid, m_cmd, status); m_parent->OnAsyncTermination(this); } diff --git a/samples/font/font.cpp b/samples/font/font.cpp index a73720f811..56fe9829c6 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -582,7 +582,7 @@ protected: { wxString text; text.Printf("Encoding %u: %s (available in facename '%s')\n", - (unsigned int) ++m_n, encoding.c_str(), facename.c_str()); + (unsigned int) ++m_n, encoding, facename); m_text += text; return true; } @@ -599,7 +599,7 @@ void MyFrame::OnEnumerateEncodings(wxCommandEvent& WXUNUSED(event)) fontEnumerator.EnumerateEncodings(); wxLogMessage("Enumerating all available encodings:\n%s", - fontEnumerator.GetText().c_str()); + fontEnumerator.GetText()); } // ------------------------------------------------------------- @@ -714,7 +714,7 @@ void MyFrame::OnSetNativeDesc(wxCommandEvent& WXUNUSED(event)) if ( !font.IsOk() ) { wxLogError("Font info string \"%s\" is invalid.", - fontInfo.c_str()); + fontInfo); return; } @@ -1103,7 +1103,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) if ( !charset ) { wxLogError("The file '%s' doesn't contain charset information.", - filename.c_str()); + filename); return; } @@ -1112,7 +1112,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) wxFontEncoding fontenc = wxFontMapper::Get()->CharsetToEncoding(charset); if ( fontenc == wxFONTENCODING_SYSTEM ) { - wxLogError("Charset '%s' is unsupported.", charset.c_str()); + wxLogError("Charset '%s' is unsupported.", charset); return; } @@ -1135,13 +1135,13 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) else { wxLogWarning("Cannot convert from '%s' to '%s'.", - wxFontMapper::GetEncodingDescription(fontenc).c_str(), - wxFontMapper::GetEncodingDescription(encAlt).c_str()); + wxFontMapper::GetEncodingDescription(fontenc), + wxFontMapper::GetEncodingDescription(encAlt)); } } else wxLogWarning("No fonts for encoding '%s' on this system.", - wxFontMapper::GetEncodingDescription(fontenc).c_str()); + wxFontMapper::GetEncodingDescription(fontenc)); } // and now create the correct font @@ -1155,7 +1155,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) else { wxLogWarning("No fonts for encoding '%s' on this system.", - wxFontMapper::GetEncodingDescription(fontenc).c_str()); + wxFontMapper::GetEncodingDescription(fontenc)); } } #endif // wxUSE_FILEDLG diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 1e6c8087ca..38da7193b9 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -1275,7 +1275,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) logBuf << " (shift down)"; if ( ev.ControlDown() ) logBuf << " (control down)"; - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( "%s", logBuf ); // you must call event skip if you want default grid processing // @@ -1349,7 +1349,7 @@ void GridFrame::OnSelectCell( wxGridEvent& ev ) if ( ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ) != ev.GetCol() ) logBuf << " *** Column moved, current position: " << ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ); - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( "%s", logBuf ); // you must call Skip() if you want the default processing // to occur in wxGrid @@ -1371,7 +1371,7 @@ void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev ) << ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F') << ", AltDown: "<< (ev.AltDown() ? 'T':'F') << ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )"; - wxLogMessage( "%s", logBuf.c_str() ); + wxLogMessage( "%s", logBuf ); ev.Skip(); } @@ -1742,7 +1742,7 @@ void BugsGridTable::SetValue( int row, int col, const wxString& value ) if ( n == WXSIZEOF(severities) ) { wxLogWarning("Invalid severity value '%s'.", - value.c_str()); + value); gd.severity = Sev_Normal; } } diff --git a/samples/htlbox/htlbox.cpp b/samples/htlbox/htlbox.cpp index 26c3f73545..7df8069439 100644 --- a/samples/htlbox/htlbox.cpp +++ b/samples/htlbox/htlbox.cpp @@ -348,7 +348,7 @@ void MyFrame::CreateBox() "Item %lu" "", level, - clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(), + clr.GetAsString(wxC2S_HTML_SYNTAX), (unsigned long)n, level); arr.Add(label); } @@ -489,7 +489,7 @@ void MyFrame::OnClear(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event) { - wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref().c_str()); + wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref()); if (GetMyBox()) { @@ -541,7 +541,7 @@ void MyFrame::OnLboxSelect(wxCommandEvent& event) if ( !s.empty() ) { - wxLogMessage("Selected items: %s", s.c_str()); + wxLogMessage("Selected items: %s", s); } } @@ -621,7 +621,7 @@ wxString MyHtmlListBox::OnGetItem(size_t n) const "Item %lu" "", level, - clr.GetAsString(wxC2S_HTML_SYNTAX).c_str(), + clr.GetAsString(wxC2S_HTML_SYNTAX), (unsigned long)n, level); if ( n == 1 ) { diff --git a/samples/html/test/test.cpp b/samples/html/test/test.cpp index bff7d31dd7..33db2207d1 100644 --- a/samples/html/test/test.cpp +++ b/samples/html/test/test.cpp @@ -347,7 +347,7 @@ void MyFrame::OnDrawCustomBg(wxCommandEvent& event) void MyFrame::OnHtmlLinkClicked(wxHtmlLinkEvent &event) { - wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref().c_str()); + wxLogMessage("The url '%s' has been clicked!", event.GetLinkInfo().GetHref()); // skipping this event the default behaviour (load the clicked URL) // will happen... @@ -398,7 +398,7 @@ void MyHtmlWindow::OnClipboardEvent(wxClipboardTextEvent& WXUNUSED(event)) const size_t maxTextLength = 100; wxLogStatus(wxString::Format("Clipboard: '%s%s'", - wxString(text, maxTextLength).c_str(), + wxString(text, maxTextLength), (text.length() > maxTextLength) ? "..." : "")); wxTheClipboard->Close(); diff --git a/samples/image/image.cpp b/samples/image/image.cpp index ec4823385e..949619960e 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -752,7 +752,7 @@ wxString MyFrame::LoadUserImage(wxImage& image) { if ( !image.LoadFile(filename) ) { - wxLogError("Couldn't load image from '%s'.", filename.c_str()); + wxLogError("Couldn't load image from '%s'.", filename); return wxEmptyString; } @@ -962,7 +962,7 @@ void MyFrame::OnThumbnail( wxCommandEvent &WXUNUSED(event) ) wxStopWatch sw; if ( !image.LoadFile(filename) ) { - wxLogError("Couldn't load image from '%s'.", filename.c_str()); + wxLogError("Couldn't load image from '%s'.", filename); return; } diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 241be9d26d..44dd60862f 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -361,7 +361,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) wxString canname = m_locale.GetCanonicalName(); localeInfo.Printf(_("Language: %s\nSystem locale name: %s\nCanonical locale name: %s\n"), - locale.c_str(), sysname.c_str(), canname.c_str() ); + locale, sysname, canname ); wxMessageDialog dlg( this, @@ -445,17 +445,17 @@ void MyFrame::OnTestLocaleAvail(wxCommandEvent& WXUNUSED(event)) const wxLanguageInfo * const info = wxLocale::FindLanguageInfo(s_locale); if ( !info ) { - wxLogError(_("Locale \"%s\" is unknown."), s_locale.c_str()); + wxLogError(_("Locale \"%s\" is unknown."), s_locale); return; } if ( wxLocale::IsAvailable(info->Language) ) { - wxLogMessage(_("Locale \"%s\" is available."), s_locale.c_str()); + wxLogMessage(_("Locale \"%s\" is available."), s_locale); } else { - wxLogWarning(_("Locale \"%s\" is not available."), s_locale.c_str()); + wxLogWarning(_("Locale \"%s\" is not available."), s_locale); } } diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index 2c14651761..3ce598f487 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -252,7 +252,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event)) bool retval = m_client->Connect(hostname, servername, topic); wxLogMessage("Client host=\"%s\" port=\"%s\" topic=\"%s\" %s", - hostname.c_str(), servername.c_str(), topic.c_str(), + hostname, servername, topic, retval ? "connected" : "failed to connect"); if (!retval) diff --git a/samples/ipc/connection.h b/samples/ipc/connection.h index 81ff6e7b12..2a59e21edb 100644 --- a/samples/ipc/connection.h +++ b/samples/ipc/connection.h @@ -24,13 +24,13 @@ protected: { wxString s; if (topic.IsEmpty() && item.IsEmpty()) - s.Printf("%s(", command.c_str()); + s.Printf("%s(", command); else if (topic.IsEmpty()) - s.Printf("%s(item=\"%s\",", command.c_str(), item.c_str()); + s.Printf("%s(item=\"%s\",", command, item); else if (item.IsEmpty()) - s.Printf("%s(topic=\"%s\",", command.c_str(), topic.c_str()); + s.Printf("%s(topic=\"%s\",", command, topic); else - s.Printf("%s(topic=\"%s\",item=\"%s\",", command.c_str(), topic.c_str(), item.c_str()); + s.Printf("%s(topic=\"%s\",item=\"%s\",", command, topic, item); switch (format) { diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 1a79c121c2..dd62713eec 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -88,7 +88,7 @@ bool MyApp::OnInit() #if wxUSE_STATUSBAR frame->CreateStatusBar(); - frame->SetStatusText(wxString::Format("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]", stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks())); + frame->SetStatusText(wxString::Format("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]", stick.GetProductName(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks())); #endif // wxUSE_STATUSBAR frame->CenterOnScreen(); diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index a0d2f287a9..a8d38f6520 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -724,7 +724,7 @@ void MyFrame::OnShowSelInfo(wxCommandEvent& WXUNUSED(event)) while ( item != -1 ) { wxLogMessage("\t%ld (%s)", - item, m_listCtrl->GetItemText(item).c_str()); + item, m_listCtrl->GetItemText(item)); if ( ++shownCount > 10 ) { @@ -1119,7 +1119,7 @@ void MyListCtrl::OnBeginRDrag(wxListEvent& event) void MyListCtrl::OnBeginLabelEdit(wxListEvent& event) { - wxLogMessage( "OnBeginLabelEdit: %s", event.m_item.m_text.c_str()); + wxLogMessage( "OnBeginLabelEdit: %s", event.m_item.m_text); wxTextCtrl * const text = GetEditControl(); if ( !text ) @@ -1139,7 +1139,7 @@ void MyListCtrl::OnEndLabelEdit(wxListEvent& event) event.IsEditCancelled() ? wxString("[cancelled]") : event.m_item.m_text - ).c_str() + ) ); } @@ -1167,7 +1167,7 @@ void MyListCtrl::OnSelected(wxListEvent& event) if ( GetItem(info) ) { wxLogMessage("Value of the 2nd field of the selected item: %s", - info.m_text.c_str()); + info.m_text); } else { @@ -1397,7 +1397,7 @@ void MyListCtrl::OnRightClick(wxMouseEvent& event) } wxLogMessage("Right double click %s item %ld, subitem %ld", - where.c_str(), item, subitem); + where, item, subitem); } void MyListCtrl::LogEvent(const wxListEvent& event, const wxString& eventName) diff --git a/samples/mediaplayer/mediaplayer.cpp b/samples/mediaplayer/mediaplayer.cpp index 3beb0e5c94..9774adbe29 100644 --- a/samples/mediaplayer/mediaplayer.cpp +++ b/samples/mediaplayer/mediaplayer.cpp @@ -1438,8 +1438,8 @@ void wxMediaPlayerTimer::Notify() "State:%s Loops:%i D/T:[%i]/[%i] V:%i%%", videoSize.x, videoSize.y, - sPosition.c_str(), - sDuration.c_str(), + sPosition, + sDuration, currentMediaCtrl->GetPlaybackRate(), wxGetMediaStateText(currentpage->m_mediactrl->GetState()), currentpage->m_nLoops, diff --git a/samples/menu/menu.cpp b/samples/menu/menu.cpp index ae44dae5bc..2302bbbf88 100644 --- a/samples/menu/menu.cpp +++ b/samples/menu/menu.cpp @@ -850,7 +850,7 @@ void MyFrame::OnGetLabelMenu(wxCommandEvent& WXUNUSED(event)) wxCHECK_RET( count, "no last menu?" ); wxLogMessage("The label of the last menu item is '%s'", - mbar->GetMenuLabel(count - 1).c_str()); + mbar->GetMenuLabel(count - 1)); } #if wxUSE_TEXTDLG @@ -896,11 +896,11 @@ void MyFrame::OnFindMenu(wxCommandEvent& WXUNUSED(event)) if (index == wxNOT_FOUND) { - wxLogWarning("No menu with label '%s'", label.c_str()); + wxLogWarning("No menu with label '%s'", label); } else { - wxLogMessage("Menu %d has label '%s'", index, label.c_str()); + wxLogMessage("Menu %d has label '%s'", index, label); } } } @@ -1016,7 +1016,7 @@ void MyFrame::OnGetLabelMenuItem(wxCommandEvent& WXUNUSED(event)) { wxString label = item->GetItemLabel(); wxLogMessage("The label of the last menu item is '%s'", - label.c_str()); + label); } } @@ -1146,12 +1146,12 @@ void MyFrame::OnFindMenuItem(wxCommandEvent& WXUNUSED(event)) } if (index == wxNOT_FOUND) { - wxLogWarning("No menu item with label '%s'", label.c_str()); + wxLogWarning("No menu item with label '%s'", label); } else { wxLogMessage("Menu item %d in menu %lu has label '%s'", - index, (unsigned long)menuindex, label.c_str()); + index, (unsigned long)menuindex, label); } } } @@ -1252,7 +1252,7 @@ void MyFrame::LogMenuOpenCloseOrHighlight(const wxMenuEvent& event, const wxStri msg << "."; - wxLogStatus(this, msg.c_str()); + wxLogStatus(this, msg); } #endif diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 6fcf42912b..8ccfe60d9e 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -686,7 +686,7 @@ void MyFrame::OnHitTest(wxCommandEvent& WXUNUSED(event)) pt.x, pt.y, pagePos, - flagsStr.c_str()); + flagsStr); } void MyFrame::OnType(wxCommandEvent& event) @@ -960,7 +960,7 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) selection << nSel; wxString title; - title.Printf("Notebook and friends (%d pages, selection: %s)", nPages, selection.c_str()); + title.Printf("Notebook and friends (%d pages, selection: %s)", nPages, selection); SetTitle(title); } @@ -1073,13 +1073,13 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event) wxLogMessage("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s", ++s_num, - nameControl.c_str(), - nameEvent.c_str(), + nameControl, + nameEvent, eventType, event.GetSelection(), event.GetOldSelection(), book->GetSelection(), - veto.c_str()); + veto); #if USE_LOG m_text->SetInsertionPointEnd(); diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index e5e40fcb23..46e02d055c 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -198,7 +198,7 @@ void TestGLCanvas::LoadSurface(const wxString& filename) new wxZlibInputStream(new wxFFileInputStream(filename)); if (!stream || !stream->IsOk()) { - wxLogError("Cannot load '%s' type of files!", filename.c_str()); + wxLogError("Cannot load '%s' type of files!", filename); delete stream; return; } @@ -226,7 +226,7 @@ void TestGLCanvas::LoadSurface(const wxString& filename) delete stream; wxLogMessage("Loaded %d vertices, %d triangles from '%s'", - m_numverts, m_numverts-2, filename.c_str()); + m_numverts, m_numverts-2, filename); // NOTE: for some reason under wxGTK the following is required to avoid that // the surface gets rendered in a small rectangle in the top-left corner of the frame diff --git a/samples/power/power.cpp b/samples/power/power.cpp index d6c66c701e..6c0f6454f0 100644 --- a/samples/power/power.cpp +++ b/samples/power/power.cpp @@ -179,8 +179,8 @@ private: SetStatusText(wxString::Format( "System is on %s power, battery state is %s", - powerStr.c_str(), - batteryStr.c_str())); + powerStr, + batteryStr)); } void OnStartTaskClicked( wxCommandEvent& WXUNUSED(event) ) diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 6f35b6147a..d323873cf1 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -188,7 +188,7 @@ public: if ( val.find(m_invalidWord) == wxString::npos ) return true; - ::wxMessageBox(wxString::Format("%s is not allowed word",m_invalidWord.c_str()), + ::wxMessageBox(wxString::Format("%s is not allowed word",m_invalidWord), "Validation Failure"); return false; @@ -650,7 +650,7 @@ void FormMain::OnPropertyGridChanging( wxPropertyGridEvent& event ) { int res = wxMessageBox(wxString::Format("'%s' is about to change (to variant of type '%s')\n\nAllow or deny?", - p->GetName().c_str(),event.GetValue().GetType().c_str()), + p->GetName(),event.GetValue().GetType()), "Testing wxEVT_PG_CHANGING", wxYES_NO, m_pPropGridManager); if ( res == wxNO ) @@ -787,7 +787,7 @@ void FormMain::OnPropertyGridPageChange( wxPropertyGridEvent& WXUNUSED(event) ) void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event ) { wxLogMessage("wxPG_EVT_LABEL_EDIT_BEGIN(%s)", - event.GetProperty()->GetLabel().c_str()); + event.GetProperty()->GetLabel()); } // ----------------------------------------------------------------------- @@ -795,7 +795,7 @@ void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event ) void FormMain::OnPropertyGridLabelEditEnding( wxPropertyGridEvent& event ) { wxLogMessage("wxPG_EVT_LABEL_EDIT_ENDING(%s)", - event.GetProperty()->GetLabel().c_str()); + event.GetProperty()->GetLabel()); } // ----------------------------------------------------------------------- @@ -1784,7 +1784,7 @@ void wxMyPropertyGridPage::OnPropertySelect( wxPropertyGridEvent& event ) wxPGProperty* p = event.GetProperty(); wxUnusedVar(p); wxLogDebug("wxMyPropertyGridPage::OnPropertySelect('%s' is %s", - p->GetName().c_str(), + p->GetName(), IsPropertySelected(p)? "selected": "unselected"); } @@ -1792,16 +1792,16 @@ void wxMyPropertyGridPage::OnPropertyChange( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); wxLogVerbose("wxMyPropertyGridPage::OnPropertyChange('%s', to value '%s')", - p->GetName().c_str(), - p->GetDisplayedString().c_str()); + p->GetName(), + p->GetDisplayedString()); } void wxMyPropertyGridPage::OnPropertyChanging( wxPropertyGridEvent& event ) { wxPGProperty* p = event.GetProperty(); wxLogVerbose("wxMyPropertyGridPage::OnPropertyChanging('%s', to value '%s')", - p->GetName().c_str(), - event.GetValue().GetString().c_str()); + p->GetName(), + event.GetValue().GetString()); } void wxMyPropertyGridPage::OnPageChange( wxPropertyGridEvent& WXUNUSED(event) ) @@ -2186,7 +2186,7 @@ void GenerateUniquePropertyLabel( wxPropertyGridManager* pg, wxString& baselabel for (;;) { count++; - newlabel.Printf("%s%i",baselabel.c_str(),count); + newlabel.Printf("%s%i",baselabel,count); if ( !pg->GetPropertyByLabel( newlabel ) ) break; } } @@ -2359,8 +2359,8 @@ int IterateMessage( wxPGProperty* prop ) { wxString s; - s.Printf( "\"%s\" class = %s, valuetype = %s", prop->GetLabel().c_str(), - prop->GetClassInfo()->GetClassName(), prop->GetValueType().c_str() ); + s.Printf( "\"%s\" class = %s, valuetype = %s", prop->GetLabel(), + prop->GetClassInfo()->GetClassName(), prop->GetValueType() ); return wxMessageBox( s, "Iterating... (press CANCEL to end)", wxOK|wxCANCEL ); } @@ -2595,7 +2595,7 @@ void FormMain::OnRemovePage( wxCommandEvent& WXUNUSED(event) ) void FormMain::OnSaveState( wxCommandEvent& WXUNUSED(event) ) { m_savedState = m_pPropGridManager->SaveEditableState(); - wxLogDebug("Saved editable state string: \"%s\"", m_savedState.c_str()); + wxLogDebug("Saved editable state string: \"%s\"", m_savedState); } // ----------------------------------------------------------------------- diff --git a/samples/propgrid/propgrid_minimal.cpp b/samples/propgrid/propgrid_minimal.cpp index a1328443b7..ee9bbafe97 100644 --- a/samples/propgrid/propgrid_minimal.cpp +++ b/samples/propgrid/propgrid_minimal.cpp @@ -65,7 +65,7 @@ void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event) if ( p ) { wxLogVerbose("OnPropertyGridChange(%s, value=%s)", - p->GetName().c_str(), p->GetValueAsString().c_str()); + p->GetName(), p->GetValueAsString()); } else { @@ -77,7 +77,7 @@ void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent &event) { wxPGProperty* p = event.GetProperty(); - wxLogVerbose("OnPropertyGridChanging(%s)", p->GetName().c_str()); + wxLogVerbose("OnPropertyGridChanging(%s)", p->GetName()); } void MyFrame::OnAction(wxCommandEvent &) diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index d5a02aca99..1a9516b332 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -147,14 +147,14 @@ void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) wxVariant& a = v[n]; t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n",(int)n, - a.GetName().c_str(),a.GetType().c_str(),a.GetString().c_str()); + a.GetName(),a.GetType(),a.GetString()); text += t; } } else { t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n",(int)i, - v.GetName().c_str(),v.GetType().c_str(),strValue.c_str()); + v.GetName(),v.GetType(),strValue); text += t; } } @@ -207,7 +207,7 @@ public: int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings; if ( warningsOccurred ) { - wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name.c_str()); + wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name); m_errorMessages->push_back(s); Msg(s); } @@ -258,7 +258,7 @@ protected: wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \ errorMessages.push_back(s1); \ wxLogDebug(s1); \ - wxString s2 = wxString::Format("Message: %s",MSG.c_str()); \ + wxString s2 = wxString::Format("Message: %s",MSG); \ errorMessages.push_back(s2); \ wxLogDebug(s2); \ failures++; \ @@ -270,7 +270,7 @@ protected: unsigned int h2_ = PROPS->GetActualVirtualHeight(); \ if ( h1_ != h2_ ) \ { \ - wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT.c_str()); \ + wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT); \ RT_FAILURE_MSG(s_); \ _failed_ = true; \ } \ @@ -382,9 +382,9 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel())) else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel())) count++; } @@ -397,7 +397,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( !p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel())) count++; } @@ -410,7 +410,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel())) count++; } @@ -423,9 +423,9 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) { wxPGProperty* p = it.GetProperty(); if ( (p->GetParent() != p->GetParentState()->DoGetRoot() && !p->GetParent()->IsExpanded()) ) - RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel())) else if ( p->HasFlag(wxPG_PROP_HIDDEN) ) - RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel().c_str())) + RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel())) count++; } @@ -476,7 +476,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 ) { wxPGProperty* p = (wxPGProperty*)*it2; - RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel().c_str(),p->GetName().c_str())); + RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel(),p->GetName())); pgman->DeleteProperty(p); } @@ -581,7 +581,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxVariant& v = values[j]; t.Printf("%i: name=\"%s\" type=\"%s\"\n",(int)j, - v.GetName().c_str(),v.GetType().c_str()); + v.GetName(),v.GetType()); text += t; } @@ -756,22 +756,22 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" ) { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Model=%s", pgman->GetPropertyValueAsString("Car.Model").c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Model=%s", pgman->GetPropertyValueAsString("Car.Model"))); } if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 ) { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString("Car.Speeds.Max. Speed (mph)").c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString("Car.Speeds.Max. Speed (mph)"))); } if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 ) { - RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")).c_str())); + RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")))); } if ( !pgman->GetPropertyValueAsBool("Car.Convertible") ) { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString("Car.Convertible").c_str())); + RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString("Car.Convertible"))); } // SetPropertyValueString for special cases such as wxColour @@ -977,10 +977,10 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxString s; if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) != - wxString::Format("123%s12", sep.c_str()) ) + wxString::Format("123%s12", sep) ) RT_FAILURE(); if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) != - wxString::Format("-123%s1230", sep.c_str()) ) + wxString::Format("-123%s1230", sep) ) RT_FAILURE(); if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) != wxString::Format("0%s0", sep) ) @@ -1039,7 +1039,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) page->Collapse( p ); - t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p).c_str()); + t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p)); ed->AppendText(t); } } @@ -1080,7 +1080,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) page->Expand( p ); - t.Printf("Expand: %s\n",page->GetPropertyLabel(p).c_str()); + t.Printf("Expand: %s\n",page->GetPropertyLabel(p)); ed->AppendText(t); } } @@ -1305,7 +1305,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1321,7 +1321,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1339,7 +1339,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1355,7 +1355,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1374,7 +1374,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr1[i]; page->HideProperty(p, true); - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1390,7 +1390,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) wxPGProperty* p = arr2[i]; page->HideProperty(p, false); - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel().c_str()); + wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); RT_VALIDATE_VIRTUAL_HEIGHT(page, s) if ( _failed_ ) break; @@ -1478,37 +1478,37 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) !p->HasFlag(wxPG_PROP_COLLAPSED) ) { RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'COLLAPSED' for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( flags.Find("COLLAPSED") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_COLLAPSED) ) { RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'COLLAPSED'for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( flags.Find("DISABLED") != wxNOT_FOUND && !p->HasFlag(wxPG_PROP_DISABLED) ) { RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'DISABLED' for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( flags.Find("DISABLED") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_DISABLED) ) { RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'DISABLED' for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( flags.Find("HIDDEN") != wxNOT_FOUND && !p->HasFlag(wxPG_PROP_HIDDEN) ) { RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'HIDDEN' for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( flags.Find("HIDDEN") == wxNOT_FOUND && p->HasFlag(wxPG_PROP_HIDDEN) ) { RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'HIDDEN' for property '%s'", - p->GetName().c_str())); + p->GetName())); } // Get individual flags @@ -1526,7 +1526,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } flags = p->GetFlagsAsString(wxPG_PROP_DISABLED); @@ -1541,7 +1541,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISABLED flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } flags = p->GetFlagsAsString(wxPG_PROP_HIDDEN); @@ -1556,7 +1556,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } flags = p->GetFlagsAsString(wxPG_PROP_NOEDITOR); @@ -1571,7 +1571,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } // Get all flags @@ -1587,7 +1587,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( p->HasFlag(wxPG_PROP_DISABLED) ) @@ -1601,7 +1601,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISBALED flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( p->HasFlag(wxPG_PROP_HIDDEN) ) @@ -1615,7 +1615,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) @@ -1629,7 +1629,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) if ( !ok ) { RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", - p->GetName().c_str())); + p->GetName())); } // Restore original flags diff --git a/samples/regtest/regtest.cpp b/samples/regtest/regtest.cpp index 88320d39e5..b97f627625 100644 --- a/samples/regtest/regtest.cpp +++ b/samples/regtest/regtest.cpp @@ -845,7 +845,7 @@ void RegTreeCtrl::OnEndEdit(wxTreeEvent& event) if ( !ok ) { wxLogError("Failed to rename '%s' to '%s'.", - m_nameOld.c_str(), name.c_str()); + m_nameOld, name); } #if 0 // MSW tree ctrl doesn't like this at all, it hangs else @@ -920,10 +920,10 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event) if ( wxMessageBox(wxString::Format ( "Do you really want to %s the %s %s to %s?", - verb.c_str(), - what.c_str(), - nameSrc.c_str(), - nameDst.c_str() + verb, + what, + nameSrc, + nameDst ), "RegTest Confirm", wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) { @@ -938,7 +938,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event) ok = keyDst.Create(false); if ( !ok ) { - wxLogError("Key '%s' already exists", keyDst.GetName().c_str()); + wxLogError("Key '%s' already exists", keyDst.GetName()); } else { @@ -969,7 +969,7 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event) if ( !ok ) { wxLogError("Failed to %s registry %s.", - verb.c_str(), what.c_str()); + verb, what); } else { @@ -1255,7 +1255,7 @@ void RegTreeCtrl::GoTo(const wxString& location) if ( !id.IsOk() ) { - wxLogError("No such key '%s'.", location.c_str()); + wxLogError("No such key '%s'.", location); return; } @@ -1291,7 +1291,7 @@ void RegTreeCtrl::DeleteSelected() if ( wxMessageBox(wxString::Format ( "Do you really want to delete this %s?", - what.c_str() + what ), "Confirmation", wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) @@ -1390,7 +1390,7 @@ void RegTreeCtrl::ShowProperties() else { wxLogMessage("Key '%s' has %u subkeys and %u values.", - key.GetName().c_str(), nSubKeys, nValues); + key.GetName(), nSubKeys, nValues); } } else // it's a value @@ -1403,7 +1403,7 @@ void RegTreeCtrl::ShowProperties() wxLogMessage("Value '%s' under the key '%s' is of type " "%d (%s).", value, - parent->m_strName.c_str(), + parent->m_strName, key.GetValueType(value), key.IsNumericValue(value) ? "numeric" : "string"); diff --git a/samples/render/render.cpp b/samples/render/render.cpp index 96d7a2e4d1..158e16d5ba 100644 --- a/samples/render/render.cpp +++ b/samples/render/render.cpp @@ -571,7 +571,7 @@ void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event)) wxRendererNative *renderer = wxRendererNative::Load(name); if ( !renderer ) { - wxLogError("Failed to load renderer \"%s\".", name.c_str()); + wxLogError("Failed to load renderer \"%s\".", name); } else // loaded ok { @@ -580,7 +580,7 @@ void MyFrame::OnLoad(wxCommandEvent& WXUNUSED(event)) m_panel->Refresh(); wxLogStatus(this, "Successfully loaded the renderer \"%s\".", - name.c_str()); + name); } } diff --git a/samples/richtext/richtext.cpp b/samples/richtext/richtext.cpp index 612535b885..aed233df76 100644 --- a/samples/richtext/richtext.cpp +++ b/samples/richtext/richtext.cpp @@ -98,7 +98,7 @@ public: virtual bool EditProperties(wxRichTextField* WXUNUSED(obj), wxWindow* WXUNUSED(parent), wxRichTextBuffer* WXUNUSED(buffer)) wxOVERRIDE { wxString label = GetLabel(); - wxMessageBox(wxString::Format("Editing %s", label.c_str())); + wxMessageBox(wxString::Format("Editing %s", label)); return true; } diff --git a/samples/sockets/baseclient.cpp b/samples/sockets/baseclient.cpp index 14f06efbbc..e389148772 100644 --- a/samples/sockets/baseclient.cpp +++ b/samples/sockets/baseclient.cpp @@ -173,7 +173,7 @@ WX_DEFINE_LIST(EList); wxString CreateIdent(const wxIPV4address& addr) { - return wxString::Format("%s:%d",addr.IPAddress().c_str(),addr.Service()); + return wxString::Format("%s:%d",addr.IPAddress(),addr.Service()); } void @@ -216,11 +216,11 @@ Client::OnCmdLineParsed(wxCmdLineParser& pParser) { wxFFile file(fname); if (!file.IsOpened()) { - wxLogError("Cannot open file %s",fname.c_str()); + wxLogError("Cannot open file %s",fname); return false; }; if (!file.ReadAll(&m_message)) { - wxLogError("Cannot read content of file %s",fname.c_str()); + wxLogError("Cannot read content of file %s",fname); return false; }; m_sendType = SEND_MESSAGE; @@ -496,7 +496,7 @@ Client::dumpStatistics() { m_statFailed )); - wxLogMessage("Current status:\n%s\n",msg.c_str()); + wxLogMessage("Current status:\n%s\n",msg); } void @@ -550,7 +550,7 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { { if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { - wxLogError("%s: read error",CreateIdent(m_localaddr).c_str()); + wxLogError("%s: read error",CreateIdent(m_localaddr)); SendEvent(true); } } @@ -560,18 +560,18 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { if (m_readed == m_insize) { if (!memcmp(m_inbuf,m_outbuf,m_insize)) { - wxLogError("%s: data mismatch",CreateIdent(m_localaddr).c_str()); + wxLogError("%s: data mismatch",CreateIdent(m_localaddr)); SendEvent(true); } m_currentType = WorkerEvent::DISCONNECTING; - wxLogDebug("%s: DISCONNECTING",CreateIdent(m_localaddr).c_str()); + wxLogDebug("%s: DISCONNECTING",CreateIdent(m_localaddr)); SendEvent(false); //wxLogDebug("EventWorker %p closing",this); m_clientSocket->Close(); m_currentType = WorkerEvent::DONE; - wxLogDebug("%s: DONE",CreateIdent(m_localaddr).c_str()); + wxLogDebug("%s: DONE",CreateIdent(m_localaddr)); SendEvent(false); } } while (!m_clientSocket->Error()); @@ -584,13 +584,13 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { if (m_written == 0) { m_currentType = WorkerEvent::SENDING; - wxLogDebug("%s: SENDING",CreateIdent(m_localaddr).c_str()); + wxLogDebug("%s: SENDING",CreateIdent(m_localaddr)); } m_clientSocket->Write(m_outbuf + m_written, m_outsize - m_written); if (m_clientSocket->Error()) { if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { - wxLogError("%s: Write error",CreateIdent(m_localaddr).c_str()); + wxLogError("%s: Write error",CreateIdent(m_localaddr)); SendEvent(true); } } @@ -603,7 +603,7 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { { //wxLogDebug("EventWorker %p SENDING->RECEIVING",this); m_currentType = WorkerEvent::RECEIVING; - wxLogDebug("%s: RECEIVING",CreateIdent(m_localaddr).c_str()); + wxLogDebug("%s: RECEIVING",CreateIdent(m_localaddr)); SendEvent(false); } } while(!m_clientSocket->Error()); @@ -611,19 +611,19 @@ EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { case wxSOCKET_CONNECTION: { //wxLogMessage("EventWorker: got connection"); - wxLogMessage("%s: starting writing message (2 bytes for signature and %d bytes of data to write)",CreateIdent(m_localaddr).c_str(),m_outsize-2); + wxLogMessage("%s: starting writing message (2 bytes for signature and %d bytes of data to write)",CreateIdent(m_localaddr),m_outsize-2); if (!m_clientSocket->GetLocal(m_localaddr)) { wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket); } m_currentType = WorkerEvent::SENDING; - wxLogDebug("%s: CONNECTING",CreateIdent(m_localaddr).c_str()); + wxLogDebug("%s: CONNECTING",CreateIdent(m_localaddr)); SendEvent(false); } break; case wxSOCKET_LOST: { - wxLogError(_("%s: connection lost"),CreateIdent(m_localaddr).c_str()); + wxLogError(_("%s: connection lost"),CreateIdent(m_localaddr)); SendEvent(true); } break; @@ -672,7 +672,7 @@ wxThread::ExitCode ThreadWorker::Entry() bool failed = false; WorkerEvent::evt_type etype = WorkerEvent::CONNECTING; if (!m_clientSocket->Connect(ca)) { - wxLogError("Cannot connect to %s:%d",ca.IPAddress().c_str(), ca.Service()); + wxLogError("Cannot connect to %s:%d",ca.IPAddress(), ca.Service()); failed = true; } else { //wxLogMessage("ThreadWorker: Connected. Sending %d bytes of data",m_outsize); diff --git a/samples/sockets/baseserver.cpp b/samples/sockets/baseserver.cpp index 89b1cdedef..a2969d66ff 100644 --- a/samples/sockets/baseserver.cpp +++ b/samples/sockets/baseserver.cpp @@ -385,7 +385,7 @@ void Server::OnSocketEvent(wxSocketEvent& pEvent) { wxLogError("Server: cannot get peer info"); } else { - wxLogMessage("Got connection from %s:%d",addr.IPAddress().c_str(), addr.Service()); + wxLogMessage("Got connection from %s:%d",addr.IPAddress(), addr.Service()); } bool createThread; diff --git a/samples/taborder/taborder.cpp b/samples/taborder/taborder.cpp index 8bed08368f..0ed2881516 100644 --- a/samples/taborder/taborder.cpp +++ b/samples/taborder/taborder.cpp @@ -254,7 +254,7 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) ) wxString msg; if ( focus ) { - msg.Printf("Focus is at %s", s_windowFocus->GetName().c_str()); + msg.Printf("Focus is at %s", s_windowFocus->GetName()); } else { diff --git a/samples/text/text.cpp b/samples/text/text.cpp index c15ce480d8..a057dbaee4 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -726,7 +726,7 @@ void MyTextCtrl::LogKeyEvent(const wxString& name, wxKeyEvent& event) const wxLogMessage( "%s event: %s (flags = %c%c%c%c)", name, - key.c_str(), + key, GetChar( event.ControlDown(), 'C' ), GetChar( event.AltDown(), 'A' ), GetChar( event.ShiftDown(), 'S' ), @@ -781,7 +781,7 @@ static wxString GetMouseEventDesc(const wxMouseEvent& ev) wxASSERT(!(dbl && up)); return wxString::Format("%s mouse button %s", - button.c_str(), + button, dbl ? "double clicked" : up ? "released" : "clicked"); } @@ -973,8 +973,8 @@ void MyTextCtrl::OnTextURL(wxTextUrlEvent& event) end = event.GetURLEnd(); wxLogMessage("Mouse event over URL '%s': %s", - GetValue().Mid(start, end - start).c_str(), - GetMouseEventDesc(ev).c_str()); + GetValue().Mid(start, end - start), + GetMouseEventDesc(ev)); } void MyTextCtrl::OnChar(wxKeyEvent& event) @@ -1018,12 +1018,12 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event) wxLogMessage("Selection: from %ld to %ld.", from, to); wxLogMessage("Selection = '%s' (len = %u)", - sel.c_str(), + sel, (unsigned int) sel.length()); const wxString text = GetLineText(line); wxLogMessage("Current line: \"%s\"; length = %lu", - text.c_str(), text.length()); + text, text.length()); } break; diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index ac7bc3daad..63ba471f6d 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -853,7 +853,7 @@ void MyFrame::OnToolRightClick(wxCommandEvent& event) void MyFrame::OnCombo(wxCommandEvent& event) { - wxLogStatus("Combobox string '%s' selected", event.GetString().c_str()); + wxLogStatus("Combobox string '%s' selected", event.GetString()); } void MyFrame::DoEnablePrint() diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 230a6da343..24a4186efd 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -588,7 +588,7 @@ void MyFrame::OnDumpSelected(wxCommandEvent& WXUNUSED(event)) for ( size_t n = 0; n < count; n++ ) { - wxLogMessage("\t%s", m_treeCtrl->GetItemText(array.Item(n)).c_str()); + wxLogMessage("\t%s", m_treeCtrl->GetItemText(array.Item(n))); } } @@ -1306,7 +1306,7 @@ void MyTreeCtrl::LogEvent(const wxString& name, const wxTreeEvent& event) text << '"' << GetItemText(item).c_str() << '"'; else text = "invalid item"; - wxLogMessage("%s(%s)", name, text.c_str()); + wxLogMessage("%s(%s)", name, text); } // avoid repetition @@ -1466,7 +1466,7 @@ void LogKeyEvent(const wxString& name, const wxKeyEvent& event) wxLogMessage( "%s event: %s (flags = %c%c%c%c)", name, - key.c_str(), + key, event.ControlDown() ? 'C' : '-', event.AltDown() ? 'A' : '-', event.ShiftDown() ? 'S' : '-', @@ -1491,7 +1491,7 @@ void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) wxPoint screenpt = ClientToScreen(clientpt); wxLogMessage("OnBeginDrag: started dragging %s at screen coords (%i,%i)", - GetItemText(m_draggedItem).c_str(), + GetItemText(m_draggedItem), screenpt.x, screenpt.y); event.Allow(); @@ -1524,7 +1524,7 @@ void MyTreeCtrl::OnEndDrag(wxTreeEvent& event) wxString text = GetItemText(itemSrc); wxLogMessage("OnEndDrag: '%s' copied to '%s'.", - text.c_str(), GetItemText(itemDst).c_str()); + text, GetItemText(itemDst)); // just do append here - we could also insert it just before/after the item // on which it was dropped, but this requires slightly more work... we also @@ -1712,7 +1712,7 @@ void MyTreeItemData::ShowInfo(wxTreeCtrl *tree) { wxLogMessage("Item '%s': %sselected, %sexpanded, %sbold,\n" "%u children (%u immediately under this item).", - m_desc.c_str(), + m_desc, Bool2String(tree->IsSelected(GetId())), Bool2String(tree->IsExpanded(GetId())), Bool2String(tree->IsBold(GetId())), diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 42894c6fcf..d365ed589f 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -158,7 +158,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) std_file_output << f << "\n"; wxString str( "Hello!" ); - tmp.Printf( "String: %s\n", str.c_str() ); + tmp.Printf( "String: %s\n", str ); textCtrl.WriteText( tmp ); text_output << str << "\n"; std_file_output << str.ToAscii() << "\n"; @@ -188,7 +188,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) char std_buf[200]; std_file_input >> std_buf; str = wxString::FromAscii(std_buf); - tmp.Printf( "String: %s\n", str.c_str() ); + tmp.Printf( "String: %s\n", str ); textCtrl.WriteText( tmp ); textCtrl.WriteText( "\nReading from wxFileInputStream:\n" ); @@ -216,7 +216,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( tmp ); text_input >> str; - tmp.Printf( "String: %s\n", str.c_str() ); + tmp.Printf( "String: %s\n", str ); textCtrl.WriteText( tmp ); @@ -244,7 +244,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) data_output.WriteDouble( d ); str = "Hello!"; - tmp.Printf( "String: %s\n", str.c_str() ); + tmp.Printf( "String: %s\n", str ); textCtrl.WriteText( tmp ); data_output.WriteString( str ); @@ -268,7 +268,7 @@ void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( tmp ); str = data_input.ReadString(); - tmp.Printf( "String: %s\n", str.c_str() ); + tmp.Printf( "String: %s\n", str ); textCtrl.WriteText( tmp ); } diff --git a/samples/webview/webview.cpp b/samples/webview/webview.cpp index feec5f02a4..98d0fea071 100644 --- a/samples/webview/webview.cpp +++ b/samples/webview/webview.cpp @@ -769,7 +769,7 @@ void WebFrame::OnFindText(wxCommandEvent& evt) { count++; } - wxLogMessage("Searching for:%s current match:%li/%i", m_findText.c_str(), count, m_findCount); + wxLogMessage("Searching for:%s current match:%li/%i", m_findText, count, m_findCount); } /** diff --git a/samples/widgets/bmpcombobox.cpp b/samples/widgets/bmpcombobox.cpp index 8d33ca70ac..56dd331fd8 100644 --- a/samples/widgets/bmpcombobox.cpp +++ b/samples/widgets/bmpcombobox.cpp @@ -806,11 +806,11 @@ void BitmapComboBoxWidgetsPage::OnComboText(wxCommandEvent& event) if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage("BitmapCombobox enter pressed (now '%s')", s.c_str()); + wxLogMessage("BitmapCombobox enter pressed (now '%s')", s); } else { - wxLogMessage("BitmapCombobox text changed (now '%s')", s.c_str()); + wxLogMessage("BitmapCombobox text changed (now '%s')", s); } } @@ -821,7 +821,7 @@ void BitmapComboBoxWidgetsPage::OnComboBox(wxCommandEvent& event) wxLogMessage("BitmapCombobox item %ld selected", sel); - wxLogMessage("BitmapCombobox GetValue(): %s", m_combobox->GetValue().c_str() ); + wxLogMessage("BitmapCombobox GetValue(): %s", m_combobox->GetValue() ); } void BitmapComboBoxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/widgets/clrpicker.cpp b/samples/widgets/clrpicker.cpp index 132c3b339c..5f166ee61e 100644 --- a/samples/widgets/clrpicker.cpp +++ b/samples/widgets/clrpicker.cpp @@ -218,7 +218,7 @@ void ColourPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void ColourPickerWidgetsPage::OnColourChange(wxColourPickerEvent& event) { wxLogMessage("The colour changed to '%s' !", - event.GetColour().GetAsString(wxC2S_CSS_SYNTAX).c_str()); + event.GetColour().GetAsString(wxC2S_CSS_SYNTAX)); } void ColourPickerWidgetsPage::OnCheckBox(wxCommandEvent &event) diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index f978711047..57c031802b 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -662,11 +662,11 @@ void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event) if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage("Combobox enter pressed (now '%s')", s.c_str()); + wxLogMessage("Combobox enter pressed (now '%s')", s); } else { - wxLogMessage("Combobox text changed (now '%s')", s.c_str()); + wxLogMessage("Combobox text changed (now '%s')", s); } } @@ -685,7 +685,7 @@ void ComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) wxLogMessage("Combobox item %ld selected", sel); - wxLogMessage("Combobox GetValue(): %s", m_combobox->GetValue().c_str() ); + wxLogMessage("Combobox GetValue(): %s", m_combobox->GetValue() ); if ( event.GetString() != m_combobox->GetValue() ) { diff --git a/samples/widgets/dirpicker.cpp b/samples/widgets/dirpicker.cpp index 84f71fc064..b6308b3595 100644 --- a/samples/widgets/dirpicker.cpp +++ b/samples/widgets/dirpicker.cpp @@ -247,7 +247,7 @@ void DirPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void DirPickerWidgetsPage::OnDirChange(wxFileDirPickerEvent& event) { wxLogMessage("The directory changed to '%s' ! The current working directory is '%s'", - event.GetPath().c_str(), wxGetCwd().c_str()); + event.GetPath(), wxGetCwd()); } void DirPickerWidgetsPage::OnCheckBox(wxCommandEvent &event) diff --git a/samples/widgets/filepicker.cpp b/samples/widgets/filepicker.cpp index dfa8e6ba2e..af80f6c2ee 100644 --- a/samples/widgets/filepicker.cpp +++ b/samples/widgets/filepicker.cpp @@ -311,7 +311,7 @@ void FilePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void FilePickerWidgetsPage::OnFileChange(wxFileDirPickerEvent& event) { wxLogMessage("The file changed to '%s' ! The current working directory is '%s'", - event.GetPath().c_str(), wxGetCwd().c_str()); + event.GetPath(), wxGetCwd()); } void FilePickerWidgetsPage::OnCheckBox(wxCommandEvent &event) diff --git a/samples/widgets/fontpicker.cpp b/samples/widgets/fontpicker.cpp index 3039479401..b9a717cf10 100644 --- a/samples/widgets/fontpicker.cpp +++ b/samples/widgets/fontpicker.cpp @@ -219,7 +219,7 @@ void FontPickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void FontPickerWidgetsPage::OnFontChange(wxFontPickerEvent& event) { wxLogMessage("The font changed to '%s' with size %d !", - event.GetFont().GetFaceName().c_str(), event.GetFont().GetPointSize()); + event.GetFont().GetFaceName(), event.GetFont().GetPointSize()); } void FontPickerWidgetsPage::OnCheckBox(wxCommandEvent &event) diff --git a/samples/widgets/itemcontainer.cpp b/samples/widgets/itemcontainer.cpp index d120895aac..86b13f12c7 100644 --- a/samples/widgets/itemcontainer.cpp +++ b/samples/widgets/itemcontainer.cpp @@ -123,7 +123,7 @@ bool ItemContainerWidgetsPage::VerifyAllClientDataDestroyed() void ItemContainerWidgetsPage::StartTest(const wxString& label) { m_container->Clear(); - wxLogMessage("Test - %s:", label.c_str()); + wxLogMessage("Test - %s:", label); } void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) @@ -144,7 +144,7 @@ void ItemContainerWidgetsPage::EndTest(const wxArrayString& items) { wxFAIL_MSG(wxString::Format( "Wrong string \"%s\" at position %d (expected \"%s\")", - str.c_str(), i, items[i].c_str())); + str, i, items[i])); ok = false; break; } @@ -227,7 +227,7 @@ bool ItemContainerWidgetsPage::VerifyClientData(wxUIntPtr i, const wxString& str { if ( i > m_items.GetCount() || m_items[i] != str ) { - wxLogMessage("Client data for '%s' does not match.", str.c_str()); + wxLogMessage("Client data for '%s' does not match.", str); return false; } diff --git a/samples/widgets/odcombobox.cpp b/samples/widgets/odcombobox.cpp index 0b30bf15d8..326bd15826 100644 --- a/samples/widgets/odcombobox.cpp +++ b/samples/widgets/odcombobox.cpp @@ -765,11 +765,11 @@ void ODComboboxWidgetsPage::OnComboText(wxCommandEvent& event) if (event.GetEventType() == wxEVT_TEXT_ENTER) { - wxLogMessage("OwnerDrawnCombobox enter pressed (now '%s')", s.c_str()); + wxLogMessage("OwnerDrawnCombobox enter pressed (now '%s')", s); } else { - wxLogMessage("OwnerDrawnCombobox text changed (now '%s')", s.c_str()); + wxLogMessage("OwnerDrawnCombobox text changed (now '%s')", s); } } @@ -780,7 +780,7 @@ void ODComboboxWidgetsPage::OnComboBox(wxCommandEvent& event) wxLogMessage("OwnerDrawnCombobox item %ld selected", sel); - wxLogMessage("OwnerDrawnCombobox GetValue(): %s", m_combobox->GetValue().c_str() ); + wxLogMessage("OwnerDrawnCombobox GetValue(): %s", m_combobox->GetValue() ); } void ODComboboxWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event) diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 7af9465417..2745422475 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -363,7 +363,7 @@ void RadioWidgetsPage::CreateRadio() for ( size_t n = 0; n < count; n++ ) { items[n] = wxString::Format("%s %lu", - labelBtn.c_str(), (unsigned long)n + 1); + labelBtn, (unsigned long)n + 1); } int flags = m_chkSpecifyRows->GetValue() ? wxRA_SPECIFY_ROWS diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index b86f477fdf..4bda25ffef 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -587,7 +587,7 @@ void SpinBtnWidgetsPage::OnSpinCtrlDouble(wxSpinDoubleEvent& event) void SpinBtnWidgetsPage::OnSpinText(wxCommandEvent& event) { wxLogMessage("Text changed in spin control, now \"%s\"", - event.GetString().c_str()); + event.GetString()); } void SpinBtnWidgetsPage::OnSpinTextEnter(wxCommandEvent& event) diff --git a/samples/widgets/statbmp.cpp b/samples/widgets/statbmp.cpp index c1842beb74..42369aaa4c 100644 --- a/samples/widgets/statbmp.cpp +++ b/samples/widgets/statbmp.cpp @@ -139,7 +139,7 @@ void StatBmpWidgetsPage::RecreateWidget() } else { - wxLogMessage("Reading image from file '%s' failed.", filepath.c_str()); + wxLogMessage("Reading image from file '%s' failed.", filepath); } } diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index 5f53422a58..8bd91ce042 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -317,7 +317,7 @@ private: break; } - wxLogMessage("Mouse is %s (%ld, %ld)", where.c_str(), x, y); + wxLogMessage("Mouse is %s (%ld, %ld)", where, x, y); } }; @@ -941,7 +941,7 @@ void TextWidgetsPage::OnButtonLoad(wxCommandEvent& WXUNUSED(event)) { long elapsed = sw.Time(); wxLogMessage("Loaded file '%s' in %lu.%us", - filename.c_str(), elapsed / 1000, + filename, elapsed / 1000, (unsigned int) elapsed % 1000); } } @@ -1001,7 +1001,7 @@ void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event)) void TextWidgetsPage::OnTextEnter(wxCommandEvent& event) { - wxLogMessage("Text entered: '%s'", event.GetString().c_str()); + wxLogMessage("Text entered: '%s'", event.GetString()); event.Skip(); } diff --git a/samples/xti/codereadercallback.cpp b/samples/xti/codereadercallback.cpp index f48e61c348..9ed6e423f4 100644 --- a/samples/xti/codereadercallback.cpp +++ b/samples/xti/codereadercallback.cpp @@ -98,7 +98,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class wxString objectName = wxString::Format( "LocalObject_%d", objectID ); m_source += ( wxString::Format( "\t%s *%s = new %s;\n", classInfo->GetClassName(), - objectName.c_str(), + objectName, classInfo->GetClassName()) ); m_data->SetObjectName( objectID, objectName ); } @@ -106,7 +106,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo)) { m_source += ( wxString::Format( "\tdelete %s;\n", - m_data->GetObjectName( objectID).c_str() ) ); + m_data->GetObjectName( objectID) ) ); } class WXDLLIMPEXP_BASE wxObjectConstructorWriter: public wxObjectWriterFunctor @@ -150,8 +150,8 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m ) const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type); if ( cti ) { - value.Printf( "%s(%s)", cti->GetTypeName().c_str(), - wxAnyGetAsString(param).c_str() ); + value.Printf( "%s(%s)", cti->GetTypeName(), + wxAnyGetAsString(param) ); } else { @@ -160,7 +160,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m ) } else if ( type->GetKind() == wxT_STRING ) { - value.Printf( "\"%s\"", wxAnyGetAsString(param).c_str() ); + value.Printf( "\"%s\"", wxAnyGetAsString(param) ); } else if ( type->GetKind() == wxT_OBJECT ) { @@ -178,7 +178,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m ) } else { - value.Printf( "%s", wxAnyGetAsString(param).c_str() ); + value.Printf( "%s", wxAnyGetAsString(param) ); } return value; @@ -195,20 +195,20 @@ void wxObjectCodeReaderCallback::CreateObject(int objectID, { int i; m_source += ( wxString::Format( "\t%s->Create(", - m_data->GetObjectName(objectID).c_str() ) ); + m_data->GetObjectName(objectID) ) ); for (i = 0; i < paramCount; i++) { if ( objectIDValues[i] != wxInvalidObjectID ) { wxString str = wxString::Format( "%s", - m_data->GetObjectName( objectIDValues[i] ).c_str() ); + m_data->GetObjectName( objectIDValues[i] ) ); m_source += ( str ); } else { m_source += ( - wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) ); + wxString::Format( "%s", ValueAsCode(params[i]) ) ); } if (i < paramCount - 1) m_source += ( ", "); @@ -228,7 +228,7 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID, wxString objectName = wxString::Format( "LocalObject_%d", objectID ); m_source += ( wxString::Format( "\t%s *%s = new %s(", classInfo->GetClassName(), - objectName.c_str(), + objectName, classInfo->GetClassName()) ); m_data->SetObjectName( objectID, objectName ); @@ -237,11 +237,11 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID, { if ( objectIDValues[i] != wxInvalidObjectID ) m_source += ( wxString::Format( "%s", - m_data->GetObjectName( objectIDValues[i] ).c_str() ) ); + m_data->GetObjectName( objectIDValues[i] ) ) ); else { m_source += ( - wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) ); + wxString::Format( "%s", ValueAsCode(params[i]) ) ); } if (i < paramCount - 1) m_source += ( ", " ); @@ -255,9 +255,9 @@ void wxObjectCodeReaderCallback::SetProperty(int objectID, const wxAny &value) { m_source += ( wxString::Format( "\t%s->%s(%s);\n", - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - ValueAsCode(value).c_str()) ); + m_data->GetObjectName(objectID), + propertyInfo->GetAccessor()->GetSetterName(), + ValueAsCode(value)) ); } void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID, @@ -267,14 +267,14 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID, { if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT ) m_source += ( wxString::Format( "\t%s->%s(*%s);\n", - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - m_data->GetObjectName( valueObjectId).c_str() ) ); + m_data->GetObjectName(objectID), + propertyInfo->GetAccessor()->GetSetterName(), + m_data->GetObjectName( valueObjectId) ) ); else m_source += ( wxString::Format( "\t%s->%s(%s);\n", - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetSetterName().c_str(), - m_data->GetObjectName( valueObjectId).c_str() ) ); + m_data->GetObjectName(objectID), + propertyInfo->GetAccessor()->GetSetterName(), + m_data->GetObjectName( valueObjectId) ) ); } void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID, @@ -283,9 +283,9 @@ void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID, const wxAny &value) { m_source += ( wxString::Format( "\t%s->%s(%s);\n", - m_data->GetObjectName(objectID).c_str(), - propertyInfo->GetAccessor()->GetAdderName().c_str(), - ValueAsCode(value).c_str()) ); + m_data->GetObjectName(objectID), + propertyInfo->GetAccessor()->GetAdderName(), + ValueAsCode(value)) ); } // sets the corresponding property (value is an object) @@ -319,8 +319,8 @@ void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID, wxString::Format( "\t%s->Connect( %s->GetId(), %d, " "(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );", - ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(), - handlerName.c_str(), ehsink.c_str() ); + ehsource, ehsource, eventType, ehsinkClass, + handlerName, ehsink ); m_source += ( code ); } From 26f0e816ca8bd613fbd0c1650e91b7fc47226960 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Thu, 1 Nov 2018 10:07:42 -0400 Subject: [PATCH 216/231] Send wxEVT_AUINOTEBOOK_PAGE_CHANGED after changing the page For consistency with the other similar events and because it is more useful for the code handling it, send this event when the new page is already shown instead of doing it before showing it. Closes https://github.com/wxWidgets/wxWidgets/pull/1007 --- docs/changes.txt | 2 ++ src/aui/auibook.cpp | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 2b3971365f..25d36877e0 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -51,6 +51,8 @@ Changes in behaviour not resulting in compilation errors consistency with the other ports. You now need to call SetMargins(0, 0) explicitly if you really don't want to have any margins in your buttons. +- wxEVT_AUINOTEBOOK_PAGE_CHANGED event is now sent after changing the page, + as expected, and not before doing it. Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index ae8ae603d0..f1298c9997 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -3423,14 +3423,6 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events) int old_curpage = m_curPage; m_curPage = n; - // program allows the page change - if(events) - { - evt.SetEventType(wxEVT_AUINOTEBOOK_PAGE_CHANGED); - (void)GetEventHandler()->ProcessEvent(evt); - } - - wxAuiTabCtrl* ctrl; int ctrl_idx; if (FindTab(wnd, &ctrl, &ctrl_idx)) @@ -3464,6 +3456,13 @@ int wxAuiNotebook::DoModifySelection(size_t n, bool events) if (wnd->IsShownOnScreen() && FindFocus() != ctrl) wnd->SetFocus(); + // program allows the page change + if(events) + { + evt.SetEventType(wxEVT_AUINOTEBOOK_PAGE_CHANGED); + (void)GetEventHandler()->ProcessEvent(evt); + } + return old_curpage; } } From d293f94d955cc743941dc91fdbed111e215dd4e5 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 16:03:59 +0100 Subject: [PATCH 217/231] CMake: improve finding gstreamer Support checking for multiple versions, first check gstreamer-1.0, then gstreamer-0.10. Add support for finding gstreamer-player. Specify the required components, add the include directories and link with the libraries of the found components. Set the setup variables wxUSE_GSTREAMER and wxUSE_GSTREAMER_PLAYER. --- build/cmake/init.cmake | 12 ++++++- build/cmake/lib/media/CMakeLists.txt | 19 ++++++++++ build/cmake/modules/FindGStreamer.cmake | 48 ++++++++++++------------- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index fac5a2be3d..cb40abc5b8 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -216,7 +216,17 @@ if(wxUSE_GUI) endif() if(wxUSE_MEDIACTRL AND UNIX AND NOT APPLE AND NOT WIN32) - find_package(GStreamer) + find_package(GStreamer 1.0 COMPONENTS video) + if(NOT GSTREAMER_FOUND) + find_package(GStreamer 0.10 COMPONENTS interfaces) + endif() + + set(wxUSE_GSTREAMER ${GSTREAMER_FOUND}) + set(wxUSE_GSTREAMER_PLAYER OFF) + if(GSTREAMER_PLAYER_INCLUDE_DIRS) + set(wxUSE_GSTREAMER_PLAYER ON) + endif() + if(NOT GSTREAMER_FOUND) message(WARNING "GStreamer not found, wxMediaCtrl won't be available") wx_option_force_value(wxUSE_MEDIACTRL OFF) diff --git a/build/cmake/lib/media/CMakeLists.txt b/build/cmake/lib/media/CMakeLists.txt index 7452774956..81028fabbe 100644 --- a/build/cmake/lib/media/CMakeLists.txt +++ b/build/cmake/lib/media/CMakeLists.txt @@ -32,7 +32,26 @@ if(WXOSX_COCOA) ) elseif(UNIX) wx_lib_include_directories(media PUBLIC ${GSTREAMER_INCLUDE_DIRS}) + if(GSTREAMER_INTERFACES_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_INTERFACES_INCLUDE_DIRS}) + endif() + if(GSTREAMER_VIDEO_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_VIDEO_INCLUDE_DIRS}) + endif() + if(GSTREAMER_PLAYER_INCLUDE_DIRS) + wx_lib_include_directories(media PUBLIC ${GSTREAMER_PLAYER_INCLUDE_DIRS}) + endif() + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_LIBRARIES}) + if(GSTREAMER_INTERFACES_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_INTERFACES_LIBRARIES}) + endif() + if(GSTREAMER_VIDEO_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_VIDEO_LIBRARIES}) + endif() + if(GSTREAMER_PLAYER_LIBRARIES) + wx_lib_link_libraries(media PUBLIC ${GSTREAMER_PLAYER_LIBRARIES}) + endif() endif() wx_finalize_lib(media) diff --git a/build/cmake/modules/FindGStreamer.cmake b/build/cmake/modules/FindGStreamer.cmake index 99fb58faae..2590b29f4a 100644 --- a/build/cmake/modules/FindGStreamer.cmake +++ b/build/cmake/modules/FindGStreamer.cmake @@ -22,6 +22,7 @@ # gstreamer-interfaces: GSTREAMER_INTERFACES_INCLUDE_DIRS and GSTREAMER_INTERFACES_LIBRARIES # gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES # gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES +# gstreamer-player: GSTREAMER_PLAYER_INCLUDE_DIRS and GSTREAMER_PLAYER_LIBRARIES # # Copyright (C) 2012 Raphael Kubo da Costa # @@ -48,26 +49,29 @@ find_package(PkgConfig) -# The minimum GStreamer version we support. -set(GSTREAMER_MINIMUM_VERSION 0.10.30) +# Determine the version in the library name, default is 1.0 +set(GST_LIB_VERSION 1.0) +if(DEFINED GStreamer_FIND_VERSION AND GStreamer_FIND_VERSION VERSION_LESS 1.0) + set(GST_LIB_VERSION 0.10) +endif() # Helper macro to find a GStreamer plugin (or GStreamer itself) # _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO") -# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-0.10", or "gstreamer-video-0.10"). -# _header is the component's header, relative to the gstreamer-0.10 directory (eg. "gst/gst.h"). -# _library is the component's library name (eg. "gstreamer-0.10" or "gstvideo-0.10") +# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer", or "gstreamer-video"). +# _header is the component's header, relative to the gstreamer-${GST_LIB_VERSION} directory (eg. "gst/gst.h"). +# _library is the component's library name (eg. "gstreamer" or "gstvideo") macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library) # FIXME: The QUIET keyword can be used once we require CMake 2.8.2. - pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name}) + pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name}-${GST_LIB_VERSION}) find_path(${_component_prefix}_INCLUDE_DIRS NAMES ${_header} HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR} - PATH_SUFFIXES gstreamer-0.10 + PATH_SUFFIXES gstreamer-${GST_LIB_VERSION} ) find_library(${_component_prefix}_LIBRARIES - NAMES ${_library} + NAMES ${_library}-${GST_LIB_VERSION} HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR} ) endmacro() @@ -77,8 +81,8 @@ endmacro() # ------------------------ # 1.1. Find headers and libraries -FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-0.10 gst/gst.h gstreamer-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-0.10 gst/gst.h gstbase-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer gst/gst.h gstreamer) +FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base gst/gst.h gstbase) # 1.2. Check GStreamer version if (GSTREAMER_INCLUDE_DIRS) @@ -98,28 +102,22 @@ if (GSTREAMER_INCLUDE_DIRS) endif () endif () -# FIXME: With CMake 2.8.3 we can just pass GSTREAMER_VERSION to FIND_PACKAGE_HANDLE_STARNDARD_ARGS as VERSION_VAR -# and remove the version check here (GSTREAMER_MINIMUM_VERSION would be passed to FIND_PACKAGE). -set(VERSION_OK TRUE) -if ("${GSTREAMER_VERSION}" VERSION_LESS "${GSTREAMER_MINIMUM_VERSION}") - set(VERSION_OK FALSE) -endif () - # ------------------------- # 2. Find GStreamer plugins # ------------------------- -FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-0.10 gst/app/gstappsink.h gstapp-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-0.10 gst/audio/audio.h gstaudio-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-0.10 gst/fft/gstfft.h gstfft-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces-0.10 gst/interfaces/mixer.h gstinterfaces-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-0.10 gst/pbutils/pbutils.h gstpbutils-0.10) -FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-0.10 gst/video/video.h gstvideo-0.10) +FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app gst/app/gstappsink.h gstapp) +FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio gst/audio/audio.h gstaudio) +FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft gst/fft/gstfft.h gstfft) +FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces gst/interfaces/mixer.h gstinterfaces) +FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils gst/pbutils/pbutils.h gstpbutils) +FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video gst/video/video.h gstvideo) +FIND_GSTREAMER_COMPONENT(GSTREAMER_PLAYER gstreamer-player gst/player/player.h gstplayer) # ------------------------------------------------ # 3. Process the COMPONENTS passed to FIND_PACKAGE # ------------------------------------------------ -set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES VERSION_OK GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES) +set(_GSTREAMER_REQUIRED_VARS GSTREAMER_VERSION GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES) foreach (_component ${GStreamer_FIND_COMPONENTS}) set(_gst_component "GSTREAMER_${_component}") @@ -129,4 +127,4 @@ foreach (_component ${GStreamer_FIND_COMPONENTS}) endforeach () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) \ No newline at end of file +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) From e1b725d5bed2a576f51acf92c90a577fa384376d Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 16:08:07 +0100 Subject: [PATCH 218/231] CMake: mark package variables as advanced Silence pkg_check_modules message. --- build/cmake/config.cmake | 1 + build/cmake/modules/FindFontconfig.cmake | 2 +- build/cmake/modules/FindGStreamer.cmake | 5 +++-- build/cmake/modules/FindGTK3.cmake | 2 +- build/cmake/modules/FindLibSoup.cmake | 2 ++ build/cmake/modules/FindLibsecret.cmake | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index bdb7ea8e04..04db51a020 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -65,6 +65,7 @@ function(wx_write_config) set(CXX ${CMAKE_CXX_COMPILER}) set(DMALLOC_LIBS) find_program(EGREP egrep) + mark_as_advanced(EGREP) set(EXTRALIBS_GUI) set(EXTRALIBS_HTML) set(EXTRALIBS_SDL) diff --git a/build/cmake/modules/FindFontconfig.cmake b/build/cmake/modules/FindFontconfig.cmake index e6fa81d8ef..c7796b1643 100644 --- a/build/cmake/modules/FindFontconfig.cmake +++ b/build/cmake/modules/FindFontconfig.cmake @@ -43,7 +43,7 @@ else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_FONTCONFIG fontconfig) + pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) endif (NOT WIN32) diff --git a/build/cmake/modules/FindGStreamer.cmake b/build/cmake/modules/FindGStreamer.cmake index 2590b29f4a..8baf9cde7b 100644 --- a/build/cmake/modules/FindGStreamer.cmake +++ b/build/cmake/modules/FindGStreamer.cmake @@ -61,8 +61,7 @@ endif() # _header is the component's header, relative to the gstreamer-${GST_LIB_VERSION} directory (eg. "gst/gst.h"). # _library is the component's library name (eg. "gstreamer" or "gstvideo") macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library) - # FIXME: The QUIET keyword can be used once we require CMake 2.8.2. - pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name}-${GST_LIB_VERSION}) + pkg_check_modules(PC_${_component_prefix} QUIET ${_pkgconfig_name}-${GST_LIB_VERSION}) find_path(${_component_prefix}_INCLUDE_DIRS NAMES ${_header} @@ -74,6 +73,8 @@ macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _librar NAMES ${_library}-${GST_LIB_VERSION} HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR} ) + + mark_as_advanced(${_component_prefix}_INCLUDE_DIRS ${_component_prefix}_LIBRARIES) endmacro() # ------------------------ diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake index 2b510aee5f..9f62658d0f 100644 --- a/build/cmake/modules/FindGTK3.cmake +++ b/build/cmake/modules/FindGTK3.cmake @@ -29,7 +29,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. find_package(PkgConfig) -pkg_check_modules(GTK3 gtk+-3.0) +pkg_check_modules(GTK3 QUIET gtk+-3.0) set(VERSION_OK TRUE) if (GTK3_VERSION) if (GTK3_FIND_VERSION_EXACT) diff --git a/build/cmake/modules/FindLibSoup.cmake b/build/cmake/modules/FindLibSoup.cmake index c7448921a9..8ce25561d8 100644 --- a/build/cmake/modules/FindLibSoup.cmake +++ b/build/cmake/modules/FindLibSoup.cmake @@ -52,3 +52,5 @@ endif() INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSoup REQUIRED_VARS LIBSOUP_INCLUDE_DIRS LIBSOUP_LIBRARIES VERSION_VAR PC_LIBSOUP_VERSION) + +mark_as_advanced(LIBSOUP_LIBRARIES LIBSOUP_INCLUDE_DIRS) diff --git a/build/cmake/modules/FindLibsecret.cmake b/build/cmake/modules/FindLibsecret.cmake index d33228a77a..af1e059fcb 100644 --- a/build/cmake/modules/FindLibsecret.cmake +++ b/build/cmake/modules/FindLibsecret.cmake @@ -30,7 +30,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. find_package(PkgConfig) -pkg_check_modules(LIBSECRET libsecret-1) +pkg_check_modules(LIBSECRET QUIET libsecret-1) set(VERSION_OK TRUE) if (LIBSECRET_VERSION) From 5c4741430a900a9046fb0467fd416863c89c35a6 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 16:10:23 +0100 Subject: [PATCH 219/231] CMake: move find_package for lzma and secretstore to init.cmake --- build/cmake/init.cmake | 14 ++++++++++++++ build/cmake/lib/base/CMakeLists.txt | 9 --------- build/cmake/options.cmake | 3 --- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index cb40abc5b8..740cfa17cd 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -154,6 +154,20 @@ if(wxUSE_THREADS) find_package(Threads REQUIRED) endif() +if(wxUSE_LIBLZMA) + find_package(LibLZMA REQUIRED) +endif() + +if(UNIX AND wxUSE_SECRETSTORE) + # The required APIs are always available under MSW and OS X but we must + # have GNOME libsecret under Unix to be able to compile this class. + find_package(Libsecret REQUIRED) + if(NOT LIBSECRET_FOUND) + message(WARNING "libsecret not found, wxSecretStore won't be available") + wx_option_force_value(wxUSE_SECRETSTORE OFF) + endif() +endif() + if(wxUSE_GUI) if(WXMSW AND wxUSE_METAFILE) # this one should probably be made separately configurable diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index 28377c4772..ec38b8947a 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -24,15 +24,6 @@ elseif(APPLE) endif() elseif(UNIX) wx_append_sources(BASE_FILES BASE_UNIX) - if(wxUSE_SECRETSTORE) - # The required APIs are always available under MSW and OS X but we must - # have GNOME libsecret under Unix to be able to compile this class. - find_package(Libsecret REQUIRED) - if(NOT LIBSECRET_FOUND) - message(WARNING "libsecret not found, wxSecretStore won't be available") - wx_option_force_value(wxUSE_SECRETSTORE OFF) - endif() - endif() endif() wx_add_library(base IS_BASE ${BASE_FILES}) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 19c7344b80..0e2401a18c 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -71,9 +71,6 @@ wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)") wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)") wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF) -if(wxUSE_LIBLZMA) - find_package(LibLZMA REQUIRED) -endif() set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression") wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") From e1e5169e4b55d45e5341684f29b91a0d572f8df5 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 16:30:20 +0100 Subject: [PATCH 220/231] CMake: enable Direct2D graphics context by default Disable it when the d2d1.h header is not found. When using MSVC, match the behaviour of setup.h. --- build/cmake/init.cmake | 19 +++++++++++++++---- build/cmake/options.cmake | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 740cfa17cd..292440380f 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -142,10 +142,6 @@ if(DEFINED wxUSE_OLE AND wxUSE_OLE) set(wxUSE_OLE_AUTOMATION ON) endif() -if(DEFINED wxUSE_GRAPHICS_DIRECT2D AND NOT wxUSE_GRAPHICS_CONTEXT) - set(wxUSE_GRAPHICS_DIRECT2D OFF) -endif() - if(wxUSE_OPENGL) set(wxUSE_GLCANVAS ON) endif() @@ -174,6 +170,21 @@ if(wxUSE_GUI) set(wxUSE_ENH_METAFILE ON) endif() + # Direct2D check + if(WIN32 AND wxUSE_GRAPHICS_DIRECT2D) + check_include_file(d2d1.h HAVE_D2D1_H) + if (NOT HAVE_D2D1_H) + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF) + endif() + endif() + if(MSVC) # match setup.h + if(MSVC_VERSION LESS 1600) + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF) + else() + wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D ${wxUSE_GRAPHICS_CONTEXT}) + endif() + endif() + # WXQT checks if(WXQT) wx_option_force_value(wxUSE_WEBVIEW OFF) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 0e2401a18c..6b03f2b068 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -208,8 +208,8 @@ if(APPLE) set(wxUSE_GRAPHICS_CONTEXT ON) else() wx_option(wxUSE_GRAPHICS_CONTEXT "use graphics context 2D drawing API") - if (WIN32 AND (NOT MSVC OR MSVC_VERSION LESS 1600)) - wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context" OFF) + if(WIN32) + wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context") endif() endif() From 9554cb49d8d4ce3ed496a4f0ea4fc705ebba3db7 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 16:34:25 +0100 Subject: [PATCH 221/231] Fix build when enabling wxD2D_DEVICE_CONTEXT_SUPPORTED Add missing GUID and function for dynamic linking. --- src/msw/graphicsd2d.cpp | 86 +++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 00eb65dde3..983372502c 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -23,6 +23,9 @@ #define D2D1MakeSkewMatrix wxD2D1MakeSkewMatrix #define D2D1IsMatrixInvertible wxD2D1IsMatrixInvertible #define D2D1InvertMatrix wxD2D1InvertMatrix +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +#define D3D11CreateDevice wxD3D11CreateDevice +#endif // There are clashes between the names of the member fields and parameters // in the standard d2d1helper.h header resulting in C4458 with VC14, @@ -42,9 +45,9 @@ #endif #if wxD2D_DEVICE_CONTEXT_SUPPORTED -#include -#include -#include +#include +#include +#include #endif #ifdef __VISUALC__ @@ -155,6 +158,11 @@ private: if ( !m_dllDirectWrite.Load(wxT("dwrite.dll"), wxDL_VERBATIM | wxDL_QUIET) ) return false; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + if (!m_dllDirect3d.Load(wxT("d3d11.dll"), wxDL_VERBATIM | wxDL_QUIET)) + return false; +#endif + #define wxLOAD_FUNC(dll, name) \ name = (name##_t)dll.RawGetSymbol(#name); \ if ( !name ) \ @@ -167,6 +175,10 @@ private: wxLOAD_FUNC(m_dllDirect2d, D2D1InvertMatrix); wxLOAD_FUNC(m_dllDirectWrite, DWriteCreateFactory); +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + wxLOAD_FUNC(m_dllDirect3d, D3D11CreateDevice); +#endif + m_D2DRuntimeVersion = wxD2D_VERSION_1_0; return true; @@ -191,6 +203,11 @@ public: typedef HRESULT (WINAPI *DWriteCreateFactory_t)(DWRITE_FACTORY_TYPE, REFIID, IUnknown**); static DWriteCreateFactory_t DWriteCreateFactory; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + typedef HRESULT (WINAPI *D3D11CreateDevice_t)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**); + static D3D11CreateDevice_t D3D11CreateDevice; +#endif + private: static bool m_initialized; static bool m_hasDirect2DSupport; @@ -198,6 +215,9 @@ private: static wxDynamicLibrary m_dllDirect2d; static wxDynamicLibrary m_dllDirectWrite; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED + static wxDynamicLibrary m_dllDirect3d; +#endif }; // define the members @@ -207,6 +227,9 @@ wxDirect2D::wxD2DVersion wxDirect2D::m_D2DRuntimeVersion = wxD2D_VERSION_NONE; wxDynamicLibrary wxDirect2D::m_dllDirect2d; wxDynamicLibrary wxDirect2D::m_dllDirectWrite; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +wxDynamicLibrary wxDirect2D::m_dllDirect3d; +#endif // define the (not yet imported) functions wxDirect2D::D2D1CreateFactory_t wxDirect2D::D2D1CreateFactory = NULL; @@ -216,6 +239,10 @@ wxDirect2D::D2D1IsMatrixInvertible_t wxDirect2D::D2D1IsMatrixInvertible = NULL; wxDirect2D::D2D1InvertMatrix_t wxDirect2D::D2D1InvertMatrix = NULL; wxDirect2D::DWriteCreateFactory_t wxDirect2D::DWriteCreateFactory = NULL; +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +wxDirect2D::D3D11CreateDevice_t wxDirect2D::D3D11CreateDevice = NULL; +#endif + // define the interface GUIDs DEFINE_GUID(wxIID_IWICImagingFactory, 0xec5ec8a9, 0xc395, 0x4314, 0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70); @@ -235,6 +262,11 @@ DEFINE_GUID(GUID_WICPixelFormat32bppPBGRA, DEFINE_GUID(GUID_WICPixelFormat32bppBGR, 0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e); +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +DEFINE_GUID(IID_IDXGIDevice, + 0x54ec77fa, 0x1377, 0x44e6, 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c); +#endif + #ifndef CLSID_WICImagingFactory DEFINE_GUID(CLSID_WICImagingFactory, 0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa); @@ -298,6 +330,36 @@ BOOL WINAPI wxD2D1InvertMatrix( return wxDirect2D::D2D1InvertMatrix(matrix); } +#if wxD2D_DEVICE_CONTEXT_SUPPORTED +HRESULT WINAPI wxD3D11CreateDevice( + IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + CONST D3D_FEATURE_LEVEL* pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + ID3D11Device** ppDevice, + D3D_FEATURE_LEVEL* pFeatureLevel, + ID3D11DeviceContext** ppImmediateContext) +{ + if (!wxDirect2D::Initialize()) + return S_FALSE; + + return wxDirect2D::D3D11CreateDevice( + pAdapter, + DriverType, + Software, + Flags, + pFeatureLevels, + FeatureLevels, + SDKVersion, + ppDevice, + pFeatureLevel, + ppImmediateContext); +} +#endif + static IWICImagingFactory* gs_WICImagingFactory = NULL; IWICImagingFactory* wxWICImagingFactory() @@ -401,7 +463,7 @@ public: // was not previously acquired virtual void* GetResource() = 0; - virtual ~wxResourceHolder(){}; + virtual ~wxResourceHolder() {} }; class wxD2DResourceManager; @@ -414,13 +476,13 @@ public: virtual bool IsBound() = 0; virtual wxD2DResourceManager* GetManager() = 0; - virtual ~wxD2DManagedObject() {}; + virtual ~wxD2DManagedObject() {} }; class wxManagedResourceHolder : public wxResourceHolder, public wxD2DManagedObject { public: - virtual ~wxManagedResourceHolder() {}; + virtual ~wxManagedResourceHolder() {} }; // A Direct2D resource manager handles the device-dependent @@ -594,7 +656,7 @@ public: virtual wxD2DManagedObject* GetManagedObject() = 0; - ~wxD2DManagedGraphicsData() {}; + ~wxD2DManagedGraphicsData() {} }; D2D1_CAP_STYLE wxD2DConvertPenCap(wxPenCap cap) @@ -1115,7 +1177,7 @@ public : void* GetNativePath() const wxOVERRIDE; // give the native path returned by GetNativePath() back (there might be some deallocations necessary) - void UnGetNativePath(void* WXUNUSED(p)) const wxOVERRIDE {}; + void UnGetNativePath(void* WXUNUSED(p)) const wxOVERRIDE {} // transforms each point of this path by the matrix void Transform(const wxGraphicsMatrixData* matrix) wxOVERRIDE; @@ -2199,7 +2261,7 @@ public: wxGraphicsBitmapData(renderer), m_bitmapHolder(bitmap) {} wxD2DBitmapData(wxGraphicsRenderer* renderer, const void* pseudoNativeBitmap) : - wxGraphicsBitmapData(renderer), m_bitmapHolder(*static_cast(pseudoNativeBitmap)) {}; + wxGraphicsBitmapData(renderer), m_bitmapHolder(*static_cast(pseudoNativeBitmap)) {} // returns the native representation void* GetNativeBitmap() const wxOVERRIDE; @@ -2268,8 +2330,8 @@ template class wxD2DBrushResourceHolder : public wxD2DResourceHolder { public: - wxD2DBrushResourceHolder(const wxBrush& brush) : m_sourceBrush(brush) {}; - virtual ~wxD2DBrushResourceHolder() {}; + wxD2DBrushResourceHolder(const wxBrush& brush) : m_sourceBrush(brush) {} + virtual ~wxD2DBrushResourceHolder() {} protected: const wxBrush m_sourceBrush; }; @@ -2645,7 +2707,7 @@ public: wxCOMPtr GetTextFormat() const { return m_textFormat; } - wxCOMPtr GetFont() { return m_font; }; + wxCOMPtr GetFont() { return m_font; } private: // The native, device-independent font object From 31f5f2dc08cf80d904241f03e892367c504c3456 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Nov 2018 17:54:52 +0100 Subject: [PATCH 222/231] Rename a variable in wxEditableListBox code for clarity Rename "centered" into "flagsCentered" to make it more obvious that this variable contains wxSizerFlags. --- src/generic/editlbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/generic/editlbox.cpp b/src/generic/editlbox.cpp index 3ad94a4ce9..f472e79ec9 100644 --- a/src/generic/editlbox.cpp +++ b/src/generic/editlbox.cpp @@ -125,14 +125,14 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, subsizer->Add(new wxStaticText(subp, wxID_ANY, label), wxSizerFlags(1).Center().Border(wxLEFT)); - const wxSizerFlags centered = wxSizerFlags().Center(); + const wxSizerFlags flagsCentered = wxSizerFlags().Center(); if ( m_style & wxEL_ALLOW_EDIT ) { m_bEdit = new wxBitmapButton(subp, wxID_ELB_EDIT, wxArtProvider::GetBitmap(wxART_EDIT, wxART_BUTTON)); m_bEdit->SetToolTip(_("Edit item")); - subsizer->Add(m_bEdit, centered); + subsizer->Add(m_bEdit, flagsCentered); } if ( m_style & wxEL_ALLOW_NEW ) @@ -140,7 +140,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, m_bNew = new wxBitmapButton(subp, wxID_ELB_NEW, wxArtProvider::GetBitmap(wxART_NEW, wxART_BUTTON)); m_bNew->SetToolTip(_("New item")); - subsizer->Add(m_bNew, centered); + subsizer->Add(m_bNew, flagsCentered); } if ( m_style & wxEL_ALLOW_DELETE ) @@ -148,7 +148,7 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, m_bDel = new wxBitmapButton(subp, wxID_ELB_DELETE, wxArtProvider::GetBitmap(wxART_DELETE, wxART_BUTTON)); m_bDel->SetToolTip(_("Delete item")); - subsizer->Add(m_bDel, centered); + subsizer->Add(m_bDel, flagsCentered); } if (!(m_style & wxEL_NO_REORDER)) @@ -156,12 +156,12 @@ bool wxEditableListBox::Create(wxWindow *parent, wxWindowID id, m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxArtProvider::GetBitmap(wxART_GO_UP, wxART_BUTTON)); m_bUp->SetToolTip(_("Move up")); - subsizer->Add(m_bUp, centered); + subsizer->Add(m_bUp, flagsCentered); m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_BUTTON)); m_bDown->SetToolTip(_("Move down")); - subsizer->Add(m_bDown, centered); + subsizer->Add(m_bDown, flagsCentered); } subp->SetSizer(subsizer); From de4eecc575b054e53005f5f51f2be53d5479c6be Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 22:00:32 +0100 Subject: [PATCH 223/231] Install additional packages on Travis CI Install packages for gstreamer, webkit, opengl and libsecret. First check if the package is available. --- build/tools/before_install.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index acd36027dc..40b72ee7d7 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -21,7 +21,18 @@ case $(uname -s) in *--with-qt*) libtoolkit_dev='qtdeclarative5-dev' ;; esac - $SUDO apt-get install -y $libgtk_dev $libtoolkit_dev libnotify-dev + pgk_check="libgstreamermm-1.0-dev libgstreamermm-0.10-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ + libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev \ + libwebkitgtk-dev libglu1-mesa-dev libsecret-1-dev libnotify-dev" + + for pkg in $pgk_check; do + if $(apt-cache pkgnames | grep -q $pkg) ; then + pkg_install="$pkg_install $pkg" + fi + done + + $SUDO apt-get install -y $libgtk_dev $libtoolkit_dev $pkg_install fi ;; From 55c50f36dc5f3b466ac2fd2f8bd1e1639913bb08 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 4 Nov 2018 23:44:06 +0100 Subject: [PATCH 224/231] Disable webview in static build Prevent link errors of test_gui with webview libraries. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3ffc1cad3..8380d561c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ matrix: env: wxGTK_VERSION=3 wxCONFIGURE_FLAGS="--enable-cxx11 --enable-stl" wxMAKEFILE_FLAGS="CXXFLAGS=-std=c++11" - dist: trusty compiler: clang - env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs" + env: wxCONFIGURE_FLAGS="--disable-shared --disable-sys-libs --disable-webview" - dist: trusty compiler: gcc env: wxTOOLSET=cmake wxCMAKE_GENERATOR="Unix Makefiles" From b77aa4782db731ee3e1226a298b3c6bc52f6d68b Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 5 Nov 2018 14:37:54 +0100 Subject: [PATCH 225/231] Forcing paint after show on 10.14 layer-backed views do not get a refresh when shown, but wx-user code might depend on the assumption that they do --- src/osx/cocoa/window.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index b32f5aef66..3695a1b185 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -2573,6 +2573,10 @@ bool wxWidgetCocoaImpl::IsVisible() const void wxWidgetCocoaImpl::SetVisibility( bool visible ) { [m_osxView setHidden:(visible ? NO:YES)]; + + // trigger redraw upon shown for layer-backed views + if( m_osxView.layer && !m_osxView.isHiddenOrHasHiddenAncestor ) + SetNeedsDisplay(NULL); } double wxWidgetCocoaImpl::GetContentScaleFactor() const @@ -3028,7 +3032,7 @@ static void SetSubviewsNeedDisplay( NSView *view ) { for ( NSView *sub in view.subviews ) { - if ( !sub.layer ) + if ( sub.isHidden || !sub.layer ) continue; [sub setNeedsDisplay:YES]; From aaa13cf520e759d202c3d4f7ce98234aed01cc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 3 Nov 2018 17:03:14 +0100 Subject: [PATCH 226/231] Fix font description for non-. decimal separators Fix wxNativeFontInfo::ToString and FromString to work correctly under locales that don't use '.' for decimal separator. The code incorrectly parsed descriptions using ToCDouble and this '.', but wrote them out using locale's native separator. Fixed by using FromCDouble for output too. --- src/common/fontcmn.cpp | 4 ++-- src/msw/font.cpp | 4 ++-- src/osx/carbon/font.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index f5c47bd001..74f105e2a2 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -812,9 +812,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxT("%d;%f;%d;%d;%d;%d;%d;%s;%d"), + s.Printf(wxT("%d;%s;%d;%d;%d;%d;%d;%s;%d"), 1, // version - GetFractionalPointSize(), + wxString::FromCDouble(GetFractionalPointSize()), family, (int)style, weight, diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 76a2cc3c35..ed9840e0e6 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -739,9 +739,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxS("%d;%f;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"), + s.Printf(wxS("%d;%s;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"), 1, // version - pointSize, + wxString::FromCDouble(pointSize), lf.lfHeight, lf.lfWidth, lf.lfEscapement, diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 53775b16b3..73f22a35fb 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -971,9 +971,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxT("%d;%f;%d;%d;%d;%d;%d;%s;%d"), + s.Printf(wxT("%d;%s;%d;%d;%d;%d;%d;%s;%d"), 1, // version - GetFractionalPointSize(), + wxString::FromCDouble(GetFractionalPointSize()), GetFamily(), (int)GetStyle(), GetNumericWeight(), From fdee5e7bc95ce19891ab2db4c8cf8550d9a8934b Mon Sep 17 00:00:00 2001 From: Artur Sochirca Date: Mon, 5 Nov 2018 18:44:59 +0100 Subject: [PATCH 227/231] Replace another occurrence of deprecated wxUSE_GENERICDATAVIEWCTRL Use wxHAS_GENERIC_DATAVIEWCTRL instead, to complete the changes of bc92ed9d854c504aa77c0dc2af194c45eab65f5e, see https://github.com/wxWidgets/wxWidgets/pull/827 Closes https://github.com/wxWidgets/wxWidgets/pull/1016 --- src/osx/cocoa/dataview.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index d7f6fc362b..09a532dbef 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -14,7 +14,7 @@ #include "wx/dataview.h" -#if !defined(wxUSE_GENERICDATAVIEWCTRL) +#if !defined(wxHAS_GENERIC_DATAVIEWCTRL) #ifndef WX_PRECOMP #include "wx/app.h" @@ -3556,6 +3556,6 @@ void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPt m_NativeDataPtr = newNativeDataPtr; } -#endif // !wxUSE_GENERICDATAVIEWCTRL +#endif // !defined(wxHAS_GENERIC_DATAVIEWCTRL) #endif // wxUSE_DATAVIEWCTRL From 3e246c767f33994287a56aa5231d00003ca0a95a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Nov 2018 19:35:44 +0100 Subject: [PATCH 228/231] Return true from wxHyperlinkCtrl::MSWOnNotify() As SendEvent() not only sends the event about clicking on the link, but also opens the link in the default browser if this event was not processed (which wasn't really obvious from its name, so at least mention it in its comment), the event is actually always handled and so MSWOnNotify() must return true, not false (and definitely not 0) to indicate it. Closes #18266. --- include/wx/hyperlink.h | 3 +++ src/msw/hyperlink.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/wx/hyperlink.h b/include/wx/hyperlink.h index 237dadca85..072c05efd3 100644 --- a/include/wx/hyperlink.h +++ b/include/wx/hyperlink.h @@ -76,6 +76,9 @@ protected: void CheckParams(const wxString& label, const wxString& url, long style); public: + // Send wxHyperlinkEvent and open our link in the default browser if it + // wasn't handled. + // // not part of the public API but needs to be public as used by // GTK+ callbacks: void SendEvent(); diff --git a/src/msw/hyperlink.cpp b/src/msw/hyperlink.cpp index f39d94ae17..adb922de74 100644 --- a/src/msw/hyperlink.cpp +++ b/src/msw/hyperlink.cpp @@ -174,7 +174,12 @@ bool wxHyperlinkCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case NM_RETURN: SetVisited(); SendEvent(); - return 0; + + // SendEvent() launches the browser by default, so we consider + // that the event was processed in any case, either by user + // code or by wx itself, hence we always return true to + // indicate that the default processing shouldn't take place. + return true; } } From 190601c47fb97e58dcd155818d8d22820931219b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 5 Nov 2018 19:38:18 +0100 Subject: [PATCH 229/231] Translate the warning shown by wxHyperlinkCtrl::SendEvent() As anything shown to the user, this string must be translated, so use _() around it instead of wxT(). Also reword the string a little; remove unnecessary call to .c_str() and use a const reference instead of making a copy of the URL unnecessarily. --- src/common/hyperlnkcmn.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/hyperlnkcmn.cpp b/src/common/hyperlnkcmn.cpp index aacbec2149..ff83c4bdc4 100644 --- a/src/common/hyperlnkcmn.cpp +++ b/src/common/hyperlnkcmn.cpp @@ -127,13 +127,13 @@ wxHyperlinkCtrlBase::CheckParams(const wxString& label, void wxHyperlinkCtrlBase::SendEvent() { - wxString url = GetURL(); + const wxString& url = GetURL(); wxHyperlinkEvent linkEvent(this, GetId(), url); if (!GetEventHandler()->ProcessEvent(linkEvent)) // was the event skipped ? { if (!wxLaunchDefaultBrowser(url)) { - wxLogWarning(wxT("Could not launch the default browser with url '%s' !"), url.c_str()); + wxLogWarning(_("Failed to open URL \"%s\" in the default browser"), url); } } } From d735e444f16255acc0c8a3bf4b2bb280c6a81b55 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 5 Nov 2018 21:00:19 +0100 Subject: [PATCH 230/231] Refer to wxPGProperty associated with wxPGComboBox editor in all drawing operations Store wxPGProperty for which wxPGComboBox editor is activated and use this reference in all further drawing operations instead of retrieving each time currently selected wxPGProperty which during the entire lifetime of the editor is the same as property selected on editor activation. See #18211. --- src/propgrid/editors.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 0b8e439faa..99ec7ed02f 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -645,10 +645,11 @@ public: // Enabling double-click processor makes sense // only for wxBoolProperty. - wxPGProperty* selProp = GetGrid()->GetSelection(); - if (wxDynamicCast(selProp, wxBoolProperty)) + m_selProp = GetGrid()->GetSelection(); + wxASSERT(m_selProp); + if (wxDynamicCast(m_selProp, wxBoolProperty)) { - m_dclickProcessor = new wxPGDoubleClickProcessor(this, selProp); + m_dclickProcessor = new wxPGDoubleClickProcessor(this, m_selProp); PushEventHandler(m_dclickProcessor); } @@ -729,9 +730,12 @@ public: ); } + wxPGProperty* GetProperty() const { return m_selProp; } + private: wxPGDoubleClickProcessor* m_dclickProcessor; bool m_sizeEventCalled; + wxPGProperty* m_selProp; }; @@ -741,7 +745,8 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, wxRect& rect, int flags ) { - wxPGProperty* p = GetSelection(); + wxPGProperty* p = pCb->GetProperty(); + wxString text; const wxPGChoices& choices = p->GetChoices(); From 8929b3d3deca58487bcb46c381f1a12ca610560f Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 5 Nov 2018 21:09:13 -0800 Subject: [PATCH 231/231] Use a more robust check for the GNU C Library _GNU_SOURCE alone is not definitive --- src/common/log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/log.cpp b/src/common/log.cpp index d5a59ff502..653c35cc3b 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -1108,7 +1108,7 @@ static const wxChar* GetSysErrorMsg(wxChar* szBuf, size_t sizeBuf, unsigned long char buffer[1024]; char *errorMsg = buffer; -#ifdef _GNU_SOURCE // GNU-specific strerror_r +#if defined(__GLIBC__) && defined(_GNU_SOURCE) // GNU-specific strerror_r // GNU's strerror_r has a weird interface -- it doesn't // necessarily copy anything to the buffer given; use return // value instead.