]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkthemingengine.c
Updated Kazakh translation
[~andy/gtk] / gtk / gtkthemingengine.c
index 70254e3b5552cd73b4a6bc405acc3dfd14659722..e5012a9318c730bdd72f37f31dd89fe435744300 100644 (file)
@@ -781,7 +781,7 @@ gtk_theming_engine_get_border_color (GtkThemingEngine *engine,
 
 /**
  * gtk_theming_engine_get_border:
- * @engine: a #GtkthemingEngine
+ * @engine: a #GtkThemingEngine
  * @state: state to retrieve the border for
  * @border: (out): return value for the border settings
  *
@@ -804,7 +804,7 @@ gtk_theming_engine_get_border (GtkThemingEngine *engine,
 
 /**
  * gtk_theming_engine_get_padding:
- * @engine: a #GtkthemingEngine
+ * @engine: a #GtkThemingEngine
  * @state: state to retrieve the padding for
  * @padding: (out): return value for the padding settings
  *
@@ -1050,10 +1050,8 @@ gtk_theming_engine_render_check (GtkThemingEngine *engine,
   gtk_theming_engine_get_color (engine, flags, &fg_color);
   gtk_theming_engine_get_background_color (engine, flags, &bg_color);
   gtk_theming_engine_get_border (engine, flags, &border);
-
-  gtk_theming_engine_get (engine, flags,
-                          "border-style", &border_style,
-                          NULL);
+  border_style = _gtk_css_border_style_value_get 
+    (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
 
   border_width = MIN (MIN (border.top, border.bottom),
                       MIN (border.left, border.right));
@@ -1106,22 +1104,14 @@ gtk_theming_engine_render_check (GtkThemingEngine *engine,
     }
   else
     {
-      gdouble progress;
-      gboolean running;
-
-      running = gtk_theming_engine_state_is_running (engine, GTK_STATE_ACTIVE, &progress);
-
-      if ((flags & GTK_STATE_FLAG_ACTIVE) || running)
+      if (flags & GTK_STATE_FLAG_ACTIVE)
         {
-          if (!running)
-            progress = 1;
-
           cairo_translate (cr,
                            x + pad, y + pad);
 
           cairo_scale (cr, interior_size / 7., interior_size / 7.);
 
-          cairo_rectangle (cr, 0, 0, 7 * progress, 7);
+          cairo_rectangle (cr, 0, 0, 7, 7);
           cairo_clip (cr);
 
           cairo_move_to  (cr, 7.0, 0.0);
@@ -1183,10 +1173,8 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
   gtk_theming_engine_get_color (engine, flags, &fg_color);
   gtk_theming_engine_get_background_color (engine, flags, &bg_color);
   gtk_theming_engine_get_border (engine, flags, &border);
-
-  gtk_theming_engine_get (engine, flags,
-                          "border-style", &border_style,
-                          NULL);
+  border_style = _gtk_css_border_style_value_get 
+    (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
 
   exterior_size = MIN (width, height);
   border_width = MIN (MIN (border.top, border.bottom),
@@ -1748,12 +1736,8 @@ render_frame_internal (GtkThemingEngine *engine,
   GtkStateFlags state;
   GtkBorderStyle border_style[4];
   GtkRoundedBox border_box;
-  gdouble progress;
-  gboolean running;
   GtkBorder border;
-  GdkRGBA *alloc_colors[4];
   GdkRGBA colors[4];
-  guint i;
 
   state = gtk_theming_engine_get_state (engine);
 
@@ -1764,57 +1748,15 @@ render_frame_internal (GtkThemingEngine *engine,
     _gtk_border_image_render (&border_image, &border, cr, x, y, width, height);
   else
     {
-      gtk_theming_engine_get (engine, state,
-                              "border-top-style", &border_style[0],
-                              "border-right-style", &border_style[1],
-                              "border-bottom-style", &border_style[2],
-                              "border-left-style", &border_style[3],
-                              "border-top-color", &alloc_colors[0],
-                              "border-right-color", &alloc_colors[1],
-                              "border-bottom-color", &alloc_colors[2],
-                              "border-left-color", &alloc_colors[3],
-                              NULL);
-
-      running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
-
-      if (running)
-        {
-          GtkStateFlags other_state;
-          GdkRGBA *other_colors[4];
+      border_style[0] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
+      border_style[1] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
+      border_style[2] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
+      border_style[3] = _gtk_css_border_style_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
 
-          if (state & GTK_STATE_FLAG_PRELIGHT)
-            {
-              other_state = state & ~(GTK_STATE_FLAG_PRELIGHT);
-              progress = 1 - progress;
-            }
-          else
-            other_state = state | GTK_STATE_FLAG_PRELIGHT;
-
-          gtk_theming_engine_get (engine, other_state,
-                                  "border-top-color", &other_colors[0],
-                                  "border-right-color", &other_colors[1],
-                                  "border-bottom-color", &other_colors[2],
-                                  "border-left-color", &other_colors[3],
-                                  NULL);
-
-          for (i = 0; i < 4; i++)
-            {
-              colors[i].red = CLAMP (alloc_colors[i]->red + ((other_colors[i]->red - alloc_colors[i]->red) * progress), 0, 1);
-              colors[i].green = CLAMP (alloc_colors[i]->green + ((other_colors[i]->green - alloc_colors[i]->green) * progress), 0, 1);
-              colors[i].blue = CLAMP (alloc_colors[i]->blue + ((other_colors[i]->blue - alloc_colors[i]->blue) * progress), 0, 1);
-              colors[i].alpha = CLAMP (alloc_colors[i]->alpha + ((other_colors[i]->alpha - alloc_colors[i]->alpha) * progress), 0, 1);
-              gdk_rgba_free (other_colors[i]);
-              gdk_rgba_free (alloc_colors[i]);
-            }
-        }
-      else
-        {
-          for (i = 0; i < 4; i++)
-            {
-              colors[i] = *alloc_colors[i];
-              gdk_rgba_free (alloc_colors[i]);
-            }
-        }
+      colors[0] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
+      colors[1] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
+      colors[2] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
+      colors[3] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
 
       _gtk_rounded_box_init_rect (&border_box, x, y, width, height);
       _gtk_rounded_box_apply_border_radius_for_engine (&border_box, engine, junction);
@@ -1882,7 +1824,7 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
   double x_double, y_double;
   gdouble angle;
   gint line_width;
-  gboolean running, is_rtl;
+  gboolean is_rtl;
   gdouble progress;
 
   cairo_save (cr);
@@ -1891,12 +1833,9 @@ gtk_theming_engine_render_expander (GtkThemingEngine *engine,
   gtk_theming_engine_get_color (engine, flags, &fg_color);
   gtk_theming_engine_get_border_color (engine, flags, &outline_color);
 
-  running = gtk_theming_engine_state_is_running (engine, GTK_STATE_ACTIVE, &progress);
   is_rtl = (gtk_theming_engine_get_direction (engine) == GTK_TEXT_DIR_RTL);
   line_width = 1;
-
-  if (!running)
-    progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
+  progress = (flags & GTK_STATE_FLAG_ACTIVE) ? 1 : 0;
 
   if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_HORIZONTAL))
     {
@@ -2103,36 +2042,11 @@ gtk_theming_engine_render_layout (GtkThemingEngine *engine,
 {
   GdkRGBA fg_color;
   GtkStateFlags flags;
-  gdouble progress;
-  gboolean running;
 
   cairo_save (cr);
   flags = gtk_theming_engine_get_state (engine);
   gtk_theming_engine_get_color (engine, flags, &fg_color);
 
-  running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
-
-  if (running)
-    {
-      GtkStateFlags other_flags;
-      GdkRGBA other_fg;
-
-      if (flags & GTK_STATE_FLAG_PRELIGHT)
-        {
-          other_flags = flags & ~(GTK_STATE_FLAG_PRELIGHT);
-          progress = 1 - progress;
-        }
-      else
-        other_flags = flags | GTK_STATE_FLAG_PRELIGHT;
-
-      gtk_theming_engine_get_color (engine, other_flags, &other_fg);
-
-      fg_color.red = CLAMP (fg_color.red + ((other_fg.red - fg_color.red) * progress), 0, 1);
-      fg_color.green = CLAMP (fg_color.green + ((other_fg.green - fg_color.green) * progress), 0, 1);
-      fg_color.blue = CLAMP (fg_color.blue + ((other_fg.blue - fg_color.blue) * progress), 0, 1);
-      fg_color.alpha = CLAMP (fg_color.alpha + ((other_fg.alpha - fg_color.alpha) * progress), 0, 1);
-    }
-
   prepare_context_for_layout (cr, x, y, layout);
 
   _gtk_css_shadows_value_paint_layout (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_TEXT_SHADOW),
@@ -2347,6 +2261,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
   GtkJunctionSides sides;
   GtkThemingBackground bg;
   gint xx, yy;
+  gboolean has_image;
 
   cairo_save (cr);
   flags = gtk_theming_engine_get_state (engine);
@@ -2359,6 +2274,7 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
   color_shade (&bg_color, 1.3, &lighter);
 
   _gtk_theming_background_init (&bg, engine, x, y, width, height, sides);
+  has_image = _gtk_theming_background_has_background_image (&bg);
   _gtk_theming_background_render (&bg, cr);
 
   gtk_theming_engine_render_frame (engine, cr, x, y, width, height);
@@ -2612,12 +2528,15 @@ gtk_theming_engine_render_handle (GtkThemingEngine *engine,
     }
   else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PANE_SEPARATOR))
     {
-      if (width > height)
-        for (xx = x + width / 2 - 15; xx <= x + width / 2 + 15; xx += 5)
-          render_dot (cr, &lighter, &darker, xx, y + height / 2 - 1, 3);
-      else
-        for (yy = y + height / 2 - 15; yy <= y + height / 2 + 15; yy += 5)
-          render_dot (cr, &lighter, &darker, x + width / 2 - 1, yy, 3);
+      if (!has_image)
+        {
+          if (width > height)
+            for (xx = x + width / 2 - 15; xx <= x + width / 2 + 15; xx += 5)
+              render_dot (cr, &lighter, &darker, xx, y + height / 2 - 1, 3);
+          else
+            for (yy = y + height / 2 - 15; yy <= y + height / 2 + 15; yy += 5)
+              render_dot (cr, &lighter, &darker, x + width / 2 - 1, yy, 3);
+        }
     }
   else
     {
@@ -2694,14 +2613,9 @@ render_spinner (GtkThemingEngine *engine,
 {
   GtkStateFlags state;
   GdkRGBA color;
-  gdouble progress;
   gdouble radius;
 
   state = gtk_theming_engine_get_state (engine);
-
-  if (!gtk_theming_engine_state_is_running (engine, GTK_STATE_ACTIVE, &progress))
-    progress = -1;
-
   radius = MIN (width / 2, height / 2);
 
   gtk_theming_engine_get_color (engine, state, &color);
@@ -2712,11 +2626,11 @@ render_spinner (GtkThemingEngine *engine,
   _gtk_css_shadows_value_paint_spinner (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_SHADOW),
                                         cr,
                                         radius,
-                                        progress);
+                                        -1);
 
   _gtk_theming_engine_paint_spinner (cr,
                                      radius,
-                                     progress,
+                                     -1,
                                      &color);
 
   cairo_restore (cr);