diff options
author | Doug McLain <doug@nostar.net> | 2008-02-15 22:27:48 +0000 |
---|---|---|
committer | Doug McLain <doug@nostar.net> | 2008-02-15 22:27:48 +0000 |
commit | 640a60169b0247924bb168af4fbdf193782f2757 (patch) | |
tree | 7b04fa28423d0dff2f4ee0b9ad7f75dd5c90f35d /gtk2_ardour/route_time_axis.cc | |
parent | cdd8ef7fc864e1eddc5272bfc938e9043f8be7fb (diff) |
Trackfaders
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3068 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 76 |
1 files changed, 68 insertions, 8 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index cc5e7f937e..7997a26e65 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -79,9 +79,19 @@ using namespace ARDOUR; using namespace PBD; +using namespace Gtkmm2ext; using namespace Gtk; using namespace Editing; +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), @@ -94,9 +104,14 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh size_button (_("h")), // height automation_button (_("a")), visual_button (_("v")), - lm (rt, sess) - + lm (rt, sess), + 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; @@ -109,6 +124,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(), false)); + ignore_toggle = false; edit_group_button.set_name ("TrackGroupButton"); @@ -150,7 +167,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")); } @@ -160,10 +177,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")); @@ -187,11 +205,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; @@ -213,6 +231,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_changed.connect (mem_fun(*this, &RouteTimeAxisView::gain_changed)); + + gain_slider->show_all(); } RouteTimeAxisView::~RouteTimeAxisView () @@ -1862,3 +1889,36 @@ RouteTimeAxisView::io_changed (IOChange change, void *src) { reset_meter (); } + +gint +RouteTimeAxisView::start_gain_touch (GdkEventButton* ev) +{ + _route->start_gain_touch (); + return FALSE; +} + +gint +RouteTimeAxisView::end_gain_touch (GdkEventButton* ev) +{ + _route->end_gain_touch (); + return FALSE; +} + +void +RouteTimeAxisView::gain_adjusted () +{ + _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); +} + +void +RouteTimeAxisView::gain_changed (void *src) +{ + 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); +} |