Readded wxPlotWindow as external lib.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2001-01-16 11:33:29 +00:00
parent 67b888f0f3
commit 8556b795c3
23 changed files with 2051 additions and 1 deletions

4
contrib/configure vendored
View File

@@ -820,6 +820,7 @@ trap 'rm -fr `echo "
src/xml/Makefile src/xml/Makefile
src/canvas/Makefile src/canvas/Makefile
src/gizmos/Makefile src/gizmos/Makefile
src/plot/Makefile
samples/Makefile samples/Makefile
samples/mmedia/Makefile samples/mmedia/Makefile
samples/ogl/Makefile samples/ogl/Makefile
@@ -833,6 +834,7 @@ trap 'rm -fr `echo "
samples/gizmos/multicell/Makefile samples/gizmos/multicell/Makefile
samples/gizmos/splittree/Makefile samples/gizmos/splittree/Makefile
samples/xml/Makefile samples/xml/Makefile
samples/plot/Makefile
utils/Makefile utils/Makefile
utils/wxrc/Makefile utils/wxrc/Makefile
utils/wxrcedit/Makefile utils/wxrcedit/Makefile
@@ -923,6 +925,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
src/xml/Makefile src/xml/Makefile
src/canvas/Makefile src/canvas/Makefile
src/gizmos/Makefile src/gizmos/Makefile
src/plot/Makefile
samples/Makefile samples/Makefile
samples/mmedia/Makefile samples/mmedia/Makefile
samples/ogl/Makefile samples/ogl/Makefile
@@ -936,6 +939,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile
samples/gizmos/multicell/Makefile samples/gizmos/multicell/Makefile
samples/gizmos/splittree/Makefile samples/gizmos/splittree/Makefile
samples/xml/Makefile samples/xml/Makefile
samples/plot/Makefile
utils/Makefile utils/Makefile
utils/wxrc/Makefile utils/wxrc/Makefile
utils/wxrcedit/Makefile utils/wxrcedit/Makefile

View File

@@ -45,6 +45,7 @@ AC_OUTPUT([
src/xml/Makefile src/xml/Makefile
src/canvas/Makefile src/canvas/Makefile
src/gizmos/Makefile src/gizmos/Makefile
src/plot/Makefile
samples/Makefile samples/Makefile
samples/mmedia/Makefile samples/mmedia/Makefile
samples/ogl/Makefile samples/ogl/Makefile
@@ -58,6 +59,7 @@ AC_OUTPUT([
samples/gizmos/multicell/Makefile samples/gizmos/multicell/Makefile
samples/gizmos/splittree/Makefile samples/gizmos/splittree/Makefile
samples/xml/Makefile samples/xml/Makefile
samples/plot/Makefile
utils/Makefile utils/Makefile
utils/wxrc/Makefile utils/wxrc/Makefile
utils/wxrcedit/Makefile utils/wxrcedit/Makefile

View File

@@ -0,0 +1,403 @@
/////////////////////////////////////////////////////////////////////////////
// Name: plot.h
// Purpose: wxPlotWindow
// Author: Robert Roebling
// Modified by:
// Created: 12/1/2000
// Copyright: (c) Robert Roebling
// RCS-ID: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PLOT_H_
#define _WX_PLOT_H_
#ifdef __GNUG__
#pragma interface "plot.h"
#endif
#include "wx/defs.h"
#include "wx/scrolwin.h"
#include "wx/event.h"
#include "wx/dynarray.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotEvent;
class WXDLLEXPORT wxPlotCurve;
class WXDLLEXPORT wxPlotValues;
class WXDLLEXPORT wxPlotArea;
class WXDLLEXPORT wxPlotXAxisArea;
class WXDLLEXPORT wxPlotYAxisArea;
class WXDLLEXPORT wxPlotWindow;
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
extern int wxEVT_PLOT_SEL_CHANGING;
extern int wxEVT_PLOT_SEL_CHANGED;
extern int wxEVT_PLOT_CLICKED;
extern int wxEVT_PLOT_DOUBLECLICKED;
extern int wxEVT_PLOT_ZOOM_IN;
extern int wxEVT_PLOT_ZOOM_OUT;
extern int wxEVT_PLOT_VALUE_SEL_CREATING;
extern int wxEVT_PLOT_VALUE_SEL_CREATED;
extern int wxEVT_PLOT_VALUE_SEL_CHANGING;
extern int wxEVT_PLOT_VALUE_SEL_CHANGED;
extern int wxEVT_PLOT_AREA_SEL_CREATING;
extern int wxEVT_PLOT_AREA_SEL_CREATED;
extern int wxEVT_PLOT_AREA_SEL_CHANGING;
extern int wxEVT_PLOT_AREA_SEL_CHANGED;
extern int wxEVT_PLOT_BEGIN_X_LABEL_EDIT;
extern int wxEVT_PLOT_END_X_LABEL_EDIT;
extern int wxEVT_PLOT_BEGIN_Y_LABEL_EDIT;
extern int wxEVT_PLOT_END_Y_LABEL_EDIT;
extern int wxEVT_PLOT_BEGIN_TITLE_EDIT;
extern int wxEVT_PLOT_END_TITLE_EDIT;
extern int wxEVT_PLOT_AREA_CREATE;
//-----------------------------------------------------------------------------
// consts
//-----------------------------------------------------------------------------
#define wxPLOT_X_AXIS 0x0004
#define wxPLOT_Y_AXIS 0x0008
#define wxPLOT_BUTTON_MOVE 0x0010
#define wxPLOT_BUTTON_ZOOM 0x0020
#define wxPLOT_BUTTON_ENLARGE 0x0040
#define wxPLOT_BUTTON_ALL (wxPLOT_BUTTON_MOVE|wxPLOT_BUTTON_ZOOM|wxPLOT_BUTTON_ENLARGE)
#define wxPLOT_DEFAULT (wxPLOT_X_AXIS|wxPLOT_Y_AXIS | wxPLOT_BUTTON_ALL)
//-----------------------------------------------------------------------------
// wxPlotEvent
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotEvent: public wxNotifyEvent
{
public:
wxPlotEvent( wxEventType commandType = wxEVT_NULL, int id = 0 );
wxPlotCurve *GetCurve()
{ return m_curve; }
void SetCurve( wxPlotCurve *curve )
{ m_curve = curve; }
double GetZoom()
{ return m_zoom; }
void SetZoom( double zoom )
{ m_zoom = zoom; }
wxInt32 GetPosition()
{ return m_position; }
void SetPosition( wxInt32 pos )
{ m_position = pos; }
private:
wxPlotCurve *m_curve;
double m_zoom;
wxInt32 m_position;
};
//-----------------------------------------------------------------------------
// wxPlotCurve
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotCurve: public wxObject
{
public:
wxPlotCurve( int offsetY, double startY, double endY );
virtual wxInt32 GetStartX() = 0;
virtual wxInt32 GetEndX() = 0;
virtual double GetY( wxInt32 x ) = 0;
void SetStartY( double startY )
{ m_startY = startY; }
double GetStartY()
{ return m_startY; }
void SetEndY( double endY )
{ m_endY = endY; }
double GetEndY()
{ return m_endY; }
void SetOffsetY( int offsetY )
{ m_offsetY = offsetY; }
int GetOffsetY()
{ return m_offsetY; }
void SetPenNormal( const wxPen &pen )
{ m_penNormal = pen; }
void SetPenSelected( const wxPen &pen )
{ m_penSelected = pen; }
private:
int m_offsetY;
double m_startY;
double m_endY;
wxPen m_penNormal;
wxPen m_penSelected;
DECLARE_ABSTRACT_CLASS(wxPlotCurve)
};
//-----------------------------------------------------------------------------
// wxPlotOnOffCurve
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotOnOff
{
public:
wxPlotOnOff() { }
wxInt32 m_on;
wxInt32 m_off;
void *m_clientData;
};
WX_DECLARE_EXPORTED_OBJARRAY(wxPlotOnOff, wxArrayPlotOnOff);
class WXDLLEXPORT wxPlotOnOffCurve: public wxObject
{
public:
wxPlotOnOffCurve( int offsetY );
wxInt32 GetStartX()
{ return m_minX; }
wxInt32 GetEndX()
{ return m_maxX; }
void SetOffsetY( int offsetY )
{ m_offsetY = offsetY; }
int GetOffsetY()
{ return m_offsetY; }
void Add( wxInt32 on, wxInt32 off, void *clientData = NULL );
size_t GetCount();
wxInt32 GetOn( size_t index );
wxInt32 GetOff( size_t index );
void* GetClientData( size_t index );
wxPlotOnOff *GetAt( size_t index );
virtual void DrawOnLine( wxDC &dc, wxCoord y, wxCoord start, wxCoord end, void *clientData );
virtual void DrawOffLine( wxDC &dc, wxCoord y, wxCoord start, wxCoord end );
private:
int m_offsetY;
wxInt32 m_minX;
wxInt32 m_maxX;
wxArrayPlotOnOff m_marks;
DECLARE_CLASS(wxPlotOnOffCurve)
};
//-----------------------------------------------------------------------------
// wxPlotArea
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotArea: public wxWindow
{
public:
wxPlotArea() {}
wxPlotArea( wxPlotWindow *parent );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void DrawCurve( wxDC *dc, wxPlotCurve *curve, int from = -1, int to = -1 );
void DrawOnOffCurve( wxDC *dc, wxPlotOnOffCurve *curve, int from = -1, int to = -1 );
void DeleteCurve( wxPlotCurve *curve, int from = -1, int to = -1 );
virtual void ScrollWindow( int dx, int dy, const wxRect *rect );
private:
wxPlotWindow *m_owner;
bool m_zooming;
DECLARE_CLASS(wxPlotArea)
DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
// wxPlotXAxisArea
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotXAxisArea: public wxWindow
{
public:
wxPlotXAxisArea() {}
wxPlotXAxisArea( wxPlotWindow *parent );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
private:
wxPlotWindow *m_owner;
DECLARE_CLASS(wxPlotXAxisArea)
DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
// wxPlotYAxisArea
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotYAxisArea: public wxWindow
{
public:
wxPlotYAxisArea() {}
wxPlotYAxisArea( wxPlotWindow *parent );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
private:
wxPlotWindow *m_owner;
DECLARE_CLASS(wxPlotYAxisArea)
DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
// wxPlotWindow
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPlotWindow: public wxScrolledWindow
{
public:
wxPlotWindow() {}
wxPlotWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flags = wxPLOT_DEFAULT );
~wxPlotWindow();
// curve accessors
// ---------------
void Add( wxPlotCurve *curve );
void Delete( wxPlotCurve* curve );
size_t GetCount();
wxPlotCurve *GetAt( size_t n );
void SetCurrent( wxPlotCurve* current );
wxPlotCurve *GetCurrent();
// mark list accessors
// -------------------
void Add( wxPlotOnOffCurve *curve );
void Delete( wxPlotOnOffCurve* curve );
size_t GetOnOffCurveCount();
wxPlotOnOffCurve *GetOnOffCurveAt( size_t n );
// vertical representation
// -----------------------
void Move( wxPlotCurve* curve, int pixels_up );
void Enlarge( wxPlotCurve *curve, double factor );
// horizontal representation
// -------------------------
void SetUnitsPerValue( double upv );
double GetUnitsPerValue()
{ return m_xUnitsPerValue; }
void SetZoom( double zoom );
double GetZoom()
{ return m_xZoom; }
// options
// -------
void SetScrollOnThumbRelease( bool scrollOnThumbRelease = TRUE )
{ m_scrollOnThumbRelease = scrollOnThumbRelease; }
bool GetScrollOnThumbRelease()
{ return m_scrollOnThumbRelease; }
void SetEnlargeAroundWindowCentre( bool enlargeAroundWindowCentre = TRUE )
{ m_enlargeAroundWindowCentre = enlargeAroundWindowCentre; }
bool GetEnlargeAroundWindowCentre()
{ return m_enlargeAroundWindowCentre; }
// events (may be overridden)
// --------------------------
void OnMoveUp( wxCommandEvent& event );
void OnMoveDown( wxCommandEvent& event );
void OnEnlarge( wxCommandEvent& event );
void OnShrink( wxCommandEvent& event );
void OnZoomIn( wxCommandEvent& event );
void OnZoomOut( wxCommandEvent& event );
void OnScroll2( wxScrollWinEvent& event );
// utilities
// ---------
void RedrawEverything();
void RedrawXAxis();
void RedrawYAxis();
void ResetScrollbar();
private:
friend class wxPlotArea;
friend class wxPlotXAxisArea;
friend class wxPlotYAxisArea;
double m_xUnitsPerValue;
double m_xZoom;
wxList m_curves;
wxList m_onOffCurves;
wxPlotArea *m_area;
wxPlotXAxisArea *m_xaxis;
wxPlotYAxisArea *m_yaxis;
wxPlotCurve *m_current;
bool m_scrollOnThumbRelease;
bool m_enlargeAroundWindowCentre;
DECLARE_CLASS(wxPlotWindow)
DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
// plot event macros
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxPlotEventFunction)(wxPlotEvent&);
#define EVT_PLOT(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, -1, (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_CHANGED(id, fn) { wxEVT_PLOT_SEL_CHANGED, id, -1, (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_DOUBLECLICKED(id, fn) { wxEVT_PLOT_DOUBLECLICKED, id, -1, (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_OUT(id, fn) { wxEVT_PLOT_ZOOM_OUT, id, -1, (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_CREATED(id, fn) { wxEVT_PLOT_VALUE_SEL_CREATED, id, -1, (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_CHANGED(id, fn) { wxEVT_PLOT_VALUE_SEL_CHANGED, id, -1, (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_CREATED(id, fn) { wxEVT_PLOT_AREA_SEL_CREATED, id, -1, (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_CHANGED(id, fn) { wxEVT_PLOT_AREA_SEL_CHANGED, 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, -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, -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, -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, -1, (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_END_TITLE_EDIT(id, fn) { wxEVT_PLOT_END_TITLE_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxPlotEventFunction) & fn, (wxObject *) NULL },
#endif
// _WX_PLOT_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -0,0 +1,32 @@
/* XPM */
static char *plot_dwn_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 18 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@@@@@@@@@@",
".@.@.@@@@@@@@@@@@@@@",
"@@.@@@@@@@@ @@@@@@@",
"@@.@@@@++++o +++@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@@@+ +@@@@@@@",
"@@.@@@@@@@@+@@@@@@@@",
"@@.@@....@@@@@@@@@@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@@O...O@@@",
"@@.@@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@@@@@",
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View File

@@ -0,0 +1,34 @@
/* XPM */
static char *plot_enl_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 20 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@+@@@@@@@@",
".@.@.@@@@@+ +@@@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@++++o +++@@@@",
"@@.@@....@@ @@@@@@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@@O...O@@@",
"@@.@@@@@@@@ @@@@@@@",
"@@.@@@@++++o +++@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@@@+ +@@@@@@@",
"@@@@@@@@@@@+@@@@@@@@",
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View File

@@ -0,0 +1,34 @@
/* XPM */
static char *plot_shr_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 20 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@ @@@@@@@",
".@.@.@@++++o +++@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@@@+ +@@@@@@@",
"@@.@@....@@+@@@@@@@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@+O...O@@@",
"@@.@@@@@@@+ +@@@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@++++o +++@@@@",
"@@.@@@@@@@@ @@@@@@@",
"@@@@@@@@@@@@@@@@@@@@",
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -0,0 +1,32 @@
/* XPM */
static char *plot_up_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 18 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@@@@@@@@@@",
".@.@.@@@@@@@@@@@@@@@",
"@@.@@@@@@@@+@@@@@@@@",
"@@.@@@@@@@+ +@@@@@@@",
"@@.@@@@@@+ o +@@@@@@",
"@@.@@@@@+ ooo +@@@@@",
"@@.@@@@@ o @@@@@",
"@@.@@@@++++o +++@@@@",
"@@.@@@@@@@@ @@@@@@@",
"@@.@@....@@@@@@@@@@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@@O...O@@@",
"@@.@@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@@@@@",
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -0,0 +1,32 @@
/* XPM */
static char *plot_zin_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 18 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@@@@@@@@@@",
".@.@.@@@@+@@@@+@@@@@",
"@@.@@@@+ +@@@@+ +@@@",
"@@.@@@+ +@@@@+ +@@",
"@@.@@+ o +@@@@+ o +@",
"@@.@+ oooo @@ oooo +",
"@@.@@+ o @@ o +@",
"@@.@@@+ +@@@@+ +@@",
"@@.@@@@+ +@@@@+ +@@@",
"@@.@@....+@@@@+@@@@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@@O...O@@@",
"@@.@@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@@@@@",
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

@@ -0,0 +1,32 @@
/* XPM */
static char *plot_zot_xpm[] = {
/* columns rows colors chars-per-pixel */
"20 18 8 1",
" c Gray0",
". c #000084",
"X c Blue",
"o c Green",
"O c #848484",
"+ c #c6c6c6",
"@ c None",
"# c Gray100",
/* pixels */
"@@.@@@@@@@@@@@@@@@@@",
"@...@@@@@@@@@@@@@@@@",
".@.@.@+@@@@@@@@@@+@@",
"@@.@@@+ +@@@@@@+ +@@",
"@@.@@@+ +@@@@+ +@@",
"@@.@@@+ o +@@+ o +@@",
"@@.@@ oooo ++ oooo @",
"@@.@@ o +@@+ o @",
"@@.@@@+ +@@@@+ +@@",
"@@.@@@+ +@@@@@@+ +@@",
"@@.@@....@@@@@@@@+@@",
"@@.@.O@@@.O@@@@@@@@@",
"@@.O.@@@@@.@@@@@@@.@",
"@@..@@@@@@@.@@@@@.O@",
"@@.@@@@@@@@O.@@@.O@@",
"@@.@@@@@@@@@O...O@@@",
"@@.@@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@@@@@",
};

View File

@@ -0,0 +1,8 @@
// For /plot.cpp
plot_up_bmp BITMAP "wx/plot/plot_up.bmp"
plot_dwn_bmp BITMAP "wx/plot/plot_dwn.bmp"
plot_enl_bmp BITMAP "wx/plot/plot_enl.bmp"
plot_shr_bmp BITMAP "wx/plot/plot_shr.bmp"
plot_zin_bmp BITMAP "wx/plot/plot_zin.bmp"
plot_zot_bmp BITMAP "wx/plot/plot_zot.bmp"

View File

@@ -1,6 +1,6 @@
# $Id$ # $Id$
CONTRIB_SAMPLES=mmedia ogl stc gizmos canvas xml CONTRIB_SAMPLES=mmedia ogl stc gizmos canvas xml plot
all: all:
@for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done @for d in $(CONTRIB_SAMPLES); do (cd $$d && $(MAKE)); done

View File

@@ -0,0 +1,16 @@
# Makefile for mmedia sample.
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
program_dir = contrib/samples/plot
PROGRAM=plot
OBJECTS=plot.o
APPEXTRALIBS=$(top_builddir)/lib/libplot.@WX_TARGET_LIBRARY_TYPE@
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makeprog.env

View File

@@ -0,0 +1,185 @@
/*
* Program: wxPlotWindow
*
* Author: Robert Roebling
*
* Copyright: (C) 1999, Robert Roebling
*
*/
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/plot.h"
#include "wx/image.h"
#include "wx/listctrl.h"
#include "wx/sizer.h"
#include "wx/log.h"
#include "wx/intl.h"
#include <math.h>
// derived classes
class MyPlotCurve;
class MyFrame;
class MyApp;
// MyPlotCurve
class MyPlotCurve: public wxPlotCurve
{
public:
MyPlotCurve( int offsetY, double startY, double endY ) :
wxPlotCurve( offsetY, startY, endY ) {}
virtual wxInt32 GetStartX()
{ return 0; }
virtual wxInt32 GetEndX()
{ return 7000; }
virtual double GetY( wxInt32 x )
{
double dx = x;
dx /= 100;
return sin( dx );
}
};
// MyFrame
class MyFrame: public wxFrame
{
public:
MyFrame();
void OnAbout( wxCommandEvent &event );
void OnQuit( wxCommandEvent &event );
void OnPlotClick( wxPlotEvent &event );
void OnPlotDClick( wxPlotEvent &event );
wxPlotWindow *m_plot;
wxTextCtrl *m_log;
private:
DECLARE_DYNAMIC_CLASS(MyFrame)
DECLARE_EVENT_TABLE()
};
// MyApp
class MyApp: public wxApp
{
public:
virtual bool OnInit();
};
// main program
IMPLEMENT_APP(MyApp)
// MyFrame
const int ID_QUIT = 108;
const int ID_ABOUT = 109;
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
EVT_MENU (ID_ABOUT, MyFrame::OnAbout)
EVT_MENU (ID_QUIT, MyFrame::OnQuit)
EVT_PLOT_CLICKED ( -1, MyFrame::OnPlotClick)
EVT_PLOT_DOUBLECLICKED ( -1, MyFrame::OnPlotDClick)
END_EVENT_TABLE()
MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, -1, "wxPlotWindow sample",
wxPoint(20,20), wxSize(470,500) )
{
wxMenu *file_menu = new wxMenu();
file_menu->Append( ID_ABOUT, "&About..");
file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
wxMenuBar *menu_bar = new wxMenuBar();
menu_bar->Append(file_menu, "&File");
SetMenuBar( menu_bar );
CreateStatusBar(2);
int widths[] = { -1, 100 };
SetStatusWidths( 2, widths );
m_plot = new wxPlotWindow( this, -1, wxPoint(0,0), wxSize(100,100), wxSUNKEN_BORDER | wxPLOT_DEFAULT );
m_plot->SetUnitsPerValue( 0.01 );
m_plot->SetScrollOnThumbRelease( TRUE );
m_plot->Add( new MyPlotCurve( 0, -1.5, 1.5 ) );
m_plot->Add( new MyPlotCurve( 50, -1.5, 1.5 ) );
wxPlotOnOffCurve *oo = new wxPlotOnOffCurve( 10 );
oo->Add( 10, 20 );
oo->Add( 25, 30 );
oo->Add( 100, 400 );
oo->Add( 1000, 2000 );
m_plot->Add( oo );
m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_plot, 1, wxEXPAND );
topsizer->Add( m_log, 0, wxEXPAND );
SetAutoLayout( TRUE );
SetSizer( topsizer );
}
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{
Close( TRUE );
}
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{
(void)wxMessageBox( "wxPlotWindow Demo\n"
"Robert Roebling (c) 1999,2000",
"About wxPlotWindow Demo", wxICON_INFORMATION | wxOK );
}
void MyFrame::OnPlotClick( wxPlotEvent &event )
{
double x = event.GetPosition() * m_plot->GetUnitsPerValue();
double y = event.GetCurve()->GetY( event.GetPosition() );
wxLogMessage( "Clicked on curve at x coordinate: %f, value: %f", x, y );
}
void MyFrame::OnPlotDClick( wxPlotEvent &event )
{
double x = event.GetPosition() * m_plot->GetUnitsPerValue();
double y = event.GetCurve()->GetY( event.GetPosition() );
wxLogMessage( "Double clicked on curve at x coordinate: %f, value: %f", x, y );
}
//-----------------------------------------------------------------------------
// MyApp
//-----------------------------------------------------------------------------
bool MyApp::OnInit()
{
wxFrame *frame = new MyFrame();
frame->Show( TRUE );
return TRUE;
}

View File

@@ -0,0 +1,7 @@
NAME Plot
DESCRIPTION 'wxWindows Plot sample'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 4048
STACKSIZE 16000

View File

@@ -0,0 +1,2 @@
#include "wx/msw/wx.rc"
#include "wx/plot/wxplot.rc"

View File

@@ -0,0 +1,23 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
libsrc_dir = contrib/src/plot
TARGET_LIBNAME=libplot
LIBVERSION_CURRENT=1
LIBVERSION_REVISION=0
LIBVERSION_AGE=0
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=plot
HEADERS=plot.h
OBJECTS=plot.o
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env

1204
contrib/src/plot/plot.cpp Normal file

File diff suppressed because it is too large Load Diff