[glide] Text previews now in slide chooser



commit d88b5c9dc0981a991422a8cce613ba802ddffc36
Author: Robert Carr <racarr Valentine localdomain>
Date:   Tue May 25 15:38:43 2010 -0400

    Text previews now in slide chooser

 libglide/glide-theme.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libglide/glide-theme.c b/libglide/glide-theme.c
index d6ba8e4..c00e8d6 100644
--- a/libglide/glide-theme.c
+++ b/libglide/glide-theme.c
@@ -25,6 +25,7 @@
  
 #include "glide-theme.h"
 #include "glide-theme-priv.h"
+#include "glide-cairo-util.h"
 
 #include <gio/gio.h>
 
@@ -351,6 +352,35 @@ glide_theme_get_default_color (GlideTheme *theme, ClutterColor *color)
 }
 
 static void
+glide_theme_preview_text (GlideTheme *theme, cairo_t *cr,
+			  gint width, gint height)
+{
+  PangoLayout *p = pango_cairo_create_layout (cr);
+  PangoFontDescription *d = pango_font_description_from_string (theme->priv->default_fontname);
+  gint lwidth, lheight;
+  
+  pango_layout_set_font_description (p, d);
+  pango_layout_set_text (p, "Double click to edit.", -1);
+  
+  pango_layout_get_pixel_size (p, &lwidth, &lheight);
+  
+  cairo_save (cr);
+  
+  cairo_move_to (cr, width/2.0-(.6*width)/2.0, (height/2.0)-(lheight/2.0)*(.6*width)/lwidth);
+  cairo_scale (cr, (.6*width)/lwidth, (.6*width)/lwidth);
+  
+  glide_cairo_set_clutter_color (cr, &theme->priv->default_color);
+  pango_cairo_show_layout (cr, p);
+  
+  cairo_restore (cr);
+
+  
+  cairo_fill (cr);
+  
+  g_object_unref (G_OBJECT (p));
+}
+
+static void
 glide_theme_preview_background (GlideTheme *theme, cairo_t *cr,
 				gint width, gint height)
 {
@@ -373,4 +403,5 @@ void
 glide_theme_preview (GlideTheme *theme, cairo_t *cr, gint width, gint height)
 {
   glide_theme_preview_background (theme, cr, width, height);
+  glide_theme_preview_text (theme, cr, width, height);
 }



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