Hi Mattia,

 Well I've wrapped the wxRichTextPrintout modules and they seem to work. 
Do you want to include them in the main wxPerl distribution?  If so, how
will you determine if the quality is OK and they are bug-free?  What is
the process for migration if you are happy with the changes?  

 I should let you know at this stage that there are a few issues, which
are probably more to do with wxWidgets than this wrap, for instance, GetDC
inherited from wxPrintout, doesn't fail (so the inheritance is working),
but appears to return null.  Additionally, there seems to be insufficient
functionality to make the wrap really useful - I'm hoping that this
situation will improve if I wrap more stuff.  However, it does seem to
sort out some minor irritations, like being able to use the SetZoom method
and wxNO_BORDER style on preview, which have been bugging me for a while.

 I am going to cut and paste the changes to the foot of this email and you
can have a think about what you would like to do.  Please let me know what
you think.

 Have a good day.

 Regards 

 Steve 

 CHANGES

 MANIFEST - no changes, I just hijacked Mark's RichTextPrinting files.

 ext/richtext/lib/Wx/RichText.pm

  package Wx::RichTextPrintout;  @ISA = qw(Wx::Printout);

 ext/richtext/t/03_threads.t - added the following:

 my $rtp3 = Wx::RichTextPrintout->new;

 ext/richtext/typemap - added the following:

 wxRichTextPrintout *    O_NON_WXOBJECT_THR

 ext/richtext/typemap.xsp - added the following:

 %typemap{wxRichTextPrintout*}{simple};
 %typemap{int}{simple};
 %typemap{wxDC*}{simple};
 %typemap{wxRect

 ext/richtext/lib/Wx/RichText.pm - added the following:

 package Wx::RichTextPrintout;  @ISA = qw(Wx::Printout);

 ext/richtext/XS/RichTextPrinting.xsp - added the following:

  %name{Wx::RichTextPrintout} class wxRichTextPrintout : public wxPrintout
 {
        wxRichTextPrintout(const wxString
  
     ~wxRichTextPrintout()
         %code%{  wxPli_thread_sv_unregister( aTHX_
"Wx::RichTextPrintout", THIS, ST(0) );
                  delete THIS; %};

 %{
 static void
 wxRichTextPrintout::CLONE()
   CODE:
     wxPli_thread_sv_clone( aTHX_ CLASS,
(wxPliCloneSV)wxPli_detach_object );
 %}

     /// The buffer to print
     void SetRichTextBuffer(wxRichTextBuffer* buffer);
     wxRichTextBuffer* GetRichTextBuffer() const ;

     /// Set/get header/footer data
     void SetHeaderFooterData(const wxRichTextHeaderFooterData
     const wxRichTextHeaderFooterData

     /// Sets margins in 10ths of millimetre. Defaults to 1 inch for
margins.
     void SetMargins(int top = 254, int bottom = 254, int left = 254,
int right = 254);

     /// Calculate scaling and rectangles, setting the device context
scaling
     void CalculateScaling(wxDC* dc, wxRect& textRect, wxRect&
headerRect, wxRect

     // wxPrintout virtual functions
     virtual bool OnPrintPage(int page);
     virtual bool HasPage(int page);
     //virtual void GetPageInfo(int *minPage, int *maxPage, int
*selPageFrom, int *selPageTo);
     virtual bool OnBeginDocument(int startPage, int endPage);
     virtual void OnPreparePrinting();

    
 };

 /home/steve/trunk/ext/richtext/t/03_threads.t - added the following:

 my $rtp2 = Wx::RichTextPrintout->new;
 $rtp2 -> GetDC();         # Inheritance
 #$rtp2 -> SetRichTextBuffer(wxRichTextBuffer* buffer);
 #$rtp2 -> SetHeaderFooterData(const wxRichTextHeaderFooterData
 $rtp2 -> SetMargins(254, 254, 254, 254);
 #$rtp2 -> CalculateScaling(wxDC* dc, wxRect& textRect, wxRect&
headerRect, wxRect
 #$rtp2 -> OnPrintPage(int page);
 $rtp2 -> HasPage(1);
 #$rtp2 -> OnBeginDocument(int startPage, int endPage);
 #$rtp2 -> OnPreparePrinting();
 #$rtp2 -> GetRichTextBuffer();     # Member methods.
 #$rtp2 -> GetHeaderFooterData(); # Member methods.
 #$rtp2 -> OnPreparePrinting();     # Member methods.

 

Reply via email to