#include "gtk2ardour-config.h"
#endif
+#ifdef COMPILER_MSVC
+#define rintf(x) round((x) + 0.5)
+#endif
+
#include <cmath>
#include <iostream>
#include <set>
#include "return_ui.h"
#include "route_processor_selection.h"
#include "send_ui.h"
-#include "utils.h"
#include "i18n.h"
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)
_button.set_diameter (3);
_button.set_distinct_led_click (true);
+ _button.set_fallthrough_to_parent(true);
_button.set_led_left (true);
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &ProcessorEntry::led_clicked));
_button.set_text (name (_width));
if (send) {
items.push_back (CheckMenuElem (_("Link panner controls")));
- CheckMenuItem* c = dynamic_cast<CheckMenuItem*> (&items.back ());
+ Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
c->set_active (send->panner_shell()->is_linked_to_route());
c->signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::toggle_panner_link));
cairo_move_to (cr, si_x, height);
cairo_line_to (cr, si_x, 0);
cairo_stroke (cr);
+ } else if (midi_sources == 1 && midi_sinks == 1) {
+ /* unusual cases -- removed synth, midi-track w/audio plugins */
+ const float si_x = rintf(width * (sinks > 1 ? .2f : .5f)) + .5f;
+ const float si_x0 = rintf(width * (sources > 1 ? .2f : .5f)) + .5f;
+ cairo_move_to (cr, si_x, height);
+ cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0);
+ cairo_stroke (cr);
}
/* AUDIO */
UINT_RGBA_B_FLT(audio_port_color));
if (_splitting) {
+ assert(audio_sources < 2);
assert(audio_sinks > 1);
- const float si_x0 = rintf(width * .5f) + .5f;
+ /* assume there is only ever one MIDI port */
+ const float si_x0 = rintf(width * (midi_sources > 0 ? .8f : .5f)) + .5f;
for (uint32_t i = midi_sinks; i < sinks; ++i) {
const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f;
cairo_move_to (cr, si_x, height);
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);
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;
default:
break;
}
+
+ return true;
}
ProcessorWindowProxy*
ret = true;
+ } else if (Keyboard::is_context_menu_event (ev)) {
+
+ show_processor_menu (ev->time);
+
+ ret = true;
+
} else if (processor && ev->button == 1 && selected) {
// this is purely informational but necessary for route params UI
sigc::mem_fun(*this, &ProcessorBox::idle_delete_processor),
boost::weak_ptr<Processor>(processor)));
- } else if (Keyboard::is_context_menu_event (ev)) {
-
- show_processor_menu (ev->time);
-
} else if (processor && Keyboard::is_button2_event (ev)
#ifndef GTKOSX
&& (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
}
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);
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) {
boost::shared_ptr<Pannable> sendpan(new Pannable (*_session));
XMLNode n (**niter);
- InternalSend* s = new InternalSend (*_session, sendpan, _route->mute_master(),
- boost::shared_ptr<Route>(), Delivery::Aux);
+ InternalSend* s = new InternalSend (*_session, sendpan, _route->mute_master(),
+ _route, boost::shared_ptr<Route>(), Delivery::Aux);
IOProcessor::prepare_for_reset (n, s->name());