/*
- Copyright (C) 2000-2004 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2005-2018 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2006-2007 Doug McLain <doug@nostar.net>
+ * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2007-2012 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2013-2015 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2016-2018 Len Ovens <len@ovenwerks.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#include <glibmm/threads.h>
#include <gtkmm/accelmap.h>
+#include <gtkmm/offscreenwindow.h>
#include <gtkmm/stock.h>
#include "pbd/convert.h"
#include "ardour/debug.h"
#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
+#include "ardour/monitor_control.h"
#include "ardour/plugin_manager.h"
#include "ardour/route_group.h"
#include "ardour/selection.h"
#include "widgets/tearoff.h"
+#include "foldback_strip.h"
#include "keyboard.h"
#include "mixer_ui.h"
#include "mixer_strip.h"
, in_group_row_change (false)
, track_menu (0)
, _plugin_selector (0)
+ , foldback_strip (0)
+ , _show_foldback_strip (true)
, _strip_width (UIConfiguration::instance().get_default_narrow_ms() ? Narrow : Wide)
, _spill_scroll_position (0)
, ignore_reorder (false)
{
load_bindings ();
register_actions ();
+ Glib::RefPtr<ToggleAction> fb_act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
+ fb_act->set_sensitive (false);
+
_content.set_data ("ardour-bindings", bindings);
PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context());
#endif
_group_tabs = new MixerGroupTabs (this);
- VBox* b = manage (new VBox);
- b->set_spacing (0);
- b->set_border_width (0);
- b->pack_start (*_group_tabs, PACK_SHRINK);
- b->pack_start (strip_packer);
- b->show_all ();
- b->signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
-
- scroller.add (*b);
+ strip_group_box.set_spacing (0);
+ strip_group_box.set_border_width (0);
+ strip_group_box.pack_start (*_group_tabs, PACK_SHRINK);
+ strip_group_box.pack_start (strip_packer);
+ strip_group_box.show_all ();
+ strip_group_box.signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_scroll_event), false);
+
+ scroller.add (strip_group_box);
scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
setup_track_display ();
vca_scroller_base.set_name (X_("MixerWindow"));
vca_scroller_base.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::masters_scroller_button_release), false);
+ vca_hpacker.signal_scroll_event().connect (sigc::mem_fun (*this, &Mixer_UI::on_vca_scroll_event), false);
vca_scroller.add (vca_hpacker);
vca_scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC);
vca_scroller.signal_button_release_event().connect (sigc::mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context());
+ FoldbackStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_foldback, this, _1), gui_context());
/* handle escape */
{
monitor_section_detached ();
+ delete foldback_strip;
+ foldback_strip = 0;
delete _plugin_selector;
delete track_menu;
}
return false;
}
+void
+Mixer_UI::new_masters_created ()
+{
+ ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane")->set_active (true);
+}
+
void
Mixer_UI::add_masters (VCAList& vlist)
{
continue;
}
+ if (route->is_foldbackbus ()) {
+ if (foldback_strip) {
+ // last strip created is shown
+ foldback_strip->set_route (route);
+ } else {
+ foldback_strip = new FoldbackStrip (*this, _session, route);
+ out_packer.pack_start (*foldback_strip, false, false);
+ // change 0 to 1 below for foldback to right of master
+ out_packer.reorder_child (*foldback_strip, 0);
+ foldback_strip->set_packed (true);
+ }
+ /* config from last run is set before there are any foldback strips
+ * this takes that setting and applies it after at least one foldback
+ * strip exists */
+ bool yn = _show_foldback_strip;
+ Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
+ act->set_sensitive (true);
+ act->set_active(!yn);
+ act->set_active(yn);
+ continue;
+ }
strip = new MixerStrip (*this, _session, route);
strips.push_back (strip);
}
}
+void
+Mixer_UI::remove_foldback (FoldbackStrip* strip)
+{
+ if (_session && _session->deletion_in_progress()) {
+ /* its all being taken care of */
+ return;
+ }
+ Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
+ act->set_sensitive (false);
+ if (foldback_strip) {
+ foldback_strip->destroy_();
+ }
+ foldback_strip = 0;
+}
+
void
Mixer_UI::presentation_info_changed (PropertyChange const & what_changed)
{
_session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::update_title, this), gui_context());
_session->vca_manager().VCAAdded.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::add_masters, this, _1), gui_context());
+ _session->vca_manager().VCACreated.connect (_session_connections, invalidator (*this), boost::bind (&Mixer_UI::new_masters_created, this), gui_context());
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::parameter_changed, this, _1), gui_context ());
}
_monitor_section.tearoff().hide_visible ();
+ StripableList fb;
+ _session->get_stripables (fb, PresentationInfo::FoldbackBus);
+ if (fb.size()) {
+ if (foldback_strip) {
+ delete foldback_strip;
+ foldback_strip = 0;
+ }
+ }
monitor_section_detached ();
(*i)[stripable_columns.visible] = av->marked_for_display ();
}
- /* force presentation catch up with visibility changes
- */
-
+ /* force presentation to catch up with visibility changes */
sync_presentation_info_from_treeview ();
}
(*i)[stripable_columns.visible] = yn;
}
+
+ /* force presentation to catch up with visibility changes */
+ sync_presentation_info_from_treeview ();
}
redisplay_track_list ();
}
-
void
Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn)
{
break;
}
}
+
+ /* force presentation to catch up with visibility changes */
+ sync_presentation_info_from_treeview ();
}
redisplay_track_list ();
Mixer_UI::initial_track_display ()
{
StripableList sl;
+ StripableList fb;
_session->get_stripables (sl);
+ _session->get_stripables (fb, PresentationInfo::FoldbackBus);
+ if (fb.size()) {
+ boost::shared_ptr<ARDOUR::Stripable> _current_foldback = *(fb.begin());
+ sl.push_back (_current_foldback);
+ }
sl.sort (PresentationInfoMixerSorter());
return false;
}
+void
+Mixer_UI::move_vca_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
+{
+ if (!vca_scroller.get_hscrollbar()) {
+ return;
+ }
+
+ bool found = false;
+ int x0 = 0;
+ Gtk::Allocation alloc;
+
+ TreeModel::Children rows = track_model->children();
+ for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) {
+ AxisView* av = (*i)[stripable_columns.strip];
+ VCAMasterStrip* vms = dynamic_cast<VCAMasterStrip*> (av);
+ if (vms && vms->stripable () == s) {
+ int y;
+ found = true;
+ vms->translate_coordinates (vca_hpacker, 0, 0, x0, y);
+ alloc = vms->get_allocation ();
+ break;
+ }
+ }
+
+ if (!found) {
+ return;
+ }
+
+ Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
+
+ if (x0 < adj->get_value()) {
+ adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x0)));
+ } else if (x0 + alloc.get_width() >= adj->get_value() + adj->get_page_size()) {
+ int x1 = x0 + alloc.get_width() - adj->get_page_size();
+ adj->set_value (max (adj->get_lower(), min (adj->get_upper(), (double) x1)));
+ }
+}
+
void
Mixer_UI::move_stripable_into_view (boost::shared_ptr<ARDOUR::Stripable> s)
{
if (!scroller.get_hscrollbar()) {
return;
}
- if (s->presentation_info().special () || s->presentation_info().flag_match (PresentationInfo::VCA)) {
+ if (s->presentation_info().special ()) {
return;
}
+ if (s->presentation_info().flag_match (PresentationInfo::VCA)) {
+ move_vca_into_view (s);
+ }
#ifdef MIXBUS
if (s->mixbus ()) {
return;
}
}
+void
+Mixer_UI::toggle_foldback_strip ()
+{
+ Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
+ showhide_foldback_strip (act->get_active());
+}
+
+
+void
+Mixer_UI::showhide_foldback_strip (bool yn)
+{
+ _show_foldback_strip = yn;
+
+ if (foldback_strip) {
+ if (yn) {
+ foldback_strip->show();
+ } else {
+ foldback_strip->hide();
+ }
+ }
+}
+
void
Mixer_UI::toggle_vcas ()
{
node.get_property ("show-mixer", _visible);
- if (node.get_property ("maximised", yn)) {
+ yn = false;
+ node.get_property ("maximised", yn);
+ {
Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Common"), X_("ToggleMaximalMixer"));
bool fs = act && act->get_active();
if (yn ^ fs) {
}
}
- if (node.get_property ("show-mixer-list", yn)) {
+ yn = true;
+ node.get_property ("show-mixer-list", yn);
+ {
Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMixerList"));
-
/* do it twice to force the change */
act->set_active (!yn);
act->set_active (yn);
}
- if (node.get_property ("monitor-section-visible", yn)) {
+ yn = true;
+ node.get_property ("monitor-section-visible", yn);
+ {
Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMonitorSection"));
/* do it twice to force the change */
act->set_active (!yn);
act->set_active (yn);
}
- if (node.get_property ("show-vca-pane", yn)) {
+ yn = true;
+ node.get_property ("foldback-strip-visible", yn);
+ {
+ Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleFoldbackStrip"));
+ /* do it twice to force the change */
+ act->set_active (!yn);
+ act->set_active (yn);
+ }
+
+ yn = true;
+ node.get_property ("show-vca-pane", yn);
+ {
Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleVCAPane"));
/* do it twice to force the change */
act->set_active (!yn);
}
#ifdef MIXBUS
- if (node.get_property ("show-mixbus-pane", yn)) {
+ yn = true;
+ node.get_property ("show-mixbus-pane", yn);
+ {
Glib::RefPtr<ToggleAction> act = ActionManager::get_toggle_action (X_("Mixer"), X_("ToggleMixbusPane"));
/* do it twice to force the change */
act->set_active (!yn);
act->set_active (yn);
}
-
#endif
//check for the user's plugin_order file
act = ActionManager::get_toggle_action ("Mixer", "ToggleMonitorSection");
node->set_property ("monitor-section-visible", act->get_active ());
+ act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
+ node->set_property ("foldback-strip-visible", act->get_active ());
+
act = ActionManager::get_toggle_action ("Mixer", "ToggleVCAPane");
node->set_property ("show-vca-pane", act->get_active ());
return false;
}
+void
+Mixer_UI::vca_scroll_left ()
+{
+ if (!vca_scroller.get_hscrollbar()) return;
+ Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
+ int sc_w = vca_scroller.get_width();
+ int sp_w = strip_packer.get_width();
+ if (sp_w <= sc_w) {
+ return;
+ }
+ int lp = adj->get_value();
+ int lm = 0;
+ using namespace Gtk::Box_Helpers;
+ const BoxList& strips = vca_hpacker.children();
+ for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
+ if (i->get_widget() == &add_vca_button) {
+ continue;
+ }
+ lm += i->get_widget()->get_width ();
+ if (lm >= lp) {
+ lm -= i->get_widget()->get_width ();
+ break;
+ }
+ }
+ vca_scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
+}
+
+void
+Mixer_UI::vca_scroll_right ()
+{
+ if (!vca_scroller.get_hscrollbar()) return;
+ Adjustment* adj = vca_scroller.get_hscrollbar()->get_adjustment();
+ int sc_w = vca_scroller.get_width();
+ int sp_w = strip_packer.get_width();
+ if (sp_w <= sc_w) {
+ return;
+ }
+ int lp = adj->get_value();
+ int lm = 0;
+ using namespace Gtk::Box_Helpers;
+ const BoxList& strips = vca_hpacker.children();
+ for (BoxList::const_iterator i = strips.begin(); i != strips.end(); ++i) {
+ if (i->get_widget() == &add_vca_button) {
+ continue;
+ }
+ lm += i->get_widget()->get_width ();
+ if (lm > lp + 1) {
+ break;
+ }
+ }
+ vca_scroller.get_hscrollbar()->set_value (max (adj->get_lower(), min (adj->get_upper(), lm - 1.0)));
+}
+
+bool
+Mixer_UI::on_vca_scroll_event (GdkEventScroll* ev)
+{
+ switch (ev->direction) {
+ case GDK_SCROLL_LEFT:
+ vca_scroll_left ();
+ return true;
+ case GDK_SCROLL_UP:
+ if (ev->state & Keyboard::TertiaryModifier) {
+ vca_scroll_left ();
+ return true;
+ }
+ return false;
+
+ case GDK_SCROLL_RIGHT:
+ vca_scroll_right ();
+ return true;
+
+ case GDK_SCROLL_DOWN:
+ if (ev->state & Keyboard::TertiaryModifier) {
+ vca_scroll_right ();
+ return true;
+ }
+ return false;
+ }
+
+ return false;
+}
void
Mixer_UI::parameter_changed (string const & p)
vector<ARDOUR::Plugin::PresetRecord> presets = (*i)->get_presets (true);
for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator j = presets.begin(); j != presets.end(); ++j) {
+ if (!(*j).user) {
+ continue;
+ }
Gtk::TreeModel::Row child_row = *(favorite_plugins_model->append (newrow.children()));
child_row[favorite_plugins_columns.name] = (*j).label;
child_row[favorite_plugins_columns.plugin] = PluginPresetPtr (new PluginPreset(pip, &(*j)));
{
using namespace Gtk::Menu_Helpers;
- Gtk::Menu* m = manage (new Menu);
+ Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
MenuList& items = m->items ();
if (_selection.axes.empty()) {
ActionManager::register_toggle_action (group, X_("ToggleVCAPane"), _("Mixer: Show VCAs"), sigc::mem_fun (*this, &Mixer_UI::toggle_vcas));
#ifdef MIXBUS
- ActionManager::register_toggle_action (group, X_("ToggleMixbusPane"), _("Mixer: Show Mixbuses"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixbus_pane));
+ ActionManager::register_toggle_action (group, X_("ToggleMixbusPane"), _("Mixer: Show Mixbusses"), sigc::mem_fun (*this, &Mixer_UI::toggle_mixbuses));
#endif
ActionManager::register_toggle_action (group, X_("ToggleMonitorSection"), _("Mixer: Show Monitor Section"), sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_section));
+
+ ActionManager::register_toggle_action (group, X_("ToggleFoldbackStrip"), _("Mixer: Show Foldback Strip"), sigc::mem_fun (*this, &Mixer_UI::toggle_foldback_strip));
+
+ ActionManager::register_toggle_action (group, X_("toggle-disk-monitor"), _("Toggle Disk Monitoring"), sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_action), MonitorDisk, false, false));
+ ActionManager::register_toggle_action (group, X_("toggle-input-monitor"), _("Toggle Input Monitoring"), sigc::bind (sigc::mem_fun (*this, &Mixer_UI::toggle_monitor_action), MonitorInput, false, false));
}
void
if (s) {
ac = (s.get()->*get_control)();
if (ac) {
+ ac->start_touch (_session->audible_sample ());
cl->push_back (ac);
if (!have_val) {
val = !ac->get_value();
}
}
}
+
+bool
+Mixer_UI::screenshot (std::string const& filename)
+{
+ if (!_session) {
+ return false;
+ }
+
+ int height = strip_packer.get_height();
+ bool with_vca = vca_vpacker.is_visible ();
+ MixerStrip* master = strip_by_route (_session->master_out ());
+
+ Gtk::OffscreenWindow osw;
+ Gtk::HBox b;
+ osw.add (b);
+ b.show ();
+
+ /* unpack widgets, add to OffscreenWindow */
+
+ strip_group_box.remove (strip_packer);
+ b.pack_start (strip_packer, false, false);
+ /* hide extra elements inside strip_packer */
+ add_button.hide ();
+ scroller_base.hide ();
+#ifdef MIXBUS
+ mb_shadow.hide();
+#endif
+
+ if (with_vca) {
+ /* work around Gtk::ScrolledWindow */
+ Gtk::Viewport* viewport = (Gtk::Viewport*) vca_scroller.get_child();
+ viewport->remove (); // << vca_hpacker
+ b.pack_start (vca_hpacker, false, false);
+ /* hide some growing widgets */
+ add_vca_button.hide ();
+ vca_scroller_base.hide();
+ }
+
+ if (master) {
+ out_packer.remove (*master);
+ b.pack_start (*master, false, false);
+ master->hide_master_spacer (true);
+ }
+
+ /* prepare the OffscreenWindow for rendering */
+ osw.set_size_request (-1, height);
+ osw.show ();
+ osw.queue_resize ();
+ osw.queue_draw ();
+ osw.get_window()->process_updates (true);
+
+ /* create screenshot */
+ Glib::RefPtr<Gdk::Pixbuf> pb = osw.get_pixbuf ();
+ pb->save (filename, "png");
+
+ /* unpack elements before destorying the Box & OffscreenWindow */
+ list<Gtk::Widget*> children = b.get_children();
+ for (list<Gtk::Widget*>::iterator child = children.begin(); child != children.end(); ++child) {
+ b.remove (**child);
+ }
+ osw.remove ();
+
+ /* now re-pack the widgets into the main mixer window */
+ add_button.show ();
+ scroller_base.show ();
+#ifdef MIXBUS
+ mb_shadow.show();
+#endif
+ strip_group_box.pack_start (strip_packer);
+ if (with_vca) {
+ add_vca_button.show ();
+ vca_scroller_base.show();
+ vca_scroller.add (vca_hpacker);
+ }
+ if (master) {
+ master->hide_master_spacer (false);
+ out_packer.pack_start (*master, false, false);
+ }
+ return true;
+}
+
+void
+Mixer_UI::toggle_monitor_action (MonitorChoice monitor_choice, bool group_override, bool all)
+{
+ MonitorChoice mc;
+ boost::shared_ptr<RouteList> rl;
+
+ for (AxisViewSelection::iterator i = _selection.axes.begin(); i != _selection.axes.end(); ++i) {
+ boost::shared_ptr<ARDOUR::Route> rt = boost::dynamic_pointer_cast<ARDOUR::Route> ((*i)->stripable());
+
+ if (rt->monitoring_control()->monitoring_choice() & monitor_choice) {
+ mc = MonitorChoice (rt->monitoring_control()->monitoring_choice() & ~monitor_choice);
+ } else {
+ mc = MonitorChoice (rt->monitoring_control()->monitoring_choice() | monitor_choice);
+ }
+
+ if (all) {
+ /* Primary-Tertiary-click applies change to all routes */
+ rl = _session->get_routes ();
+ _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::NoGroup);
+ } else if (group_override) {
+ rl.reset (new RouteList);
+ rl->push_back (rt);
+ _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::InverseGroup);
+ } else {
+ rl.reset (new RouteList);
+ rl->push_back (rt);
+ _session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::UseGroup);
+ }
+
+ }
+}