diff options
author | David Robillard <d@drobilla.net> | 2008-02-16 22:43:18 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-16 22:43:18 +0000 |
commit | 8aa9508c82f32efcf9c7c00e2c9e76268d4dddce (patch) | |
tree | 1fb1a5e7eef6684c0a5bb49be492612c71796fc4 /gtk2_ardour/route_time_axis.cc | |
parent | 1b657585572298d1a69a7b43e611f59b7e185df3 (diff) |
Merge with 2.0-ongoing R3071.
git-svn-id: svn://localhost/ardour2/branches/3.0@3073 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 77 |
1 files changed, 70 insertions, 7 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index bd6f8db95e..9e955e4345 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -79,10 +79,20 @@ using namespace ARDOUR; using namespace PBD; +using namespace Gtkmm2ext; using namespace Gtk; using namespace Editing; using namespace sigc; +using namespace std; +Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider; + +int +RouteTimeAxisView::setup_slider_pix () +{ + slider = ::get_icon ("fader_belt_h"); + return 0; +} RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess), @@ -96,8 +106,15 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh automation_button (_("a")), visual_button (_("v")), lm (rt, sess), - underlay_xml_node (0) + underlay_xml_node (0), + gain_slider (0), + gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) + { + if (slider == 0) { + setup_slider_pix (); + } + lm.set_no_show_all(); lm.setup_meters(50); _has_state = true; @@ -110,6 +127,8 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh destructive_track_mode_item = 0; normal_track_mode_item = 0; + gain_slider = manage (new HSliderController (slider, &gain_adjustment, *_route->gain_control().get(), false)); + ignore_toggle = false; edit_group_button.set_name ("TrackGroupButton"); @@ -151,7 +170,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false); rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release)); - controls_table.attach (*rec_enable_button, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record")); } @@ -161,10 +180,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh _route->input_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); _route->output_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed)); - controls_table.attach (*mute_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); - controls_table.attach (*solo_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); - controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (edit_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0); + controls_table.attach (*gain_slider, 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0); ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo")); ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute")); @@ -188,11 +208,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh } else { - controls_table.attach (automation_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (automation_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); } if (is_track() && track()->mode() == ARDOUR::Normal) { - controls_table.attach (playlist_button, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); } y_position = -1; @@ -218,6 +238,15 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit)); ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler)); + + gain_slider->signal_button_press_event().connect (mem_fun(*this, &RouteTimeAxisView::start_gain_touch)); + gain_slider->signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::end_gain_touch)); + gain_slider->set_name ("TrackGainFader"); + + gain_adjustment.signal_value_changed().connect (mem_fun(*this, &RouteTimeAxisView::gain_adjusted)); + _route->gain_control()->Changed.connect (mem_fun(*this, &RouteTimeAxisView::gain_changed)); + + gain_slider->show_all(); } RouteTimeAxisView::~RouteTimeAxisView () @@ -2255,3 +2284,37 @@ RouteTimeAxisView::remove_underlay(StreamView* v) } } } + +gint +RouteTimeAxisView::start_gain_touch (GdkEventButton* ev) +{ + _route->gain_control()->list()->start_touch (); + return FALSE; +} + +gint +RouteTimeAxisView::end_gain_touch (GdkEventButton* ev) +{ + _route->gain_control()->list()->stop_touch (); + return FALSE; +} + +void +RouteTimeAxisView::gain_adjusted () +{ + _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); +} + +void +RouteTimeAxisView::gain_changed () +{ + Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::effective_gain_display)); +} + +void +RouteTimeAxisView::effective_gain_display () +{ + gfloat value = gain_to_slider_position (_route->effective_gain()); + gain_adjustment.set_value (value); +} + |