From 8731f9ed8f0a98c21fbccd9523a2797be8afe2a2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 22 Apr 2015 20:22:35 +0200 Subject: [PATCH] scaleable routing icons & wires --- gtk2_ardour/processor_box.cc | 17 +++++++++++++---- gtk2_ardour/processor_box.h | 6 +----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 092cd5e830..fbb4bbd1b3 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -734,7 +734,8 @@ PluginInsertProcessorEntry::plugin_insert_splitting_changed () _plugin_insert->input_streams().n_audio() < _plugin_insert->natural_input_streams().n_audio() ) { - _routing_icon.set_size_request (-1, 7); + const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.); + _routing_icon.set_size_request (-1, rint(7.0 * scale)); _routing_icon.set_visible(true); _input_icon.show(); } else { @@ -756,6 +757,12 @@ PluginInsertProcessorEntry::hide_things () plugin_insert_splitting_changed (); } +ProcessorEntry::PortIcon::PortIcon(bool input) { + _input = input; + _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); + const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.); + set_size_request (-1, rint(2 * scale)); +} bool ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) @@ -775,6 +782,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); + const double dx = rint(max(2.0, 2. * ARDOUR_UI::config()->get_font_scale () / 102400.)); if (_ports.n_total() > 1) { for (uint32_t i = 0; i < _ports.n_total(); ++i) { if (i < _ports.n_midi()) { @@ -789,7 +797,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_B_FLT(audio_port_color)); } const float x = rintf(width * (.2f + .6f * i / (_ports.n_total() - 1.f))); - cairo_rectangle (cr, x-1, 0, 3, height); + cairo_rectangle (cr, x-dx * .5, 0, 1+dx, height); cairo_fill(cr); } } else if (_ports.n_total() == 1) { @@ -805,7 +813,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev) UINT_RGBA_B_FLT(audio_port_color)); } const float x = rintf(width * .5); - cairo_rectangle (cr, x-1, 0, 3, height); + cairo_rectangle (cr, x-dx * .5, 0, 1+dx, height); cairo_fill(cr); cairo_stroke(cr); } @@ -822,7 +830,8 @@ ProcessorEntry::RoutingIcon::on_expose_event (GdkEventExpose* ev) cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height); cairo_clip (cr); - cairo_set_line_width (cr, 1.0); + const double scale = max(1.0, ARDOUR_UI::config()->get_font_scale () / 102400.); + cairo_set_line_width (cr, scale); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); Gtk::Allocation a = get_allocation(); diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 9622011654..28c9af7d9d 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -210,11 +210,7 @@ private: class PortIcon : public Gtk::DrawingArea { public: - PortIcon(bool input) { - _input = input; - _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1); - set_size_request (-1, 2); - } + PortIcon(bool input); void set_ports(ARDOUR::ChanCount const ports) { _ports = ports; } private: bool on_expose_event (GdkEventExpose *);