diff --git a/ChangeLog-20000414 b/ChangeLog-20000414 index 96f32b2ab..ccc719fa8 100644 --- a/ChangeLog-20000414 +++ b/ChangeLog-20000414 @@ -1,3 +1,11 @@ +2000-01-18 Andy Hertzfeld + + * libnautilus/gnome-icon-container.c + made icon centered in cell by setting "x_set" pixbuf property so it listens to our offset + also, adjusted x_offset constant + * libnautilus/gnome-icon-container-dnd.c + made shadow be centered properly by taking difference between cellwidth and iconwidth into account + 2000-01-18 Ettore Perazzoli * src/file-manager/dfos-xfer.c (xfer_info_destroy): Removed `#if diff --git a/libnautilus-extensions/gnome-icon-container-dnd.c b/libnautilus-extensions/gnome-icon-container-dnd.c index 3b695cbe9..dfad3b7c4 100644 --- a/libnautilus-extensions/gnome-icon-container-dnd.c +++ b/libnautilus-extensions/gnome-icon-container-dnd.c @@ -50,6 +50,9 @@ static GtkTargetEntry drop_types [] = { }; static const int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]); +/* number of pixels of margin for shadow box */ +#define SHADOW_MARGIN 8 + static GnomeCanvasItem * create_selection_shadow (GnomeIconContainer *container, GList *list) @@ -61,6 +64,7 @@ create_selection_shadow (GnomeIconContainer *container, gint min_x, min_y; gint icon_width, icon_height; gint cell_width, cell_height; + gint x_offset; GList *p; if (list == NULL) @@ -73,7 +77,8 @@ create_selection_shadow (GnomeIconContainer *container, icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container); cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container); cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container); - + x_offset = cell_width - icon_width - SHADOW_MARGIN; + canvas = GNOME_CANVAS (container); /* Creating a big set of rectangles in the canvas can be expensive, so @@ -100,11 +105,11 @@ create_selection_shadow (GnomeIconContainer *container, item = p->data; - x1 = item->x; + x1 = item->x + x_offset; y1 = item->y; - x2 = item->x + icon_width; + x2 = item->x + icon_width + x_offset; y2 = item->y + icon_height; - + if (x2 >= min_x && x1 <= max_x && y2 >= min_y && y1 <= max_y) { GnomeCanvasItem *rect; diff --git a/libnautilus-extensions/gnome-icon-container.c b/libnautilus-extensions/gnome-icon-container.c index e5a645526..03954d5dd 100644 --- a/libnautilus-extensions/gnome-icon-container.c +++ b/libnautilus-extensions/gnome-icon-container.c @@ -55,7 +55,7 @@ static GnomeCanvasClass *parent_class; /* WARNING: Keep this in sync with the `GnomeIconContainerIconMode' enum in `gnome-icon-container.h'. */ GnomeIconContainerIconModeInfo gnome_icon_container_icon_mode_info[] = { - { 48, 48, 80, 80, 4, 24, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ + { 48, 48, 80, 80, 4, 12, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ { 24, 24, 100, 40, 4, 16, 16 } /* GNOME_ICON_CONTAINER_SMALL_ICONS */ }; @@ -189,6 +189,8 @@ icon_new_pixbuf (GnomeIconContainer *container, "pixbuf", image, "x", (gdouble) 0, "y", (gdouble) 0, + "x_set", TRUE, + "width_set", TRUE, NULL); icon_configure (new, container); diff --git a/libnautilus-private/gnome-icon-container-dnd.c b/libnautilus-private/gnome-icon-container-dnd.c index 3b695cbe9..dfad3b7c4 100644 --- a/libnautilus-private/gnome-icon-container-dnd.c +++ b/libnautilus-private/gnome-icon-container-dnd.c @@ -50,6 +50,9 @@ static GtkTargetEntry drop_types [] = { }; static const int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]); +/* number of pixels of margin for shadow box */ +#define SHADOW_MARGIN 8 + static GnomeCanvasItem * create_selection_shadow (GnomeIconContainer *container, GList *list) @@ -61,6 +64,7 @@ create_selection_shadow (GnomeIconContainer *container, gint min_x, min_y; gint icon_width, icon_height; gint cell_width, cell_height; + gint x_offset; GList *p; if (list == NULL) @@ -73,7 +77,8 @@ create_selection_shadow (GnomeIconContainer *container, icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container); cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container); cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container); - + x_offset = cell_width - icon_width - SHADOW_MARGIN; + canvas = GNOME_CANVAS (container); /* Creating a big set of rectangles in the canvas can be expensive, so @@ -100,11 +105,11 @@ create_selection_shadow (GnomeIconContainer *container, item = p->data; - x1 = item->x; + x1 = item->x + x_offset; y1 = item->y; - x2 = item->x + icon_width; + x2 = item->x + icon_width + x_offset; y2 = item->y + icon_height; - + if (x2 >= min_x && x1 <= max_x && y2 >= min_y && y1 <= max_y) { GnomeCanvasItem *rect; diff --git a/libnautilus-private/gnome-icon-container.c b/libnautilus-private/gnome-icon-container.c index e5a645526..03954d5dd 100644 --- a/libnautilus-private/gnome-icon-container.c +++ b/libnautilus-private/gnome-icon-container.c @@ -55,7 +55,7 @@ static GnomeCanvasClass *parent_class; /* WARNING: Keep this in sync with the `GnomeIconContainerIconMode' enum in `gnome-icon-container.h'. */ GnomeIconContainerIconModeInfo gnome_icon_container_icon_mode_info[] = { - { 48, 48, 80, 80, 4, 24, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ + { 48, 48, 80, 80, 4, 12, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ { 24, 24, 100, 40, 4, 16, 16 } /* GNOME_ICON_CONTAINER_SMALL_ICONS */ }; @@ -189,6 +189,8 @@ icon_new_pixbuf (GnomeIconContainer *container, "pixbuf", image, "x", (gdouble) 0, "y", (gdouble) 0, + "x_set", TRUE, + "width_set", TRUE, NULL); icon_configure (new, container); diff --git a/libnautilus/gnome-icon-container-dnd.c b/libnautilus/gnome-icon-container-dnd.c index 3b695cbe9..dfad3b7c4 100644 --- a/libnautilus/gnome-icon-container-dnd.c +++ b/libnautilus/gnome-icon-container-dnd.c @@ -50,6 +50,9 @@ static GtkTargetEntry drop_types [] = { }; static const int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]); +/* number of pixels of margin for shadow box */ +#define SHADOW_MARGIN 8 + static GnomeCanvasItem * create_selection_shadow (GnomeIconContainer *container, GList *list) @@ -61,6 +64,7 @@ create_selection_shadow (GnomeIconContainer *container, gint min_x, min_y; gint icon_width, icon_height; gint cell_width, cell_height; + gint x_offset; GList *p; if (list == NULL) @@ -73,7 +77,8 @@ create_selection_shadow (GnomeIconContainer *container, icon_height = GNOME_ICON_CONTAINER_ICON_HEIGHT (container); cell_width = GNOME_ICON_CONTAINER_CELL_WIDTH (container); cell_height = GNOME_ICON_CONTAINER_CELL_HEIGHT (container); - + x_offset = cell_width - icon_width - SHADOW_MARGIN; + canvas = GNOME_CANVAS (container); /* Creating a big set of rectangles in the canvas can be expensive, so @@ -100,11 +105,11 @@ create_selection_shadow (GnomeIconContainer *container, item = p->data; - x1 = item->x; + x1 = item->x + x_offset; y1 = item->y; - x2 = item->x + icon_width; + x2 = item->x + icon_width + x_offset; y2 = item->y + icon_height; - + if (x2 >= min_x && x1 <= max_x && y2 >= min_y && y1 <= max_y) { GnomeCanvasItem *rect; diff --git a/libnautilus/gnome-icon-container.c b/libnautilus/gnome-icon-container.c index e5a645526..03954d5dd 100644 --- a/libnautilus/gnome-icon-container.c +++ b/libnautilus/gnome-icon-container.c @@ -55,7 +55,7 @@ static GnomeCanvasClass *parent_class; /* WARNING: Keep this in sync with the `GnomeIconContainerIconMode' enum in `gnome-icon-container.h'. */ GnomeIconContainerIconModeInfo gnome_icon_container_icon_mode_info[] = { - { 48, 48, 80, 80, 4, 24, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ + { 48, 48, 80, 80, 4, 12, 28 }, /* GNOME_ICON_CONTAINER_NORMAL_ICONS */ { 24, 24, 100, 40, 4, 16, 16 } /* GNOME_ICON_CONTAINER_SMALL_ICONS */ }; @@ -189,6 +189,8 @@ icon_new_pixbuf (GnomeIconContainer *container, "pixbuf", image, "x", (gdouble) 0, "y", (gdouble) 0, + "x_set", TRUE, + "width_set", TRUE, NULL); icon_configure (new, container);