X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gtk2_ardour%2Fvca_master_strip.cc;h=d3f28cfb67379ad1a7bec16c3704d3909741719a;hb=806bfeced72674164a628c64abbda30ac916b2ca;hp=4ef1e4adaf5eaf5f5ccbea6e5fef92577de3f56f;hpb=212afd402c98e71e3ccc6ce3c8795234aef66f54;p=ardour.git diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc index 4ef1e4adaf..d3f28cfb67 100644 --- a/gtk2_ardour/vca_master_strip.cc +++ b/gtk2_ardour/vca_master_strip.cc @@ -38,7 +38,7 @@ #include "utils.h" #include "vca_master_strip.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace ARDOUR_UI_UTILS; @@ -52,17 +52,14 @@ PBD::Signal1 VCAMasterStrip::CatchDeletion; VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) : SessionHandlePtr (s) , _vca (v) - , gain_meter (s, 254) + , gain_meter (s, 254) /* magic number, don't adjust blindly */ , context_menu (0) , delete_dialog (0) , control_slave_ui (s) { + /* set color for the VCA, if not already done. */ - PresentationInfo::color_t c = _vca->presentation_info().color (); - - /* XXX need a (better) test of "has a color" */ - - if (c == 0) { + if (!_vca->presentation_info().color_set()) { _vca->presentation_info().set_color (gdk_color_to_rgba (unique_random_color())); } @@ -97,8 +94,10 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) number_label.set_name ("generic button"); number_label.set_alignment (.5, .5); number_label.set_fallthrough_to_parent (true); + number_label.set_inactive_color (_vca->presentation_info().color ()); + number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press)); - bottom_padding.set_size_request (-1, 32); /* this one is a hack. there's no trivial way to compute it */ + update_bottom_padding (); //Glib::RefPtr layout = vertical_button.get_layout (); // layout->set_justify (JUSTIFY_CENTER); @@ -110,20 +109,16 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) vertical_button.set_active_color (_vca->presentation_info().color ()); set_tooltip (vertical_button, _("Click to show slaves only")); /* tooltip updated dynamically */ - drop_button.set_text(_("drop")); - drop_button.signal_clicked.connect (sigc::mem_fun (*this, &VCAMasterStrip::drop_button_press)); - set_tooltip (drop_button, _("Unassign all slaves from this control master")); - - global_vpacker.set_border_width (1); - global_vpacker.set_spacing (0); + global_vpacker.set_border_width (0); + global_vpacker.set_spacing (2); + gain_meter.set_spacing(4); global_vpacker.pack_start (number_label, false, false); global_vpacker.pack_start (hide_button, false, false); global_vpacker.pack_start (vertical_button, true, true); global_vpacker.pack_start (solo_mute_box, false, false); - global_vpacker.pack_start (gain_meter, false, false, 2); + global_vpacker.pack_start (gain_meter, false, false); global_vpacker.pack_start (control_slave_ui, false, false); - global_vpacker.pack_start (drop_button, false, false); global_vpacker.pack_start (bottom_padding, false, false); global_frame.add (global_vpacker); @@ -142,7 +137,6 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) gain_meter.show (); solo_mute_box.show_all (); control_slave_ui.show (); - drop_button.show (); /* force setting of visible selected status */ @@ -154,7 +148,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) mute_changed (); spill_change (boost::shared_ptr()); - Mixer_UI::instance()->show_vca_change.connect (sigc::mem_fun (*this, &VCAMasterStrip::spill_change)); + Mixer_UI::instance()->show_spill_change.connect (sigc::mem_fun (*this, &VCAMasterStrip::spill_change)); _vca->PropertyChanged.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::vca_property_changed, this, _1), gui_context()); _vca->presentation_info().PropertyChanged.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::vca_property_changed, this, _1), gui_context()); @@ -171,9 +165,9 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) VCAMasterStrip::~VCAMasterStrip () { - if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_vca_slaves_for (_vca)) { + if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_spill_for (_vca)) { /* cancel spill for this VCA */ - Mixer_UI::instance()->show_vca_slaves (boost::shared_ptr()); + Mixer_UI::instance()->show_spill (boost::shared_ptr()); } delete delete_dialog; @@ -185,9 +179,9 @@ VCAMasterStrip::~VCAMasterStrip () void VCAMasterStrip::self_delete () { - if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_vca_slaves_for (_vca)) { + if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_spill_for (_vca)) { /* cancel spill for this VCA */ - Mixer_UI::instance()->show_vca_slaves (boost::shared_ptr()); + Mixer_UI::instance()->show_spill (boost::shared_ptr()); } /* Drop reference immediately, delete self when idle */ _vca.reset (); @@ -199,6 +193,8 @@ VCAMasterStrip::parameter_changed (std::string const & p) { if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") { set_button_names (); + } else if (p == "mixer-element-visibility") { + update_bottom_padding (); } } @@ -222,6 +218,42 @@ VCAMasterStrip::set_button_names () } } +void +VCAMasterStrip::update_bottom_padding () +{ + std::string viz = UIConfiguration::instance().get_mixer_strip_visibility (); + + ArdourButton meter_point_button (_("pre")); + ArdourButton output_button (_("Output")); + ArdourButton comment_button (_("Comments")); + + meter_point_button.set_name ("mixer strip button"); + output_button.set_name ("mixer strip button"); + comment_button.set_name ("generic button"); + + + int h = 1; + if (1) { + Gtk::Window window (WINDOW_TOPLEVEL); + window.add (meter_point_button); + Gtk::Requisition requisition(meter_point_button.size_request ()); + h += requisition.height; + } + if (viz.find ("Output") != std::string::npos) { + Gtk::Window window (WINDOW_TOPLEVEL); + window.add (output_button); + Gtk::Requisition requisition(output_button.size_request ()); + h += requisition.height + 2; + } + if (viz.find ("Comments") != std::string::npos) { + Gtk::Window window (WINDOW_TOPLEVEL); + window.add (comment_button); + Gtk::Requisition requisition(comment_button.size_request ()); + h += requisition.height + 2; + } + bottom_padding.set_size_request (-1, h); +} + string VCAMasterStrip::name() const { @@ -231,14 +263,7 @@ VCAMasterStrip::name() const void VCAMasterStrip::hide_clicked () { - if (!delete_dialog) { - delete_dialog = new MessageDialog (_("Removing a Master will deassign all slaves. Remove it anyway?"), - true, MESSAGE_WARNING, BUTTONS_YES_NO, true); - delete_dialog->signal_response().connect (sigc::mem_fun (*this, &VCAMasterStrip::hide_confirmation)); - } - - delete_dialog->set_position (Gtk::WIN_POS_MOUSE); - delete_dialog->present (); + _vca->presentation_info().set_hidden (true); } void @@ -364,6 +389,18 @@ VCAMasterStrip::vertical_button_press (GdkEventButton* ev) return true; } +bool +VCAMasterStrip::number_button_press (GdkEventButton* ev) +{ + if (Keyboard::is_context_menu_event (ev)) { + if (!context_menu) { + build_context_menu (); + } + context_menu->popup (1, ev->time); + } + return true; +} + void VCAMasterStrip::start_name_edit () { @@ -388,6 +425,11 @@ VCAMasterStrip::vca_property_changed (PropertyChange const & what_changed) if (what_changed.contains (ARDOUR::Properties::color)) { vertical_button.set_active_color (_vca->presentation_info().color ()); + number_label.set_inactive_color (_vca->presentation_info().color ()); + } + + if (what_changed.contains (ARDOUR::Properties::hidden)) { + } } @@ -395,7 +437,7 @@ void VCAMasterStrip::update_vca_name () { /* 20 is a rough guess at the number of letters we can fit. */ - vertical_button.set_text (short_version (_vca->name(), 20)); + vertical_button.set_text (short_version (_vca->full_name(), 20)); } void @@ -415,15 +457,15 @@ VCAMasterStrip::build_context_menu () void VCAMasterStrip::spill () { - if (Mixer_UI::instance()->showing_vca_slaves_for (_vca)) { - Mixer_UI::instance()->show_vca_slaves (boost::shared_ptr()); + if (Mixer_UI::instance()->showing_spill_for (_vca)) { + Mixer_UI::instance()->show_spill (boost::shared_ptr()); } else { - Mixer_UI::instance()->show_vca_slaves (_vca); + Mixer_UI::instance()->show_spill (_vca); } } void -VCAMasterStrip::spill_change (boost::shared_ptr vca) +VCAMasterStrip::spill_change (boost::shared_ptr vca) { if (vca != _vca) { vertical_button.set_active_state (Gtkmm2ext::Off); @@ -449,17 +491,11 @@ VCAMasterStrip::drop_all_slaves () { _vca->Drop (); /* EMIT SIGNAL */ - if (Mixer_UI::instance()->showing_vca_slaves_for (_vca)) { - Mixer_UI::instance()->show_vca_slaves (boost::shared_ptr()); + if (Mixer_UI::instance()->showing_spill_for (_vca)) { + Mixer_UI::instance()->show_spill (boost::shared_ptr()); } } -void -VCAMasterStrip::drop_button_press () -{ - drop_all_slaves (); -} - Gdk::Color VCAMasterStrip::color () const { @@ -500,3 +536,31 @@ VCAMasterStrip::finish_color_edit (int response, Gtk::ColorSelectionDialog* dial delete_when_idle (dialog); } + +bool +VCAMasterStrip::marked_for_display () const +{ + return !_vca->presentation_info().hidden(); +} + +bool +VCAMasterStrip::set_marked_for_display (bool yn) +{ + if (yn == _vca->presentation_info().hidden()) { + _vca->presentation_info().set_hidden (!yn); + return true; // things changed + } + return false; +} + +PresentationInfo const & +VCAMasterStrip::presentation_info () const +{ + return _vca->presentation_info(); +} + +boost::shared_ptr +VCAMasterStrip::stripable () const +{ + return _vca; +}