#include "return_ui.h"
#include "route_processor_selection.h"
#include "send_ui.h"
+#include "timers.h"
#include "i18n.h"
ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w)
: _button (ArdourButton::led_default_elements)
, _position (PreFader)
+ , _position_num(0)
, _selectable(true)
, _parent (parent)
, _processor (p)
, _width (w)
- , _visual_state (Gtk::STATE_NORMAL)
, _input_icon(true)
, _output_icon(false)
{
_vbox.show ();
- _button.set_diameter (3);
_button.set_distinct_led_click (true);
_button.set_fallthrough_to_parent(true);
_button.set_led_left (true);
ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string const & n)
: _control (c)
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
- , _slider (&_adjustment, 0, 13)
+ , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, 13)
, _slider_persistant_tooltip (&_slider)
, _button (ArdourButton::led_default_elements)
, _ignore_ui_adjustment (false)
box.add (_slider);
_slider.show ();
- double const lo = c->internal_to_interface (c->lower ());
- double const up = c->internal_to_interface (c->upper ());
-
+ const ARDOUR::ParameterDescriptor& desc = c->desc();
+ double const lo = c->internal_to_interface(desc.lower);
+ double const up = c->internal_to_interface(desc.upper);
+ double const normal = c->internal_to_interface(desc.normal);
+ double smallstep = desc.smallstep;
+ double largestep = desc.largestep;
+
+ if (smallstep == 0.0) {
+ smallstep = up / 1000.;
+ } else {
+ smallstep = c->internal_to_interface(desc.lower + smallstep);
+ }
+
+ if (largestep == 0.0) {
+ largestep = up / 40.;
+ } else {
+ largestep = c->internal_to_interface(desc.lower + largestep);
+ }
+
_adjustment.set_lower (lo);
_adjustment.set_upper (up);
- _adjustment.set_step_increment ((up - lo) / 100);
- _adjustment.set_page_increment ((up - lo) / 10);
- _slider.set_default_value (c->internal_to_interface (c->normal ()));
+ _adjustment.set_step_increment (smallstep);
+ _adjustment.set_page_increment (largestep);
+ _slider.set_default_value (normal);
_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted));
c->Changed.connect (_connection, MISSING_INVALIDATOR, boost::bind (&Control::control_changed, this), gui_context ());
}
- ARDOUR_UI::RapidScreenUpdate.connect (sigc::mem_fun (*this, &Control::control_changed));
+ Timers::rapid_connect (sigc::mem_fun (*this, &Control::control_changed));
control_changed ();
set_tooltip ();
return;
}
- c->set_value (c->interface_to_internal (_adjustment.get_value ()));
+ c->set_value ( c->interface_to_internal(_adjustment.get_value ()) );
set_tooltip ();
}
} else {
- _adjustment.set_value (c->internal_to_interface (c->get_value ()));
+ _adjustment.set_value (c->internal_to_interface(c->get_value ()));
stringstream s;
s.precision (1);
ProcessorWindowProxy*
ProcessorBox::find_window_proxy (boost::shared_ptr<Processor> processor) const
{
- for (list<ProcessorWindowProxy*>::const_iterator i = _processor_window_info.begin(); i != _processor_window_info.end(); ++i) {
- boost::shared_ptr<Processor> p = (*i)->processor().lock();
-
- if (p && p == processor) {
- return (*i);
- }
- }
-
- return 0;
+ return processor->window_proxy();
}
-
bool
ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry* child)
{
&_visible_prefader_processors, &fader_seen));
_route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
-
- for (ProcessorWindowProxies::iterator i = _processor_window_info.begin(); i != _processor_window_info.end(); ++i) {
- (*i)->marked = false;
- }
-
_route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::maybe_add_processor_to_ui_list));
-
- /* trim dead wood from the processor window proxy list */
-
- ProcessorWindowProxies::iterator i = _processor_window_info.begin();
- while (i != _processor_window_info.end()) {
- ProcessorWindowProxies::iterator j = i;
- ++j;
-
- if (!(*i)->valid()) {
-
- WM::Manager::instance().remove (*i);
- delete *i;
- _processor_window_info.erase (i);
-
- } else if (!(*i)->marked) {
-
- /* this processor is no longer part of this processor
- * box.
- *
- * that could be because it was deleted or it could be
- * because the route being displayed in the parent
- * strip changed.
- *
- * The latter only happens with the editor mixer strip.
- */
-
- if (is_editor_mixer_strip()) {
-
- /* editor mixer strip .. DO NOTHING
- *
- * note: the processor window stays visible if
- * it is already visible
- */
- } else {
- (*i)->hide ();
- WM::Manager::instance().remove (*i);
- delete *i;
- _processor_window_info.erase (i);
- }
- }
-
- i = j;
- }
-
setup_entry_positions ();
}
if (!p) {
return;
}
-
- ProcessorWindowProxies::iterator i = _processor_window_info.begin ();
- while (i != _processor_window_info.end()) {
-
- boost::shared_ptr<Processor> t = (*i)->processor().lock ();
-
- if (p == t) {
- /* this processor is already on the list; done */
- (*i)->marked = true;
- return;
- }
-
- ++i;
+ if (p->window_proxy()) {
+ return;
}
/* not on the list; add it */
string loc;
+#if 0 // is this still needed? Why?
if (_parent_strip) {
if (_parent_strip->mixer_owned()) {
loc = X_("M");
} else {
loc = X_("P");
}
+#else
+ loc = X_("P");
+#endif
ProcessorWindowProxy* wp = new ProcessorWindowProxy (
string_compose ("%1-%2-%3", loc, _route->id(), p->id()),
wp->set_state (*ui_xml);
}
- wp->marked = true;
-
- /* if the processor already has an existing UI,
- note that so that we don't recreate it
- */
-
void* existing_ui = p->get_ui ();
if (existing_ui) {
wp->use_window (*(reinterpret_cast<Gtk::Window*>(existing_ui)));
}
- _processor_window_info.push_back (wp);
+ p->set_window_proxy (wp);
WM::Manager::instance().register_window (wp);
}
Window *
ProcessorBox::get_processor_ui (boost::shared_ptr<Processor> p) const
{
- list<ProcessorWindowProxy*>::const_iterator i = _processor_window_info.begin ();
- while (i != _processor_window_info.end()) {
- boost::shared_ptr<Processor> t = (*i)->processor().lock ();
- if (t && t == p) {
- return (*i)->get ();
- }
-
- ++i;
+ ProcessorWindowProxy* wp = p->window_proxy();
+ if (wp) {
+ return wp->get ();
}
-
return 0;
}
void
ProcessorBox::set_processor_ui (boost::shared_ptr<Processor> p, Gtk::Window* w)
{
- list<ProcessorWindowProxy*>::iterator i = _processor_window_info.begin ();
-
+ assert (p->window_proxy());
p->set_ui (w);
-
- while (i != _processor_window_info.end()) {
- boost::shared_ptr<Processor> t = (*i)->processor().lock ();
- if (t && t == p) {
- (*i)->use_window (*w);
- return;
- }
-
- ++i;
- }
-
- /* we shouldn't get here, because the ProcessorUIList should always contain
- an entry for each processor.
- */
- assert (false);
+ p->window_proxy()->use_window (*w);
}
void
ProcessorWindowProxy::ProcessorWindowProxy (string const & name, ProcessorBox* box, boost::weak_ptr<Processor> processor)
: WM::ProxyBase (name, string())
- , marked (false)
, _processor_box (box)
, _processor (processor)
, is_custom (false)
, want_custom (false)
- , _valid (true)
{
boost::shared_ptr<Processor> p = _processor.lock ();
if (!p) {
{
delete _window;
_window = 0;
- _valid = false;
+ WM::Manager::instance().remove (this);
/* should be no real reason to do this, since the object that would
send DropReferences is about to be deleted, but lets do it anyway.
*/
return 0;
}
-bool
-ProcessorWindowProxy::valid() const
-{
- return _valid;
-}
-
XMLNode&
ProcessorWindowProxy::get_state () const
{