X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8556b795c369382a1f5f2ed9405138a450ecc4a6..a2d541ca9c552d1a30ba75970968a7a220f4955a:/contrib/src/plot/plot.cpp?ds=sidebyside diff --git a/contrib/src/plot/plot.cpp b/contrib/src/plot/plot.cpp index af509c3440..0e210f7b2f 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 @@ -49,6 +50,32 @@ #include "wx/plot/plot_dwn.xpm" #endif +//---------------------------------------------------------------------------- +// event types +//---------------------------------------------------------------------------- + +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!) //---------------------------------------------------------------------------- @@ -60,32 +87,6 @@ static wxBitmap *GetZoomOutBitmap(); static wxBitmap *GetUpBitmap(); static wxBitmap *GetDownBitmap(); -//---------------------------------------------------------------------------- -// event types -//---------------------------------------------------------------------------- - -int wxEVT_PLOT_SEL_CHANGING; -int wxEVT_PLOT_SEL_CHANGED; -int wxEVT_PLOT_CLICKED; -int wxEVT_PLOT_DOUBLECLICKED; -int wxEVT_PLOT_ZOOM_IN; -int wxEVT_PLOT_ZOOM_OUT; -int wxEVT_PLOT_VALUE_SEL_CREATING; -int wxEVT_PLOT_VALUE_SEL_CREATED; -int wxEVT_PLOT_VALUE_SEL_CHANGING; -int wxEVT_PLOT_VALUE_SEL_CHANGED; -int wxEVT_PLOT_AREA_SEL_CREATING; -int wxEVT_PLOT_AREA_SEL_CREATED; -int wxEVT_PLOT_AREA_SEL_CHANGING; -int wxEVT_PLOT_AREA_SEL_CHANGED; -int wxEVT_PLOT_BEGIN_X_LABEL_EDIT; -int wxEVT_PLOT_END_X_LABEL_EDIT; -int wxEVT_PLOT_BEGIN_Y_LABEL_EDIT; -int wxEVT_PLOT_END_Y_LABEL_EDIT; -int wxEVT_PLOT_BEGIN_TITLE_EDIT; -int wxEVT_PLOT_END_TITLE_EDIT; -int wxEVT_PLOT_AREA_CREATE; - //----------------------------------------------------------------------------- // consts //----------------------------------------------------------------------------- @@ -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() @@ -1153,52 +1156,3 @@ static wxBitmap *GetDownBitmap() return s_bitmap; } - -//---------------------------------------------------------------------------- -// wxPlotModule -//---------------------------------------------------------------------------- - -class wxPlotModule : public wxModule -{ -public: - bool OnInit(); - void OnExit(); - -private: - DECLARE_CLASS(wxPlotModule) -}; - -IMPLEMENT_DYNAMIC_CLASS(wxPlotModule, wxModule) - -bool wxPlotModule::OnInit() -{ - wxEVT_PLOT_SEL_CHANGING = wxNewId(); - wxEVT_PLOT_SEL_CHANGED = wxNewId(); - wxEVT_PLOT_CLICKED = wxNewId(); - wxEVT_PLOT_DOUBLECLICKED = wxNewId(); - wxEVT_PLOT_ZOOM_IN = wxNewId(); - wxEVT_PLOT_ZOOM_OUT = wxNewId(); - wxEVT_PLOT_VALUE_SEL_CREATING = wxNewId(); - wxEVT_PLOT_VALUE_SEL_CREATED = wxNewId(); - wxEVT_PLOT_VALUE_SEL_CHANGING = wxNewId(); - wxEVT_PLOT_VALUE_SEL_CHANGED = wxNewId(); - wxEVT_PLOT_AREA_SEL_CREATING = wxNewId(); - wxEVT_PLOT_AREA_SEL_CREATED = wxNewId(); - wxEVT_PLOT_AREA_SEL_CHANGING = wxNewId(); - wxEVT_PLOT_AREA_SEL_CHANGED = wxNewId(); - wxEVT_PLOT_BEGIN_X_LABEL_EDIT = wxNewId(); - wxEVT_PLOT_END_X_LABEL_EDIT = wxNewId(); - wxEVT_PLOT_BEGIN_Y_LABEL_EDIT = wxNewId(); - wxEVT_PLOT_END_Y_LABEL_EDIT = wxNewId(); - wxEVT_PLOT_BEGIN_TITLE_EDIT = wxNewId(); - wxEVT_PLOT_END_TITLE_EDIT = wxNewId(); - wxEVT_PLOT_AREA_CREATE = wxNewId(); - - return TRUE; -} - -void wxPlotModule::OnExit() -{ -} - -