22 #ifndef __WXWIDGETS_H__
23 #define __WXWIDGETS_H__
26 #include <wx/spinctrl.h>
29 #ifdef PL_HAVE_FREETYPE
33 #ifndef max_number_of_grey_levels_used_in_text_smoothing
34 #define max_number_of_grey_levels_used_in_text_smoothing 64
37 #define NDEV 100 // Max number of output device types in menu
51 #define VSCALE ( 40. )
54 #define DEVICE_PIXELS_PER_IN ( 80. )
55 #define VIRTUAL_PIXELS_PER_IN ( DEVICE_PIXELS_PER_IN * VSCALE )
59 #define MM_PER_IN ( 25.4 )
62 #define DEVICE_PIXELS_PER_MM ( DEVICE_PIXELS_PER_IN / MM_PER_IN )
63 #define VIRTUAL_PIXELS_PER_MM ( VIRTUAL_PIXELS_PER_IN / MM_PER_IN )
66 #define CANVAS_WIDTH ( 10.0 )
67 #define CANVAS_HEIGHT ( 7.5 )
70 #define PLOT_WIDTH ( 800 )
71 #define PLOT_HEIGHT ( 600 )
74 #define LOCATE_INVOKED_VIA_API 1
75 #define LOCATE_INVOKED_VIA_DRIVER 2
78 #define wxBACKEND_DC 0
79 #define wxBACKEND_AGG 1
80 #define wxBACKEND_GC 2
92 virtual void DrawLine(
short x1a,
short y1a,
short x2a,
short y2a ) = 0;
96 virtual void BlitRectangle( wxDC* dc,
int vX,
int vY,
int vW,
int vH ) = 0;
103 #ifdef PL_HAVE_FREETYPE
104 virtual void PutPixel(
short x,
short y,
PLINT color ) = 0;
105 virtual void PutPixel(
short x,
short y ) = 0;
106 virtual PLINT GetPixel(
short x,
short y ) = 0;
107 #endif // PL_HAVE_FREETYPE
110 virtual void PSDrawTextToDC(
char* utf8_string,
bool drawText ) = 0;
186 void DrawLine(
short x1a,
short y1a,
short x2a,
short y2a );
190 void BlitRectangle( wxDC* dc,
int vX,
int vY,
int vW,
int vH );
196 #ifdef PL_HAVE_FREETYPE
197 void PutPixel(
short x,
short y,
PLINT color );
198 void PutPixel(
short x,
short y );
199 PLINT GetPixel(
short x,
short y );
200 #endif // PL_HAVE_FREETYPE
213 #include "agg2/agg_basics.h"
214 #include "agg2/agg_rendering_buffer.h"
215 #include "agg2/agg_rasterizer_scanline_aa.h"
216 #include "agg2/agg_scanline_u.h"
217 #include "agg2/agg_scanline_bin.h"
218 #include "agg2/agg_conv_stroke.h"
219 #include "agg2/agg_pixfmt_rgb.h"
220 #include "agg2/agg_renderer_base.h"
221 #include "agg2/agg_renderer_scanline.h"
222 #include "agg2/agg_renderer_primitives.h"
223 #include "agg2/agg_path_storage.h"
224 #include "agg2/agg_conv_curve.h"
225 #include "agg2/agg_conv_contour.h"
226 #include "agg2/agg_font_freetype.h"
231 typedef agg::pixfmt_rgb24 pixFormat;
232 typedef agg::renderer_base<pixFormat> rendererBase;
233 typedef agg::renderer_scanline_aa_solid<rendererBase> rendererSolid;
234 typedef agg::font_engine_freetype_int32 fontEngineType;
235 typedef agg::font_cache_manager<fontEngineType> fontManagerType;
236 typedef agg::font_cache_manager<fontEngineType>::gray8_adaptor_type fontRasterizer;
237 typedef agg::font_cache_manager<fontEngineType>::gray8_scanline_type fontScanline;
238 typedef agg::conv_curve<agg::path_storage> convCurve;
239 typedef agg::conv_stroke<convCurve> convStroke;
240 typedef agg::conv_transform<convCurve> pathTransform;
241 typedef agg::conv_transform<convStroke> strokeTransform;
243 enum drawPathFlag { Fill, Stroke, FillAndStroke };
249 void DrawLine(
short x1a,
short y1a,
short x2a,
short y2a );
253 void BlitRectangle( wxDC* dc,
int vX,
int vY,
int vW,
int vH );
259 #ifdef PL_HAVE_FREETYPE
260 void PutPixel(
short x,
short y,
PLINT color );
261 void PutPixel(
short x,
short y );
262 PLINT GetPixel(
short x,
short y );
263 #endif // PL_HAVE_FREETYPE
267 void drawPath( drawPathFlag flag );
268 void AGGAddtoClipRegion(
short x1,
short y1,
short x2,
short y2 );
273 agg::rendering_buffer mRenderingBuffer;
274 fontEngineType mFontEngine;
275 fontManagerType mFontManager;
276 agg::conv_curve<fontManagerType::path_adaptor_type> mCurves;
277 agg::conv_contour<agg::conv_curve<fontManagerType::path_adaptor_type> > mContour;
279 pixFormat mPixFormat;
280 rendererBase mRendererBase;
281 rendererSolid mRendererSolid;
283 agg::scanline_u8 mScanLine;
284 agg::rasterizer_scanline_aa<> mRasterizer;
285 agg::path_storage mPath;
286 agg::trans_affine mTransform;
288 convCurve mConvCurve;
289 convStroke mConvStroke;
290 pathTransform mPathTransform;
291 strokeTransform mStrokeTransform;
294 wxUint8 mStrokeOpacity;
295 unsigned char mColorRedStroke;
296 unsigned char mColorGreenStroke;
297 unsigned char mColorBlueStroke;
298 unsigned char mColorRedFill;
299 unsigned char mColorGreenFill;
300 unsigned char mColorBlueFill;
308 #if wxUSE_GRAPHICS_CONTEXT
309 #include <wx/graphics.h>
317 void DrawLine(
short x1a,
short y1a,
short x2a,
short y2a );
321 void BlitRectangle( wxDC* dc,
int vX,
int vY,
int vW,
int vH );
327 #ifdef PL_HAVE_FREETYPE
328 void PutPixel(
short x,
short y,
PLINT color );
329 void PutPixel(
short x,
short y );
330 PLINT GetPixel(
short x,
short y );
331 #endif // PL_HAVE_FREETYPE
339 wxGraphicsContext* m_context;
342 unsigned char textRed, textGreen, textBlue;
344 unsigned char mStrokeOpacity;
345 unsigned char mColorRedStroke;
346 unsigned char mColorGreenStroke;
347 unsigned char mColorBlueStroke;
348 unsigned char mColorRedFill;
349 unsigned char mColorGreenFill;
350 unsigned char mColorBlueFill;
367 #define MAX_COMCOUNT 10000
384 void OnIdle( wxIdleEvent& event );
391 DECLARE_EVENT_TABLE()
405 void OnPaint( wxPaintEvent& event );
406 void OnChar( wxKeyEvent& event );
407 void OnIdle( wxIdleEvent& event );
408 void OnErase( wxEraseEvent & WXUNUSED( event ) );
409 void OnSize( wxSizeEvent & WXUNUSED( event ) );
410 void OnMaximize( wxMaximizeEvent & WXUNUSED( event ) );
411 void OnMouse( wxMouseEvent& event );
421 DECLARE_EVENT_TABLE()
430 void OnMenu( wxCommandEvent& event );
431 void OnClose( wxCloseEvent& event );
432 bool SavePlot(
const char* filename,
const char* devname,
int width,
int height );
441 DECLARE_EVENT_TABLE()
454 wxGetSizeDialog( wxWindow *parent, wxWindowID
id,
const wxString &title,
455 const wxPoint& pos = wxDefaultPosition,
456 const wxSize& size = wxDefaultSize,
457 long style = wxDEFAULT_DIALOG_STYLE,
458 int width = 800,
int height = 600 );
468 DECLARE_EVENT_TABLE()
474 #define IMPLEMENT_PLAPP_NO_MAIN( appname ) \
475 wxAppConsole * wxPLCreateApp() \
477 wxAppConsole::CheckBuildOptions( WX_BUILD_OPTIONS_SIGNATURE, \
479 return new appname; \
482 wxAppInitializer( (wxAppInitializerFunction) ( wxApp::GetInitializerFunction() == NULL ? wxPLCreateApp : wxApp::GetInitializerFunction() ) ); \
483 DECLARE_PLAPP( appname ) \
484 appname & wxPLGetApp() { return *wx_static_cast( appname *, wxApp::GetInstance() ); }
486 #define DECLARE_PLAPP( appname ) extern appname &wxPLGetApp();
489 static inline void Use(
void * )
492 #define WX_SUPPRESS_UNUSED_WARN( x ) Use( &x )
532 wxFONTFAMILY_TELETYPE,
548 #endif // __WXWIDGETS_H__
void DrawPolyline(short *xa, short *ya, PLINT npts)
void PSSetFont(PLUNICODE fci)
virtual void ProcessString(PLStream *pls, EscText *args)=0
virtual void CreateCanvas()=0
void SetWidth(PLStream *pls)
virtual void SetColor1(PLStream *pls)=0
void AddFrame(wxPLplotFrame *frame)
wxPLplotWindow * m_window
void SetColor0(PLStream *pls)
void OnMaximize(wxMaximizeEvent &WXUNUSED(event))
void SetRefreshFlag(bool flag=true)
void OnIdle(wxIdleEvent &event)
virtual void SetExternalBuffer(void *buffer)=0
void PLFLT PLINT PLINT PLFLT x
static const int max_string_length
void AddtoClipRegion(int x1, int y1, int x2, int y2)
virtual void DrawPolyline(short *xa, short *ya, PLINT npts)=0
void SetColor1(PLStream *pls)
virtual void SetWidth(PLStream *pls)=0
void OnChar(wxKeyEvent &event)
void OnClose(wxCloseEvent &event)
virtual void DrawLine(short x1a, short y1a, short x2a, short y2a)=0
void OnMouse(wxMouseEvent &event)
void OnIdle(wxIdleEvent &event)
wxPLplotWindow(wxWindow *parent, PLStream *pls)
void SetOrientation(int rot)
void RemoveFrame(wxPLplotFrame *frame)
void PLFLT PLINT PLINT PLFLT PLFLT y
virtual ~wxPLDevBase(void)
void PSDrawTextToDC(char *utf8_string, bool drawText)
void FillPolygon(PLStream *pls)
void SetExitFlag(bool flag=true)
wxPLplotFrame(const wxString &title, PLStream *pls)
virtual void PSSetFont(PLUNICODE fci)=0
bool GetRefreshFlag(void)
wxCoord superscriptHeight
void DrawLine(short x1a, short y1a, short x2a, short y2a)
virtual void SetColor0(PLStream *pls)=0
void ProcessString(PLStream *pls, EscText *args)
virtual void FillPolygon(PLStream *pls)=0
virtual void PSDrawText(PLUNICODE *ucs4, int ucs4Len, bool drawText)
virtual void PSDrawTextToDC(char *utf8_string, bool drawText)=0
void OnPaint(wxPaintEvent &event)
void SetExternalBuffer(void *buffer)
void ClearBackground(PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1=-1, PLINT y1=-1, PLINT x2=-1, PLINT y2=-1)
wxSpinCtrl * spinControlHeight
bool GetAdvanceFlag(void)
void OnSize(wxSizeEvent &WXUNUSED(event))
virtual void ClearBackground(PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1=-1, PLINT y1=-1, PLINT x2=-1, PLINT y2=-1)=0
void OnMenu(wxCommandEvent &event)
void BlitRectangle(wxDC *dc, int vX, int vY, int vW, int vH)
virtual void BlitRectangle(wxDC *dc, int vX, int vY, int vW, int vH)=0
wxGetSizeDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, int width=800, int height=600)
void SetRefreshFlag(bool flag=true)
wxArrayOfwxPLplotFrame FrameArray
bool SavePlot(const char *filename, const char *devname, int width, int height)
bool GetRefreshFlag(void)
wxSpinCtrl * spinControlWidth
void SetAdvanceFlag(bool flag=true)
void SetRefreshFlag(bool flag=true)
void OnErase(wxEraseEvent &WXUNUSED(event))