From eece8f14d92f71fc12ab87c529fffc5fcc5a4e94 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 2 Sep 2009 12:39:05 +0200 Subject: Add graph data chooser window, based on glade * configure.ac: Test for libglademm * grapher/GraphWidget.hxx (DataModelColumns): new class (onDataDialogCancel, void onDataAdd, onDataRemove, onDataDialogOpen): new methods * grapher/GraphWidget.cxx: ditto; methods for the graph data dialog. * grapher/graph-dialog.glade: New file. * grapher/graph-dialog.gladep: New file. * grapher/Makefile.am (dist_pkgdata_DATA): add graph-dialog.glade to installation. * grapher/GraphWidget.cxx (GraphWidget constructor): Use PKGDATADIR --- grapher/GraphWidget.cxx | 62 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 3 deletions(-) (limited to 'grapher/GraphWidget.cxx') diff --git a/grapher/GraphWidget.cxx b/grapher/GraphWidget.cxx index 757060e1..f3319806 100644 --- a/grapher/GraphWidget.cxx +++ b/grapher/GraphWidget.cxx @@ -1,8 +1,13 @@ #include #include #include +#include #include +#include + +#include "../config.h" + #include "GraphWidget.hxx" #include "CairoWidget.hxx" @@ -10,7 +15,9 @@ namespace systemtap { using namespace std; using namespace std::tr1; - + + + GraphWidget::GraphWidget() : _trackingDrag(false), _width(600), _height(200) { @@ -34,6 +41,30 @@ namespace systemtap // Temporary testing of multiple graphs shared_ptr graph(new Graph); _graphs.push_back(graph); + try + { + _refXmlDataDialog = Gnome::Glade::Xml::create(PKGDATADIR "/graph-dialog.glade"); + _refXmlDataDialog->get_widget("dialog1", _dataDialog); + Gtk::Button* button = 0; + _refXmlDataDialog->get_widget("cancelbutton1", button); + button->signal_clicked() + .connect(sigc::mem_fun(*this, &GraphWidget::onDataDialogCancel), + false); + _refXmlDataDialog->get_widget("button1", button); + button->signal_clicked() + .connect(sigc::mem_fun(*this, &GraphWidget::onDataAdd), false); + _refXmlDataDialog->get_widget("button2", button); + button->signal_clicked() + .connect(sigc::mem_fun(*this, &GraphWidget::onDataRemove), false); + _refXmlDataDialog->get_widget("treeview1", _dataTreeView); + _dataDialog->signal_map() + .connect(sigc::mem_fun(*this, &GraphWidget::onDataDialogOpen)); + } + catch (const Gnome::Glade::XmlError& ex ) + { + std::cerr << ex.what() << std::endl; + throw; + } } GraphWidget::~GraphWidget() @@ -103,8 +134,16 @@ namespace systemtap && event->y >= (*g)->_graphY && event->y < (*g)->_graphY + (*g)->_graphHeight) { - _activeGraph = *g; - break; + _activeGraph = *g; + if (event->button == 3) + { + _dataDialog->show(); + return true; + } + else + { + break; + } } } if (!_activeGraph) @@ -198,4 +237,21 @@ namespace systemtap req->width = _width; req->height = _height; } + + void GraphWidget::onDataDialogCancel() + { + _dataDialog->hide(); + } + + void GraphWidget::onDataAdd() + { + } + + void GraphWidget::onDataRemove() + { + } + + void GraphWidget::onDataDialogOpen() + { + } } -- cgit