gimp r27058 - in trunk: . app/display
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27058 - in trunk: . app/display
- Date: Thu, 25 Sep 2008 15:41:57 +0000 (UTC)
Author: neo
Date: Thu Sep 25 15:41:57 2008
New Revision: 27058
URL: http://svn.gnome.org/viewvc/gimp?rev=27058&view=rev
Log:
2008-09-25 Sven Neumann <sven gimp org>
* app/display/gimpdisplayshell-dnd.c
(gimp_display_shell_drop_component)
(gimp_display_shell_drop_drawable): moved duplicate code to a
helper function.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-dnd.c
Modified: trunk/app/display/gimpdisplayshell-dnd.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-dnd.c (original)
+++ trunk/app/display/gimpdisplayshell-dnd.c Thu Sep 25 15:41:57 2008
@@ -157,6 +157,26 @@
/* private functions */
+/*
+ * Position the dropped item in the middle of the viewport.
+ */
+static void
+gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
+ GimpItem *item)
+{
+ gint x, y;
+ gint width, height;
+ gint off_x, off_y;
+
+ gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
+
+ gimp_item_offsets (item, &off_x, &off_y);
+
+ off_x = x + (width - gimp_item_width (item)) / 2 - off_x;
+ off_y = y + (height - gimp_item_height (item)) / 2 - off_y;
+
+ gimp_item_translate (item, off_x, off_y, FALSE);
+}
static void
gimp_display_shell_dnd_flush (GimpDisplayShell *shell,
@@ -235,21 +255,7 @@
_("Drop New Layer"));
if (! new_image)
- {
- gint x, y;
- gint width, height;
- gint off_x, off_y;
-
- gimp_item_offsets (new_item, &off_x, &off_y);
-
- gimp_display_shell_untransform_viewport (shell,
- &x, &y, &width, &height);
-
- off_x = x + (width - gimp_item_width (new_item)) / 2 - off_x;
- off_y = y + (height - gimp_item_height (new_item)) / 2 - off_y;
-
- gimp_item_translate (new_item, off_x, off_y, FALSE);
- }
+ gimp_display_shell_dnd_position_item (shell, new_item);
gimp_item_set_visible (new_item, TRUE, FALSE);
gimp_item_set_linked (new_item, FALSE, FALSE);
@@ -554,8 +560,6 @@
if (new_item)
{
GimpLayer *new_layer = GIMP_LAYER (new_item);
- gint x, y, width, height;
- gint off_x, off_y;
gimp_enum_get_value (GIMP_TYPE_CHANNEL_TYPE, component,
NULL, NULL, &desc, NULL);
@@ -565,14 +569,7 @@
gimp_image_undo_group_start (dest_image, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Drop New Layer"));
- gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
-
- gimp_item_offsets (new_item, &off_x, &off_y);
-
- off_x = x + (width - gimp_item_width (new_item)) / 2 - off_x;
- off_y = y + (height - gimp_item_height (new_item)) / 2 - off_y;
-
- gimp_item_translate (new_item, off_x, off_y, FALSE);
+ gimp_display_shell_dnd_position_item (shell, new_item);
gimp_image_add_layer (dest_image, new_layer, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]