From: <sm...@us...> - 2008-12-14 20:37:10
|
Revision: 9104 http://plplot.svn.sourceforge.net/plplot/?rev=9104&view=rev Author: smekal Date: 2008-12-14 20:37:02 +0000 (Sun, 14 Dec 2008) Log Message: ----------- Fixed the bug which caused wxPLplotDemo to segfault. Since there is no easy fix for this the AGG backend is disabled for the wxWidgets bindings, wxDC and wxGC backend still work. This was tested on Linux with wxWidgets 2.6.4 and 2.8.9. Another bug showed up, when the window of wxPLplotDemo was sized to a very small size. This bug was also fixed. Also the frame of wxPLplotDemo has a minimum size now. Set ENABLE_wxwidgets to ON again. Modified Paths: -------------- trunk/bindings/wxwidgets/wxPLplotstream.cpp trunk/cmake/modules/wxwidgets.cmake trunk/drivers/wxwidgets_dc.cpp trunk/examples/c++/wxPLplotDemo.cpp Modified: trunk/bindings/wxwidgets/wxPLplotstream.cpp =================================================================== --- trunk/bindings/wxwidgets/wxPLplotstream.cpp 2008-12-14 09:47:14 UTC (rev 9103) +++ trunk/bindings/wxwidgets/wxPLplotstream.cpp 2008-12-14 20:37:02 UTC (rev 9104) @@ -68,7 +68,7 @@ if( m_style & wxPLPLOT_BACKEND_GC ) backend=2; else if ( m_style & wxPLPLOT_BACKEND_AGG ) - backend=1; + backend=0; else backend=0; @@ -81,12 +81,12 @@ SetOpt( "-drvopt", drvopt ); init(); -#ifdef HAVE_AGG - m_image = new wxImage( m_width, m_height ); - cmd( PLESC_DEVINIT, (void*)m_image ); -#else +//#ifdef HAVE_AGG +// m_image = new wxImage( m_width, m_height ); +// cmd( PLESC_DEVINIT, (void*)m_image ); +//#else cmd( PLESC_DEVINIT, (void*)m_dc ); -#endif +//#endif } @@ -116,25 +116,25 @@ the other way round if the buffer size decreases. There is no impact for the other backends. This is kind of hacky, but I have no better idea in the moment */ - if( width*height>m_width*m_height ) { -#ifdef HAVE_AGG - if( m_image ) - delete m_image; - m_image = new wxImage( width, height ); - cmd( PLESC_DEVINIT, (void*)m_image ); -#endif + //~ if( width*height>m_width*m_height ) { +//~ #ifdef HAVE_AGG + //~ if( m_image ) + //~ delete m_image; + //~ m_image = new wxImage( width, height ); + //~ cmd( PLESC_DEVINIT, (void*)m_image ); +//~ #endif wxSize size( width, height ); cmd( PLESC_RESIZE, (void*)&size ); - } else { - wxSize size( width, height ); - cmd( PLESC_RESIZE, (void*)&size ); -#ifdef HAVE_AGG - if( m_image ) - delete m_image; - m_image = new wxImage( width, height ); - cmd( PLESC_DEVINIT, (void*)m_image ); -#endif - } + //~ } else { + //~ wxSize size( width, height ); + //~ cmd( PLESC_RESIZE, (void*)&size ); +//~ #ifdef HAVE_AGG + //~ if( m_image ) + //~ delete m_image; + //~ m_image = new wxImage( width, height ); + //~ cmd( PLESC_DEVINIT, (void*)m_image ); +//~ #endif + //~ } m_width=width; m_height=height; @@ -155,14 +155,14 @@ */ void wxPLplotstream::Update() { -#ifdef HAVE_AGG - if( m_style & wxPLPLOT_BACKEND_AGG ) { - wxMemoryDC MemoryDC; - wxBitmap bitmap( *m_image, -1 ); - MemoryDC.SelectObject( bitmap ); - m_dc->Blit( 0, 0, m_width, m_height, &MemoryDC, 0, 0 ); - MemoryDC.SelectObject( wxNullBitmap ); - } -#endif +//~ #ifdef HAVE_AGG + //~ if( m_style & wxPLPLOT_BACKEND_AGG ) { + //~ wxMemoryDC MemoryDC; + //~ wxBitmap bitmap( *m_image, -1 ); + //~ MemoryDC.SelectObject( bitmap ); + //~ m_dc->Blit( 0, 0, m_width, m_height, &MemoryDC, 0, 0 ); + //~ MemoryDC.SelectObject( wxNullBitmap ); + //~ } +//~ #endif } Modified: trunk/cmake/modules/wxwidgets.cmake =================================================================== --- trunk/cmake/modules/wxwidgets.cmake 2008-12-14 09:47:14 UTC (rev 9103) +++ trunk/cmake/modules/wxwidgets.cmake 2008-12-14 20:37:02 UTC (rev 9104) @@ -89,7 +89,7 @@ if(DEFAULT_NO_BINDINGS) option(ENABLE_wxwidgets "Enable wxwidgets bindings" OFF) else(DEFAULT_NO_BINDINGS) - option(ENABLE_wxwidgets "Enable wxwidgets bindings" OFF) + option(ENABLE_wxwidgets "Enable wxwidgets bindings" ON) endif(DEFAULT_NO_BINDINGS) if(ENABLE_wxwidgets AND NOT PLD_wxwidgets) Modified: trunk/drivers/wxwidgets_dc.cpp =================================================================== --- trunk/drivers/wxwidgets_dc.cpp 2008-12-14 09:47:14 UTC (rev 9103) +++ trunk/drivers/wxwidgets_dc.cpp 2008-12-14 20:37:02 UTC (rev 9104) @@ -346,8 +346,9 @@ if( m_font ) delete m_font; - m_font=wxFont::New((int) (fontSize*fontScale), fontFamilyLookup[fontFamily], - fontStyleLookup[fontStyle] & fontWeightLookup[fontWeight] ); + m_font=wxFont::New((int) (fontSize*fontScale<4 ? 4 : fontSize*fontScale), + fontFamilyLookup[fontFamily], + fontStyleLookup[fontStyle] & fontWeightLookup[fontWeight] ); m_font->SetUnderlined( underlined ); m_dc->SetFont( *m_font ); } Modified: trunk/examples/c++/wxPLplotDemo.cpp =================================================================== --- trunk/examples/c++/wxPLplotDemo.cpp 2008-12-14 09:47:14 UTC (rev 9103) +++ trunk/examples/c++/wxPLplotDemo.cpp 2008-12-14 20:37:02 UTC (rev 9104) @@ -169,7 +169,8 @@ box->Add( plotwindow, 1, wxALL | wxEXPAND, 0 ); panel->SetSizer( box ); - SetSize( 640, 500 ); // set wxWindow size + SetSize( 640, 500 ); // set frame size + SetSizeHints( 220, 150 ); // set minimum frame size Plot(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |