Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / processor_box.cc
index a31bfc9f7390bd4486456f582074099b9cbfda8f..5eb60d2cca675d90ef67c8716b0aa7c3825981d1 100644 (file)
@@ -1,21 +1,29 @@
 /*
-    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) 2007-2014 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2018 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2007 Doug McLain <doug@nostar.net>
+ * Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2013-2015 John Emmas <john@creativepost.co.uk>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014-2015 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2014-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
+ * Copyright (C) 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"
@@ -32,6 +40,8 @@
 
 #include <gtkmm/messagedialog.h>
 
+#include "pbd/unwind.h"
+
 #include "gtkmm2ext/colors.h"
 #include "gtkmm2ext/gtk_ui.h"
 #include "gtkmm2ext/menu_elems.h"
@@ -106,6 +116,8 @@ using namespace Gtkmm2ext;
 using namespace ArdourWidgets;
 
 ProcessorBox*  ProcessorBox::_current_processor_box = 0;
+bool           ProcessorBox::_ignore_disk_io_change = false;
+
 RefPtr<Action> ProcessorBox::paste_action;
 RefPtr<Action> ProcessorBox::cut_action;
 RefPtr<Action> ProcessorBox::copy_action;
@@ -1027,7 +1039,8 @@ ProcessorEntry::Control::set_state (XMLNode const * node)
                        set_visible (visible);
                }
        } else {
-               set_visible (false);
+               boost::shared_ptr<AutomationControl> c = _control.lock ();
+               set_visible (c && (c->flags () & Controllable::InlineControl));
        }
 }
 
@@ -1673,7 +1686,7 @@ ProcessorEntry::PluginInlineDisplay::update_height_alloc (uint32_t inline_height
 }
 
 void
-ProcessorEntry::PluginInlineDisplay::display_sample (cairo_t* cr, double w, double h)
+ProcessorEntry::PluginInlineDisplay::display_frame (cairo_t* cr, double w, double h)
 {
        Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, w - 1, h + 1, 7);
 }
@@ -1985,6 +1998,9 @@ ProcessorBox::object_drop (DnDVBox<ProcessorEntry>* source, ProcessorEntry* posi
                        if (boost::dynamic_pointer_cast<UnknownProcessor> ((*i)->processor())) {
                                continue;
                        }
+                       if (boost::dynamic_pointer_cast<PortInsert> ((*i)->processor())) {
+                               continue;
+                       }
                        procs.push_back ((*i)->processor ());
                }
        }
@@ -2264,6 +2280,10 @@ ProcessorBox::show_processor_menu (int arg)
        manage_pins_action->set_sensitive (pi != 0);
        if (boost::dynamic_pointer_cast<Track>(_route)) {
                disk_io_action->set_sensitive (true);
+               PBD::Unwinder<bool> uw (_ignore_disk_io_change, true);
+               ActionManager::get_toggle_action (X_("ProcessorMenu"), "disk-io-prefader")->set_active (_route->disk_io_point () == DiskIOPreFader);
+               ActionManager::get_toggle_action (X_("ProcessorMenu"), "disk-io-postfader")->set_active (_route->disk_io_point () == DiskIOPostFader);
+               ActionManager::get_toggle_action (X_("ProcessorMenu"), "disk-io-custom")->set_active (_route->disk_io_point () == DiskIOCustom);
        } else {
                disk_io_action->set_sensitive (false);
        }
@@ -2885,19 +2905,8 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
        boost::shared_ptr<UnknownProcessor> stub = boost::dynamic_pointer_cast<UnknownProcessor> (processor);
 
        //faders and meters are not deletable, copy/paste-able, so they shouldn't be selectable
-       if (!send && !plugin_insert && !ext && !stub)
+       if (!send && !plugin_insert && !ext && !stub) {
                e->set_selectable(false);
-
-       bool mark_send_visible = false;
-       if (send && _parent_strip) {
-               /* show controls of new sends by default */
-               GUIObjectState& st = _parent_strip->gui_object_state ();
-               XMLNode* strip = st.get_or_add_node (_parent_strip->state_id ());
-               assert (strip);
-               /* check if state exists, if not it must be a new send */
-               if (!st.get_node(strip, e->state_id())) {
-                       mark_send_visible = true;
-               }
        }
 
        /* Set up this entry's state from the GUIObjectState */
@@ -2906,10 +2915,6 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
                e->set_control_state (proc);
        }
 
-       if (mark_send_visible) {
-               e->show_all_controls ();
-       }
-
        if (plugin_insert
 #ifdef MIXBUS
                        && !plugin_insert->plugin(0)->is_channelstrip()
@@ -3844,9 +3849,9 @@ ProcessorBox::register_actions ()
 
        /* Disk IO stuff */
        disk_io_action = ActionManager::register_action (processor_box_actions, X_("disk-io-menu"), _("Disk I/O ..."));
-       ActionManager::register_action (processor_box_actions, X_("disk-io-prefader"), _("Pre-Fader."), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOPreFader));
-       ActionManager::register_action (processor_box_actions, X_("disk-io-postfader"), _("Post-Fader."), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOPostFader));
-       ActionManager::register_action (processor_box_actions, X_("disk-io-custom"), _("Custom."), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOCustom));
+       ActionManager::register_toggle_action (processor_box_actions, X_("disk-io-prefader"), _("Pre-Fader"), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOPreFader));
+       ActionManager::register_toggle_action (processor_box_actions, X_("disk-io-postfader"), _("Post-Fader"), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOPostFader));
+       ActionManager::register_toggle_action (processor_box_actions, X_("disk-io-custom"), _("Custom"), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_set_disk_io_position), DiskIOCustom));
 
        /* show editors */
        edit_action = ActionManager::register_action (
@@ -3885,6 +3890,9 @@ ProcessorBox::rb_set_disk_io_position (DiskIOPoint diop)
        if (_current_processor_box == 0) {
                return;
        }
+       if (_ignore_disk_io_change) {
+               return;
+       }
 
        _current_processor_box->set_disk_io_position (diop);
 }