redesign toggling of editor/mixer stacking to use Gtkmm2ext::VisibilityTracker
[ardour.git] / libs / gtkmm2ext / utils.cc
index c0c7a88362e83d72f59a82307580d87b4e2bf46b..4bc9113875c04dca7b13823b2d1af29146694586 100644 (file)
 using namespace std;
 
 void
-Gtkmm2ext::init ()
+Gtkmm2ext::init (const char* localedir)
 {
-       // Necessary for gettext
-       (void) bindtextdomain(PACKAGE, LOCALEDIR);
+#ifdef ENABLE_NLS
+       (void) bindtextdomain(PACKAGE, localedir);
+#endif
 }
 
 void
@@ -413,80 +414,76 @@ Gtkmm2ext::rounded_bottom_half_rectangle (Cairo::RefPtr<Cairo::Context> context,
 {
        rounded_bottom_half_rectangle (context->cobj(), x, y, w, h, r);
 }
+void
+Gtkmm2ext::rounded_right_half_rectangle (Cairo::RefPtr<Cairo::Context> context, double x, double y, double w, double h, double r)
+{
+       rounded_right_half_rectangle (context->cobj(), x, y, w, h, r);
+}
 
 void
 Gtkmm2ext::rounded_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
 {
-/*    A****BQ
-      H    C
-      *    *
-      G    D
-      F****E
-*/
-       cairo_move_to (cr, x+r,y); // Move to A
-       cairo_line_to (cr, x+w-r,y); // Straight line to B
-       cairo_curve_to (cr, x+w,y,x+w,y,x+w,y+r); // Curve to C, Control points are both at Q
-       cairo_line_to (cr, x+w,y+h-r); // Move to D
-       cairo_curve_to (cr, x+w,y+h,x+w,y+h,x+w-r,y+h); // Curve to E
-       cairo_line_to (cr, x+r,y+h); // Line to F
-       cairo_curve_to (cr, x,y+h,x,y+h,x,y+h-r); // Curve to G
-       cairo_line_to (cr, x,y+r); // Line to H
-       cairo_curve_to (cr, x,y,x,y,x+r,y); // Curve to A
+       double degrees = M_PI / 180.0;
+
+       cairo_new_sub_path (cr);
+       cairo_arc (cr, x + w - r, y + r, r, -90 * degrees, 0 * degrees);  //tr
+       cairo_arc (cr, x + w - r, y + h - r, r, 0 * degrees, 90 * degrees);  //br
+       cairo_arc (cr, x + r, y + h - r, r, 90 * degrees, 180 * degrees);  //bl
+       cairo_arc (cr, x + r, y + r, r, 180 * degrees, 270 * degrees);  //tl
+       cairo_close_path (cr);
+}
+
+void
+Gtkmm2ext::rounded_right_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
+{
+       double degrees = M_PI / 180.0;
+
+       cairo_new_sub_path (cr);
+       cairo_arc (cr, x + w - r, y + r, r, -90 * degrees, 0 * degrees);  //tr
+       cairo_arc (cr, x + w - r, y + h - r, r, 0 * degrees, 90 * degrees);  //br
+       cairo_line_to (cr, x, y + h); // bl
+       cairo_line_to (cr, x, y); // tl
+       cairo_close_path (cr);
 }
 
 void
 Gtkmm2ext::rounded_top_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
 {
-/*    A****BQ
-      H    C
-      *    *
-      G    D
-      F****E
-*/
-       cairo_move_to (cr, x+r,y); // Move to A
-       cairo_line_to (cr, x+w-r,y); // Straight line to B
-       cairo_curve_to (cr, x+w,y,x+w,y,x+w,y+r); // Curve to C, Control points are both at Q
-       cairo_line_to (cr, x+w,y+h); // Move to E
-       cairo_line_to (cr, x,y+h); // Line to F
-       cairo_line_to (cr, x,y+r); // Line to H
-       cairo_curve_to (cr, x,y,x,y,x+r,y); // Curve to A
+       double degrees = M_PI / 180.0;
+
+       cairo_new_sub_path (cr);
+       cairo_move_to (cr, x+w, y+h);
+       cairo_line_to (cr, x, y+h);
+       cairo_arc (cr, x + r, y + r, r, 180 * degrees, 270 * degrees);  //tl
+       cairo_arc (cr, x + w - r, y + r, r, -90 * degrees, 0 * degrees);  //tr
+       cairo_close_path (cr);
 }
 
 void
 Gtkmm2ext::rounded_bottom_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
 {
-/*    A****BQ
-      H    C
-      *    *
-      G    D
-      F****E
-*/
-       cairo_move_to (cr, x,y); // Move to A
-       cairo_line_to (cr, x+w,y); // Straight line to B
-       cairo_line_to (cr, x+w,y+h-r); // Move to D
-       cairo_curve_to (cr, x+w,y+h,x+w,y+h,x+w-r,y+h); // Curve to E
-       cairo_line_to (cr, x+r,y+h); // Line to F
-       cairo_curve_to (cr, x,y+h,x,y+h,x,y+h-r); // Curve to G
-       cairo_line_to (cr, x,y); // Line to A
+       double degrees = M_PI / 180.0;
+
+       cairo_new_sub_path (cr);
+       cairo_move_to (cr, x, y);
+       cairo_line_to (cr, x+w, y);
+       cairo_arc (cr, x + w - r, y + h - r, r, 0 * degrees, 90 * degrees);  //br
+       cairo_arc (cr, x + r, y + h - r, r, 90 * degrees, 180 * degrees);  //bl
+       cairo_close_path (cr);
 }
 
 
 void
 Gtkmm2ext::rounded_top_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
 {
-/*    A****BQ
-      H    C
-      *    *
-      *    *
-      F****E
-*/
-       cairo_move_to (cr, x+r,y); // Move to A
-       cairo_line_to (cr, x+w-r,y); // Straight line to B
-       cairo_curve_to (cr, x+w,y,x+w,y,x+w,y+r); // Curve to C, Control points are both at Q
-       cairo_line_to (cr, x+w,y+h); // Move to E
-       cairo_line_to (cr, x,y+h); // Line to F
-       cairo_line_to (cr, x,y+r); // Line to H
-       cairo_curve_to (cr, x,y,x,y,x+r,y); // Curve to A
+       double degrees = M_PI / 180.0;
+
+       cairo_new_sub_path (cr);
+       cairo_move_to (cr, x+w, y+h);
+       cairo_line_to (cr, x, y+h);
+       cairo_arc (cr, x + r, y + r, r, 180 * degrees, 270 * degrees);  //tl
+       cairo_arc (cr, x + w - r, y + r, r, -90 * degrees, 0 * degrees);  //tr
+       cairo_close_path (cr);
 }
 
 void