From 5f4f8b1129659adb2015ce42821faccf8fe6d8d5 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 27 May 2009 10:32:51 +0200 Subject: Templatize GraphData * grapher/GraphData.hxx (GraphDataBase): new superclass for GraphData. Split time data out as a separate vector. (GraphData): Rewrite as template. * grapher/GraphWidget.cxx (on_expose_event): Reflect GraphData templatization. Handle events with string values. * grapher/GraphWidget.hxx (GraphWidget): Keep pointers to GraphDataBase objects instead of GraphData. * grapher/StapParser.cxx (parseData): new member function (ioCallback): Handle new discreet event * grapher/StapParser.hxx (StapParser): keep pointers to GraphDataBase objects instead of GraphData * testsuite/systemtap.examples/general/grapher.stp: Display actual key pressed for keyboard event --- grapher/GraphWidget.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grapher/GraphWidget.hxx') diff --git a/grapher/GraphWidget.hxx b/grapher/GraphWidget.hxx index 46075b78..86ba771d 100644 --- a/grapher/GraphWidget.hxx +++ b/grapher/GraphWidget.hxx @@ -17,7 +17,7 @@ namespace systemtap public: GraphWidget(); virtual ~GraphWidget(); - void addGraphData(std::tr1::shared_ptr data); + void addGraphData(std::tr1::shared_ptr data); void getExtents(double& left, double& right, double& top, double& bottom) const; void setExtents(double left, double right, double top, double bottom); double getLineWidth() { return _lineWidth; } @@ -38,7 +38,7 @@ namespace systemtap virtual bool on_button_release_event(GdkEventButton* event); virtual bool on_scroll_event(GdkEventScroll* event); bool on_timeout(); - typedef std::vector > DatasetList; + typedef std::vector > DatasetList; DatasetList _datasets; double _left; double _right; -- cgit From 364ad890e341bb60ae169af69933a382d4bf9f81 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 27 Jul 2009 12:46:30 +0200 Subject: Support for presenting multiple graphs * grapher/Graph.hxx: New file; class for single graph display. * grapher/Graph.cxx: New file. * grapher/GraphData.hxx: Associate title and axis labels with graph data and not a graph display. * grapher/GraphWidget.hxx: Move graph-related members to Graph class. * grapher/GraphWidget.cxx (getExtents, setExtents): Move to Graph class (on_expose_event): Move graph rendering to Graph. (on_button_press_event): Delegate to Graph. (on_motion_notify_event, on_scroll_event): Modify "active" graph. * grapher/StapParser.cxx (findTaggedValue): New parsing helper function. (io_callback): Support new syntax where properties are attached to graph data and not the entire graph. * grapher/grapher.cxx (GrapherWindow): Don't set graph values. * grapher/Makefile.am: Add Graph.cxx. * testsuite/systemtap.examples/general/grapher.stp: New property syntax. --- grapher/GraphWidget.hxx | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'grapher/GraphWidget.hxx') diff --git a/grapher/GraphWidget.hxx b/grapher/GraphWidget.hxx index 86ba771d..c15f8fcd 100644 --- a/grapher/GraphWidget.hxx +++ b/grapher/GraphWidget.hxx @@ -6,7 +6,7 @@ #include #include -#include "GraphData.hxx" +#include namespace systemtap { @@ -18,19 +18,15 @@ namespace systemtap GraphWidget(); virtual ~GraphWidget(); void addGraphData(std::tr1::shared_ptr data); - void getExtents(double& left, double& right, double& top, double& bottom) const; - void setExtents(double left, double right, double top, double bottom); - double getLineWidth() { return _lineWidth; } - void setLineWidth(double lineWidth) { _lineWidth = lineWidth; } - bool getAutoScaling() const { return _autoScaling; } - void setAutoScaling(bool val) { _autoScaling = val; } - std::string getTitle() const { return _title; } - void setTitle(const std::string& title) { _title = title; } - std::string getXAxisText() const { return _xAxisText; } - void setXAxisText(const std::string& text) { _xAxisText = text; } - std::string getYAxisText() const { return _yAxisText; } - void setYAxisText(const std::string& text) { _yAxisText = text; } + protected: + typedef std::vector > GraphList; + GraphList _graphs; + // For click and drag + std::tr1::shared_ptr _activeGraph; + // Dragging all graphs simultaneously, or perhaps seperately + typedef std::vector > DragList; + DragList dragCoords; //Override default signal handler: virtual bool on_expose_event(GdkEventExpose* event); virtual bool on_motion_notify_event(GdkEventMotion* event); @@ -38,25 +34,11 @@ namespace systemtap virtual bool on_button_release_event(GdkEventButton* event); virtual bool on_scroll_event(GdkEventScroll* event); bool on_timeout(); - typedef std::vector > DatasetList; - DatasetList _datasets; - double _left; - double _right; - double _top; - double _bottom; - double _lineWidth; - bool _autoScaling; - bool _autoScrolling; - double _zoomFactor; bool _trackingDrag; double _dragOriginX; double _dragOriginY; double _dragOrigLeft; double _dragOrigRight; - std::string _title; - std::string _xAxisText; - std::string _yAxisText; - std::tr1::shared_ptr _playButton; }; } #endif // SYSTEMTAP_GRAPHWIDGET_H -- cgit