catch lua exceptions.
[ardour.git] / gtk2_ardour / processor_box.h
index f2fc9d2df1937412b7a9e353de50bd03b8a138d8..2df431139caee758269e554c3987a4713565a504 100644 (file)
@@ -44,6 +44,7 @@
 #include "ardour/types.h"
 #include "ardour/ardour.h"
 #include "ardour/plugin_insert.h"
+#include "ardour/luaproc.h"
 #include "ardour/port_insert.h"
 #include "ardour/processor.h"
 #include "ardour/route.h"
@@ -82,27 +83,27 @@ class ProcessorWindowProxy : public WM::ProxyBase
   public:
        ProcessorWindowProxy (std::string const &, ProcessorBox *, boost::weak_ptr<ARDOUR::Processor>);
        ~ProcessorWindowProxy();
-       
+
        Gtk::Window* get (bool create = false);
-       
+
        boost::weak_ptr<ARDOUR::Processor> processor () const {
                return _processor;
        }
-       
+
        ARDOUR::SessionHandlePtr* session_handle();
        void show_the_right_window ();
        void set_custom_ui_mode(bool use_custom) { want_custom = use_custom; }
-       
+
        int set_state (const XMLNode&, int);
        XMLNode& get_state ();
-       
+
   private:
        ProcessorBox* _processor_box;
        boost::weak_ptr<ARDOUR::Processor> _processor;
        bool is_custom;
        bool want_custom;
        bool _valid;
-       
+
        void processor_going_away ();
        PBD::ScopedConnection going_away_connection;
 };
@@ -122,6 +123,7 @@ public:
        void set_selectable(bool s) { _selectable = s; }
 
        bool drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &);
+       bool can_copy_state (Gtkmm2ext::DnDVBoxChild*) const;
 
        enum Position {
                PreFader,
@@ -215,9 +217,41 @@ private:
 
        std::list<Control*> _controls;
 
+       void toggle_inline_display_visibility ();
        void toggle_control_visibility (Control *);
        void toggle_panner_link ();
 
+       class PluginDisplay : public Gtk::DrawingArea {
+       public:
+               PluginDisplay(boost::shared_ptr<ARDOUR::Plugin>, uint32_t max_height = 80);
+               ~PluginDisplay();
+       protected:
+               bool on_expose_event (GdkEventExpose *);
+               void on_size_request (Gtk::Requisition* req);
+
+               void update_height_alloc (uint32_t inline_height);
+               virtual uint32_t render_inline (cairo_t *, uint32_t width);
+
+               boost::shared_ptr<ARDOUR::Plugin> _plug;
+               PBD::ScopedConnection _qdraw_connection;
+               cairo_surface_t* _surf;
+               uint32_t _max_height;
+               uint32_t _cur_height;
+               bool _scroll;
+       };
+
+       class LuaPluginDisplay : public PluginDisplay {
+       public:
+               LuaPluginDisplay(boost::shared_ptr<ARDOUR::LuaProc>, uint32_t max_height = 80);
+               ~LuaPluginDisplay();
+       protected:
+               virtual uint32_t render_inline (cairo_t *, uint32_t width);
+       private:
+               boost::shared_ptr<ARDOUR::LuaProc> _luaproc;
+               LuaState lua_gui;
+               luabridge::LuaRef * _lua_render_inline;
+       };
+
        class PortIcon : public Gtk::DrawingArea {
        public:
                PortIcon(bool input);
@@ -251,6 +285,7 @@ protected:
        RoutingIcon _routing_icon;
        PortIcon _input_icon;
        PortIcon _output_icon;
+       PluginDisplay *_plugin_display ;
 };
 
 class PluginInsertProcessorEntry : public ProcessorEntry
@@ -317,7 +352,10 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorSelected;
        sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorUnselected;
 
+       static Glib::RefPtr<Gtk::ActionGroup> processor_box_actions;
+       static Gtkmm2ext::Bindings* bindings;
        static void register_actions();
+
 #ifndef NDEBUG
        static bool show_all_processors;
 #endif
@@ -344,6 +382,9 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        uint32_t                  _visible_prefader_processors;
 
        RouteProcessorSelection& _rr_selection;
+       static Gtkmm2ext::ActionMap myactions;
+
+       static void load_bindings ();
 
        void route_going_away ();
 
@@ -375,6 +416,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        void return_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Processor>, IOSelectorWindow*);
        void choose_insert ();
        void choose_plugin ();
+       bool choose_lua ();
        bool use_plugins (const SelectedPlugins&);
 
        bool no_processor_redisplay;
@@ -438,6 +480,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
        static void rb_choose_aux (boost::weak_ptr<ARDOUR::Route>);
        static void rb_choose_plugin ();
        static void rb_choose_insert ();
+       static void rb_choose_lua ();
        static void rb_choose_send ();
        static void rb_clear ();
        static void rb_clear_pre ();