gimp r25241 - in trunk: . app/display
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25241 - in trunk: . app/display
- Date: Wed, 26 Mar 2008 13:49:27 +0000 (GMT)
Author: mitch
Date: Wed Mar 26 13:49:27 2008
New Revision: 25241
URL: http://svn.gnome.org/viewvc/gimp?rev=25241&view=rev
Log:
2008-03-26 Michael Natterer <mitch gimp org>
* app/display/gimpcanvas.[ch]: improve wilber scaling and remove
the drop zone layout.
* app/display/gimpdisplayshell.c: add a tooltip instead.
Modified:
trunk/ChangeLog
trunk/app/display/gimpcanvas.c
trunk/app/display/gimpcanvas.h
trunk/app/display/gimpdisplayshell.c
Modified: trunk/app/display/gimpcanvas.c
==============================================================================
--- trunk/app/display/gimpcanvas.c (original)
+++ trunk/app/display/gimpcanvas.c Wed Mar 26 13:49:27 2008
@@ -263,12 +263,6 @@
canvas->layout = NULL;
}
- if (canvas->drop_zone_layout)
- {
- g_object_unref (canvas->drop_zone_layout);
- canvas->drop_zone_layout = NULL;
- }
-
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
@@ -286,12 +280,6 @@
g_object_unref (canvas->layout);
canvas->layout = NULL;
}
-
- if (canvas->drop_zone_layout)
- {
- g_object_unref (canvas->drop_zone_layout);
- canvas->drop_zone_layout = NULL;
- }
}
/* Returns: %TRUE if the XOR color is not white */
@@ -839,74 +827,50 @@
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (canvas);
- GdkColor *color = &widget->style->fg[widget->state];
+ GdkPixbuf *wilber;
+ gint wilber_width;
+ gint wilber_height;
+ gint wilber_x;
+ gint wilber_y;
gint width;
gint height;
+ gint side;
gdouble factor;
- gdouble opacity;
- if (! canvas->drop_zone_layout)
- {
- canvas->drop_zone_layout = gtk_widget_create_pango_layout (widget,
- _("Drag images here"));
- gimp_pango_layout_set_weight (canvas->drop_zone_layout,
- PANGO_WEIGHT_BOLD);
- }
+ wilber = gtk_widget_render_icon (widget,
+ GIMP_STOCK_WILBER,
+ GTK_ICON_SIZE_DIALOG,
+ NULL);
+
+ wilber_width = gdk_pixbuf_get_width (wilber) / 2;
+ wilber_height = gdk_pixbuf_get_height (wilber) / 2;
+
+ side = MIN (MIN (widget->allocation.width,
+ widget->allocation.height),
+ MAX (widget->allocation.width,
+ widget->allocation.height) / 2);
- pango_layout_get_pixel_size (canvas->drop_zone_layout, &width, &height);
+ width = MAX (wilber_width, side);
+ height = MAX (wilber_height, side);
- factor = 4.0 / 5.0 * MIN ((gdouble) widget->allocation.width / width,
- (gdouble) widget->allocation.height / height);
+ factor = MIN ((gdouble) width / wilber_width,
+ (gdouble) height / wilber_height);
cairo_scale (cr, factor, factor);
- cairo_move_to (cr,
- (widget->allocation.width / factor - width) / 2.0,
- (widget->allocation.height / factor - height) / 2.0);
-
- opacity = CLAMP (0.5 / factor, 0.1, 1.0);
-
- cairo_set_source_rgba (cr,
- color->red / 65535.0,
- color->green / 65535.0,
- color->blue / 65535.0,
- opacity);
-
- pango_cairo_show_layout (cr, canvas->drop_zone_layout);
-
- cairo_scale (cr, 1.0 / factor, 1.0 / factor);
-
- {
- GdkPixbuf *pixbuf = gtk_widget_render_icon (GTK_WIDGET (canvas),
- GIMP_STOCK_WILBER,
- GTK_ICON_SIZE_DIALOG,
- NULL);
- gint wilber_width = gdk_pixbuf_get_width (pixbuf) / 2;
- gint wilber_height = gdk_pixbuf_get_height (pixbuf) / 2;
- gint wilber_x;
- gint wilber_y;
-
- width = MAX (wilber_width, widget->allocation.width);
- height = MAX (wilber_height, widget->allocation.height);
-
- factor = 0.5 * MIN ((gdouble) width / wilber_width,
- (gdouble) height / wilber_height);
-
- cairo_scale (cr, factor, factor);
-
- /* magic factors depend on the image used, everything else is
- * generic
- */
- wilber_x = -wilber_width * 0.6;
- wilber_y = widget->allocation.height / factor - wilber_height * 1.1;
-
- gdk_cairo_set_source_pixbuf (cr, pixbuf, wilber_x, wilber_y);
- cairo_rectangle (cr,
- wilber_x, wilber_y,
- wilber_width * 2, wilber_height * 2);
- cairo_fill (cr);
- g_object_unref (pixbuf);
- }
+ /* magic factors depend on the image used, everything else is
+ * generic
+ */
+ wilber_x = -wilber_width * 0.6;
+ wilber_y = widget->allocation.height / factor - wilber_height * 1.1;
+
+ gdk_cairo_set_source_pixbuf (cr, wilber, wilber_x, wilber_y);
+ cairo_rectangle (cr,
+ wilber_x, wilber_y,
+ wilber_width * 2, wilber_height * 2);
+ cairo_fill (cr);
+
+ g_object_unref (wilber);
}
/**
Modified: trunk/app/display/gimpcanvas.h
==============================================================================
--- trunk/app/display/gimpcanvas.h (original)
+++ trunk/app/display/gimpcanvas.h Wed Mar 26 13:49:27 2008
@@ -66,7 +66,6 @@
GdkGC *gc[GIMP_CANVAS_NUM_STYLES];
GdkBitmap *stipple[GIMP_CANVAS_NUM_STIPPLES];
PangoLayout *layout;
- PangoLayout *drop_zone_layout;
};
struct _GimpCanvasClass
Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c (original)
+++ trunk/app/display/gimpdisplayshell.c Wed Mar 26 13:49:27 2008
@@ -1202,6 +1202,8 @@
gimp_dialog_factory_add_foreign (display_factory,
"gimp-empty-image-window",
GTK_WIDGET (shell));
+ gimp_help_set_help_data (shell->canvas, _("Drop files to open them."),
+ NULL);
}
gimp_display_shell_title_init (shell);
@@ -1288,6 +1290,8 @@
gimp_display_shell_appearance_update (shell);
+ gimp_help_set_help_data (shell->canvas, _("Drop files to open them."), NULL);
+
gimp_display_shell_expose_full (shell);
gtk_window_resize (GTK_WINDOW (shell), width, height);
@@ -1330,6 +1334,8 @@
gimp_display_shell_appearance_update (shell);
+ gimp_help_set_help_data (shell->canvas, NULL, NULL);
+
shell->fill_idle_id = g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_display_shell_fill_idle,
shell, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]