[gtk+] win32: Remove GtkWin32ThemePart



commit d021ed7c5e3d3a266224f02c3d537f833524541c
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jan 3 03:21:21 2012 +0100

    win32: Remove GtkWin32ThemePart
    
    Its job is done by GtkCssImage now.

 gtk/gtkcssstylefuncs.c     |    5 -
 gtk/gtkwin32theme.c        |  301 --------------------------------------------
 gtk/gtkwin32themeprivate.h |   14 --
 3 files changed, 0 insertions(+), 320 deletions(-)
---
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index c179179..af1ad5c 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -798,11 +798,6 @@ pattern_value_parse (GtkCssParser *parser,
     }
   else if (_gtk_css_parser_begins_with (parser, '-'))
     {
-      int res;
-      res = _gtk_win32_theme_part_parse (parser, base, value);
-      if (res >= 0)
-	return res > 0;
-      /* < 0 => continue */
       g_value_unset (value);
       g_value_init (value, GTK_TYPE_GRADIENT);
       return gradient_value_parse (parser, base, value);
diff --git a/gtk/gtkwin32theme.c b/gtk/gtkwin32theme.c
index 398ff3e..fd894ef 100644
--- a/gtk/gtkwin32theme.c
+++ b/gtk/gtkwin32theme.c
@@ -172,11 +172,6 @@ _gtk_win32_lookup_htheme_by_classname (const char *class)
 
 #else
 
-static void
-_gtk_win32_theme_init (void)
-{
-}
-
 HTHEME
 _gtk_win32_lookup_htheme_by_classname (const char *class)
 {
@@ -185,247 +180,6 @@ _gtk_win32_lookup_htheme_by_classname (const char *class)
 
 #endif /* G_OS_WIN32 */
 
-G_DEFINE_BOXED_TYPE_WITH_CODE (GtkWin32ThemePart, _gtk_win32_theme_part,
-			       _gtk_win32_theme_part_ref, _gtk_win32_theme_part_unref, 
-			       _gtk_win32_theme_init() )
-
-struct _GtkWin32ThemePart {
-  HTHEME theme;
-  int part;
-  int state;
-
-  double over_alpha;
-  int part2;
-  int state2;
-
-  gint margins[4];
-
-  gint ref_count;
-};
-
-GtkWin32ThemePart *
-_gtk_win32_theme_part_new (const char *class, 
-			   int xp_part, int state, 
-			   int xp_part2, int state2, 
-			   double over_alpha,
-			   gint margins[4])
-{
-  GtkWin32ThemePart *part;
-  int i;
-
-  part = g_slice_new0 (GtkWin32ThemePart);
-  part->ref_count = 1;
-
-  part->theme = _gtk_win32_lookup_htheme_by_classname (class);
-  part->part = xp_part;
-  part->state = state;
-  part->part2 = xp_part2;
-  part->state2 = state2;
-  part->over_alpha = over_alpha;
-  for (i = 0; i < 4; i++)
-    part->margins[i] = margins[i];
-
-  return part;
-}
-
-GtkWin32ThemePart *
-_gtk_win32_theme_part_ref (GtkWin32ThemePart *part)
-{
-  g_return_val_if_fail (part != NULL, NULL);
-
-  part->ref_count++;
-
-  return part;
-}
-
-void
-_gtk_win32_theme_part_unref (GtkWin32ThemePart *part)
-{
-  g_return_if_fail (part != NULL);
-
-  part->ref_count--;
-
-  if (part->ref_count == 0)
-    {
-      g_slice_free (GtkWin32ThemePart, part);
-    }
-}
-
-int
-_gtk_win32_theme_part_parse (GtkCssParser *parser, 
-			     GFile *base, 
-			     GValue *value)
-{
-  char *class;
-  int xp_part, state, xp_part2, state2;
-  double over_alpha;
-  GtkWin32ThemePart *theme_part;
-  gint i, margins[4];
-
-  if (!_gtk_css_parser_try (parser, "-gtk-win32-theme-part", TRUE))
-    {
-      return -1;
-    }
-  
-  g_value_unset (value);
-  g_value_init (value, GTK_TYPE_WIN32_THEME_PART);
-
-  if (!_gtk_css_parser_try (parser, "(", TRUE))
-    {
-      _gtk_css_parser_error (parser,
-                             "Expected '(' after '-gtk-win32-theme-part'");
-      return 0;
-    }
-  
-  class = _gtk_css_parser_try_name (parser, TRUE);
-  if (class == NULL)
-    {
-      _gtk_css_parser_error (parser,
-                             "Expected name as first argument to  '-gtk-win32-theme-part'");
-      return 0;
-    }
-
-  if (! _gtk_css_parser_try (parser, ",", TRUE))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser,
-			     "Expected ','");
-      return 0;
-    }
-
-  if (!_gtk_css_parser_try_int (parser, &xp_part))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser, "Expected a valid integer value");
-      return 0;
-    }
-
-  if (!_gtk_css_parser_try_int (parser, &state))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser, "Expected a valid integer value");
-      return 0;
-    }
-
-
-  margins[0] = margins[1] = margins[2] = margins[3] = 0;
-  over_alpha = 1.0;
-  xp_part2 = -1;
-  state2 = -1;
-
-  while (TRUE)
-    {
-      if ( _gtk_css_parser_try (parser, ",", TRUE))
-	{
-	  if ( _gtk_css_parser_try (parser, "over", TRUE))
-	    {
-	      if (!_gtk_css_parser_try (parser, "(", TRUE))
-		{
-		  _gtk_css_parser_error (parser,
-					 "Expected '(' after 'over'");
-		  return 0;
-		}
-
-	      if (!_gtk_css_parser_try_int (parser, &xp_part2))
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser, "Expected a valid integer value");
-		  return 0;
-		}
-
-	      if (!_gtk_css_parser_try_int (parser, &state2))
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser, "Expected a valid integer value");
-		  return 0;
-		}
-
-	      if ( _gtk_css_parser_try (parser, ",", TRUE))
-		{
-		  if (!_gtk_css_parser_try_double (parser, &over_alpha))
-		    {
-		      g_free (class);
-		      _gtk_css_parser_error (parser, "Expected a valid double value");
-		      return 0;
-		    }
-		}
-
-	      if (!_gtk_css_parser_try (parser, ")", TRUE))
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser,
-					 "Expected ')' at end of 'over'");
-		  return 0;
-		}
-	    }
-	  else if ( _gtk_css_parser_try (parser, "margins", TRUE))
-	    {
-	      if (!_gtk_css_parser_try (parser, "(", TRUE))
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser,
-					 "Expected '(' after 'margins'");
-		  return 0;
-		}
-
-	      for (i = 0; i < 4; i++)
-		{
-		  if (!_gtk_css_parser_try_int (parser, &margins[i]))
-		    break;
-		}
-	      
-	      if (i == 0)
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser, "Expected valid margins");
-		  return 0;
-		}
-
-	      if (i == 1)
-		margins[1] = margins[0];
-	      if (i <= 2)
-		margins[2] = margins[1];
-	      if (i <= 3)
-		margins[3] = margins[2];
-	      
-	      if (!_gtk_css_parser_try (parser, ")", TRUE))
-		{
-		  g_free (class);
-		  _gtk_css_parser_error (parser,
-					 "Expected ')' at end of 'margins'");
-		  return 0;
-		}
-	    }
-	  else
-	    {
-	      _gtk_css_parser_error (parser,
-				     "Expected identifier");
-	      return 0;
-	    }
-	}
-      else
-	break; /* no comma, break loop */
-    }
-
-  if (!_gtk_css_parser_try (parser, ")", TRUE))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser,
-			     "Expected ')'");
-      return 0;
-    }
-  
-  theme_part = _gtk_win32_theme_part_new (class, 
-					  xp_part, state, 
-					  xp_part2, state2,
-					  over_alpha,
-					  margins);
-  g_free (class);
-  
-  g_value_take_boxed (value, theme_part);
-  return 1;
-}
-
 cairo_surface_t *
 _gtk_win32_theme_part_create_surface (HTHEME theme,
                                       int    xp_part,
@@ -469,61 +223,6 @@ _gtk_win32_theme_part_create_surface (HTHEME theme,
   return surface;
 }
 
-cairo_pattern_t *
-_gtk_win32_theme_part_render  (GtkWin32ThemePart  *part,
-			       int                 width,
-			       int                 height)
-{
-  cairo_surface_t *surface, *surface2, *image;
-  cairo_pattern_t *pattern;
-  cairo_t *cr;
-  cairo_matrix_t matrix;
-  cairo_user_data_key_t key;
-
-  surface = _gtk_win32_theme_part_create_surface (part->theme, part->part, part->state, part->margins,
-						  width, height);
-  
-  if (part->state2 >= 0)
-    {
-      surface2 = _gtk_win32_theme_part_create_surface (part->theme, part->part2, part->state2, part->margins,
-						       width, height);
-
-      cr = cairo_create (surface);
-
-      pattern = cairo_pattern_create_for_surface (surface2);
-      cairo_set_source (cr, pattern);
-      cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-      cairo_paint_with_alpha (cr, part->over_alpha);
-      
-      cairo_destroy (cr);
-      cairo_pattern_destroy (pattern);
-
-      cairo_surface_destroy (surface2);
-    }
-
-#ifdef G_OS_WIN32
-  /* We need to return an image surface, as that is what the code expects in order
-     to get the size */
-  image = cairo_win32_surface_get_image (surface);
-#else
-  image = surface;
-#endif
-  pattern = cairo_pattern_create_for_surface (cairo_surface_reference (image));
-
-  cairo_matrix_init_scale (&matrix,
-			   width,
-			   height);
-  cairo_pattern_set_matrix (pattern, &matrix);
-
-  /* We can't immediately destroy the surface, because that would free the data
-     the image surface refers too. Instead we destroy it with the pattern. */
-  cairo_pattern_set_user_data (pattern,
-			       &key,
-			       surface, (cairo_destroy_func_t) cairo_surface_destroy);
-
-  return pattern;
-}
-
 int
 _gtk_win32_theme_int_parse (GtkCssParser      *parser,
 			    GFile             *base,
diff --git a/gtk/gtkwin32themeprivate.h b/gtk/gtkwin32themeprivate.h
index c347987..fb20fbc 100644
--- a/gtk/gtkwin32themeprivate.h
+++ b/gtk/gtkwin32themeprivate.h
@@ -40,10 +40,6 @@ G_BEGIN_DECLS
 
 #define GTK_WIN32_THEME_SYMBOLIC_COLOR_NAME "-gtk-win32-color"
 
-typedef struct _GtkWin32ThemePart GtkWin32ThemePart;
-
-#define GTK_TYPE_WIN32_THEME_PART (_gtk_win32_theme_part_get_type ())
-
 HTHEME             _gtk_win32_lookup_htheme_by_classname (const char  *classname);
 cairo_surface_t *  _gtk_win32_theme_part_create_surface  (HTHEME       theme,
                                                           int          xp_part,
@@ -52,16 +48,6 @@ cairo_surface_t *  _gtk_win32_theme_part_create_surface  (HTHEME       theme,
                                                           int          width,
                                                           int          height);
 
-GType              _gtk_win32_theme_part_get_type  (void) G_GNUC_CONST;
-
-GtkWin32ThemePart *_gtk_win32_theme_part_ref       (GtkWin32ThemePart *part);
-void               _gtk_win32_theme_part_unref     (GtkWin32ThemePart *part);
-int                _gtk_win32_theme_part_parse     (GtkCssParser      *parser, 
-						    GFile             *base, 
-						    GValue            *value);
-cairo_pattern_t   *_gtk_win32_theme_part_render   (GtkWin32ThemePart  *part,
-						   int                 width,
-						   int                 height);
 int                _gtk_win32_theme_int_parse     (GtkCssParser      *parser,
 						   GFile             *base,
 						   int               *value);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]