update german translation
[ardour.git] / libs / gtkmm2ext / ardour_icon.cc
index 4db86b86b786672280f379dd697e545d9506f689..6a7cabe82934e1665fed1d8c2dd2cf8ad4706f66 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include <math.h> // M_PI
+#include <assert.h>
 #include <algorithm> // std:min
 #include "gtkmm2ext/ardour_icon.h"
 
@@ -137,18 +138,22 @@ static void icon_tool_range (cairo_t *cr, const int width, const int height)
        const double x  = width * .5;
        const double y  = height * .5;
        const double wh = std::min (x, y) * .55;
-       const double lw = ceil (wh / 6.0); // line width
+       const double lw = rint (wh / 6.0); // line width
        const double ar = wh * .6; // arrow
-       const double ym = rint (y - wh * .1) + .5; // arrow-horizontal; slightly to the top, on a px
 
-       const double x0 = rint(x - wh); // left arrow tip
-       const double x1 = rint(x + wh); // right arrow tip
+       const double bw = ceil (wh) - .5;
+       const double y0 = ceil (y);
+       const double ym = rint (y0 - wh * .1) + .5; // arrow-horizontal; slightly to the top, on a px
+       const double x0 = rint (x) - bw; // left arrow tip
+       const double x1 = rint (x) + bw; // right arrow tip
 
        // left and right box
-       cairo_rectangle (cr, x0 - lw, y - wh, 2 * lw,  2 * wh);
-       VECTORICONSTROKEFILL(1.0);
-       cairo_rectangle (cr, x1 - lw, y - wh, 2 * lw,  2 * wh);
-       VECTORICONSTROKEFILL(1.0);
+       cairo_move_to (cr, x0, y0 - bw);
+       cairo_line_to (cr, x0, y0 + bw);
+       VECTORICONSTROKEOUTLINE(lw, 0xffffffff);
+       cairo_move_to (cr, x1, y0 - bw);
+       cairo_line_to (cr, x1, y0 + bw);
+       VECTORICONSTROKEOUTLINE(lw, 0xffffffff);
 
        // arrows
        cairo_move_to (cr, x0 + ar, ym - ar);
@@ -165,10 +170,17 @@ static void icon_tool_range (cairo_t *cr, const int width, const int height)
        VECTORICONSTROKEOUTLINE(lw, 0xffffffff);
 
        cairo_set_source_rgba (cr, 1, 1, 1, 1.0);
-       cairo_rectangle (cr, x0 - lw, y - wh, 2 * lw,  2 * wh);
-       cairo_fill (cr);
-       cairo_rectangle (cr, x1 - lw, y - wh, 2 * lw,  2 * wh);
-       cairo_fill (cr);
+       cairo_set_line_width (cr, lw);
+
+       cairo_move_to (cr, x0, y0 - bw);
+       cairo_line_to (cr, x0, y0 + bw);
+       cairo_stroke (cr);
+
+       cairo_move_to (cr, x1, y0 - bw);
+       cairo_line_to (cr, x1, y0 + bw);
+       cairo_stroke (cr);
+
+
 }
 
 /** Grab/Object tool - 6x8em "hand", with 'em' wide index finger. */
@@ -267,11 +279,13 @@ static void icon_tool_stretch (cairo_t *cr, const int width, const int height)
        const double y  = height * .5;
        const double wh = std::min (x, y) * .55;
 
-       const double lw = wh / 6.0;
-       const double x0 = x + lw + 0.5;
+       const double y0 = ceil (y);
+       const double bw = rint (wh);
+       const double lw = rint (wh / 3.0) / 2.0;
+       const double x0 = rint (x + lw) + .5;
 
        // box indication region
-       cairo_rectangle (cr, x - wh, y - wh, lw + wh,  2 * wh);
+       cairo_rectangle (cr, x0 - lw - bw - .5, y0 - bw, lw + bw, 2 * bw);
        VECTORICONSTROKEFILL (0.75);
 
        cairo_set_line_width (cr, 1.0);
@@ -415,7 +429,7 @@ static void icon_tool_draw (cairo_t *cr, const int width, const int height)
        cairo_line_to (cr, EM_POINT(-6.0, 5.66));
        cairo_line_to (cr, EM_POINT(-4.1, 4.9));
        cairo_close_path (cr);
-       cairo_set_source_rgba (cr, 0, 0, 0, 1.0);
+       cairo_set_source_rgba (cr, 0, 0, 0, 0.7);
        cairo_set_line_width (cr, em);
        cairo_stroke_preserve (cr);
        cairo_fill (cr);
@@ -508,10 +522,15 @@ static void icon_rec_enable (cairo_t *cr, const int width, const int height, con
        const double y = height * .5;
        const double r = std::min (x, y) * .55;
        cairo_arc (cr, x, y, r, 0, 2 * M_PI);
-       if (state == Gtkmm2ext::ExplicitActive)
-               cairo_set_source_rgba (cr, 0.95, 0.10, 0.10, 1.0);
-       else
-               cairo_set_source_rgba (cr, 0.95, 0.44, 0.44, 1.0); // #f46f6f
+       if (state == Gtkmm2ext::ExplicitActive) {
+               cairo_set_source_rgba (cr, 1.0, .1, .1, 1.0);
+       }
+       else if (state == Gtkmm2ext::ImplicitActive) {
+               cairo_set_source_rgba (cr, .9, .3, .3, 1.0);
+       }
+       else {
+               cairo_set_source_rgba (cr, .4, .3, .3, 1.0);
+       }
        cairo_fill_preserve (cr);
        cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8); // outline
        cairo_set_line_width (cr, 1);
@@ -529,9 +548,13 @@ static void icon_rec_tape (cairo_t *cr, const int width, const int height, const
 
        cairo_arc (cr, 0, 0, r, 0, 2 * M_PI);
        if (state == Gtkmm2ext::ExplicitActive) {
-               cairo_set_source_rgba (cr, .95, .1, .1, 1.);
-       } else {
-               cairo_set_source_rgba (cr, .95, .44, .44, 1.); // #f46f6f
+               cairo_set_source_rgba (cr, 1.0, .1, .1, 1.0);
+       }
+       else if (state == Gtkmm2ext::ImplicitActive) {
+               cairo_set_source_rgba (cr, .9, .3, .3, 1.0);
+       }
+       else {
+               cairo_set_source_rgba (cr, .4, .3, .3, 1.0);
        }
        cairo_fill_preserve (cr);
        cairo_set_source_rgba (cr, .0, .0, .0, .5);
@@ -566,10 +589,15 @@ static void icon_rec_tape (cairo_t *cr, const int width, const int height, const
        cairo_restore (cr);
 
        cairo_arc (cr, 0, 0, r * .3, 0, 2 * M_PI);
-       if (state == Gtkmm2ext::ExplicitActive)
-               cairo_set_source_rgba (cr, .95, .1, .1, 1.);
-       else
-               cairo_set_source_rgba (cr, .95, .44, .44, 1.); // #f46f6f
+       if (state == Gtkmm2ext::ExplicitActive) {
+               cairo_set_source_rgba (cr, 1.0, .1, .1, 1.0);
+       }
+       else if (state == Gtkmm2ext::ImplicitActive) {
+               cairo_set_source_rgba (cr, .9, .3, .3, 1.0);
+       }
+       else {
+               cairo_set_source_rgba (cr, .4, .3, .3, 1.0);
+       }
        cairo_fill (cr);
        cairo_set_source_rgba (cr, .0, .0, .0, 1.0);
        cairo_arc (cr, 0, 0, r *.15, 0, 2 * M_PI); // hole in the middle
@@ -835,7 +863,7 @@ static void icon_close_cross (cairo_t *cr, const int width, const int height, co
        const double y = height * .5;
        const double o = .5 + std::min (x, y) * .4;
        ardour_icon_set_source_rgba (cr, fg_color);
-       cairo_set_line_width (cr, 1);
+       cairo_set_line_width (cr, 1.0);
        cairo_move_to (cr, x-o, y-o);
        cairo_line_to (cr, x+o, y+o);
        cairo_move_to (cr, x+o, y-o);
@@ -884,15 +912,15 @@ static void icon_strip_width (cairo_t *cr, const int width, const int height, co
        const double x1 = width   * .8;
 
        const double y0 = height  * .25;
-       const double y1= height   * .75;
+       const double y1 = height  * .75;
 
-       const double ym= height   * .5;
+       const double ym = height  * .5;
 
        // arrow
-       const double xa0= height  * .39;
-       const double xa1= height  * .61;
-       const double ya0= height  * .35;
-       const double ya1= height  * .65;
+       const double xa0= width  * .39;
+       const double xa1= width  * .61;
+       const double ya0= height * .35;
+       const double ya1= height * .65;
 
        ardour_icon_set_source_rgba (cr, fg_color);
        cairo_set_line_width (cr, 1);
@@ -963,6 +991,10 @@ Gtkmm2ext::ArdourIcon::render (cairo_t *cr,
        bool rv = true;
        cairo_save (cr);
 
+       if (width < 6 || height < 6) {
+               return false;
+       }
+
        switch (icon) {
                case TransportStop:
                        icon_transport_stop (cr, width, height);