aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/MachinaGUI.hpp1
-rw-r--r--src/gui/NodePropertiesWindow.cpp26
-rw-r--r--src/gui/NodePropertiesWindow.hpp12
-rw-r--r--src/gui/NodeView.cpp3
-rw-r--r--src/gui/machina.ui39
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 <gtkmm.h>
+#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 <string>
+
+#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<Gtk::Builder>& xml)
: Gtk::Dialog(cobject)
+ , _gui(NULL)
{
property_visible() = false;
@@ -63,12 +70,9 @@ NodePropertiesWindow::apply_clicked()
action = dynamic_ptr_cast<MidiAction>(_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<machina::client::ClientObject> node)
+NodePropertiesWindow::set_node(MachinaGUI* gui,
+ SPtr<machina::client::ClientObject> node)
{
+ _gui = gui;
_node = node;
#if 0
SPtr<MidiAction> enter_action = dynamic_ptr_cast<MidiAction>(node->enter_action());
@@ -102,12 +108,14 @@ NodePropertiesWindow::set_node(SPtr<machina::client::ClientObject> 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<machina::client::ClientObject> 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<machina::client::ClientObject> node);
private:
- void set_node(SPtr<machina::client::ClientObject> node);
+ void set_node(MachinaGUI* gui,
+ SPtr<machina::client::ClientObject> node);
void apply_clicked();
void cancel_clicked();
@@ -48,6 +51,7 @@ private:
static NodePropertiesWindow* _instance;
+ MachinaGUI* _gui;
SPtr<machina::client::ClientObject> _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<MachinaCanvas*>(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 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkAdjustment" id="bpm_adjustment">
- <property name="lower">1</property>
- <property name="upper">480</property>
- <property name="value">120</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkRadioAction" id="record_action">
- <property name="stock_id">gtk-media-record</property>
- <property name="draw_as_radio">True</property>
- </object>
<object class="GtkRadioAction" id="play_action">
<property name="stock_id">gtk-media-play</property>
<property name="draw_as_radio">True</property>
@@ -72,6 +61,19 @@ along with Machina; if not, write to the Free Software Foundation, Inc.,
</object>
</child>
</object>
+ <object class="GtkAdjustment" id="bpm_adjustment">
+ <property name="lower">1</property>
+ <property name="upper">480</property>
+ <property name="value">120</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="duration_adjustment">
+ <property name="upper">64</property>
+ <property name="value">0.25</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">4</property>
+ </object>
<object class="GtkDialog" id="help_dialog">
<property name="can_focus">False</property>
<property name="border_width">8</property>
@@ -942,6 +944,16 @@ selection to many nodes.</property>
</object>
</child>
</object>
+ <object class="GtkAdjustment" id="note_num_adjustment">
+ <property name="upper">127</property>
+ <property name="value">64</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkRadioAction" id="record_action">
+ <property name="stock_id">gtk-media-record</property>
+ <property name="draw_as_radio">True</property>
+ </object>
<object class="GtkDialog" id="node_properties_dialog">
<property name="can_focus">False</property>
<property name="border_width">8</property>
@@ -1035,8 +1047,8 @@ selection to many nodes.</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
- <property name="climb_rate">1</property>
- <property name="digits">2</property>
+ <property name="adjustment">duration_adjustment</property>
+ <property name="digits">3</property>
<property name="numeric">True</property>
</object>
<packing>
@@ -1081,6 +1093,7 @@ selection to many nodes.</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">note_num_adjustment</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
</object>