Am Montag, den 29.08.2005, 10:19 +0200 schrieb Alexander Larsson: > On Fri, 2005-08-26 at 23:15 +0200, Christian Neumair wrote: > > Am Freitag, den 15.07.2005, 11:40 +0200 schrieb Alexander Larsson: > > > > > > Its still extremely weird. It allows 25 pixel above the highest icon, > > > but only the top 25 pixels of the lowest icon. Just either use the full > > > extent of both icons to calculate the max/min position, or use the > > > middle of the icon. > > > > New proposed patch which takes into account the center of all selection > > candidates. I also tried to only use the image rectangle but throwed > > away this idea since it proved to feel a bit weird. > > That patch seems to contain a variety of changes. Some are even partial, > so that the patch doesn't compile. > > Also, by now we should be looking at showstopper bugs, like crashes or > data-loss things. While this bug is silly, and we should eventually fix > it, we shouldn't focus on it much atm. Attaching a new patch, containing only the relevant bits, so that we have something when the freeze is over. -- Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.393
diff -u -p -r1.393 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c 12 Aug 2005 18:11:29 -0000 1.393
+++ libnautilus-private/nautilus-icon-container.c 26 Aug 2005 21:12:26 -0000
@@ -1771,26 +1778,63 @@ select_range (NautilusIconContainer *con
unmatched_icon = NULL;
select = FALSE;
- for (p = container->details->icons; p != NULL; p = p->next) {
- icon = p->data;
+ if (container->details->auto_layout) {
+ for (p = container->details->icons; p != NULL; p = p->next) {
+ icon = p->data;
+
+ if (unmatched_icon == NULL) {
+ if (icon == icon1) {
+ unmatched_icon = icon2;
+ select = TRUE;
+ } else if (icon == icon2) {
+ unmatched_icon = icon1;
+ select = TRUE;
+ }
+ }
+
+ selection_changed |= icon_set_selected
+ (container, icon, select);
- if (unmatched_icon == NULL) {
- if (icon == icon1) {
- unmatched_icon = icon2;
- select = TRUE;
- } else if (icon == icon2) {
- unmatched_icon = icon1;
- select = TRUE;
+ if (unmatched_icon != NULL && icon == unmatched_icon) {
+ select = FALSE;
}
+
}
-
- selection_changed |= icon_set_selected
- (container, icon, select);
+ } else {
+ ArtIRect icon1_rect, icon2_rect;
+ ArtIRect icon_rect;
+ int x0, x1, y0, y1;
+ int x, y;
+
+ icon_get_bounding_box (icon1,
+ &icon1_rect.x0, &icon1_rect.y0,
+ &icon1_rect.x1, &icon1_rect.y1);
+ icon_get_bounding_box (icon2,
+ &icon2_rect.x0, &icon2_rect.y0,
+ &icon2_rect.x1, &icon2_rect.y1);
+
+ x0 = MIN (icon1_rect.x0, icon2_rect.x0);
+ x1 = MAX (icon1_rect.x1, icon2_rect.x1);
+ y0 = MIN (icon1_rect.y0, icon2_rect.y0);
+ y1 = MAX (icon1_rect.y1, icon2_rect.y1);
+
- if (unmatched_icon != NULL && icon == unmatched_icon) {
- select = FALSE;
+ for (p = container->details->icons; p != NULL; p = p->next) {
+ icon = p->data;
+
+ /* select all items whose center is inside the selection rectangle */
+ icon_get_bounding_box (icon,
+ &icon_rect.x0, &icon_rect.y0,
+ &icon_rect.x1, &icon_rect.y1);
+
+ x = (icon_rect.x0 + icon_rect.x1) / 2;
+ y = (icon_rect.y0 + icon_rect.y1) / 2;
+
+ select = (x > x0 && x < x1 && y > y0 && y < y1);
+ selection_changed |= icon_set_selected
+ (container, icon, select);
}
-
+
}
if (selection_changed && icon2 != NULL) {
Attachment:
signature.asc
Description: This is a digitally signed message part