Merge branch 'master' into windows+cc
[ardour.git] / gtk2_ardour / processor_box.cc
index bae29ae98ab26e05e0f493196b71879702a2b8f5..1ed7c393120d6294e6a594666bf46a742421d239 100644 (file)
@@ -213,6 +213,7 @@ void
 ProcessorEntry::set_enum_width (Width w)
 {
        _width = w;
+       _button.set_text (name (_width));
 }
 
 void
@@ -381,7 +382,7 @@ ProcessorEntry::build_controls_menu ()
        
        for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
                items.push_back (CheckMenuElem ((*i)->name ()));
-               CheckMenuItem* c = dynamic_cast<CheckMenuItem*> (&items.back ());
+               Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
                c->set_active ((*i)->visible ());
                c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ProcessorEntry::toggle_control_visibility), *i));
        }
@@ -655,10 +656,15 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
 {
        cairo_t* cr = gdk_cairo_create (get_window()->gobj());
 
-       cairo_set_line_width (cr, 1);
+       cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+       cairo_clip (cr);
+
+       cairo_set_line_width (cr, 1.5);
+       cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
-       double const width = ev->area.width;
-       double const height = ev->area.height;
+       Gtk::Allocation a = get_allocation();
+       double const width = a.get_width();
+       double const height = a.get_height();
 
        Gdk::Color const bg = get_style()->get_bg (STATE_NORMAL);
        cairo_set_source_rgb (cr, bg.get_red_p (), bg.get_green_p (), bg.get_blue_p ());
@@ -669,12 +675,19 @@ PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev)
        Gdk::Color const fg = get_style()->get_fg (STATE_NORMAL);
        cairo_set_source_rgb (cr, fg.get_red_p (), fg.get_green_p (), fg.get_blue_p ());
 
-       cairo_move_to (cr, width * 0.3, height);
-       cairo_line_to (cr, width * 0.3, height * 0.5);
-       cairo_line_to (cr, width * 0.7, height * 0.5);
-       cairo_line_to (cr, width * 0.7, height);
-       cairo_move_to (cr, width * 0.5, height * 0.5);
-       cairo_line_to (cr, width * 0.5, 0);
+       const float si_l = rint(width * 0.3) + .5;
+       const float si_c = rint(width * 0.5) + .5;
+       const float si_r = rint(width * 0.7) + .5;
+       const float si_m = rint(height * 0.5) + .5;
+
+       cairo_move_to (cr, si_l, height);
+       cairo_line_to (cr, si_l, si_m);
+       cairo_line_to (cr, si_r, si_m);
+       cairo_line_to (cr, si_r, height);
+
+       cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+       cairo_move_to (cr, si_c, si_m);
+       cairo_line_to (cr, si_c, 0);
        cairo_stroke (cr);
 
        return true;
@@ -2031,7 +2044,7 @@ ProcessorBox::processor_can_be_edited (boost::shared_ptr<Processor> processor)
        }
 
        if (
-               (boost::dynamic_pointer_cast<Send> (processor) && !boost::dynamic_pointer_cast<InternalSend> (processor))||
+               boost::dynamic_pointer_cast<Send> (processor) ||
                boost::dynamic_pointer_cast<Return> (processor) ||
                boost::dynamic_pointer_cast<PluginInsert> (processor) ||
                boost::dynamic_pointer_cast<PortInsert> (processor)
@@ -2084,17 +2097,8 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
                }
 
                if (boost::dynamic_pointer_cast<InternalSend> (processor) == 0) {
-                       SendUIWindow* w = new SendUIWindow (send, _session);
-                       w->show ();
-               } else {
-                       /* assign internal send to main fader */
-                       if (_parent_strip) {
-                               if (_parent_strip->current_delivery() == send) {
-                                       _parent_strip->revert_to_default_display ();
-                               } else {
-                                       _parent_strip->show_send(send);
-                               }
-                       } 
+
+                       gidget = new SendUIWindow (send, _session);
                }
 
        } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
@@ -2147,7 +2151,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
        } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
 
                if (!_session->engine().connected()) {
-                       MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
+                       MessageDialog msg ( _("Not connected to audio engine - no I/O changes are possible"));
                        msg.run ();
                        return 0;
                }
@@ -2198,10 +2202,10 @@ ProcessorBox::register_actions ()
 
        act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"),
                        sigc::ptr_fun (ProcessorBox::rb_choose_insert));
-       ActionManager::jack_sensitive_actions.push_back (act);
+       ActionManager::engine_sensitive_actions.push_back (act);
        act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New External Send ..."),
                        sigc::ptr_fun (ProcessorBox::rb_choose_send));
-       ActionManager::jack_sensitive_actions.push_back (act);
+       ActionManager::engine_sensitive_actions.push_back (act);
 
        ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ..."));
 
@@ -2442,13 +2446,34 @@ ProcessorBox::rb_edit ()
        _current_processor_box->for_selected_processors (&ProcessorBox::edit_processor);
 }
 
+bool
+ProcessorBox::edit_aux_send (boost::shared_ptr<Processor> processor)
+{
+       if (boost::dynamic_pointer_cast<InternalSend> (processor) == 0) {
+               return false;
+       }
+
+       if (_parent_strip) {
+               boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
+               if (_parent_strip->current_delivery() == send) {
+                       _parent_strip->revert_to_default_display ();
+               } else {
+                       _parent_strip->show_send(send);
+               }
+       }
+       return true;
+}
+
 void
 ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
 {
        if (!processor) {
                return;
        }
-       
+       if (edit_aux_send (processor)) {
+               return;
+       }
+
        ProcessorWindowProxy* proxy = find_window_proxy (processor);
 
        if (proxy) {
@@ -2463,7 +2488,10 @@ ProcessorBox::generic_edit_processor (boost::shared_ptr<Processor> processor)
        if (!processor) {
                return;
        }
-       
+       if (edit_aux_send (processor)) {
+               return;
+       }
+
        ProcessorWindowProxy* proxy = find_window_proxy (processor);
 
        if (proxy) {