X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adb85931ab5170068d39ad4ef54157d218bbe8f4..25088f1eea365f0da7aeb565932dd4fe0fd5d20e:/contrib/src/plot/plot.cpp diff --git a/contrib/src/plot/plot.cpp b/contrib/src/plot/plot.cpp index 5f46be05e8..dde86ac78b 100644 --- a/contrib/src/plot/plot.cpp +++ b/contrib/src/plot/plot.cpp @@ -33,6 +33,7 @@ #include "wx/plot/plot.h" #include "wx/bmpbuttn.h" +#include "wx/module.h" #include @@ -53,27 +54,27 @@ // 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!) @@ -135,7 +136,7 @@ wxPlotOnOffCurve::wxPlotOnOffCurve( int offsetY ) 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) @@ -203,7 +204,7 @@ BEGIN_EVENT_TABLE(wxPlotArea, wxWindow) 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; @@ -461,7 +462,7 @@ BEGIN_EVENT_TABLE(wxPlotXAxisArea, wxWindow) 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; @@ -557,14 +558,14 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) ) 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 ); } @@ -588,7 +589,7 @@ BEGIN_EVENT_TABLE(wxPlotYAxisArea, wxWindow) 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; @@ -663,14 +664,14 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) ) 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 ); } @@ -712,7 +713,7 @@ BEGIN_EVENT_TABLE(wxPlotWindow, wxScrolledWindow) 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; @@ -839,6 +840,8 @@ void wxPlotWindow::Delete( wxPlotCurve* curve ) m_area->DeleteCurve( curve ); m_area->Refresh( FALSE ); + + if (curve == m_current) m_current = (wxPlotCurve *) NULL; } wxPlotCurve *wxPlotWindow::GetCurrent() @@ -1049,7 +1052,7 @@ static wxBitmap *GetEnlargeBitmap() 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 @@ -1068,7 +1071,7 @@ static wxBitmap *GetShrinkBitmap() 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 @@ -1087,7 +1090,7 @@ static wxBitmap *GetZoomInBitmap() 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 @@ -1106,7 +1109,7 @@ static wxBitmap *GetZoomOutBitmap() 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 @@ -1125,7 +1128,7 @@ static wxBitmap *GetUpBitmap() 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 @@ -1144,7 +1147,7 @@ static wxBitmap *GetDownBitmap() 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