From ac0438352410a5af5d64d2268d3541b47e8a2669 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 13 Jan 2013 20:46:13 +0000 Subject: Fix step recording. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4965 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaGUI.cpp | 26 +++++++++++++++++++------- src/gui/MachinaGUI.hpp | 5 +++-- src/gui/machina.ui | 49 +++++++++++++++++++++++-------------------------- 3 files changed, 45 insertions(+), 35 deletions(-) (limited to 'src/gui') diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 1b2b1f5..1d4d272 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -71,13 +71,13 @@ MachinaGUI::MachinaGUI(SPtr engine) xml->get_widget("help_about_menuitem", _menu_help_about); xml->get_widget("help_help_menuitem", _menu_help_help); xml->get_widget("canvas_scrolledwindow", _canvas_scrolledwindow); - xml->get_widget("step_record_checkbutton", _step_record_checkbutton); xml->get_widget("bpm_spinbutton", _bpm_spinbutton); xml->get_widget("quantize_checkbutton", _quantize_checkbutton); xml->get_widget("quantize_spinbutton", _quantize_spinbutton); - xml->get_widget("record_but", _record_button); xml->get_widget("stop_but", _stop_button); xml->get_widget("play_but", _play_button); + xml->get_widget("record_but", _record_button); + xml->get_widget("step_record_but", _step_record_button); xml->get_widget("zoom_normal_but", _zoom_normal_button); xml->get_widget("zoom_full_but", _zoom_full_button); xml->get_widget("chain_but", _chain_button); @@ -101,12 +101,14 @@ MachinaGUI::MachinaGUI(SPtr engine) _canvas_scrolledwindow->property_hadjustment().get_value()->set_step_increment(10); _canvas_scrolledwindow->property_vadjustment().get_value()->set_step_increment(10); - _record_button->signal_toggled().connect( - sigc::mem_fun(this, &MachinaGUI::record_toggled)); _stop_button->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::stop_toggled)); _play_button->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::play_toggled)); + _record_button->signal_toggled().connect( + sigc::mem_fun(this, &MachinaGUI::record_toggled)); + _step_record_button->signal_toggled().connect( + sigc::mem_fun(this, &MachinaGUI::step_record_toggled)); _zoom_normal_button->signal_clicked().connect(sigc::bind( sigc::mem_fun(this, &MachinaGUI::zoom), 1.0)); @@ -179,7 +181,6 @@ MachinaGUI::MachinaGUI(SPtr engine) _main_window->present(); - _step_record_checkbutton->show(); _quantize_checkbutton->set_active(false); update_toolbar(); @@ -371,6 +372,7 @@ MachinaGUI::update_toolbar() { const Driver::PlayState state = _engine->driver()->play_state(); _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()); } @@ -666,7 +668,8 @@ MachinaGUI::stop_toggled() if (_stop_button->get_active()) { const Driver::PlayState old_state = _engine->driver()->play_state(); _engine->driver()->set_play_state(Driver::PlayState::STOPPED); - if (old_state == Driver::PlayState::RECORDING) { + if (old_state == Driver::PlayState::RECORDING || + old_state == Driver::PlayState::STEP_RECORDING) { rebuild_canvas(); } } @@ -678,7 +681,8 @@ MachinaGUI::play_toggled() if (_play_button->get_active()) { const Driver::PlayState old_state = _engine->driver()->play_state(); _engine->driver()->set_play_state(Driver::PlayState::PLAYING); - if (old_state == Driver::PlayState::RECORDING) { + if (old_state == Driver::PlayState::RECORDING || + old_state == Driver::PlayState::STEP_RECORDING) { rebuild_canvas(); } } @@ -692,6 +696,14 @@ MachinaGUI::record_toggled() } } +void +MachinaGUI::step_record_toggled() +{ + if (_step_record_button->get_active()) { + _engine->driver()->set_play_state(Driver::PlayState::STEP_RECORDING); + } +} + void MachinaGUI::chain_toggled() { diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index 061cc8a..d794fbb 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -109,6 +109,7 @@ protected: void stop_toggled(); void play_toggled(); void record_toggled(); + void step_record_toggled(); void chain_toggled(); void fan_toggled(); @@ -152,13 +153,13 @@ protected: Gtk::ScrolledWindow* _canvas_scrolledwindow; Gtk::TextView* _status_text; Gtk::Expander* _messages_expander; - Gtk::ToggleToolButton* _step_record_checkbutton; Gtk::SpinButton* _bpm_spinbutton; Gtk::CheckButton* _quantize_checkbutton; Gtk::SpinButton* _quantize_spinbutton; - Gtk::ToggleToolButton* _record_button; Gtk::ToggleToolButton* _stop_button; Gtk::ToggleToolButton* _play_button; + Gtk::ToggleToolButton* _record_button; + Gtk::ToggleToolButton* _step_record_button; Gtk::ToolButton* _zoom_normal_button; Gtk::ToolButton* _zoom_full_button; Gtk::RadioButton* _chain_button; diff --git a/src/gui/machina.ui b/src/gui/machina.ui index eeea2f4..cc66256 100644 --- a/src/gui/machina.ui +++ b/src/gui/machina.ui @@ -2,13 +2,6 @@ - - 1 - 480 - 120 - 1 - 10 - gtk-media-record True @@ -18,6 +11,12 @@ True record_action + + Step record + gtk-add + True + record_action + gtk-media-stop True @@ -66,6 +65,20 @@ along with Machina; if not, write to the Free Software Foundation, Inc., + + 1 + 480 + 120 + 1 + 10 + + + 1 + 256 + 16 + 2 + 8 + False 8 @@ -387,6 +400,7 @@ press stop or play and the new nodes will be added to the machine. stop_action True False + Stop True @@ -420,22 +434,12 @@ press stop or play and the new nodes will be added to the machine. - - True - False - - - False - - - - - False + + step_record_action True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Step record - gtk-add False @@ -1087,11 +1091,4 @@ press stop or play and the new nodes will be added to the machine. node_properties_ok_button - - 1 - 256 - 16 - 2 - 8 - -- cgit v1.2.1