From f1a93bc8a15b91be45ac2041d8e9e921f3dc4330 Mon Sep 17 00:00:00 2001 From: derAbgang Date: Thu, 2 Jan 2014 17:13:14 -0500 Subject: [PATCH 01/30] mantis 0005805 --- libs/ardour/session.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 40123e0670..af52163ae9 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1985,7 +1985,7 @@ Session::auto_connect_route (boost::shared_ptr route, ChanCount& existing for (uint32_t i = output_start.get(*t); i < route->n_outputs().get(*t); ++i) { string port; - if ((*t) == DataType::MIDI || Config->get_output_auto_connect() & AutoConnectPhysical) { + if ((*t) == DataType::MIDI && Config->get_output_auto_connect() & AutoConnectPhysical) { port = physoutputs[(out_offset.get(*t) + i) % nphysical_out]; } else if ((*t) == DataType::AUDIO && Config->get_output_auto_connect() & AutoConnectMaster) { /* master bus is audio only */ From 156283936ba81966603e4a1b3e767bc3f5b5b6ae Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Thu, 2 Jan 2014 14:15:18 +0100 Subject: [PATCH 02/30] get rid of const warnings --- libs/clearlooks-newer/clearlooks_rc_style.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/clearlooks-newer/clearlooks_rc_style.c b/libs/clearlooks-newer/clearlooks_rc_style.c index c9a30ff6b4..9f8fbd4945 100644 --- a/libs/clearlooks-newer/clearlooks_rc_style.c +++ b/libs/clearlooks-newer/clearlooks_rc_style.c @@ -306,7 +306,7 @@ clearlooks_gtk2_rc_parse_style (GtkSettings *settings, static guint clearlooks_gtk2_rc_parse_dummy (GtkSettings *settings, GScanner *scanner, - gchar *name) + const gchar *name) { (void) settings; From aa15f90959ed1a20ad47daef87da41bee93c744e Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: Thu, 2 Jan 2014 15:27:15 +0100 Subject: [PATCH 03/30] don't declare hilight variable twice --- libs/clearlooks-newer/clearlooks_draw_glossy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/clearlooks-newer/clearlooks_draw_glossy.c b/libs/clearlooks-newer/clearlooks_draw_glossy.c index 62f17f3f95..a0e250ee64 100644 --- a/libs/clearlooks-newer/clearlooks_draw_glossy.c +++ b/libs/clearlooks-newer/clearlooks_draw_glossy.c @@ -746,7 +746,7 @@ clearlooks_glossy_draw_tab (cairo_t *cr, if (params->active) { - CairoColor shadow, hilight, f1, f2; + CairoColor shadow, f1, f2; pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0, tab->gap_side == CL_GAP_TOP ? height-2 : 1, From a37112bdd760e444d0f923796fab49765b517a2c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 3 Jan 2014 12:19:18 -0500 Subject: [PATCH 04/30] improve clarity of logic parentheses --- libs/ardour/session.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index af52163ae9..115fcd750a 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1985,9 +1985,9 @@ Session::auto_connect_route (boost::shared_ptr route, ChanCount& existing for (uint32_t i = output_start.get(*t); i < route->n_outputs().get(*t); ++i) { string port; - if ((*t) == DataType::MIDI && Config->get_output_auto_connect() & AutoConnectPhysical) { + if ((*t) == DataType::MIDI && (Config->get_output_auto_connect() & AutoConnectPhysical)) { port = physoutputs[(out_offset.get(*t) + i) % nphysical_out]; - } else if ((*t) == DataType::AUDIO && Config->get_output_auto_connect() & AutoConnectMaster) { + } else if ((*t) == DataType::AUDIO && (Config->get_output_auto_connect() & AutoConnectMaster)) { /* master bus is audio only */ if (_master_out && _master_out->n_inputs().get(*t) > 0) { port = _master_out->input()->ports().port(*t, From d85ec4ee173127a18ea68fab55f78c90713dadcf Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 3 Jan 2014 18:36:00 +0100 Subject: [PATCH 05/30] don't split process cycle at end Keep in mind: While this is the correct thing to do, it hides another another bug under the hood, related to _global_port_buffer_offset in MidiPort::flush_buffers. For debugging the latter issue, revert this. --- libs/ardour/session_process.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 18dfbf2f2e..6d8c0f9f70 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -421,7 +421,9 @@ Session::process_with_events (pframes_t nframes) check_declick_out (); } - _engine.split_cycle (this_nframes); + if (nframes > 0) { + _engine.split_cycle (this_nframes); + } /* now handle this event and all others scheduled for the same time */ From 5ef7900ea41cd55a112765d231de48a5b6fa0bc5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 3 Jan 2014 20:24:23 +0100 Subject: [PATCH 06/30] pre-select reasonable-synth as Instrument --- gtk2_ardour/add_route_dialog.cc | 8 +++++++- gtk2_ardour/add_route_dialog.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index e0e5c70798..8837e9f468 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -56,6 +56,7 @@ AddRouteDialog::AddRouteDialog () , configuration_label (_("Configuration:")) , mode_label (_("Track mode:")) , instrument_label (_("Instrument:")) + , reasonable_synth_id(0) { set_name ("AddRouteDialog"); set_modal (true); @@ -82,7 +83,7 @@ AddRouteDialog::AddRouteDialog () build_instrument_list (); instrument_combo.set_model (instrument_list); instrument_combo.pack_start (instrument_list_columns.name); - instrument_combo.set_active (0); + instrument_combo.set_active (reasonable_synth_id); instrument_combo.set_button_sensitivity (Gtk::SENSITIVITY_AUTO); VBox* vbox = manage (new VBox); @@ -587,6 +588,7 @@ AddRouteDialog::build_instrument_list () row[instrument_list_columns.info_ptr] = PluginInfoPtr (); row[instrument_list_columns.name] = _("-none-"); + uint32_t n = 1; for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) { if (manager.get_status (*i) == PluginManager::Hidden) continue; @@ -595,6 +597,10 @@ AddRouteDialog::build_instrument_list () row = *(instrument_list->append()); row[instrument_list_columns.name] = (*i)->name; row[instrument_list_columns.info_ptr] = *i; + if ((*i)->unique_id == "https://community.ardour.org/node/7596") { + reasonable_synth_id = n; + } + n++; } } } diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index 31b746ac76..7cd3307d48 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -122,6 +122,7 @@ class AddRouteDialog : public ArdourDialog InstrumentListColumns instrument_list_columns; void build_instrument_list (); + uint32_t reasonable_synth_id; }; #endif /* __gtk_ardour_add_route_dialog_h__ */ From 52d6cbc1e97a82d2f0537f544150bcee8f4d17f5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 05:29:06 +0100 Subject: [PATCH 07/30] fix PixFader size allocation previously faders in the processor box were only sized correctly after the 2nd iteration: allocate -> request -> allocate --- libs/gtkmm2ext/pixfader.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 0185550259..7007cf0efe 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -54,6 +54,12 @@ PixFader::PixFader (Gtk::Adjustment& adj, int orientation, int fader_length, int adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); + + if (_orien == VERT) { + DrawingArea::set_size_request(girth, span); + } else { + DrawingArea::set_size_request(span, girth); + } } PixFader::~PixFader () From e8e4e677aab030c0aae4eaf1f92cfc8a614defe6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 05:43:20 +0100 Subject: [PATCH 08/30] processor drag box only --- libs/gtkmm2ext/gtkmm2ext/dndvbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index bbfd183c7b..a362f1dbbe 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -296,7 +296,7 @@ private: /* make up an icon for the drag */ _drag_icon = new Gtk::Window (Gtk::WINDOW_POPUP); - Gtk::Allocation a = child->widget().get_allocation (); + Gtk::Allocation a = child->action_widget().get_allocation (); _drag_icon->set_size_request (a.get_width(), a.get_height()); _drag_icon->signal_expose_event().connect (sigc::mem_fun (*this, &DnDVBox::icon_expose)); @@ -326,7 +326,7 @@ private: cairo_t* cr = gdk_cairo_create (_drag_icon->get_window()->gobj ()); - Glib::RefPtr p = _drag_child->widget().get_snapshot(); + Glib::RefPtr p = _drag_child->action_widget().get_snapshot(); gdk_cairo_set_source_pixmap (cr, p->gobj(), 0, 0); cairo_rectangle (cr, 0, 0, w, h); cairo_fill (cr); From 2b5a04d3f48e7f632c778c8bcd705aab10b9dcf5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 05:54:20 +0100 Subject: [PATCH 09/30] continued work on processor-routing visualization major re-design. * change splitting-icon into routing-icon * add it to all processors (not only plugin-inserts) * subscribe to ChanCount configuration changes * add 'wiring' to BlankProcessorEntry pre-fader placeholder * visualize routing for non-matching port-counts currently still wire+color design with #if'ed debug messages and optional #ifdef wires for matching connections. --- gtk2_ardour/processor_box.cc | 294 ++++++++++++++++++++++++++--------- gtk2_ardour/processor_box.h | 63 +++++--- 2 files changed, 264 insertions(+), 93 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 08079f4f91..2e1942f7d3 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -17,6 +17,8 @@ */ +//#define ALWAYS_DISPLAY_WIRES + #ifdef WAF_BUILD #include "gtk2ardour-config.h" #endif @@ -98,6 +100,8 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptractive()); + _button.show (); +#ifdef ALWAYS_DISPLAY_WIRES + _routing_icon.show(); +#endif + _input_icon.show(); + _output_icon.show(); _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context()); _processor->PropertyChanged.connect (name_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context()); + _processor->ConfigurationChanged.connect (config_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_configuration_changed, this, _1, _2), gui_context()); set p = _processor->what_can_be_automated (); for (set::iterator i = p.begin(); i != p.end(); ++i) { @@ -135,6 +149,12 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptrinput_streams()); + _output_icon.set_ports(_processor->output_streams()); + + _routing_icon.set_sources(_processor->input_streams()); + _routing_icon.set_sinks(_processor->output_streams()); + setup_tooltip (); setup_visuals (); } else { @@ -190,14 +210,17 @@ ProcessorEntry::setup_visuals () switch (_position) { case PreFader: _button.set_name ("processor prefader"); + _routing_icon.set_name ("ProcessorPreFader"); break; case Fader: _button.set_name ("processor fader"); + _routing_icon.set_name ("ProcessorFader"); break; case PostFader: _button.set_name ("processor postfader"); + _routing_icon.set_name ("ProcessorPostFader"); break; } } @@ -245,6 +268,24 @@ ProcessorEntry::processor_property_changed (const PropertyChange& what_changed) } } +void +ProcessorEntry::processor_configuration_changed (const ChanCount in, const ChanCount out) +{ +#if 0 // debug, devel information + printf("ProcessorEntry::processor_config_changed %s %d %d\n", + name(Wide).c_str(), + in.n_audio(), out.n_audio()); +#endif + + _input_icon.set_ports(in); + _output_icon.set_ports(out); + _routing_icon.set_sources(in); + _routing_icon.set_sinks(out); + _input_icon.queue_draw(); + _output_icon.queue_draw(); + _routing_icon.queue_draw(); +} + void ProcessorEntry::setup_tooltip () { @@ -593,9 +634,20 @@ ProcessorEntry::Control::state_id () const return string_compose (X_("control %1"), c->id().to_s ()); } -BlankProcessorEntry::BlankProcessorEntry (ProcessorBox* b, Width w) +BlankProcessorEntry::BlankProcessorEntry (ProcessorBox* b, Width w, ChanCount cc) : ProcessorEntry (b, boost::shared_ptr(), w) { +#ifdef ALWAYS_DISPLAY_WIRES + _vbox.pack_start (_routing_icon); + _routing_icon.set_sources(cc); + _routing_icon.set_sinks(cc); + _routing_icon.show(); + setup_visuals (); + _routing_icon.set_size_request (-1, 8); + _vbox.set_size_request (-1, 8); +#else + _vbox.set_size_request (-1, 0); +#endif } PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost::shared_ptr p, Width w) @@ -606,31 +658,74 @@ PluginInsertProcessorEntry::PluginInsertProcessorEntry (ProcessorBox* b, boost:: _splitting_connection, invalidator (*this), boost::bind (&PluginInsertProcessorEntry::plugin_insert_splitting_changed, this), gui_context() ); - _splitting_icon.set_size_request (-1, 12); - - _vbox.pack_start (_splitting_icon); - _vbox.reorder_child (_splitting_icon, 0); - plugin_insert_splitting_changed (); } void PluginInsertProcessorEntry::plugin_insert_splitting_changed () { - _splitting_icon.set_inputs(_plugin_insert->input_streams()); - _splitting_icon.set_outputs(_plugin_insert->output_streams()); +#if 0 // debug, devel information + printf("--%s--\n", _plugin_insert->name().c_str()); + printf("AUDIO src: %d -> in:%d | * cnt %d * | out: %d -> snk: %d\n", + _plugin_insert->input_streams().n_audio(), + _plugin_insert->natural_input_streams().n_audio(), + _plugin_insert->get_count(), + _plugin_insert->natural_output_streams().n_audio(), + _plugin_insert->output_streams().n_audio()); + printf("MIDI src: %d -> in:%d | * cnt %d * | out: %d -> snk: %d\n", + _plugin_insert->input_streams().n_midi(), + _plugin_insert->natural_input_streams().n_midi(), + _plugin_insert->get_count(), + _plugin_insert->natural_output_streams().n_midi(), + _plugin_insert->output_streams().n_midi()); + printf("TOTAL src: %d -> in:%d | * cnt %d * | out: %d -> snk: %d\n", + _plugin_insert->input_streams().n_total(), + _plugin_insert->natural_input_streams().n_total(), + _plugin_insert->get_count(), + _plugin_insert->natural_output_streams().n_total(), + _plugin_insert->output_streams().n_total()); +#endif - if (_plugin_insert->splitting () || ( - _plugin_insert->input_streams().n_midi() == 0 - && _plugin_insert->input_streams().n_audio() < _plugin_insert->output_streams().n_audio() - ) + _output_icon.set_ports(_plugin_insert->output_streams()); + _routing_icon.set_splitting(_plugin_insert->splitting ()); + + ChanCount sources = _plugin_insert->input_streams(); + ChanCount sinks = _plugin_insert->natural_input_streams(); + + /* replicated instances */ + if (!_plugin_insert->splitting () && _plugin_insert->get_count() > 1) { + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + sinks.set(*t, sinks.get(*t) * _plugin_insert->get_count()); + } + } + /* MIDI bypass */ + if (_plugin_insert->natural_output_streams().n_midi() == 0 && + _plugin_insert->output_streams().n_midi() == 1) { + sinks.set(DataType::MIDI, 1); + sources.set(DataType::MIDI, 1); + } + + _input_icon.set_ports(sinks); + _routing_icon.set_sinks(sinks); + _routing_icon.set_sources(sources); + + if (_plugin_insert->splitting () || + _plugin_insert->input_streams().n_audio() < _plugin_insert->natural_input_streams().n_audio() ) { - _splitting_icon.show (); - _splitting_icon.queue_draw(); + _routing_icon.set_size_request (-1, 8); + _routing_icon.show(); } else { - _splitting_icon.hide (); +#ifdef ALWAYS_DISPLAY_WIRES + _routing_icon.set_size_request (-1, 4); +#else + _routing_icon.hide(); +#endif } + + _input_icon.queue_draw(); + _output_icon.queue_draw(); + _routing_icon.queue_draw(); } void @@ -640,28 +735,59 @@ PluginInsertProcessorEntry::hide_things () plugin_insert_splitting_changed (); } -void -PluginInsertProcessorEntry::setup_visuals () + +bool +ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) { - switch (_position) { - case PreFader: - _splitting_icon.set_name ("ProcessorPreFader"); - break; + cairo_t* cr = gdk_cairo_create (get_window()->gobj()); - case Fader: - _splitting_icon.set_name ("ProcessorFader"); - break; + cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); + cairo_clip (cr); - case PostFader: - _splitting_icon.set_name ("ProcessorPostFader"); - break; + cairo_set_line_width (cr, 5.0); + cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); + + 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 ()); + + cairo_rectangle (cr, 0, 0, width, height); + cairo_fill (cr); + + const double y0 = _input ? height-.5 : .5; + + if (_ports.n_total() > 1) { + for (uint32_t i = 0; i < _ports.n_total(); ++i) { + if (i < _ports.n_midi()) { + cairo_set_source_rgb (cr, .8, .3, .3); + } else { + cairo_set_source_rgb (cr, .4, .4, .8); + } + const float x = rintf(width * (.2f + .6f * i / (_ports.n_total() - 1.f))) + .5f; + cairo_move_to (cr, x, y0); + cairo_close_path(cr); + cairo_stroke(cr); + } + } else if (_ports.n_total() == 1) { + if (_ports.n_midi() == 1) { + cairo_set_source_rgb (cr, .8, .3, .3); + } else { + cairo_set_source_rgb (cr, .4, .4, .8); + } + cairo_move_to (cr, rintf(width * .5) + .5f, y0); + cairo_close_path(cr); + cairo_stroke(cr); } - ProcessorEntry::setup_visuals (); + cairo_destroy(cr); + return true; } bool -PluginInsertProcessorEntry::SplittingIcon::on_expose_event (GdkEventExpose* ev) +ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) { cairo_t* cr = gdk_cairo_create (get_window()->gobj()); @@ -684,54 +810,58 @@ 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 ()); - const uint32_t inputs = _inputs.n_audio(); - const uint32_t outputs = _outputs.n_audio(); + const uint32_t sources = _sources.n_total(); + const uint32_t sinks = _sinks.n_total(); - const float si_m = rintf(height * 0.5) + .5f; + /* MIDI */ + cairo_set_source_rgb (cr, .6, .2, .2); + const uint32_t midi_sources = _sources.n_midi(); + const uint32_t midi_sinks = _sinks.n_midi(); - if (inputs == 1) { - const float si_l = rintf(width * 0.2) + .5f; - const float si_c = rintf(width * 0.5) + .5f; - const float si_r = rintf(width * 0.8) + .5f; - - 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_stroke (cr); - - cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT); - - const uint32_t outputs = _outputs.n_audio(); - for (uint32_t i = 2; i < outputs; ++i) { - const float si_b = rintf(width * (.2f + .6f * (i - 1.f) / (outputs - 1.f))) + .5f; - cairo_move_to (cr, si_b, height); - cairo_line_to (cr, si_b, si_m); + if (midi_sources > 0 && midi_sinks > 0 && sinks > 1 && sources > 1) { + for (uint32_t i = 0 ; i < midi_sources; ++i) { + const float si_x = rintf(width * (.2f + .6f * i / (sinks - 1.f))) + .5f; + const float si_x0 = rintf(width * (.2f + .6f * i / (sources - 1.f))) + .5f; + cairo_move_to (cr, si_x, height); + cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); cairo_stroke (cr); } - - cairo_move_to (cr, si_c, si_m); - cairo_line_to (cr, si_c, 0); + } else if (midi_sources == 1 && midi_sinks == 1 && sinks == 1 && sources == 1) { + const float si_x = rintf(width * .5f) + .5f; + cairo_move_to (cr, si_x, height); + cairo_line_to (cr, si_x, 0); cairo_stroke (cr); - } else { - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - for (uint32_t i = 0 ; i < outputs; ++i) { - const float si_x = rintf(width * (.2f + .6f * i / (outputs - 1.f))) + .5f; - if (i < inputs) { - cairo_move_to (cr, si_x, height); - cairo_line_to (cr, si_x, 0); - cairo_stroke (cr); - } else { - cairo_move_to (cr, si_x, si_m); - cairo_line_to (cr, si_x, height); - cairo_stroke (cr); - cairo_move_to (cr, si_x+4, si_m); - cairo_line_to (cr, si_x-4, si_m); - cairo_stroke (cr); - } - } } + /* AUDIO */ + cairo_set_source_rgb (cr, .6, .6, .8); + const uint32_t audio_sources = _sources.n_audio(); + const uint32_t audio_sinks = _sinks.n_audio(); + + if (_splitting) { + assert(audio_sinks > 1); + const float si_x0 = rintf(width * .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); + cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); + cairo_stroke (cr); + } + } else if (audio_sources > 1) { + for (uint32_t i = 0 ; i < audio_sources; ++i) { + const float si_x = rintf(width * (.2f + .6f * (i + midi_sinks) / (sinks - 1.f))) + .5f; + const float si_x0 = rintf(width * (.2f + .6f * (i + midi_sources) / (sources - 1.f))) + .5f; + cairo_move_to (cr, si_x, height); + cairo_curve_to (cr, si_x, 0, si_x0, height, si_x0, 0); + cairo_stroke (cr); + } + } else if (audio_sources == 1 && audio_sinks == 1) { + const float si_x = rintf(width * .5f) + .5f; + cairo_move_to (cr, si_x, height); + cairo_line_to (cr, si_x, 0); + cairo_stroke (cr); + } + cairo_destroy(cr); return true; } @@ -761,7 +891,7 @@ ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function r) _route->PropertyChanged.connect ( _route_connections, invalidator (*this), boost::bind (&ProcessorBox::route_property_changed, this, _1), gui_context() ); +#ifdef ALWAYS_DISPLAY_WIRES + /* update BlankProcessorEntry wire-count */ + _route->io_changed.connect ( + _route_connections, invalidator (*this), boost::bind (&ProcessorBox::io_changed_proxy, this), gui_context () + ); +#endif redisplay_processors (); } @@ -1414,6 +1550,7 @@ ProcessorBox::redisplay_processors () { ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors); bool fader_seen; + ChanCount amp_chan_count; if (no_processor_redisplay) { return; @@ -1425,10 +1562,10 @@ ProcessorBox::redisplay_processors () fader_seen = false; _route->foreach_processor (sigc::bind (sigc::mem_fun (*this, &ProcessorBox::help_count_visible_prefader_processors), - &_visible_prefader_processors, &fader_seen)); + &_visible_prefader_processors, &fader_seen, &_chan_count)); if (_visible_prefader_processors == 0) { // fader only - BlankProcessorEntry* bpe = new BlankProcessorEntry (this, _width); + BlankProcessorEntry* bpe = new BlankProcessorEntry (this, _width, amp_chan_count); processor_display.add_child (bpe); } @@ -1486,6 +1623,12 @@ ProcessorBox::redisplay_processors () setup_entry_positions (); } +void +ProcessorBox::io_changed_proxy () +{ + Glib::signal_idle().connect_once (sigc::mem_fun (*this, &ProcessorBox::redisplay_processors)); +} + /** Add a ProcessorWindowProxy for a processor to our list, if that processor does * not already have one. */ @@ -1552,7 +1695,7 @@ ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr w) } void -ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr p, uint32_t* cnt, bool* amp_seen) +ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr p, uint32_t* cnt, bool* amp_seen, ChanCount *cc) { boost::shared_ptr processor (p.lock ()); @@ -1560,6 +1703,9 @@ ProcessorBox::help_count_visible_prefader_processors (boost::weak_ptr if (boost::dynamic_pointer_cast(processor)) { *amp_seen = true; + for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { + cc->set(*t, processor->input_streams().get(*t)); + } } else { if (!*amp_seen) { (*cnt)++; diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 6aed08d17e..9534488f32 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -150,6 +150,7 @@ private: void led_clicked(); void processor_active_changed (); void processor_property_changed (const PBD::PropertyChange&); + void processor_configuration_changed (const ARDOUR::ChanCount in, const ARDOUR::ChanCount out); std::string name (Width) const; void setup_tooltip (); @@ -159,6 +160,7 @@ private: Gtk::StateType _visual_state; PBD::ScopedConnection active_connection; PBD::ScopedConnection name_connection; + PBD::ScopedConnection config_connection; class Control : public sigc::trackable { public: @@ -204,12 +206,49 @@ private: std::list _controls; void toggle_control_visibility (Control *); + + class PortIcon : public Gtk::DrawingArea { + public: + PortIcon(bool input) { + _input = input; + _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); + set_size_request (-1, 3); + } + void set_ports(ARDOUR::ChanCount const ports) { _ports = ports; } + private: + bool on_expose_event (GdkEventExpose *); + bool _input; + ARDOUR::ChanCount _ports; + }; + + class RoutingIcon : public Gtk::DrawingArea { + public: + RoutingIcon() { + _sources = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); + _sinks = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); + _splitting = false; + set_size_request (-1, 4); + } + void set_sources(ARDOUR::ChanCount const sources) { _sources = sources; } + void set_sinks(ARDOUR::ChanCount const sinks) { _sinks = sinks; } + void set_splitting(const bool splitting) { _splitting = splitting; } + private: + bool on_expose_event (GdkEventExpose *); + ARDOUR::ChanCount _sources; // signals available to feed into the processor(s) + ARDOUR::ChanCount _sinks; // combined number of outputs of the processor + bool _splitting; + }; + +protected: + RoutingIcon _routing_icon; + PortIcon _input_icon; + PortIcon _output_icon; }; class BlankProcessorEntry : public ProcessorEntry { public: - BlankProcessorEntry (ProcessorBox *, Width w); + BlankProcessorEntry (ProcessorBox *, Width w, ARDOUR::ChanCount cc); }; class PluginInsertProcessorEntry : public ProcessorEntry @@ -220,25 +259,9 @@ public: void hide_things (); private: - void setup_visuals (); void plugin_insert_splitting_changed (); - - class SplittingIcon : public Gtk::DrawingArea { - public: - SplittingIcon() { - _inputs = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); - _outputs = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 2); - } - void set_inputs(ARDOUR::ChanCount const inputs) { _inputs = inputs; } - void set_outputs(ARDOUR::ChanCount const outputs) { _outputs = outputs; } - private: - bool on_expose_event (GdkEventExpose *); - ARDOUR::ChanCount _inputs; - ARDOUR::ChanCount _outputs; - }; - boost::shared_ptr _plugin_insert; - SplittingIcon _splitting_icon; + PBD::ScopedConnection _splitting_connection; }; @@ -349,11 +372,12 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD bool processor_button_release_event (GdkEventButton *, ProcessorEntry *); void redisplay_processors (); void add_processor_to_display (boost::weak_ptr); - void help_count_visible_prefader_processors (boost::weak_ptr, uint32_t*, bool*); + void help_count_visible_prefader_processors (boost::weak_ptr, uint32_t*, bool*, ARDOUR::ChanCount*); void reordered (); void report_failed_reorder (); void route_processors_changed (ARDOUR::RouteProcessorChange); void processor_menu_unmapped (); + void io_changed_proxy (); void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*); void compute_processor_sort_keys (); @@ -434,6 +458,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD void mixer_strip_delivery_changed (boost::weak_ptr); XMLNode* entry_gui_object_state (ProcessorEntry *); + PBD::ScopedConnection amp_config_connection; }; #endif /* __ardour_gtk_processor_box__ */ From 2a734a2d8505e62142300c7ef89f79a80acf0a51 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 15:05:45 +0100 Subject: [PATCH 10/30] fix ardour-button text bleed --- gtk2_ardour/ardour_button.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc index 3f118921d6..f1f45e90c3 100644 --- a/gtk2_ardour/ardour_button.cc +++ b/gtk2_ardour/ardour_button.cc @@ -302,6 +302,9 @@ ArdourButton::render (cairo_t* cr) } if ( ((_elements & Text)==Text) && !_text.empty()) { + cairo_save (cr); + cairo_rectangle (cr, 2, 1, get_width()-4, get_height()-2); + cairo_clip(cr); cairo_new_path (cr); cairo_set_source_rgba (cr, text_r, text_g, text_b, text_a); @@ -342,7 +345,7 @@ ArdourButton::render (cairo_t* cr) /* use old center'ed layout for follow up items - until rotation/aligment code is completed */ cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0); } - + cairo_restore (cr); } if (((_elements & Indicator)==Indicator)) { @@ -472,6 +475,7 @@ ArdourButton::on_size_request (Gtk::Requisition* req) req->height = _text_height + ypad; } } + req->width += _corner_radius; } void From c4de1048226cdadfb4640f4f3a6d022d66428121 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 18:48:28 +0100 Subject: [PATCH 11/30] fix tooltip on processor button widget --- gtk2_ardour/processor_box.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 2e1942f7d3..e40b8e9bf9 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -546,6 +546,7 @@ ProcessorEntry::Control::button_clicked () c->set_value (n ? 0 : 1); _button.set_active (!n); + set_tooltip (); } void From 8c7cae0d8f98c17ac082da580a8467e436d9dd5a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 19:03:47 +0100 Subject: [PATCH 12/30] add padding to in-line plugin controls --- gtk2_ardour/processor_box.cc | 5 +++-- gtk2_ardour/processor_box.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index e40b8e9bf9..bbadd775e5 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -449,12 +449,13 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string , _name (n) { _slider.set_controllable (c); + box.set_padding(0, 0, 4, 4); if (c->toggled()) { _button.set_text (_name); _button.set_led_left (true); _button.set_name ("processor control button"); - box.pack_start (_button); + box.add (_button); _button.show (); _button.signal_clicked.connect (sigc::mem_fun (*this, &Control::button_clicked)); @@ -466,7 +467,7 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string _slider.set_name ("PluginSlider"); _slider.set_text (_name); - box.pack_start (_slider); + box.add (_slider); _slider.show (); double const lo = c->internal_to_interface (c->lower ()); diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 9534488f32..f0ff6bf34e 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -180,7 +180,7 @@ private: return _name; } - Gtk::VBox box; + Gtk::Alignment box; private: void slider_adjusted (); From f3d858f9dfa8e708cefb445c3825bca8304e897b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 4 Jan 2014 19:28:15 +0100 Subject: [PATCH 13/30] fix detection of aubio library - aubio-0.4 breaks API and ABI. ideally we'll want atleast_version='0.3.2', max_version='0.3.9' (or anything before 0.4.0) for the time being. but waf/autowaf don't seem to allow that. aubio-0.3.2 was the previous minimum requirement and is also the last release of audio-0.3.X, so we're good with exact_version for now. --- libs/ardour/wscript | 2 +- libs/vamp-plugins/wscript | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 2a3c998ca1..dbc0335ecd 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -244,7 +244,7 @@ def configure(conf): 'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0) autowaf.configure(conf) autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', - atleast_version='0.3.2') + exact_version='0.3.2') autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML') autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF', atleast_version='0.4.0') diff --git a/libs/vamp-plugins/wscript b/libs/vamp-plugins/wscript index 46198cc18e..9568e96367 100644 --- a/libs/vamp-plugins/wscript +++ b/libs/vamp-plugins/wscript @@ -26,7 +26,8 @@ def configure(conf): conf.load('compiler_cxx') autowaf.configure(conf) autowaf.check_pkg(conf, 'fftw3f', uselib_store='FFTW3F', mandatory=True) - autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', mandatory=False) + autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', mandatory=False, + exact_version='0.3.2') conf.write_config_header('libvampplugins-config.h', remove=False) def build(bld): From d89573f8e73ee7f0c28a6b9a8b8ba0f8e78c69aa Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 5 Jan 2014 13:07:31 +0100 Subject: [PATCH 14/30] update slider rendering & set style for faders * render background -- outside of rounded corners * visually align unity-location with fader at 0. * sharp lines (no more AA blur) x/y offset, radius --- gtk2_ardour/ardour3_styles.rc.in | 23 +++++++++++++- gtk2_ardour/ardour3_widget_list.rc | 11 +++++-- gtk2_ardour/processor_box.cc | 2 +- gtk2_ardour/return_ui.cc | 4 +-- gtk2_ardour/send_ui.cc | 4 +-- gtk2_ardour/sfdb_ui.cc | 2 +- libs/ardour/lv2_plugin.cc | 10 +++++- libs/gtkmm2ext/pixfader.cc | 50 +++++++++++++++++------------- 8 files changed, 74 insertions(+), 32 deletions(-) diff --git a/gtk2_ardour/ardour3_styles.rc.in b/gtk2_ardour/ardour3_styles.rc.in index 8b5b5e4c99..188c57b547 100644 --- a/gtk2_ardour/ardour3_styles.rc.in +++ b/gtk2_ardour/ardour3_styles.rc.in @@ -731,6 +731,19 @@ style "midi_track_base" = "default" bg[SELECTED] = @@COLPREFIX@_bg } +style "audio_track_fader" = "gain_fader" +{ + bg[PRELIGHT] = @@COLPREFIX@_audio_track +} +style "audio_bus_fader" = "gain_fader" +{ + bg[PRELIGHT] = @@COLPREFIX@_audio_bus +} +style "midi_track_fader" = "gain_fader" +{ + bg[PRELIGHT] = @@COLPREFIX@_midi_track +} + style "audio_track_metrics" = "audio_track_base" { font_name = "@FONT_TINY@" @@ -815,7 +828,9 @@ style "plugin_slider" bg[ACTIVE] = shade (0.6, @@COLPREFIX@_lightest) bg[INSENSITIVE] = shade (0.6, @@COLPREFIX@_lightest) bg[SELECTED] = shade (0.6, @@COLPREFIX@_lightest) - bg[PRELIGHT] = shade (0.6, @@COLPREFIX@_lightest) + + # outer round-corner-background (pixslider does its own hover prelight) + bg[PRELIGHT] = @@COLPREFIX@_bg # the numeric display @@ -826,6 +841,12 @@ style "plugin_slider" text[PRELIGHT] = @@COLPREFIX@_text } +style "processor_control_slider" = "plugin_slider" +{ + bg[PRELIGHT] = @@COLPREFIX@_darkest + bg[NORMAL] = @@COLPREFIX@_bg +} + style "track_list_display" = "small_bold_text" { text[NORMAL] = @@COLPREFIX@_text diff --git a/gtk2_ardour/ardour3_widget_list.rc b/gtk2_ardour/ardour3_widget_list.rc index 0e7075cef4..d9fdd2eafa 100644 --- a/gtk2_ardour/ardour3_widget_list.rc +++ b/gtk2_ardour/ardour3_widget_list.rc @@ -186,9 +186,13 @@ widget "*AudioMidiTrackMetricsInactive" style:highest "midi_track_metrics_inacti widget "*TimeAxisViewControlsBaseUnselected" style:highest "audio_track_base" widget "*AudioTrackControlsBaseUnselected" style:highest "audio_track_base" widget "*MidiTrackControlsBaseUnselected" style:highest "midi_track_base" -widget "*AudioTrackFader" style:highest "gain_fader" -widget "*MidiTrackFader" style:highest "gain_fader" -widget "*AudioBusFader" style:highest "gain_fader" + +widget "*SendUIFader" style:highest "plugin_slider" +widget "*ReturnUIFader" style:highest "plugin_slider" + +widget "*AudioTrackFader" style:highest "audio_track_fader" +widget "*MidiTrackFader" style:highest "midi_track_fader" +widget "*AudioBusFader" style:highest "audio_bus_fader" widget "*BusControlsBaseUnselected" style:highest "audio_bus_base" widget "*TrackSeparator" style:highest "track_separator" @@ -234,6 +238,7 @@ widget "*MotionControllerValue*" style:highest "small_entry" widget "*ParameterValueDisplay" style:highest "medium_bold_entry" widget "*PluginUIClickBox" style:highest "medium_bold_entry" widget "*PluginUIClickBox*" style:highest "medium_bold_entry" +widget "*ProcessorControlSlider" style:highest "processor_control_slider" widget "*PluginSlider" style:highest "plugin_slider" widget "*GainFader" style:highest "plugin_slider" widget "*MixerTrackCommentArea" style:highest "option_entry" diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index bbadd775e5..81bb5e42c3 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -464,7 +464,7 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string } else { - _slider.set_name ("PluginSlider"); + _slider.set_name ("ProcessorControlSlider"); _slider.set_text (_name); box.add (_slider); diff --git a/gtk2_ardour/return_ui.cc b/gtk2_ardour/return_ui.cc index 592fff0a0e..92846af469 100644 --- a/gtk2_ardour/return_ui.cc +++ b/gtk2_ardour/return_ui.cc @@ -42,7 +42,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr r, Session* s _gpm.set_controls (boost::shared_ptr(), r->meter(), r->amp()); _hbox.pack_start (_gpm, true, true); - set_name ("ReturnUIFrame"); + set_name (X_("ReturnUIFrame")); _vbox.set_spacing (5); _vbox.set_border_width (5); @@ -61,7 +61,7 @@ ReturnUI::ReturnUI (Gtk::Window* parent, boost::shared_ptr r, Session* s _return->input()->changed.connect (input_change_connection, invalidator (*this), boost::bind (&ReturnUI::ins_changed, this, _1, _2), gui_context()); _gpm.setup_meters (); - _gpm.set_fader_name ("ReturnUIFrame"); + _gpm.set_fader_name (X_("ReturnUIFader")); // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect (sigc::mem_fun (*this, &ReturnUI::update)); fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun (*this, &ReturnUI::fast_update)); diff --git a/gtk2_ardour/send_ui.cc b/gtk2_ardour/send_ui.cc index 1bc4e031f0..1fead73084 100644 --- a/gtk2_ardour/send_ui.cc +++ b/gtk2_ardour/send_ui.cc @@ -46,7 +46,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr s, Session* session _gpm.set_controls (boost::shared_ptr(), s->meter(), s->amp()); _hbox.pack_start (_gpm, true, true); - set_name ("SendUIFrame"); + set_name (X_("SendUIFrame")); _vbox.set_spacing (5); _vbox.set_border_width (5); @@ -77,7 +77,7 @@ SendUI::SendUI (Gtk::Window* parent, boost::shared_ptr s, Session* session _panners.setup_pan (); _gpm.setup_meters (); - _gpm.set_fader_name ("SendUIFrame"); + _gpm.set_fader_name (X_("SendUIFader")); // screen_update_connection = ARDOUR_UI::instance()->RapidScreenUpdate.connect ( // sigc::mem_fun (*this, &SendUI::update)); diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 4944ef41a0..9b3d78e86d 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -707,7 +707,7 @@ SoundFileBrowser::add_gain_meter () boost::shared_ptr r = _session->the_auditioner (); gm->set_controls (r, r->shared_peak_meter(), r->amp()); - gm->set_fader_name (X_("AudioTrackFader")); + gm->set_fader_name (X_("GainFader")); meter_packer.set_border_width (12); meter_packer.pack_start (*gm, false, true); diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index a1d9de1e53..36b77e6d59 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -1022,8 +1022,10 @@ LV2Plugin::load_preset(PresetRecord r) LilvWorld* world = _world.world; LilvNode* pset = lilv_new_uri(world, r.uri.c_str()); LilvState* state = lilv_state_new_from_world(world, _uri_map.urid_map(), pset); + printf("LV2Plugin::load_preset %s\n", r.uri.c_str()); if (state) { + printf("found state\n"); lilv_state_restore(state, _impl->instance, set_port_value, this, 0, NULL); lilv_state_free(state); } @@ -1093,7 +1095,13 @@ LV2Plugin::do_save_preset(string name) lilv_state_free(state); - return Glib::filename_to_uri(Glib::build_filename(bundle, file_name)); + std::string uri = Glib::filename_to_uri(Glib::build_filename(bundle, file_name)); + LilvNode *node = lilv_new_uri(_world.world, uri.c_str()); + lilv_world_load_bundle(_world.world, node); + lilv_node_free(node); + printf("LV2Plugin::do_save_preset %s\n", uri.c_str()); + + return uri; } void diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 7007cf0efe..22ed0dbb27 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -33,7 +33,9 @@ using namespace Gtk; using namespace std; #define CORNER_RADIUS 4 -#define FADER_RESERVE (2*CORNER_RADIUS) +#define CORNER_SIZE 2 +#define CORNER_OFFSET 1 +#define FADER_RESERVE 5 std::list PixFader::_patterns; @@ -111,11 +113,8 @@ PixFader::create_patterns () cairo_surface_t* surface; cairo_t* tc = 0; - float radius = CORNER_RADIUS; - double w = get_width(); - - if (w <= 1 || get_height() <= 1) { + if (get_width() <= 1 || get_height() <= 1) { return; } @@ -142,13 +141,12 @@ PixFader::create_patterns () /* paint lower shade */ - w -= 2.0; - - shade_pattern = cairo_pattern_create_linear (0.0, 0.0, w, 0); + shade_pattern = cairo_pattern_create_linear (0.0, 0.0, get_width() - 2 - CORNER_OFFSET , 0); cairo_pattern_add_color_stop_rgba (shade_pattern, 0, fr*0.8,fg*0.8,fb*0.8, 1.0); cairo_pattern_add_color_stop_rgba (shade_pattern, 1, fr*0.6,fg*0.6,fb*0.6, 1.0); cairo_set_source (tc, shade_pattern); - Gtkmm2ext::rounded_top_half_rectangle (tc, 1.0, get_height(), w, get_height(), radius-1.5); + Gtkmm2ext::rounded_top_half_rectangle (tc, CORNER_OFFSET, get_height() + CORNER_OFFSET, + get_width() - CORNER_SIZE, get_height(), CORNER_RADIUS); cairo_fill (tc); cairo_pattern_destroy (shade_pattern); @@ -175,7 +173,8 @@ PixFader::create_patterns () cairo_pattern_add_color_stop_rgba (shade_pattern, 0, fr*0.8,fg*0.8,fb*0.8, 1.0); cairo_pattern_add_color_stop_rgba (shade_pattern, 1, fr*0.6,fg*0.6,fb*0.6, 1.0); cairo_set_source (tc, shade_pattern); - Gtkmm2ext::rounded_right_half_rectangle (tc, 0, 1, get_width(), get_height() - 2.0, radius-1.5); + Gtkmm2ext::rounded_right_half_rectangle (tc, CORNER_OFFSET, CORNER_OFFSET, + get_width() - CORNER_OFFSET, get_height() - CORNER_SIZE, CORNER_RADIUS); cairo_fill (tc); cairo_pattern_destroy (shade_pattern); @@ -218,7 +217,6 @@ PixFader::on_expose_event (GdkEventExpose* ev) cairo_set_source_rgb (cr, br, bg, bb); cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_fill (cr); - return true; } @@ -229,18 +227,27 @@ PixFader::on_expose_event (GdkEventExpose* ev) float w = get_width(); float h = get_height(); + Gdk::Color c = get_style()->get_bg (Gtk::STATE_PRELIGHT); + cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cairo_rectangle (cr, 0, 0, w, h); + cairo_fill(cr); + + cairo_set_line_width (cr, 1); + cairo_set_source_rgba (cr, 0, 0, 0, 1.0); + cairo_matrix_t matrix; + Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS); + cairo_stroke_preserve(cr); if (_orien == VERT) { - if (ds > h - FADER_RESERVE) { - ds = h - FADER_RESERVE; + if (ds > h - FADER_RESERVE - CORNER_OFFSET) { + ds = h - FADER_RESERVE - CORNER_OFFSET; } cairo_set_source (cr, pattern); cairo_matrix_init_translate (&matrix, 0, (h - ds)); cairo_pattern_set_matrix (pattern, &matrix); - Gtkmm2ext::rounded_rectangle (cr, 0, 0, w, h, CORNER_RADIUS-1.5); cairo_fill (cr); } else { @@ -264,7 +271,6 @@ PixFader::on_expose_event (GdkEventExpose* ev) cairo_set_source (cr, pattern); cairo_matrix_init_translate (&matrix, w - ds, 0); cairo_pattern_set_matrix (pattern, &matrix); - Gtkmm2ext::rounded_rectangle (cr, 0, 0, w, h, CORNER_RADIUS-1.5); cairo_fill (cr); } @@ -276,14 +282,14 @@ PixFader::on_expose_event (GdkEventExpose* ev) context->set_source_rgba (c.get_red_p()*1.5, c.get_green_p()*1.5, c.get_blue_p()*1.5, 0.85); if ( _orien == VERT) { if (unity_loc < h ) { - context->move_to (1.5, unity_loc + .5); - context->line_to (girth - 1.5, unity_loc + .5); + context->move_to (1.5, unity_loc + CORNER_OFFSET + .5); + context->line_to (girth - 1.5, unity_loc + CORNER_OFFSET + .5); context->stroke (); } } else { if ( unity_loc < w ){ - context->move_to (unity_loc + .5, 1.5); - context->line_to (unity_loc + .5, girth - 1.5); + context->move_to (unity_loc - CORNER_OFFSET + .5, 1.5); + context->line_to (unity_loc - CORNER_OFFSET + .5, girth - 1.5); context->stroke (); } } @@ -299,11 +305,11 @@ PixFader::on_expose_event (GdkEventExpose* ev) } if (!get_sensitive()) { - Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3); + Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS); cairo_set_source_rgba (cr, 0.505, 0.517, 0.525, 0.4); cairo_fill (cr); } else if (_hovering) { - Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3); + Gtkmm2ext::rounded_rectangle (cr, CORNER_OFFSET, CORNER_OFFSET, w-CORNER_SIZE, h-CORNER_SIZE, CORNER_RADIUS); cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.1); cairo_fill (cr); } @@ -620,6 +626,7 @@ PixFader::on_state_changed (Gtk::StateType old_state) { Widget::on_state_changed (old_state); create_patterns (); + queue_draw (); } void @@ -636,4 +643,5 @@ PixFader::on_style_changed (const Glib::RefPtr&) */ pattern = 0; + queue_draw (); } From 7eca9919713e02b5429372aa9f14aceec785b9de Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 5 Jan 2014 13:09:08 +0100 Subject: [PATCH 15/30] fix fader default-value line position --- libs/gtkmm2ext/pixfader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 22ed0dbb27..ef1dffc1dd 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -558,9 +558,9 @@ void PixFader::update_unity_position () { if (_orien == VERT) { - unity_loc = (int) rint (span * (1 - (default_value / (adjustment.get_upper() - adjustment.get_lower())))) - 1; + unity_loc = (int) rint (span * (1 - ((default_value - adjustment.get_lower()) / (adjustment.get_upper() - adjustment.get_lower())))) - 1; } else { - unity_loc = (int) rint (default_value * span / (adjustment.get_upper() - adjustment.get_lower())); + unity_loc = (int) rint ((default_value - adjustment.get_lower()) * span / (adjustment.get_upper() - adjustment.get_lower())); } queue_draw (); From 34d8c762c810017b4440c347f1ad9550ccf843f1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 5 Jan 2014 13:13:28 +0100 Subject: [PATCH 16/30] update processor control toggle button style --- gtk2_ardour/ardour3_styles.rc.in | 4 ++++ gtk2_ardour/ardour3_ui_default.conf | 12 ++++++------ gtk2_ardour/ardour3_widget_list.rc | 1 + gtk2_ardour/processor_box.cc | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/ardour3_styles.rc.in b/gtk2_ardour/ardour3_styles.rc.in index 188c57b547..8314e9dc36 100644 --- a/gtk2_ardour/ardour3_styles.rc.in +++ b/gtk2_ardour/ardour3_styles.rc.in @@ -841,6 +841,10 @@ style "plugin_slider" text[PRELIGHT] = @@COLPREFIX@_text } +style "processor_control_button" = "very_small_text" +{ +} + style "processor_control_slider" = "plugin_slider" { bg[PRELIGHT] = @@COLPREFIX@_darkest diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index 7c33944dbe..21bda9c83c 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -186,12 +186,12 @@