add vector rendition of nudge icons.
[ardour.git] / gtk2_ardour / processor_box.cc
index 0119cfceebdcd2ae6c308bb63b2478b4aa81710c..71435fe9e4f437843766e59aa06a67440dea9c8e 100644 (file)
 #include "gtk2ardour-config.h"
 #endif
 
-#ifdef COMPILER_MSVC
-#define rintf(x) round((x) + 0.5)
-#endif
-
 #include <cmath>
 #include <iostream>
 #include <set>
@@ -49,6 +45,7 @@
 #include "ardour/audioengine.h"
 #include "ardour/internal_return.h"
 #include "ardour/internal_send.h"
+#include "ardour/meter.h"
 #include "ardour/panner_shell.h"
 #include "ardour/plugin_insert.h"
 #include "ardour/pannable.h"
@@ -120,6 +117,9 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
        _button.signal_led_clicked.connect (sigc::mem_fun (*this, &ProcessorEntry::led_clicked));
        _button.set_text (name (_width));
 
+       if (boost::dynamic_pointer_cast<PeakMeter> (_processor)) {
+               _button.set_elements(ArdourButton::Element(_button.elements() & ~ArdourButton::Indicator));
+       }
        if (_processor) {
 
                _vbox.pack_start (_routing_icon);
@@ -493,7 +493,7 @@ ProcessorEntry::toggle_panner_link ()
 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, boost::shared_ptr<PBD::Controllable>(), 0, 13)
+       , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, max(13.f, rintf(13.f * ARDOUR_UI::ui_scale)))
        , _slider_persistant_tooltip (&_slider)
        , _button (ArdourButton::led_default_elements)
        , _ignore_ui_adjustment (false)
@@ -734,7 +734,7 @@ 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);
+               _routing_icon.set_size_request (-1, std::max (7.f, rintf(7.f * ARDOUR_UI::ui_scale)));
                _routing_icon.set_visible(true);
                _input_icon.show();
        } else {
@@ -756,6 +756,11 @@ PluginInsertProcessorEntry::hide_things ()
        plugin_insert_splitting_changed ();
 }
 
+ProcessorEntry::PortIcon::PortIcon(bool input) {
+       _input = input;
+       _ports = ARDOUR::ChanCount(ARDOUR::DataType::AUDIO, 1);
+       set_size_request (-1, std::max (2.f, rintf(2.f * ARDOUR_UI::ui_scale)));
+}
 
 bool
 ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
@@ -775,6 +780,7 @@ ProcessorEntry::PortIcon::on_expose_event (GdkEventExpose* ev)
        cairo_rectangle (cr, 0, 0, width, height);
        cairo_fill (cr);
 
+       const double dx = rint(max(2., 2. * ARDOUR_UI::ui_scale));
        if (_ports.n_total() > 1) {
                for (uint32_t i = 0; i < _ports.n_total(); ++i) {
                        if (i < _ports.n_midi()) {
@@ -789,7 +795,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 +811,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 +828,7 @@ 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);
+       cairo_set_line_width (cr, max (1.f, ARDOUR_UI::ui_scale));
        cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
        Gtk::Allocation a = get_allocation();
@@ -1309,7 +1315,9 @@ ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry*
                if (_session->engine().connected()) {
                        /* XXX giving an error message here is hard, because we may be in the midst of a button press */
 
-                       if (!one_processor_can_be_edited ()) return true;
+                       if (!one_processor_can_be_edited ()) {
+                               return true;
+                       }
 
                        if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) {
                                generic_edit_processor (processor);