From e9bb96bf484a9b415ba690131300134570099567 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Jan 2013 09:10:26 +0000 Subject: Make duration spinner in properties dialog functional. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4986 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaGUI.hpp | 1 + src/gui/NodePropertiesWindow.cpp | 26 +++++++++++++++++--------- src/gui/NodePropertiesWindow.hpp | 12 ++++++++---- src/gui/NodeView.cpp | 3 ++- src/gui/machina.ui | 39 ++++++++++++++++++++++++++------------- 5 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 3c10cda..c450ebb 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -21,6 +21,7 @@ #include +#include "raul/Maid.hpp" #include "raul/TimeStamp.hpp" #include "machina/types.hpp" diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp index c05b257..6a5f0fc 100644 --- a/src/gui/NodePropertiesWindow.cpp +++ b/src/gui/NodePropertiesWindow.cpp @@ -15,6 +15,12 @@ */ #include + +#include "client/ClientObject.hpp" +#include "machina/URIs.hpp" +#include "raul/TimeStamp.hpp" + +#include "MachinaGUI.hpp" #include "NodePropertiesWindow.hpp" #include "WidgetFactory.hpp" @@ -29,6 +35,7 @@ NodePropertiesWindow::NodePropertiesWindow( BaseObjectType* cobject, const Glib::RefPtr& xml) : Gtk::Dialog(cobject) + , _gui(NULL) { property_visible() = false; @@ -63,12 +70,9 @@ NodePropertiesWindow::apply_clicked() action = dynamic_ptr_cast(_node->exit_action()); action->event()[1] = note; } - - const double duration_dbl = _duration_spinbutton->get_value(); - TimeStamp duration(TimeUnit(TimeUnit::BEATS, 19200), duration_dbl); - _node->set_duration(duration); - _node->set_changed(); #endif + _node->set(URIs::instance().machina_duration, + _gui->forge().make(float(_duration_spinbutton->get_value()))); } void @@ -87,8 +91,10 @@ NodePropertiesWindow::ok_clicked() } void -NodePropertiesWindow::set_node(SPtr node) +NodePropertiesWindow::set_node(MachinaGUI* gui, + SPtr node) { + _gui = gui; _node = node; #if 0 SPtr enter_action = dynamic_ptr_cast(node->enter_action()); @@ -102,12 +108,14 @@ NodePropertiesWindow::set_node(SPtr node) } else { _note_spinbutton->hide(); } - _duration_spinbutton->set_value(node->duration().to_double()); #endif + _duration_spinbutton->set_value( + node->get(URIs::instance().machina_duration).get_float()); } void -NodePropertiesWindow::present(Gtk::Window* parent, +NodePropertiesWindow::present(MachinaGUI* gui, + Gtk::Window* parent, SPtr node) { if (!_instance) { @@ -120,7 +128,7 @@ NodePropertiesWindow::present(Gtk::Window* parent, } } - _instance->set_node(node); + _instance->set_node(gui, node); _instance->show(); } diff --git a/src/gui/NodePropertiesWindow.hpp b/src/gui/NodePropertiesWindow.hpp index 6927f7c..a999004 100644 --- a/src/gui/NodePropertiesWindow.hpp +++ b/src/gui/NodePropertiesWindow.hpp @@ -27,8 +27,9 @@ namespace client { class ClientObject; } namespace gui { -class NodePropertiesWindow - : public Gtk::Dialog +class MachinaGUI; + +class NodePropertiesWindow : public Gtk::Dialog { public: NodePropertiesWindow(BaseObjectType* cobject, @@ -36,11 +37,13 @@ public: ~NodePropertiesWindow(); - static void present(Gtk::Window* parent, + static void present(MachinaGUI* gui, + Gtk::Window* parent, SPtr node); private: - void set_node(SPtr node); + void set_node(MachinaGUI* gui, + SPtr node); void apply_clicked(); void cancel_clicked(); @@ -48,6 +51,7 @@ private: static NodePropertiesWindow* _instance; + MachinaGUI* _gui; SPtr _node; Gtk::SpinButton* _note_spinbutton; diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index e8364ec..e4e4faa 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -68,7 +68,8 @@ NodeView::~NodeView() bool NodeView::on_double_click(GdkEventButton*) { - NodePropertiesWindow::present(_window, _node); + MachinaCanvas* canvas = dynamic_cast(this->canvas()); + NodePropertiesWindow::present(canvas->app(), _window, _node); return true; } diff --git a/src/gui/machina.ui b/src/gui/machina.ui index dc138b9..d251ce2 100644 --- a/src/gui/machina.ui +++ b/src/gui/machina.ui @@ -2,17 +2,6 @@ - - 1 - 480 - 120 - 1 - 10 - - - gtk-media-record - True - gtk-media-play True @@ -72,6 +61,19 @@ along with Machina; if not, write to the Free Software Foundation, Inc., + + 1 + 480 + 120 + 1 + 10 + + + 64 + 0.25 + 1 + 4 + False 8 @@ -942,6 +944,16 @@ selection to many nodes. + + 127 + 64 + 1 + 10 + + + gtk-media-record + True + False 8 @@ -1035,8 +1047,8 @@ selection to many nodes. False True True - 1 - 2 + duration_adjustment + 3 True @@ -1081,6 +1093,7 @@ selection to many nodes. False True True + note_num_adjustment 1 True -- cgit v1.2.1