~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to drivers/README.wxwidgets

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 
 
3
Installation instructions for Unix
 
4
1) Install the wxwidgets library either by compiling it yourself or using apt/rpm (2.6.0 is needed)
 
5
   + compile it yourself:
 
6
     - Download wxWidgets 2.6.1 from http://www.wxwidgets.org (wxGTK package)
 
7
     - Untar it to a folder and cd into the main dir.
 
8
     - Make a directory called "buildgtk". Cd into buildgtk
 
9
     - Run: ../configure --disable-debug --enable-gtk2 --enable-monolithic --enable-shared
 
10
     - Run: make
 
11
     - Run: sudo make install (library and developer files are installed to /usr/local)
 
12
2) Install at least automake 1.82 and libtool 1.4
 
13
3) download plplot 5.5.3 from cvs
 
14
4) build plplot library
 
15
   - cd into plplot main directory
 
16
   - run: cf/bootstrap.sh
 
17
   - run: ./configure --enable-wxwidgets
 
18
   - run: make
 
19
   - run: sudo make install
 
20
   - run: cd examples/c
 
21
   - run: make x01c 
 
22
   - run: ./x01c
 
23
 
 
24
Installation instructions for Mac OS X
 
25
1) Install the wxwidgets library either by compiling it yourself or using the opendarwin port
 
26
   + Mac OS X G++ Compiler
 
27
     - Download wxWidgets 2.6.1 from http://www.wxwidgets.org (wxMAC package).
 
28
     - Untar it to a folder and cd into the main dir.
 
29
     - Make a directory called "buildosx". cd into "buildosx".
 
30
     - Run: ../configure --disable-debug --enable-monolithic --enable-shared
 
31
     - Run: make 
 
32
     - Run: sudo make install (library and developer files are installed to /usr/local)
 
33
     OR
 
34
     - download and install the port package from http://darwinports.opendarwin.org
 
35
     - add
 
36
                    PATH=/opt/local/bin:$PATH
 
37
                          MANPATH=/opt/local/share/man:$MANPATH
 
38
                                INFOPATH=/opt/local/share/info:$INFOPATH
 
39
                 to your ".profile" file in your home directory.
 
40
         - run: sudo port -d selfupdate
 
41
           - run: sudo port install wxWidgets (library and developer files are installed to /opt/local)
 
42
2) Install at least automake 1.82 and libtool 1.4, e.g. via opendarwin port:
 
43
   - download and install the port package from http://darwinports.opendarwin.org
 
44
   - add
 
45
                    PATH=/opt/local/bin:$PATH
 
46
                          MANPATH=/opt/local/share/man:$MANPATH
 
47
                                INFOPATH=/opt/local/share/info:$INFOPATH
 
48
                 to your ".profile" file in your home directory.
 
49
         - run: sudo port -d selfupdate
 
50
         - run: sudo port install automake
 
51
         - run: sudo port install libtool
 
52
         - run: sudo ln -s /opt/local/bin/glibtool /opt/local/bin/libtool
 
53
         - run: sudo ln -s /opt/local/bin/glibtoolize /opt/local/bin/libtoolize
 
54
3) download plplot 5.5.3 from cvs
 
55
4) build plplot library
 
56
   - cd into plplot main directory
 
57
   - run: cf/bootstrap.sh
 
58
   - run: ./configure --enable-wxwidgets --with-wxwidgets-bindir=/opt/local/bin (port)
 
59
     OR
 
60
     run: ./configure --enable-wxwidgets (self compiled in /usr/local)
 
61
   - run: make 
 
62
   - run: sudo make install
 
63
   - run: cd examples/c
 
64
   - run: make x01c 
 
65
   - run: ./x01c
 
66
 
 
67
 
 
68
--------- Using the driver in a wxWidgets Application -------------------------------------
 
69
 
 
70
The wxWidgets driver is already capable of redirecting the plot to any canvas (wxDC), which can also be provided by a wxApp. The API is not quite ready for release, but it's easy to implement. First we need to inherit a class from plstream
 
71
 
 
72
 
 
73
#include "plplotP.h"
 
74
#include "plstream.h"
 
75
#include "wx/dc.h"
 
76
 
 
77
class wxPLplotstream : public plstream
 
78
{
 
79
public:
 
80
  wxPLplotstream( wxDC *dc, int width, int height );  //!< Constructor.
 
81
  void set_stream();   //!< Calls some code before every PLplot command.
 
82
        void SetSize( int width, int height );   //!< Set new size of plot area.
 
83
        void RenewPlot();   //!< Redo plot.
 
84
private:
 
85
        wxDC* m_dc;   //!< Pointer to wxDC to plot into.
 
86
        int m_width;   //!< Width of dc/plot area.
 
87
        int m_height;   //!< Height of dc/plot area.
 
88
};
 
89
 
 
90
 
 
91
wxPLplotstream::wxPLplotstream( wxDC *dc, int width, int height ) : 
 
92
                m_dc(dc), m_width(width), m_height(height)
 
93
{
 
94
  ::plstream();
 
95
  sdev( "wxwidgets" );
 
96
  spage( 0.0, 0.0, m_width, m_height, 0, 0 );
 
97
  SetOpt( "text", "1" ); // use freetype?
 
98
  SetOpt( "smooth", "1" );  // antialiased text?
 
99
  init();
 
100
  plP_esc( PLESC_DEVINIT, (void*)m_dc );
 
101
}
 
102
 
 
103
void wxPLplotstream::set_stream()
 
104
{
 
105
  plstream::set_stream();
 
106
}
 
107
 
 
108
void wxPLplotstream::SetSize( int width, int height )
 
109
{
 
110
        m_width=width;
 
111
        m_height=height;
 
112
  plP_esc( PLESC_CLEAR, NULL );
 
113
  wxSize size( m_width, m_height );
 
114
  plP_esc( PLESC_RESIZE, (void*)&size );
 
115
}
 
116
 
 
117
void wxPLplotstream::RenewPlot()
 
118
{
 
119
  plP_esc( PLESC_CLEAR, NULL );
 
120
  replot();
 
121
}
 
122
 
 
123
 
 
124
In the wxWidgets application a wxMemoryDC must be created (e.g. in the constructor of a wxWindow) and made known to the driver, e.g.
 
125
 
 
126
 
 
127
        MemPlotDC = new wxMemoryDC;
 
128
  MemPlotDCBitmap = new wxBitmap( 640, 400, -1 );
 
129
  MemPlotDC->SelectObject( *MemPlotDCBitmap );
 
130
        my_stream = new wxPLplotstream( (wxDC*)MemPlotDC, MemPlotDC_width, MemPlotDC_height );
 
131
 
 
132
 
 
133
The OnPaint() event handler looks like this (double buffering is used here)
 
134
 
 
135
 
 
136
void plotwindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
 
137
{
 
138
  int width, height;
 
139
  GetSize( &width, &height );
 
140
 
 
141
        // Check if we window was resized (or dc is invalid)
 
142
        if( (my_stream == NULL) || (MemPlotDC_width!=width) || (MemPlotDC_height!=height) ) {
 
143
    MemPlotDC->SelectObject( wxNullBitmap );
 
144
    if( MemPlotDCBitmap )
 
145
      delete MemPlotDCBitmap;
 
146
    MemPlotDCBitmap = new wxBitmap( width, height, -1 );
 
147
    MemPlotDC->SelectObject( *MemPlotDCBitmap );
 
148
                my_stream->SetSize( width, height );
 
149
    my_stream->replot();
 
150
    MemPlotDC_width = width;
 
151
    MemPlotDC_height = height;
 
152
        }
 
153
 
 
154
  wxPaintDC dc( this );
 
155
        dc.SetClippingRegion( GetUpdateRegion() );
 
156
  dc.BeginDrawing();
 
157
  dc.Blit( 0, 0, width, height, MemPlotDC, 0, 0 );
 
158
  dc.EndDrawing();
 
159
}
 
160
 
 
161
The whole PLplot API is then available via the my_stream object.
 
162
 
 
163
 
 
164
--------- don't bother with stuff below this line -----------------------------------------
 
165
 
 
166
 
 
167
Installation instructions for Win32
 
168
 
 
169
- install wxWidgets 2.6.1 (see instructions below)
 
170
- NOT WORKING NOW: install gd library and/or freetype library (see instructions below)
 
171
- download the PLplot library from plplot.sf.net (version 5.5.3)
 
172
- Remark (Mac OS X): You need automake 1.8.2 and libtool 1.4 in order to compile PLplot.
 
173
                     Download and install fink (fink.sf.net) and install these programs. 
 
174
- untar or unzip it in a suitable directory
 
175
- unzip or untar the wxPLplot package in sys/win32
 
176
- cd into sys/win32/wxplplot
 
177
 
 
178
- WIN32:
 
179
  . Set WXWIN environment variable (see wxWidgets instructions).
 
180
  . For all compilers you need the mingw32-make program (www.mingw.org).
 
181
  . Check the settings in config.mak.
 
182
  . Run: mingw32-make COMPILER=bcc
 
183
  .  or: mingw32-make COMPILER=gcc
 
184
  . Run: cd examples
 
185
  . Run: mingw32-make COMPILER=bcc
 
186
  .  or: mingw32-make COMPILER=gcc
 
187
  
 
188
 
 
189
 
 
190
 
 
191
Install the gd library for png, gif and jpeg drivers (Win32, NOT WORKING NOW)
 
192
 
 
193
- goto http://www.boutell.com/gd/ and download the precompiled Windows DLL at
 
194
  the bottom ( http://www.boutell.com/gd/http/gdwin32.zip )
 
195
- extract to sys/win32/wxplplot
 
196
- enter sys/win32/wxplplot/gdwin32 and make a library from the dll
 
197
  Borland BCC 5.5: implib -a bgd_bcc.lib bgd.dll
 
198
  VC++: lib /machine:i386 /def:bgd.def
 
199
  MingW: already in gdwin32 (libbgd.a)
 
200
  
 
201
Install the freetype library (Win32, NOT WORKING NOW)
 
202
 
 
203
 
 
204
Install wxWidgets 2.6.1
 
205
 
 
206
 + Win32 MingW Compiler
 
207
 - Download the necessary files from www.mingw.org. Either the whole package mingw-3.1.0 or
 
208
   the canditate releases from at least gcc-core, gcc-g++, binutils, mingw-runtime, w32api,
 
209
   mingw-utils, mingw32-make and gdb. Install them in a directory and set the path file accordingly.
 
210
 - Download wxWidgets 2.6.1 from http://www.wxwidgets.org (wxMSW package).
 
211
 -  Unzip it to a folder and set the WXWIN variable accordingly (system wide in System Settings/System).
 
212
 - Goto %WXWIN%/build/msw.
 
213
 - Run all or some of the following commands:
 
214
   mingw32-make -f makefile.gcc BUILD=debug MONOLITHIC=1 SHARED=1
 
215
     The wxWidgets (debug, shared) library will be build. 
 
216
   mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 SHARED=1
 
217
     The wxWidgets (release, shared) library will be build. 
 
218
   mingw32-make -f makefile.gcc BUILD=debug MONOLITHIC=1 SHARED=0
 
219
     The wxWidgets (debug, static) library will be build. 
 
220
   mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 SHARED=0.
 
221
     The wxWidgets (release, static) library will be build. 
 
222
 - Copy both dlls from %%WXWIN%/lib/gcc_dll to a directory, where they can be found (e.g. sys/win32/wxplplot/examples directory).
 
223
 - The same WXWIN variable must than be set for the wxplplot makefile.
 
224
 
 
225
 + Win32 Borland free command line tools (BCC 5.5.2)
 
226
 - Install the Borland Compiler.
 
227
 - Download wxWidgets 2.6.1 from http://www.wxwidgets.org (wxMSW package)
 
228
 -  Unzip it to a folder and set the WXWIN variable accordingly (system wide in System Settings/System).
 
229
 - Goto %WXWIN%/build/msw.
 
230
 - Run all or some of the following commands:
 
231
   make -f makefile.bcc -DBUILD=debug -DMONOLITHIC=1 -DSHARED=1
 
232
     The wxWidgets (debug, shared) library will be build. 
 
233
   make -f makefile.bcc -DBUILD=release -DMONOLITHIC=1 -DSHARED=1
 
234
     The wxWidgets (release, shared) library will be build. 
 
235
   make -f makefile.bcc -DBUILD=debug -DMONOLITHIC=1 -DSHARED=0
 
236
     The wxWidgets (debug, static) library will be build. 
 
237
   make -f makefile.bcc -DBUILD=release -DMONOLITHIC=1 -DSHARED=0.
 
238
     The wxWidgets (release, static) library will be build. 
 
239
 - Copy both dlls from %%WXWIN%/lib/gcc_dll to a directory, where they can be found (e.g. sys/win32/wxplplot/examples directory).
 
240
 - The same WXWIN variable must than be set for the wxplplot makefile.
 
241