diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 3 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 25 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 7 | ||||
-rw-r--r-- | src/gui/machina.ui | 35 |
4 files changed, 36 insertions, 34 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 15aaf57..3413a9f 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -186,7 +186,8 @@ MachinaCanvas::action_create_node(double x, double y) _app->forge().make_urid(URIs::instance().machina_Node)); obj.set(URIs::instance().machina_canvas_x, _app->forge().make((float)x)); obj.set(URIs::instance().machina_canvas_y, _app->forge().make((float)y)); - obj.set(URIs::instance().machina_duration, _app->forge().make(1.0f)); + obj.set(URIs::instance().machina_duration, + _app->forge().make((float)_app->default_length())); _app->controller()->create(obj); } diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 5057f5a..2147c27 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -149,6 +149,8 @@ MachinaGUI::MachinaGUI(SPtr<machina::Engine> engine) _bpm_spinbutton->signal_changed().connect( sigc::mem_fun(this, &MachinaGUI::tempo_changed)); _quantize_checkbutton->signal_toggled().connect( + sigc::mem_fun(this, &MachinaGUI::quantize_record_changed)); + _quantize_spinbutton->signal_changed().connect( sigc::mem_fun(this, &MachinaGUI::quantize_changed)); _mutate_button->signal_clicked().connect( @@ -176,8 +178,6 @@ MachinaGUI::MachinaGUI(SPtr<machina::Engine> engine) sigc::bind(sigc::mem_fun(this, &MachinaGUI::mutate), SPtr<Machine>(), 6)); - connect_widgets(); - _canvas->widget().show(); _main_window->present(); @@ -375,7 +375,6 @@ MachinaGUI::update_toolbar() _record_button->set_active(state == Driver::PlayState::RECORDING); _step_record_button->set_active(state == Driver::PlayState::STEP_RECORDING); _play_button->set_active(state == Driver::PlayState::PLAYING); - _quantize_spinbutton->set_sensitive(_quantize_checkbutton->get_active()); } void @@ -386,31 +385,23 @@ MachinaGUI::rebuild_canvas() } void -MachinaGUI::quantize_changed() +MachinaGUI::quantize_record_changed() { - if (_quantize_checkbutton->get_active()) { - _engine->set_quantization(1.0 / _quantize_spinbutton->get_value()); - } else { - _engine->set_quantization(0.0); - } - update_toolbar(); + _engine->driver()->set_quantize_record(_quantize_checkbutton->get_active()); } void -MachinaGUI::tempo_changed() +MachinaGUI::quantize_changed() { - _engine->set_bpm(_bpm_spinbutton->get_value_as_int()); + _engine->set_quantization(1.0 / _quantize_spinbutton->get_value()); } -/** Update the sensitivity status of menus to reflect the present. - */ void -MachinaGUI::connect_widgets() +MachinaGUI::tempo_changed() { + _engine->set_bpm(_bpm_spinbutton->get_value_as_int()); } -using namespace std; - void MachinaGUI::menu_file_quit() { diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index e917ff8..4bbb238 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -66,6 +66,10 @@ public: SPtr<machina::Controller> controller() { return _controller; } + double default_length() const { + return 1 / (double)_quantize_spinbutton->get_value(); + } + inline void queue_refresh() { _refresh = true; } void on_new_object(SPtr<machina::client::ClientObject> object); @@ -76,8 +80,6 @@ public: } protected: - void connect_widgets(); - void menu_file_quit(); void menu_file_open(); void menu_file_save(); @@ -116,6 +118,7 @@ protected: void chain_toggled(); void fan_toggled(); + void quantize_record_changed(); void quantize_changed(); void tempo_changed(); diff --git a/src/gui/machina.ui b/src/gui/machina.ui index 62d3459..cc03739 100644 --- a/src/gui/machina.ui +++ b/src/gui/machina.ui @@ -2,6 +2,13 @@ <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> @@ -65,13 +72,6 @@ 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="GtkDialog" id="help_dialog"> <property name="can_focus">False</property> <property name="border_width">8</property> @@ -175,11 +175,11 @@ selection to many nodes.</property> <action-widget response="-7">closebutton1</action-widget> </action-widgets> </object> - <object class="GtkAdjustment" id="quantize_adjustment"> + <object class="GtkAdjustment" id="length_adjustment"> <property name="lower">1</property> <property name="upper">256</property> - <property name="value">16</property> - <property name="step_increment">2</property> + <property name="value">8</property> + <property name="step_increment">1</property> <property name="page_increment">8</property> </object> <object class="GtkWindow" id="machina_win"> @@ -533,6 +533,7 @@ selection to many nodes.</property> <object class="GtkSpinButton" id="bpm_spinbutton"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Playback tempo</property> <property name="max_length">3</property> <property name="invisible_char">•</property> <property name="width_chars">3</property> @@ -590,12 +591,12 @@ selection to many nodes.</property> <property name="border_width">4</property> <child> <object class="GtkCheckButton" id="quantize_checkbutton"> - <property name="label" translatable="yes">1/</property> + <property name="label" translatable="yes">Quantize 1/</property> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Quantization</property> + <property name="tooltip_text" translatable="yes">Quantize recorded notes</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> </object> @@ -608,9 +609,8 @@ selection to many nodes.</property> <child> <object class="GtkSpinButton" id="quantize_spinbutton"> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Quantize note type</property> + <property name="tooltip_text" translatable="yes">Note type for quantization</property> <property name="primary_icon_activatable">False</property> <property name="secondary_icon_activatable">False</property> <property name="primary_icon_sensitive">True</property> @@ -1105,4 +1105,11 @@ selection to many nodes.</property> <action-widget response="-5">node_properties_ok_button</action-widget> </action-widgets> </object> + <object class="GtkAdjustment" id="quantize_adjustment"> + <property name="lower">1</property> + <property name="upper">256</property> + <property name="value">8</property> + <property name="step_increment">1</property> + <property name="page_increment">8</property> + </object> </interface> |