summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--libnautilus-extensions/nautilus-icon-canvas-item.c7
-rw-r--r--libnautilus-extensions/nautilus-icon-container.c42
-rw-r--r--libnautilus-extensions/nautilus-icon-dnd.c2
-rw-r--r--libnautilus-extensions/nautilus-icon-private.h3
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c7
-rw-r--r--libnautilus-private/nautilus-icon-container.c42
-rw-r--r--libnautilus-private/nautilus-icon-dnd.c2
-rw-r--r--libnautilus-private/nautilus-icon-private.h3
9 files changed, 104 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index f21511b1d..d154676b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2000-09-21 Andy Hertzfeld <andy@eazel.com>
+
+ * libnautilus-extensions/nautilus-icon-canvas-item.c:
+ (draw_stretch_handles_aa):
+
+ fixed bugs 3084, 3119, 3134, icon stretch handles are not drawn
+ in the right place or hit-tested properly, by removing some
+ bogus offsets.
+
+ fixed bugs 764 and 2626, icon stretching is way too slow, by only
+ doing the relayout and update position when the stretching is
+ finished, instead of doing it every time the mouse moves during
+ the stretch. Also, made it relayout if necessary after stretching
+ is finished, like it was intending to do.
+
+ * libnautilus-extensions/nautilus-icon-container.c:
+ (icon_set_size), (nautilus_icon_container_move_icon),
+ (continue_stretching), (end_stretching), (motion_notify_event),
+ (nautilus_icon_container_unstretch):
+ passed an "update_position" parameter through the various levels
+ to control if it should issue the icon_position_changed signal and
+ attempt the relayout
+
+ * libnautilus-extensions/nautilus-icon-dnd.c: (handle_local_move):
+ passed TRUE for the new update_position parameter to the move_icon call.
+ * libnautilus-extensions/nautilus-icon-private.h:
+ added an update position parameter to the move_icon call.
+
2000-09-21 Josh Barrow <linuxfan@ionet.net>
* icons/gnome/gnome.xml:
diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c
index 753199a1e..0b7490852 100644
--- a/libnautilus-extensions/nautilus-icon-canvas-item.c
+++ b/libnautilus-extensions/nautilus-icon-canvas-item.c
@@ -47,6 +47,7 @@
#include "nautilus-graphic-effects.h"
#include "nautilus-file-utilities.h"
#include "nautilus-icon-factory.h"
+#include "nautilus-theme.h"
/* Comment this out if the new smooth fonts code give you problems
* This isnt meant to be permanent. Its just a precaution.
@@ -911,10 +912,10 @@ draw_stretch_handles_aa (NautilusIconCanvasItem *item, GnomeCanvasBuf *buf,
get_icon_canvas_rectangle (item, &icon_rect);
- knob_filename = nautilus_pixmap_file ("knob.png");
+ knob_filename = nautilus_theme_get_image_path ("knob.png");
knob_pixbuf = gdk_pixbuf_new_from_file (knob_filename);
- knob_width = gdk_pixbuf_get_width (knob_pixbuf) - 6; /* offset to compensate for shadow */
- knob_height = gdk_pixbuf_get_height (knob_pixbuf) - 6; /* offset to compensate for shadow */
+ knob_width = gdk_pixbuf_get_width (knob_pixbuf);
+ knob_height = gdk_pixbuf_get_height (knob_pixbuf);
art_affine_identity(affine);
diff --git a/libnautilus-extensions/nautilus-icon-container.c b/libnautilus-extensions/nautilus-icon-container.c
index a5f7be185..9aae3a408 100644
--- a/libnautilus-extensions/nautilus-icon-container.c
+++ b/libnautilus-extensions/nautilus-icon-container.c
@@ -242,7 +242,8 @@ icon_get_size (NautilusIconContainer *container,
static void
icon_set_size (NautilusIconContainer *container,
NautilusIcon *icon,
- guint icon_size)
+ guint icon_size,
+ gboolean update_position)
{
guint old_size_x, old_size_y;
double scale;
@@ -258,7 +259,7 @@ icon_set_size (NautilusIconContainer *container,
nautilus_icon_container_move_icon (container, icon,
icon->x, icon->y,
scale, scale,
- FALSE);
+ FALSE, update_position);
}
static void
@@ -1055,7 +1056,8 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
NautilusIcon *icon,
int x, int y,
double scale_x, double scale_y,
- gboolean raise)
+ gboolean raise,
+ gboolean update_position)
{
NautilusIconContainerDetails *details;
gboolean emit_signal;
@@ -1068,7 +1070,7 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
if (!details->auto_layout) {
if (x != icon->x || y != icon->y) {
icon_set_position (icon, x, y);
- emit_signal = TRUE;
+ emit_signal = update_position;
}
}
@@ -1076,8 +1078,11 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
icon->scale_x = scale_x;
icon->scale_y = scale_y;
nautilus_icon_container_update_icon (container, icon);
- relayout (container);
- emit_signal = TRUE;
+ if (update_position) {
+ relayout (container);
+ emit_signal = TRUE;
+ }
+
}
if (emit_signal) {
@@ -2269,7 +2274,8 @@ start_stretching (NautilusIconContainer *container)
static void
continue_stretching (NautilusIconContainer *container,
- int window_x, int window_y)
+ int window_x, int window_y,
+ gboolean update_position)
{
NautilusIconContainerDetails *details;
NautilusIcon *icon;
@@ -2298,7 +2304,7 @@ continue_stretching (NautilusIconContainer *container,
&world_x, &world_y);
icon_set_position (icon, world_x, world_y);
- icon_set_size (container, icon, stretch_state.icon_size);
+ icon_set_size (container, icon, stretch_state.icon_size, update_position);
}
static void
@@ -2312,11 +2318,25 @@ static void
end_stretching (NautilusIconContainer *container,
int window_x, int window_y)
{
- continue_stretching (container, window_x, window_y);
+ NautilusIconPosition position;
+ NautilusIcon *icon;
+
+ continue_stretching (container, window_x, window_y, FALSE);
ungrab_stretch_icon (container);
+ /* now that we're done stretching, update the icon's position */
+ icon = container->details->drag_icon;
+ position.x = icon->x;
+ position.y = icon->y;
+ position.scale_x = icon->scale_x;
+ position.scale_y = icon->scale_y;
+ gtk_signal_emit (GTK_OBJECT (container),
+ signals[ICON_POSITION_CHANGED],
+ icon->data, &position);
+
/* We must do a relayout after indicating we are done stretching. */
container->details->drag_icon = NULL;
+ container->details->drag_state = DRAG_STATE_INITIAL;
relayout (container);
}
@@ -2430,7 +2450,7 @@ motion_notify_event (GtkWidget *widget,
}
break;
case DRAG_STATE_STRETCH:
- continue_stretching (container, motion->x, motion->y);
+ continue_stretching (container, motion->x, motion->y, FALSE);
break;
default:
break;
@@ -3954,7 +3974,7 @@ nautilus_icon_container_unstretch (NautilusIconContainer *container)
nautilus_icon_container_move_icon (container, icon,
icon->x, icon->y,
1.0, 1.0,
- FALSE);
+ FALSE, TRUE);
}
}
}
diff --git a/libnautilus-extensions/nautilus-icon-dnd.c b/libnautilus-extensions/nautilus-icon-dnd.c
index 9afc35d72..1447402b9 100644
--- a/libnautilus-extensions/nautilus-icon-dnd.c
+++ b/libnautilus-extensions/nautilus-icon-dnd.c
@@ -724,7 +724,7 @@ handle_local_move (NautilusIconContainer *container,
(container, icon,
world_x + item->icon_x, world_y + item->icon_y,
icon->scale_x, icon->scale_y,
- TRUE);
+ TRUE, TRUE);
}
moved_icons = g_list_prepend (moved_icons, icon);
}
diff --git a/libnautilus-extensions/nautilus-icon-private.h b/libnautilus-extensions/nautilus-icon-private.h
index eabd7277a..66a630f83 100644
--- a/libnautilus-extensions/nautilus-icon-private.h
+++ b/libnautilus-extensions/nautilus-icon-private.h
@@ -197,7 +197,8 @@ void nautilus_icon_container_move_icon (NautilusIconC
int y,
double scale_x,
double scale_y,
- gboolean raise);
+ gboolean raise,
+ gboolean update_position);
void nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *container,
GList *icons);
char * nautilus_icon_container_get_icon_uri (NautilusIconContainer *container,
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 753199a1e..0b7490852 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -47,6 +47,7 @@
#include "nautilus-graphic-effects.h"
#include "nautilus-file-utilities.h"
#include "nautilus-icon-factory.h"
+#include "nautilus-theme.h"
/* Comment this out if the new smooth fonts code give you problems
* This isnt meant to be permanent. Its just a precaution.
@@ -911,10 +912,10 @@ draw_stretch_handles_aa (NautilusIconCanvasItem *item, GnomeCanvasBuf *buf,
get_icon_canvas_rectangle (item, &icon_rect);
- knob_filename = nautilus_pixmap_file ("knob.png");
+ knob_filename = nautilus_theme_get_image_path ("knob.png");
knob_pixbuf = gdk_pixbuf_new_from_file (knob_filename);
- knob_width = gdk_pixbuf_get_width (knob_pixbuf) - 6; /* offset to compensate for shadow */
- knob_height = gdk_pixbuf_get_height (knob_pixbuf) - 6; /* offset to compensate for shadow */
+ knob_width = gdk_pixbuf_get_width (knob_pixbuf);
+ knob_height = gdk_pixbuf_get_height (knob_pixbuf);
art_affine_identity(affine);
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index a5f7be185..9aae3a408 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -242,7 +242,8 @@ icon_get_size (NautilusIconContainer *container,
static void
icon_set_size (NautilusIconContainer *container,
NautilusIcon *icon,
- guint icon_size)
+ guint icon_size,
+ gboolean update_position)
{
guint old_size_x, old_size_y;
double scale;
@@ -258,7 +259,7 @@ icon_set_size (NautilusIconContainer *container,
nautilus_icon_container_move_icon (container, icon,
icon->x, icon->y,
scale, scale,
- FALSE);
+ FALSE, update_position);
}
static void
@@ -1055,7 +1056,8 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
NautilusIcon *icon,
int x, int y,
double scale_x, double scale_y,
- gboolean raise)
+ gboolean raise,
+ gboolean update_position)
{
NautilusIconContainerDetails *details;
gboolean emit_signal;
@@ -1068,7 +1070,7 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
if (!details->auto_layout) {
if (x != icon->x || y != icon->y) {
icon_set_position (icon, x, y);
- emit_signal = TRUE;
+ emit_signal = update_position;
}
}
@@ -1076,8 +1078,11 @@ nautilus_icon_container_move_icon (NautilusIconContainer *container,
icon->scale_x = scale_x;
icon->scale_y = scale_y;
nautilus_icon_container_update_icon (container, icon);
- relayout (container);
- emit_signal = TRUE;
+ if (update_position) {
+ relayout (container);
+ emit_signal = TRUE;
+ }
+
}
if (emit_signal) {
@@ -2269,7 +2274,8 @@ start_stretching (NautilusIconContainer *container)
static void
continue_stretching (NautilusIconContainer *container,
- int window_x, int window_y)
+ int window_x, int window_y,
+ gboolean update_position)
{
NautilusIconContainerDetails *details;
NautilusIcon *icon;
@@ -2298,7 +2304,7 @@ continue_stretching (NautilusIconContainer *container,
&world_x, &world_y);
icon_set_position (icon, world_x, world_y);
- icon_set_size (container, icon, stretch_state.icon_size);
+ icon_set_size (container, icon, stretch_state.icon_size, update_position);
}
static void
@@ -2312,11 +2318,25 @@ static void
end_stretching (NautilusIconContainer *container,
int window_x, int window_y)
{
- continue_stretching (container, window_x, window_y);
+ NautilusIconPosition position;
+ NautilusIcon *icon;
+
+ continue_stretching (container, window_x, window_y, FALSE);
ungrab_stretch_icon (container);
+ /* now that we're done stretching, update the icon's position */
+ icon = container->details->drag_icon;
+ position.x = icon->x;
+ position.y = icon->y;
+ position.scale_x = icon->scale_x;
+ position.scale_y = icon->scale_y;
+ gtk_signal_emit (GTK_OBJECT (container),
+ signals[ICON_POSITION_CHANGED],
+ icon->data, &position);
+
/* We must do a relayout after indicating we are done stretching. */
container->details->drag_icon = NULL;
+ container->details->drag_state = DRAG_STATE_INITIAL;
relayout (container);
}
@@ -2430,7 +2450,7 @@ motion_notify_event (GtkWidget *widget,
}
break;
case DRAG_STATE_STRETCH:
- continue_stretching (container, motion->x, motion->y);
+ continue_stretching (container, motion->x, motion->y, FALSE);
break;
default:
break;
@@ -3954,7 +3974,7 @@ nautilus_icon_container_unstretch (NautilusIconContainer *container)
nautilus_icon_container_move_icon (container, icon,
icon->x, icon->y,
1.0, 1.0,
- FALSE);
+ FALSE, TRUE);
}
}
}
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index 9afc35d72..1447402b9 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -724,7 +724,7 @@ handle_local_move (NautilusIconContainer *container,
(container, icon,
world_x + item->icon_x, world_y + item->icon_y,
icon->scale_x, icon->scale_y,
- TRUE);
+ TRUE, TRUE);
}
moved_icons = g_list_prepend (moved_icons, icon);
}
diff --git a/libnautilus-private/nautilus-icon-private.h b/libnautilus-private/nautilus-icon-private.h
index eabd7277a..66a630f83 100644
--- a/libnautilus-private/nautilus-icon-private.h
+++ b/libnautilus-private/nautilus-icon-private.h
@@ -197,7 +197,8 @@ void nautilus_icon_container_move_icon (NautilusIconC
int y,
double scale_x,
double scale_y,
- gboolean raise);
+ gboolean raise,
+ gboolean update_position);
void nautilus_icon_container_select_list_unselect_others (NautilusIconContainer *container,
GList *icons);
char * nautilus_icon_container_get_icon_uri (NautilusIconContainer *container,