Patch #3501 2013-09-29 20:18

mojca

wxcontrib: patches for wx 2.9
Download
3501-wxcontrib_patc.patch (814 bytes)
Category
Plugin::Bugfix
Status
Accepted
Close date
2013-10-04 21:24
Assigned to
tpetrov
Index: src/plugins/contrib/wxContribItems/wxTreeList/src/treelistctrl.cpp
===================================================================
--- src/plugins/contrib/wxContribItems/wxTreeList/src/treelistctrl.cpp    (revision 9378)
+++ src/plugins/contrib/wxContribItems/wxTreeList/src/treelistctrl.cpp    (working copy)
@@ -2021,14 +2021,8 @@
                                    const wxString& name) {
 
 #ifdef __WXMAC__
-    if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
-    if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
     style &= ~wxTR_LINES_AT_ROOT;
     style |= wxTR_NO_LINES;
-
-    int major,minor;
-    wxGetOsVersion( &major, &minor );
-    if (major < 10) style |= wxTR_ROW_LINES;
 #endif
 
     wxScrolledWindow::Create (parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name);
mojca 2013-09-29 20:22

I'm submitting a patch for plugins/contrib/wxContribItems. It contains four chunks of code. The first three are absolutely needed to work with wxWidgets 2.9 and are safe for earlier versions. The fourth one was needed to compile on 2.9, but I'm not sure what it purpose was on earlier versions or how it was user.

The wxWidgets sources (include/wx/treebase.h) say they the constants are deprecated:

#if WXWIN_COMPATIBILITY_2_6

// deprecated, don't use

#define wxTR_MAC_BUTTONS 0

#define wxTR_AQUA_BUTTONS 0

#endif // WXWIN_COMPATIBILITY_2_6

mojca 2013-09-29 21:18

I now see that the first two chunks have already been fixed. So only the last two are still needed to be applied.

mojca 2013-10-01 21:27

This patch has already been dealt with (the first three chunks were applied) except for this:

- if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;

- if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;

and I'm not sure what to do with that.

mojca 2013-10-02 10:40
From wxWidgets 2.8:

#if WXWIN_COMPATIBILITY_2_6
// deprecated, don't use
#define wxTR_MAC_BUTTONS             0
#define wxTR_AQUA_BUTTONS            0
#endif // WXWIN_COMPATIBILITY_2_6

I think it really makes sense to delete at least these two lines. I'm not sure if anyone still cares about ancient macs running wxWidgets 2.6 (when the code doesn't even compile on the latest ones ;).

--- src/plugins/contrib/wxContribItems/wxTreeList/src/treelistctrl.cpp	(revision 9378)
+++ src/plugins/contrib/wxContribItems/wxTreeList/src/treelistctrl.cpp	(working copy)
@@ -2021,8 +2021,6 @@
                                    const wxString& name) {

 #ifdef __WXMAC__
-    if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
-    if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
     style &= ~wxTR_LINES_AT_ROOT;
     style |= wxTR_NO_LINES;

On the other hand the lines that follow are even more outdated, targetting Mac OS 8/9, so I believe they could go just as well:

    int major,minor;
    wxGetOsVersion( &major, &minor );
    if (major < 10) style |= wxTR_ROW_LINES;

mojca 2013-10-02 20:48

I uploaded a new patch. It deletes 5 lines.

Deleting the first two lines is necessary in order to be prevent a compile error.

The last three lines are harmless and only affect Mac OS < 10.0, but I think that supporting that would be an equivalent of supporting Windows 3.11. (wxWidgets 2.9 don't even support 10.4 any longer, let alone versions before), so I consider it safe to remove them.