add the spacing between the previews here instead of expecting an already

2001-02-06  Michael Natterer  <mitch@gimp.org>

	* app/gimpcontainergridview.[ch]: add the spacing between the
	previews here instead of expecting an already bordered preview.
	Set the widget background to white.

	* app/gimppattern.c: removed the white border hack.
This commit is contained in:
Michael Natterer 2001-02-05 23:44:19 +00:00 committed by Michael Natterer
parent 1f8b94df75
commit 3f839512fe
8 changed files with 47 additions and 21 deletions

View File

@ -1,3 +1,11 @@
2001-02-06 Michael Natterer <mitch@gimp.org>
* app/gimpcontainergridview.[ch]: add the spacing between the
previews here instead of expecting an already bordered preview.
Set the widget background to white.
* app/gimppattern.c: removed the white border hack.
2001-02-06 Michael Natterer <mitch@gimp.org>
* app/gimpcontainergridview.[ch]

View File

@ -142,17 +142,13 @@ gimp_pattern_preview_new (GimpViewable *viewable,
pattern = GIMP_PATTERN (viewable);
width -= 2;
height -= 2;
copy_width = MIN (width, pattern->mask->width);
copy_height = MIN (height, pattern->mask->height);
x = ((copy_width == width) ? 0 : (width - copy_width) / 2) + 1;
y = ((copy_height == height) ? 0 : (height - copy_height) / 2) + 1;
x = (copy_width == width) ? 0 : (width - copy_width) / 2;
y = (copy_height == height) ? 0 : (height - copy_height) / 2;
temp_buf = temp_buf_new (width + 2,
height + 2,
temp_buf = temp_buf_new (width, height,
pattern->mask->bytes,
0, 0,
white);

View File

@ -142,17 +142,13 @@ gimp_pattern_preview_new (GimpViewable *viewable,
pattern = GIMP_PATTERN (viewable);
width -= 2;
height -= 2;
copy_width = MIN (width, pattern->mask->width);
copy_height = MIN (height, pattern->mask->height);
x = ((copy_width == width) ? 0 : (width - copy_width) / 2) + 1;
y = ((copy_height == height) ? 0 : (height - copy_height) / 2) + 1;
x = (copy_width == width) ? 0 : (width - copy_width) / 2;
y = (copy_height == height) ? 0 : (height - copy_height) / 2;
temp_buf = temp_buf_new (width + 2,
height + 2,
temp_buf = temp_buf_new (width, height,
pattern->mask->bytes,
0, 0,
white);

View File

@ -25,6 +25,7 @@
#include "apptypes.h"
#include "appenv.h"
#include "colormaps.h"
#include "gimpcontainer.h"
#include "gimpcontainergridview.h"
#include "gimppreview.h"
@ -91,6 +92,12 @@ gimp_container_grid_view_class_init (GimpContainerGridViewClass *klass)
container_view_class->remove_item = gimp_container_grid_view_remove_item;
container_view_class->clear_items = gimp_container_grid_view_clear_items;
container_view_class->set_preview_size = gimp_container_grid_view_set_preview_size;
klass->white_style = gtk_style_copy (gtk_widget_get_default_style ());
klass->white_style->bg[GTK_STATE_NORMAL].red = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].green = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].blue = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].pixel = g_white_pixel;
}
static void
@ -105,9 +112,15 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
gtk_box_pack_start (GTK_BOX (grid_view), scrolled_win, TRUE, TRUE, 0);
grid_view->wrapbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_hspacing (GTK_WRAP_BOX (grid_view->wrapbox), 2);
gtk_wrap_box_set_vspacing (GTK_WRAP_BOX (grid_view->wrapbox), 2);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
grid_view->wrapbox);
gtk_widget_set_style
(grid_view->wrapbox->parent,
GIMP_CONTAINER_GRID_VIEW_CLASS (GTK_OBJECT (grid_view)->klass)->white_style);
gtk_container_set_focus_vadjustment
(GTK_CONTAINER (grid_view->wrapbox),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));

View File

@ -42,6 +42,8 @@ struct _GimpContainerGridView
struct _GimpContainerGridViewClass
{
GimpContainerViewClass parent_class;
GtkStyle *white_style;
};

View File

@ -142,17 +142,13 @@ gimp_pattern_preview_new (GimpViewable *viewable,
pattern = GIMP_PATTERN (viewable);
width -= 2;
height -= 2;
copy_width = MIN (width, pattern->mask->width);
copy_height = MIN (height, pattern->mask->height);
x = ((copy_width == width) ? 0 : (width - copy_width) / 2) + 1;
y = ((copy_height == height) ? 0 : (height - copy_height) / 2) + 1;
x = (copy_width == width) ? 0 : (width - copy_width) / 2;
y = (copy_height == height) ? 0 : (height - copy_height) / 2;
temp_buf = temp_buf_new (width + 2,
height + 2,
temp_buf = temp_buf_new (width, height,
pattern->mask->bytes,
0, 0,
white);

View File

@ -25,6 +25,7 @@
#include "apptypes.h"
#include "appenv.h"
#include "colormaps.h"
#include "gimpcontainer.h"
#include "gimpcontainergridview.h"
#include "gimppreview.h"
@ -91,6 +92,12 @@ gimp_container_grid_view_class_init (GimpContainerGridViewClass *klass)
container_view_class->remove_item = gimp_container_grid_view_remove_item;
container_view_class->clear_items = gimp_container_grid_view_clear_items;
container_view_class->set_preview_size = gimp_container_grid_view_set_preview_size;
klass->white_style = gtk_style_copy (gtk_widget_get_default_style ());
klass->white_style->bg[GTK_STATE_NORMAL].red = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].green = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].blue = 0xffff;
klass->white_style->bg[GTK_STATE_NORMAL].pixel = g_white_pixel;
}
static void
@ -105,9 +112,15 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
gtk_box_pack_start (GTK_BOX (grid_view), scrolled_win, TRUE, TRUE, 0);
grid_view->wrapbox = gtk_hwrap_box_new (FALSE);
gtk_wrap_box_set_hspacing (GTK_WRAP_BOX (grid_view->wrapbox), 2);
gtk_wrap_box_set_vspacing (GTK_WRAP_BOX (grid_view->wrapbox), 2);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
grid_view->wrapbox);
gtk_widget_set_style
(grid_view->wrapbox->parent,
GIMP_CONTAINER_GRID_VIEW_CLASS (GTK_OBJECT (grid_view)->klass)->white_style);
gtk_container_set_focus_vadjustment
(GTK_CONTAINER (grid_view->wrapbox),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));

View File

@ -42,6 +42,8 @@ struct _GimpContainerGridView
struct _GimpContainerGridViewClass
{
GimpContainerViewClass parent_class;
GtkStyle *white_style;
};