reinstate MIDI binding for shuttle controller

git-svn-id: svn://localhost/ardour2/branches/3.0@9394 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-04-20 05:07:41 +00:00
parent b1ed372a8f
commit 458db0525c
4 changed files with 15 additions and 21 deletions

View File

@ -156,7 +156,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
auto_loop_controllable (new TransportControllable ("transport auto loop", *this, TransportControllable::AutoLoop)),
play_selection_controllable (new TransportControllable ("transport play selection", *this, TransportControllable::PlaySelection)),
rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable)),
shuttle_controller_binding_proxy (shuttle_controllable),
roll_button (roll_controllable),
stop_button (stop_controllable),
@ -555,7 +554,7 @@ ARDOUR_UI::set_transport_controllable_state (const XMLNode& node)
rec_controllable->set_id (prop->value());
}
if ((prop = node.property ("shuttle")) != 0) {
shuttle_box->controllable().set_id (prop->value());
shuttle_box->controllable()->set_id (prop->value());
}
}
@ -580,7 +579,7 @@ ARDOUR_UI::get_transport_controllable_state ()
node->add_property (X_("play_selection"), buf);
rec_controllable->id().print (buf, sizeof (buf));
node->add_property (X_("rec"), buf);
shuttle_box->controllable().id().print (buf, sizeof (buf));
shuttle_box->controllable()->id().print (buf, sizeof (buf));
node->add_property (X_("shuttle"), buf);
return *node;

View File

@ -413,7 +413,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
boost::shared_ptr<TransportControllable> rec_controllable;
boost::shared_ptr<TransportControllable> shuttle_controllable;
boost::shared_ptr<TransportControllable> join_play_range_controllable;
BindingProxy shuttle_controller_binding_proxy;
void set_transport_controllable_state (const XMLNode&);
XMLNode& get_transport_controllable_state ();

View File

@ -40,9 +40,10 @@ using std::min;
using std::max;
ShuttleControl::ShuttleControl ()
: _controllable (*this)
: _controllable (new ShuttleControllable (*this))
, binding_proxy (_controllable)
{
ARDOUR_UI::instance()->set_tip (*this, _("Shuttle speed control"));
ARDOUR_UI::instance()->set_tip (*this, _("Shuttle speed control (Context-click for options)"));
pattern = 0;
last_shuttle_request = 0;
@ -74,6 +75,7 @@ ShuttleControl::set_session (Session *s)
if (_session) {
set_sensitive (true);
_session->add_controllable (_controllable);
} else {
set_sensitive (false);
}
@ -205,11 +207,9 @@ ShuttleControl::on_button_press_event (GdkEventButton* ev)
return true;
}
#if 0
if (shuttle_controller_binding_proxy.button_press_handler (ev)) {
if (binding_proxy.button_press_handler (ev)) {
return true;
}
#endif
if (Keyboard::is_context_menu_event (ev)) {
show_shuttle_context_menu ();
@ -370,7 +370,7 @@ ShuttleControl::use_shuttle_fract (bool force)
speed = shuttle_max_speed * fract;
}
_session->request_transport_speed_nonzero (speed);
}
@ -418,7 +418,7 @@ ShuttleControl::on_expose_event (GdkEventExpose* event)
}
}
} else {
snprintf (buf, sizeof (buf), _("stop"));
snprintf (buf, sizeof (buf), _("Stopped"));
}
last_speed_displayed = speed;
@ -479,13 +479,6 @@ ShuttleControl::update_speed_display ()
}
}
/*
set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
set_tip (speed_display_box, _("Current transport speed"));
*/
ShuttleControl::ShuttleControllable::ShuttleControllable (ShuttleControl& s)
: PBD::Controllable (X_("Shuttle"))
, sc (s)
@ -512,7 +505,7 @@ ShuttleControl::ShuttleControllable::set_value (double val)
fract = ((val - 0.5)/0.5);
}
}
sc.set_shuttle_fract (fract);
}

View File

@ -21,6 +21,8 @@
#include <gtkmm/drawingarea.h>
#include "gtkmm2ext/binding_proxy.h"
#include "pbd/controllable.h"
#include "ardour/session_handle.h"
@ -52,20 +54,21 @@ class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
ShuttleControl& sc;
};
ShuttleControllable& controllable() { return _controllable; }
boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
protected:
float shuttle_max_speed;
float last_speed_displayed;
bool shuttle_grabbed;
double shuttle_fract;
ShuttleControllable _controllable;
boost::shared_ptr<ShuttleControllable> _controllable;
cairo_pattern_t* pattern;
ARDOUR::microseconds_t last_shuttle_request;
PBD::ScopedConnection parameter_connection;
Gtk::Menu* shuttle_unit_menu;
Gtk::Menu* shuttle_style_menu;
Gtk::Menu* shuttle_context_menu;
BindingProxy binding_proxy;
void build_shuttle_context_menu ();
void show_shuttle_context_menu ();