Commit f406b73d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

some cleanup.

2004-01-27  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-dnd.c: some cleanup.

	(gimp_display_shell_bucket_fill): don't use the bucket fill
	options but behave like "Edit -> Fill" and fill with NORMAL/100%.
	Fixes bug #132596.
parent 89156a3d
2004-01-27 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-dnd.c: some cleanup.
(gimp_display_shell_bucket_fill): don't use the bucket fill
options but behave like "Edit -> Fill" and fill with NORMAL/100%.
Fixes bug #132596.
2004-01-26 Manish Singh <yosh@gimp.org>
 
* gimp-zip.in: use new versioning defines.
......@@ -25,7 +25,6 @@
#include "core/gimp.h"
#include "core/gimp-edit.h"
#include "core/gimpbuffer.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-bucket-fill.h"
......@@ -33,7 +32,6 @@
#include "core/gimpimage-undo.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
#include "core/gimptoolinfo.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpvectors-import.h"
......@@ -102,34 +100,31 @@ gimp_display_shell_drop_vectors (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDisplay *gdisp;
GimpItem *new_item;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpImage *gimage = shell->gdisp->gimage;
GimpItem *new_item;
if (gdisp->gimage->gimp->busy)
if (gimage->gimp->busy)
return;
new_item = gimp_item_convert (GIMP_ITEM (viewable), gdisp->gimage,
new_item = gimp_item_convert (GIMP_ITEM (viewable), gimage,
G_TYPE_FROM_INSTANCE (viewable), TRUE);
if (new_item)
{
GimpVectors *new_vectors;
new_vectors = GIMP_VECTORS (new_item);
GimpVectors *new_vectors = GIMP_VECTORS (new_item);
gimp_image_undo_group_start (gdisp->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
_("Drop New Path"));
gimp_image_add_vectors (gdisp->gimage, new_vectors, -1);
gimp_image_add_vectors (gimage, new_vectors, -1);
gimp_image_undo_group_end (gdisp->gimage);
gimp_image_undo_group_end (gimage);
gimp_image_flush (gdisp->gimage);
gimp_image_flush (gimage);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
gimp_context_set_display (gimp_get_user_context (gimage->gimp),
shell->gdisp);
}
}
......@@ -139,17 +134,16 @@ gimp_display_shell_drop_svg (GtkWidget *widget,
gint svg_data_len,
gpointer data)
{
GimpDisplay *gdisp;
GError *error = NULL;
gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
GimpImage *gimage = shell->gdisp->gimage;
GError *error = NULL;
if (gdisp->gimage->gimp->busy)
if (gimage->gimp->busy)
return;
g_print ("drop SVG on canvas\n");
if (! gimp_vectors_import_buffer (gdisp->gimage, svg_data, svg_data_len,
if (! gimp_vectors_import_buffer (gimage, svg_data, svg_data_len,
TRUE, TRUE, &error))
{
g_message (error->message);
......@@ -157,22 +151,21 @@ gimp_display_shell_drop_svg (GtkWidget *widget,
}
else
{
gimp_image_flush (gdisp->gimage);
gimp_image_flush (gimage);
gimp_context_set_display (gimp_get_user_context (gdisp->gimage->gimp),
gdisp);
gimp_context_set_display (gimp_get_user_context (gimage->gimp),
shell->gdisp);
}
}
static void
gimp_display_shell_bucket_fill (GimpImage *gimage,
gimp_display_shell_bucket_fill (GimpDisplayShell *shell,
GimpBucketFillMode fill_mode,
const GimpRGB *color,
GimpPattern *pattern)
{
GimpImage *gimage = shell->gdisp->gimage;
GimpDrawable *drawable;
GimpToolInfo *tool_info;
GimpContext *context;
if (gimage->gimp->busy)
return;
......@@ -182,25 +175,17 @@ gimp_display_shell_bucket_fill (GimpImage *gimage,
if (! drawable)
return;
/* Get the bucket fill context */
tool_info = (GimpToolInfo *)
gimp_container_get_child_by_name (gimage->gimp->tool_info_list,
"gimp-bucket-fill-tool");
if (tool_info && tool_info->tool_options)
context = GIMP_CONTEXT (tool_info->tool_options);
else
context = gimp_get_user_context (gimage->gimp);
gimp_drawable_bucket_fill_full (drawable,
fill_mode,
gimp_context_get_paint_mode (context),
gimp_context_get_opacity (context),
GIMP_NORMAL_MODE, GIMP_OPACITY_OPAQUE,
FALSE /* no seed fill */,
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
color, pattern);
gimp_image_flush (gimage);
gimp_context_set_display (gimp_get_user_context (gimage->gimp),
shell->gdisp);
}
void
......@@ -208,10 +193,9 @@ gimp_display_shell_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
GimpDisplay *gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
if (GIMP_IS_PATTERN (viewable))
gimp_display_shell_bucket_fill (gdisp->gimage, GIMP_PATTERN_BUCKET_FILL,
gimp_display_shell_bucket_fill (GIMP_DISPLAY_SHELL (data),
GIMP_PATTERN_BUCKET_FILL,
NULL, GIMP_PATTERN (viewable));
}
......@@ -220,9 +204,8 @@ gimp_display_shell_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data)
{
GimpDisplay *gdisp = GIMP_DISPLAY_SHELL (data)->gdisp;
gimp_display_shell_bucket_fill (gdisp->gimage, GIMP_FG_BUCKET_FILL,
gimp_display_shell_bucket_fill (GIMP_DISPLAY_SHELL (data),
GIMP_FG_BUCKET_FILL,
color, NULL);
}
......
Markdown is supported
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