From c18a296b760df73e2c233077aa0b863f67ed725f Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 4 Aug 2009 23:46:02 +0200 Subject: more multiple graph fixes * grapher/Graph.cxx (Graph constructor): set _drawX, _drawY * grapher/GraphWidget.cxx (addGraph): Fix graph layout (on_button_press_event): Fix test of play button in multiple graphs --- grapher/Graph.cxx | 2 ++ grapher/GraphWidget.cxx | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/grapher/Graph.cxx b/grapher/Graph.cxx index 7f9b2607..496b85b1 100644 --- a/grapher/Graph.cxx +++ b/grapher/Graph.cxx @@ -17,6 +17,8 @@ namespace systemtap _left(0.0), _right(1.0), _top(5.0), _bottom(0.0) { setOrigin(x, y); + _graphX = x; + _graphY = y; } diff --git a/grapher/GraphWidget.cxx b/grapher/GraphWidget.cxx index c4613fd7..757060e1 100644 --- a/grapher/GraphWidget.cxx +++ b/grapher/GraphWidget.cxx @@ -47,15 +47,15 @@ namespace systemtap void GraphWidget::addGraph() { - shared_ptr graph(new Graph); double x = 0.0; double y = 0.0; if (!_graphs.empty()) { _graphs.back()->getOrigin(x, y); y += _graphs.back()->_height + 10; - _height = y + graph->_height; } + shared_ptr graph(new Graph(x, y)); + _height = y + graph->_height; graph->setOrigin(x, y); _graphs.push_back(graph); queue_resize(); @@ -109,8 +109,11 @@ namespace systemtap } if (!_activeGraph) return true; + double activeX, activeY; + _activeGraph->getOrigin(activeX, activeY); if (!_activeGraph->_autoScrolling - && _activeGraph->_playButton->containsPoint(event->x, event->y)) + && _activeGraph->_playButton->containsPoint(event->x - activeX, + event->y - activeY)) { _activeGraph->_autoScaling = true; _activeGraph->_autoScrolling = true; @@ -131,6 +134,7 @@ namespace systemtap bool GraphWidget::on_button_release_event(GdkEventButton* event) { + _activeGraph.reset(); _trackingDrag = false; return true; } -- cgit