Layout fixes for wxPlotWindow [#1192416] + source cleaning to the wxW 2.6 coding starndards.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -138,7 +138,7 @@ public:
|
|||||||
{ m_offsetY = offsetY; }
|
{ m_offsetY = offsetY; }
|
||||||
int GetOffsetY()
|
int GetOffsetY()
|
||||||
{ return m_offsetY; }
|
{ return m_offsetY; }
|
||||||
|
|
||||||
void SetPenNormal( const wxPen &pen )
|
void SetPenNormal( const wxPen &pen )
|
||||||
{ m_penNormal = pen; }
|
{ m_penNormal = pen; }
|
||||||
void SetPenSelected( const wxPen &pen )
|
void SetPenSelected( const wxPen &pen )
|
||||||
@@ -185,10 +185,10 @@ public:
|
|||||||
{ m_offsetY = offsetY; }
|
{ m_offsetY = offsetY; }
|
||||||
int GetOffsetY()
|
int GetOffsetY()
|
||||||
{ return m_offsetY; }
|
{ return m_offsetY; }
|
||||||
|
|
||||||
void Add( wxInt32 on, wxInt32 off, void *clientData = NULL );
|
void Add( wxInt32 on, wxInt32 off, void *clientData = NULL );
|
||||||
size_t GetCount();
|
size_t GetCount();
|
||||||
|
|
||||||
wxInt32 GetOn( size_t index );
|
wxInt32 GetOn( size_t index );
|
||||||
wxInt32 GetOff( size_t index );
|
wxInt32 GetOff( size_t index );
|
||||||
void* GetClientData( size_t index );
|
void* GetClientData( size_t index );
|
||||||
@@ -201,7 +201,7 @@ private:
|
|||||||
int m_offsetY;
|
int m_offsetY;
|
||||||
wxInt32 m_minX;
|
wxInt32 m_minX;
|
||||||
wxInt32 m_maxX;
|
wxInt32 m_maxX;
|
||||||
|
|
||||||
wxArrayPlotOnOff m_marks;
|
wxArrayPlotOnOff m_marks;
|
||||||
|
|
||||||
DECLARE_CLASS(wxPlotOnOffCurve)
|
DECLARE_CLASS(wxPlotOnOffCurve)
|
||||||
@@ -302,7 +302,7 @@ public:
|
|||||||
|
|
||||||
void Add( wxPlotOnOffCurve *curve );
|
void Add( wxPlotOnOffCurve *curve );
|
||||||
void Delete( wxPlotOnOffCurve* curve );
|
void Delete( wxPlotOnOffCurve* curve );
|
||||||
|
|
||||||
size_t GetOnOffCurveCount();
|
size_t GetOnOffCurveCount();
|
||||||
wxPlotOnOffCurve *GetOnOffCurveAt( size_t n );
|
wxPlotOnOffCurve *GetOnOffCurveAt( size_t n );
|
||||||
|
|
||||||
@@ -326,12 +326,12 @@ public:
|
|||||||
// options
|
// options
|
||||||
// -------
|
// -------
|
||||||
|
|
||||||
void SetScrollOnThumbRelease( bool scrollOnThumbRelease = TRUE )
|
void SetScrollOnThumbRelease( bool scrollOnThumbRelease = true )
|
||||||
{ m_scrollOnThumbRelease = scrollOnThumbRelease; }
|
{ m_scrollOnThumbRelease = scrollOnThumbRelease; }
|
||||||
bool GetScrollOnThumbRelease()
|
bool GetScrollOnThumbRelease()
|
||||||
{ return m_scrollOnThumbRelease; }
|
{ return m_scrollOnThumbRelease; }
|
||||||
|
|
||||||
void SetEnlargeAroundWindowCentre( bool enlargeAroundWindowCentre = TRUE )
|
void SetEnlargeAroundWindowCentre( bool enlargeAroundWindowCentre = true )
|
||||||
{ m_enlargeAroundWindowCentre = enlargeAroundWindowCentre; }
|
{ m_enlargeAroundWindowCentre = enlargeAroundWindowCentre; }
|
||||||
bool GetEnlargeAroundWindowCentre()
|
bool GetEnlargeAroundWindowCentre()
|
||||||
{ return m_enlargeAroundWindowCentre; }
|
{ return m_enlargeAroundWindowCentre; }
|
||||||
@@ -368,7 +368,7 @@ private:
|
|||||||
|
|
||||||
wxList m_curves;
|
wxList m_curves;
|
||||||
wxList m_onOffCurves;
|
wxList m_onOffCurves;
|
||||||
|
|
||||||
wxPlotArea *m_area;
|
wxPlotArea *m_area;
|
||||||
wxPlotXAxisArea *m_xaxis;
|
wxPlotXAxisArea *m_xaxis;
|
||||||
wxPlotYAxisArea *m_yaxis;
|
wxPlotYAxisArea *m_yaxis;
|
||||||
@@ -389,51 +389,51 @@ typedef void (wxEvtHandler::*wxPlotEventFunction)(wxPlotEvent&);
|
|||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_EVENT_TYPES
|
#if WXWIN_COMPATIBILITY_EVENT_TYPES
|
||||||
|
|
||||||
#define EVT_PLOT(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_SEL_CHANGING(id, fn) { wxEVT_PLOT_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_SEL_CHANGING(id, fn) { wxEVT_PLOT_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_SEL_CHANGED(id, fn) { wxEVT_PLOT_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_SEL_CHANGED(id, fn) { wxEVT_PLOT_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_CLICKED(id, fn) { wxEVT_PLOT_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_CLICKED(id, fn) { wxEVT_PLOT_CLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_DOUBLECLICKED(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_DOUBLECLICKED(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_ZOOM_IN(id, fn) { wxEVT_PLOT_ZOOM_IN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_ZOOM_IN(id, fn) { wxEVT_PLOT_ZOOM_IN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_ZOOM_OUT(id, fn) { wxEVT_PLOT_ZOOM_OUT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_ZOOM_OUT(id, fn) { wxEVT_PLOT_ZOOM_OUT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_VALUE_SEL_CREATING(id, fn) { wxEVT_PLOT_VALUE_SEL_CREATING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_VALUE_SEL_CREATING(id, fn) { wxEVT_PLOT_VALUE_SEL_CREATING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_VALUE_SEL_CREATED(id, fn) { wxEVT_PLOT_VALUE_SEL_CREATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_VALUE_SEL_CREATED(id, fn) { wxEVT_PLOT_VALUE_SEL_CREATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_VALUE_SEL_CHANGING(id, fn) { wxEVT_PLOT_VALUE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_VALUE_SEL_CHANGING(id, fn) { wxEVT_PLOT_VALUE_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_VALUE_SEL_CHANGED(id, fn) { wxEVT_PLOT_VALUE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_VALUE_SEL_CHANGED(id, fn) { wxEVT_PLOT_VALUE_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_AREA_SEL_CREATING(id, fn) { wxEVT_PLOT_AREA_SEL_CREATING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_AREA_SEL_CREATING(id, fn) { wxEVT_PLOT_AREA_SEL_CREATING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_AREA_SEL_CREATED(id, fn) { wxEVT_PLOT_AREA_SEL_CREATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_AREA_SEL_CREATED(id, fn) { wxEVT_PLOT_AREA_SEL_CREATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_AREA_SEL_CHANGING(id, fn) { wxEVT_PLOT_AREA_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_AREA_SEL_CHANGING(id, fn) { wxEVT_PLOT_AREA_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_AREA_SEL_CHANGED(id, fn) { wxEVT_PLOT_AREA_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_AREA_SEL_CHANGED(id, fn) { wxEVT_PLOT_AREA_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_BEGIN_X_LABEL_EDIT(id, fn) { wxEVT_PLOT_BEGIN_X_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_BEGIN_X_LABEL_EDIT(id, fn) { wxEVT_PLOT_BEGIN_X_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_END_X_LABEL_EDIT(id, fn) { wxEVT_PLOT_END_X_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_END_X_LABEL_EDIT(id, fn) { wxEVT_PLOT_END_X_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_BEGIN_Y_LABEL_EDIT(id, fn) { wxEVT_PLOT_BEGIN_Y_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_BEGIN_Y_LABEL_EDIT(id, fn) { wxEVT_PLOT_BEGIN_Y_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_END_Y_LABEL_EDIT(id, fn) { wxEVT_PLOT_END_Y_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_END_Y_LABEL_EDIT(id, fn) { wxEVT_PLOT_END_Y_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_BEGIN_TITLE_EDIT(id, fn) { wxEVT_PLOT_BEGIN_TITLE_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_BEGIN_TITLE_EDIT(id, fn) { wxEVT_PLOT_BEGIN_TITLE_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
#define EVT_PLOT_END_TITLE_EDIT(id, fn) { wxEVT_PLOT_END_TITLE_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
#define EVT_PLOT_END_TITLE_EDIT(id, fn) { wxEVT_PLOT_END_TITLE_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define EVT_PLOT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_DOUBLECLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_CLICKED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_CLICKED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_CLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_DOUBLECLICKED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_DOUBLECLICKED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_DOUBLECLICKED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_ZOOM_IN(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_ZOOM_IN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_ZOOM_IN(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_ZOOM_IN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_ZOOM_OUT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_ZOOM_OUT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_ZOOM_OUT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_ZOOM_OUT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_VALUE_SEL_CREATING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CREATING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_VALUE_SEL_CREATING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CREATING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_VALUE_SEL_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CREATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_VALUE_SEL_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CREATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_VALUE_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_VALUE_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_VALUE_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_VALUE_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_VALUE_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_AREA_SEL_CREATING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CREATING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_AREA_SEL_CREATING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CREATING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_AREA_SEL_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CREATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_AREA_SEL_CREATED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CREATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_AREA_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_AREA_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CHANGING, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_AREA_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_AREA_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_AREA_SEL_CHANGED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_BEGIN_X_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_X_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_BEGIN_X_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_X_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_END_X_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_X_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_END_X_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_X_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_BEGIN_Y_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_Y_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_BEGIN_Y_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_Y_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_END_Y_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_Y_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_END_Y_LABEL_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_Y_LABEL_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_BEGIN_TITLE_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_TITLE_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_BEGIN_TITLE_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_BEGIN_TITLE_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
#define EVT_PLOT_END_TITLE_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_TITLE_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
#define EVT_PLOT_END_TITLE_EDIT(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_PLOT_END_TITLE_EDIT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) wxStaticCastEvent( wxPlotEventFunction, & fn ), (wxObject *) NULL ),
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
/*
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
* Program: wxPlotWindow
|
// Name: plot.cpp
|
||||||
*
|
// Purpose: wxPlotWindow sample
|
||||||
* Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
*
|
// Modified by:
|
||||||
* Copyright: (C) 1999, Robert Roebling
|
// Created:
|
||||||
*
|
// Copyright: (C) 1999, Robert Roebling
|
||||||
*/
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
@@ -25,8 +27,7 @@
|
|||||||
#include "wx/sizer.h"
|
#include "wx/sizer.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
#include "wx/math.h"
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
// derived classes
|
// derived classes
|
||||||
|
|
||||||
@@ -39,16 +40,16 @@ class MyApp;
|
|||||||
class MyPlotCurve: public wxPlotCurve
|
class MyPlotCurve: public wxPlotCurve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyPlotCurve( int offsetY, double startY, double endY ) :
|
MyPlotCurve( int offsetY, double startY, double endY ) :
|
||||||
wxPlotCurve( offsetY, startY, endY ) {}
|
wxPlotCurve( offsetY, startY, endY ) {}
|
||||||
|
|
||||||
virtual wxInt32 GetStartX()
|
virtual wxInt32 GetStartX()
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
virtual wxInt32 GetEndX()
|
virtual wxInt32 GetEndX()
|
||||||
{ return 7000; }
|
{ return 7000; }
|
||||||
|
|
||||||
virtual double GetY( wxInt32 x )
|
virtual double GetY( wxInt32 x )
|
||||||
{
|
{
|
||||||
double dx = x;
|
double dx = x;
|
||||||
dx /= 100;
|
dx /= 100;
|
||||||
return sin( dx );
|
return sin( dx );
|
||||||
@@ -64,16 +65,17 @@ public:
|
|||||||
|
|
||||||
void OnAbout( wxCommandEvent &event );
|
void OnAbout( wxCommandEvent &event );
|
||||||
void OnQuit( wxCommandEvent &event );
|
void OnQuit( wxCommandEvent &event );
|
||||||
|
|
||||||
void OnPlotClick( wxPlotEvent &event );
|
void OnPlotClick( wxPlotEvent &event );
|
||||||
void OnPlotDClick( wxPlotEvent &event );
|
void OnPlotDClick( wxPlotEvent &event );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
wxPlotWindow *m_plot;
|
wxPlotWindow *m_plot;
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
wxTextCtrl *m_log;
|
wxTextCtrl *m_log;
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_DYNAMIC_CLASS(MyFrame)
|
DECLARE_DYNAMIC_CLASS(MyFrame)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
@@ -92,30 +94,30 @@ IMPLEMENT_APP(MyApp)
|
|||||||
|
|
||||||
// MyFrame
|
// MyFrame
|
||||||
|
|
||||||
const int ID_QUIT = 108;
|
|
||||||
const int ID_ABOUT = 109;
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
|
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||||
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
|
EVT_MENU (wxID_ABOUT, MyFrame::OnAbout)
|
||||||
EVT_MENU (ID_QUIT, MyFrame::OnQuit)
|
EVT_MENU (wxID_EXIT, MyFrame::OnQuit)
|
||||||
EVT_PLOT_CLICKED ( -1, MyFrame::OnPlotClick)
|
EVT_PLOT_CLICKED (wxID_ANY, MyFrame::OnPlotClick)
|
||||||
EVT_PLOT_DOUBLECLICKED ( -1, MyFrame::OnPlotDClick)
|
EVT_PLOT_DOUBLECLICKED (wxID_ANY, MyFrame::OnPlotDClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame( (wxFrame *)NULL, -1, _T("wxPlotWindow sample"),
|
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxPlotWindow sample"),
|
||||||
wxPoint(20,20), wxSize(470,500) )
|
wxPoint(20,20), wxSize(470,500) )
|
||||||
{
|
{
|
||||||
wxMenu *file_menu = new wxMenu();
|
wxMenu *fileMenu = new wxMenu();
|
||||||
file_menu->Append( ID_ABOUT, _T("&About.."));
|
fileMenu->Append( wxID_EXIT, _T("E&xit\tAlt-X"), _T("Quit this program"));
|
||||||
file_menu->Append( ID_QUIT, _T("E&xit\tAlt-X"));
|
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar();
|
wxMenu *helpMenu = new wxMenu;
|
||||||
menu_bar->Append(file_menu, _T("&File"));
|
helpMenu->Append(wxID_ABOUT, _T("&About...\tF1"), _T("Show about dialog"));
|
||||||
|
|
||||||
SetMenuBar( menu_bar );
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
|
menuBar->Append(fileMenu, _T("&File"));
|
||||||
|
menuBar->Append(helpMenu, _T("&Help"));
|
||||||
|
|
||||||
|
SetMenuBar( menuBar );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
@@ -123,9 +125,9 @@ MyFrame::MyFrame()
|
|||||||
SetStatusWidths( 2, widths );
|
SetStatusWidths( 2, widths );
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_plot = new wxPlotWindow( this, -1, wxPoint(0,0), wxSize(100,100), wxSUNKEN_BORDER | wxPLOT_DEFAULT );
|
m_plot = new wxPlotWindow( this, wxID_ANY, wxPoint(0,0), wxSize(100,100), wxSUNKEN_BORDER | wxPLOT_DEFAULT );
|
||||||
m_plot->SetUnitsPerValue( 0.01 );
|
m_plot->SetUnitsPerValue( 0.01 );
|
||||||
// m_plot->SetScrollOnThumbRelease( TRUE );
|
// m_plot->SetScrollOnThumbRelease( true );
|
||||||
|
|
||||||
m_plot->Add( new MyPlotCurve( 0, -1.5, 1.5 ) );
|
m_plot->Add( new MyPlotCurve( 0, -1.5, 1.5 ) );
|
||||||
m_plot->Add( new MyPlotCurve( 50, -1.5, 1.5 ) );
|
m_plot->Add( new MyPlotCurve( 50, -1.5, 1.5 ) );
|
||||||
@@ -135,15 +137,15 @@ MyFrame::MyFrame()
|
|||||||
oo->Add( 100, 400 );
|
oo->Add( 100, 400 );
|
||||||
oo->Add( 1000, 2000 );
|
oo->Add( 1000, 2000 );
|
||||||
m_plot->Add( oo );
|
m_plot->Add( oo );
|
||||||
|
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
|
m_log = new wxTextCtrl( this, wxID_ANY, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
|
||||||
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
|
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
|
||||||
delete old_log;
|
delete old_log;
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
topsizer->Add( m_plot, 1, wxEXPAND );
|
topsizer->Add( m_plot, 1, wxEXPAND );
|
||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
topsizer->Add( m_log, 0, wxEXPAND );
|
topsizer->Add( m_log, 0, wxEXPAND );
|
||||||
@@ -151,18 +153,20 @@ MyFrame::MyFrame()
|
|||||||
|
|
||||||
SetAutoLayout( true );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
|
topsizer->Fit(this);
|
||||||
|
topsizer->SetSizeHints(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
Close( true );
|
Close( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
(void)wxMessageBox( _T("wxPlotWindow Demo\n")
|
(void)wxMessageBox( _T("wxPlotWindow Demo\n")
|
||||||
_T("Robert Roebling (c) 1999,2000"),
|
_T("Robert Roebling (c) 1999,2000"),
|
||||||
_T("About wxPlotWindow Demo"), wxICON_INFORMATION | wxOK );
|
_T("About wxPlotWindow Demo"), wxICON_INFORMATION | wxOK );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnPlotClick( wxPlotEvent &event )
|
void MyFrame::OnPlotClick( wxPlotEvent &event )
|
||||||
@@ -186,8 +190,8 @@ void MyFrame::OnPlotDClick( wxPlotEvent &event )
|
|||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
wxFrame *frame = new MyFrame();
|
wxFrame *frame = new MyFrame();
|
||||||
frame->Show( TRUE );
|
frame->Show( true );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,12 +99,12 @@ static wxBitmap *GetDownBitmap();
|
|||||||
|
|
||||||
wxPlotEvent::wxPlotEvent( wxEventType commandType, int id )
|
wxPlotEvent::wxPlotEvent( wxEventType commandType, int id )
|
||||||
: wxNotifyEvent( commandType, id )
|
: wxNotifyEvent( commandType, id )
|
||||||
{
|
{
|
||||||
m_curve = (wxPlotCurve*) NULL;
|
m_curve = (wxPlotCurve*) NULL;
|
||||||
m_zoom = 1.0;
|
m_zoom = 1.0;
|
||||||
m_position = 0;
|
m_position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxPlotCurve
|
// wxPlotCurve
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -143,7 +143,7 @@ void wxPlotOnOffCurve::Add( wxInt32 on, wxInt32 off, void *clientData )
|
|||||||
m_minX = on;
|
m_minX = on;
|
||||||
if (off > m_maxX)
|
if (off > m_maxX)
|
||||||
m_maxX = off;
|
m_maxX = off;
|
||||||
|
|
||||||
wxPlotOnOff *v = new wxPlotOnOff;
|
wxPlotOnOff *v = new wxPlotOnOff;
|
||||||
v->m_on = on;
|
v->m_on = on;
|
||||||
v->m_off = off;
|
v->m_off = off;
|
||||||
@@ -198,17 +198,17 @@ void wxPlotOnOffCurve::DrawOffLine( wxDC &dc, wxCoord y, wxCoord start, wxCoord
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxPlotArea, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxPlotArea, wxWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPlotArea, wxWindow)
|
BEGIN_EVENT_TABLE(wxPlotArea, wxWindow)
|
||||||
EVT_PAINT( wxPlotArea::OnPaint)
|
EVT_PAINT( wxPlotArea::OnPaint)
|
||||||
EVT_LEFT_DOWN( wxPlotArea::OnMouse)
|
EVT_LEFT_DOWN( wxPlotArea::OnMouse)
|
||||||
EVT_LEFT_DCLICK( wxPlotArea::OnMouse)
|
EVT_LEFT_DCLICK( wxPlotArea::OnMouse)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxPlotArea::wxPlotArea( wxPlotWindow *parent )
|
wxPlotArea::wxPlotArea( wxPlotWindow *parent )
|
||||||
: wxWindow( parent, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("plotarea") )
|
: wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("plotarea") )
|
||||||
{
|
{
|
||||||
m_owner = parent;
|
m_owner = parent;
|
||||||
|
|
||||||
m_zooming = FALSE;
|
m_zooming = false;
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
SetBackgroundColour( *wxWHITE );
|
||||||
}
|
}
|
||||||
@@ -223,25 +223,25 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
|
|||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= wxPLOT_SCROLL_STEP;
|
view_x *= wxPLOT_SCROLL_STEP;
|
||||||
view_y *= wxPLOT_SCROLL_STEP;
|
view_y *= wxPLOT_SCROLL_STEP;
|
||||||
|
|
||||||
wxCoord x = event.GetX();
|
wxCoord x = event.GetX();
|
||||||
wxCoord y = event.GetY();
|
wxCoord y = event.GetY();
|
||||||
x += view_x;
|
x += view_x;
|
||||||
y += view_y;
|
y += view_y;
|
||||||
|
|
||||||
wxList::compatibility_iterator node = m_owner->m_curves.GetFirst();
|
wxList::compatibility_iterator node = m_owner->m_curves.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxPlotCurve *curve = (wxPlotCurve*)node->GetData();
|
wxPlotCurve *curve = (wxPlotCurve*)node->GetData();
|
||||||
|
|
||||||
double double_client_height = (double)client_height;
|
double double_client_height = (double)client_height;
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
double end = curve->GetEndY();
|
double end = curve->GetEndY();
|
||||||
wxCoord offset_y = curve->GetOffsetY();
|
wxCoord offset_y = curve->GetOffsetY();
|
||||||
|
|
||||||
double dy = (end - curve->GetY( (wxInt32)(x/m_owner->GetZoom()) )) / range;
|
double dy = (end - curve->GetY( (wxInt32)(x/m_owner->GetZoom()) )) / range;
|
||||||
wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||||
|
|
||||||
if ((y-curve_y < 4) && (y-curve_y > -4))
|
if ((y-curve_y < 4) && (y-curve_y > -4))
|
||||||
{
|
{
|
||||||
wxPlotEvent event1( event.ButtonDClick() ? wxEVT_PLOT_DOUBLECLICKED : wxEVT_PLOT_CLICKED, m_owner->GetId() );
|
wxPlotEvent event1( event.ButtonDClick() ? wxEVT_PLOT_DOUBLECLICKED : wxEVT_PLOT_CLICKED, m_owner->GetId() );
|
||||||
@@ -250,7 +250,7 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
|
|||||||
event1.SetCurve( curve );
|
event1.SetCurve( curve );
|
||||||
event1.SetPosition( (int)floor(x/m_owner->GetZoom()) );
|
event1.SetPosition( (int)floor(x/m_owner->GetZoom()) );
|
||||||
m_owner->GetEventHandler()->ProcessEvent( event1 );
|
m_owner->GetEventHandler()->ProcessEvent( event1 );
|
||||||
|
|
||||||
if (curve != m_owner->GetCurrentCurve())
|
if (curve != m_owner->GetCurrentCurve())
|
||||||
{
|
{
|
||||||
wxPlotEvent event2( wxEVT_PLOT_SEL_CHANGING, m_owner->GetId() );
|
wxPlotEvent event2( wxEVT_PLOT_SEL_CHANGING, m_owner->GetId() );
|
||||||
@@ -264,7 +264,7 @@ void wxPlotArea::OnMouse( wxMouseEvent &event )
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,17 +283,17 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
|
|||||||
int view_y;
|
int view_y;
|
||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= wxPLOT_SCROLL_STEP;
|
view_x *= wxPLOT_SCROLL_STEP;
|
||||||
|
|
||||||
if (from == -1)
|
if (from == -1)
|
||||||
from = view_x;
|
from = view_x;
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
if (to == -1)
|
if (to == -1)
|
||||||
to = view_x + client_width;
|
to = view_x + client_width;
|
||||||
|
|
||||||
double zoom = m_owner->GetZoom();
|
double zoom = m_owner->GetZoom();
|
||||||
|
|
||||||
int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) );
|
int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) );
|
||||||
@@ -301,23 +301,23 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to )
|
|||||||
|
|
||||||
start_x = wxMax( view_x, start_x );
|
start_x = wxMax( view_x, start_x );
|
||||||
end_x = wxMin( view_x + client_width, end_x );
|
end_x = wxMin( view_x + client_width, end_x );
|
||||||
|
|
||||||
end_x++;
|
end_x++;
|
||||||
|
|
||||||
double double_client_height = (double)client_height;
|
double double_client_height = (double)client_height;
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
double end = curve->GetEndY();
|
double end = curve->GetEndY();
|
||||||
wxCoord offset_y = curve->GetOffsetY();
|
wxCoord offset_y = curve->GetOffsetY();
|
||||||
|
|
||||||
wxCoord last_y=0;
|
wxCoord last_y=0;
|
||||||
for (int x = start_x; x < end_x; x++)
|
for (int x = start_x; x < end_x; x++)
|
||||||
{
|
{
|
||||||
double dy = (end - curve->GetY( (wxInt32)(x/zoom) )) / range;
|
double dy = (end - curve->GetY( (wxInt32)(x/zoom) )) / range;
|
||||||
wxCoord y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
wxCoord y = (wxCoord)(dy * double_client_height) - offset_y - 1;
|
||||||
|
|
||||||
if (x != start_x)
|
if (x != start_x)
|
||||||
dc->DrawLine( x-1, last_y, x, y );
|
dc->DrawLine( x-1, last_y, x, y );
|
||||||
|
|
||||||
last_y = y;
|
last_y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -328,17 +328,17 @@ void wxPlotArea::DrawOnOffCurve( wxDC *dc, wxPlotOnOffCurve *curve, int from, in
|
|||||||
int view_y;
|
int view_y;
|
||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= wxPLOT_SCROLL_STEP;
|
view_x *= wxPLOT_SCROLL_STEP;
|
||||||
|
|
||||||
if (from == -1)
|
if (from == -1)
|
||||||
from = view_x;
|
from = view_x;
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
if (to == -1)
|
if (to == -1)
|
||||||
to = view_x + client_width;
|
to = view_x + client_width;
|
||||||
|
|
||||||
double zoom = m_owner->GetZoom();
|
double zoom = m_owner->GetZoom();
|
||||||
|
|
||||||
int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) );
|
int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) );
|
||||||
@@ -346,19 +346,19 @@ void wxPlotArea::DrawOnOffCurve( wxDC *dc, wxPlotOnOffCurve *curve, int from, in
|
|||||||
|
|
||||||
start_x = wxMax( view_x, start_x );
|
start_x = wxMax( view_x, start_x );
|
||||||
end_x = wxMin( view_x + client_width, end_x );
|
end_x = wxMin( view_x + client_width, end_x );
|
||||||
|
|
||||||
end_x++;
|
end_x++;
|
||||||
|
|
||||||
wxCoord offset_y = curve->GetOffsetY();
|
wxCoord offset_y = curve->GetOffsetY();
|
||||||
wxCoord last_off = -5;
|
wxCoord last_off = -5;
|
||||||
|
|
||||||
if (curve->GetCount() == 0)
|
if (curve->GetCount() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (size_t index = 0; index < curve->GetCount(); index++)
|
for (size_t index = 0; index < curve->GetCount(); index++)
|
||||||
{
|
{
|
||||||
wxPlotOnOff *p = curve->GetAt( index );
|
wxPlotOnOff *p = curve->GetAt( index );
|
||||||
|
|
||||||
wxCoord on = (wxCoord)(p->m_on*zoom);
|
wxCoord on = (wxCoord)(p->m_on*zoom);
|
||||||
wxCoord off = (wxCoord)(p->m_off*zoom);
|
wxCoord off = (wxCoord)(p->m_off*zoom);
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ void wxPlotArea::DrawOnOffCurve( wxDC *dc, wxPlotOnOffCurve *curve, int from, in
|
|||||||
curve->DrawOffLine( *dc, client_height-offset_y, last_off, on );
|
curve->DrawOffLine( *dc, client_height-offset_y, last_off, on );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (off >= start_x)
|
if (off >= start_x)
|
||||||
{
|
{
|
||||||
curve->DrawOffLine( *dc, client_height-offset_y, last_off, on );
|
curve->DrawOffLine( *dc, client_height-offset_y, last_off, on );
|
||||||
@@ -375,7 +375,7 @@ void wxPlotArea::DrawOnOffCurve( wxDC *dc, wxPlotOnOffCurve *curve, int from, in
|
|||||||
}
|
}
|
||||||
last_off = off;
|
last_off = off;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPlotOnOff *p = curve->GetAt( curve->GetCount()-1 );
|
wxPlotOnOff *p = curve->GetAt( curve->GetCount()-1 );
|
||||||
wxCoord off = (wxCoord)(p->m_off*zoom);
|
wxCoord off = (wxCoord)(p->m_off*zoom);
|
||||||
if (off < end_x)
|
if (off < end_x)
|
||||||
@@ -394,16 +394,12 @@ void wxPlotArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
m_owner->PrepareDC( dc );
|
m_owner->PrepareDC( dc );
|
||||||
|
|
||||||
wxRegionIterator upd( GetUpdateRegion() );
|
wxRegionIterator upd( GetUpdateRegion() );
|
||||||
|
|
||||||
while (upd)
|
while (upd)
|
||||||
{
|
{
|
||||||
int update_x = upd.GetX() + view_x;
|
int update_x = upd.GetX() + view_x;
|
||||||
#if 0
|
|
||||||
// unused var
|
|
||||||
int update_y = upd.GetY() + view_y;
|
|
||||||
#endif
|
|
||||||
int update_width = upd.GetWidth();
|
int update_width = upd.GetWidth();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (m_owner->m_current)
|
if (m_owner->m_current)
|
||||||
{
|
{
|
||||||
@@ -412,34 +408,34 @@ void wxPlotArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.DrawLine( update_x-1, base_line-1, update_x+update_width+2, base_line-1 );
|
dc.DrawLine( update_x-1, base_line-1, update_x+update_width+2, base_line-1 );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxList::compatibility_iterator node = m_owner->m_curves.GetFirst();
|
wxList::compatibility_iterator node = m_owner->m_curves.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxPlotCurve *curve = (wxPlotCurve*) node->GetData();
|
wxPlotCurve *curve = (wxPlotCurve*) node->GetData();
|
||||||
|
|
||||||
if (curve == m_owner->GetCurrentCurve())
|
if (curve == m_owner->GetCurrentCurve())
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
else
|
else
|
||||||
dc.SetPen( *wxGREY_PEN );
|
dc.SetPen( *wxGREY_PEN );
|
||||||
|
|
||||||
DrawCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
DrawCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen( *wxRED_PEN );
|
dc.SetPen( *wxRED_PEN );
|
||||||
|
|
||||||
node = m_owner->m_onOffCurves.GetFirst();
|
node = m_owner->m_onOffCurves.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxPlotOnOffCurve *curve = (wxPlotOnOffCurve*) node->GetData();
|
wxPlotOnOffCurve *curve = (wxPlotOnOffCurve*) node->GetData();
|
||||||
|
|
||||||
DrawOnOffCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
DrawOnOffCurve( &dc, curve, update_x-1, update_x+update_width+2 );
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
upd ++;
|
upd ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -462,10 +458,10 @@ BEGIN_EVENT_TABLE(wxPlotXAxisArea, wxWindow)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxPlotXAxisArea::wxPlotXAxisArea( wxPlotWindow *parent )
|
wxPlotXAxisArea::wxPlotXAxisArea( wxPlotWindow *parent )
|
||||||
: wxWindow( parent, -1, wxDefaultPosition, wxSize(-1,40), 0, _T("plotxaxisarea") )
|
: wxWindow( parent, wxID_ANY, wxDefaultPosition, wxSize(wxDefaultCoord,40), 0, _T("plotxaxisarea") )
|
||||||
{
|
{
|
||||||
m_owner = parent;
|
m_owner = parent;
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
SetBackgroundColour( *wxWHITE );
|
||||||
SetFont( *wxSMALL_FONT );
|
SetFont( *wxSMALL_FONT );
|
||||||
}
|
}
|
||||||
@@ -480,10 +476,10 @@ void wxPlotXAxisArea::OnMouse( wxMouseEvent &event )
|
|||||||
m_owner->GetViewStart( &view_x, &view_y );
|
m_owner->GetViewStart( &view_x, &view_y );
|
||||||
view_x *= wxPLOT_SCROLL_STEP;
|
view_x *= wxPLOT_SCROLL_STEP;
|
||||||
view_y *= wxPLOT_SCROLL_STEP;
|
view_y *= wxPLOT_SCROLL_STEP;
|
||||||
|
|
||||||
wxCoord x = event.GetX() + view_x;
|
wxCoord x = event.GetX() + view_x;
|
||||||
wxCoord y = event.GetY() + view_y;
|
wxCoord y = event.GetY() + view_y;
|
||||||
|
|
||||||
/* TO DO: do something here */
|
/* TO DO: do something here */
|
||||||
wxUnusedVar(x);
|
wxUnusedVar(x);
|
||||||
wxUnusedVar(y);
|
wxUnusedVar(y);
|
||||||
@@ -498,34 +494,34 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
view_y *= wxPLOT_SCROLL_STEP;
|
view_y *= wxPLOT_SCROLL_STEP;
|
||||||
|
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
double zoom = m_owner->GetZoom();
|
double zoom = m_owner->GetZoom();
|
||||||
|
|
||||||
double ups = m_owner->GetUnitsPerValue() / zoom;
|
double ups = m_owner->GetUnitsPerValue() / zoom;
|
||||||
|
|
||||||
double start = view_x * ups;
|
double start = view_x * ups;
|
||||||
double end = (view_x + client_width) * ups;
|
double end = (view_x + client_width) * ups;
|
||||||
double range = end - start;
|
double range = end - start;
|
||||||
|
|
||||||
int int_log_range = (int)floor( log10( range ) );
|
int int_log_range = (int)floor( log10( range ) );
|
||||||
double step = 1.0;
|
double step = 1.0;
|
||||||
if (int_log_range > 0)
|
if (int_log_range > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < int_log_range; i++)
|
for (int i = 0; i < int_log_range; i++)
|
||||||
step *= 10;
|
step *= 10;
|
||||||
}
|
}
|
||||||
if (int_log_range < 0)
|
if (int_log_range < 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < -int_log_range; i++)
|
for (int i = 0; i < -int_log_range; i++)
|
||||||
step /= 10;
|
step /= 10;
|
||||||
}
|
}
|
||||||
double lower = ceil(start / step) * step;
|
double lower = ceil(start / step) * step;
|
||||||
double upper = floor(end / step) * step;
|
double upper = floor(end / step) * step;
|
||||||
|
|
||||||
// if too few values, shrink size
|
// if too few values, shrink size
|
||||||
if ((range/step) < 4)
|
if ((range/step) < 4)
|
||||||
{
|
{
|
||||||
@@ -533,7 +529,7 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (lower-step > start) lower -= step;
|
if (lower-step > start) lower -= step;
|
||||||
if (upper+step < end) upper += step;
|
if (upper+step < end) upper += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if still too few, again
|
// if still too few, again
|
||||||
if ((range/step) < 4)
|
if ((range/step) < 4)
|
||||||
{
|
{
|
||||||
@@ -541,13 +537,13 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (lower-step > start) lower -= step;
|
if (lower-step > start) lower -= step;
|
||||||
if (upper+step < end) upper += step;
|
if (upper+step < end) upper += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.SetBrush( *wxWHITE_BRUSH );
|
dc.SetBrush( *wxWHITE_BRUSH );
|
||||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||||
dc.DrawRectangle( 4, 5, client_width-14, 10 );
|
dc.DrawRectangle( 4, 5, client_width-14, 10 );
|
||||||
dc.DrawRectangle( 0, 20, client_width, 20 );
|
dc.DrawRectangle( 0, 20, client_width, 20 );
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
|
|
||||||
double current = lower;
|
double current = lower;
|
||||||
while (current < upper+(step/2))
|
while (current < upper+(step/2))
|
||||||
{
|
{
|
||||||
@@ -559,7 +555,7 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (range < 50)
|
if (range < 50)
|
||||||
{
|
{
|
||||||
label.Printf( _T("%f"), current );
|
label.Printf( _T("%f"), current );
|
||||||
while (label.Last() == _T('0'))
|
while (label.Last() == _T('0'))
|
||||||
label.RemoveLast();
|
label.RemoveLast();
|
||||||
if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
|
if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
|
||||||
label.Append( _T('0') );
|
label.Append( _T('0') );
|
||||||
@@ -571,7 +567,7 @@ void wxPlotXAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
current += step;
|
current += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.DrawLine( 0, 15, client_width-8, 15 );
|
dc.DrawLine( 0, 15, client_width-8, 15 );
|
||||||
dc.DrawLine( client_width-4, 15, client_width-10, 10 );
|
dc.DrawLine( client_width-4, 15, client_width-10, 10 );
|
||||||
dc.DrawLine( client_width-4, 15, client_width-10, 20 );
|
dc.DrawLine( client_width-4, 15, client_width-10, 20 );
|
||||||
@@ -589,10 +585,10 @@ BEGIN_EVENT_TABLE(wxPlotYAxisArea, wxWindow)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxPlotYAxisArea::wxPlotYAxisArea( wxPlotWindow *parent )
|
wxPlotYAxisArea::wxPlotYAxisArea( wxPlotWindow *parent )
|
||||||
: wxWindow( parent, -1, wxDefaultPosition, wxSize(60,-1), 0, _T("plotyaxisarea") )
|
: wxWindow( parent, wxID_ANY, wxDefaultPosition, wxSize(60,wxDefaultCoord), 0, _T("plotyaxisarea") )
|
||||||
{
|
{
|
||||||
m_owner = parent;
|
m_owner = parent;
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
SetBackgroundColour( *wxWHITE );
|
||||||
SetFont( *wxSMALL_FONT );
|
SetFont( *wxSMALL_FONT );
|
||||||
}
|
}
|
||||||
@@ -605,36 +601,36 @@ void wxPlotYAxisArea::OnMouse( wxMouseEvent &WXUNUSED(event) )
|
|||||||
void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
|
|
||||||
wxPlotCurve *curve = m_owner->GetCurrentCurve();
|
wxPlotCurve *curve = m_owner->GetCurrentCurve();
|
||||||
|
|
||||||
if (!curve) return;
|
if (!curve) return;
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
GetClientSize( &client_width, &client_height);
|
GetClientSize( &client_width, &client_height);
|
||||||
|
|
||||||
|
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
double offset = ((double) curve->GetOffsetY() / (double)client_height ) * range;
|
double offset = ((double) curve->GetOffsetY() / (double)client_height ) * range;
|
||||||
double start = curve->GetStartY() - offset;
|
double start = curve->GetStartY() - offset;
|
||||||
double end = curve->GetEndY() - offset;
|
double end = curve->GetEndY() - offset;
|
||||||
|
|
||||||
int int_log_range = (int)floor( log10( range ) );
|
int int_log_range = (int)floor( log10( range ) );
|
||||||
double step = 1.0;
|
double step = 1.0;
|
||||||
if (int_log_range > 0)
|
if (int_log_range > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < int_log_range; i++)
|
for (int i = 0; i < int_log_range; i++)
|
||||||
step *= 10;
|
step *= 10;
|
||||||
}
|
}
|
||||||
if (int_log_range < 0)
|
if (int_log_range < 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < -int_log_range; i++)
|
for (int i = 0; i < -int_log_range; i++)
|
||||||
step /= 10;
|
step /= 10;
|
||||||
}
|
}
|
||||||
double lower = ceil(start / step) * step;
|
double lower = ceil(start / step) * step;
|
||||||
double upper = floor(end / step) * step;
|
double upper = floor(end / step) * step;
|
||||||
|
|
||||||
// if too few values, shrink size
|
// if too few values, shrink size
|
||||||
if ((range/step) < 4)
|
if ((range/step) < 4)
|
||||||
{
|
{
|
||||||
@@ -642,7 +638,7 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (lower-step > start) lower -= step;
|
if (lower-step > start) lower -= step;
|
||||||
if (upper+step < end) upper += step;
|
if (upper+step < end) upper += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if still too few, again
|
// if still too few, again
|
||||||
if ((range/step) < 4)
|
if ((range/step) < 4)
|
||||||
{
|
{
|
||||||
@@ -652,7 +648,7 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen( *wxBLACK_PEN );
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
|
|
||||||
double current = lower;
|
double current = lower;
|
||||||
while (current < upper+(step/2))
|
while (current < upper+(step/2))
|
||||||
{
|
{
|
||||||
@@ -665,7 +661,7 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (range < 50)
|
if (range < 50)
|
||||||
{
|
{
|
||||||
label.Printf( _T("%f"), current );
|
label.Printf( _T("%f"), current );
|
||||||
while (label.Last() == _T('0'))
|
while (label.Last() == _T('0'))
|
||||||
label.RemoveLast();
|
label.RemoveLast();
|
||||||
if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
|
if ((label.Last() == _T('.')) || (label.Last() == _T(',')))
|
||||||
label.Append( _T('0') );
|
label.Append( _T('0') );
|
||||||
@@ -677,7 +673,7 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
current += step;
|
current += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.DrawLine( client_width-15, 6, client_width-15, client_height );
|
dc.DrawLine( client_width-15, 6, client_width-15, client_height );
|
||||||
dc.DrawLine( client_width-15, 2, client_width-20, 8 );
|
dc.DrawLine( client_width-15, 2, client_width-20, 8 );
|
||||||
dc.DrawLine( client_width-15, 2, client_width-10, 8 );
|
dc.DrawLine( client_width-15, 2, client_width-10, 8 );
|
||||||
@@ -700,16 +696,16 @@ void wxPlotYAxisArea::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxPlotWindow, wxScrolledWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxPlotWindow, wxScrolledWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPlotWindow, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(wxPlotWindow, wxScrolledWindow)
|
||||||
EVT_BUTTON( ID_MOVE_UP, wxPlotWindow::OnMoveUp)
|
EVT_BUTTON( ID_MOVE_UP, wxPlotWindow::OnMoveUp)
|
||||||
EVT_BUTTON( ID_MOVE_DOWN, wxPlotWindow::OnMoveDown)
|
EVT_BUTTON( ID_MOVE_DOWN, wxPlotWindow::OnMoveDown)
|
||||||
|
|
||||||
EVT_BUTTON( ID_ENLARGE, wxPlotWindow::OnEnlarge)
|
EVT_BUTTON( ID_ENLARGE, wxPlotWindow::OnEnlarge)
|
||||||
EVT_BUTTON( ID_SHRINK, wxPlotWindow::OnShrink)
|
EVT_BUTTON( ID_SHRINK, wxPlotWindow::OnShrink)
|
||||||
|
|
||||||
EVT_BUTTON( ID_ZOOM_IN, wxPlotWindow::OnZoomIn)
|
EVT_BUTTON( ID_ZOOM_IN, wxPlotWindow::OnZoomIn)
|
||||||
EVT_BUTTON( ID_ZOOM_OUT, wxPlotWindow::OnZoomOut)
|
EVT_BUTTON( ID_ZOOM_OUT, wxPlotWindow::OnZoomOut)
|
||||||
|
|
||||||
EVT_SCROLLWIN( wxPlotWindow::OnScroll2)
|
EVT_SCROLLWIN( wxPlotWindow::OnScroll2)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag )
|
wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag )
|
||||||
@@ -717,13 +713,13 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||||||
{
|
{
|
||||||
m_xUnitsPerValue = 1.0;
|
m_xUnitsPerValue = 1.0;
|
||||||
m_xZoom = 1.0;
|
m_xZoom = 1.0;
|
||||||
|
|
||||||
m_enlargeAroundWindowCentre = FALSE;
|
m_enlargeAroundWindowCentre = false;
|
||||||
m_scrollOnThumbRelease = FALSE;
|
m_scrollOnThumbRelease = false;
|
||||||
|
|
||||||
m_area = new wxPlotArea( this );
|
m_area = new wxPlotArea( this );
|
||||||
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *mainsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
if ((GetWindowStyleFlag() & wxPLOT_BUTTON_ALL) != 0)
|
if ((GetWindowStyleFlag() & wxPLOT_BUTTON_ALL) != 0)
|
||||||
{
|
{
|
||||||
wxBoxSizer *buttonlist = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *buttonlist = new wxBoxSizer( wxVERTICAL );
|
||||||
@@ -746,15 +742,15 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||||||
}
|
}
|
||||||
mainsizer->Add( buttonlist, 0, wxEXPAND|wxALL, 4 );
|
mainsizer->Add( buttonlist, 0, wxEXPAND|wxALL, 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBoxSizer *plotsizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *plotsizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
if ((GetWindowStyleFlag() & wxPLOT_Y_AXIS) != 0)
|
if ((GetWindowStyleFlag() & wxPLOT_Y_AXIS) != 0)
|
||||||
{
|
{
|
||||||
m_yaxis = new wxPlotYAxisArea( this );
|
m_yaxis = new wxPlotYAxisArea( this );
|
||||||
|
|
||||||
wxBoxSizer *vert1 = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *vert1 = new wxBoxSizer( wxVERTICAL );
|
||||||
plotsizer->Add( vert1, 0, wxEXPAND );
|
plotsizer->Add( vert1, 1, wxEXPAND|wxTOP,10 );
|
||||||
vert1->Add( m_yaxis, 1 );
|
vert1->Add( m_yaxis, 1 );
|
||||||
if ((GetWindowStyleFlag() & wxPLOT_X_AXIS) != 0)
|
if ((GetWindowStyleFlag() & wxPLOT_X_AXIS) != 0)
|
||||||
vert1->Add( 60, 40 );
|
vert1->Add( 60, 40 );
|
||||||
@@ -763,14 +759,14 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||||||
{
|
{
|
||||||
m_yaxis = (wxPlotYAxisArea*) NULL;
|
m_yaxis = (wxPlotYAxisArea*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((GetWindowStyleFlag() & wxPLOT_X_AXIS) != 0)
|
if ((GetWindowStyleFlag() & wxPLOT_X_AXIS) != 0)
|
||||||
{
|
{
|
||||||
m_xaxis = new wxPlotXAxisArea( this );
|
m_xaxis = new wxPlotXAxisArea( this );
|
||||||
|
|
||||||
wxBoxSizer *vert2 = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *vert2 = new wxBoxSizer( wxVERTICAL );
|
||||||
plotsizer->Add( vert2, 1, wxEXPAND );
|
plotsizer->Add( vert2, 5, wxEXPAND);
|
||||||
vert2->Add( m_area, 1, wxEXPAND );
|
vert2->Add( m_area, 1, wxEXPAND|wxTOP,10 );
|
||||||
vert2->Add( m_xaxis, 0, wxEXPAND );
|
vert2->Add( m_xaxis, 0, wxEXPAND );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -779,15 +775,17 @@ wxPlotWindow::wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||||||
m_xaxis = (wxPlotXAxisArea*) NULL;
|
m_xaxis = (wxPlotXAxisArea*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mainsizer->Add( plotsizer, 1, wxEXPAND );
|
mainsizer->Add( plotsizer, 1, wxEXPAND );
|
||||||
|
|
||||||
SetAutoLayout( TRUE );
|
SetAutoLayout( true );
|
||||||
SetSizer( mainsizer );
|
SetSizer( mainsizer );
|
||||||
|
mainsizer->Fit(this);
|
||||||
|
mainsizer->SetSizeHints(this);
|
||||||
|
|
||||||
SetTargetWindow( m_area );
|
SetTargetWindow( m_area );
|
||||||
|
|
||||||
SetBackgroundColour( *wxWHITE );
|
SetBackgroundColour( *wxWHITE );
|
||||||
|
|
||||||
m_current = (wxPlotCurve*) NULL;
|
m_current = (wxPlotCurve*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -799,7 +797,7 @@ void wxPlotWindow::Add( wxPlotCurve *curve )
|
|||||||
{
|
{
|
||||||
m_curves.Append( curve );
|
m_curves.Append( curve );
|
||||||
if (!m_current) m_current = curve;
|
if (!m_current) m_current = curve;
|
||||||
|
|
||||||
ResetScrollbar();
|
ResetScrollbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,17 +811,17 @@ wxPlotCurve *wxPlotWindow::GetAt( size_t n )
|
|||||||
wxList::compatibility_iterator node = m_curves.Item( n );
|
wxList::compatibility_iterator node = m_curves.Item( n );
|
||||||
if (!node)
|
if (!node)
|
||||||
return (wxPlotCurve*) NULL;
|
return (wxPlotCurve*) NULL;
|
||||||
|
|
||||||
return (wxPlotCurve*) node->GetData();
|
return (wxPlotCurve*) node->GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::SetCurrentCurve( wxPlotCurve* current )
|
void wxPlotWindow::SetCurrentCurve( wxPlotCurve* current )
|
||||||
{
|
{
|
||||||
m_current = current;
|
m_current = current;
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( false );
|
||||||
|
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
|
|
||||||
wxPlotEvent event( wxEVT_PLOT_SEL_CHANGED, GetId() );
|
wxPlotEvent event( wxEVT_PLOT_SEL_CHANGED, GetId() );
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
event.SetZoom( GetZoom() );
|
event.SetZoom( GetZoom() );
|
||||||
@@ -835,11 +833,11 @@ void wxPlotWindow::Delete( wxPlotCurve* curve )
|
|||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = m_curves.Find( curve );
|
wxList::compatibility_iterator node = m_curves.Find( curve );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
m_curves.DeleteObject( curve );
|
m_curves.DeleteObject( curve );
|
||||||
|
|
||||||
m_area->DeleteCurve( curve );
|
m_area->DeleteCurve( curve );
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( false );
|
||||||
|
|
||||||
if (curve == m_current) m_current = (wxPlotCurve *) NULL;
|
if (curve == m_current) m_current = (wxPlotCurve *) NULL;
|
||||||
}
|
}
|
||||||
@@ -858,7 +856,7 @@ void wxPlotWindow::Delete( wxPlotOnOffCurve* curve )
|
|||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = m_onOffCurves.Find( curve );
|
wxList::compatibility_iterator node = m_onOffCurves.Find( curve );
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
m_onOffCurves.DeleteObject( curve );
|
m_onOffCurves.DeleteObject( curve );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,54 +870,54 @@ wxPlotOnOffCurve *wxPlotWindow::GetOnOffCurveAt( size_t n )
|
|||||||
wxList::compatibility_iterator node = m_onOffCurves.Item( n );
|
wxList::compatibility_iterator node = m_onOffCurves.Item( n );
|
||||||
if (!node)
|
if (!node)
|
||||||
return (wxPlotOnOffCurve*) NULL;
|
return (wxPlotOnOffCurve*) NULL;
|
||||||
|
|
||||||
return (wxPlotOnOffCurve*) node->GetData();
|
return (wxPlotOnOffCurve*) node->GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::Move( wxPlotCurve* curve, int pixels_up )
|
void wxPlotWindow::Move( wxPlotCurve* curve, int pixels_up )
|
||||||
{
|
{
|
||||||
m_area->DeleteCurve( curve );
|
m_area->DeleteCurve( curve );
|
||||||
|
|
||||||
curve->SetOffsetY( curve->GetOffsetY() + pixels_up );
|
curve->SetOffsetY( curve->GetOffsetY() + pixels_up );
|
||||||
|
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( false );
|
||||||
|
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnMoveUp( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnMoveUp( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Move( m_current, 25 );
|
Move( m_current, 25 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnMoveDown( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnMoveDown( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Move( m_current, -25 );
|
Move( m_current, -25 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
||||||
{
|
{
|
||||||
m_area->DeleteCurve( curve );
|
m_area->DeleteCurve( curve );
|
||||||
|
|
||||||
int client_width;
|
int client_width;
|
||||||
int client_height;
|
int client_height;
|
||||||
m_area->GetClientSize( &client_width, &client_height);
|
m_area->GetClientSize( &client_width, &client_height);
|
||||||
double offset = (double)curve->GetOffsetY() / (double)client_height;
|
double offset = (double)curve->GetOffsetY() / (double)client_height;
|
||||||
|
|
||||||
double range = curve->GetEndY() - curve->GetStartY();
|
double range = curve->GetEndY() - curve->GetStartY();
|
||||||
offset *= range;
|
offset *= range;
|
||||||
|
|
||||||
double new_range = range / factor;
|
double new_range = range / factor;
|
||||||
double new_offset = offset / factor;
|
double new_offset = offset / factor;
|
||||||
|
|
||||||
if (m_enlargeAroundWindowCentre)
|
if (m_enlargeAroundWindowCentre)
|
||||||
{
|
{
|
||||||
double middle = curve->GetStartY() - offset + range/2;
|
double middle = curve->GetStartY() - offset + range/2;
|
||||||
|
|
||||||
curve->SetStartY( middle - new_range / 2 + new_offset );
|
curve->SetStartY( middle - new_range / 2 + new_offset );
|
||||||
curve->SetEndY( middle + new_range / 2 + new_offset );
|
curve->SetEndY( middle + new_range / 2 + new_offset );
|
||||||
}
|
}
|
||||||
@@ -928,15 +926,15 @@ void wxPlotWindow::Enlarge( wxPlotCurve *curve, double factor )
|
|||||||
curve->SetStartY( (curve->GetStartY() - offset)/factor + new_offset );
|
curve->SetStartY( (curve->GetStartY() - offset)/factor + new_offset );
|
||||||
curve->SetEndY( (curve->GetEndY() - offset)/factor + new_offset );
|
curve->SetEndY( (curve->GetEndY() - offset)/factor + new_offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_area->Refresh( FALSE );
|
m_area->Refresh( false );
|
||||||
RedrawYAxis();
|
RedrawYAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::SetUnitsPerValue( double upv )
|
void wxPlotWindow::SetUnitsPerValue( double upv )
|
||||||
{
|
{
|
||||||
m_xUnitsPerValue = upv;
|
m_xUnitsPerValue = upv;
|
||||||
|
|
||||||
RedrawXAxis();
|
RedrawXAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,11 +942,11 @@ void wxPlotWindow::SetZoom( double zoom )
|
|||||||
{
|
{
|
||||||
double old_zoom = m_xZoom;
|
double old_zoom = m_xZoom;
|
||||||
m_xZoom = zoom;
|
m_xZoom = zoom;
|
||||||
|
|
||||||
int view_x = 0;
|
int view_x = 0;
|
||||||
int view_y = 0;
|
int view_y = 0;
|
||||||
GetViewStart( &view_x, &view_y );
|
GetViewStart( &view_x, &view_y );
|
||||||
|
|
||||||
wxInt32 max = 0;
|
wxInt32 max = 0;
|
||||||
wxList::compatibility_iterator node = m_curves.GetFirst();
|
wxList::compatibility_iterator node = m_curves.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -958,13 +956,13 @@ void wxPlotWindow::SetZoom( double zoom )
|
|||||||
max = curve->GetEndX();
|
max = curve->GetEndX();
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP,
|
SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP,
|
||||||
(int)((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0,
|
(int)((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0,
|
||||||
(int)(view_x*zoom/old_zoom), 0,
|
(int)(view_x*zoom/old_zoom), 0,
|
||||||
TRUE );
|
true );
|
||||||
|
|
||||||
RedrawXAxis();
|
RedrawXAxis();
|
||||||
m_area->Refresh( TRUE );
|
m_area->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::ResetScrollbar()
|
void wxPlotWindow::ResetScrollbar()
|
||||||
@@ -978,30 +976,30 @@ void wxPlotWindow::ResetScrollbar()
|
|||||||
max = curve->GetEndX();
|
max = curve->GetEndX();
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP,
|
SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP,
|
||||||
(int)(((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1), 0 );
|
(int)(((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::RedrawXAxis()
|
void wxPlotWindow::RedrawXAxis()
|
||||||
{
|
{
|
||||||
if (m_xaxis)
|
if (m_xaxis)
|
||||||
m_xaxis->Refresh( FALSE );
|
m_xaxis->Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::RedrawYAxis()
|
void wxPlotWindow::RedrawYAxis()
|
||||||
{
|
{
|
||||||
if (m_yaxis)
|
if (m_yaxis)
|
||||||
m_yaxis->Refresh( TRUE );
|
m_yaxis->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::RedrawEverything()
|
void wxPlotWindow::RedrawEverything()
|
||||||
{
|
{
|
||||||
if (m_xaxis)
|
if (m_xaxis)
|
||||||
m_xaxis->Refresh( TRUE );
|
m_xaxis->Refresh( true );
|
||||||
if (m_yaxis)
|
if (m_yaxis)
|
||||||
m_yaxis->Refresh( TRUE );
|
m_yaxis->Refresh( true );
|
||||||
m_area->Refresh( TRUE );
|
m_area->Refresh( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnZoomIn( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnZoomIn( wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -1017,14 +1015,14 @@ void wxPlotWindow::OnZoomOut( wxCommandEvent& WXUNUSED(event) )
|
|||||||
void wxPlotWindow::OnEnlarge( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnEnlarge( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 1.5 );
|
Enlarge( m_current, 1.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPlotWindow::OnShrink( wxCommandEvent& WXUNUSED(event) )
|
void wxPlotWindow::OnShrink( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if (!m_current) return;
|
if (!m_current) return;
|
||||||
|
|
||||||
Enlarge( m_current, 0.6666666 );
|
Enlarge( m_current, 0.6666666 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,11 +1043,11 @@ void wxPlotWindow::OnScroll2( wxScrollWinEvent& event )
|
|||||||
static wxBitmap *GetEnlargeBitmap()
|
static wxBitmap *GetEnlargeBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_enl_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_enl_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
@@ -1064,11 +1062,11 @@ static wxBitmap *GetEnlargeBitmap()
|
|||||||
static wxBitmap *GetShrinkBitmap()
|
static wxBitmap *GetShrinkBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_shr_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_shr_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
@@ -1083,11 +1081,11 @@ static wxBitmap *GetShrinkBitmap()
|
|||||||
static wxBitmap *GetZoomInBitmap()
|
static wxBitmap *GetZoomInBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_zin_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_zin_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
@@ -1102,11 +1100,11 @@ static wxBitmap *GetZoomInBitmap()
|
|||||||
static wxBitmap *GetZoomOutBitmap()
|
static wxBitmap *GetZoomOutBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_zot_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_zot_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
@@ -1121,11 +1119,11 @@ static wxBitmap *GetZoomOutBitmap()
|
|||||||
static wxBitmap *GetUpBitmap()
|
static wxBitmap *GetUpBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_up_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_up_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
@@ -1140,11 +1138,11 @@ static wxBitmap *GetUpBitmap()
|
|||||||
static wxBitmap *GetDownBitmap()
|
static wxBitmap *GetDownBitmap()
|
||||||
{
|
{
|
||||||
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
static wxBitmap* s_bitmap = (wxBitmap *) NULL;
|
||||||
static bool s_loaded = FALSE;
|
static bool s_loaded = false;
|
||||||
|
|
||||||
if ( !s_loaded )
|
if ( !s_loaded )
|
||||||
{
|
{
|
||||||
s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
|
s_loaded = true; // set it to true anyhow, we won't try again
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||||
s_bitmap = new wxBitmap(_T("plot_dwn_bmp"), wxBITMAP_TYPE_RESOURCE);
|
s_bitmap = new wxBitmap(_T("plot_dwn_bmp"), wxBITMAP_TYPE_RESOURCE);
|
||||||
|
|||||||
Reference in New Issue
Block a user