mirror of https://github.com/GNOME/gimp.git
center the preview's allocation.
2002-06-12 Sven Neumann <sven@gimp.org> * app/widgets/gimppreview.c (gimp_preview_size_allocate): center the preview's allocation. * app/tools/gimpblendtool.c (blend_options_new): use a button for the gradient so it's more obvious that it can be pressed.
This commit is contained in:
parent
6ea8d93872
commit
117a8032d1
|
@ -1,3 +1,11 @@
|
|||
2002-06-12 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimppreview.c (gimp_preview_size_allocate): center
|
||||
the preview's allocation.
|
||||
|
||||
* app/tools/gimpblendtool.c (blend_options_new): use a button for
|
||||
the gradient so it's more obvious that it can be pressed.
|
||||
|
||||
2002-06-12 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpdata.[ch]: added a boolean "internal" which
|
||||
|
|
|
@ -448,6 +448,7 @@ blend_options_new (GimpToolInfo *tool_info)
|
|||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *button;
|
||||
GtkWidget *preview;
|
||||
|
||||
/* the new blend tool options structure */
|
||||
|
@ -509,18 +510,22 @@ blend_options_new (GimpToolInfo *tool_info)
|
|||
user_context = gimp_get_user_context (tool_info->gimp);
|
||||
gradient = gimp_context_get_gradient (user_context);
|
||||
|
||||
button = gtk_button_new ();
|
||||
preview = gimp_preview_new_full (GIMP_VIEWABLE (gradient),
|
||||
48, 16, 0,
|
||||
FALSE, TRUE, TRUE);
|
||||
128, 16, 0,
|
||||
FALSE, FALSE, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (button), preview);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Gradient:"), 1.0, 0.5,
|
||||
preview, 2, TRUE);
|
||||
button, 2, TRUE);
|
||||
|
||||
g_signal_connect_object (G_OBJECT (user_context), "gradient_changed",
|
||||
G_CALLBACK (gimp_preview_set_viewable),
|
||||
G_OBJECT (preview),
|
||||
G_CONNECT_SWAPPED);
|
||||
g_signal_connect (G_OBJECT (preview), "clicked",
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (blend_options_gradient_clicked),
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -275,11 +275,22 @@ gimp_preview_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpPreview *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
allocation->width = preview->width + 2 * preview->border_width;
|
||||
allocation->height = preview->height + 2 * preview->border_width;
|
||||
width = preview->width + 2 * preview->border_width;
|
||||
height = preview->height + 2 * preview->border_width;
|
||||
|
||||
if (allocation->width > width)
|
||||
allocation->x += (allocation->width - width) / 2;
|
||||
|
||||
if (allocation->height > height)
|
||||
allocation->y += (allocation->height - height) / 2;
|
||||
|
||||
allocation->width = width;
|
||||
allocation->height = height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
@ -307,7 +318,7 @@ gimp_preview_expose_event (GtkWidget *widget,
|
|||
if (widget->allocation.width > buf_rect.width)
|
||||
buf_rect.x = (widget->allocation.width - buf_rect.width) / 2;
|
||||
|
||||
if (widget->allocation.height >buf_rect.height)
|
||||
if (widget->allocation.height > buf_rect.height)
|
||||
buf_rect.y = (widget->allocation.height - buf_rect.height) / 2;
|
||||
|
||||
if (gdk_rectangle_intersect (&event->area, &buf_rect, &render_rect))
|
||||
|
|
|
@ -275,11 +275,22 @@ gimp_preview_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpPreview *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
allocation->width = preview->width + 2 * preview->border_width;
|
||||
allocation->height = preview->height + 2 * preview->border_width;
|
||||
width = preview->width + 2 * preview->border_width;
|
||||
height = preview->height + 2 * preview->border_width;
|
||||
|
||||
if (allocation->width > width)
|
||||
allocation->x += (allocation->width - width) / 2;
|
||||
|
||||
if (allocation->height > height)
|
||||
allocation->y += (allocation->height - height) / 2;
|
||||
|
||||
allocation->width = width;
|
||||
allocation->height = height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
@ -307,7 +318,7 @@ gimp_preview_expose_event (GtkWidget *widget,
|
|||
if (widget->allocation.width > buf_rect.width)
|
||||
buf_rect.x = (widget->allocation.width - buf_rect.width) / 2;
|
||||
|
||||
if (widget->allocation.height >buf_rect.height)
|
||||
if (widget->allocation.height > buf_rect.height)
|
||||
buf_rect.y = (widget->allocation.height - buf_rect.height) / 2;
|
||||
|
||||
if (gdk_rectangle_intersect (&event->area, &buf_rect, &render_rect))
|
||||
|
|
|
@ -275,11 +275,22 @@ gimp_preview_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpPreview *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
allocation->width = preview->width + 2 * preview->border_width;
|
||||
allocation->height = preview->height + 2 * preview->border_width;
|
||||
width = preview->width + 2 * preview->border_width;
|
||||
height = preview->height + 2 * preview->border_width;
|
||||
|
||||
if (allocation->width > width)
|
||||
allocation->x += (allocation->width - width) / 2;
|
||||
|
||||
if (allocation->height > height)
|
||||
allocation->y += (allocation->height - height) / 2;
|
||||
|
||||
allocation->width = width;
|
||||
allocation->height = height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
@ -307,7 +318,7 @@ gimp_preview_expose_event (GtkWidget *widget,
|
|||
if (widget->allocation.width > buf_rect.width)
|
||||
buf_rect.x = (widget->allocation.width - buf_rect.width) / 2;
|
||||
|
||||
if (widget->allocation.height >buf_rect.height)
|
||||
if (widget->allocation.height > buf_rect.height)
|
||||
buf_rect.y = (widget->allocation.height - buf_rect.height) / 2;
|
||||
|
||||
if (gdk_rectangle_intersect (&event->area, &buf_rect, &render_rect))
|
||||
|
|
|
@ -275,11 +275,22 @@ gimp_preview_size_allocate (GtkWidget *widget,
|
|||
GtkAllocation *allocation)
|
||||
{
|
||||
GimpPreview *preview;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
allocation->width = preview->width + 2 * preview->border_width;
|
||||
allocation->height = preview->height + 2 * preview->border_width;
|
||||
width = preview->width + 2 * preview->border_width;
|
||||
height = preview->height + 2 * preview->border_width;
|
||||
|
||||
if (allocation->width > width)
|
||||
allocation->x += (allocation->width - width) / 2;
|
||||
|
||||
if (allocation->height > height)
|
||||
allocation->y += (allocation->height - height) / 2;
|
||||
|
||||
allocation->width = width;
|
||||
allocation->height = height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
@ -307,7 +318,7 @@ gimp_preview_expose_event (GtkWidget *widget,
|
|||
if (widget->allocation.width > buf_rect.width)
|
||||
buf_rect.x = (widget->allocation.width - buf_rect.width) / 2;
|
||||
|
||||
if (widget->allocation.height >buf_rect.height)
|
||||
if (widget->allocation.height > buf_rect.height)
|
||||
buf_rect.y = (widget->allocation.height - buf_rect.height) / 2;
|
||||
|
||||
if (gdk_rectangle_intersect (&event->area, &buf_rect, &render_rect))
|
||||
|
|
Loading…
Reference in New Issue