From: <sm...@us...> - 2008-11-28 19:38:03
|
Revision: 9026 http://plplot.svn.sourceforge.net/plplot/?rev=9026&view=rev Author: smekal Date: 2008-11-28 19:38:00 +0000 (Fri, 28 Nov 2008) Log Message: ----------- Error and abort message only appear if error string is no empty. "Save plot..." submenu only appears if there is any file driver (svg,...) available. Added plot menu with Locate entry (doesn't work at the moment) and "Set Orientation" entry. The latter is only available if the backends to handle the text on their own due to some problems (pls->diorot is set to zero during replot?). Modified Paths: -------------- trunk/drivers/wxwidgets.cpp trunk/drivers/wxwidgets.h trunk/drivers/wxwidgets_app.cpp Modified: trunk/drivers/wxwidgets.cpp =================================================================== --- trunk/drivers/wxwidgets.cpp 2008-11-28 19:22:15 UTC (rev 9025) +++ trunk/drivers/wxwidgets.cpp 2008-11-28 19:38:00 UTC (rev 9026) @@ -780,8 +780,10 @@ *----------------------------------------------------------------------*/ int plD_errorexithandler_wxwidgets( const char *errormessage ) { - wxMessageDialog dialog( 0, wxString(errormessage, *wxConvCurrent),wxString("wxWidgets PLplot App error",*wxConvCurrent),wxOK ); - dialog.ShowModal(); + if( errormessage[0] ) { + wxMessageDialog dialog( 0, wxString(errormessage, *wxConvCurrent),wxString("wxWidgets PLplot App error",*wxConvCurrent),wxOK ); + dialog.ShowModal(); + } return 0; } @@ -795,8 +797,10 @@ *----------------------------------------------------------------------*/ void plD_erroraborthandler_wxwidgets( const char *errormessage ) { - wxMessageDialog dialog( 0,(wxString(errormessage, *wxConvCurrent)+wxString(" aborting operation...", *wxConvCurrent)), wxString("wxWidgets PLplot App abort",*wxConvCurrent), wxOK ); - dialog.ShowModal(); + if( errormessage[0] ) { + wxMessageDialog dialog( 0,(wxString(errormessage, *wxConvCurrent)+wxString(" aborting operation...", *wxConvCurrent)), wxString("wxWidgets PLplot App abort",*wxConvCurrent), wxOK ); + dialog.ShowModal(); + } } Modified: trunk/drivers/wxwidgets.h =================================================================== --- trunk/drivers/wxwidgets.h 2008-11-28 19:22:15 UTC (rev 9025) +++ trunk/drivers/wxwidgets.h 2008-11-28 19:38:00 UTC (rev 9026) @@ -383,6 +383,7 @@ void SetRefreshFlag( bool flag=true ) { refresh=flag; }; bool GetRefreshFlag( void ) { return refresh; }; + void SetOrientation( int rot ); private: void OnPaint( wxPaintEvent& event ); @@ -395,7 +396,7 @@ void Locate( void ); void DrawCrosshair(); - PLStream *m_pls; + PLStream* m_pls; wxPLDevBase* m_dev; /* windows needs to know this structure */ bool refresh; bool xhair_drawn; @@ -424,7 +425,9 @@ DECLARE_EVENT_TABLE() }; -enum { wxPL_Save=10000, wxPL_Next=10100 }; +/* menu ids */ +enum { wxPL_Save=10000, wxPL_Next=10100, wxPL_Locate, wxPL_Orientation_0, wxPL_Orientation_90, + wxPL_Orientation_180, wxPL_Orientation_270 }; /* Use this macro if you want to define your own main() or WinMain() function and call wxEntry() from there. */ Modified: trunk/drivers/wxwidgets_app.cpp =================================================================== --- trunk/drivers/wxwidgets_app.cpp 2008-11-28 19:22:15 UTC (rev 9025) +++ trunk/drivers/wxwidgets_app.cpp 2008-11-28 19:38:00 UTC (rev 9026) @@ -189,15 +189,35 @@ } wxMenu* fileMenu = new wxMenu; + if( m_dev->ndev ) { #if (wxMAJOR_VERSION<=2) & (wxMINOR_VERSION<=6) - fileMenu->Append( -1, wxT("Save plot as..."), saveMenu, wxT("Save this plot as ...!") ); + fileMenu->Append( -1, wxT("Save plot as..."), saveMenu, wxT("Save this plot as ...!") ); #else - fileMenu->AppendSubMenu( saveMenu, wxT("Save plot as..."), wxT("Save this plot as ...!") ); + fileMenu->AppendSubMenu( saveMenu, wxT("Save plot as..."), wxT("Save this plot as ...!") ); #endif + } fileMenu->Append( wxID_EXIT, wxT("E&xit\tAlt-X"), wxT("Exit wxWidgets PLplot App") ); + wxMenu* orientationMenu = new wxMenu; + orientationMenu->Append( wxPL_Orientation_0, wxT("0 deg."), wxT("Orientation 0 deg.") ); + orientationMenu->Append( wxPL_Orientation_90, wxT("90 deg."), wxT("Orientation 90 deg.") ); + orientationMenu->Append( wxPL_Orientation_180, wxT("180 deg."), wxT("Orientation 180 deg.") ); + orientationMenu->Append( wxPL_Orientation_270, wxT("270 deg."), wxT("Orientation 270 deg.") ); + + wxMenu* plotMenu = new wxMenu; + plotMenu->Append( wxPL_Locate, wxT("Locate\tL"), wxT("Enter locate mode") ); + // only add the orientation menu for hershey text processing + if( !pls->dev_text ) { +#if (wxMAJOR_VERSION<=2) & (wxMINOR_VERSION<=6) + plotMenu->Append( -1, wxT("Set Orientation to..."), orientationMenu, wxT("Set the Orientation of the plot!") ); +#else + plotMenu->AppendSubMenu( orientationMenu, wxT("Set Orientation to..."), wxT("Set the Orientation of the plot!") ); +#endif + } + wxMenuBar* menuBar = new wxMenuBar(); menuBar->Append( fileMenu, wxT("&File") ); + menuBar->Append( plotMenu, wxT("&Plot") ); SetMenuBar( menuBar ); SetTitle( wxT("wxWidgets PLplot App") ); @@ -220,6 +240,12 @@ m_dev->exit=true; wxGetApp().ExitMainLoop(); break; + case wxPL_Orientation_0: + case wxPL_Orientation_90: + case wxPL_Orientation_180: + case wxPL_Orientation_270: + m_window->SetOrientation( event.GetId()-wxPL_Orientation_0 ); + break; } size_t index=event.GetId()-wxPL_Save; @@ -653,4 +679,24 @@ } } + +/*---------------------------------------------------------------------- + * void wxPLplotWindow::SetOrientation( int rot ) + * + * Set the orientation of the plot. + *----------------------------------------------------------------------*/ +void wxPLplotWindow::SetOrientation( int rot ) +{ + PLINT bgr, bgg, bgb; /* red, green, blue */ + + //plsstrm( m_pls ); + plsdiori( rot ); + m_dev->resizing = true; + plgcolbg( &bgr, &bgg, &bgb); /* get background color information */ + m_dev->ClearBackground( bgr, bgg, bgb ); + plRemakePlot( m_pls ); + m_dev->resizing = false; + Refresh(); +} + #endif /* PLD_wxwidgets */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |