Hi Mattia,
please can you explain me the reason for this patch?
http://wxperl.cvs.sourceforge.net/wxperl/wxPerl/ext/docview/cpp/docview.h?r1=1.19&r2=1.20
It seems to break my one and only wxPerl application that makes use of
the doc/view framework.
My documents OnCreate method won't be called anymore, which has worked
perfectly with wxPerl 0.25
So i dived into the depth of debugging xs and wxperl (this drove ne
nuts, but i have learned a lot ;-) ).
What i have discouvered is, that wxPliDocTemplate::CreateDocument
doesn't call the docs OnCreate Method in case of having the document
class by name. The same is true for wxPliDocTemplate::CreateView and the
views OnCreate method. So i translated the missing parts from the
wxWidget sources and patched it to work for me again.
Then i had the idea of looking into the cvs tree (a little bit late, i
kow :-) ) just to see that you have removed aproximatly the same code,
that i have recreated. Now im a little bit puzzled.
Knowing the problem i get my application to work by overloading the
DocTemplates CreateDocument and CreateView functions, but this is a
dirty hack. And so I hope you can put me back on the right trail.
regards,
Gerrit Wichert
ps. this are my patched versions of the two wxPliDocTemplate functions:
wxDocument *wxPliDocTemplate::CreateDocument( const wxString& path, long
flags )
{
dTHX;
wxDocument* doc = 0;
if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback,
"CreateDocument" ) )
{
SV* ret = wxPliVirtualCallback_CallCallback( aTHX_ &m_callback,
G_SCALAR, "Pl", &path,
flags );
doc = (wxDocument*) wxPli_sv_2_object( aTHX_ ret, "Wx::Document" );
SvREFCNT_dec( ret );
}
else
{
if( m_hasDocClassInfo )
return wxDocTemplate::CreateDocument( path, flags );
SV* obj = CallConstructor( m_docClassName );
doc = (wxDocument*)wxPli_sv_2_object( aTHX_ obj, "Wx::Document" );
SvREFCNT_dec( obj );
if (InitDocument( doc, path, flags)) {//gw
return doc; //gw
} else { //gw
return (wxDocument *) NULL; //gw
} //gw
}
return doc;
}
wxView *wxPliDocTemplate::CreateView( wxDocument* doc, long flags )
{
dTHX;
wxView* view = 0;
if( wxPliVirtualCallback_FindCallback( aTHX_ &m_callback,
"CreateView" ) )
{
SV* ret = wxPliVirtualCallback_CallCallback( aTHX_ &m_callback,
G_SCALAR, "Ol", doc,
flags );
view = (wxView*) wxPli_sv_2_object( aTHX_ ret, "Wx::View" );
SvREFCNT_dec( ret );
}
else
{
if( m_hasViewClassInfo )
return wxDocTemplate::CreateView( doc, flags );
SV* obj = CallConstructor( m_viewClassName );
view = (wxView*)wxPli_sv_2_object( aTHX_ obj, "Wx::View" );
SvREFCNT_dec( obj );
view->SetDocument(doc); //gw
if (view->OnCreate( doc, flags)) { //gw
return view; //gw
} else { //gw
delete view; //gw does this work this way?
return (wxView *) NULL; //gw
} //gw
}
return view;
}
|