Hi Vadim,

>  I've just started looking in using plplot with wxWidgets backend and so
> it's perfectly possible that I'm doing something wrong but it didn't build
> for me out of the box because of a couple of missing headers. To be more
> precise, here is what I did:
>
> 0. Checked out latest (r9437) svn revision under Debian Linux
> 1. Ran "cmake -DDEFAULT_NO_BINDINGS=on -DENABLE_cxx=on -DENABLE_wxwidgets=on\
>    DEFAULT_NO_DEVICES=on PLD_wxwidgets=on ~/src/plplot" in the build
>    directory
> 2. Did make and got errors because of undeclared wxGraphicsContext and
>    wxPaintDC
>
> The trivial patch below fixes them:
>
> diff -r bc2186e13860 bindings/wxwidgets/wxPLplotwindow.cpp
> --- a/bindings/wxwidgets/wxPLplotwindow.cpp     Mon Feb 02 23:25:14 2009 +0100
> +++ b/bindings/wxwidgets/wxPLplotwindow.cpp     Mon Feb 02 23:54:16 2009 +0100
> @@ -22,7 +22,8 @@
>  #include "plplotP.h"
>  #include "wxPLplotwindow.h"
>  #include "wxPLplotstream.h"
> -#include "wx/window.h"
> +#include <wx/window.h>
> +#include <wx/dcclient.h>
>  //#include "wx/log.h"
>
>  BEGIN_EVENT_TABLE( wxPLplotwindow, wxWindow )
> diff -r bc2186e13860 drivers/wxwidgets.h
> --- a/drivers/wxwidgets.h       Mon Feb 02 23:25:14 2009 +0100
> +++ b/drivers/wxwidgets.h       Mon Feb 02 23:54:16 2009 +0100
> @@ -304,6 +304,8 @@
>
>
>  #if wxUSE_GRAPHICS_CONTEXT
> +#include <wx/graphics.h>
> +
>  class wxPLDevGC : public wxPLDevBase
>  {
>  public: /* methods */
>
>
> But I still wonder how did it manage to compile before. The wxPaintDC
> declaration could be included from wx/window.h in the previous wxWidgets
> versions (although this was never guaranteed to work) but wx/graphics.h
> definitely was never included from anywhere else so it's a mystery to me
> how did it work. Anyhow, I hope the patch above can be applied if it seems
> to be the right thing to do.
>   
Thanks for the patch, I'll include it. Actually I'm testing the driver 
"only" with 2.6.4 and 2.8.9 on Ubuntu/Debian, 2.8.4 on Mac OS X and 
2.8.9 on Win32, so I never tried the svn version of wxWidgets. It's 
already a hard job to test it for the cases above ;). Anyway, I think it 
was pure luck that it worked so far.


>
>  And, as I was already patching it anyhow, here is another simple patch
> suppressing the g++ (4.1) warnings about conversions from double to int.
> Again, this might not be totally correct as perhaps rounding was meant
> instead of truncation but as it is, the patch preserves the original
> behaviour while getting rid of the warnings.
>
> diff -r cfa4ac2c8e9e drivers/wxwidgets_gc.cpp
> --- a/drivers/wxwidgets_gc.cpp  Mon Feb 02 23:30:53 2009 +0100
> +++ b/drivers/wxwidgets_gc.cpp  Mon Feb 02 23:55:11 2009 +0100
> @@ -297,8 +297,10 @@
>      m_context->Translate( w, 0 );
>    }
>
> -  textWidth += w;
> -  textHeight = textHeight>(h+yOffset/scaley) ? textHeight : 
> (h+yOffset/scaley);
> +  textWidth += static_cast<int>(w);
> +  textHeight = textHeight>(h+yOffset/scaley)
> +                ? textHeight
> +                : static_cast<int>((h+yOffset/scaley));
>    memset( utf8_string, '\0', max_string_length );
>  }
>
> @@ -314,8 +316,9 @@
>    plP_fci2hex( fci, &fontWeight, PL_FCI_WEIGHT );
>    if( m_font )
>      delete m_font;
> -  m_font=wxFont::New(fontSize*fontScale, fontFamilyLookup[fontFamily],
> -                         fontStyleLookup[fontStyle] & 
> fontWeightLookup[fontWeight] );
> +  m_font=wxFont::New(static_cast<int>(fontSize*fontScale),
> +                     fontFamilyLookup[fontFamily],
> +                     fontStyleLookup[fontStyle] & 
> fontWeightLookup[fontWeight] );
>    m_font->SetUnderlined( underlined );
>    m_context->SetFont( *m_font, wxColour(textRed, textGreen, textBlue) );
>  }
>
>  Thanks,
> VZ
>   
Will have a look at this if rounding is better than truncating, but 
thanks for this patch as well.

Thank you,
Werner

-- 
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria
DVR-Nr: 0005886

email: sme...@iap.tuwien.ac.at
web:   http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office)
       +43-(0)1-58801-13469 (laboratory)
fax:   +43-(0)1-58801-13499


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to