File: 1000-wx3.0-compat.patch

package info (click to toggle)
chipw 2.0.6-1.2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 2,884 kB
  • sloc: cpp: 7,050; sh: 985; makefile: 25
file content (124 lines) | stat: -rw-r--r-- 5,256 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Description: Fixes to work with wxwidgets 3.0
 Preserves compatibility with wxwidgets 2.8.
Author: David <deivi73@yahoo.es>
Last-Update: 2014-06-06

diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/src/leveleditview.cpp chipw-2.0.6/src/leveleditview.cpp
--- orig/chipw-2.0.6/src/leveleditview.cpp	2011-12-15 16:40:24.000000000 +0100
+++ chipw-2.0.6/src/leveleditview.cpp	2014-06-03 19:27:04.847603711 +0200
@@ -210,10 +210,15 @@
 void LevelEditView::OnChangeFilename() {
     if(GetDocument() != NULL && GetFrame() != NULL) {
         wxString name;
-        GetDocument()->GetPrintableName(name);
         wxString title = wxT("Chip's Workshop");
-        if(name)
+#if wxCHECK_VERSION(2,8,5)
+        name=GetDocument()->GetUserReadableName();
+        title += wxT(" - ") + name;
+#else
+        GetDocument()->GetPrintableName(name);
+        if(!name.empty())
             title += wxT(" - ") + name;
+#endif
         if(level != NULL && !level->title.empty())
             title += wxT(" (") + wxString(level->title.c_str(), wxConvISO8859_1) + wxT(")");
         if(GetFrame()->IsKindOf(CLASSINFO(wxTopLevelWindow)))
@@ -343,7 +348,7 @@
                 std::string title = level->title;
                 {
                     const wxWX2MBbuf str = dlg.title.mb_str(wxConvISO8859_1);
-                    if(str != NULL)
+                    if((const void *) str != NULL)
                         title = str;
                     else
                         wxLogError(wxT("Failed to set level title."));
@@ -351,7 +356,7 @@
                 std::string psw = level->psw;
                 {
                     const wxWX2MBbuf str = dlg.psw.mb_str(wxConvISO8859_1);
-                    if(str != NULL)
+                    if((const void *) str != NULL)
                         psw = str;
                     else
                         wxLogError(wxT("Failed to set level password."));
@@ -369,7 +374,7 @@
                 std::string hint = level->hint;
                 {
                     const wxWX2MBbuf str = dlg.hint.mb_str(wxConvISO8859_1);
-                    if(str != NULL)
+                    if ((const void *) str != NULL)
                         hint = str;
                     else
                         wxLogError(wxT("Failed to set level hint."));
@@ -827,7 +832,11 @@
         wxRegion region(x1, y1, selw * GetTileW(), selh * GetTileH());
         region.Xor(x2, y2, w * GetTileW(), h * GetTileH());
         wxDC* dc = NewClientDC();
+#if wxCHECK_VERSION(2,8,11)
+        dc->SetDeviceClippingRegion(region);
+#else
         dc->SetClippingRegion(region);
+#endif
         DrawSelection(dc, 0, 0, 32, 32);
         delete dc;
     }
@@ -896,7 +905,11 @@
 
 void LevelEditView::DrawSelection(wxDC* dc, wxUint32 x, wxUint32 y, wxUint32 w, wxUint32 h) {
     if(x < 32 && y < 32 && w > 0 && h > 0) {
+#if wxCHECK_VERSION(2,9,0)
+        wxRasterOperationMode origfunc = dc->GetLogicalFunction();
+#else
         int origfunc = dc->GetLogicalFunction();
+#endif
         dc->SetLogicalFunction(wxINVERT);
         dc->SetPen(*wxTRANSPARENT_PEN);
         dc->SetBrush(*wxBLACK_BRUSH);
@@ -963,7 +976,11 @@
                 continue;
             }
             if(tilelist != NULL && tilelist->IsSelected(tileselgrid[x + TILESEL_WIDTH * y])) {
-                int origfunc = dc->GetLogicalFunction();
+#if wxCHECK_VERSION(2,9,0)
+                wxRasterOperationMode origfunc = dc->GetLogicalFunction();
+#else
+		int origfunc = dc->GetLogicalFunction();
+#endif
                 dc->SetLogicalFunction(wxINVERT);
                 dc->SetPen(*wxTRANSPARENT_PEN);
                 dc->SetBrush(*wxBLACK_BRUSH);
diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/src/listmenumgr.cpp chipw-2.0.6/src/listmenumgr.cpp
--- orig/chipw-2.0.6/src/listmenumgr.cpp	2011-12-15 16:40:24.000000000 +0100
+++ chipw-2.0.6/src/listmenumgr.cpp	2014-06-03 18:15:16.851527122 +0200
@@ -81,7 +81,12 @@
             wxMenuItem* item = *itemit;
             if(item == NULL)
                 continue;
-            item->SetText(GetItemLabel(i, newitems, emptytext));
+            
+#if wxCHECK_VERSION(2,8,5)
+            item->SetItemLabel(GetItemLabel(i, newitems, emptytext));
+#else
+            item->SetText(GetItemLabel(i,newitems,emptytext));
+#endif
             item->Enable((unsigned int) i < newitems.size());
         }
         // Add items if the length has increased.
diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/src/tileset.cpp chipw-2.0.6/src/tileset.cpp
--- orig/chipw-2.0.6/src/tileset.cpp	2011-12-15 16:40:24.000000000 +0100
+++ chipw-2.0.6/src/tileset.cpp	2014-06-03 00:46:18.469299483 +0200
@@ -210,11 +210,11 @@
     if(!CheckMaxSize(size, size))
         return false;
     // Avoiding alpha simplifies the code, and it doesn't seem to work well in wxWidgets anyway.
-    if(!img.ConvertAlphaToMask()) {
+    if(img.HasAlpha() && !img.ConvertAlphaToMask()) {
         wxLogError(wxT("Failed to generate image mask."));
         return false;
     }
-    if(CheckOk(img2) && !img2.ConvertAlphaToMask()) {
+    if(CheckOk(img2) && img2.HasAlpha() && !img2.ConvertAlphaToMask()) {
         wxLogError(wxT("Failed to generate secondary image mask."));
         return false;
     }