RE: How to add a new module to Wx
Hi Mattia, Thanks very much for that. It worked perfectly. I don't know whether it's because I'm on Kubuntu, or just that my directory structure is different, but the steps I used were: $ sudo -s $ [password] $ svn co https://wxperl.svn.sourceforge.net/svnroot/wxperl/wxPerl/trunk # Upper case 'P' in the second 'wxPerl' $ cd trunk $ perl Makefile.PL # Lots of errors as per previous emails, but it was successful. $ make $ make test # I'm always a bit nervous of new stuff. $ make install Anyhow, my code is working and displaying a page preview. I can see images inserted into richtext and everything is smooth. I have a presentation on Saturday, and I thought I might not be ready. So my very sincere thanks to both you and Mark. Have a good weekend. Regards. Steve
Re: How to add a new module to Wx
Steve Cookson wrote: Hi, Mark Dootson said: What does aptitude show g++ | grep State: give you? Hi Mark, Good point, I noticed that but I wan't sure it was important. This is what I get. State: not installed. I've now installed it (but I don't understand how it's been working up until now). Anyhow because I had already tried and failed, CPAN wasn't comfortable doing an upgrade, so I did: cpanforce get Wx wxRichTextPrinting is not (yet) in a CPAN release. You should run: $ svn co https://wxperl.svn.sourceforge.net/svnroot/wxperl/wxPerl/trunk wxPerl $ cd wxPerl $ perl Makefile.PL $ make $ make install # or sudo make install Can't locate object method new via package Wx::RichTextPrinting at (perhaps you forgot to load Wx::RichTextPrinting) This is expected, given that the change for wxRichTextPrinting are only in the Subversion repository. HTH, Mattia
RE: How to add a new module to Wx
I don't have full access to everything on Windows, so I need to continue my testing on Linux. OK, now I'm on Linux and I've tried to install from CPAN, I have some errors and 97.01 won't install. Sorry about the length of the dump, but there are some errors at the beginning and at the end. The dump follows, but here are the main errors: 1) Unrecognized argument in LIBS ignored: '-Wl,-Bsymbolic-functions' - this appears on every line. 2) These errors appear to be RichText specific: I'm sure you would have worked this out anyway, but for other readers it's a Brazilian machine and the Portuguese 'Entrando no diretório' means entering directory and 'Saindo do diretório' means exiting directory. touch overload make[1]: Entrando no diretório `/home/steve/.cpan/build/Wx-0.9701-5_cc0Z/ext' make[2]: Entrando no diretório `/home/steve/.cpan/build/Wx-0.9701-5_cc0Z/ext/richtext' cp lib/Wx/RichText.pm ../../blib/lib/Wx/RichText.pm /usr/bin/perl /usr/local/share/perl/5.10.0/ExtUtils/xsubpp -noprototypes -nolinenumbers -typemap /usr/share/perl/5.10/ExtUtils/typemap -typemap ../../typemap -typemap typemap RichText.xs RichText.xsc mv RichText.xsc RichText.c g++ -pthread -c -I. -I../.. -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\0.01\ -DXS_VERSION=\0.01\ -fPIC -I/usr/lib/perl/5.10/CORE -DWXPL_EXT -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ RichText.c /bin/sh: g++: not found make[2]: ** [RichText.o] Erro 127 make[2]: Saindo do diretório `/home/steve/.cpan/build/Wx-0.9701-5_cc0Z/ext/richtext' make[1]: ** [subdirs] Erro 2 make[1]: Saindo do diretório `/home/steve/.cpan/build/Wx-0.9701-5_cc0Z/ext' make: ** [subdirs] Erro 2 MBARBON/Wx-0.9701.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Failed during this command: MBARBON/Wx-0.9701.tar.gz : make NO * Then here is the full dump. Thanks very much. Steve Wx-0.9701/XS/Validators.xs Wx-0.9701/XS/Accelerators.xs Wx-0.9701/XS/Treebook.xsp Wx-0.9701/XS/Icon.xs Wx-0.9701/XS/VListBox.xsp Wx-0.9701/XS/Timer.xs Wx-0.9701/XS/BookCtrl.xsp Wx-0.9701/XS/Slider.xs Wx-0.9701/XS/Menu.xs Wx-0.9701/XS/TaskBarIcon.xs Wx-0.9701/XS/Bitmap.xs Wx-0.9701/XS/Toolbook.xsp Wx-0.9701/XS/ToggleButton.xs Wx-0.9701/XS/SingleChoiceDialog.xs Wx-0.9701/XS/SVGFileDC.xsp Wx-0.9701/XS/StaticBox.xs Wx-0.9701/XS/MessageDialog.xsp Wx-0.9701/XS/PlWindow.xsp Wx-0.9701/XS/RadioBox.xs Wx-0.9701/XS/Stream.xs Wx-0.9701/XS/Animation.xsp Wx-0.9701/XS/TextEntryDialog.xs Wx-0.9701/XS/Frame.xs Wx-0.9701/XS/MultiChoiceDialog.xs Wx-0.9701/XS/Choice.xs Wx-0.9701/XS/HyperlinkCtrl.xsp Wx-0.9701/XS/Cursor.xs Wx-0.9701/XS/CollapsiblePane.xsp Wx-0.9701/XS/ScrollBar.xs Wx-0.9701/XS/Variant.xsp Wx-0.9701/XS/PickerCtrl.xsp Wx-0.9701/XS/FileCtrl.xsp Wx-0.9701/XS/Caret.xs Wx-0.9701/XS/Power.xsp Wx-0.9701/XS/VarHScrollHelper.xsp Wx-0.9701/XS/EvtHandler.xs Wx-0.9701/XS/Gauge.xs Wx-0.9701/XS/ItemContainer.xsp Wx-0.9701/XS/FileDialog.xs Wx-0.9701/XS/Listbook.xsp Wx-0.9701/XS/ToolBar.xs Wx-0.9701/XS/SpinButton.xs Wx-0.9701/XS/Geom.xs Wx-0.9701/XS/VarHVScrollHelper.xsp Wx-0.9701/XS/TextCtrl.xs Wx-0.9701/XS/GraphicsRenderer.xsp Wx-0.9701/XS/SashWindow.xs Wx-0.9701/XS/VarVScrollHelper.xsp Wx-0.9701/XS/DirCtrl.xsp Wx-0.9701/XS/Font.xs Wx-0.9701/XS/Process.xs Wx-0.9701/XS/BitmapComboBox.xsp Wx-0.9701/XS/Constraint.xs Wx-0.9701/XS/TreeCtrl.xs Wx-0.9701/XS/Palette.xs Wx-0.9701/XS/NotificationMessage.xsp Wx-0.9701/XS/GridBagSizer.xsp Wx-0.9701/XS/Locale.xs Wx-0.9701/XS/FontMapper.xs Wx-0.9701/XS/MimeTypes.xsp Wx-0.9701/XS/StaticText.xs Wx-0.9701/XS/ComboPopup.xsp Wx-0.9701/XS/Display.xsp Wx-0.9701/XS/StatusBar.xs Wx-0.9701/XS/ComboCtrl.xsp Wx-0.9701/XS/AnimationCtrl.xsp Wx-0.9701/XS/PopupWindow.xsp Wx-0.9701/XS/ClassInfo.xs Wx-0.9701/XS/Notebook.xs Wx-0.9701/XS/BitmapButton.xs Wx-0.9701/XS/Button.xs Wx-0.9701/XS/Colour.xs Wx-0.9701/XS/GraphicsMatrix.xs Wx-0.9701/XS/CheckBox.xs Wx-0.9701/XS/TextAttr.xsp Wx-0.9701/lib/ Wx-0.9701/lib/Wx/ Wx-0.9701/lib/Wx/Timer.pm Wx-0.9701/lib/Wx/Loader.pod Wx-0.9701/lib/Wx/App.pm Wx-0.9701/lib/Wx/Api.pod Wx-0.9701/lib/Wx/Mini.pm Wx-0.9701/lib/Wx/Locale.pm Wx-0.9701/lib/Wx/RadioBox.pm Wx-0.9701/lib/Wx/Thread.pod Wx-0.9701/lib/Wx/Menu.pm Wx-0.9701/lib/Wx/ArtProvider.pm Wx-0.9701/lib/Wx/Event.pm Wx-0.9701/Constant.xs Wx-0.9701/Event.xs Wx-0.9701/Wx.pm Wx-0.9701/META.yml Wx-0.9701/Controls.xs Wx-0.9701/wxpl.ico Wx-0.9701/wxpl.xpm Wx-0.9701/samples/ Wx-0.9701/samples/minimal/ Wx-0.9701/samples/minimal/minimal.pl Wx-0.9701/samples/trivial/ Wx-0.9701/samples/trivial/trivial.pl Wx-0.9701/samples/dialog/
RE: How to add a new module to Wx
Hi Mark and Mattia, First, a big thank you to both of you, Mark for the wrapping and Mattia for surreptitiously updating it into the RichText demo. I had similar difficulties to Alexander with updating the wxPerl, and so I uninstalled Perl 5.8 and installed 5.10 and then reinstalled wx. I avoided the repository versioning problems by installing Wx-demo and allowing it to chose it's own predecessors. So I'll be spending next week working on it and trying to get a full RTC printout. I'll let you (or of course the wxWidgets people) know of anything I find. Thanks again and have a good weekend. Regards Steve
RE: How to add a new module to Wx
Hi Mark, Thanks again for this. I'm happy to test the revisions you very kindly made. But I'm not clear how to start. I've been happily coding in wxPerl for the last year or so and using Perl as the glue to call other applications, like SWI-Prolog (which is amazing, if you haven't tried it) and Ffmpeg to do simple video editing/processing. wxWidgets has a wonderful array of components like wxMediaCtrl which I use as the front-end to display what Ffmpeg is doing. However, I've not (until now) lifted the bonnet on wxPerl and looked at what makes it tick. If I download the GNU tarball, can I do the usual Makefile.PL, make, make test, make install on it, or is there another way? I'll continue to investigate, but if you get this before I find the answer, I'd be grateful to hear from you. Regards Steve -Original Message- From: Mark Dootson [mailto:mark.doot...@znix.com] Sent: 13 April 2010 14:03 To: wxperl-users@perl.org Cc: Mattia Barbon mattia.bar...@libero.it; Steve Cookson Subject: Re: How to add a new module to Wx Hi, I thought I'd chip in with a populated template for Steve to test. However, basic testing here brought up a problem. wxRichTextPrinting has no wxRTTI information (there's no IMPLEMENT_CLASS macro) so the wxPerl code ( wxPli_object_2_sv ) throws warnings. The attached patch wraps wxRichTextPrinting but is not applied to SVN as the wxRichTextPrinting constructor code is none standard. It does what wxPli_object_2_sv would do if wxRichTextPrinting had ClassInfo. I'm fairly sure this is OK because wxRichTextPrinting inherits directly from wxObject and, as there is no need to wrap wxRichTextPrinting to handle Perl virtual methods, I don't think there is anywhere else in the wxPerl code that would attempt to reference the missing class info. My question to Mattia is, this seems wrong and a bit of a hack. Is there a better way to handle it? I suppose the correct fix is to patch wxRichTextPrinting to implement wxRTTI, but this would not help any existing 2.8.x installations. Some simple usage has been added to wxDemo in SVN. I've tested the patch building and with the basic wxDemo usage on msw/linux/mac with wxWidgets 2.8.10, and all seems to work OK. Apologies to Steve if you have already been tackling this. It wasn't my original intention to just wrap the classes, but solving the above problem meant I ended up with the classes more or less wrapped anyway. Regards Mark On 10/04/2010 09:40, Mattia Barbon wrote: Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some automation/facilitation of the process, but it's not clear to me how it works. I've also never used XS before. Are there some instructions about how to do this available? I'm sure I answered this on the mailing list, but can't find the mails; I just committed some documentation that should at least get you started; see lib/Wx/NewClass.pod. I think that wxRichTextPrinting should be reasonably easy to wrap. Regards, Mattia
Re: How to add a new module to Wx
Hi, If you have a working Perl + compiler combination, then the standard stuff should work :- Download tarball or svn for Alien-wxWidgets: In the source: perl Build.PL perl Build perl Build test perl Build install Download tarball or svn for Wx In the source: perl Makefile.PL perl make perl make test perl make install You'll need the latest ExtUtils::XSpp (0.09) so cpan Extutils::XSpp (or PPM or whatever) first. The crucial thing seems to be the working Perl + compiler combination, which isn't always as straightforward as it might be. There's detail on how the PPMs for Wx are built at http://www.wxperl.co.uk/building/ which may contain useful info, depending on your setup. I think that for most users, if 'cpan' works in general on their setup, then 'cpan Wx' should work too. So building from the tarballs / svn should similarly work OK without further trouble. regards Mark On 14/04/2010 18:52, Steve Cookson wrote: Hi Mark, Thanks again for this. I'm happy to test the revisions you very kindly made. But I'm not clear how to start. I've been happily coding in wxPerl for the last year or so and using Perl as the glue to call other applications, like SWI-Prolog (which is amazing, if you haven't tried it) and Ffmpeg to do simple video editing/processing. wxWidgets has a wonderful array of components like wxMediaCtrl which I use as the front-end to display what Ffmpeg is doing. However, I've not (until now) lifted the bonnet on wxPerl and looked at what makes it tick. If I download the GNU tarball, can I do the usual Makefile.PL, make, make test, make install on it, or is there another way? I'll continue to investigate, but if you get this before I find the answer, I'd be grateful to hear from you. Regards Steve -Original Message- From: Mark Dootson [mailto:mark.doot...@znix.com] Sent: 13 April 2010 14:03 To: wxperl-users@perl.org Cc: Mattia Barbonmattia.bar...@libero.it; Steve Cookson Subject: Re: How to add a new module to Wx Hi, I thought I'd chip in with a populated template for Steve to test. However, basic testing here brought up a problem. wxRichTextPrinting has no wxRTTI information (there's no IMPLEMENT_CLASS macro) so the wxPerl code ( wxPli_object_2_sv ) throws warnings. The attached patch wraps wxRichTextPrinting but is not applied to SVN as the wxRichTextPrinting constructor code is none standard. It does what wxPli_object_2_sv would do if wxRichTextPrinting had ClassInfo. I'm fairly sure this is OK because wxRichTextPrinting inherits directly from wxObject and, as there is no need to wrap wxRichTextPrinting to handle Perl virtual methods, I don't think there is anywhere else in the wxPerl code that would attempt to reference the missing class info. My question to Mattia is, this seems wrong and a bit of a hack. Is there a better way to handle it? I suppose the correct fix is to patch wxRichTextPrinting to implement wxRTTI, but this would not help any existing 2.8.x installations. Some simple usage has been added to wxDemo in SVN. I've tested the patch building and with the basic wxDemo usage on msw/linux/mac with wxWidgets 2.8.10, and all seems to work OK. Apologies to Steve if you have already been tackling this. It wasn't my original intention to just wrap the classes, but solving the above problem meant I ended up with the classes more or less wrapped anyway. Regards Mark On 10/04/2010 09:40, Mattia Barbon wrote: Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some automation/facilitation of the process, but it's not clear to me how it works. I've also never used XS before. Are there some instructions about how to do this available? I'm sure I answered this on the mailing list, but can't find the mails; I just committed some documentation that should at least get you started; see lib/Wx/NewClass.pod. I think that wxRichTextPrinting should be reasonably easy to wrap. Regards, Mattia
RE: How to add a new module to Wx
Hi Mark, Thanks for this. I'll probably take the second option. I'll let you know when I have it working. Do you think it will work on Linux too? Should I know what Alien is? It seems like some sort of framework for installing wxPerl. I looked at the doc on CPAN, but I wasn't much clearer. Regards Steve -Original Message- From: Mark Dootson [mailto:mark.doot...@znix.com] Sent: 14 April 2010 17:44 To: Steve Cookson Cc: wxPerl users Subject: Re: How to add a new module to Wx Hi, If you have a working Perl + compiler combination, then the standard stuff should work :- Download tarball or svn for Alien-wxWidgets: In the source: perl Build.PL perl Build perl Build test perl Build install Download tarball or svn for Wx In the source: perl Makefile.PL perl make perl make test perl make install You'll need the latest ExtUtils::XSpp (0.09) so cpan Extutils::XSpp (or PPM or whatever) first. The crucial thing seems to be the working Perl + compiler combination, which isn't always as straightforward as it might be. There's detail on how the PPMs for Wx are built at http://www.wxperl.co.uk/building/ which may contain useful info, depending on your setup. I think that for most users, if 'cpan' works in general on their setup, then 'cpan Wx' should work too. So building from the tarballs / svn should similarly work OK without further trouble. regards Mark On 14/04/2010 18:52, Steve Cookson wrote: Hi Mark, Thanks again for this. I'm happy to test the revisions you very kindly made. But I'm not clear how to start. I've been happily coding in wxPerl for the last year or so and using Perl as the glue to call other applications, like SWI-Prolog (which is amazing, if you haven't tried it) and Ffmpeg to do simple video editing/processing. wxWidgets has a wonderful array of components like wxMediaCtrl which I use as the front-end to display what Ffmpeg is doing. However, I've not (until now) lifted the bonnet on wxPerl and looked at what makes it tick. If I download the GNU tarball, can I do the usual Makefile.PL, make, make test, make install on it, or is there another way? I'll continue to investigate, but if you get this before I find the answer, I'd be grateful to hear from you. Regards Steve -Original Message- From: Mark Dootson [mailto:mark.doot...@znix.com] Sent: 13 April 2010 14:03 To: wxperl-users@perl.org Cc: Mattia Barbonmattia.bar...@libero.it; Steve Cookson Subject: Re: How to add a new module to Wx Hi, I thought I'd chip in with a populated template for Steve to test. However, basic testing here brought up a problem. wxRichTextPrinting has no wxRTTI information (there's no IMPLEMENT_CLASS macro) so the wxPerl code ( wxPli_object_2_sv ) throws warnings. The attached patch wraps wxRichTextPrinting but is not applied to SVN as the wxRichTextPrinting constructor code is none standard. It does what wxPli_object_2_sv would do if wxRichTextPrinting had ClassInfo. I'm fairly sure this is OK because wxRichTextPrinting inherits directly from wxObject and, as there is no need to wrap wxRichTextPrinting to handle Perl virtual methods, I don't think there is anywhere else in the wxPerl code that would attempt to reference the missing class info. My question to Mattia is, this seems wrong and a bit of a hack. Is there a better way to handle it? I suppose the correct fix is to patch wxRichTextPrinting to implement wxRTTI, but this would not help any existing 2.8.x installations. Some simple usage has been added to wxDemo in SVN. I've tested the patch building and with the basic wxDemo usage on msw/linux/mac with wxWidgets 2.8.10, and all seems to work OK. Apologies to Steve if you have already been tackling this. It wasn't my original intention to just wrap the classes, but solving the above problem meant I ended up with the classes more or less wrapped anyway. Regards Mark On 10/04/2010 09:40, Mattia Barbon wrote: Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some
Re: How to add a new module to Wx
Hi, I thought I'd chip in with a populated template for Steve to test. However, basic testing here brought up a problem. wxRichTextPrinting has no wxRTTI information (there's no IMPLEMENT_CLASS macro) so the wxPerl code ( wxPli_object_2_sv ) throws warnings. The attached patch wraps wxRichTextPrinting but is not applied to SVN as the wxRichTextPrinting constructor code is none standard. It does what wxPli_object_2_sv would do if wxRichTextPrinting had ClassInfo. I'm fairly sure this is OK because wxRichTextPrinting inherits directly from wxObject and, as there is no need to wrap wxRichTextPrinting to handle Perl virtual methods, I don't think there is anywhere else in the wxPerl code that would attempt to reference the missing class info. My question to Mattia is, this seems wrong and a bit of a hack. Is there a better way to handle it? I suppose the correct fix is to patch wxRichTextPrinting to implement wxRTTI, but this would not help any existing 2.8.x installations. Some simple usage has been added to wxDemo in SVN. I've tested the patch building and with the basic wxDemo usage on msw/linux/mac with wxWidgets 2.8.10, and all seems to work OK. Apologies to Steve if you have already been tackling this. It wasn't my original intention to just wrap the classes, but solving the above problem meant I ended up with the classes more or less wrapped anyway. Regards Mark On 10/04/2010 09:40, Mattia Barbon wrote: Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some automation/facilitation of the process, but it's not clear to me how it works. I've also never used XS before. Are there some instructions about how to do this available? I'm sure I answered this on the mailing list, but can't find the mails; I just committed some documentation that should at least get you started; see lib/Wx/NewClass.pod. I think that wxRichTextPrinting should be reasonably easy to wrap. Regards, Mattia Index: Changes === --- Changes (revision 2885) +++ Changes (working copy) @@ -1,5 +1,7 @@ Revision history for Perl extension Wx. +- Wrapped wxRichTextPrinting + 0.9701_01 Tue Mar 30 22:46:33 CEST 2010 - 64 Bit build fixes. - Wrapped wxMenuBar::MacSetCommonMenuBar, MacInstallMenuBar Index: ext/richtext/lib/Wx/RichText.pm === --- ext/richtext/lib/Wx/RichText.pm (revision 2885) +++ ext/richtext/lib/Wx/RichText.pm (working copy) @@ -5,7 +5,7 @@ ## Modified by: ## Created: 05/11/2006 ## RCS-ID: $Id$ -## Copyright: (c) 2006-2007 Mattia Barbon +## Copyright: (c) 2006-2007, 2010 Mattia Barbon ## Licence: This program is free software; you can redistribute it and/or ## modify it under the same terms as Perl itself # @@ -13,6 +13,7 @@ package Wx::RichText; use strict; +use Wx::Print; our $VERSION = '0.01'; @@ -49,6 +50,8 @@ package Wx::RichTextBox; @ISA = qw(Wx::RichTextCompositeObject); package Wx::RichTextParagraphLayoutBox; @ISA = qw(Wx::RichTextBox); package Wx::RichTextBuffer; @ISA = qw(Wx::RichTextParagraphLayoutBox); +package Wx::RichTextPrinting; @ISA = qw(Wx::Object); +package Wx::RichTextHeaderFooterData; @ISA = qw(Wx::Object); package Wx::SymbolPickerDialog; @ISA = qw(Wx::Dialog); package Wx::RichTextStyleOrganiserDialog; @ISA = qw(Wx::Dialog); Index: ext/richtext/RichText.xs === --- ext/richtext/RichText.xs(revision 2885) +++ ext/richtext/RichText.xs(working copy) @@ -80,6 +80,8 @@ INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp -t ../../typemap.xsp XS/RichTextStyleOrganiserDialog.xsp +INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t typemap.xsp -t ../../typemap.xsp XS/RichTextPrinting.xsp + MODULE=Wx__RichText PACKAGE=Wx::RichText void Index: ext/richtext/t/03_threads.t
Re: How to add a new module to Wx
Mark Dootson wrote: Hi, I thought I'd chip in with a populated template for Steve to test. However, basic testing here brought up a problem. wxRichTextPrinting has no wxRTTI information (there's no IMPLEMENT_CLASS macro) so the wxPerl code ( wxPli_object_2_sv ) throws warnings. The attached patch wraps wxRichTextPrinting but is not applied to SVN as the wxRichTextPrinting constructor code is none standard. It does what wxPli_object_2_sv would do if wxRichTextPrinting had ClassInfo. I'm fairly sure this is OK because wxRichTextPrinting inherits directly from wxObject and, as there is no need to wrap wxRichTextPrinting to handle Perl virtual methods, I don't think there is anywhere else in the wxPerl code that would attempt to reference the missing class info. Just a clarification: RTTI is not needed to handle virtual methods, it's required to bless a Perl object into the correct class when there is a C++ method returning a pointer to some base class. For example, in C++, wxWindow::GetParent returns a wxWindow*, but Perl uses the RTTI info to return an object blessed into the subclass the object really belongs to. My question to Mattia is, this seems wrong and a bit of a hack. Is there a better way to handle it? The correct hack is to use O_NON_WXOBJECT(_THR) in the typemap; the result is the same, but you avoid the copy-pasted code in the constructor, and get the correct conversion code in case there is some other method returning a wxRichTextPrinting instance. I suppose the correct fix is to patch wxRichTextPrinting to implement wxRTTI, but this would not help any existing 2.8.x installations. Both correct. Some simple usage has been added to wxDemo in SVN. I've tested the patch building and with the basic wxDemo usage on msw/linux/mac with wxWidgets 2.8.10, and all seems to work OK. Thanks! Mattia On 10/04/2010 09:40, Mattia Barbon wrote: Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some automation/facilitation of the process, but it's not clear to me how it works. I've also never used XS before. Are there some instructions about how to do this available? I'm sure I answered this on the mailing list, but can't find the mails; I just committed some documentation that should at least get you started; see lib/Wx/NewClass.pod. I think that wxRichTextPrinting should be reasonably easy to wrap. Regards, Mattia
Re: How to add a new module to Wx
Steve Cookson wrote: Hi, I'm not sure whether I should be sending this to the group or directly to Mattia Better to the group (it will be in the archives, and there are other people beside me that have some experience in wrapping wxWidgets classes). but I'm trying to understand how to print a wxRichTextCtrl from wxPerl. I understand that wxRichTextPrinting and wxRichTextPrintout are not implemented yet in wxPerl. Correct. So I need to do something to access the original C++ code (maybe wrap or re-write). Re-writing seems to be an easier route as I don't understand the Wx XS framework that Mattia uses. However, it would be a bit anti-social. It would be better to use the current wxPerl framework. I wouldn't call it antisocial, but wrapping the C++ code is definitely more maintainable in the long run. As far as I can see the wxPerl framework is dll driven and provides an XS-based interface to the dlls? Is that right? Correct. There seems to be some automation/facilitation of the process, but it's not clear to me how it works. I've also never used XS before. Are there some instructions about how to do this available? I'm sure I answered this on the mailing list, but can't find the mails; I just committed some documentation that should at least get you started; see lib/Wx/NewClass.pod. I think that wxRichTextPrinting should be reasonably easy to wrap. Regards, Mattia