Layering - the return of "later is higher".
[ardour.git] / gtk2_ardour / stereo_panner.cc
index 3245a97e9aa98b494753a78bd70d17f9db78dec5..ab057c91476ab90d8afee3d4c416232d27e09253 100644 (file)
@@ -53,11 +53,6 @@ using namespace Gtk;
 using namespace Gtkmm2ext;
 using namespace ARDOUR_UI_UTILS;
 
-static const int pos_box_size = 8;
-static const int lr_box_size = 15;
-static const int step_down = 10;
-static const int top_step = 2;
-
 StereoPanner::ColorScheme StereoPanner::colors[3];
 bool StereoPanner::have_colors = false;
 
@@ -150,13 +145,18 @@ StereoPanner::on_expose_event (GdkEventExpose*)
        const double pos = position_control->get_value (); /* 0..1 */
        const double swidth = width_control->get_value (); /* -1..+1 */
        const double fswidth = fabs (swidth);
-       const double corner_radius = 5.0;
        uint32_t o, f, t, b, r;
        State state;
 
        width = get_width();
        height = get_height ();
 
+       const int step_down = rint(height / 3.5);
+       const double corner_radius = 5.0 * ARDOUR_UI::ui_scale;
+       const int lr_box_size = height - 2 * step_down;
+       const int pos_box_size = (int)(rint(step_down * .8)) | 1;
+       const int top_step = step_down - pos_box_size;
+
        if (swidth == 0.0) {
                state = Mono;
        } else if (swidth < 0.0) {
@@ -246,9 +246,9 @@ StereoPanner::on_expose_event (GdkEventExpose*)
                /* add text */
                context->set_source_rgba (UINT_RGBA_R_FLT(t), UINT_RGBA_G_FLT(t), UINT_RGBA_B_FLT(t), UINT_RGBA_A_FLT(t));
                if (swidth < 0.0) {
-                       layout->set_text (_("R"));
+                       layout->set_text (S_("Panner|R"));
                } else {
-                       layout->set_text (_("L"));
+                       layout->set_text (S_("Panner|L"));
                }
                layout->get_pixel_size(tw, th);
                context->move_to (rint(left - tw/2), rint(lr_box_size + step_down - th/2));
@@ -268,12 +268,12 @@ StereoPanner::on_expose_event (GdkEventExpose*)
        context->set_source_rgba (UINT_RGBA_R_FLT(t), UINT_RGBA_G_FLT(t), UINT_RGBA_B_FLT(t), UINT_RGBA_A_FLT(t));
 
        if (state == Mono) {
-               layout->set_text (_("M"));
+               layout->set_text (S_("Panner|M"));
        } else {
                if (swidth < 0.0) {
-                       layout->set_text (_("L"));
+                       layout->set_text (S_("Panner|L"));
                } else {
-                       layout->set_text (_("R"));
+                       layout->set_text (S_("Panner|R"));
                }
        }
        layout->get_pixel_size(tw, th);
@@ -412,6 +412,7 @@ StereoPanner::on_button_press_event (GdkEventButton* ev)
                        double pos = position_control->get_value (); /* 0..1 */
                        double swidth = width_control->get_value (); /* -1..+1 */
                        double fswidth = fabs (swidth);
+                       const int lr_box_size = get_height() - 2 * rint(get_height() / 3.5);
                        int usable_width = get_width() - lr_box_size;
                        double center = (lr_box_size/2.0) + (usable_width * pos);
                        int left = lrint (center - (fswidth * usable_width / 2.0)); // center of leftmost box
@@ -529,6 +530,7 @@ StereoPanner::on_motion_notify_event (GdkEventMotion* ev)
                return false;
        }
 
+       const int lr_box_size = get_height() - 2 * rint(get_height() / 3.5);
        int usable_width = get_width() - lr_box_size;
        double delta = (ev->x - last_drag_x) / (double) usable_width;
        double current_width = width_control->get_value ();