Desktop icon layout fixes
- From: Dave Camp <dave ximian com>
- To: nautilus-list gnome org
- Subject: Desktop icon layout fixes
- Date: 17 Jun 2002 16:58:43 -0400
The attached patch fixes a couple of problems with the desktop icon
placement:
* When placing a new icon, it would sometimes place the icon under the
panel (outside of its margins)
* When placing a new icon, sometimes the icon would butt right up
against another icon, because the placement code wasn't honoring
DESKTOP_PAD_[HORIZONTAL,VERTICAL]
* When arranging by name, if you had a stretched icon at the end of a
column, it could be placed outside of the margins.
* When arranging by name, if you had a stretched icon in one column, all
subsequent columns would be at least as wide as the stretched icon.
-dave
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5374
diff -u -r1.5374 ChangeLog
--- ChangeLog 14 Jun 2002 21:28:50 -0000 1.5374
+++ ChangeLog 17 Jun 2002 20:56:11 -0000
@@ -1,3 +1,13 @@
+2002-06-17 Dave Camp <dave ximian com>
+
+ * libnautilus-private/nautilus-icon-container.c:
+ (find_open_grid_space), (mark_icon_location_in_grid): Add
+ DESKTOP_PAD_[HORIZONTAL,VERTICAL] to width and height to avoid new
+ icons from being placed too closely to other icons, and don't
+ place an icon partially outside of the grid.
+ (lay_down_icons_tblr): Wrap before placing the icon if necessary,
+ and reset max_width when moving to a new column.
+
2002-06-14 Damon Chaplin <damon ximian com>
* src/nautilus-preferences-dialog.c (preferences_show_help): new
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.282
diff -u -r1.282 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c 1 Jun 2002 00:05:47 -0000 1.282
+++ libnautilus-private/nautilus-icon-container.c 17 Jun 2002 20:56:12 -0000
@@ -961,23 +961,20 @@
/* Get icon dimensions */
icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
- width = x2 - x1;
- height = y2 - y1;
+
+ width = (x2 - x1) + DESKTOP_PAD_HORIZONTAL;
+ height = (y2 - y1) + DESKTOP_PAD_VERTICAL;
/* Convert to grid coordinates */
qwidth = ceil (width / CELL_SIZE);
qheight = ceil (height / CELL_SIZE);
- if (row + qwidth > num_rows) {
- qwidth = num_rows;
- } else {
- qwidth += row;
- }
- if (column + qheight > num_columns) {
- qheight = num_columns;
- } else {
- qheight += column;
+ if ((row + qwidth > num_rows) || (column + qheight > num_columns)) {
+ return FALSE;
}
+
+ qwidth += row;
+ qheight += column;
for (row_index = row; row_index < qwidth; row_index++) {
for (column_index = column; column_index < qheight; column_index++) {
@@ -1038,8 +1035,9 @@
int grid_width, grid_height;
icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
- width = x2 - x1;
- height = y2 - y1;
+
+ width = (x2 - x1) + DESKTOP_PAD_HORIZONTAL;
+ height = (y2 - y1) + DESKTOP_PAD_VERTICAL;
/* Convert x and y to our quantized grid value */
qx = icon->x / CELL_SIZE;
@@ -1179,22 +1177,25 @@
for (p = icons; p != NULL; p = p->next) {
icon = p->data;
icon_get_bounding_box (icon, &x1, &y1, &x2, &y2);
- icon_set_position (icon, x, y);
-
+
icon_width = x2 - x1;
icon_height = y2 - y1;
- y += icon_height + 10;
- /* Check for increase in column width */
- if (max_width < icon_width) {
- max_width = icon_width;
- }
-
/* Check and see if we need to move to a new column */
if (y > height - icon_height) {
x += max_width + DESKTOP_PAD_VERTICAL;
y = DESKTOP_PAD_VERTICAL;
+ max_width = 0;
+ }
+
+ icon_set_position (icon, x, y);
+
+ /* Check for increase in column width */
+ if (max_width < icon_width) {
+ max_width = icon_width;
}
+
+ y += icon_height + DESKTOP_PAD_VERTICAL;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]