#include "wx/plot/plot.h"
#include "wx/bmpbuttn.h"
+#include "wx/module.h"
#include <math.h>
// event types
//----------------------------------------------------------------------------
-int wxEVT_PLOT_SEL_CHANGING = wxNewId();
-int wxEVT_PLOT_SEL_CHANGED = wxNewId();
-int wxEVT_PLOT_CLICKED = wxNewId();
-int wxEVT_PLOT_DOUBLECLICKED = wxNewId();
-int wxEVT_PLOT_ZOOM_IN = wxNewId();
-int wxEVT_PLOT_ZOOM_OUT = wxNewId();
-int wxEVT_PLOT_VALUE_SEL_CREATING = wxNewId();
-int wxEVT_PLOT_VALUE_SEL_CREATED = wxNewId();
-int wxEVT_PLOT_VALUE_SEL_CHANGING = wxNewId();
-int wxEVT_PLOT_VALUE_SEL_CHANGED = wxNewId();
-int wxEVT_PLOT_AREA_SEL_CREATING = wxNewId();
-int wxEVT_PLOT_AREA_SEL_CREATED = wxNewId();
-int wxEVT_PLOT_AREA_SEL_CHANGING = wxNewId();
-int wxEVT_PLOT_AREA_SEL_CHANGED = wxNewId();
-int wxEVT_PLOT_BEGIN_X_LABEL_EDIT = wxNewId();
-int wxEVT_PLOT_END_X_LABEL_EDIT = wxNewId();
-int wxEVT_PLOT_BEGIN_Y_LABEL_EDIT = wxNewId();
-int wxEVT_PLOT_END_Y_LABEL_EDIT = wxNewId();
-int wxEVT_PLOT_BEGIN_TITLE_EDIT = wxNewId();
-int wxEVT_PLOT_END_TITLE_EDIT = wxNewId();
-int wxEVT_PLOT_AREA_CREATE = wxNewId();
+const int wxEVT_PLOT_SEL_CHANGING = wxNewEventType();
+const int wxEVT_PLOT_SEL_CHANGED = wxNewEventType();
+const int wxEVT_PLOT_CLICKED = wxNewEventType();
+const int wxEVT_PLOT_DOUBLECLICKED = wxNewEventType();
+const int wxEVT_PLOT_ZOOM_IN = wxNewEventType();
+const int wxEVT_PLOT_ZOOM_OUT = wxNewEventType();
+const int wxEVT_PLOT_VALUE_SEL_CREATING = wxNewEventType();
+const int wxEVT_PLOT_VALUE_SEL_CREATED = wxNewEventType();
+const int wxEVT_PLOT_VALUE_SEL_CHANGING = wxNewEventType();
+const int wxEVT_PLOT_VALUE_SEL_CHANGED = wxNewEventType();
+const int wxEVT_PLOT_AREA_SEL_CREATING = wxNewEventType();
+const int wxEVT_PLOT_AREA_SEL_CREATED = wxNewEventType();
+const int wxEVT_PLOT_AREA_SEL_CHANGING = wxNewEventType();
+const int wxEVT_PLOT_AREA_SEL_CHANGED = wxNewEventType();
+const int wxEVT_PLOT_BEGIN_X_LABEL_EDIT = wxNewEventType();
+const int wxEVT_PLOT_END_X_LABEL_EDIT = wxNewEventType();
+const int wxEVT_PLOT_BEGIN_Y_LABEL_EDIT = wxNewEventType();
+const int wxEVT_PLOT_END_Y_LABEL_EDIT = wxNewEventType();
+const int wxEVT_PLOT_BEGIN_TITLE_EDIT = wxNewEventType();
+const int wxEVT_PLOT_END_TITLE_EDIT = wxNewEventType();
+const int wxEVT_PLOT_AREA_CREATE = wxNewEventType();
//----------------------------------------------------------------------------
// accessor functions for the bitmaps (may return NULL, check for it!)
void wxPlotOnOffCurve::Add( wxInt32 on, wxInt32 off, void *clientData )
{
- wxASSERT_MSG( on > 0, wxT("plot index < 0") );
+ wxASSERT_MSG( on > 0, _T("plot index < 0") );
wxASSERT( on <= off );
if (m_minX == -1)
END_EVENT_TABLE()
wxPlotArea::wxPlotArea( wxPlotWindow *parent )
- : wxWindow( parent, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, "plotarea" )
+ : wxWindow( parent, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("plotarea") )
{
m_owner = parent;
END_EVENT_TABLE()
wxPlotXAxisArea::wxPlotXAxisArea( wxPlotWindow *parent )
- : wxWindow( parent, -1, wxDefaultPosition, wxSize(-1,40), 0, "plotxaxisarea" )
+ : wxWindow( parent, -1, wxDefaultPosition, wxSize(-1,40), 0, _T("plotxaxisarea") )
{
m_owner = parent;
wxString label;
if (range < 50)
{
- label.Printf( wxT("%f"), current );
- while (label.Last() == wxT('0'))
+ label.Printf( _T("%f"), current );
+ while (label.Last() == _T('0'))
label.RemoveLast();
- if ((label.Last() == wxT('.')) || (label.Last() == wxT(',')))
- label.Append( wxT('0') );
+ if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
+ label.Append( _T('0') );
}
else
- label.Printf( wxT("%d"), (int)floor(current) );
+ label.Printf( _T("%d"), (int)floor(current) );
dc.DrawText( label, x-4, 20 );
}
END_EVENT_TABLE()
wxPlotYAxisArea::wxPlotYAxisArea( wxPlotWindow *parent )
- : wxWindow( parent, -1, wxDefaultPosition, wxSize(60,-1), 0, "plotyaxisarea" )
+ : wxWindow( parent, -1, wxDefaultPosition, wxSize(60,-1), 0, _T("plotyaxisarea") )
{
m_owner = parent;
wxString label;
if (range < 50)
{
- label.Printf( wxT("%f"), current );
- while (label.Last() == wxT('0'))
+ label.Printf( _T("%f"), current );
+ while (label.Last() == _T('0'))
label.RemoveLast();
- if ((label.Last() == wxT('.')) || (label.Last() == wxT(',')))
- label.Append( wxT('0') );
+ if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
+ label.Append( _T('0') );
}
else
- label.Printf( wxT("%d"), (int)floor(current) );
+ label.Printf( _T("%d"), (int)floor(current) );
dc.DrawText( label, 5, y-7 );
}
END_EVENT_TABLE()
wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag )
- : wxScrolledWindow( parent, id, pos, size, flag, "plotcanvas" )
+ : wxScrolledWindow( parent, id, pos, size, flag, _T("plotcanvas") )
{
m_xUnitsPerValue = 1.0;
m_xZoom = 1.0;
m_area->DeleteCurve( curve );
m_area->Refresh( FALSE );
+
+ if (curve == m_current) m_current = (wxPlotCurve *) NULL;
}
wxPlotCurve *wxPlotWindow::GetCurrent()
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_enl_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_enl_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_enl_xpm );
#endif
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_shr_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_shr_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_shr_xpm );
#endif
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_zin_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_zin_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_zin_xpm );
#endif
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_zot_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_zot_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_zot_xpm );
#endif
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_up_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_up_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_up_xpm );
#endif
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
#if defined(__WXMSW__) || defined(__WXPM__)
- s_bitmap = new wxBitmap("plot_dwn_bmp", wxBITMAP_TYPE_RESOURCE);
+ s_bitmap = new wxBitmap(_T("plot_dwn_bmp"), wxBITMAP_TYPE_RESOURCE);
#else
s_bitmap = new wxBitmap( plot_dwn_xpm );
#endif