disallow selection of the fader and meter processor entries
authorBen Loftis <ben@harrisonconsoles.com>
Mon, 28 Jul 2014 15:08:17 +0000 (10:08 -0500)
committerBen Loftis <ben@harrisonconsoles.com>
Mon, 28 Jul 2014 15:08:26 +0000 (10:08 -0500)
gtk2_ardour/processor_box.cc
gtk2_ardour/processor_box.h
libs/gtkmm2ext/gtkmm2ext/dndvbox.h

index ff679239351b214daa6710baafa608fe32c5af64..f095896f407ac86ef00f0c093f1045e7552fefc2 100644 (file)
@@ -103,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)
@@ -1753,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);
@@ -1760,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) {
index 52ed36a9b2a997de944598ee3d9c035d3188dbba..8caee04006cbe317dd706889a4901d721f17a824 100644 (file)
@@ -119,6 +119,9 @@ public:
        std::string drag_text () const;
        void set_visual_state (Gtkmm2ext::VisualState, bool);
 
+       bool is_selectable() const {return _selectable;}
+       void set_selectable(bool s) { _selectable = s; }
+       
        enum Position {
                PreFader,
                Fader,
@@ -149,6 +152,7 @@ protected:
        virtual void setup_visuals ();
 
 private:
+       bool _selectable;
        void led_clicked();
        void processor_active_changed ();
        void processor_property_changed (const PBD::PropertyChange&);
index 157cd59bef68575f3716626fe021b5a4dc21fec3..9ea93262fe10e1ffe4e845bfefa06e29938b36aa 100644 (file)
@@ -41,6 +41,9 @@ public:
 
        /** Set the child's visual state */
        virtual void set_visual_state (VisualState, bool onoff) = 0;
+
+       /** @return True if the child can be selected in the list ( if you don't want it to copy/paste/drag then turn this off ) */
+       virtual bool is_selectable () const = 0;
 };
 
 /** A VBox whose contents can be dragged and dropped */
@@ -565,6 +568,8 @@ private:
        
        void add_to_selection (T* child)
        {
+               if ( !child->is_selectable() )
+                       return;
                _selection.push_back (child);
                setup_child_state (child);
        }