Commit 2689b7f2 authored by Andy Hertzfeld's avatar Andy Hertzfeld
Browse files

made icons centered with respect to the text


   made icons centered with respect to the text
parent 8881c805
2000-01-18 Andy Hertzfeld <andy@eazel.com>
* 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 <ettore@helixcode.com>
* src/file-manager/dfos-xfer.c (xfer_info_destroy): Removed `#if
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment