Standardize drawing of PixFader and BarController; implement flat_buttons and prelight.
[ardour.git] / gtk2_ardour / processor_box.cc
index 56d2d371ebb7d242009be0755a945941fcf21936..f095896f407ac86ef00f0c093f1045e7552fefc2 100644 (file)
@@ -76,7 +76,6 @@
 #include "return_ui.h"
 #include "route_processor_selection.h"
 #include "send_ui.h"
-#include "utils.h"
 
 #include "i18n.h"
 
@@ -104,6 +103,7 @@ static const uint32_t midi_port_color = 0x960909FF; //Red
 ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w)
        : _button (ArdourButton::led_default_elements)
        , _position (PreFader)
+       , _selectable(true)
        , _parent (parent)
        , _processor (p)
        , _width (w)
@@ -1196,14 +1196,14 @@ ProcessorBox::leave_notify (GdkEventCrossing*)
        return false;
 }
 
-void
+bool
 ProcessorBox::processor_operation (ProcessorOperation op) 
 {
        ProcSelection targets;
 
        get_selected_processors (targets);
 
-       if (targets.empty()) {
+/*     if (targets.empty()) {
 
                int x, y;
                processor_display.get_pointer (x, y);
@@ -1214,12 +1214,20 @@ ProcessorBox::processor_operation (ProcessorOperation op)
                        targets.push_back (pointer.first->processor ());
                }
        }
+*/
 
+       if ( (op == ProcessorsDelete) && targets.empty() )
+               return false;  //nothing to delete.  return false so the editor-mixer, because the user was probably intending to delete something in the editor
+       
        switch (op) {
        case ProcessorsSelectAll:
                processor_display.select_all ();
                break;
 
+       case ProcessorsSelectNone:
+               processor_display.select_none ();
+               break;
+
        case ProcessorsCopy:
                copy_processors (targets);
                break;
@@ -1257,6 +1265,8 @@ ProcessorBox::processor_operation (ProcessorOperation op)
        default:
                break;
        }
+       
+       return true;
 }
 
 ProcessorWindowProxy* 
@@ -1744,6 +1754,7 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
        }
 
        boost::shared_ptr<PluginInsert> plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor);
+       
        ProcessorEntry* e = 0;
        if (plugin_insert) {
                e = new PluginInsertProcessorEntry (this, plugin_insert, _width);
@@ -1751,6 +1762,13 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
                e = new ProcessorEntry (this, processor, _width);
        }
 
+       boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
+       boost::shared_ptr<PortInsert> ext = boost::dynamic_pointer_cast<PortInsert> (processor);
+       
+       //faders and meters are not deletable, copy/paste-able, so they shouldn't be selectable
+       if (!send && !plugin_insert && !ext)
+               e->set_selectable(false);
+
        /* Set up this entry's state from the GUIObjectState */
        XMLNode* proc = entry_gui_object_state (e);
        if (proc) {