Bug#748634: chipw: NMU update to use wxwidgets3.0. Cleaned up and revised versions patch

2014-06-03 Thread Deivi San
tags 748634 + patch


Dear Olly,

In first place, thanks for your sugestions and time.

After
 cleaning up comments and reconsidering all your recommendations I've 
recompiled and tested with versions 2.8 and 3.0 of the library (both 
available in testing) and it works fine. I've attached a new patch with 
comments removed, versions verified and null checks in place.

wxWX2MBbuf is not wxString but a dual type macro so I have used casting instead 
of your proposal.

The only doubt I hold is with function wxImage.ConvertAlphaToMask():
    In 2.8 code works well with package included tiles (a bmp without Alpha 
returns true). However, it fails when calling this function in 3.0 and 
previous img.HasAlpha() check is required.
    I guess it's an wxwidgets behavior change.

Anyway, now migration to wxwidgets3.0 is a step nearer. 


Cheers,
  
Daviddiff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/debian/changelog chipw-2.0.6/debian/changelog
--- orig/chipw-2.0.6/debian/changelog	2011-12-16 14:50:53.0 +0100
+++ chipw-2.0.6/debian/changelog	2014-06-03 19:31:39.176154934 +0200
@@ -1,3 +1,10 @@
+chipw (2.0.6-1.2) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Update to use wxWidgets3.0
+
+ -- David deiv...@yahoo.es Tue, 3 Jun 2014 19:31:39 +0200
+
 chipw (2.0.6-1.1) unstable; urgency=low
 
   * Non-maintainer upload at maintainer's request.
diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/debian/control chipw-2.0.6/debian/control
--- orig/chipw-2.0.6/debian/control	2011-12-16 14:47:25.0 +0100
+++ chipw-2.0.6/debian/control	2014-06-03 01:28:04.853789962 +0200
@@ -2,7 +2,7 @@
 Section: games
 Priority: optional
 Maintainer: Luke Faraone l...@faraone.cc
-Build-Depends: cdbs, debhelper (= 7), libwxgtk2.8-dev
+Build-Depends: cdbs, debhelper (= 7), libwxgtk3.0-dev
 DM-Upload-Allowed: yes
 Standards-Version: 3.9.0
 Homepage: http://www.microstupidity.com/chipw/
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.0 +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 + 

Bug#748634: chipw: NMU update to use wxwidgets3.0

2014-06-02 Thread Deivi San
Dear maintainer and dear Olly,

I've tried my best to contribue my two cents in migrating to wxwidgets3.0. The 
project just seemed at my hand reach.

Cheers

David.
diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/debian/changelog chipw-2.0.6/debian/changelog
--- orig/chipw-2.0.6/debian/changelog	2011-12-16 14:50:53.0 +0100
+++ chipw-2.0.6/debian/changelog	2014-06-03 01:27:10.890468373 +0200
@@ -1,3 +1,10 @@
+chipw (2.0.6-1.2) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Update to use wxWidgets3.0
+
+ -- David deiv...@yahoo.es Tue, 3 Jun 2014 01:27:10 +0200
+
 chipw (2.0.6-1.1) unstable; urgency=low
 
   * Non-maintainer upload at maintainer's request.
diff -Nru --from-file orig/chipw-2.0.6/ orig/chipw-2.0.6/debian/control chipw-2.0.6/debian/control
--- orig/chipw-2.0.6/debian/control	2011-12-16 14:47:25.0 +0100
+++ chipw-2.0.6/debian/control	2014-06-03 01:28:04.853789962 +0200
@@ -2,7 +2,7 @@
 Section: games
 Priority: optional
 Maintainer: Luke Faraone l...@faraone.cc
-Build-Depends: cdbs, debhelper (= 7), libwxgtk2.8-dev
+Build-Depends: cdbs, debhelper (= 7), libwxgtk3.0-dev
 DM-Upload-Allowed: yes
 Standards-Version: 3.9.0
 Homepage: http://www.microstupidity.com/chipw/
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.0 +0100
+++ chipw-2.0.6/src/leveleditview.cpp	2014-06-03 01:03:59.311962884 +0200
@@ -210,10 +210,13 @@
 void LevelEditView::OnChangeFilename() {
 if(GetDocument() != NULL  GetFrame() != NULL) {
 wxString name;
-GetDocument()-GetPrintableName(name);
+/*DVD GetDocument()-GetPrintableName(name);*/
+	name=GetDocument()-GetUserReadableName();
 wxString title = wxT(Chip's Workshop);
-if(name)
-title += wxT( - ) + name;
+/* Not needed any more GURN returns default wxString unnamed
+	if(name)
+	*/
+title += wxT( - ) + name;
 if(level != NULL  !level-title.empty())
 title += wxT( () + wxString(level-title.c_str(), wxConvISO8859_1) + wxT());
 if(GetFrame()-IsKindOf(CLASSINFO(wxTopLevelWindow)))
@@ -343,18 +346,18 @@
 std::string title = level-title;
 {
 const wxWX2MBbuf str = dlg.title.mb_str(wxConvISO8859_1);
-if(str != NULL)
+/*DVD mb_str never returns NULL as of wx/string.h:AsChar   if(str != NULL)*/
 title = str;
-else
-wxLogError(wxT(Failed to set level title.));
+/*DVD  mb_str never returns NULL as of wx/string.h:AsChar  else
+wxLogError(wxT(Failed to set level title.));*/
 }
 std::string psw = level-psw;
 {
 const wxWX2MBbuf str = dlg.psw.mb_str(wxConvISO8859_1);
-if(str != NULL)
+/*DVD  mb_str never returns NULL as of wx/string.h:AsChar  if(str != NULL)*/
 psw = str;
-else
-wxLogError(wxT(Failed to set level password.));
+/*DVD  mb_str never returns NULL as of wx/string.h:AsChar  else
+wxLogError(wxT(Failed to set level password.));*/
 }
 wxUint16 chips = level-chips;
 if(dlg.chips.ToULong(ul)  ul  65536)
@@ -369,10 +372,10 @@
 std::string hint = level-hint;
 {
 const wxWX2MBbuf str = dlg.hint.mb_str(wxConvISO8859_1);
-if(str != NULL)
+/*DVD  mb_str never returns NULL as of wx/string.h:AsChar  if(str != NULL)*/
 hint = str;
-else
-wxLogError(wxT(Failed to set level hint.));
+/*DVD  mb_str never returns NULL as of wx/string.h:AsChar  else
+wxLogError(wxT(Failed to set level hint.));*/
 }
 wxUint16 levelnumber = level-levelnumber;
 if(dlg.levnum.ToULong(ul)  ul  65536)
@@ -827,7 +830,7 @@
 wxRegion region(x1, y1, selw * GetTileW(), selh * GetTileH());
 region.Xor(x2, y2, w * GetTileW(), h * GetTileH());
 wxDC* dc = NewClientDC();
-dc-SetClippingRegion(region);
+dc-SetDeviceClippingRegion(region);
 DrawSelection(dc, 0, 0, 32, 32);
 delete dc;
 }
@@ -896,7 +899,12 @@
 
 void LevelEditView::DrawSelection(wxDC* dc, wxUint32 x, wxUint32 y, wxUint32 w, wxUint32 h) {
 if(x  32  y  32  w  0  h  0) {
-int origfunc = dc-GetLogicalFunction();
+/*DVDint origfunc = dc-GetLogicalFunction();*/
+#if wxCHECK_VERSION(2,9,0)
+	wxRasterOperationMode origfunc = dc-GetLogicalFunction();
+#else
+	int origfunc = dc-GetLogicalFunction();
+#endif