Only show user-presets in favorite sidebar
[ardour.git] / gtk2_ardour / vca_time_axis.cc
index 39ce9c0aa0c345fb40c66b5b77285939ce1cf14c..efa1c3cdea901e716336379bb0485e231ca256e4 100644 (file)
 #include "ardour/vca.h"
 
 #include "gtkmm2ext/doi.h"
-#include <gtkmm2ext/utils.h>
+#include "gtkmm2ext/utils.h"
+#include "widgets/tooltips.h"
 
 #include "gui_thread.h"
 #include "public_editor.h"
-#include "tooltips.h"
+#include "mixer_ui.h"
 #include "ui_config.h"
 #include "vca_time_axis.h"
 
 #include "pbd/i18n.h"
 
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
+using namespace ArdourWidgets;
 using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace PBD;
@@ -50,6 +51,10 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
        , gain_meter (s, true, 75, 14) // XXX stupid magic numbers, match sizes in RouteTimeAxisView
        , automation_action_menu (0)
 {
+
+       controls_base_selected_name = X_("ControlMasterBaseSelected");
+       controls_base_unselected_name = X_("ControlMasterBaseUnselected");
+
        solo_button.set_name ("solo button");
        set_tooltip (solo_button, _("Solo slaves"));
        solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::solo_release), false);
@@ -78,11 +83,26 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
        drop_button.set_tweaks(ArdourButton::TrackHeader);
        automation_button.set_tweaks(ArdourButton::TrackHeader);
 
-       controls_table.attach (mute_button, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
-       controls_table.attach (solo_button, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
-       controls_table.attach (automation_button, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
-       controls_table.attach (drop_button, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
-       controls_table.attach (gain_meter.get_gain_slider(), 0, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0);
+       if (ARDOUR::Profile->get_mixbus()) {
+               controls_button_size_group->add_widget(mute_button);
+
+               Gtk::Fixed *blank = manage(new Gtk::Fixed());
+               controls_button_size_group->add_widget(*blank);
+               controls_table.attach (*blank, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               blank->show();
+
+               controls_table.attach (mute_button, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (solo_button, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (automation_button, 1, 2, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (drop_button, 2, 3, 2, 3, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (gain_meter.get_gain_slider(), 3, 5, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0);
+       } else {
+               controls_table.attach (mute_button, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (solo_button, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (automation_button, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (drop_button, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+               controls_table.attach (gain_meter.get_gain_slider(), 0, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 1, 0);
+       }
 
        mute_button.show ();
        solo_button.show ();
@@ -90,8 +110,8 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca
        automation_button.show ();
        gain_meter.get_gain_slider().show ();
 
-       controls_ebox.set_name ("ControlMasterBaseUnselected");
-       time_axis_frame.set_name ("ControlMasterBaseUnselected");
+       controls_ebox.set_name (controls_base_unselected_name);
+       time_axis_frame.set_name (controls_base_unselected_name);
 
        s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
        Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context());
@@ -195,6 +215,13 @@ VCATimeAxisView::update_vca_name ()
        name_label.set_text (_vca->full_name());
 }
 
+bool
+VCATimeAxisView::name_entry_changed (std::string const& str)
+{
+       _vca->set_name (str);
+       return true;
+}
+
 void
 VCATimeAxisView::update_mute_display ()
 {
@@ -319,13 +346,23 @@ VCATimeAxisView::stripable () const
 Gdk::Color
 VCATimeAxisView::color () const
 {
-       return gdk_color_from_rgb (_vca->presentation_info().color ());
+       return ARDOUR_UI_UTILS::gdk_color_from_rgb (_vca->presentation_info().color ());
 }
 
 void
 VCATimeAxisView::set_height (uint32_t h, TrackHeightMode m)
 {
        TimeAxisView::set_height (h, m);
+       if (height >= preset_height (HeightNormal)) {
+               drop_button.show ();
+               automation_button.show ();
+               gain_meter.get_gain_slider().show ();
+       } else {
+               drop_button.hide ();
+               automation_button.hide ();
+               gain_meter.get_gain_slider().hide ();
+       }
+
        set_gui_property ("height", h);
        _vca->gui_changed ("track_height", (void*) 0); /* EMIT SIGNAL */
 }
@@ -401,6 +438,32 @@ VCATimeAxisView::create_automation_child (const Evoral::Parameter& param, bool s
        }
 }
 
+void
+VCATimeAxisView::build_display_menu ()
+{
+       using namespace Menu_Helpers;
+       /* prepare it */
+       TimeAxisView::build_display_menu ();
+
+       MenuList& items = display_menu->items();
+       items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &VCATimeAxisView::choose_color)));
+       if (_size_menu) {
+               detach_menu (*_size_menu);
+       }
+       build_size_menu ();
+       items.push_back (MenuElem (_("Height"), *_size_menu));
+       items.push_back (SeparatorElem());
+
+       build_automation_action_menu (true);
+       items.push_back (MenuElem (_("Automation"), *automation_action_menu));
+
+       items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Drop All Slaves"), sigc::mem_fun (*this, &VCATimeAxisView::drop_all_slaves)));
+       items.push_back (SeparatorElem());
+       items.push_back (MenuElem (_("Remove"), sigc::mem_fun(_editor, &PublicEditor::remove_tracks)));
+}
+
+
 void
 VCATimeAxisView::build_automation_action_menu (bool for_selection)
 {
@@ -482,3 +545,18 @@ VCATimeAxisView::hide_all_automation (bool apply_to_selection)
        no_redraw = false;
        request_redraw ();
 }
+
+void
+VCATimeAxisView::drop_all_slaves ()
+{
+       _vca->Drop (); /* EMIT SIGNAL */
+
+       if (Mixer_UI::instance()->showing_spill_for (_vca)) {
+               Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
+       }
+}
+
+void
+VCATimeAxisView::choose_color () {
+       _color_picker.popup (_vca);
+}