mirror of https://github.com/GNOME/gimp.git
allow a NULL gimage argument for gimp_edit_paste_as_new() (don't set
2001-07-02 Michael Natterer <mitch@gimp.org> * app/global_edit.c: allow a NULL gimage argument for gimp_edit_paste_as_new() (don't set resolution and unit). * app/disp_callbacks.[ch] * app/interface.c: allow dropping of a GimpBuffer (pastes the buffer). * app/gui/toolbox.c: ditto (creates a new image).
This commit is contained in:
parent
05f02449fe
commit
e94f175120
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2001-07-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/global_edit.c: allow a NULL gimage argument for
|
||||
gimp_edit_paste_as_new() (don't set resolution and unit).
|
||||
|
||||
* app/disp_callbacks.[ch]
|
||||
* app/interface.c: allow dropping of a GimpBuffer (pastes the
|
||||
buffer).
|
||||
|
||||
* app/gui/toolbox.c: ditto (creates a new image).
|
||||
|
||||
2001-07-02 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* Makefile.am
|
||||
|
|
|
@ -258,8 +258,13 @@ gimp_edit_paste_as_new (GimpImage *invoke,
|
|||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
if (invoke)
|
||||
{
|
||||
gimp_image_set_resolution (gimage,
|
||||
invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
}
|
||||
|
||||
layer = gimp_layer_new_from_tiles (gimage,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
|
|
|
@ -258,8 +258,13 @@ gimp_edit_paste_as_new (GimpImage *invoke,
|
|||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
if (invoke)
|
||||
{
|
||||
gimp_image_set_resolution (gimage,
|
||||
invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
}
|
||||
|
||||
layer = gimp_layer_new_from_tiles (gimage,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
@ -47,17 +48,18 @@
|
|||
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gui/info-window.h"
|
||||
#include "gui/layer-select.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "scale.h"
|
||||
#include "scroll.h"
|
||||
#include "selection.h"
|
||||
|
@ -1017,3 +1019,27 @@ gdisplay_drop_color (GtkWidget *widget,
|
|||
|
||||
gdisplay_bucket_fill (widget, FG_BUCKET_FILL, color, NULL, data);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (gimp_busy)
|
||||
return;
|
||||
|
||||
buffer = GIMP_BUFFER (viewable);
|
||||
gdisp = (GDisplay *) data;
|
||||
|
||||
/* FIXME: popup a menu for selecting "Paste Into" */
|
||||
|
||||
gimp_edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
buffer->tiles,
|
||||
FALSE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ void gdisplay_drop_pattern (GtkWidget *widget,
|
|||
void gdisplay_drop_color (GtkWidget *widget,
|
||||
const GimpRGB *color,
|
||||
gpointer data);
|
||||
void gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __DISP_CALLBACKS_H__ */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
@ -47,17 +48,18 @@
|
|||
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gui/info-window.h"
|
||||
#include "gui/layer-select.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "scale.h"
|
||||
#include "scroll.h"
|
||||
#include "selection.h"
|
||||
|
@ -1017,3 +1019,27 @@ gdisplay_drop_color (GtkWidget *widget,
|
|||
|
||||
gdisplay_bucket_fill (widget, FG_BUCKET_FILL, color, NULL, data);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (gimp_busy)
|
||||
return;
|
||||
|
||||
buffer = GIMP_BUFFER (viewable);
|
||||
gdisp = (GDisplay *) data;
|
||||
|
||||
/* FIXME: popup a menu for selecting "Paste Into" */
|
||||
|
||||
gimp_edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
buffer->tiles,
|
||||
FALSE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ void gdisplay_drop_pattern (GtkWidget *widget,
|
|||
void gdisplay_drop_color (GtkWidget *widget,
|
||||
const GimpRGB *color,
|
||||
gpointer data);
|
||||
void gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __DISP_CALLBACKS_H__ */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
@ -47,17 +48,18 @@
|
|||
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gui/info-window.h"
|
||||
#include "gui/layer-select.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "devices.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "disp_callbacks.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimprc.h"
|
||||
#include "global_edit.h"
|
||||
#include "scale.h"
|
||||
#include "scroll.h"
|
||||
#include "selection.h"
|
||||
|
@ -1017,3 +1019,27 @@ gdisplay_drop_color (GtkWidget *widget,
|
|||
|
||||
gdisplay_bucket_fill (widget, FG_BUCKET_FILL, color, NULL, data);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (gimp_busy)
|
||||
return;
|
||||
|
||||
buffer = GIMP_BUFFER (viewable);
|
||||
gdisp = (GDisplay *) data;
|
||||
|
||||
/* FIXME: popup a menu for selecting "Paste Into" */
|
||||
|
||||
gimp_edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
buffer->tiles,
|
||||
FALSE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ void gdisplay_drop_pattern (GtkWidget *widget,
|
|||
void gdisplay_drop_color (GtkWidget *widget,
|
||||
const GimpRGB *color,
|
||||
gpointer data);
|
||||
void gdisplay_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __DISP_CALLBACKS_H__ */
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -61,7 +62,8 @@ static GtkTargetEntry display_target_table[] =
|
|||
GIMP_TARGET_CHANNEL,
|
||||
GIMP_TARGET_LAYER_MASK,
|
||||
GIMP_TARGET_COLOR,
|
||||
GIMP_TARGET_PATTERN
|
||||
GIMP_TARGET_PATTERN,
|
||||
GIMP_TARGET_BUFFER
|
||||
};
|
||||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
@ -199,6 +201,8 @@ create_display_shell (GDisplay *gdisp,
|
|||
gdisplay_drop_drawable, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_PATTERN,
|
||||
gdisplay_drop_pattern, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_BUFFER,
|
||||
gdisplay_drop_buffer, gdisp);
|
||||
gimp_dnd_color_dest_set (gdisp->shell,
|
||||
gdisplay_drop_color, gdisp);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -61,7 +62,8 @@ static GtkTargetEntry display_target_table[] =
|
|||
GIMP_TARGET_CHANNEL,
|
||||
GIMP_TARGET_LAYER_MASK,
|
||||
GIMP_TARGET_COLOR,
|
||||
GIMP_TARGET_PATTERN
|
||||
GIMP_TARGET_PATTERN,
|
||||
GIMP_TARGET_BUFFER
|
||||
};
|
||||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
@ -199,6 +201,8 @@ create_display_shell (GDisplay *gdisp,
|
|||
gdisplay_drop_drawable, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_PATTERN,
|
||||
gdisplay_drop_pattern, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_BUFFER,
|
||||
gdisplay_drop_buffer, gdisp);
|
||||
gimp_dnd_color_dest_set (gdisp->shell,
|
||||
gdisplay_drop_color, gdisp);
|
||||
|
||||
|
|
|
@ -258,8 +258,13 @@ gimp_edit_paste_as_new (GimpImage *invoke,
|
|||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
||||
if (invoke)
|
||||
{
|
||||
gimp_image_set_resolution (gimage,
|
||||
invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
}
|
||||
|
||||
layer = gimp_layer_new_from_tiles (gimage,
|
||||
gimp_image_base_type_with_alpha (gimage),
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
@ -53,10 +54,12 @@
|
|||
#include "dialogs.h"
|
||||
#include "dialogs-commands.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "indicator-area.h"
|
||||
#include "menus.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "appenv.h"
|
||||
#include "gimage.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
|
@ -90,6 +93,12 @@ static void toolbox_drop_drawable (GtkWidget *widget,
|
|||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
static void toolbox_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#define COLUMNS 3
|
||||
|
@ -107,7 +116,8 @@ static GtkTargetEntry toolbox_target_table[] =
|
|||
GIMP_TARGET_LAYER,
|
||||
GIMP_TARGET_CHANNEL,
|
||||
GIMP_TARGET_LAYER_MASK,
|
||||
GIMP_TARGET_TOOL
|
||||
GIMP_TARGET_TOOL,
|
||||
GIMP_TARGET_BUFFER
|
||||
};
|
||||
static guint toolbox_n_targets = (sizeof (toolbox_target_table) /
|
||||
sizeof (toolbox_target_table[0]));
|
||||
|
@ -430,9 +440,10 @@ toolbox_create (void)
|
|||
toolbox_drop_drawable, NULL);
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_CHANNEL,
|
||||
toolbox_drop_drawable, NULL);
|
||||
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_TOOL_INFO,
|
||||
toolbox_drop_tool, NULL);
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_BUFFER,
|
||||
toolbox_drop_buffer, NULL);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
|
@ -571,3 +582,14 @@ toolbox_drop_tool (GtkWidget *widget,
|
|||
{
|
||||
gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable));
|
||||
}
|
||||
|
||||
static void
|
||||
toolbox_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
if (gimp_busy)
|
||||
return;
|
||||
|
||||
gimp_edit_paste_as_new (NULL, GIMP_BUFFER (viewable)->tiles);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -61,7 +62,8 @@ static GtkTargetEntry display_target_table[] =
|
|||
GIMP_TARGET_CHANNEL,
|
||||
GIMP_TARGET_LAYER_MASK,
|
||||
GIMP_TARGET_COLOR,
|
||||
GIMP_TARGET_PATTERN
|
||||
GIMP_TARGET_PATTERN,
|
||||
GIMP_TARGET_BUFFER
|
||||
};
|
||||
static guint display_n_targets = (sizeof (display_target_table) /
|
||||
sizeof (display_target_table[0]));
|
||||
|
@ -199,6 +201,8 @@ create_display_shell (GDisplay *gdisp,
|
|||
gdisplay_drop_drawable, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_PATTERN,
|
||||
gdisplay_drop_pattern, gdisp);
|
||||
gimp_dnd_viewable_dest_set (gdisp->shell, GIMP_TYPE_BUFFER,
|
||||
gdisplay_drop_buffer, gdisp);
|
||||
gimp_dnd_color_dest_set (gdisp->shell,
|
||||
gdisplay_drop_color, gdisp);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
@ -53,10 +54,12 @@
|
|||
#include "dialogs.h"
|
||||
#include "dialogs-commands.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "indicator-area.h"
|
||||
#include "menus.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "appenv.h"
|
||||
#include "gimage.h"
|
||||
#include "gimprc.h"
|
||||
|
||||
|
@ -90,6 +93,12 @@ static void toolbox_drop_drawable (GtkWidget *widget,
|
|||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
static void toolbox_drop_tool (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
static void toolbox_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#define COLUMNS 3
|
||||
|
@ -107,7 +116,8 @@ static GtkTargetEntry toolbox_target_table[] =
|
|||
GIMP_TARGET_LAYER,
|
||||
GIMP_TARGET_CHANNEL,
|
||||
GIMP_TARGET_LAYER_MASK,
|
||||
GIMP_TARGET_TOOL
|
||||
GIMP_TARGET_TOOL,
|
||||
GIMP_TARGET_BUFFER
|
||||
};
|
||||
static guint toolbox_n_targets = (sizeof (toolbox_target_table) /
|
||||
sizeof (toolbox_target_table[0]));
|
||||
|
@ -430,9 +440,10 @@ toolbox_create (void)
|
|||
toolbox_drop_drawable, NULL);
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_CHANNEL,
|
||||
toolbox_drop_drawable, NULL);
|
||||
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_TOOL_INFO,
|
||||
toolbox_drop_tool, NULL);
|
||||
gimp_dnd_viewable_dest_set (window, GIMP_TYPE_BUFFER,
|
||||
toolbox_drop_buffer, NULL);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
|
@ -571,3 +582,14 @@ toolbox_drop_tool (GtkWidget *widget,
|
|||
{
|
||||
gimp_context_set_tool (gimp_context_get_user (), GIMP_TOOL_INFO (viewable));
|
||||
}
|
||||
|
||||
static void
|
||||
toolbox_drop_buffer (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
if (gimp_busy)
|
||||
return;
|
||||
|
||||
gimp_edit_paste_as_new (NULL, GIMP_BUFFER (viewable)->tiles);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue