|
From: <sm...@us...> - 2008-11-26 21:13:32
|
Revision: 9021
http://plplot.svn.sourceforge.net/plplot/?rev=9021&view=rev
Author: smekal
Date: 2008-11-26 21:13:20 +0000 (Wed, 26 Nov 2008)
Log Message:
-----------
Abort and exit error messages are now shown in a message dialog.
Improved documentation of functions.
Modified Paths:
--------------
trunk/drivers/wxwidgets.cpp
trunk/drivers/wxwidgets_agg.cpp
trunk/drivers/wxwidgets_dc.cpp
Modified: trunk/drivers/wxwidgets.cpp
===================================================================
--- trunk/drivers/wxwidgets.cpp 2008-11-26 18:47:40 UTC (rev 9020)
+++ trunk/drivers/wxwidgets.cpp 2008-11-26 21:13:20 UTC (rev 9021)
@@ -422,10 +422,6 @@
/* set dpi */
plspage(VIRTUAL_PIXELS_PER_IN/dev->scalex, VIRTUAL_PIXELS_PER_IN/dev->scaley, 0, 0, 0, 0);
- /* Set wx error handler for various errors in plplot*/
- /* plsexit(plD_errorexithandler_wxwidgets); */
- /* plsabort(plD_erroraborthandler_wxwidgets); */
-
#ifdef HAVE_FREETYPE
if( dev->freetype )
init_freetype_lv2( pls );
@@ -776,38 +772,31 @@
}
-/*----------------------------------------------------------------------*\
- * int plD_errorexithandler_wxwidgets( char *errormessage )
+/*----------------------------------------------------------------------
+ * int plD_errorexithandler_wxwidgets( const char *errormessage )
*
* If an PLplot error occurs, this function shows a dialog regarding
* this error and than exits.
-\*----------------------------------------------------------------------*/
-int plD_errorexithandler_wxwidgets( char *errormessage )
+ *----------------------------------------------------------------------*/
+int plD_errorexithandler_wxwidgets( const char *errormessage )
{
- /* wxPLDevBase* dev = (wxPLDevBase*)pls->dev; */
+ wxMessageDialog dialog( 0, wxString(errormessage, *wxConvCurrent),wxString("wxWidgets PLplot App error",*wxConvCurrent),wxOK );
+ dialog.ShowModal();
- /* if( dev->ownGUI ) { */
- wxMessageDialog dialog( 0, wxString(errormessage, *wxConvCurrent),wxString("wxPlot error",*wxConvCurrent),wxOK );
- dialog.ShowModal();
- plend();
- return 0;
- /*} */
+ return 0;
}
-/*----------------------------------------------------------------------*\
- * void plD_erroraborthandler_wxwidgets( char *errormessage )
+
+/*----------------------------------------------------------------------
+ * void plD_erroraborthandler_wxwidgets( const char *errormessage )
*
- * If an PLplot error occurs, this function shows a dialog regarding
+ * If PLplot aborts, this function shows a dialog regarding
* this error.
-\*----------------------------------------------------------------------*/
-void plD_erroraborthandler_wxwidgets( char *errormessage )
+ *----------------------------------------------------------------------*/
+void plD_erroraborthandler_wxwidgets( const char *errormessage )
{
- /* wxPLDevBase* dev = (wxPLDevBase*)pls->dev; */
-
- /* if( dev->ownGUI ) { */
- wxMessageDialog dialog( 0,(wxString(errormessage, *wxConvCurrent)+ wxString(" aborting operation...", *wxConvCurrent)), wxString("wxPlot error",*wxConvCurrent), wxOK );
- dialog.ShowModal();
- /* } */
+ wxMessageDialog dialog( 0,(wxString(errormessage, *wxConvCurrent)+wxString(" aborting operation...", *wxConvCurrent)), wxString("wxWidgets PLplot App abort",*wxConvCurrent), wxOK );
+ dialog.ShowModal();
}
@@ -1076,6 +1065,10 @@
dev->ready = true;
+ /* Set wx error handler for various errors in plplot*/
+ plsexit( plD_errorexithandler_wxwidgets );
+ plsabort( plD_erroraborthandler_wxwidgets );
+
/* replay command we may have missed */
plD_bop_wxwidgets( pls );
}
@@ -1112,7 +1105,7 @@
but not for Windows, but it doesn't harm */
wxIdleEvent event;
wxGetApp().AddPendingEvent( event );
- wxGetApp().OnRun(); /* start wxWidgets application */
+ wxGetApp().OnRun(); /* start wxWidgets application */
callOnExit.exit=false;
}
wxCATCH_ALL( wxGetApp().OnUnhandledException(); fprintf(stderr, "Problem running wxWidgets!\n"); exit(0); )
Modified: trunk/drivers/wxwidgets_agg.cpp
===================================================================
--- trunk/drivers/wxwidgets_agg.cpp 2008-11-26 18:47:40 UTC (rev 9020)
+++ trunk/drivers/wxwidgets_agg.cpp 2008-11-26 21:13:20 UTC (rev 9021)
@@ -60,7 +60,12 @@
#define makeunixslash( b ) do { char *I; for( I=b;*I!=0;*I++ ) if( *I=='\\' ) *I='/';} while(0)
-/* Constructor initializes all variables and objects */
+/*--------------------------------------------------------------------------
+ * wxPLDevAGG::wxPLDevAGG()
+ *
+ * Constructor of the AGG wxWidgets device based on the wxPLDevBase
+ * class. Initialisations of variables and objects are done.
+ *--------------------------------------------------------------------------*/
wxPLDevAGG::wxPLDevAGG() :
wxPLDevBase(),
mRenderingBuffer(),
@@ -158,7 +163,11 @@
}
-/* Deconstructor frees allocated buffer */
+/*--------------------------------------------------------------------------
+ * wxPLDevAGG::~wxPLDevAGG()
+ *
+ * Deconstructor frees allocated buffer.
+ *--------------------------------------------------------------------------*/
wxPLDevAGG::~wxPLDevAGG()
{
if( ownGUI )
@@ -167,6 +176,12 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::drawPath( drawPathFlag flag )
+ *
+ * Common function which either draws a stroke along a path or a filled
+ * polygon surrounded by a stroke depending on flag.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::drawPath( drawPathFlag flag )
{
mRasterizer.reset();
@@ -198,6 +213,11 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::DrawLine( short x1a, short y1a, short x2a, short y2a )
+ *
+ * Draw a line from (x1a, y1a) to (x2a, y2a).
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::DrawLine( short x1a, short y1a, short x2a, short y2a )
{
mPath.remove_all();
@@ -211,6 +231,11 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::DrawPolyline( short *xa, short *ya, PLINT npts )
+ *
+ * Draw a poly line - coordinates are in the xa and ya arrays.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::DrawPolyline( short *xa, short *ya, PLINT npts )
{
mPath.remove_all();
@@ -225,6 +250,12 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb,
+ * PLINT x1, PLINT y1, PLINT x2, PLINT y2 )
+ *
+ * Clear parts ((x1,y1) to (x2,y2)) of the background in color (bgr,bgg,bgb).
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::ClearBackground( PLINT bgr, PLINT bgg, PLINT bgb, PLINT x1, PLINT y1, PLINT x2, PLINT y2 )
{
if( x1<0 && y1<0 && x2<0 && y2<0 ) {
@@ -255,6 +286,13 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::AGGAddtoClipRegion( short x1, short y1,
+ * short x2, short y2 )
+ *
+ * Adds the region (x1,y1)-(x2,y2) to the regions which needs to be
+ * updated/redrawn.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::AGGAddtoClipRegion( short x1, short y1, short x2, short y2 )
{
double x1d=x1, x2d=x2, y1d=y1, y2d=y2;
@@ -265,6 +303,11 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::FillPolygon( PLStream *pls )
+ *
+ * Draw a filled polygon.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::FillPolygon( PLStream *pls )
{
short *xa = pls->dev_x;
@@ -284,6 +327,12 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::BlitRectangle( wxPaintDC* dc, int vX, int vY,
+ * int vW, int vH )
+ *
+ * Copy/Blit a rectangle ((vX,vY) to (vX+vW,vY+vH)) into given dc.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::BlitRectangle( wxPaintDC* dc, int vX, int vY, int vW, int vH )
{
if( mBuffer ) {
@@ -296,6 +345,11 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::CreateCanvas( void )
+ *
+ * Create canvas (bitmap and dc) if the driver provides the GUI.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::CreateCanvas()
{
if( ownGUI ) {
@@ -316,12 +370,22 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::SetWidth( PLStream *pls )
+ *
+ * Set the width of the drawing pen.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::SetWidth( PLStream *pls )
{
mStrokeWidth = (scalex+scaley)/2.0*(pls->width>0 ? pls->width : 1); // TODO: why and when ist width 0???
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::SetColor0( PLStream *pls )
+ *
+ * Set color from colormap 0.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::SetColor0( PLStream *pls )
{
mColorRedStroke = pls->cmap0[pls->icol0].r;
@@ -331,6 +395,11 @@
}
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::SetColor1( PLStream *pls )
+ *
+ * Set color from colormap 1.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::SetColor1( PLStream *pls )
{
mColorRedStroke = pls->curcolor.r;
@@ -340,12 +409,12 @@
}
-/*--------------------------------------------------------------------------*\
- * void wx_set_buffer( PLStream* pls, wxImage* dc )
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::SetExternalBuffer( void* dc )
*
- * Adds a dc to the stream. The associated device is attached to the canvas
- * as the property "dev".
-\*--------------------------------------------------------------------------*/
+ * Adds a dc to the device. In that case, the drivers doesn't provide
+ * a GUI. A new buffer (image) will be created and set up.
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::SetExternalBuffer( void* dc )
{
mDC=(wxDC*)dc; /* Add the dc to the device */
@@ -367,18 +436,35 @@
#ifdef HAVE_FREETYPE
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::PutPixel( short x, short y, PLINT color )
+ *
+ * Draw a pixel in color color @ (x,y).
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::PutPixel( short x, short y, PLINT color )
{
mBuffer->SetRGB( x, y, GetRValue(color), GetGValue(color), GetBValue(color) );
AddtoClipRegion( x, y, x, y );
}
+
+/*--------------------------------------------------------------------------
+ * void wxPLDevAGG::PutPixel( short x, short y )
+ *
+ * Draw a pixel in current color @ (x,y).
+ *--------------------------------------------------------------------------*/
void wxPLDevAGG::PutPixel( short x, short y )
{
mBuffer->SetRGB( x, y, mColorRedStroke, mColorGreenStroke, mColorBlueStroke );
AddtoClipRegion( x, y, x, y );
}
+
+/*--------------------------------------------------------------------------
+ * PLINT wxPLDevAGG::GetPixel( short x, short y )
+ *
+ * Get color information from pixel @ (x,y).
+ *--------------------------------------------------------------------------*/
PLINT wxPLDevAGG::GetPixel( short x, short y )
{
return RGB( mBuffer->GetRed( x, y ), mBuffer->GetGreen( x, y ), mBuffer->GetBlue( x, y ) );
Modified: trunk/drivers/wxwidgets_dc.cpp
===================================================================
--- trunk/drivers/wxwidgets_dc.cpp 2008-11-26 18:47:40 UTC (rev 9020)
+++ trunk/drivers/wxwidgets_dc.cpp 2008-11-26 21:13:20 UTC (rev 9021)
@@ -243,7 +243,7 @@
* void wxPLDevDC::SetExternalBuffer( void* dc )
*
* Adds a dc to the device. In that case, the drivers doesn't provide
- * a GUI
+ * a GUI.
*--------------------------------------------------------------------------*/
void wxPLDevDC::SetExternalBuffer( void* dc )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|