diff options
author | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-05-19 17:29:05 +0000 |
---|---|---|
committer | Nick Mainsbridge <beatroute@iprimus.com.au> | 2006-05-19 17:29:05 +0000 |
commit | c33d0ad760e311c37cfcb99e48948cc92472ad55 (patch) | |
tree | 29ee2b0b3647f0556b7b604a61d0d29f8a771851 | |
parent | 06654aa7f10005d447d0829f149b9008c1abbcb6 (diff) |
Mixer strip & ui layout changes
git-svn-id: svn://localhost/trunk/ardour2@514 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/gain_meter.cc | 197 | ||||
-rw-r--r-- | gtk2_ardour/gain_meter.h | 30 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 349 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 34 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/panner_ui.cc | 196 | ||||
-rw-r--r-- | gtk2_ardour/panner_ui.h | 23 |
8 files changed, 474 insertions, 381 deletions
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index 159454ab18..c586958281 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -87,7 +87,9 @@ GainMeter::GainMeter (IO& io, Session& s) gain_display (&gain_adjustment, "MixerStripGainDisplay"), gain_unit_label (_("dbFS")), meter_point_label (_("pre")), - top_table (1, 2) + top_table (1, 2), + gain_automation_style_button (""), + gain_automation_state_button ("") { if (slider == 0) { @@ -180,8 +182,47 @@ GainMeter::GainMeter (IO& io, Session& s) meter_packer.set_spacing (2); - hbox.set_spacing (4); - hbox.pack_start (*gain_slider, false, false, 2); + gain_automation_style_button.set_name ("MixerAutomationModeButton"); + gain_automation_state_button.set_name ("MixerAutomationPlaybackButton"); + + ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Fader automation mode")); + ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Fader automation type")); + + gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS); + gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS); + + using namespace Menu_Helpers; + + gain_astate_menu.items().push_back (MenuElem (_("Isolate"), + bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Off))); + gain_astate_menu.items().push_back (MenuElem (_("Play"), + bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Play))); + gain_astate_menu.items().push_back (MenuElem (_("Write"), + bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Write))); + gain_astate_menu.items().push_back (MenuElem (_("Touch"), + bind (mem_fun (dynamic_cast<Route*>(&_io), &IO::set_gain_automation_state), (AutoState) Touch))); + + gain_astyle_menu.items().push_back (MenuElem (_("Trim"))); + gain_astyle_menu.items().push_back (MenuElem (_("Abs"))); + + Route* _route = dynamic_cast<Route*>(&_io); + + gain_astate_menu.set_name ("ArdourContextMenu"); + gain_astyle_menu.set_name ("ArdourContextMenu"); + + gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false); + gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false); + + _route->gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed)); + _route->gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed)); + + fader_vbox = manage (new Gtk::VBox()); + fader_vbox->set_spacing (0); + fader_vbox->pack_start (*gain_slider, false, false, 0); + fader_vbox->pack_start (gain_automation_state_button, false, false, 0); + + hbox.set_spacing (0); + hbox.pack_start (*fader_vbox, false, false, 2); hbox.pack_start (meter_packer, true, false); set_spacing (4); @@ -198,6 +239,8 @@ GainMeter::GainMeter (IO& io, Session& s) _session.MeterHoldChanged.connect (mem_fun(*this, &GainMeter::meter_hold_changed)); + gain_automation_state_changed (); + gain_changed (0); update_gain_sensitive (); @@ -455,8 +498,8 @@ void GainMeter::reset_peak_display () { max_peak = minus_infinity(); - peak_display_label.set_text (_("-inf")); - peak_display.set_name ("MixerStripPeakDisplay"); + peak_display_label.set_text (_("-Inf")); + peak_display.set_name ("Mixerstrippeakdisplay"); } void @@ -736,3 +779,147 @@ GainMeter::end_gain_touch (GdkEventButton* ev) _io.end_gain_touch (); return FALSE; } + +gint +GainMeter::gain_automation_state_button_event (GdkEventButton *ev) +{ + if (ev->type == GDK_BUTTON_RELEASE) { + return TRUE; + } + + switch (ev->button) { + case 1: + gain_astate_menu.popup (1, ev->time); + break; + default: + break; + } + + return TRUE; +} + +gint +GainMeter::gain_automation_style_button_event (GdkEventButton *ev) +{ + if (ev->type == GDK_BUTTON_RELEASE) { + return TRUE; + } + + switch (ev->button) { + case 1: + gain_astyle_menu.popup (1, ev->time); + break; + default: + break; + } + return TRUE; +} + +string +GainMeter::astate_string (AutoState state) +{ + return _astate_string (state, false); +} + +string +GainMeter::short_astate_string (AutoState state) +{ + return _astate_string (state, true); +} + +string +GainMeter::_astate_string (AutoState state, bool shrt) +{ + string sstr; + + switch (state) { + case Off: + sstr = (shrt ? "I" : _("I")); + break; + case Play: + sstr = (shrt ? "P" : _("P")); + break; + case Touch: + sstr = (shrt ? "T" : _("T")); + break; + case Write: + sstr = (shrt ? "W" : _("W")); + break; + } + + return sstr; +} + +string +GainMeter::astyle_string (AutoStyle style) +{ + return _astyle_string (style, false); +} + +string +GainMeter::short_astyle_string (AutoStyle style) +{ + return _astyle_string (style, true); +} + +string +GainMeter::_astyle_string (AutoStyle style, bool shrt) +{ + if (style & Trim) { + return _("Trim"); + } else { + /* XXX it might different in different languages */ + + return (shrt ? _("Abs") : _("Abs")); + } +} + +void +GainMeter::gain_automation_style_changed () +{ + Route* _route = dynamic_cast<Route*>(&_io); + switch (_width) { + case Wide: + gain_automation_style_button.set_label (astyle_string(_route->gain_automation_curve().automation_style())); + break; + case Narrow: + gain_automation_style_button.set_label (short_astyle_string(_route->gain_automation_curve().automation_style())); + break; + } +} + +void +GainMeter::gain_automation_state_changed () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &GainMeter::gain_automation_state_changed)); + Route* _route = dynamic_cast<Route*>(&_io); + + bool x; + + switch (_width) { + case Wide: + gain_automation_state_button.set_label (astate_string(_route->gain_automation_curve().automation_state())); + break; + case Narrow: + gain_automation_state_button.set_label (short_astate_string(_route->gain_automation_curve().automation_state())); + break; + } + + x = (_route->gain_automation_state() != Off); + + if (gain_automation_state_button.get_active() != x) { + ignore_toggle = true; + gain_automation_state_button.set_active (x); + ignore_toggle = false; + } + + update_gain_sensitive (); + + /* start watching automation so that things move */ + + gain_watching.disconnect(); + + if (x) { + gain_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (*this, &GainMeter::effective_gain_display)); + } +} diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index d30f21314f..c18d351ff6 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -32,7 +32,6 @@ #include <gtkmm/table.h> #include <gtkmm/drawingarea.h> - #include <ardour/types.h> #include <gtkmm2ext/slider_controller.h> @@ -74,6 +73,8 @@ class GainMeter : public Gtk::VBox void set_fader_name (const char * name); private: + + friend class MixerStrip; ARDOUR::IO& _io; ARDOUR::Session& _session; @@ -94,6 +95,31 @@ class GainMeter : public Gtk::VBox Gtk::Button meter_point_button; Gtk::Label meter_point_label; Gtk::Table top_table; + + sigc::connection gain_watching; + + Gtk::Button gain_automation_style_button; + Gtk::ToggleButton gain_automation_state_button; + + Gtk::Menu gain_astate_menu; + Gtk::Menu gain_astyle_menu; + + gint gain_automation_style_button_event (GdkEventButton *); + gint gain_automation_state_button_event (GdkEventButton *); + gint pan_automation_style_button_event (GdkEventButton *); + gint pan_automation_state_button_event (GdkEventButton *); + + void gain_automation_state_changed(); + void gain_automation_style_changed(); + + std::string astate_string (ARDOUR::AutoState); + std::string short_astate_string (ARDOUR::AutoState); + std::string _astate_string (ARDOUR::AutoState, bool); + + std::string astyle_string (ARDOUR::AutoStyle); + std::string short_astyle_string (ARDOUR::AutoStyle); + std::string _astyle_string (ARDOUR::AutoStyle, bool); + Width _width; static std::map<std::string,Glib::RefPtr<Gdk::Pixmap> > metric_pixmaps; @@ -121,7 +147,7 @@ class GainMeter : public Gtk::VBox vector<MeterInfo> meters; float max_peak; - +Gtk::VBox* fader_vbox; Gtk::HBox hbox; Gtk::HBox meter_packer; diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index edc2e56216..73ba274bc2 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -88,11 +88,8 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) post_redirect_box (PostFader, sess, rt, mx.plugin_selector(), mx.selection(), in_mixer), gpm (_route, sess), panners (_route, sess), - button_table (6, 2), - gain_automation_style_button (""), - gain_automation_state_button (""), - pan_automation_style_button (""), - pan_automation_state_button (""), + button_table (3, 2), + bottom_button_table (2, 2), comment_button (_("Comments")), speed_adjustment (1.0, 0.001, 4.0, 0.001, 0.1), speed_spinner (&speed_adjustment, "MixerStripSpeedBase", true) @@ -131,16 +128,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) solo_button->set_name ("MixerSoloButton"); mute_button->set_name ("MixerMuteButton"); - gain_automation_style_button.set_name ("MixerAutomationModeButton"); - gain_automation_state_button.set_name ("MixerAutomationPlaybackButton"); - pan_automation_style_button.set_name ("MixerAutomationModeButton"); - pan_automation_state_button.set_name ("MixerAutomationPlaybackButton"); - - ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode")); - ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Fader automation mode")); - - ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type")); - ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Fader automation type")); hide_button.set_events (hide_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK)); @@ -150,59 +137,18 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) output_button.unset_flags (Gtk::CAN_FOCUS); solo_button->unset_flags (Gtk::CAN_FOCUS); mute_button->unset_flags (Gtk::CAN_FOCUS); - gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS); - gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS); - pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS); - pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS); button_table.set_homogeneous (true); button_table.set_spacings (0); button_table.attach (name_button, 0, 2, 0, 1); - button_table.attach (group_button, 0, 2, 1, 2); - button_table.attach (input_button, 0, 2, 2, 3); - - button_table.attach (*solo_button, 0, 1, 3, 4); - button_table.attach (*mute_button, 1, 2, 3, 4); + button_table.attach (input_button, 0, 2, 1, 2); + button_table.attach (*rec_enable_button, 0, 2, 2, 3); - button_table.attach (gain_automation_state_button, 0, 1, 4, 5); - button_table.attach (pan_automation_state_button, 1, 2, 4, 5); - - using namespace Menu_Helpers; - - gain_astate_menu.items().push_back (MenuElem (_("Isolate"), - bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Off))); - gain_astate_menu.items().push_back (MenuElem (_("Play"), - bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Play))); - gain_astate_menu.items().push_back (MenuElem (_("Write"), - bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Write))); - gain_astate_menu.items().push_back (MenuElem (_("Touch"), - bind (mem_fun (_route, &IO::set_gain_automation_state), (AutoState) Touch))); - - gain_astyle_menu.items().push_back (MenuElem (_("Trim"))); - gain_astyle_menu.items().push_back (MenuElem (_("Abs"))); - - pan_astate_menu.items().push_back (MenuElem (_("Isolate"), - bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Off))); - pan_astate_menu.items().push_back (MenuElem (_("Play"), - bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Play))); - pan_astate_menu.items().push_back (MenuElem (_("Write"), - bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Write))); - pan_astate_menu.items().push_back (MenuElem (_("Touch"), - bind (mem_fun (_route.panner(), &Panner::set_automation_state), (AutoState) Touch))); - - pan_astyle_menu.items().push_back (MenuElem (_("Trim"))); - pan_astyle_menu.items().push_back (MenuElem (_("Abs"))); - - gain_astate_menu.set_name ("ArdourContextMenu"); - gain_astyle_menu.set_name ("ArdourContextMenu"); - pan_astate_menu.set_name ("ArdourContextMenu"); - pan_astyle_menu.set_name ("ArdourContextMenu"); - - ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Fader automation mode")); - ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation mode")); - ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Fader automation state")); - ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation state")); + bottom_button_table.set_homogeneous (true); + bottom_button_table.set_spacings (0); + bottom_button_table.attach (*solo_button, 0, 1, 1, 2); + bottom_button_table.attach (*mute_button, 1, 2, 1, 2); if (is_audio_track()) { @@ -224,7 +170,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) button_table.attach (speed_frame, 0, 2, 5, 6); #endif /* VARISPEED_IN_MIXER_STRIP */ - button_table.attach (*rec_enable_button, 0, 2, 5, 6); + bottom_button_table.attach (group_button, 0, 2, 0, 1); } name_button.add (name_label); @@ -263,13 +209,17 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) width_hide_box.pack_start (width_button, false, true); width_hide_box.pack_end (hide_button, false, true); + Gtk::Alignment *gain_meter_alignment = Gtk::manage(new Gtk::Alignment()); + gain_meter_alignment->set_padding(0, 4, 0, 0); + gain_meter_alignment->add(gpm); whvbox->pack_start (width_hide_box, true, true); global_vpacker.pack_start (*whvbox, Gtk::PACK_SHRINK); global_vpacker.pack_start (button_table,Gtk::PACK_SHRINK); global_vpacker.pack_start (pre_redirect_box, true, true); - global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK, 4); + global_vpacker.pack_start (bottom_button_table,Gtk::PACK_SHRINK); + global_vpacker.pack_start (*gain_meter_alignment,Gtk::PACK_SHRINK); global_vpacker.pack_start (post_redirect_box, true, true); global_vpacker.pack_start (panners, Gtk::PACK_SHRINK); global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK); @@ -297,8 +247,6 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) _route.solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); _route.solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed)); _route.mix_group_changed.connect (mem_fun(*this, &MixerStrip::mix_group_changed)); - _route.gain_automation_curve().automation_state_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_state_changed)); - _route.gain_automation_curve().automation_style_changed.connect (mem_fun(*this, &MixerStrip::gain_automation_style_changed)); _route.panner().Changed.connect (mem_fun(*this, &MixerStrip::connect_to_pan)); if (is_audio_track()) { @@ -319,15 +267,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false); mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false); - gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_style_button_event), false); - - pan_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_style_button_event), false); - - gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::gain_automation_state_button_event), false); - pan_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::pan_automation_state_button_event), false); - name_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::name_button_button_press), false); - group_button.signal_button_press_event().connect (mem_fun(*this, &MixerStrip::select_mix_group), false); _width = (Width) -1; @@ -348,8 +288,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, Route& rt, bool in_mixer) name_changed (0); comment_changed (0); mix_group_changed (0); - gain_automation_state_changed (); - pan_automation_state_changed (); + connect_to_pan (); panners.setup_pan (); @@ -445,10 +384,10 @@ MixerStrip::set_width (Width w) comment_button.set_label (_("*Comments*")); } - gain_automation_style_button.set_label (_("F:") + astyle_string(_route.gain_automation_curve().automation_style())); - gain_automation_state_button.set_label (_("F:") + astate_string(_route.gain_automation_curve().automation_state())); - pan_automation_style_button.set_label (_("P:") + astyle_string(_route.panner().automation_style())); - pan_automation_state_button.set_label (_("P:") + astate_string(_route.panner().automation_state())); + gpm.gain_automation_style_button.set_label (gpm.astyle_string(_route.gain_automation_curve().automation_style())); + gpm.gain_automation_state_button.set_label (gpm.astate_string(_route.gain_automation_curve().automation_state())); + panners.pan_automation_style_button.set_label (panners.astyle_string(_route.panner().automation_style())); + panners.pan_automation_state_button.set_label (panners.astate_string(_route.panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2); break; @@ -466,10 +405,10 @@ MixerStrip::set_width (Width w) comment_button.set_label (_("*Cmt*")); } - gain_automation_style_button.set_label (_("F:") + short_astyle_string(_route.gain_automation_curve().automation_style())); - gain_automation_state_button.set_label (_("F:") + short_astate_string(_route.gain_automation_curve().automation_state())); - pan_automation_style_button.set_label (_("P:") + short_astyle_string(_route.panner().automation_style())); - pan_automation_state_button.set_label (_("P:") + short_astate_string(_route.panner().automation_state())); + gpm.gain_automation_style_button.set_label (gpm.short_astyle_string(_route.gain_automation_curve().automation_style())); + gpm.gain_automation_state_button.set_label (gpm.short_astate_string(_route.gain_automation_curve().automation_state())); + panners.pan_automation_style_button.set_label (panners.short_astyle_string(_route.panner().automation_style())); + panners.pan_automation_state_button.set_label (panners.short_astate_string(_route.panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); break; } @@ -748,8 +687,8 @@ MixerStrip::connect_to_pan () if (!_route.panner().empty()) { StreamPanner* sp = _route.panner().front(); - panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_state_changed)); - panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(*this, &MixerStrip::pan_automation_style_changed)); + panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed)); + panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed)); } panners.pan_changed (this); @@ -802,137 +741,6 @@ MixerStrip::fast_update () gpm.update_meters (); } -gint -MixerStrip::gain_automation_state_button_event (GdkEventButton *ev) -{ - if (ev->type == GDK_BUTTON_RELEASE) { - return TRUE; - } - - switch (ev->button) { - case 1: - gain_astate_menu.popup (1, ev->time); - break; - default: - break; - } - - return TRUE; -} - -gint -MixerStrip::gain_automation_style_button_event (GdkEventButton *ev) -{ - if (ev->type == GDK_BUTTON_RELEASE) { - return TRUE; - } - - switch (ev->button) { - case 1: - gain_astyle_menu.popup (1, ev->time); - break; - default: - break; - } - return TRUE; -} - -gint -MixerStrip::pan_automation_state_button_event (GdkEventButton *ev) -{ - using namespace Menu_Helpers; - - if (ev->type == GDK_BUTTON_RELEASE) { - return TRUE; - } - - switch (ev->button) { - case 1: - pan_astate_menu.popup (1, ev->time); - break; - default: - break; - } - - return TRUE; -} - -gint -MixerStrip::pan_automation_style_button_event (GdkEventButton *ev) -{ - if (ev->type == GDK_BUTTON_RELEASE) { - return TRUE; - } - - switch (ev->button) { - case 1: - pan_astyle_menu.popup (1, ev->time); - break; - default: - break; - } - return TRUE; -} - -string -MixerStrip::astate_string (AutoState state) -{ - return _astate_string (state, false); -} - -string -MixerStrip::short_astate_string (AutoState state) -{ - return _astate_string (state, true); -} - -string -MixerStrip::_astate_string (AutoState state, bool shrt) -{ - string sstr; - - switch (state) { - case Off: - sstr = (shrt ? "I" : _("Iso")); - break; - case Play: - sstr = (shrt ? "P" : _("Ply")); - break; - case Touch: - sstr = (shrt ? "T" : _("Tch")); - break; - case Write: - sstr = (shrt ? "W" : _("Wri")); - break; - } - - return sstr; -} - -string -MixerStrip::astyle_string (AutoStyle style) -{ - return _astyle_string (style, false); -} - -string -MixerStrip::short_astyle_string (AutoStyle style) -{ - return _astyle_string (style, true); -} - -string -MixerStrip::_astyle_string (AutoStyle style, bool shrt) -{ - if (style & Trim) { - return _("Trim"); - } else { - /* XXX it might different in different languages */ - - return (shrt ? _("Abs") : _("Abs")); - } -} - void MixerStrip::diskstream_changed (void *src) { @@ -940,113 +748,6 @@ MixerStrip::diskstream_changed (void *src) } void -MixerStrip::gain_automation_style_changed () -{ - switch (_width) { - case Wide: - gain_automation_style_button.set_label (_("F:") + astyle_string(_route.gain_automation_curve().automation_style())); - break; - case Narrow: - gain_automation_style_button.set_label (_("F:") + short_astyle_string(_route.gain_automation_curve().automation_style())); - break; - } -} - -void -MixerStrip::gain_automation_state_changed () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::gain_automation_state_changed)); - - bool x; - - switch (_width) { - case Wide: - gain_automation_state_button.set_label (_("F:") + astate_string(_route.gain_automation_curve().automation_state())); - break; - case Narrow: - gain_automation_state_button.set_label (_("F:") + short_astate_string(_route.gain_automation_curve().automation_state())); - break; - } - - x = (_route.gain_automation_state() != Off); - - if (gain_automation_state_button.get_active() != x) { - ignore_toggle = true; - gain_automation_state_button.set_active (x); - ignore_toggle = false; - } - - gpm.update_gain_sensitive (); - - /* start watching automation so that things move */ - - gain_watching.disconnect(); - - if (x) { - gain_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (gpm, &GainMeter::effective_gain_display)); - } -} - -void -MixerStrip::pan_automation_style_changed () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_style_changed)); - - switch (_width) { - case Wide: - pan_automation_style_button.set_label (_("P:") + astyle_string(_route.panner().automation_style())); - break; - case Narrow: - pan_automation_style_button.set_label (_("P:") + short_astyle_string(_route.panner().automation_style())); - break; - } -} - -void -MixerStrip::pan_automation_state_changed () -{ - ENSURE_GUI_THREAD(mem_fun(*this, &MixerStrip::pan_automation_state_changed)); - - bool x; - - switch (_width) { - case Wide: - pan_automation_state_button.set_label (_("P:") + astate_string(_route.panner().automation_state())); - break; - case Narrow: - pan_automation_state_button.set_label (_("P:") + short_astate_string(_route.panner().automation_state())); - break; - } - - /* when creating a new session, we get to create busses (and - sometimes tracks) with no outputs by the time they get - here. - */ - - if (_route.panner().empty()) { - return; - } - - x = (_route.panner().front()->automation().automation_state() != Off); - - if (pan_automation_state_button.get_active() != x) { - ignore_toggle = true; - pan_automation_state_button.set_active (x); - ignore_toggle = false; - } - - panners.update_pan_sensitive (); - - /* start watching automation so that things move */ - - pan_watching.disconnect(); - - if (x) { - pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (panners, &PannerUI::effective_pan_display)); - } -} - -void MixerStrip::input_changed (IOChange change, void *src) { Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &MixerStrip::update_input_display)); diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 32ff691583..67ad30bbe7 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -122,9 +122,10 @@ class MixerStrip : public RouteUI, public Gtk::EventBox RedirectBox pre_redirect_box; RedirectBox post_redirect_box; GainMeter gpm; - PannerUI panners; + PannerUI panners; Gtk::Table button_table; + Gtk::Table bottom_button_table; Gtk::Button diskstream_button; Gtk::Label diskstream_label; @@ -134,17 +135,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox Gtk::Button output_button; Gtk::Label output_label; - Gtk::Button gain_automation_style_button; - Gtk::ToggleButton gain_automation_state_button; - - Gtk::Button pan_automation_style_button; - Gtk::ToggleButton pan_automation_state_button; - - Gtk::Menu gain_astate_menu; - Gtk::Menu gain_astyle_menu; - Gtk::Menu pan_astate_menu; - Gtk::Menu pan_astyle_menu; - sigc::connection newplug_connection; gint mark_update_safe (); @@ -188,31 +178,13 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void new_send (); void show_send_controls (); - - gint gain_automation_style_button_event (GdkEventButton *); - gint gain_automation_state_button_event (GdkEventButton *); - gint pan_automation_style_button_event (GdkEventButton *); - gint pan_automation_state_button_event (GdkEventButton *); - void input_changed (ARDOUR::IOChange, void *); void output_changed (ARDOUR::IOChange, void *); - void gain_automation_state_changed(); - void pan_automation_state_changed(); - void gain_automation_style_changed(); - void pan_automation_style_changed(); sigc::connection panstate_connection; sigc::connection panstyle_connection; void connect_to_pan (); - std::string astate_string (ARDOUR::AutoState); - std::string short_astate_string (ARDOUR::AutoState); - std::string _astate_string (ARDOUR::AutoState, bool); - - std::string astyle_string (ARDOUR::AutoStyle); - std::string short_astyle_string (ARDOUR::AutoStyle); - std::string _astyle_string (ARDOUR::AutoStyle, bool); - void update_diskstream_display (); void update_input_display (); void update_output_display (); @@ -260,8 +232,6 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void map_frozen (); void hide_redirect_editor (ARDOUR::Redirect* redirect); - sigc::connection gain_watching; - sigc::connection pan_watching; bool ignore_speed_adjustment; string solo_button_name () const { return "MixerSoloButton"; } diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index b558770222..9573011b37 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -88,7 +88,6 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) track_display.set_name (X_("MixerTrackDisplayList")); track_display.get_selection()->set_mode (Gtk::SELECTION_NONE); track_display.set_reorderable (true); - track_display.set_size_request (100, -1); track_display.set_headers_visible (true); track_model->signal_row_deleted().connect (mem_fun (*this, &Mixer_UI::track_list_delete)); @@ -105,16 +104,15 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_model = ListStore::create (group_columns); group_display.set_model (group_model); - group_display.append_column (_("groupname"), group_columns.text); - group_display.append_column (_("active"), group_columns.active); - group_display.append_column (_("visible"), group_columns.visible); + group_display.append_column (_("Group"), group_columns.text); + group_display.append_column (_("Active"), group_columns.active); + group_display.append_column (_("Visible"), group_columns.visible); group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0)); group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); group_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2)); group_display.set_name ("MixerGroupList"); group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE); group_display.set_reorderable (true); - group_display.set_size_request (150, -1); group_display.set_headers_visible (true); group_display.set_headers_clickable (false); group_display.set_rules_hint (true); @@ -144,8 +142,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_display_scroller.add (group_display); group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - HButtonBox* mix_group_display_button_box = manage (new HButtonBox()); - mix_group_display_button_box->set_homogeneous (true); + HBox* mix_group_display_button_box = manage (new HBox()); Button* mix_group_add_button = manage (new Button ()); Button* mix_group_remove_button = manage (new Button ()); @@ -160,11 +157,13 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) w->show(); mix_group_remove_button->add (*w); + mix_group_display_button_box->set_homogeneous (true); + mix_group_add_button->signal_clicked().connect (mem_fun (*this, &Mixer_UI::new_mix_group)); mix_group_remove_button->signal_clicked().connect (mem_fun (*this, &Mixer_UI::remove_selected_mix_group)); - mix_group_display_button_box->pack_start (*mix_group_add_button, false, false); - mix_group_display_button_box->pack_start (*mix_group_remove_button, false, false); + mix_group_display_button_box->add (*mix_group_remove_button); + mix_group_display_button_box->add (*mix_group_add_button); group_display_vbox.pack_start (group_display_scroller, true, true); group_display_vbox.pack_start (*mix_group_display_button_box, false, false); @@ -177,15 +176,16 @@ Mixer_UI::Mixer_UI (AudioEngine& eng) group_display_frame.set_shadow_type (Gtk::SHADOW_IN); group_display_frame.add (group_display_vbox); - rhs_pane1.add1 (track_display_frame); - rhs_pane1.add2 (group_display_frame); + rhs_pane1.pack1 (track_display_frame); + rhs_pane1.pack2 (group_display_frame); + rhs_pane1.set_size_request (110, -1); list_vpacker.pack_start (rhs_pane1, true, true); global_hpacker.pack_start (scroller, true, true); global_hpacker.pack_start (out_packer, false, false); - list_hpane.add1(list_vpacker); + list_hpane.pack1(list_vpacker, false, false); list_hpane.add2(global_hpacker); rhs_pane1.signal_size_allocate().connect (bind (mem_fun(*this, &Mixer_UI::pane_allocation_handler), diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 6cf420d916..35320b3a48 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -228,7 +228,7 @@ class Mixer_UI : public Gtk::Window Width _strip_width; - static const int32_t default_width = -1; + static const int32_t default_width = 478; static const int32_t default_height = 765; }; diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 4b954c0e62..3261a9bdd6 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -35,8 +35,8 @@ #include "gui_thread.h" #include <ardour/session.h> -#include <ardour/route.h> #include <ardour/panner.h> +#include <ardour/route.h> #include "i18n.h" @@ -54,13 +54,20 @@ PannerUI::PannerUI (IO& io, Session& s) panning_viewport(hAdjustment, vAdjustment), panning_up_arrow (Gtk::ARROW_UP, Gtk::SHADOW_OUT), panning_down_arrow (Gtk::ARROW_DOWN, Gtk::SHADOW_OUT), - panning_link_button (_("link")) - + panning_link_button (_("link")), + pan_automation_style_button (""), + pan_automation_state_button ("") { ignore_toggle = false; pan_menu = 0; in_pan_update = false; + pan_automation_style_button.set_name ("MixerAutomationModeButton"); + pan_automation_state_button.set_name ("MixerAutomationPlaybackButton"); + + ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_state_button, _("Pan automation mode")); + ARDOUR_UI::instance()->tooltips().set_tip (pan_automation_style_button, _("Pan automation type")); + pan_bar_packer.set_size_request (-1, 61); panning_viewport.set_size_request (61, 61); @@ -71,8 +78,34 @@ PannerUI::PannerUI (IO& io, Session& s) ARDOUR_UI::instance()->tooltips().set_tip (panning_link_direction_button, _("panning link direction")); + pan_automation_style_button.unset_flags (Gtk::CAN_FOCUS); + pan_automation_state_button.unset_flags (Gtk::CAN_FOCUS); + + using namespace Menu_Helpers; + pan_astate_menu.items().push_back (MenuElem (_("Isolate"), + bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Off))); + pan_astate_menu.items().push_back (MenuElem (_("Play"), + bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Play))); + pan_astate_menu.items().push_back (MenuElem (_("Write"), + bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Write))); + pan_astate_menu.items().push_back (MenuElem (_("Touch"), + bind (mem_fun (_io.panner(), &Panner::set_automation_state), (AutoState) Touch))); + + pan_astyle_menu.items().push_back (MenuElem (_("Trim"))); + pan_astyle_menu.items().push_back (MenuElem (_("Abs"))); + + pan_astate_menu.set_name ("ArdourContextMenu"); + pan_astyle_menu.set_name ("ArdourContextMenu"); + + pan_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &PannerUI::pan_automation_style_button_event), false); + pan_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &PannerUI::pan_automation_state_button_event), false); + + Gtk::HBox* pan_button_hbox = manage (new Gtk::HBox()); + panning_link_box.pack_start (panning_link_button, true, true); panning_link_box.pack_start (panning_link_direction_button, true, true); + pan_button_hbox->pack_start (panning_link_box, true, true); + pan_button_hbox->pack_start (pan_automation_state_button, true, true); panning_link_button.set_name (X_("PanningLinkButton")); panning_link_direction_button.set_name (X_("PanningLinkDirectionButton")); @@ -102,7 +135,7 @@ PannerUI::PannerUI (IO& io, Session& s) pan_vbox.set_spacing (4); pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK); - pan_vbox.pack_start (panning_link_box, Gtk::PACK_SHRINK); + pan_vbox.pack_start (*pan_button_hbox, Gtk::PACK_SHRINK); pack_start (pan_vbox, true, false); @@ -115,6 +148,7 @@ PannerUI::PannerUI (IO& io, Session& s) pan_changed (0); update_pan_sensitive (); update_pan_linkage (); + pan_automation_state_changed (); } gint @@ -612,3 +646,157 @@ PannerUI::update_pan_sensitive () } } +gint +PannerUI::pan_automation_state_button_event (GdkEventButton *ev) +{ + using namespace Menu_Helpers; + + if (ev->type == GDK_BUTTON_RELEASE) { + return TRUE; + } + + switch (ev->button) { + case 1: + pan_astate_menu.popup (1, ev->time); + break; + default: + break; + } + + return TRUE; +} + +gint +PannerUI::pan_automation_style_button_event (GdkEventButton *ev) +{ + if (ev->type == GDK_BUTTON_RELEASE) { + return TRUE; + } + + switch (ev->button) { + case 1: + pan_astyle_menu.popup (1, ev->time); + break; + default: + break; + } + return TRUE; +} + +void +PannerUI::pan_automation_style_changed () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_style_changed)); + + switch (_width) { + case Wide: + pan_automation_style_button.set_label (astyle_string(_io.panner().automation_style())); + break; + case Narrow: + pan_automation_style_button.set_label (short_astyle_string(_io.panner().automation_style())); + break; + } +} + +void +PannerUI::pan_automation_state_changed () +{ + ENSURE_GUI_THREAD(mem_fun(*this, &PannerUI::pan_automation_state_changed)); + + bool x; + + switch (_width) { + case Wide: + pan_automation_state_button.set_label (astate_string(_io.panner().automation_state())); + break; + case Narrow: + pan_automation_state_button.set_label (short_astate_string(_io.panner().automation_state())); + break; + } + + /* when creating a new session, we get to create busses (and + sometimes tracks) with no outputs by the time they get + here. + */ + + if (_io.panner().empty()) { + return; + } + + x = (_io.panner().front()->automation().automation_state() != Off); + + if (pan_automation_state_button.get_active() != x) { + ignore_toggle = true; + pan_automation_state_button.set_active (x); + ignore_toggle = false; + } + + update_pan_sensitive (); + + /* start watching automation so that things move */ + + pan_watching.disconnect(); + + if (x) { + pan_watching = ARDOUR_UI::RapidScreenUpdate.connect (mem_fun (*this, &PannerUI::effective_pan_display)); + } +} + +string +PannerUI::astate_string (AutoState state) +{ + return _astate_string (state, false); +} + +string +PannerUI::short_astate_string (AutoState state) +{ + return _astate_string (state, true); +} + +string +PannerUI::_astate_string (AutoState state, bool shrt) +{ + string sstr; + + switch (state) { + case Off: + sstr = (shrt ? "I" : _("I")); + break; + case Play: + sstr = (shrt ? "P" : _("P")); + break; + case Touch: + sstr = (shrt ? "T" : _("T")); + break; + case Write: + sstr = (shrt ? "W" : _("W")); + break; + } + + return sstr; +} + +string +PannerUI::astyle_string (AutoStyle style) +{ + return _astyle_string (style, false); +} + +string +PannerUI::short_astyle_string (AutoStyle style) +{ + return _astyle_string (style, true); +} + +string +PannerUI::_astyle_string (AutoStyle style, bool shrt) +{ + if (style & Trim) { + return _("Trim"); + } else { + /* XXX it might different in different languages */ + + return (shrt ? _("Abs") : _("Abs")); + } +} diff --git a/gtk2_ardour/panner_ui.h b/gtk2_ardour/panner_ui.h index a1435973b7..78fc86885d 100644 --- a/gtk2_ardour/panner_ui.h +++ b/gtk2_ardour/panner_ui.h @@ -71,6 +71,7 @@ class PannerUI : public Gtk::HBox void set_meter_strip_name (string name); private: + friend class MixerStrip; ARDOUR::IO& _io; ARDOUR::Session& _session; @@ -89,7 +90,6 @@ class PannerUI : public Gtk::HBox Gtk::Arrow panning_down_arrow; Gtk::VBox pan_vbox; Width _width; - gint panning_scroll_button_press_event (GdkEventButton*, int32_t dir); gint panning_scroll_button_release_event (GdkEventButton*, int32_t dir); @@ -97,6 +97,13 @@ class PannerUI : public Gtk::HBox Gtk::Button panning_link_direction_button; Gtk::HBox panning_link_box; + Gtk::Menu pan_astate_menu; + Gtk::Menu pan_astyle_menu; + + Gtk::Button pan_automation_style_button; + Gtk::ToggleButton pan_automation_state_button; + + gint panning_link_button_press (GdkEventButton*); gint panning_link_button_release (GdkEventButton*); void panning_link_direction_clicked (); @@ -128,6 +135,20 @@ class PannerUI : public Gtk::HBox void pan_mute (uint32_t which); void pan_reset (); void pan_bypass_toggle (); + + void pan_automation_state_changed(); + void pan_automation_style_changed(); + gint pan_automation_style_button_event (GdkEventButton *); + gint pan_automation_state_button_event (GdkEventButton *); + sigc::connection pan_watching; + + std::string astate_string (ARDOUR::AutoState); + std::string short_astate_string (ARDOUR::AutoState); + std::string _astate_string (ARDOUR::AutoState, bool); + + std::string astyle_string (ARDOUR::AutoStyle); + std::string short_astyle_string (ARDOUR::AutoStyle); + std::string _astyle_string (ARDOUR::AutoStyle, bool); }; #endif /* __ardour_gtk_panner_ui_h__ */ |