mirror of https://github.com/GNOME/gimp.git
app/Makefile.am removed.
2001-06-26 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/color_transfer.[ch]: removed. * app/tools/Makefile.am * app/tools/gimpcolorbalancetool-transfer.[ch]: added. * app/tools/gimpcolorbalancetool.c: changed accordingly. * app/base/Makefile.am * app/base/tile-manager-crop.[ch]: formerly known as crop_buffer(). * app/tools/gimptexttool.c: changed accordingly. * app/context_manager.[ch]: added the global clipboard and the named buffer list here. * app/app_procs.c: don't call color_transfer_init() and don't free the buffer stuff (done by the context manager now). * app/errorconsole.c: don't #include "gui/commands.h" * app/global_edit.[ch]: removed lots of stuff which is now done by gui/edit-commands.* or the new GimpBuffer object. The "paste named" dialog will go away and this file will be moved to core/ soon. * app/image_new.c: no need to declare the global_buffer extern any more. * app/qmask.c: don't #include "global_edit.h" * app/core/Makefile.am * app/core/core-types.h * app/core/gimpbuffer.[ch]: new object (aka named buffer) * app/core/gimpcontext.[ch]: added a GimpBuffer attribute. * app/core/gimpimage.[ch]: one s/int/gboolean/. * app/core/gimppattern.c: hmm... * app/gui/commands.[ch]: split up in small files: * app/gui/Makefile.am * app/gui/edit-commands.[ch] * app/gui/file-commands.[ch] * app/gui/image-commands.[ch] * app/gui/select-commands.[ch] * app/gui/view-commands.[ch]: new files. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added the named buffer list & grid. * app/gui/file-new-dialog.[ch] * app/gui/menus.c * app/gui/palette-editor.c * app/gui/test-commands.c: changed accordingly. * app/pdb/edit_cmds.c * tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff. * app/widgets/Makefile.am * app/widgets/gimpbufferpreview.[ch] * app/widgets/gimpbufferview.[ch] * app/widgets/gimpcontainereditor.[ch]: new widgets. * app/widgets/gimpcontainerview-utils.c * app/widgets/gimpdatafactoryview.[ch] * app/widgets/gimpdnd.[ch] * app/widgets/gimpdrawablepreview.c * app/widgets/gimplayerlistview.c * app/widgets/gimppreview.c * app/widgets/widgets-types.h: changed accordingly for the new GimpBuffer object and it's views, misc. cleanups. * pixmaps/Makefile.am * pixmaps/paste-as-new.xpm * pixmaps/paste-into.xpm * pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-) * po/POTFILES.in: added the new files.
This commit is contained in:
parent
76389b3c44
commit
d26c26686e
84
ChangeLog
84
ChangeLog
|
@ -1,3 +1,87 @@
|
|||
2001-06-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/Makefile.am
|
||||
* app/color_transfer.[ch]: removed.
|
||||
|
||||
* app/tools/Makefile.am
|
||||
* app/tools/gimpcolorbalancetool-transfer.[ch]: added.
|
||||
|
||||
* app/tools/gimpcolorbalancetool.c: changed accordingly.
|
||||
|
||||
* app/base/Makefile.am
|
||||
* app/base/tile-manager-crop.[ch]: formerly known as crop_buffer().
|
||||
|
||||
* app/tools/gimptexttool.c: changed accordingly.
|
||||
|
||||
* app/context_manager.[ch]: added the global clipboard and the
|
||||
named buffer list here.
|
||||
|
||||
* app/app_procs.c: don't call color_transfer_init() and don't free
|
||||
the buffer stuff (done by the context manager now).
|
||||
|
||||
* app/errorconsole.c: don't #include "gui/commands.h"
|
||||
|
||||
* app/global_edit.[ch]: removed lots of stuff which is now done by
|
||||
gui/edit-commands.* or the new GimpBuffer object. The "paste
|
||||
named" dialog will go away and this file will be moved to core/
|
||||
soon.
|
||||
|
||||
* app/image_new.c: no need to declare the global_buffer extern any
|
||||
more.
|
||||
|
||||
* app/qmask.c: don't #include "global_edit.h"
|
||||
|
||||
* app/core/Makefile.am
|
||||
* app/core/core-types.h
|
||||
* app/core/gimpbuffer.[ch]: new object (aka named buffer)
|
||||
|
||||
* app/core/gimpcontext.[ch]: added a GimpBuffer attribute.
|
||||
|
||||
* app/core/gimpimage.[ch]: one s/int/gboolean/.
|
||||
|
||||
* app/core/gimppattern.c: hmm...
|
||||
|
||||
* app/gui/commands.[ch]: split up in small files:
|
||||
|
||||
* app/gui/Makefile.am
|
||||
* app/gui/edit-commands.[ch]
|
||||
* app/gui/file-commands.[ch]
|
||||
* app/gui/image-commands.[ch]
|
||||
* app/gui/select-commands.[ch]
|
||||
* app/gui/view-commands.[ch]: new files.
|
||||
|
||||
* app/gui/dialogs-constructors.[ch]
|
||||
* app/gui/dialogs.c: added the named buffer list & grid.
|
||||
|
||||
* app/gui/file-new-dialog.[ch]
|
||||
* app/gui/menus.c
|
||||
* app/gui/palette-editor.c
|
||||
* app/gui/test-commands.c: changed accordingly.
|
||||
|
||||
* app/pdb/edit_cmds.c
|
||||
* tools/pdbgen/pdb/edit.pdb: changed for the global_edit stuff.
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/gimpbufferpreview.[ch]
|
||||
* app/widgets/gimpbufferview.[ch]
|
||||
* app/widgets/gimpcontainereditor.[ch]: new widgets.
|
||||
|
||||
* app/widgets/gimpcontainerview-utils.c
|
||||
* app/widgets/gimpdatafactoryview.[ch]
|
||||
* app/widgets/gimpdnd.[ch]
|
||||
* app/widgets/gimpdrawablepreview.c
|
||||
* app/widgets/gimplayerlistview.c
|
||||
* app/widgets/gimppreview.c
|
||||
* app/widgets/widgets-types.h: changed accordingly for the new
|
||||
GimpBuffer object and it's views, misc. cleanups.
|
||||
|
||||
* pixmaps/Makefile.am
|
||||
* pixmaps/paste-as-new.xpm
|
||||
* pixmaps/paste-into.xpm
|
||||
* pixmaps/paste.xpm: new pixmaps (they all look the same... Tigert? ;-)
|
||||
|
||||
* po/POTFILES.in: added the new files.
|
||||
|
||||
2001-06-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/scripts/burn-in-anim.scm: added Burn-In script
|
||||
|
|
|
@ -98,8 +98,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
|
|||
apptypes.h \
|
||||
batch.c \
|
||||
batch.h \
|
||||
color_transfer.c \
|
||||
color_transfer.h \
|
||||
context_manager.c \
|
||||
context_manager.h \
|
||||
drawable.c \
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "edit-commands.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data);
|
||||
static void copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
edit_undo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_redo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_cut (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_copy (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage));
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buffer,
|
||||
FALSE))
|
||||
{
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_into_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buffer,
|
||||
TRUE))
|
||||
{
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_as_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
edit_paste_as_new (gdisp->gimage,
|
||||
global_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/cut_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
cut_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Copy Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/copy_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
copy_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
fill_type = (GimpFillType) action;
|
||||
|
||||
edit_fill (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
fill_type);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
edit_stroke_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_cut (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_buffer_new (new_tiles, name);
|
||||
gimp_container_add (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_copy (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_buffer_new (new_tiles, name);
|
||||
gimp_container_add (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __EDIT_COMMANDS_H__
|
||||
#define __EDIT_COMMANDS_H__
|
||||
|
||||
|
||||
void edit_undo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_redo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_into_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_as_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void edit_stroke_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __EDIT_COMMANDS_H__ */
|
|
@ -0,0 +1,115 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "file-commands.h"
|
||||
#include "file-new-dialog.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "image_new.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
void
|
||||
file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *image = NULL;
|
||||
|
||||
/* Before we try to determine the responsible gdisplay,
|
||||
* make sure this wasn't called from the toolbox
|
||||
*/
|
||||
if (action)
|
||||
{
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (gdisp)
|
||||
image = gdisp->gimage;
|
||||
}
|
||||
|
||||
image_new_create_window (NULL, image);
|
||||
}
|
||||
|
||||
void
|
||||
file_open_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_open_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_as_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_a_copy_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_a_copy_as_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_revert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_revert_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
file_quit_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
app_exit (FALSE);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __FILE_COMMANDS_H__
|
||||
#define __FILE_COMMANDS_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void file_open_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_revert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_pref_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_quit_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __FILE_COMMANDS_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -20,89 +20,24 @@
|
|||
#define __COMMANDS_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *, gpointer, guint);
|
||||
void file_open_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_a_copy_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_revert_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_pref_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_close_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_quit_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void edit_undo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_redo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_into_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_as_new_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_clear_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
void edit_stroke_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void select_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_all_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_none_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_float_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_feather_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_sharpen_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_shrink_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_border_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_grow_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_save_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void view_zoomin_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoomout_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_16_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_8_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_4_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_2_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_2_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_4_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_8_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_16_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_dot_for_dot_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_info_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_nav_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_rulers_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_statusbar_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_snap_to_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void help_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_context_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void help_context_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __COMMANDS_H__ */
|
||||
|
|
|
@ -0,0 +1,440 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-desaturate.h"
|
||||
#include "core/gimpdrawable-equalize.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-duplicate.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
#include "convert-dialog.h"
|
||||
#include "offset-dialog.h"
|
||||
#include "resize-dialog.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void image_resize_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data);
|
||||
static void image_scale_implement (ImageResize *image_scale);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
image_convert_rgb_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_convert_indexed_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (! gimp_drawable_is_rgb (drawable))
|
||||
{
|
||||
g_message (_("Desaturate operates only on RGB color drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_drawable_desaturate (drawable);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
Argument *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (gimp_drawable_is_indexed (drawable))
|
||||
{
|
||||
g_message (_("Invert does not operate on indexed drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_invert",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
||||
g_message (_("Invert operation failed."));
|
||||
|
||||
procedural_db_destroy_args (return_vals, nreturn_vals);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_equalize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (gimp_drawable_is_indexed (drawable))
|
||||
{
|
||||
g_message (_("Equalize does not operate on indexed drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_drawable_equalize (drawable, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_offset_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
offset_dialog_create (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_resize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_resize;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_resize = g_new0 (ImageResize, 1);
|
||||
|
||||
image_resize->gimage = gimage;
|
||||
image_resize->resize = resize_widget_new (ResizeWidget,
|
||||
ResizeImage,
|
||||
GTK_OBJECT (gimage),
|
||||
"destroy",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
gdisp->dot_for_dot,
|
||||
image_resize_callback,
|
||||
NULL,
|
||||
image_resize);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (image_resize->resize->resize_shell),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (g_free),
|
||||
(GtkObject *) image_resize);
|
||||
|
||||
gtk_widget_show (image_resize->resize->resize_shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_scale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_scale;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_scale = g_new0 (ImageResize, 1);
|
||||
|
||||
image_scale->gimage = gimage;
|
||||
image_scale->resize = resize_widget_new (ScaleWidget,
|
||||
ResizeImage,
|
||||
GTK_OBJECT (gimage),
|
||||
"destroy",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
gdisp->dot_for_dot,
|
||||
image_scale_callback,
|
||||
NULL,
|
||||
image_scale);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (image_scale->resize->resize_shell),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (g_free),
|
||||
(GtkObject *) image_scale);
|
||||
|
||||
gtk_widget_show (image_scale->resize->resize_shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_duplicate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new (gimp_image_duplicate (gdisp->gimage), 0x0101);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
image_resize_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) data;
|
||||
|
||||
g_assert (image_resize != NULL);
|
||||
g_assert (image_resize->gimage != NULL);
|
||||
|
||||
gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE);
|
||||
|
||||
if (image_resize->resize->width > 0 &&
|
||||
image_resize->resize->height > 0)
|
||||
{
|
||||
gimp_image_resize (image_resize->gimage,
|
||||
image_resize->resize->width,
|
||||
image_resize->resize->height,
|
||||
image_resize->resize->offset_x,
|
||||
image_resize->resize->offset_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message (_("Resize Error: Both width and height must be "
|
||||
"greater than zero."));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (image_resize->resize->resize_shell);
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
|
||||
image_scale = (ImageResize *) data;
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
|
||||
gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE);
|
||||
|
||||
if (gimp_image_check_scaling (image_scale->gimage,
|
||||
image_scale->resize->width,
|
||||
image_scale->resize->height))
|
||||
{
|
||||
image_scale_implement (image_scale);
|
||||
|
||||
gtk_widget_destroy (image_scale->resize->resize_shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog =
|
||||
gimp_query_boolean_box (_("Layer Too Small"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/scale_layer_warn.html",
|
||||
FALSE,
|
||||
_("The chosen image size will shrink\n"
|
||||
"some layers completely away.\n"
|
||||
"Is this what you want?"),
|
||||
_("OK"), _("Cancel"),
|
||||
GTK_OBJECT (image_scale->resize->resize_shell),
|
||||
"destroy",
|
||||
image_scale_warn_callback,
|
||||
image_scale);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GimpImage *gimage;
|
||||
|
||||
image_scale = (ImageResize *) data;
|
||||
gimage = image_scale->gimage;
|
||||
|
||||
if (do_scale) /* User doesn't mind losing layers... */
|
||||
{
|
||||
image_scale_implement (image_scale);
|
||||
|
||||
gtk_widget_destroy (image_scale->resize->resize_shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (image_scale->resize->resize_shell, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_implement (ImageResize *image_scale)
|
||||
{
|
||||
GimpImage *gimage = NULL;
|
||||
gboolean rulers_flush = FALSE;
|
||||
gboolean display_flush = FALSE; /* this is a bit ugly:
|
||||
we hijack the flush variable
|
||||
to check if an undo_group was
|
||||
already started */
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
|
||||
gimage = image_scale->gimage;
|
||||
|
||||
if (image_scale->resize->resolution_x != gimage->xresolution ||
|
||||
image_scale->resize->resolution_y != gimage->yresolution)
|
||||
{
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_set_resolution (gimage,
|
||||
image_scale->resize->resolution_x,
|
||||
image_scale->resize->resolution_y);
|
||||
|
||||
rulers_flush = TRUE;
|
||||
display_flush = TRUE;
|
||||
}
|
||||
|
||||
if (image_scale->resize->unit != gimage->unit)
|
||||
{
|
||||
if (!display_flush)
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_set_unit (gimage, image_scale->resize->unit);
|
||||
gdisplays_setup_scale (gimage);
|
||||
gdisplays_resize_cursor_label (gimage);
|
||||
|
||||
rulers_flush = TRUE;
|
||||
display_flush = TRUE;
|
||||
}
|
||||
|
||||
if (image_scale->resize->width != gimage->width ||
|
||||
image_scale->resize->height != gimage->height)
|
||||
{
|
||||
if (image_scale->resize->width > 0 &&
|
||||
image_scale->resize->height > 0)
|
||||
{
|
||||
if (!display_flush)
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_scale (gimage,
|
||||
image_scale->resize->width,
|
||||
image_scale->resize->height);
|
||||
|
||||
display_flush = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message (_("Scale Error: Both width and height must be "
|
||||
"greater than zero."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (rulers_flush)
|
||||
{
|
||||
gdisplays_setup_scale (gimage);
|
||||
gdisplays_resize_cursor_label (gimage);
|
||||
}
|
||||
|
||||
if (display_flush)
|
||||
{
|
||||
undo_push_group_end (gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __IMAGE_COMMANDS_H__
|
||||
#define __IMAGE_COMMANDS_H__
|
||||
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_equalize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_offset_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_resize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_scale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_duplicate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __IMAGE_COMMANDS_H__ */
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -0,0 +1,380 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void gimage_mask_feather_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_border_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_grow_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_shrink_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* local variables */
|
||||
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
static gboolean selection_shrink_edge_lock = FALSE;
|
||||
|
||||
|
||||
void
|
||||
select_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_none_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_float_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_feather_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Feather Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/feather_selection.html",
|
||||
_("Feather Selection by:"),
|
||||
selection_feather_radius, 0, 32767, 3,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_feather_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_sharpen_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_shrink_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *edge_lock;
|
||||
GtkWidget *shrink_dialog;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
shrink_dialog =
|
||||
gimp_query_size_box (_("Shrink Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/shrink_selection.html",
|
||||
_("Shrink Selection by:"),
|
||||
selection_shrink_pixels, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_shrink_callback, gdisp->gimage);
|
||||
|
||||
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
|
||||
/* eeek */
|
||||
gtk_box_pack_start (GTK_BOX (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox)), 0)), edge_lock,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_object_set_data (GTK_OBJECT (shrink_dialog), "edge_lock_toggle",
|
||||
edge_lock);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
|
||||
! selection_shrink_edge_lock);
|
||||
gtk_widget_show (edge_lock);
|
||||
|
||||
gtk_widget_show (shrink_dialog);
|
||||
}
|
||||
|
||||
void
|
||||
select_grow_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Grow Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/grow_selection.html",
|
||||
_("Grow Selection by:"),
|
||||
selection_grow_pixels, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_grow_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_border_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Border Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/border_selection.html",
|
||||
_("Border Selection by:"),
|
||||
selection_border_radius, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_border_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimage_mask_feather_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_feather_radius = size;
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_feather (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_border_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_border_radius = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_border (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_grow_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_grow_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_grow (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_shrink_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_shrink_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
selection_shrink_edge_lock =
|
||||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_shrink (gimage, radius_x, radius_y, selection_shrink_edge_lock);
|
||||
gdisplays_flush ();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SELECT_COMMANDS_H__
|
||||
#define __SELECT_COMMANDS_H__
|
||||
|
||||
|
||||
void select_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_none_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_float_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_feather_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_sharpen_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_shrink_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_border_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_grow_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __SELECT_COMMANDS_H__ */
|
|
@ -0,0 +1,245 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
#include "view-commands.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "nav_window.h"
|
||||
#include "scale.h"
|
||||
#include "selection.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
void
|
||||
view_zoomin_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, GIMP_ZOOM_IN);
|
||||
}
|
||||
|
||||
void
|
||||
view_zoomout_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, GIMP_ZOOM_OUT);
|
||||
}
|
||||
|
||||
void
|
||||
view_zoom_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, action);
|
||||
}
|
||||
|
||||
void
|
||||
view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
||||
void
|
||||
view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gimprc.info_window_follows_mouse)
|
||||
{
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create (gdisp);
|
||||
|
||||
info_window_update (gdisp);
|
||||
info_dialog_popup (gdisp->window_info_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
info_window_follow_auto ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gimprc.nav_window_per_display)
|
||||
{
|
||||
if (! gdisp->window_nav_dialog)
|
||||
gdisp->window_nav_dialog = nav_dialog_create (gdisp);
|
||||
|
||||
nav_dialog_popup (gdisp->window_nav_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav_dialog_follow_auto ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
gint new_val;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
||||
/* hidden == TRUE corresponds to the menu toggle being FALSE */
|
||||
if (new_val == gdisp->select->hidden)
|
||||
{
|
||||
selection_toggle (gdisp->select);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (gdisp->origin))
|
||||
{
|
||||
gtk_widget_hide (gdisp->origin);
|
||||
gtk_widget_hide (gdisp->hrule);
|
||||
gtk_widget_hide (gdisp->vrule);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (gdisp->origin))
|
||||
{
|
||||
gtk_widget_show (gdisp->origin);
|
||||
gtk_widget_show (gdisp->hrule);
|
||||
gtk_widget_show (gdisp->vrule);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (gdisp->statusarea))
|
||||
gtk_widget_hide (gdisp->statusarea);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (gdisp->statusarea))
|
||||
gtk_widget_show (gdisp->statusarea);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
gint old_val;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
||||
if ((old_val != gdisp->draw_guides) && gdisp->gimage->guides)
|
||||
{
|
||||
gdisplay_expose_full (gdisp);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
||||
void
|
||||
view_new_view_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __VIEW_COMMANDS_H__
|
||||
#define __VIEW_COMMANDS_H__
|
||||
|
||||
|
||||
void view_zoomin_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_zoomout_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_zoom_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_new_view_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __VIEW_COMMANDS_H__ */
|
|
@ -47,14 +47,12 @@
|
|||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "batch.h"
|
||||
#include "color_transfer.h"
|
||||
#include "colormaps.h"
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "gimpparasite.h"
|
||||
#include "global_edit.h"
|
||||
#include "plug_in.h"
|
||||
#include "module_db.h"
|
||||
|
||||
|
@ -235,8 +233,6 @@ app_init (void)
|
|||
message_handler = MESSAGE_BOX;
|
||||
}
|
||||
|
||||
color_transfer_init ();
|
||||
|
||||
if (! no_interface)
|
||||
{
|
||||
gui_restore ();
|
||||
|
@ -270,8 +266,6 @@ app_exit_finish (void)
|
|||
|
||||
module_db_free ();
|
||||
gdisplays_delete ();
|
||||
global_edit_free ();
|
||||
named_buffers_free ();
|
||||
context_manager_free ();
|
||||
plug_in_kill ();
|
||||
procedural_db_free ();
|
||||
|
|
|
@ -34,6 +34,8 @@ libappbase_a_SOURCES = @STRIP_BEGIN@ \
|
|||
tile-manager.c \
|
||||
tile-manager.h \
|
||||
tile-manager-private.h \
|
||||
tile-manager-crop.c \
|
||||
tile-manager-crop.h \
|
||||
tile-swap.c \
|
||||
tile-swap.h \
|
||||
@STRIP_END@
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gimpcolorbalancetool.h"
|
||||
#include "gimpcolorbalancetool-transfer.h"
|
||||
#include "tool_manager.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
#include "color_transfer.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "image_map.h"
|
||||
|
@ -156,6 +156,8 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
|
|||
|
||||
tool_class->initialize = gimp_color_balance_tool_initialize;
|
||||
tool_class->control = gimp_color_balance_tool_control;
|
||||
|
||||
gimp_color_balance_tool_transfer_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "base-types.h"
|
||||
|
||||
#include "pixel-region.h"
|
||||
#include "tile-manager.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
|
||||
/* Crop the buffer to the size of pixels with non-zero transparency */
|
||||
|
||||
TileManager *
|
||||
tile_manager_crop (TileManager *tiles,
|
||||
gint border)
|
||||
{
|
||||
PixelRegion PR;
|
||||
TileManager *new_tiles;
|
||||
gint bytes, alpha;
|
||||
guchar *data;
|
||||
gint empty;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
gint ex, ey;
|
||||
gint found;
|
||||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
g_return_val_if_fail (tiles != NULL, NULL);
|
||||
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
ey = PR.y + PR.h;
|
||||
|
||||
for (y = PR.y; y < ey; y++)
|
||||
{
|
||||
found = FALSE;
|
||||
|
||||
for (x = PR.x; x < ex; x++, data+=bytes)
|
||||
if (*data)
|
||||
{
|
||||
if (x < x1)
|
||||
x1 = x;
|
||||
if (x > x2)
|
||||
x2 = x;
|
||||
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
if (y < y1)
|
||||
y1 = y;
|
||||
if (y > y2)
|
||||
y2 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
if (empty)
|
||||
{
|
||||
/* If there are no visible pixels, return NULL */
|
||||
|
||||
new_tiles = NULL;
|
||||
}
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
/* If no cropping, return original buffer */
|
||||
|
||||
new_tiles = tiles;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, crop the original area */
|
||||
|
||||
PixelRegion srcPR, destPR;
|
||||
gint new_width, new_height;
|
||||
|
||||
new_width = (x2 - x1) + border * 2;
|
||||
new_height = (y2 - y1) + border * 2;
|
||||
new_tiles = tile_manager_new (new_width, new_height, bytes);
|
||||
|
||||
/* If there is a border, make sure to clear the new tiles first */
|
||||
if (border)
|
||||
{
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
0, 0, new_width, border,
|
||||
TRUE);
|
||||
color_region (&destPR, black);
|
||||
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
0, border, border, (y2 - y1),
|
||||
TRUE);
|
||||
color_region (&destPR, black);
|
||||
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
new_width - border, border, border, (y2 - y1),
|
||||
TRUE);
|
||||
color_region (&destPR, black);
|
||||
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
0, new_height - border, new_width, border,
|
||||
TRUE);
|
||||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TILE_MANAGER_CROP_H__
|
||||
#define __TILE_MANAGER_CROP_H__
|
||||
|
||||
|
||||
TileManager * tile_manager_crop (TileManager *tiles,
|
||||
gint border);
|
||||
|
||||
|
||||
#endif /* __TILE_MANAGER_CROP_H__ */
|
|
@ -22,9 +22,12 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "core/gimpbrush.h"
|
||||
#include "core/gimpbrushgenerated.h"
|
||||
#include "core/gimpbrushpipe.h"
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
#include "core/gimpgradient.h"
|
||||
|
@ -56,6 +59,16 @@
|
|||
*/
|
||||
GimpContainer *image_context = NULL;
|
||||
|
||||
/*
|
||||
* the global cut buffer
|
||||
*/
|
||||
TileManager *global_buffer = NULL;
|
||||
|
||||
/*
|
||||
* the list of named cut buffers
|
||||
*/
|
||||
GimpContainer *named_buffers = NULL;
|
||||
|
||||
/*
|
||||
* the global data lists
|
||||
*/
|
||||
|
@ -190,6 +203,15 @@ context_manager_init (void)
|
|||
/* Create the context of all existing images */
|
||||
image_context = gimp_list_new (GIMP_TYPE_IMAGE, GIMP_CONTAINER_POLICY_WEAK);
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (image_context));
|
||||
gtk_object_sink (GTK_OBJECT (image_context));
|
||||
|
||||
/* Create the list of all named cut buffers */
|
||||
named_buffers = gimp_list_new (GIMP_TYPE_BUFFER, GIMP_CONTAINER_POLICY_STRONG);
|
||||
|
||||
gtk_object_ref (GTK_OBJECT (named_buffers));
|
||||
gtk_object_sink (GTK_OBJECT (named_buffers));
|
||||
|
||||
/* Create the global data factories */
|
||||
global_brush_factory =
|
||||
gimp_data_factory_new (GIMP_TYPE_BRUSH,
|
||||
|
@ -293,6 +315,18 @@ context_manager_free (void)
|
|||
gimp_data_factory_data_free (global_pattern_factory);
|
||||
gimp_data_factory_data_free (global_gradient_factory);
|
||||
gimp_data_factory_data_free (global_palette_factory);
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (named_buffers));
|
||||
named_buffers = NULL;
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
tile_manager_destroy (global_buffer);
|
||||
global_buffer = NULL;
|
||||
}
|
||||
|
||||
gtk_object_unref (GTK_OBJECT (image_context));
|
||||
image_context = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -25,6 +25,16 @@
|
|||
*/
|
||||
extern GimpContainer *image_context;
|
||||
|
||||
/*
|
||||
* the global cut buffer
|
||||
*/
|
||||
extern TileManager *global_buffer;
|
||||
|
||||
/*
|
||||
* the list of named cut buffers
|
||||
*/
|
||||
extern GimpContainer *named_buffers;
|
||||
|
||||
/*
|
||||
* the global data factories which contain the global data lists
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,8 @@ libappcore_a_SOURCES = @STRIP_BEGIN@ \
|
|||
gimpbrushgenerated.h \
|
||||
gimpbrushpipe.c \
|
||||
gimpbrushpipe.h \
|
||||
gimpbuffer.c \
|
||||
gimpbuffer.h \
|
||||
gimpchannel.c \
|
||||
gimpchannel.h \
|
||||
gimpcontainer.c \
|
||||
|
|
|
@ -76,6 +76,8 @@ typedef struct _GimpContext GimpContext;
|
|||
|
||||
typedef struct _GimpViewable GimpViewable;
|
||||
|
||||
typedef struct _GimpBuffer GimpBuffer;
|
||||
|
||||
typedef struct _GimpToolInfo GimpToolInfo;
|
||||
|
||||
|
||||
|
|
|
@ -29,18 +29,22 @@
|
|||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile-manager-crop.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#include "tools/gimptool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -66,139 +70,10 @@ struct _PasteNamedDialog
|
|||
{
|
||||
GtkWidget *shell;
|
||||
GtkWidget *list;
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
PasteAction action;
|
||||
};
|
||||
|
||||
/* The named buffer structure... */
|
||||
typedef struct _NamedBuffer NamedBuffer;
|
||||
|
||||
struct _NamedBuffer
|
||||
{
|
||||
TileManager *buf;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
|
||||
/* The named buffer list */
|
||||
static GSList *named_buffers = NULL;
|
||||
|
||||
/* The global edit buffer */
|
||||
TileManager *global_buf = NULL;
|
||||
|
||||
|
||||
/* Crop the buffer to the size of pixels with non-zero transparency */
|
||||
|
||||
TileManager *
|
||||
crop_buffer (TileManager *tiles,
|
||||
gboolean border)
|
||||
{
|
||||
PixelRegion PR;
|
||||
TileManager *new_tiles;
|
||||
gint bytes, alpha;
|
||||
guchar *data;
|
||||
gint empty;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
gint ex, ey;
|
||||
gint found;
|
||||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
ey = PR.y + PR.h;
|
||||
|
||||
for (y = PR.y; y < ey; y++)
|
||||
{
|
||||
found = FALSE;
|
||||
for (x = PR.x; x < ex; x++, data+=bytes)
|
||||
if (*data)
|
||||
{
|
||||
if (x < x1)
|
||||
x1 = x;
|
||||
if (x > x2)
|
||||
x2 = x;
|
||||
found = TRUE;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
if (y < y1)
|
||||
y1 = y;
|
||||
if (y > y2)
|
||||
y2 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
int new_width, new_height;
|
||||
|
||||
new_width = (x2 - x1) + border * 2;
|
||||
new_height = (y2 - y1) + border * 2;
|
||||
new_tiles = tile_manager_new (new_width, new_height, bytes);
|
||||
|
||||
/* If there is a border, make sure to clear the new tiles first */
|
||||
if (border)
|
||||
{
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, new_width - border, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, new_height - border, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
edit_cut (GimpImage *gimage,
|
||||
|
@ -206,10 +81,12 @@ edit_cut (GimpImage *gimage,
|
|||
{
|
||||
TileManager *cut;
|
||||
TileManager *cropped_cut;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_CUT_UNDO);
|
||||
|
@ -220,38 +97,39 @@ edit_cut (GimpImage *gimage,
|
|||
/* Next, cut the mask portion from the gimage */
|
||||
cut = gimage_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (cut && empty == FALSE)
|
||||
if (cut && ! empty)
|
||||
{
|
||||
cropped_cut = crop_buffer (cut, FALSE);
|
||||
cropped_cut = tile_manager_crop (cut, 0);
|
||||
|
||||
if (cropped_cut != cut)
|
||||
tile_manager_destroy (cut);
|
||||
{
|
||||
tile_manager_destroy (cut);
|
||||
cut = NULL;
|
||||
}
|
||||
}
|
||||
else if (cut)
|
||||
cropped_cut = cut;
|
||||
else
|
||||
cropped_cut = NULL;
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
if (cropped_cut)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_cut;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_cut;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_cut;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_cut;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
|
@ -260,10 +138,12 @@ edit_copy (GimpImage *gimage,
|
|||
{
|
||||
TileManager *copy;
|
||||
TileManager *cropped_copy;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* See if the gimage mask is empty */
|
||||
empty = gimage_mask_is_empty (gimage);
|
||||
|
@ -271,35 +151,36 @@ edit_copy (GimpImage *gimage,
|
|||
/* First, copy the masked portion of the gimage */
|
||||
copy = gimage_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
||||
|
||||
if (copy)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (copy && empty == FALSE)
|
||||
if (copy && ! empty)
|
||||
{
|
||||
cropped_copy = crop_buffer (copy, FALSE);
|
||||
cropped_copy = tile_manager_crop (copy, 0);
|
||||
|
||||
if (cropped_copy != copy)
|
||||
tile_manager_destroy (copy);
|
||||
{
|
||||
tile_manager_destroy (copy);
|
||||
copy = NULL;
|
||||
}
|
||||
}
|
||||
else if (copy)
|
||||
cropped_copy = copy;
|
||||
else
|
||||
cropped_copy = NULL;
|
||||
|
||||
if(copy)
|
||||
image_new_reset_current_cut_buffer();
|
||||
|
||||
|
||||
if (cropped_copy)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_copy;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_copy;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_copy;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_copy;
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
|
@ -312,8 +193,12 @@ edit_paste (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
gint cx, cy;
|
||||
|
||||
/* Make a new layer: iff drawable == NULL,
|
||||
* user is pasting into an empty display.
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Make a new layer: if drawable == NULL,
|
||||
* user is pasting into an empty image.
|
||||
*/
|
||||
|
||||
if (drawable != NULL)
|
||||
|
@ -329,56 +214,54 @@ edit_paste (GimpImage *gimage,
|
|||
_("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (layer)
|
||||
if (! layer)
|
||||
return NULL;
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
gboolean
|
||||
GimpImage *
|
||||
edit_paste_as_new (GimpImage *invoke,
|
||||
TileManager *paste)
|
||||
{
|
||||
|
@ -386,7 +269,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
GimpLayer *layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (! global_buf)
|
||||
if (! global_buffer)
|
||||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
|
@ -396,7 +279,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gimp_image_undo_disable (gimage);
|
||||
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),
|
||||
paste,
|
||||
|
@ -414,10 +297,10 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
return TRUE;
|
||||
return gimage;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -429,8 +312,10 @@ edit_clear (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
gimp_image_get_background (gimage, drawable, col);
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
|
@ -447,7 +332,7 @@ edit_clear (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
ERASE_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -471,8 +356,10 @@ edit_fill (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
col [gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
|
||||
|
@ -521,7 +408,7 @@ edit_fill (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
NORMAL_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -535,68 +422,6 @@ edit_fill (GimpImage *gimage,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
if (!edit_copy (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste_as_new (GDisplay *gdisp)
|
||||
{
|
||||
if (!global_buf)
|
||||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
||||
void
|
||||
global_edit_free (void)
|
||||
{
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
|
||||
global_buf = NULL;
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
/* Named buffer operations */
|
||||
|
@ -604,19 +429,21 @@ global_edit_free (void)
|
|||
static void
|
||||
set_list_of_named_buffers (GtkWidget *list_widget)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
GtkWidget *list_item;
|
||||
GList *list;
|
||||
GimpBuffer *buffer;
|
||||
GtkWidget *list_item;
|
||||
|
||||
gtk_list_clear_items (GTK_LIST (list_widget), 0, -1);
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
for (list = GIMP_LIST (named_buffers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
buffer = (GimpBuffer *) list->data;
|
||||
|
||||
list_item = gtk_list_item_new_with_label (nb->name);
|
||||
list_item = gtk_list_item_new_with_label (GIMP_OBJECT (buffer)->name);
|
||||
gtk_container_add (GTK_CONTAINER (list_widget), list_item);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), (gpointer) nb);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), buffer);
|
||||
gtk_widget_show (list_item);
|
||||
}
|
||||
}
|
||||
|
@ -626,29 +453,29 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
switch (pn_dialog->action)
|
||||
{
|
||||
case PASTE:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, FALSE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, FALSE);
|
||||
break;
|
||||
|
||||
case PASTE_INTO:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, TRUE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, TRUE);
|
||||
break;
|
||||
|
||||
case PASTE_AS_NEW:
|
||||
edit_paste_as_new (pn_dialog->gdisp->gimage, nb->buf);
|
||||
edit_paste_as_new (pn_dialog->gimage, buffer->tiles);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -656,7 +483,6 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -710,17 +536,14 @@ named_buffer_delete_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
named_buffers = g_slist_remove (named_buffers, nb);
|
||||
g_free (nb->name);
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb);
|
||||
gimp_container_remove (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +561,7 @@ named_buffer_delete_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
paste_named_buffer (GDisplay *gdisp)
|
||||
paste_named_buffer (GimpImage *gimage)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
GtkWidget *vbox;
|
||||
|
@ -764,7 +587,7 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
|
||||
pn_dialog = g_new0 (PasteNamedDialog, 1);
|
||||
|
||||
pn_dialog->gdisp = gdisp;
|
||||
pn_dialog->gimage = gimage;
|
||||
|
||||
pn_dialog->shell =
|
||||
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
|
||||
|
@ -826,126 +649,10 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
gtk_widget_show (pn_dialog->shell);
|
||||
}
|
||||
|
||||
static void
|
||||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = g_new0 (NamedBuffer, 1);
|
||||
|
||||
nb->name = g_strdup (name);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
named_buffers = g_slist_append (named_buffers, nb);
|
||||
}
|
||||
|
||||
static void
|
||||
cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_cut (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_cut (GDisplay *gdisp)
|
||||
named_edit_paste (GimpImage *gimage)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/cut_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
cut_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
paste_named_buffer (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_copy (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
qbox = gimp_query_string_box (_("Copy Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/copy_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
copy_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_paste (GDisplay *gdisp)
|
||||
{
|
||||
paste_named_buffer (gdisp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
named_buffers_free (void)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb->name);
|
||||
g_free (nb);
|
||||
}
|
||||
|
||||
g_slist_free (named_buffers);
|
||||
named_buffers = NULL;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __GLOBAL_EDIT_H__
|
||||
|
||||
|
||||
TileManager * crop_buffer (TileManager *tiles,
|
||||
gint border);
|
||||
|
||||
TileManager * edit_cut (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
TileManager * edit_copy (GimpImage *gimage,
|
||||
|
@ -31,7 +28,7 @@ GimpLayer * edit_paste (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
TileManager *paste,
|
||||
gboolean paste_into);
|
||||
gboolean edit_paste_as_new (GimpImage *gimage,
|
||||
GimpImage * edit_paste_as_new (GimpImage *gimage,
|
||||
TileManager *tiles);
|
||||
gboolean edit_clear (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
|
@ -39,17 +36,7 @@ gboolean edit_fill (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
GimpFillType fill_type);
|
||||
|
||||
gboolean global_edit_cut (GDisplay *gdisp);
|
||||
gboolean global_edit_copy (GDisplay *gdisp);
|
||||
gboolean global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into);
|
||||
gboolean global_edit_paste_as_new (GDisplay *gdisp);
|
||||
void global_edit_free (void);
|
||||
|
||||
gboolean named_edit_cut (GDisplay *gdisp);
|
||||
gboolean named_edit_copy (GDisplay *gdisp);
|
||||
gboolean named_edit_paste (GDisplay *gdisp);
|
||||
void named_buffers_free (void);
|
||||
gboolean named_edit_paste (GimpImage *gimage);
|
||||
|
||||
|
||||
#endif /* __GLOBAL_EDIT_H__ */
|
||||
|
|
|
@ -0,0 +1,184 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/temp-buf.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "gimpbuffer.h"
|
||||
|
||||
|
||||
static void gimp_buffer_class_init (GimpBufferClass *klass);
|
||||
static void gimp_buffer_init (GimpBuffer *buffer);
|
||||
static void gimp_buffer_destroy (GtkObject *object);
|
||||
static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
|
||||
static GimpViewableClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_buffer_get_type (void)
|
||||
{
|
||||
static GtkType buffer_type = 0;
|
||||
|
||||
if (! buffer_type)
|
||||
{
|
||||
static const GtkTypeInfo buffer_info =
|
||||
{
|
||||
"GimpBuffer",
|
||||
sizeof (GimpBuffer),
|
||||
sizeof (GimpBufferClass),
|
||||
(GtkClassInitFunc) gimp_buffer_class_init,
|
||||
(GtkObjectInitFunc) gimp_buffer_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
buffer_type = gtk_type_unique (GIMP_TYPE_VIEWABLE, &buffer_info);
|
||||
}
|
||||
|
||||
return buffer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_class_init (GimpBufferClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
viewable_class = (GimpViewableClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_VIEWABLE);
|
||||
|
||||
object_class->destroy = gimp_buffer_destroy;
|
||||
|
||||
viewable_class->get_new_preview = gimp_buffer_get_new_preview;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_init (GimpBuffer *buffer)
|
||||
{
|
||||
buffer->tiles = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = GIMP_BUFFER (object);
|
||||
|
||||
if (buffer->tiles)
|
||||
{
|
||||
tile_manager_destroy (buffer->tiles);
|
||||
buffer->tiles = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
TempBuf *temp_buf;
|
||||
gint buffer_width;
|
||||
gint buffer_height;
|
||||
PixelRegion srcPR;
|
||||
PixelRegion destPR;
|
||||
gint bytes;
|
||||
gint subsample;
|
||||
|
||||
buffer = GIMP_BUFFER (viewable);
|
||||
buffer_width = tile_manager_width (buffer->tiles);
|
||||
buffer_height = tile_manager_height (buffer->tiles);
|
||||
|
||||
bytes = tile_manager_bpp (buffer->tiles);
|
||||
|
||||
/* calculate 'acceptable' subsample */
|
||||
subsample = 1;
|
||||
|
||||
while ((width * (subsample + 1) * 2 < buffer_width) &&
|
||||
(height * (subsample + 1) * 2 < buffer_height))
|
||||
subsample += 1;
|
||||
|
||||
pixel_region_init (&srcPR, buffer->tiles,
|
||||
0, 0,
|
||||
buffer_width,
|
||||
buffer_height,
|
||||
FALSE);
|
||||
|
||||
temp_buf = temp_buf_new (width, height, bytes, 0, 0, NULL);
|
||||
|
||||
destPR.bytes = temp_buf->bytes;
|
||||
destPR.x = 0;
|
||||
destPR.y = 0;
|
||||
destPR.w = width;
|
||||
destPR.h = height;
|
||||
destPR.rowstride = width * destPR.bytes;
|
||||
destPR.data = temp_buf_data (temp_buf);
|
||||
|
||||
subsample_region (&srcPR, &destPR, subsample);
|
||||
|
||||
return temp_buf;
|
||||
}
|
||||
|
||||
GimpBuffer *
|
||||
gimp_buffer_new (TileManager *tiles,
|
||||
const gchar *name)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
PixelRegion srcPR, destPR;
|
||||
gint width, height;
|
||||
|
||||
g_return_val_if_fail (tiles != NULL, NULL);
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
buffer = GIMP_BUFFER (gtk_type_new (GIMP_TYPE_BUFFER));
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (buffer), name);
|
||||
|
||||
buffer->tiles = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, buffer->tiles, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
return GIMP_BUFFER (buffer);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_BUFFER_H__
|
||||
#define __GIMP_BUFFER_H__
|
||||
|
||||
|
||||
#include "gimpviewable.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BUFFER (gimp_buffer_get_type ())
|
||||
#define GIMP_BUFFER(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BUFFER, GimpBuffer))
|
||||
#define GIMP_BUFFER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUFFER, GimpBufferClass))
|
||||
#define GIMP_IS_BUFFER(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BUFFER))
|
||||
#define GIMP_IS_BUFFER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUFFER))
|
||||
|
||||
|
||||
typedef struct _GimpBufferClass GimpBufferClass;
|
||||
|
||||
struct _GimpBuffer
|
||||
{
|
||||
GimpViewable parent_instance;
|
||||
|
||||
TileManager *tiles;
|
||||
};
|
||||
|
||||
struct _GimpBufferClass
|
||||
{
|
||||
GimpViewableClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_buffer_get_type (void);
|
||||
|
||||
GimpBuffer * gimp_buffer_new (TileManager *tiles,
|
||||
const gchar *name);
|
||||
|
||||
|
||||
#endif /* __GIMP_BUFFER_H__ */
|
|
@ -36,6 +36,7 @@
|
|||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "gimpbrush.h"
|
||||
#include "gimpbuffer.h"
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdatafactory.h"
|
||||
|
@ -187,6 +188,19 @@ static void gimp_context_real_set_palette (GimpContext *context,
|
|||
static void gimp_context_copy_palette (GimpContext *src,
|
||||
GimpContext *dest);
|
||||
|
||||
/* buffer */
|
||||
static void gimp_context_buffer_dirty (GimpBuffer *buffer,
|
||||
GimpContext *context);
|
||||
static void gimp_context_buffer_removed (GimpContainer *container,
|
||||
GimpBuffer *buffer,
|
||||
GimpContext *context);
|
||||
static void gimp_context_buffer_list_thaw (GimpContainer *container,
|
||||
GimpContext *context);
|
||||
static void gimp_context_real_set_buffer (GimpContext *context,
|
||||
GimpBuffer *buffer);
|
||||
static void gimp_context_copy_buffer (GimpContext *src,
|
||||
GimpContext *dest);
|
||||
|
||||
|
||||
/* arguments & signals */
|
||||
|
||||
|
@ -203,7 +217,8 @@ enum
|
|||
ARG_BRUSH,
|
||||
ARG_PATTERN,
|
||||
ARG_GRADIENT,
|
||||
ARG_PALETTE
|
||||
ARG_PALETTE,
|
||||
ARG_BUFFER
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -219,6 +234,7 @@ enum
|
|||
PATTERN_CHANGED,
|
||||
GRADIENT_CHANGED,
|
||||
PALETTE_CHANGED,
|
||||
BUFFER_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -234,7 +250,8 @@ static gchar *gimp_context_arg_names[] =
|
|||
"GimpContext::brush",
|
||||
"GimpContext::pattern",
|
||||
"GimpContext::gradient",
|
||||
"GimpContext::palette"
|
||||
"GimpContext::palette",
|
||||
"GimpContext::buffer"
|
||||
};
|
||||
|
||||
static GimpContextCopyArgFunc gimp_context_copy_arg_funcs[] =
|
||||
|
@ -249,7 +266,8 @@ static GimpContextCopyArgFunc gimp_context_copy_arg_funcs[] =
|
|||
gimp_context_copy_brush,
|
||||
gimp_context_copy_pattern,
|
||||
gimp_context_copy_gradient,
|
||||
gimp_context_copy_palette
|
||||
gimp_context_copy_palette,
|
||||
gimp_context_copy_buffer
|
||||
};
|
||||
|
||||
static GtkType gimp_context_arg_types[] =
|
||||
|
@ -264,6 +282,7 @@ static GtkType gimp_context_arg_types[] =
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -279,7 +298,8 @@ static gchar *gimp_context_signal_names[] =
|
|||
"brush_changed",
|
||||
"pattern_changed",
|
||||
"gradient_changed",
|
||||
"palette_changed"
|
||||
"palette_changed",
|
||||
"buffer_changed"
|
||||
};
|
||||
|
||||
static GtkSignalFunc gimp_context_signal_handlers[] =
|
||||
|
@ -294,7 +314,8 @@ static GtkSignalFunc gimp_context_signal_handlers[] =
|
|||
gimp_context_real_set_brush,
|
||||
gimp_context_real_set_pattern,
|
||||
gimp_context_real_set_gradient,
|
||||
gimp_context_real_set_palette
|
||||
gimp_context_real_set_palette,
|
||||
gimp_context_real_set_buffer
|
||||
};
|
||||
|
||||
|
||||
|
@ -336,6 +357,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
gimp_context_arg_types[GIMP_CONTEXT_ARG_PATTERN] = GIMP_TYPE_PATTERN;
|
||||
gimp_context_arg_types[GIMP_CONTEXT_ARG_GRADIENT] = GIMP_TYPE_GRADIENT;
|
||||
gimp_context_arg_types[GIMP_CONTEXT_ARG_PALETTE] = GIMP_TYPE_PALETTE;
|
||||
gimp_context_arg_types[GIMP_CONTEXT_ARG_BUFFER] = GIMP_TYPE_BUFFER;
|
||||
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[IMAGE_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
|
||||
|
@ -370,6 +392,9 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
gtk_object_add_arg_type (gimp_context_arg_names[PALETTE_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
|
||||
ARG_PALETTE);
|
||||
gtk_object_add_arg_type (gimp_context_arg_names[BUFFER_CHANGED],
|
||||
GTK_TYPE_POINTER, GTK_ARG_READWRITE,
|
||||
ARG_BUFFER);
|
||||
|
||||
gimp_context_signals[IMAGE_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[IMAGE_CHANGED],
|
||||
|
@ -481,6 +506,16 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
gimp_context_signals[BUFFER_CHANGED] =
|
||||
gtk_signal_new (gimp_context_signal_names[BUFFER_CHANGED],
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GimpContextClass,
|
||||
buffer_changed),
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gimp_context_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
|
@ -499,6 +534,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
klass->pattern_changed = NULL;
|
||||
klass->gradient_changed = NULL;
|
||||
klass->palette_changed = NULL;
|
||||
klass->buffer_changed = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -532,6 +568,8 @@ gimp_context_init (GimpContext *context)
|
|||
context->palette = NULL;
|
||||
context->palette_name = NULL;
|
||||
|
||||
context->buffer = NULL;
|
||||
|
||||
context_list = g_slist_prepend (context_list, context);
|
||||
}
|
||||
|
||||
|
@ -610,6 +648,12 @@ gimp_context_destroy (GtkObject *object)
|
|||
context->palette_name = NULL;
|
||||
}
|
||||
|
||||
if (context->buffer)
|
||||
{
|
||||
gtk_object_unref (GTK_OBJECT (context->buffer));
|
||||
context->buffer = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
@ -658,6 +702,9 @@ gimp_context_set_arg (GtkObject *object,
|
|||
case ARG_PALETTE:
|
||||
gimp_context_set_palette (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
case ARG_BUFFER:
|
||||
gimp_context_set_buffer (context, GTK_VALUE_POINTER (*arg));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -707,6 +754,9 @@ gimp_context_get_arg (GtkObject *object,
|
|||
case ARG_PALETTE:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_palette (context);
|
||||
break;
|
||||
case ARG_BUFFER:
|
||||
GTK_VALUE_POINTER (*arg) = gimp_context_get_buffer (context);
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
|
@ -817,6 +867,17 @@ gimp_context_new (const gchar *name,
|
|||
context,
|
||||
GTK_OBJECT (context));
|
||||
|
||||
gtk_signal_connect_while_alive (GTK_OBJECT (named_buffers),
|
||||
"remove",
|
||||
GTK_SIGNAL_FUNC (gimp_context_buffer_removed),
|
||||
context,
|
||||
GTK_OBJECT (context));
|
||||
gtk_signal_connect_while_alive (GTK_OBJECT (named_buffers),
|
||||
"thaw",
|
||||
GTK_SIGNAL_FUNC (gimp_context_buffer_list_thaw),
|
||||
context,
|
||||
GTK_OBJECT (context));
|
||||
|
||||
if (template)
|
||||
{
|
||||
context->defined_args = template->defined_args;
|
||||
|
@ -2348,3 +2409,171 @@ gimp_context_copy_palette (GimpContext *src,
|
|||
dest->palette_name = g_strdup (src->palette_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* buffer ******************************************************************/
|
||||
|
||||
/*
|
||||
static GimpBuffer *standard_buffer = NULL;
|
||||
*/
|
||||
|
||||
GimpBuffer *
|
||||
gimp_context_get_buffer (GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_val_if_fail (context, NULL);
|
||||
|
||||
return context->buffer;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_context_set_buffer (GimpContext *context,
|
||||
GimpBuffer *buffer)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
context_find_defined (context, GIMP_CONTEXT_BUFFER_MASK);
|
||||
|
||||
gimp_context_real_set_buffer (context, buffer);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_context_buffer_changed (GimpContext *context)
|
||||
{
|
||||
context_check_current (context);
|
||||
context_return_if_fail (context);
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (context),
|
||||
gimp_context_signals[BUFFER_CHANGED],
|
||||
context->buffer);
|
||||
}
|
||||
|
||||
/* the active buffer was modified */
|
||||
static void
|
||||
gimp_context_buffer_dirty (GimpBuffer *buffer,
|
||||
GimpContext *context)
|
||||
{
|
||||
/*
|
||||
g_free (context->buffer_name);
|
||||
context->buffer_name = g_strdup (GIMP_OBJECT (buffer)->name);
|
||||
*/
|
||||
|
||||
gimp_context_buffer_changed (context);
|
||||
}
|
||||
|
||||
/* the global gradient list is there again after refresh */
|
||||
static void
|
||||
gimp_context_buffer_list_thaw (GimpContainer *container,
|
||||
GimpContext *context)
|
||||
{
|
||||
/*
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (! context->buffer_name)
|
||||
context->buffer_name = g_strdup (gimprc.default_buffer);
|
||||
|
||||
if ((buffer = (GimpBuffer *)
|
||||
gimp_container_get_child_by_name (container,
|
||||
context->buffer_name)))
|
||||
{
|
||||
gimp_context_real_set_buffer (context, buffer);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (gimp_container_num_children (container))
|
||||
gimp_context_real_set_buffer
|
||||
(context,
|
||||
GIMP_BUFFER (gimp_container_get_child_by_index (container, 0)));
|
||||
else
|
||||
gimp_context_buffer_changed (context);
|
||||
|
||||
/*
|
||||
else
|
||||
gimp_context_real_set_buffer (context,
|
||||
GIMP_BUFFER (gimp_buffer_get_standard ()));
|
||||
*/
|
||||
}
|
||||
|
||||
/* the active buffer disappeared */
|
||||
static void
|
||||
gimp_context_buffer_removed (GimpContainer *container,
|
||||
GimpBuffer *buffer,
|
||||
GimpContext *context)
|
||||
{
|
||||
if (buffer == context->buffer)
|
||||
{
|
||||
context->buffer = NULL;
|
||||
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (buffer),
|
||||
gimp_context_buffer_dirty,
|
||||
context);
|
||||
gtk_object_unref (GTK_OBJECT (buffer));
|
||||
|
||||
if (! gimp_container_frozen (container))
|
||||
gimp_context_buffer_list_thaw (container, context);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_real_set_buffer (GimpContext *context,
|
||||
GimpBuffer *buffer)
|
||||
{
|
||||
/*
|
||||
if (! standard_buffer)
|
||||
standard_buffer = GIMP_BUFFER (gimp_buffer_get_standard ());
|
||||
*/
|
||||
|
||||
if (context->buffer == buffer)
|
||||
return;
|
||||
|
||||
/*
|
||||
if (context->buffer_name && buffer != standard_buffer)
|
||||
{
|
||||
g_free (context->buffer_name);
|
||||
context->buffer_name = NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
/* disconnect from the old buffer's signals */
|
||||
if (context->buffer)
|
||||
{
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (context->buffer),
|
||||
gimp_context_buffer_dirty,
|
||||
context);
|
||||
gtk_object_unref (GTK_OBJECT (context->buffer));
|
||||
}
|
||||
|
||||
context->buffer = buffer;
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
gtk_object_ref (GTK_OBJECT (buffer));
|
||||
gtk_signal_connect (GTK_OBJECT (buffer), "name_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_context_buffer_dirty),
|
||||
context);
|
||||
|
||||
/*
|
||||
if (buffer != standard_buffer)
|
||||
context->buffer_name = g_strdup (GIMP_OBJECT (buffer)->name);
|
||||
*/
|
||||
}
|
||||
|
||||
gimp_context_buffer_changed (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_context_copy_buffer (GimpContext *src,
|
||||
GimpContext *dest)
|
||||
{
|
||||
gimp_context_real_set_buffer (dest, src->buffer);
|
||||
|
||||
/*
|
||||
if ((!src->buffer || src->buffer == standard_buffer) && src->buffer_name)
|
||||
{
|
||||
g_free (dest->buffer_name);
|
||||
dest->buffer_name = g_strdup (src->buffer_name);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef enum
|
|||
GIMP_CONTEXT_ARG_PATTERN,
|
||||
GIMP_CONTEXT_ARG_GRADIENT,
|
||||
GIMP_CONTEXT_ARG_PALETTE,
|
||||
GIMP_CONTEXT_ARG_BUFFER,
|
||||
GIMP_CONTEXT_NUM_ARGS
|
||||
} GimpContextArgType;
|
||||
|
||||
|
@ -61,6 +62,7 @@ typedef enum
|
|||
GIMP_CONTEXT_PATTERN_MASK = 1 << 8,
|
||||
GIMP_CONTEXT_GRADIENT_MASK = 1 << 9,
|
||||
GIMP_CONTEXT_PALETTE_MASK = 1 << 10,
|
||||
GIMP_CONTEXT_BUFFER_MASK = 1 << 11,
|
||||
|
||||
/* aliases */
|
||||
GIMP_CONTEXT_PAINT_ARGS_MASK = (GIMP_CONTEXT_FOREGROUND_MASK |
|
||||
|
@ -74,6 +76,7 @@ typedef enum
|
|||
GIMP_CONTEXT_DISPLAY_MASK |
|
||||
GIMP_CONTEXT_TOOL_MASK |
|
||||
GIMP_CONTEXT_PALETTE_MASK |
|
||||
GIMP_CONTEXT_BUFFER_MASK |
|
||||
GIMP_CONTEXT_PAINT_ARGS_MASK)
|
||||
} GimpContextArgMask;
|
||||
|
||||
|
@ -110,6 +113,8 @@ struct _GimpContext
|
|||
|
||||
GimpPalette *palette;
|
||||
gchar *palette_name;
|
||||
|
||||
GimpBuffer *buffer;
|
||||
};
|
||||
|
||||
struct _GimpContextClass
|
||||
|
@ -140,6 +145,8 @@ struct _GimpContextClass
|
|||
GimpGradient *gradient);
|
||||
void (* palette_changed) (GimpContext *context,
|
||||
GimpPalette *palette);
|
||||
void (* buffer_changed) (GimpContext *context,
|
||||
GimpBuffer *buffer);
|
||||
};
|
||||
|
||||
GtkType gimp_context_get_type (void);
|
||||
|
@ -305,4 +312,11 @@ void gimp_context_set_palette (GimpContext *context,
|
|||
void gimp_context_palette_changed (GimpContext *context);
|
||||
|
||||
|
||||
/* buffer */
|
||||
GimpBuffer * gimp_context_get_buffer (GimpContext *context);
|
||||
void gimp_context_set_buffer (GimpContext *context,
|
||||
GimpBuffer *palette);
|
||||
void gimp_context_buffer_changed (GimpContext *context);
|
||||
|
||||
|
||||
#endif /* __GIMP_CONTEXT_H__ */
|
||||
|
|
|
@ -29,18 +29,22 @@
|
|||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile-manager-crop.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#include "tools/gimptool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -66,139 +70,10 @@ struct _PasteNamedDialog
|
|||
{
|
||||
GtkWidget *shell;
|
||||
GtkWidget *list;
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
PasteAction action;
|
||||
};
|
||||
|
||||
/* The named buffer structure... */
|
||||
typedef struct _NamedBuffer NamedBuffer;
|
||||
|
||||
struct _NamedBuffer
|
||||
{
|
||||
TileManager *buf;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
|
||||
/* The named buffer list */
|
||||
static GSList *named_buffers = NULL;
|
||||
|
||||
/* The global edit buffer */
|
||||
TileManager *global_buf = NULL;
|
||||
|
||||
|
||||
/* Crop the buffer to the size of pixels with non-zero transparency */
|
||||
|
||||
TileManager *
|
||||
crop_buffer (TileManager *tiles,
|
||||
gboolean border)
|
||||
{
|
||||
PixelRegion PR;
|
||||
TileManager *new_tiles;
|
||||
gint bytes, alpha;
|
||||
guchar *data;
|
||||
gint empty;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
gint ex, ey;
|
||||
gint found;
|
||||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
ey = PR.y + PR.h;
|
||||
|
||||
for (y = PR.y; y < ey; y++)
|
||||
{
|
||||
found = FALSE;
|
||||
for (x = PR.x; x < ex; x++, data+=bytes)
|
||||
if (*data)
|
||||
{
|
||||
if (x < x1)
|
||||
x1 = x;
|
||||
if (x > x2)
|
||||
x2 = x;
|
||||
found = TRUE;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
if (y < y1)
|
||||
y1 = y;
|
||||
if (y > y2)
|
||||
y2 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
int new_width, new_height;
|
||||
|
||||
new_width = (x2 - x1) + border * 2;
|
||||
new_height = (y2 - y1) + border * 2;
|
||||
new_tiles = tile_manager_new (new_width, new_height, bytes);
|
||||
|
||||
/* If there is a border, make sure to clear the new tiles first */
|
||||
if (border)
|
||||
{
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, new_width - border, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, new_height - border, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
edit_cut (GimpImage *gimage,
|
||||
|
@ -206,10 +81,12 @@ edit_cut (GimpImage *gimage,
|
|||
{
|
||||
TileManager *cut;
|
||||
TileManager *cropped_cut;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_CUT_UNDO);
|
||||
|
@ -220,38 +97,39 @@ edit_cut (GimpImage *gimage,
|
|||
/* Next, cut the mask portion from the gimage */
|
||||
cut = gimage_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (cut && empty == FALSE)
|
||||
if (cut && ! empty)
|
||||
{
|
||||
cropped_cut = crop_buffer (cut, FALSE);
|
||||
cropped_cut = tile_manager_crop (cut, 0);
|
||||
|
||||
if (cropped_cut != cut)
|
||||
tile_manager_destroy (cut);
|
||||
{
|
||||
tile_manager_destroy (cut);
|
||||
cut = NULL;
|
||||
}
|
||||
}
|
||||
else if (cut)
|
||||
cropped_cut = cut;
|
||||
else
|
||||
cropped_cut = NULL;
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
if (cropped_cut)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_cut;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_cut;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_cut;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_cut;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
|
@ -260,10 +138,12 @@ edit_copy (GimpImage *gimage,
|
|||
{
|
||||
TileManager *copy;
|
||||
TileManager *cropped_copy;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* See if the gimage mask is empty */
|
||||
empty = gimage_mask_is_empty (gimage);
|
||||
|
@ -271,35 +151,36 @@ edit_copy (GimpImage *gimage,
|
|||
/* First, copy the masked portion of the gimage */
|
||||
copy = gimage_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
||||
|
||||
if (copy)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (copy && empty == FALSE)
|
||||
if (copy && ! empty)
|
||||
{
|
||||
cropped_copy = crop_buffer (copy, FALSE);
|
||||
cropped_copy = tile_manager_crop (copy, 0);
|
||||
|
||||
if (cropped_copy != copy)
|
||||
tile_manager_destroy (copy);
|
||||
{
|
||||
tile_manager_destroy (copy);
|
||||
copy = NULL;
|
||||
}
|
||||
}
|
||||
else if (copy)
|
||||
cropped_copy = copy;
|
||||
else
|
||||
cropped_copy = NULL;
|
||||
|
||||
if(copy)
|
||||
image_new_reset_current_cut_buffer();
|
||||
|
||||
|
||||
if (cropped_copy)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_copy;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_copy;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_copy;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_copy;
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
|
@ -312,8 +193,12 @@ edit_paste (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
gint cx, cy;
|
||||
|
||||
/* Make a new layer: iff drawable == NULL,
|
||||
* user is pasting into an empty display.
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Make a new layer: if drawable == NULL,
|
||||
* user is pasting into an empty image.
|
||||
*/
|
||||
|
||||
if (drawable != NULL)
|
||||
|
@ -329,56 +214,54 @@ edit_paste (GimpImage *gimage,
|
|||
_("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (layer)
|
||||
if (! layer)
|
||||
return NULL;
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
gboolean
|
||||
GimpImage *
|
||||
edit_paste_as_new (GimpImage *invoke,
|
||||
TileManager *paste)
|
||||
{
|
||||
|
@ -386,7 +269,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
GimpLayer *layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (! global_buf)
|
||||
if (! global_buffer)
|
||||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
|
@ -396,7 +279,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gimp_image_undo_disable (gimage);
|
||||
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),
|
||||
paste,
|
||||
|
@ -414,10 +297,10 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
return TRUE;
|
||||
return gimage;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -429,8 +312,10 @@ edit_clear (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
gimp_image_get_background (gimage, drawable, col);
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
|
@ -447,7 +332,7 @@ edit_clear (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
ERASE_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -471,8 +356,10 @@ edit_fill (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
col [gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
|
||||
|
@ -521,7 +408,7 @@ edit_fill (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
NORMAL_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -535,68 +422,6 @@ edit_fill (GimpImage *gimage,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
if (!edit_copy (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste_as_new (GDisplay *gdisp)
|
||||
{
|
||||
if (!global_buf)
|
||||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
||||
void
|
||||
global_edit_free (void)
|
||||
{
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
|
||||
global_buf = NULL;
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
/* Named buffer operations */
|
||||
|
@ -604,19 +429,21 @@ global_edit_free (void)
|
|||
static void
|
||||
set_list_of_named_buffers (GtkWidget *list_widget)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
GtkWidget *list_item;
|
||||
GList *list;
|
||||
GimpBuffer *buffer;
|
||||
GtkWidget *list_item;
|
||||
|
||||
gtk_list_clear_items (GTK_LIST (list_widget), 0, -1);
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
for (list = GIMP_LIST (named_buffers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
buffer = (GimpBuffer *) list->data;
|
||||
|
||||
list_item = gtk_list_item_new_with_label (nb->name);
|
||||
list_item = gtk_list_item_new_with_label (GIMP_OBJECT (buffer)->name);
|
||||
gtk_container_add (GTK_CONTAINER (list_widget), list_item);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), (gpointer) nb);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), buffer);
|
||||
gtk_widget_show (list_item);
|
||||
}
|
||||
}
|
||||
|
@ -626,29 +453,29 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
switch (pn_dialog->action)
|
||||
{
|
||||
case PASTE:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, FALSE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, FALSE);
|
||||
break;
|
||||
|
||||
case PASTE_INTO:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, TRUE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, TRUE);
|
||||
break;
|
||||
|
||||
case PASTE_AS_NEW:
|
||||
edit_paste_as_new (pn_dialog->gdisp->gimage, nb->buf);
|
||||
edit_paste_as_new (pn_dialog->gimage, buffer->tiles);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -656,7 +483,6 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -710,17 +536,14 @@ named_buffer_delete_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
named_buffers = g_slist_remove (named_buffers, nb);
|
||||
g_free (nb->name);
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb);
|
||||
gimp_container_remove (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +561,7 @@ named_buffer_delete_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
paste_named_buffer (GDisplay *gdisp)
|
||||
paste_named_buffer (GimpImage *gimage)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
GtkWidget *vbox;
|
||||
|
@ -764,7 +587,7 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
|
||||
pn_dialog = g_new0 (PasteNamedDialog, 1);
|
||||
|
||||
pn_dialog->gdisp = gdisp;
|
||||
pn_dialog->gimage = gimage;
|
||||
|
||||
pn_dialog->shell =
|
||||
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
|
||||
|
@ -826,126 +649,10 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
gtk_widget_show (pn_dialog->shell);
|
||||
}
|
||||
|
||||
static void
|
||||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = g_new0 (NamedBuffer, 1);
|
||||
|
||||
nb->name = g_strdup (name);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
named_buffers = g_slist_append (named_buffers, nb);
|
||||
}
|
||||
|
||||
static void
|
||||
cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_cut (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_cut (GDisplay *gdisp)
|
||||
named_edit_paste (GimpImage *gimage)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/cut_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
cut_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
paste_named_buffer (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_copy (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
qbox = gimp_query_string_box (_("Copy Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/copy_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
copy_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_paste (GDisplay *gdisp)
|
||||
{
|
||||
paste_named_buffer (gdisp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
named_buffers_free (void)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb->name);
|
||||
g_free (nb);
|
||||
}
|
||||
|
||||
g_slist_free (named_buffers);
|
||||
named_buffers = NULL;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __GLOBAL_EDIT_H__
|
||||
|
||||
|
||||
TileManager * crop_buffer (TileManager *tiles,
|
||||
gint border);
|
||||
|
||||
TileManager * edit_cut (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
TileManager * edit_copy (GimpImage *gimage,
|
||||
|
@ -31,7 +28,7 @@ GimpLayer * edit_paste (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
TileManager *paste,
|
||||
gboolean paste_into);
|
||||
gboolean edit_paste_as_new (GimpImage *gimage,
|
||||
GimpImage * edit_paste_as_new (GimpImage *gimage,
|
||||
TileManager *tiles);
|
||||
gboolean edit_clear (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
|
@ -39,17 +36,7 @@ gboolean edit_fill (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
GimpFillType fill_type);
|
||||
|
||||
gboolean global_edit_cut (GDisplay *gdisp);
|
||||
gboolean global_edit_copy (GDisplay *gdisp);
|
||||
gboolean global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into);
|
||||
gboolean global_edit_paste_as_new (GDisplay *gdisp);
|
||||
void global_edit_free (void);
|
||||
|
||||
gboolean named_edit_cut (GDisplay *gdisp);
|
||||
gboolean named_edit_copy (GDisplay *gdisp);
|
||||
gboolean named_edit_paste (GDisplay *gdisp);
|
||||
void named_buffers_free (void);
|
||||
gboolean named_edit_paste (GimpImage *gimage);
|
||||
|
||||
|
||||
#endif /* __GLOBAL_EDIT_H__ */
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -103,12 +103,12 @@ gimp_pattern_class_init (GimpPatternClass *klass)
|
|||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_DATA);
|
||||
|
||||
object_class->destroy = gimp_pattern_destroy;
|
||||
object_class->destroy = gimp_pattern_destroy;
|
||||
|
||||
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
data_class->duplicate = gimp_pattern_duplicate;
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
data_class->duplicate = gimp_pattern_duplicate;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -103,12 +103,12 @@ gimp_pattern_class_init (GimpPatternClass *klass)
|
|||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_DATA);
|
||||
|
||||
object_class->destroy = gimp_pattern_destroy;
|
||||
object_class->destroy = gimp_pattern_destroy;
|
||||
|
||||
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
data_class->duplicate = gimp_pattern_duplicate;
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
data_class->duplicate = gimp_pattern_duplicate;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void
|
|||
gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
/* alternative to using drawable tiles as src1: */
|
||||
|
@ -1151,7 +1151,7 @@ void
|
|||
gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -209,7 +209,7 @@ void gimp_image_free_shadow (GimpImage *gimage);
|
|||
void gimp_image_apply_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
LayerModeEffects mode,
|
||||
TileManager *src1_tiles,
|
||||
|
@ -218,7 +218,7 @@ void gimp_image_apply_image (GimpImage *gimage,
|
|||
void gimp_image_replace_image (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
PixelRegion *src2PR,
|
||||
gint undo,
|
||||
gboolean undo,
|
||||
gint opacity,
|
||||
PixelRegion *maskPR,
|
||||
gint x,
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/gimplayer.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpbufferview.h"
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
|
@ -104,7 +105,7 @@ static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
|||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
static void dialogs_set_data_context_func (GimpDockable *dockable,
|
||||
static void dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
static void dialogs_set_drawable_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -325,7 +326,7 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Brush List", "Brushes",
|
||||
dialogs_brush_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -344,7 +345,7 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Pattern List", "Patterns",
|
||||
dialogs_pattern_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -363,7 +364,7 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Gradient List", "Gradients",
|
||||
dialogs_gradient_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -382,7 +383,7 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Palette List", "Palettes",
|
||||
dialogs_palette_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -402,6 +403,24 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
named_buffers,
|
||||
context,
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Buffer List", "Buffers",
|
||||
NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* grid views */
|
||||
|
||||
|
@ -438,7 +457,7 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Brush Grid", "Brushes",
|
||||
dialogs_brush_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -457,7 +476,7 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Pattern Grid", "Patterns",
|
||||
dialogs_pattern_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -476,7 +495,7 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Gradient Grid", "Gradients",
|
||||
dialogs_gradient_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -495,7 +514,7 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Palette Grid", "Palettes",
|
||||
dialogs_palette_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -515,6 +534,24 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
named_buffers,
|
||||
context,
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Buffer Grid", "Buffers",
|
||||
NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* image related dialogs */
|
||||
|
||||
|
@ -825,17 +862,17 @@ dialogs_set_view_context_func (GimpDockable *dockable,
|
|||
}
|
||||
|
||||
static void
|
||||
dialogs_set_data_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpDataFactoryView *view;
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
view = (GimpDataFactoryView *) gtk_object_get_data (GTK_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
editor = (GimpContainerEditor *) gtk_object_get_data (GTK_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (view)
|
||||
if (editor)
|
||||
{
|
||||
/* TODO: gimp_data_factory_view_set_context (view, context); */
|
||||
/* TODO: gimp_container_editor_set_context (editor, context); */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ GtkWidget * dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
GimpContext *context);
|
||||
GtkWidget * dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
GtkWidget * dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
||||
GtkWidget * dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
@ -85,6 +87,8 @@ GtkWidget * dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
GimpContext *context);
|
||||
GtkWidget * dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
GtkWidget * dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
||||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
|
|
@ -67,12 +67,15 @@ static const GimpDialogFactoryEntry dock_entries[] =
|
|||
{ "gimp:gradient-list", dialogs_gradient_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:palette-list", dialogs_palette_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:tool-list", dialogs_tool_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:buffer-list", dialogs_buffer_list_view_new, FALSE, FALSE, FALSE },
|
||||
|
||||
{ "gimp:image-grid", dialogs_image_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:brush-grid", dialogs_brush_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:pattern-grid", dialogs_pattern_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:gradient-grid", dialogs_gradient_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:palette-grid", dialogs_palette_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:buffer-grid", dialogs_buffer_grid_view_new, FALSE, FALSE, FALSE },
|
||||
|
||||
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
|
||||
|
|
|
@ -54,6 +54,7 @@ typedef struct
|
|||
gdouble size;
|
||||
} NewImageInfo;
|
||||
|
||||
|
||||
/* new image local functions */
|
||||
static void file_new_confirm_dialog (NewImageInfo *);
|
||||
|
||||
|
@ -63,6 +64,7 @@ static void file_new_cancel_callback (GtkWidget *, gpointer);
|
|||
static void file_new_resolution_callback (GtkWidget *, gpointer);
|
||||
static void file_new_image_size_callback (GtkWidget *, gpointer);
|
||||
|
||||
|
||||
static void
|
||||
file_new_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -303,28 +305,6 @@ file_new_image_size_callback (GtkWidget *widget,
|
|||
g_free (text);
|
||||
}
|
||||
|
||||
void
|
||||
file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *image = NULL;
|
||||
|
||||
/* Before we try to determine the responsible gdisplay,
|
||||
* make sure this wasn't called from the toolbox
|
||||
*/
|
||||
if (callback_action)
|
||||
{
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (gdisp)
|
||||
image = gdisp->gimage;
|
||||
}
|
||||
|
||||
image_new_create_window (NULL, image);
|
||||
}
|
||||
|
||||
void
|
||||
ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
||||
{
|
||||
|
@ -344,8 +324,8 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
|||
GtkWidget *spinbutton;
|
||||
GtkWidget *spinbutton2;
|
||||
GtkWidget *radio_box;
|
||||
GSList *group;
|
||||
GList *list;
|
||||
GSList *group;
|
||||
GList *list;
|
||||
|
||||
info = g_new (NewImageInfo, 1);
|
||||
info->values = values = image_new_values_new (values_orig);
|
||||
|
|
|
@ -20,11 +20,7 @@
|
|||
#define __FILE_NEW_DIALOG_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void ui_new_image_window_create (const GimpImageNewValues *values);
|
||||
|
||||
|
||||
#endif /* __FILE_NEW_DIALOG_H_H__ */
|
||||
#endif /* __FILE_NEW_DIALOG_H__ */
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "gui/commands.h"
|
||||
#include "dialog_handler.h"
|
||||
|
||||
#include "appenv.h"
|
||||
|
|
|
@ -29,18 +29,22 @@
|
|||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile-manager-crop.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplist.h"
|
||||
|
||||
#include "tools/gimptool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -66,139 +70,10 @@ struct _PasteNamedDialog
|
|||
{
|
||||
GtkWidget *shell;
|
||||
GtkWidget *list;
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
PasteAction action;
|
||||
};
|
||||
|
||||
/* The named buffer structure... */
|
||||
typedef struct _NamedBuffer NamedBuffer;
|
||||
|
||||
struct _NamedBuffer
|
||||
{
|
||||
TileManager *buf;
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
|
||||
/* The named buffer list */
|
||||
static GSList *named_buffers = NULL;
|
||||
|
||||
/* The global edit buffer */
|
||||
TileManager *global_buf = NULL;
|
||||
|
||||
|
||||
/* Crop the buffer to the size of pixels with non-zero transparency */
|
||||
|
||||
TileManager *
|
||||
crop_buffer (TileManager *tiles,
|
||||
gboolean border)
|
||||
{
|
||||
PixelRegion PR;
|
||||
TileManager *new_tiles;
|
||||
gint bytes, alpha;
|
||||
guchar *data;
|
||||
gint empty;
|
||||
gint x1, y1, x2, y2;
|
||||
gint x, y;
|
||||
gint ex, ey;
|
||||
gint found;
|
||||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
ey = PR.y + PR.h;
|
||||
|
||||
for (y = PR.y; y < ey; y++)
|
||||
{
|
||||
found = FALSE;
|
||||
for (x = PR.x; x < ex; x++, data+=bytes)
|
||||
if (*data)
|
||||
{
|
||||
if (x < x1)
|
||||
x1 = x;
|
||||
if (x > x2)
|
||||
x2 = x;
|
||||
found = TRUE;
|
||||
}
|
||||
if (found)
|
||||
{
|
||||
if (y < y1)
|
||||
y1 = y;
|
||||
if (y > y2)
|
||||
y2 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
int new_width, new_height;
|
||||
|
||||
new_width = (x2 - x1) + border * 2;
|
||||
new_height = (y2 - y1) + border * 2;
|
||||
new_tiles = tile_manager_new (new_width, new_height, bytes);
|
||||
|
||||
/* If there is a border, make sure to clear the new tiles first */
|
||||
if (border)
|
||||
{
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, new_width - border, border, border, (y2 - y1), TRUE);
|
||||
color_region (&destPR, black);
|
||||
pixel_region_init (&destPR, new_tiles, 0, new_height - border, new_width, border, TRUE);
|
||||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
edit_cut (GimpImage *gimage,
|
||||
|
@ -206,10 +81,12 @@ edit_cut (GimpImage *gimage,
|
|||
{
|
||||
TileManager *cut;
|
||||
TileManager *cropped_cut;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_CUT_UNDO);
|
||||
|
@ -220,38 +97,39 @@ edit_cut (GimpImage *gimage,
|
|||
/* Next, cut the mask portion from the gimage */
|
||||
cut = gimage_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (cut && empty == FALSE)
|
||||
if (cut && ! empty)
|
||||
{
|
||||
cropped_cut = crop_buffer (cut, FALSE);
|
||||
cropped_cut = tile_manager_crop (cut, 0);
|
||||
|
||||
if (cropped_cut != cut)
|
||||
tile_manager_destroy (cut);
|
||||
{
|
||||
tile_manager_destroy (cut);
|
||||
cut = NULL;
|
||||
}
|
||||
}
|
||||
else if (cut)
|
||||
cropped_cut = cut;
|
||||
else
|
||||
cropped_cut = NULL;
|
||||
|
||||
if (cut)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
if (cropped_cut)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_cut;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_cut;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_cut;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_cut;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
|
@ -260,10 +138,12 @@ edit_copy (GimpImage *gimage,
|
|||
{
|
||||
TileManager *copy;
|
||||
TileManager *cropped_copy;
|
||||
gint empty;
|
||||
gboolean empty;
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return NULL;
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (drawable != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* See if the gimage mask is empty */
|
||||
empty = gimage_mask_is_empty (gimage);
|
||||
|
@ -271,35 +151,36 @@ edit_copy (GimpImage *gimage,
|
|||
/* First, copy the masked portion of the gimage */
|
||||
copy = gimage_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
||||
|
||||
if (copy)
|
||||
image_new_reset_current_cut_buffer ();
|
||||
|
||||
/* Only crop if the gimage mask wasn't empty */
|
||||
if (copy && empty == FALSE)
|
||||
if (copy && ! empty)
|
||||
{
|
||||
cropped_copy = crop_buffer (copy, FALSE);
|
||||
cropped_copy = tile_manager_crop (copy, 0);
|
||||
|
||||
if (cropped_copy != copy)
|
||||
tile_manager_destroy (copy);
|
||||
{
|
||||
tile_manager_destroy (copy);
|
||||
copy = NULL;
|
||||
}
|
||||
}
|
||||
else if (copy)
|
||||
cropped_copy = copy;
|
||||
else
|
||||
cropped_copy = NULL;
|
||||
|
||||
if(copy)
|
||||
image_new_reset_current_cut_buffer();
|
||||
|
||||
|
||||
if (cropped_copy)
|
||||
{
|
||||
/* Free the old global edit buffer */
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
/* Set the global edit buffer */
|
||||
global_buf = cropped_copy;
|
||||
if (global_buffer)
|
||||
tile_manager_destroy (global_buffer);
|
||||
|
||||
return cropped_copy;
|
||||
/* Set the global edit buffer */
|
||||
global_buffer = cropped_copy;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return cropped_copy;
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
|
@ -312,8 +193,12 @@ edit_paste (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
gint cx, cy;
|
||||
|
||||
/* Make a new layer: iff drawable == NULL,
|
||||
* user is pasting into an empty display.
|
||||
g_return_val_if_fail (gimage != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (! drawable || GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
/* Make a new layer: if drawable == NULL,
|
||||
* user is pasting into an empty image.
|
||||
*/
|
||||
|
||||
if (drawable != NULL)
|
||||
|
@ -329,56 +214,54 @@ edit_paste (GimpImage *gimage,
|
|||
_("Pasted Layer"),
|
||||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
if (layer)
|
||||
if (! layer)
|
||||
return NULL;
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
||||
/* Set the offsets to the center of the image */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
gimp_drawable_offsets (drawable, &cx, &cy);
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
cx += (x1 + x2) >> 1;
|
||||
cy += (y1 + y2) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = gimage->width >> 1;
|
||||
cy = gimage->height >> 1;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
GIMP_DRAWABLE (layer)->offset_x = cx - (GIMP_DRAWABLE (layer)->width >> 1);
|
||||
GIMP_DRAWABLE (layer)->offset_y = cy - (GIMP_DRAWABLE (layer)->height >> 1);
|
||||
|
||||
/* If there is a selection mask clear it--
|
||||
* this might not always be desired, but in general,
|
||||
* it seems like the correct behavior.
|
||||
*/
|
||||
if (! gimage_mask_is_empty (gimage) && ! paste_into)
|
||||
gimp_channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* if there's a drawable, add a new floating selection */
|
||||
if (drawable != NULL)
|
||||
{
|
||||
floating_sel_attach (layer, drawable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_set_gimage (GIMP_DRAWABLE (layer), gimage);
|
||||
gimp_image_add_layer (gimage, layer, 0);
|
||||
}
|
||||
|
||||
/* end the group undo */
|
||||
undo_push_group_end (gimage);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
gboolean
|
||||
GimpImage *
|
||||
edit_paste_as_new (GimpImage *invoke,
|
||||
TileManager *paste)
|
||||
{
|
||||
|
@ -386,7 +269,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
GimpLayer *layer;
|
||||
GDisplay *gdisp;
|
||||
|
||||
if (! global_buf)
|
||||
if (! global_buffer)
|
||||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
|
@ -396,7 +279,7 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gimp_image_undo_disable (gimage);
|
||||
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),
|
||||
paste,
|
||||
|
@ -414,10 +297,10 @@ edit_paste_as_new (GimpImage *invoke,
|
|||
gdisp = gdisplay_new (gimage, 0x0101);
|
||||
gimp_context_set_display (gimp_context_get_user (), gdisp);
|
||||
|
||||
return TRUE;
|
||||
return gimage;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -429,8 +312,10 @@ edit_clear (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
gimp_image_get_background (gimage, drawable, col);
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
|
@ -447,7 +332,7 @@ edit_clear (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
ERASE_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -471,8 +356,10 @@ edit_fill (GimpImage *gimage,
|
|||
gint x1, y1, x2, y2;
|
||||
guchar col[MAX_CHANNELS];
|
||||
|
||||
if (!gimage || drawable == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (gimage != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
|
||||
g_return_val_if_fail (drawable != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
col [gimp_drawable_bytes (drawable) - 1] = OPAQUE_OPACITY;
|
||||
|
@ -521,7 +408,7 @@ edit_fill (GimpImage *gimage,
|
|||
color_region (&bufPR, col);
|
||||
|
||||
pixel_region_init (&bufPR, buf_tiles, 0, 0, (x2 - x1), (y2 - y1), FALSE);
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, 1, OPAQUE_OPACITY,
|
||||
gimp_image_apply_image (gimage, drawable, &bufPR, TRUE, OPAQUE_OPACITY,
|
||||
NORMAL_MODE, NULL, x1, y1);
|
||||
|
||||
/* update the image */
|
||||
|
@ -535,68 +422,6 @@ edit_fill (GimpImage *gimage,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_cut (GDisplay *gdisp)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_cut (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
if (!edit_copy (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (!edit_paste (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buf, paste_into))
|
||||
return FALSE;
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
global_edit_paste_as_new (GDisplay *gdisp)
|
||||
{
|
||||
if (!global_buf)
|
||||
return FALSE;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
return edit_paste_as_new (gdisp->gimage, global_buf);
|
||||
}
|
||||
|
||||
void
|
||||
global_edit_free (void)
|
||||
{
|
||||
if (global_buf)
|
||||
tile_manager_destroy (global_buf);
|
||||
|
||||
global_buf = NULL;
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
/* Named buffer operations */
|
||||
|
@ -604,19 +429,21 @@ global_edit_free (void)
|
|||
static void
|
||||
set_list_of_named_buffers (GtkWidget *list_widget)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
GtkWidget *list_item;
|
||||
GList *list;
|
||||
GimpBuffer *buffer;
|
||||
GtkWidget *list_item;
|
||||
|
||||
gtk_list_clear_items (GTK_LIST (list_widget), 0, -1);
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
for (list = GIMP_LIST (named_buffers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
buffer = (GimpBuffer *) list->data;
|
||||
|
||||
list_item = gtk_list_item_new_with_label (nb->name);
|
||||
list_item = gtk_list_item_new_with_label (GIMP_OBJECT (buffer)->name);
|
||||
gtk_container_add (GTK_CONTAINER (list_widget), list_item);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), (gpointer) nb);
|
||||
gtk_object_set_user_data (GTK_OBJECT (list_item), buffer);
|
||||
gtk_widget_show (list_item);
|
||||
}
|
||||
}
|
||||
|
@ -626,29 +453,29 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
switch (pn_dialog->action)
|
||||
{
|
||||
case PASTE:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, FALSE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, FALSE);
|
||||
break;
|
||||
|
||||
case PASTE_INTO:
|
||||
edit_paste (pn_dialog->gdisp->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gdisp->gimage),
|
||||
nb->buf, TRUE);
|
||||
edit_paste (pn_dialog->gimage,
|
||||
gimp_image_active_drawable (pn_dialog->gimage),
|
||||
buffer->tiles, TRUE);
|
||||
break;
|
||||
|
||||
case PASTE_AS_NEW:
|
||||
edit_paste_as_new (pn_dialog->gdisp->gimage, nb->buf);
|
||||
edit_paste_as_new (pn_dialog->gimage, buffer->tiles);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -656,7 +483,6 @@ named_buffer_paste_foreach (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
/* flush the display */
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
@ -710,17 +536,14 @@ named_buffer_delete_foreach (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
NamedBuffer *nb;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
if (widget->state == GTK_STATE_SELECTED)
|
||||
{
|
||||
pn_dialog = (PasteNamedDialog *) data;
|
||||
nb = (NamedBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
buffer = (GimpBuffer *) gtk_object_get_user_data (GTK_OBJECT (widget));
|
||||
|
||||
named_buffers = g_slist_remove (named_buffers, nb);
|
||||
g_free (nb->name);
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb);
|
||||
gimp_container_remove (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +561,7 @@ named_buffer_delete_callback (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
paste_named_buffer (GDisplay *gdisp)
|
||||
paste_named_buffer (GimpImage *gimage)
|
||||
{
|
||||
PasteNamedDialog *pn_dialog;
|
||||
GtkWidget *vbox;
|
||||
|
@ -764,7 +587,7 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
|
||||
pn_dialog = g_new0 (PasteNamedDialog, 1);
|
||||
|
||||
pn_dialog->gdisp = gdisp;
|
||||
pn_dialog->gimage = gimage;
|
||||
|
||||
pn_dialog->shell =
|
||||
gimp_dialog_new (_("Paste Named Buffer"), "paste_named_buffer",
|
||||
|
@ -826,126 +649,10 @@ paste_named_buffer (GDisplay *gdisp)
|
|||
gtk_widget_show (pn_dialog->shell);
|
||||
}
|
||||
|
||||
static void
|
||||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = g_new0 (NamedBuffer, 1);
|
||||
|
||||
nb->name = g_strdup (name);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
named_buffers = g_slist_append (named_buffers, nb);
|
||||
}
|
||||
|
||||
static void
|
||||
cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_cut (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_cut (GDisplay *gdisp)
|
||||
named_edit_paste (GimpImage *gimage)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/cut_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
cut_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
paste_named_buffer (gimage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_copy (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
new_named_buffer (new_tiles, name);
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_copy (GDisplay *gdisp)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
|
||||
qbox = gimp_query_string_box (_("Copy Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/copy_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
copy_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
named_edit_paste (GDisplay *gdisp)
|
||||
{
|
||||
paste_named_buffer (gdisp);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
named_buffers_free (void)
|
||||
{
|
||||
GSList *list;
|
||||
NamedBuffer *nb;
|
||||
|
||||
for (list = named_buffers; list; list = g_slist_next (list))
|
||||
{
|
||||
nb = (NamedBuffer *) list->data;
|
||||
|
||||
tile_manager_destroy (nb->buf);
|
||||
g_free (nb->name);
|
||||
g_free (nb);
|
||||
}
|
||||
|
||||
g_slist_free (named_buffers);
|
||||
named_buffers = NULL;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#define __GLOBAL_EDIT_H__
|
||||
|
||||
|
||||
TileManager * crop_buffer (TileManager *tiles,
|
||||
gint border);
|
||||
|
||||
TileManager * edit_cut (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
TileManager * edit_copy (GimpImage *gimage,
|
||||
|
@ -31,7 +28,7 @@ GimpLayer * edit_paste (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
TileManager *paste,
|
||||
gboolean paste_into);
|
||||
gboolean edit_paste_as_new (GimpImage *gimage,
|
||||
GimpImage * edit_paste_as_new (GimpImage *gimage,
|
||||
TileManager *tiles);
|
||||
gboolean edit_clear (GimpImage *gimage,
|
||||
GimpDrawable *drawable);
|
||||
|
@ -39,17 +36,7 @@ gboolean edit_fill (GimpImage *gimage,
|
|||
GimpDrawable *drawable,
|
||||
GimpFillType fill_type);
|
||||
|
||||
gboolean global_edit_cut (GDisplay *gdisp);
|
||||
gboolean global_edit_copy (GDisplay *gdisp);
|
||||
gboolean global_edit_paste (GDisplay *gdisp,
|
||||
gboolean paste_into);
|
||||
gboolean global_edit_paste_as_new (GDisplay *gdisp);
|
||||
void global_edit_free (void);
|
||||
|
||||
gboolean named_edit_cut (GDisplay *gdisp);
|
||||
gboolean named_edit_copy (GDisplay *gdisp);
|
||||
gboolean named_edit_paste (GDisplay *gdisp);
|
||||
void named_buffers_free (void);
|
||||
gboolean named_edit_paste (GimpImage *gimage);
|
||||
|
||||
|
||||
#endif /* __GLOBAL_EDIT_H__ */
|
||||
|
|
|
@ -30,6 +30,10 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
|
|||
dialogs-commands.h \
|
||||
dialogs-constructors.c \
|
||||
dialogs-constructors.h \
|
||||
edit-commands.c \
|
||||
edit-commands.h \
|
||||
file-commands.c \
|
||||
file-commands.h \
|
||||
file-dialog-utils.c \
|
||||
file-dialog-utils.h \
|
||||
file-new-dialog.c \
|
||||
|
@ -44,6 +48,8 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
|
|||
gradient-select.c \
|
||||
gui.c \
|
||||
gui.h \
|
||||
image-commands.c \
|
||||
image-commands.h \
|
||||
indicator-area.c \
|
||||
indicator-area.h \
|
||||
info-dialog.c \
|
||||
|
@ -74,6 +80,8 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
|
|||
resize-dialog.h \
|
||||
resolution-calibrate-dialog.c \
|
||||
resolution-calibrate-dialog.h \
|
||||
select-commands.c \
|
||||
select-commands.h \
|
||||
session.c \
|
||||
session.h \
|
||||
splash.c \
|
||||
|
@ -86,6 +94,8 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
|
|||
tool-options-dialog.h \
|
||||
toolbox.c \
|
||||
toolbox.h \
|
||||
view-commands.c \
|
||||
view-commands.h \
|
||||
@STRIP_END@
|
||||
|
||||
EXTRA_DIST = @STRIP_BEGIN@ \
|
||||
|
|
1206
app/gui/commands.c
1206
app/gui/commands.c
File diff suppressed because it is too large
Load Diff
|
@ -20,89 +20,24 @@
|
|||
#define __COMMANDS_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *, gpointer, guint);
|
||||
void file_open_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_a_copy_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_revert_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_pref_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_close_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_quit_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void edit_undo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_redo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_into_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_as_new_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_clear_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
void edit_stroke_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void select_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_all_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_none_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_float_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_feather_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_sharpen_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_shrink_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_border_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_grow_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_save_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void view_zoomin_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoomout_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_16_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_8_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_4_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_2_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_2_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_4_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_8_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_16_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_dot_for_dot_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_info_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_nav_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_rulers_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_statusbar_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_snap_to_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void help_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_context_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void help_context_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __COMMANDS_H__ */
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/gimplayer.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpbufferview.h"
|
||||
#include "widgets/gimpcontainerlistview.h"
|
||||
#include "widgets/gimpcontainergridview.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
|
@ -104,7 +105,7 @@ static GtkWidget * dialogs_tool_tab_func (GimpDockable *dockable,
|
|||
|
||||
static void dialogs_set_view_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
static void dialogs_set_data_context_func (GimpDockable *dockable,
|
||||
static void dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
static void dialogs_set_drawable_context_func (GimpDockable *dockable,
|
||||
GimpContext *context);
|
||||
|
@ -325,7 +326,7 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Brush List", "Brushes",
|
||||
dialogs_brush_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -344,7 +345,7 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Pattern List", "Patterns",
|
||||
dialogs_pattern_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -363,7 +364,7 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Gradient List", "Gradients",
|
||||
dialogs_gradient_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -382,7 +383,7 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Palette List", "Palettes",
|
||||
dialogs_palette_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -402,6 +403,24 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
|||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
named_buffers,
|
||||
context,
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Buffer List", "Buffers",
|
||||
NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* grid views */
|
||||
|
||||
|
@ -438,7 +457,7 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Brush Grid", "Brushes",
|
||||
dialogs_brush_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -457,7 +476,7 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Pattern Grid", "Patterns",
|
||||
dialogs_pattern_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -476,7 +495,7 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Gradient Grid", "Gradients",
|
||||
dialogs_gradient_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -495,7 +514,7 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
return dialogs_dockable_new (view,
|
||||
"Palette Grid", "Palettes",
|
||||
dialogs_palette_tab_func,
|
||||
dialogs_set_data_context_func);
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -515,6 +534,24 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
|||
dialogs_set_view_context_func);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context)
|
||||
{
|
||||
GtkWidget *view;
|
||||
|
||||
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
named_buffers,
|
||||
context,
|
||||
32,
|
||||
5, 3);
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
"Buffer Grid", "Buffers",
|
||||
NULL,
|
||||
dialogs_set_editor_context_func);
|
||||
}
|
||||
|
||||
|
||||
/* image related dialogs */
|
||||
|
||||
|
@ -825,17 +862,17 @@ dialogs_set_view_context_func (GimpDockable *dockable,
|
|||
}
|
||||
|
||||
static void
|
||||
dialogs_set_data_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
dialogs_set_editor_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpDataFactoryView *view;
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
view = (GimpDataFactoryView *) gtk_object_get_data (GTK_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
editor = (GimpContainerEditor *) gtk_object_get_data (GTK_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (view)
|
||||
if (editor)
|
||||
{
|
||||
/* TODO: gimp_data_factory_view_set_context (view, context); */
|
||||
/* TODO: gimp_container_editor_set_context (editor, context); */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ GtkWidget * dialogs_palette_list_view_new (GimpDialogFactory *factory,
|
|||
GimpContext *context);
|
||||
GtkWidget * dialogs_tool_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
GtkWidget * dialogs_buffer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
||||
GtkWidget * dialogs_image_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
@ -85,6 +87,8 @@ GtkWidget * dialogs_palette_grid_view_new (GimpDialogFactory *factory,
|
|||
GimpContext *context);
|
||||
GtkWidget * dialogs_tool_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
GtkWidget * dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
||||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context);
|
||||
|
|
|
@ -67,12 +67,15 @@ static const GimpDialogFactoryEntry dock_entries[] =
|
|||
{ "gimp:gradient-list", dialogs_gradient_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:palette-list", dialogs_palette_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:tool-list", dialogs_tool_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:buffer-list", dialogs_buffer_list_view_new, FALSE, FALSE, FALSE },
|
||||
|
||||
{ "gimp:image-grid", dialogs_image_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:brush-grid", dialogs_brush_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:pattern-grid", dialogs_pattern_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:gradient-grid", dialogs_gradient_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:palette-grid", dialogs_palette_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:buffer-grid", dialogs_buffer_grid_view_new, FALSE, FALSE, FALSE },
|
||||
|
||||
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
|
||||
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "edit-commands.h"
|
||||
|
||||
#include "context_manager.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data);
|
||||
static void copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
edit_undo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_pop (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_redo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
undo_redo (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_cut (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage)))
|
||||
{
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_copy (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage));
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buffer,
|
||||
FALSE))
|
||||
{
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_into_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
if (edit_paste (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
global_buffer,
|
||||
TRUE))
|
||||
{
|
||||
gdisplays_update_title (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_paste_as_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (global_buffer)
|
||||
{
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
edit_paste_as_new (gdisp->gimage,
|
||||
global_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
/* stop any active tool */
|
||||
tool_manager_control_active (HALT, gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Cut Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/cut_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
cut_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GtkWidget *qbox;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_string_box (_("Copy Named"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/copy_named.html",
|
||||
_("Enter a name for this buffer"),
|
||||
NULL,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
copy_named_buffer_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
edit_named_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
named_edit_paste (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
edit_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
edit_clear (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpFillType fill_type;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
fill_type = (GimpFillType) action;
|
||||
|
||||
edit_fill (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage),
|
||||
fill_type);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
edit_stroke_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_stroke (gdisp->gimage, gimp_image_active_drawable (gdisp->gimage));
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
cut_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_cut (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_buffer_new (new_tiles, name);
|
||||
gimp_container_add (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
copy_named_buffer_callback (GtkWidget *widget,
|
||||
gchar *name,
|
||||
gpointer data)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = (GimpImage *) data;
|
||||
|
||||
new_tiles = edit_copy (gimage, gimp_image_active_drawable (gimage));
|
||||
|
||||
if (new_tiles)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
|
||||
buffer = gimp_buffer_new (new_tiles, name);
|
||||
gimp_container_add (named_buffers, GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __EDIT_COMMANDS_H__
|
||||
#define __EDIT_COMMANDS_H__
|
||||
|
||||
|
||||
void edit_undo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_redo_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_into_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_paste_as_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_cut_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_copy_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_named_paste_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void edit_stroke_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __EDIT_COMMANDS_H__ */
|
|
@ -0,0 +1,115 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "file-commands.h"
|
||||
#include "file-new-dialog.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "image_new.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
void
|
||||
file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *image = NULL;
|
||||
|
||||
/* Before we try to determine the responsible gdisplay,
|
||||
* make sure this wasn't called from the toolbox
|
||||
*/
|
||||
if (action)
|
||||
{
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (gdisp)
|
||||
image = gdisp->gimage;
|
||||
}
|
||||
|
||||
image_new_create_window (NULL, image);
|
||||
}
|
||||
|
||||
void
|
||||
file_open_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_open_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_as_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_save_a_copy_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_save_a_copy_as_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_revert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
file_revert_callback (widget, data);
|
||||
}
|
||||
|
||||
void
|
||||
file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_close_window (gdisp, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
file_quit_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
app_exit (FALSE);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __FILE_COMMANDS_H__
|
||||
#define __FILE_COMMANDS_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void file_open_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_save_a_copy_as_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_revert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_pref_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_close_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void file_quit_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __FILE_COMMANDS_H__ */
|
|
@ -54,6 +54,7 @@ typedef struct
|
|||
gdouble size;
|
||||
} NewImageInfo;
|
||||
|
||||
|
||||
/* new image local functions */
|
||||
static void file_new_confirm_dialog (NewImageInfo *);
|
||||
|
||||
|
@ -63,6 +64,7 @@ static void file_new_cancel_callback (GtkWidget *, gpointer);
|
|||
static void file_new_resolution_callback (GtkWidget *, gpointer);
|
||||
static void file_new_image_size_callback (GtkWidget *, gpointer);
|
||||
|
||||
|
||||
static void
|
||||
file_new_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -303,28 +305,6 @@ file_new_image_size_callback (GtkWidget *widget,
|
|||
g_free (text);
|
||||
}
|
||||
|
||||
void
|
||||
file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *image = NULL;
|
||||
|
||||
/* Before we try to determine the responsible gdisplay,
|
||||
* make sure this wasn't called from the toolbox
|
||||
*/
|
||||
if (callback_action)
|
||||
{
|
||||
gdisp = gdisplay_active ();
|
||||
|
||||
if (gdisp)
|
||||
image = gdisp->gimage;
|
||||
}
|
||||
|
||||
image_new_create_window (NULL, image);
|
||||
}
|
||||
|
||||
void
|
||||
ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
||||
{
|
||||
|
@ -344,8 +324,8 @@ ui_new_image_window_create (const GimpImageNewValues *values_orig)
|
|||
GtkWidget *spinbutton;
|
||||
GtkWidget *spinbutton2;
|
||||
GtkWidget *radio_box;
|
||||
GSList *group;
|
||||
GList *list;
|
||||
GSList *group;
|
||||
GList *list;
|
||||
|
||||
info = g_new (NewImageInfo, 1);
|
||||
info->values = values = image_new_values_new (values_orig);
|
||||
|
|
|
@ -20,11 +20,7 @@
|
|||
#define __FILE_NEW_DIALOG_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void ui_new_image_window_create (const GimpImageNewValues *values);
|
||||
|
||||
|
||||
#endif /* __FILE_NEW_DIALOG_H_H__ */
|
||||
#endif /* __FILE_NEW_DIALOG_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,89 +20,24 @@
|
|||
#define __COMMANDS_H__
|
||||
|
||||
|
||||
void file_new_cmd_callback (GtkWidget *, gpointer, guint);
|
||||
void file_open_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_save_a_copy_as_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_revert_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_pref_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_close_cmd_callback (GtkWidget *, gpointer);
|
||||
void file_quit_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void edit_undo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_redo_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_into_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_paste_as_new_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_cut_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_copy_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_named_paste_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_clear_cmd_callback (GtkWidget *, gpointer);
|
||||
void edit_fill_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
void edit_stroke_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
void select_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_all_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_none_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_float_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_feather_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_sharpen_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_shrink_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_border_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_grow_cmd_callback (GtkWidget *, gpointer);
|
||||
void select_save_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void view_zoomin_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoomout_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_16_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_8_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_4_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_2_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_1_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_2_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_4_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_8_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_zoom_1_16_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_dot_for_dot_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_info_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_nav_window_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_rulers_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_statusbar_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_toggle_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_snap_to_guides_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_new_view_cmd_callback (GtkWidget *, gpointer);
|
||||
void view_shrink_wrap_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_desaturate_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_invert_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_equalize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_offset_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_resize_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_scale_cmd_callback (GtkWidget *, gpointer);
|
||||
void image_duplicate_cmd_callback (GtkWidget *, gpointer);
|
||||
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_contexts_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void filters_repeat_cmd_callback (GtkWidget *widget,
|
||||
gpointer callback_data,
|
||||
guint callback_action);
|
||||
|
||||
void help_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_context_help_cmd_callback (GtkWidget *, gpointer);
|
||||
void help_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void help_context_help_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __COMMANDS_H__ */
|
||||
|
|
|
@ -0,0 +1,440 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-desaturate.h"
|
||||
#include "core/gimpdrawable-equalize.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-duplicate.h"
|
||||
|
||||
#include "pdb/procedural_db.h"
|
||||
|
||||
#include "convert-dialog.h"
|
||||
#include "offset-dialog.h"
|
||||
#include "resize-dialog.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void image_resize_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data);
|
||||
static void image_scale_implement (ImageResize *image_scale);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
image_convert_rgb_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_rgb (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_grayscale (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_convert_indexed_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
convert_to_indexed (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (! gimp_drawable_is_rgb (drawable))
|
||||
{
|
||||
g_message (_("Desaturate operates only on RGB color drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_drawable_desaturate (drawable);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
Argument *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (gimp_drawable_is_indexed (drawable))
|
||||
{
|
||||
g_message (_("Invert does not operate on indexed drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
return_vals =
|
||||
procedural_db_run_proc ("gimp_invert",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
||||
g_message (_("Invert operation failed."));
|
||||
|
||||
procedural_db_destroy_args (return_vals, nreturn_vals);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_equalize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpDrawable *drawable;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (gimp_drawable_is_indexed (drawable))
|
||||
{
|
||||
g_message (_("Equalize does not operate on indexed drawables."));
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_drawable_equalize (drawable, TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
image_offset_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
offset_dialog_create (gdisp->gimage);
|
||||
}
|
||||
|
||||
void
|
||||
image_resize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_resize;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_resize = g_new0 (ImageResize, 1);
|
||||
|
||||
image_resize->gimage = gimage;
|
||||
image_resize->resize = resize_widget_new (ResizeWidget,
|
||||
ResizeImage,
|
||||
GTK_OBJECT (gimage),
|
||||
"destroy",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
gdisp->dot_for_dot,
|
||||
image_resize_callback,
|
||||
NULL,
|
||||
image_resize);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (image_resize->resize->resize_shell),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (g_free),
|
||||
(GtkObject *) image_resize);
|
||||
|
||||
gtk_widget_show (image_resize->resize->resize_shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_scale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
ImageResize *image_scale;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
image_scale = g_new0 (ImageResize, 1);
|
||||
|
||||
image_scale->gimage = gimage;
|
||||
image_scale->resize = resize_widget_new (ScaleWidget,
|
||||
ResizeImage,
|
||||
GTK_OBJECT (gimage),
|
||||
"destroy",
|
||||
gimage->width,
|
||||
gimage->height,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution,
|
||||
gimage->unit,
|
||||
gdisp->dot_for_dot,
|
||||
image_scale_callback,
|
||||
NULL,
|
||||
image_scale);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (image_scale->resize->resize_shell),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC (g_free),
|
||||
(GtkObject *) image_scale);
|
||||
|
||||
gtk_widget_show (image_scale->resize->resize_shell);
|
||||
}
|
||||
|
||||
void
|
||||
image_duplicate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new (gimp_image_duplicate (gdisp->gimage), 0x0101);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
image_resize_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_resize;
|
||||
|
||||
image_resize = (ImageResize *) data;
|
||||
|
||||
g_assert (image_resize != NULL);
|
||||
g_assert (image_resize->gimage != NULL);
|
||||
|
||||
gtk_widget_set_sensitive (image_resize->resize->resize_shell, FALSE);
|
||||
|
||||
if (image_resize->resize->width > 0 &&
|
||||
image_resize->resize->height > 0)
|
||||
{
|
||||
gimp_image_resize (image_resize->gimage,
|
||||
image_resize->resize->width,
|
||||
image_resize->resize->height,
|
||||
image_resize->resize->offset_x,
|
||||
image_resize->resize->offset_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message (_("Resize Error: Both width and height must be "
|
||||
"greater than zero."));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (image_resize->resize->resize_shell);
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
|
||||
image_scale = (ImageResize *) data;
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
|
||||
gtk_widget_set_sensitive (image_scale->resize->resize_shell, FALSE);
|
||||
|
||||
if (gimp_image_check_scaling (image_scale->gimage,
|
||||
image_scale->resize->width,
|
||||
image_scale->resize->height))
|
||||
{
|
||||
image_scale_implement (image_scale);
|
||||
|
||||
gtk_widget_destroy (image_scale->resize->resize_shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog =
|
||||
gimp_query_boolean_box (_("Layer Too Small"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/scale_layer_warn.html",
|
||||
FALSE,
|
||||
_("The chosen image size will shrink\n"
|
||||
"some layers completely away.\n"
|
||||
"Is this what you want?"),
|
||||
_("OK"), _("Cancel"),
|
||||
GTK_OBJECT (image_scale->resize->resize_shell),
|
||||
"destroy",
|
||||
image_scale_warn_callback,
|
||||
image_scale);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_warn_callback (GtkWidget *widget,
|
||||
gboolean do_scale,
|
||||
gpointer data)
|
||||
{
|
||||
ImageResize *image_scale;
|
||||
GimpImage *gimage;
|
||||
|
||||
image_scale = (ImageResize *) data;
|
||||
gimage = image_scale->gimage;
|
||||
|
||||
if (do_scale) /* User doesn't mind losing layers... */
|
||||
{
|
||||
image_scale_implement (image_scale);
|
||||
|
||||
gtk_widget_destroy (image_scale->resize->resize_shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (image_scale->resize->resize_shell, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
image_scale_implement (ImageResize *image_scale)
|
||||
{
|
||||
GimpImage *gimage = NULL;
|
||||
gboolean rulers_flush = FALSE;
|
||||
gboolean display_flush = FALSE; /* this is a bit ugly:
|
||||
we hijack the flush variable
|
||||
to check if an undo_group was
|
||||
already started */
|
||||
|
||||
g_assert (image_scale != NULL);
|
||||
g_assert (image_scale->gimage != NULL);
|
||||
|
||||
gimage = image_scale->gimage;
|
||||
|
||||
if (image_scale->resize->resolution_x != gimage->xresolution ||
|
||||
image_scale->resize->resolution_y != gimage->yresolution)
|
||||
{
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_set_resolution (gimage,
|
||||
image_scale->resize->resolution_x,
|
||||
image_scale->resize->resolution_y);
|
||||
|
||||
rulers_flush = TRUE;
|
||||
display_flush = TRUE;
|
||||
}
|
||||
|
||||
if (image_scale->resize->unit != gimage->unit)
|
||||
{
|
||||
if (!display_flush)
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_set_unit (gimage, image_scale->resize->unit);
|
||||
gdisplays_setup_scale (gimage);
|
||||
gdisplays_resize_cursor_label (gimage);
|
||||
|
||||
rulers_flush = TRUE;
|
||||
display_flush = TRUE;
|
||||
}
|
||||
|
||||
if (image_scale->resize->width != gimage->width ||
|
||||
image_scale->resize->height != gimage->height)
|
||||
{
|
||||
if (image_scale->resize->width > 0 &&
|
||||
image_scale->resize->height > 0)
|
||||
{
|
||||
if (!display_flush)
|
||||
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
|
||||
|
||||
gimp_image_scale (gimage,
|
||||
image_scale->resize->width,
|
||||
image_scale->resize->height);
|
||||
|
||||
display_flush = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message (_("Scale Error: Both width and height must be "
|
||||
"greater than zero."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (rulers_flush)
|
||||
{
|
||||
gdisplays_setup_scale (gimage);
|
||||
gdisplays_resize_cursor_label (gimage);
|
||||
}
|
||||
|
||||
if (display_flush)
|
||||
{
|
||||
undo_push_group_end (gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __IMAGE_COMMANDS_H__
|
||||
#define __IMAGE_COMMANDS_H__
|
||||
|
||||
|
||||
void image_convert_rgb_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_convert_grayscale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_convert_indexed_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_desaturate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_equalize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_offset_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_resize_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_scale_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void image_duplicate_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __IMAGE_COMMANDS_H__ */
|
|
@ -46,13 +46,18 @@
|
|||
#include "commands.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "dialogs-commands.h"
|
||||
#include "edit-commands.h"
|
||||
#include "file-commands.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
#include "gdisplay.h"
|
||||
#include "image-commands.h"
|
||||
#include "layers-commands.h"
|
||||
#include "menus.h"
|
||||
#include "paths-dialog.h"
|
||||
#include "select-commands.h"
|
||||
#include "test-commands.h"
|
||||
#include "view-commands.h"
|
||||
|
||||
#include "gimphelp.h"
|
||||
#include "gimprc.h"
|
||||
|
@ -370,23 +375,23 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
|
||||
/* <Image>/View/Zoom */
|
||||
|
||||
{ { N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/16:1"), NULL, view_zoom_cmd_callback, 1601 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/8:1"), NULL, view_zoom_8_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/8:1"), NULL, view_zoom_cmd_callback, 801 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/4:1"), NULL, view_zoom_4_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/4:1"), NULL, view_zoom_cmd_callback, 401 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/2:1"), NULL, view_zoom_2_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/2:1"), NULL, view_zoom_cmd_callback, 201 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:1"), "1", view_zoom_1_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:1"), "1", view_zoom_cmd_callback, 101 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:2"), NULL, view_zoom_1_2_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:2"), NULL, view_zoom_cmd_callback, 102 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:4"), NULL, view_zoom_1_4_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:4"), NULL, view_zoom_cmd_callback, 104 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:8"), NULL, view_zoom_1_8_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:8"), NULL, view_zoom_cmd_callback, 108 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:16"), NULL, view_zoom_1_16_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:16"), NULL, view_zoom_cmd_callback, 116 },
|
||||
"view/zoom.html", NULL },
|
||||
|
||||
{ { N_("/View/Dot for Dot"), NULL, view_dot_for_dot_cmd_callback, 0, "<ToggleItem>" },
|
||||
|
@ -929,6 +934,16 @@ static GimpItemFactoryEntry dialogs_entries[] =
|
|||
NULL, NULL },
|
||||
{ { N_("/Add Tab/Image Grid..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:image-grid") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { N_("/Add Tab/Buffer List..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:buffer-list") },
|
||||
NULL, NULL },
|
||||
{ { N_("/Add Tab/Buffer Grid..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:buffer-grid") },
|
||||
NULL, NULL }
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
|
|
|
@ -490,7 +490,7 @@ palette_dialog_new (gboolean editor)
|
|||
}
|
||||
|
||||
if (editor)
|
||||
gtk_list_set_selection_mode (GTK_LIST (GIMP_CONTAINER_LIST_VIEW (GIMP_DATA_FACTORY_VIEW (palette_dialog->view)->view)->gtk_list),
|
||||
gtk_list_set_selection_mode (GTK_LIST (GIMP_CONTAINER_LIST_VIEW (GIMP_CONTAINER_EDITOR (palette_dialog->view)->view)->gtk_list),
|
||||
GTK_SELECTION_EXTENDED);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (palette_dialog->context), "palette_changed",
|
||||
|
@ -1310,7 +1310,7 @@ palette_dialog_do_merge_callback (GtkWidget *widget,
|
|||
|
||||
palette_dialog = (PaletteDialog *) data;
|
||||
|
||||
sel_list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (GIMP_DATA_FACTORY_VIEW (palette_dialog->view)->view)->gtk_list)->selection;
|
||||
sel_list = GTK_LIST (GIMP_CONTAINER_LIST_VIEW (GIMP_CONTAINER_EDITOR (palette_dialog->view)->view)->gtk_list)->selection;
|
||||
|
||||
while (sel_list)
|
||||
{
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -0,0 +1,380 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void gimage_mask_feather_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_border_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_grow_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
static void gimage_mask_shrink_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* local variables */
|
||||
|
||||
static gdouble selection_feather_radius = 5.0;
|
||||
static gint selection_border_radius = 5;
|
||||
static gint selection_grow_pixels = 1;
|
||||
static gint selection_shrink_pixels = 1;
|
||||
static gboolean selection_shrink_edge_lock = FALSE;
|
||||
|
||||
|
||||
void
|
||||
select_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_invert (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_all (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_none_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_none (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_float_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_float (gdisp->gimage,
|
||||
gimp_image_active_drawable (gdisp->gimage),
|
||||
0, 0);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_feather_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Feather Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/feather_selection.html",
|
||||
_("Feather Selection by:"),
|
||||
selection_feather_radius, 0, 32767, 3,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_feather_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_sharpen_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_sharpen (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
select_shrink_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *edge_lock;
|
||||
GtkWidget *shrink_dialog;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
shrink_dialog =
|
||||
gimp_query_size_box (_("Shrink Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/shrink_selection.html",
|
||||
_("Shrink Selection by:"),
|
||||
selection_shrink_pixels, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_shrink_callback, gdisp->gimage);
|
||||
|
||||
edge_lock = gtk_check_button_new_with_label (_("Shrink from image border"));
|
||||
/* eeek */
|
||||
gtk_box_pack_start (GTK_BOX (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (shrink_dialog)->vbox)), 0)), edge_lock,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_object_set_data (GTK_OBJECT (shrink_dialog), "edge_lock_toggle",
|
||||
edge_lock);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edge_lock),
|
||||
! selection_shrink_edge_lock);
|
||||
gtk_widget_show (edge_lock);
|
||||
|
||||
gtk_widget_show (shrink_dialog);
|
||||
}
|
||||
|
||||
void
|
||||
select_grow_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Grow Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/grow_selection.html",
|
||||
_("Grow Selection by:"),
|
||||
selection_grow_pixels, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_grow_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_border_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *qbox;
|
||||
GDisplay *gdisp;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
qbox = gimp_query_size_box (_("Border Selection"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/border_selection.html",
|
||||
_("Border Selection by:"),
|
||||
selection_border_radius, 1, 32767, 0,
|
||||
gdisp->gimage->unit,
|
||||
MIN (gdisp->gimage->xresolution,
|
||||
gdisp->gimage->yresolution),
|
||||
gdisp->dot_for_dot,
|
||||
GTK_OBJECT (gdisp->gimage), "destroy",
|
||||
gimage_mask_border_callback, gdisp->gimage);
|
||||
gtk_widget_show (qbox);
|
||||
}
|
||||
|
||||
void
|
||||
select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gimage_mask_save (gdisp->gimage);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimage_mask_feather_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_feather_radius = size;
|
||||
|
||||
radius_x = radius_y = selection_feather_radius;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_feather (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_border_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_border_radius = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_border_radius;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_border (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_grow_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gdouble radius_x;
|
||||
gdouble radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_grow_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_grow_pixels;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_grow (gimage, radius_x, radius_y);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimage_mask_shrink_callback (GtkWidget *widget,
|
||||
gdouble size,
|
||||
GimpUnit unit,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gint radius_x;
|
||||
gint radius_y;
|
||||
|
||||
gimage = GIMP_IMAGE (data);
|
||||
|
||||
selection_shrink_pixels = ROUND (size);
|
||||
|
||||
radius_x = radius_y = selection_shrink_pixels;
|
||||
|
||||
selection_shrink_edge_lock =
|
||||
! GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget),
|
||||
"edge_lock_toggle"))->active;
|
||||
|
||||
if (unit != GIMP_UNIT_PIXEL)
|
||||
{
|
||||
gdouble factor;
|
||||
|
||||
factor = (MAX (gimage->xresolution, gimage->yresolution) /
|
||||
MIN (gimage->xresolution, gimage->yresolution));
|
||||
|
||||
if (gimage->xresolution == MIN (gimage->xresolution, gimage->yresolution))
|
||||
radius_y *= factor;
|
||||
else
|
||||
radius_x *= factor;
|
||||
}
|
||||
|
||||
gimage_mask_shrink (gimage, radius_x, radius_y, selection_shrink_edge_lock);
|
||||
gdisplays_flush ();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SELECT_COMMANDS_H__
|
||||
#define __SELECT_COMMANDS_H__
|
||||
|
||||
|
||||
void select_invert_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_none_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_float_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_feather_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_sharpen_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_shrink_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_border_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_grow_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void select_save_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __SELECT_COMMANDS_H__ */
|
|
@ -217,7 +217,7 @@ data_factory_view_new (GimpViewType view_type,
|
|||
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (container_view_scale_callback),
|
||||
GIMP_DATA_FACTORY_VIEW (view)->view);
|
||||
GIMP_CONTAINER_EDITOR (view)->view);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,245 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
#include "view-commands.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_ops.h"
|
||||
#include "gimprc.h"
|
||||
#include "nav_window.h"
|
||||
#include "scale.h"
|
||||
#include "selection.h"
|
||||
|
||||
|
||||
#define return_if_no_display(gdisp) \
|
||||
gdisp = gdisplay_active (); \
|
||||
if (!gdisp) return
|
||||
|
||||
|
||||
void
|
||||
view_zoomin_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, GIMP_ZOOM_IN);
|
||||
}
|
||||
|
||||
void
|
||||
view_zoomout_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, GIMP_ZOOM_OUT);
|
||||
}
|
||||
|
||||
void
|
||||
view_zoom_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
change_scale (gdisp, action);
|
||||
}
|
||||
|
||||
void
|
||||
view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
|
||||
}
|
||||
|
||||
void
|
||||
view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! gimprc.info_window_follows_mouse)
|
||||
{
|
||||
if (! gdisp->window_info_dialog)
|
||||
gdisp->window_info_dialog = info_window_create (gdisp);
|
||||
|
||||
info_window_update (gdisp);
|
||||
info_dialog_popup (gdisp->window_info_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
info_window_follow_auto ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (gimprc.nav_window_per_display)
|
||||
{
|
||||
if (! gdisp->window_nav_dialog)
|
||||
gdisp->window_nav_dialog = nav_dialog_create (gdisp);
|
||||
|
||||
nav_dialog_popup (gdisp->window_nav_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav_dialog_follow_auto ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
gint new_val;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
||||
/* hidden == TRUE corresponds to the menu toggle being FALSE */
|
||||
if (new_val == gdisp->select->hidden)
|
||||
{
|
||||
selection_toggle (gdisp->select);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (gdisp->origin))
|
||||
{
|
||||
gtk_widget_hide (gdisp->origin);
|
||||
gtk_widget_hide (gdisp->hrule);
|
||||
gtk_widget_hide (gdisp->vrule);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (gdisp->origin))
|
||||
{
|
||||
gtk_widget_show (gdisp->origin);
|
||||
gtk_widget_show (gdisp->hrule);
|
||||
gtk_widget_show (gdisp->vrule);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
if (! GTK_CHECK_MENU_ITEM (widget)->active)
|
||||
{
|
||||
if (GTK_WIDGET_VISIBLE (gdisp->statusarea))
|
||||
gtk_widget_hide (gdisp->statusarea);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! GTK_WIDGET_VISIBLE (gdisp->statusarea))
|
||||
gtk_widget_show (gdisp->statusarea);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
gint old_val;
|
||||
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
old_val = gdisp->draw_guides;
|
||||
gdisp->draw_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
|
||||
if ((old_val != gdisp->draw_guides) && gdisp->gimage->guides)
|
||||
{
|
||||
gdisplay_expose_full (gdisp);
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisp->snap_to_guides = GTK_CHECK_MENU_ITEM (widget)->active;
|
||||
}
|
||||
|
||||
void
|
||||
view_new_view_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
gdisplay_new_view (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
return_if_no_display (gdisp);
|
||||
|
||||
shrink_wrap_display (gdisp);
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __VIEW_COMMANDS_H__
|
||||
#define __VIEW_COMMANDS_H__
|
||||
|
||||
|
||||
void view_zoomin_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_zoomout_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_zoom_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_info_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_nav_window_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_rulers_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_statusbar_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_toggle_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_snap_to_guides_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_new_view_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __VIEW_COMMANDS_H__ */
|
|
@ -38,6 +38,7 @@
|
|||
#include "gdisplay.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "context_manager.h"
|
||||
#include "drawable.h"
|
||||
#include "gimage.h"
|
||||
#include "gimprc.h"
|
||||
|
@ -53,7 +54,6 @@ static GList *fill_type_names = NULL;
|
|||
static GimpImageNewValues last_values;
|
||||
static gboolean current_cut_buffer = FALSE;
|
||||
|
||||
extern TileManager *global_buf;
|
||||
|
||||
static void
|
||||
image_new_init (void)
|
||||
|
@ -156,10 +156,10 @@ image_new_create_window (const GimpImageNewValues *create_values,
|
|||
/* If a cut buffer exists, default to using its size for the new image
|
||||
* also check to see if a new_image has been opened
|
||||
*/
|
||||
if (global_buf && current_cut_buffer)
|
||||
if (global_buffer && current_cut_buffer)
|
||||
{
|
||||
values->width = tile_manager_width (global_buf);
|
||||
values->height = tile_manager_height (global_buf);
|
||||
values->width = tile_manager_width (global_buffer);
|
||||
values->height = tile_manager_height (global_buffer);
|
||||
}
|
||||
|
||||
ui_new_image_window_create (values);
|
||||
|
|
|
@ -46,13 +46,18 @@
|
|||
#include "commands.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "dialogs-commands.h"
|
||||
#include "edit-commands.h"
|
||||
#include "file-commands.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
#include "gdisplay.h"
|
||||
#include "image-commands.h"
|
||||
#include "layers-commands.h"
|
||||
#include "menus.h"
|
||||
#include "paths-dialog.h"
|
||||
#include "select-commands.h"
|
||||
#include "test-commands.h"
|
||||
#include "view-commands.h"
|
||||
|
||||
#include "gimphelp.h"
|
||||
#include "gimprc.h"
|
||||
|
@ -370,23 +375,23 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
|
||||
/* <Image>/View/Zoom */
|
||||
|
||||
{ { N_("/View/Zoom/16:1"), NULL, view_zoom_16_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/16:1"), NULL, view_zoom_cmd_callback, 1601 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/8:1"), NULL, view_zoom_8_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/8:1"), NULL, view_zoom_cmd_callback, 801 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/4:1"), NULL, view_zoom_4_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/4:1"), NULL, view_zoom_cmd_callback, 401 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/2:1"), NULL, view_zoom_2_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/2:1"), NULL, view_zoom_cmd_callback, 201 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:1"), "1", view_zoom_1_1_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:1"), "1", view_zoom_cmd_callback, 101 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:2"), NULL, view_zoom_1_2_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:2"), NULL, view_zoom_cmd_callback, 102 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:4"), NULL, view_zoom_1_4_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:4"), NULL, view_zoom_cmd_callback, 104 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:8"), NULL, view_zoom_1_8_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:8"), NULL, view_zoom_cmd_callback, 108 },
|
||||
"view/zoom.html", NULL },
|
||||
{ { N_("/View/Zoom/1:16"), NULL, view_zoom_1_16_cmd_callback, 0 },
|
||||
{ { N_("/View/Zoom/1:16"), NULL, view_zoom_cmd_callback, 116 },
|
||||
"view/zoom.html", NULL },
|
||||
|
||||
{ { N_("/View/Dot for Dot"), NULL, view_dot_for_dot_cmd_callback, 0, "<ToggleItem>" },
|
||||
|
@ -929,6 +934,16 @@ static GimpItemFactoryEntry dialogs_entries[] =
|
|||
NULL, NULL },
|
||||
{ { N_("/Add Tab/Image Grid..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:image-grid") },
|
||||
NULL, NULL },
|
||||
|
||||
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
|
||||
NULL, NULL },
|
||||
|
||||
{ { N_("/Add Tab/Buffer List..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:buffer-list") },
|
||||
NULL, NULL },
|
||||
{ { N_("/Add Tab/Buffer Grid..."), NULL, dialogs_add_tab_cmd_callback,
|
||||
GPOINTER_TO_UINT ("gimp:buffer-grid") },
|
||||
NULL, NULL }
|
||||
};
|
||||
static guint n_dialogs_entries = (sizeof (dialogs_entries) /
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "drawable.h"
|
||||
#include "global_edit.h"
|
||||
|
||||
extern TileManager *global_buf;
|
||||
extern TileManager *global_buffer;
|
||||
|
||||
static ProcRecord edit_cut_proc;
|
||||
static ProcRecord edit_copy_proc;
|
||||
|
@ -163,7 +163,7 @@ edit_paste_invoker (Argument *args)
|
|||
if (success)
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
layer = edit_paste (gimage, drawable, global_buf, paste_into);
|
||||
layer = edit_paste (gimage, drawable, global_buffer, paste_into);
|
||||
success = layer != NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,13 +39,14 @@
|
|||
#include "drawable.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "qmask.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
struct _EditQmaskOptions
|
||||
{
|
||||
GtkWidget *query_box;
|
||||
|
@ -55,10 +56,7 @@ struct _EditQmaskOptions
|
|||
GimpImage *gimage;
|
||||
};
|
||||
|
||||
typedef struct _EditQmaskOptions EditQmaskOptions;
|
||||
|
||||
/* Global variables */
|
||||
/* Static variables */
|
||||
/* Prototypes */
|
||||
static void edit_qmask_channel_query (GDisplay *gdisp);
|
||||
static void edit_qmask_query_ok_callback (GtkWidget *widget,
|
||||
|
|
|
@ -22,6 +22,8 @@ libapptools_a_SOURCES = @STRIP_BEGIN@ \
|
|||
gimpclonetool.h \
|
||||
gimpcolorbalancetool.c \
|
||||
gimpcolorbalancetool.h \
|
||||
gimpcolorbalancetool-transfer.c \
|
||||
gimpcolorbalancetool-transfer.h \
|
||||
gimpcolorpickertool.c \
|
||||
gimpcolorpickertool.h \
|
||||
gimpconvolvetool.c \
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "color_transfer.h"
|
||||
#include "gimpcolorbalancetool-transfer.h"
|
||||
|
||||
|
||||
/* for lightening */
|
||||
|
@ -38,9 +38,8 @@ gdouble midtones_sub[256];
|
|||
gdouble shadows_sub[256];
|
||||
|
||||
|
||||
/* color transfer functions */
|
||||
void
|
||||
color_transfer_init (void)
|
||||
gimp_color_balance_tool_transfer_init (void)
|
||||
{
|
||||
gint i;
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __COLOR_TRANSFER_H__
|
||||
#define __COLOR_TRANSFER_H__
|
||||
#ifndef __GIMP_COLOR_BALANCE_TOOL_TRANSFER_H__
|
||||
#define __GIMP_COLOR_BALANCE_TOOL_TRANSFER_H__
|
||||
|
||||
|
||||
/* color transfer data */
|
||||
|
@ -34,8 +34,7 @@ extern gdouble midtones_sub[];
|
|||
extern gdouble shadows_sub[];
|
||||
|
||||
|
||||
/* color transfer functions */
|
||||
void color_transfer_init (void);
|
||||
void gimp_color_balance_tool_transfer_init (void);
|
||||
|
||||
|
||||
#endif /* __COLOR_TRANSFER_H__ */
|
||||
#endif /* __GIMP_COLOR_BALANCE_TOOL_TRANSFER_H__ */
|
|
@ -34,10 +34,10 @@
|
|||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gimpcolorbalancetool.h"
|
||||
#include "gimpcolorbalancetool-transfer.h"
|
||||
#include "tool_manager.h"
|
||||
#include "tool_options.h"
|
||||
|
||||
#include "color_transfer.h"
|
||||
#include "drawable.h"
|
||||
#include "gdisplay.h"
|
||||
#include "image_map.h"
|
||||
|
@ -156,6 +156,8 @@ gimp_color_balance_tool_class_init (GimpColorBalanceToolClass *klass)
|
|||
|
||||
tool_class->initialize = gimp_color_balance_tool_initialize;
|
||||
tool_class->control = gimp_color_balance_tool_control;
|
||||
|
||||
gimp_color_balance_tool_transfer_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile-manager-crop.h"
|
||||
#include "base/tile.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
@ -53,7 +54,6 @@
|
|||
#include "errors.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
#include "plug_in.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -600,7 +600,7 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
guchar * data;
|
||||
|
||||
scale2 = scale * scale;
|
||||
/* GDK_WINDOWING is defined only with GTk+ 1.3 */
|
||||
|
||||
#ifndef GDK_WINDOWING_WIN32
|
||||
black.red = black.green = black.blue = 0;
|
||||
gdk_colormap_alloc_color (gdk_colormap_get_system (), &black, FALSE, TRUE);
|
||||
|
@ -608,6 +608,7 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
#else
|
||||
black_pixel = 0;
|
||||
#endif
|
||||
|
||||
data = textPR->data;
|
||||
|
||||
for (y = 0, scaley = 0; y < textPR->h; y++, scaley += scale)
|
||||
|
@ -626,7 +627,6 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
|
||||
/* store the alpha value in the data */
|
||||
*data++= (guchar) ((value * 255) / scale2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ text_render (GimpImage *gimage,
|
|||
|
||||
/* Dont crop the text if border is negative */
|
||||
crop = (border >= 0);
|
||||
if (!crop)
|
||||
if (!crop)
|
||||
border = 0;
|
||||
|
||||
/* load the font in */
|
||||
|
@ -692,7 +692,7 @@ text_render (GimpImage *gimage,
|
|||
return NULL;
|
||||
}
|
||||
xfs = GDK_FONT_XFONT (font);
|
||||
if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0)
|
||||
if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0)
|
||||
{
|
||||
gchar *fname;
|
||||
|
||||
|
@ -821,7 +821,7 @@ text_render (GimpImage *gimage,
|
|||
}
|
||||
|
||||
/* Crop the mask buffer */
|
||||
newmask = crop ? crop_buffer (mask, border) : mask;
|
||||
newmask = crop ? tile_manager_crop (mask, border) : mask;
|
||||
if (newmask != mask)
|
||||
tile_manager_destroy (mask);
|
||||
|
||||
|
@ -878,9 +878,9 @@ text_render (GimpImage *gimage,
|
|||
|
||||
tile_manager_destroy (newmask);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (newmask)
|
||||
if (newmask)
|
||||
{
|
||||
g_message ("text_render: could not allocate image");
|
||||
tile_manager_destroy (newmask);
|
||||
|
|
|
@ -6,6 +6,10 @@ libappwidgets_a_SOURCES = @STRIP_BEGIN@ \
|
|||
widgets-types.h \
|
||||
gimpbrushpreview.c \
|
||||
gimpbrushpreview.h \
|
||||
gimpbufferpreview.c \
|
||||
gimpbufferpreview.h \
|
||||
gimpbufferview.c \
|
||||
gimpbufferview.h \
|
||||
gimpchannellistitem.c \
|
||||
gimpchannellistitem.h \
|
||||
gimpchannellistview.c \
|
||||
|
@ -14,6 +18,8 @@ libappwidgets_a_SOURCES = @STRIP_BEGIN@ \
|
|||
gimpcolorpanel.h \
|
||||
gimpcomponentlistitem.c \
|
||||
gimpcomponentlistitem.h \
|
||||
gimpcontainereditor.c \
|
||||
gimpcontainereditor.h \
|
||||
gimpcontainergridview.c \
|
||||
gimpcontainergridview.h \
|
||||
gimpcontainerlistview.c \
|
||||
|
|
|
@ -0,0 +1,269 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpbufferpreview.c
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "base/temp-buf.h"
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "core/gimpbuffer.h"
|
||||
|
||||
#include "gimpbufferpreview.h"
|
||||
|
||||
|
||||
static void gimp_buffer_preview_class_init (GimpBufferPreviewClass *klass);
|
||||
static void gimp_buffer_preview_init (GimpBufferPreview *preview);
|
||||
|
||||
static void gimp_buffer_preview_get_size (GimpPreview *preview,
|
||||
gint size,
|
||||
gint *width,
|
||||
gint *height);
|
||||
static void gimp_buffer_preview_render (GimpPreview *preview);
|
||||
static GtkWidget * gimp_buffer_preview_create_popup (GimpPreview *preview);
|
||||
static gboolean gimp_buffer_preview_needs_popup (GimpPreview *preview);
|
||||
|
||||
|
||||
static GimpPreviewClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_buffer_preview_get_type (void)
|
||||
{
|
||||
static GtkType preview_type = 0;
|
||||
|
||||
if (! preview_type)
|
||||
{
|
||||
GtkTypeInfo preview_info =
|
||||
{
|
||||
"GimpBufferPreview",
|
||||
sizeof (GimpBufferPreview),
|
||||
sizeof (GimpBufferPreviewClass),
|
||||
(GtkClassInitFunc) gimp_buffer_preview_class_init,
|
||||
(GtkObjectInitFunc) gimp_buffer_preview_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
preview_type = gtk_type_unique (GIMP_TYPE_PREVIEW, &preview_info);
|
||||
}
|
||||
|
||||
return preview_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_preview_class_init (GimpBufferPreviewClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GimpPreviewClass *preview_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
preview_class = (GimpPreviewClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_PREVIEW);
|
||||
|
||||
preview_class->get_size = gimp_buffer_preview_get_size;
|
||||
preview_class->render = gimp_buffer_preview_render;
|
||||
preview_class->create_popup = gimp_buffer_preview_create_popup;
|
||||
preview_class->needs_popup = gimp_buffer_preview_needs_popup;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_preview_init (GimpBufferPreview *buffer_preview)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_preview_get_size (GimpPreview *preview,
|
||||
gint size,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
gboolean scaling_up;
|
||||
|
||||
buffer = GIMP_BUFFER (preview->viewable);
|
||||
|
||||
gimp_preview_calc_size (preview,
|
||||
tile_manager_width (buffer->tiles),
|
||||
tile_manager_height (buffer->tiles),
|
||||
size,
|
||||
size,
|
||||
1.0,
|
||||
1.0,
|
||||
width,
|
||||
height,
|
||||
&scaling_up);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_preview_render (GimpPreview *preview)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
gint buffer_width;
|
||||
gint buffer_height;
|
||||
gint width;
|
||||
gint height;
|
||||
gint preview_width;
|
||||
gint preview_height;
|
||||
gboolean scaling_up;
|
||||
TempBuf *render_buf;
|
||||
|
||||
buffer = GIMP_BUFFER (preview->viewable);
|
||||
buffer_width = tile_manager_width (buffer->tiles);
|
||||
buffer_height = tile_manager_height (buffer->tiles);
|
||||
|
||||
width = preview->width;
|
||||
height = preview->height;
|
||||
|
||||
gimp_preview_calc_size (preview,
|
||||
buffer_width,
|
||||
buffer_height,
|
||||
width,
|
||||
height,
|
||||
1.0,
|
||||
1.0,
|
||||
&preview_width,
|
||||
&preview_height,
|
||||
&scaling_up);
|
||||
|
||||
if (scaling_up)
|
||||
{
|
||||
TempBuf *temp_buf;
|
||||
|
||||
temp_buf = gimp_viewable_get_new_preview (preview->viewable,
|
||||
buffer_width,
|
||||
buffer_height);
|
||||
render_buf = temp_buf_scale (temp_buf, preview_width, preview_height);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
render_buf = gimp_viewable_get_new_preview (preview->viewable,
|
||||
preview_width,
|
||||
preview_height);
|
||||
}
|
||||
|
||||
if (preview_width < width)
|
||||
render_buf->x = (width - preview_width) / 2;
|
||||
|
||||
if (preview_height < height)
|
||||
render_buf->y = (height - preview_height) / 2;
|
||||
|
||||
if (render_buf->x || render_buf->y)
|
||||
{
|
||||
TempBuf *temp_buf;
|
||||
guchar white[4] = { 255, 255, 255, 255 };
|
||||
|
||||
temp_buf = temp_buf_new (width, height,
|
||||
render_buf->bytes,
|
||||
0, 0,
|
||||
white);
|
||||
|
||||
temp_buf_copy_area (render_buf, temp_buf,
|
||||
0, 0,
|
||||
render_buf->width,
|
||||
render_buf->height,
|
||||
render_buf->x,
|
||||
render_buf->y);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
|
||||
gimp_preview_render_and_flush (preview,
|
||||
temp_buf,
|
||||
-1);
|
||||
|
||||
temp_buf_free (temp_buf);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_preview_render_and_flush (preview,
|
||||
render_buf,
|
||||
-1);
|
||||
|
||||
temp_buf_free (render_buf);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gimp_buffer_preview_create_popup (GimpPreview *preview)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
gint buffer_width;
|
||||
gint buffer_height;
|
||||
gint popup_width;
|
||||
gint popup_height;
|
||||
gboolean scaling_up;
|
||||
|
||||
buffer = GIMP_BUFFER (preview->viewable);
|
||||
buffer_width = tile_manager_width (buffer->tiles);
|
||||
buffer_height = tile_manager_height (buffer->tiles);
|
||||
|
||||
gimp_preview_calc_size (preview,
|
||||
buffer_width,
|
||||
buffer_height,
|
||||
MIN (preview->width * 2, 256),
|
||||
MIN (preview->height * 2, 256),
|
||||
1.0,
|
||||
1.0,
|
||||
&popup_width,
|
||||
&popup_height,
|
||||
&scaling_up);
|
||||
|
||||
if (scaling_up)
|
||||
{
|
||||
return gimp_preview_new_full (preview->viewable,
|
||||
buffer_width,
|
||||
buffer_height,
|
||||
0,
|
||||
TRUE, FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return gimp_preview_new_full (preview->viewable,
|
||||
popup_width,
|
||||
popup_height,
|
||||
0,
|
||||
TRUE, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_buffer_preview_needs_popup (GimpPreview *preview)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
gint buffer_width;
|
||||
gint buffer_height;
|
||||
|
||||
buffer = GIMP_BUFFER (preview->viewable);
|
||||
buffer_width = tile_manager_width (buffer->tiles);
|
||||
buffer_height = tile_manager_height (buffer->tiles);
|
||||
|
||||
if (buffer_width > preview->width || buffer_height > preview->height)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpbufferpreview.h
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_BUFFER_PREVIEW_H__
|
||||
#define __GIMP_BUFFER_PREVIEW_H__
|
||||
|
||||
|
||||
#include "gimppreview.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define GIMP_TYPE_BUFFER_PREVIEW (gimp_buffer_preview_get_type ())
|
||||
#define GIMP_BUFFER_PREVIEW(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BUFFER_PREVIEW, GimpBufferPreview))
|
||||
#define GIMP_BUFFER_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUFFER_PREVIEW, GimpBufferPreviewClass))
|
||||
#define GIMP_IS_BUFFER_PREVIEW(obj) (GTK_CHECK_TYPE (obj, GIMP_TYPE_BUFFER_PREVIEW))
|
||||
#define GIMP_IS_BUFFER_PREVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUFFER_PREVIEW))
|
||||
|
||||
|
||||
typedef struct _GimpBufferPreviewClass GimpBufferPreviewClass;
|
||||
|
||||
struct _GimpBufferPreview
|
||||
{
|
||||
GimpPreview parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpBufferPreviewClass
|
||||
{
|
||||
GimpPreviewClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_buffer_preview_get_type (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __GIMP_BUFFER_PREVIEW_H__ */
|
|
@ -0,0 +1,481 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpbufferview.c
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpbuffer.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "gimpcontainerview.h"
|
||||
#include "gimpbufferview.h"
|
||||
#include "gimpdnd.h"
|
||||
|
||||
#include "gdisplay.h"
|
||||
#include "global_edit.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps/paste.xpm"
|
||||
#include "pixmaps/paste-into.xpm"
|
||||
#include "pixmaps/paste-as-new.xpm"
|
||||
#include "pixmaps/delete.xpm"
|
||||
|
||||
|
||||
static void gimp_buffer_view_class_init (GimpBufferViewClass *klass);
|
||||
static void gimp_buffer_view_init (GimpBufferView *view);
|
||||
static void gimp_buffer_view_destroy (GtkObject *object);
|
||||
|
||||
static void gimp_buffer_view_paste_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view);
|
||||
static void gimp_buffer_view_paste_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_buffer_view_paste_into_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view);
|
||||
static void gimp_buffer_view_paste_into_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_buffer_view_paste_as_new_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view);
|
||||
static void gimp_buffer_view_paste_as_new_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_buffer_view_delete_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view);
|
||||
static void gimp_buffer_view_delete_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_buffer_view_item_changed (GimpContext *context,
|
||||
GimpViewable *viewable,
|
||||
GimpBufferView *view);
|
||||
static void gimp_buffer_view_item_activate (GtkWidget *context,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
GimpBufferView *view);
|
||||
|
||||
|
||||
static GimpContainerEditorClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_buffer_view_get_type (void)
|
||||
{
|
||||
static guint view_type = 0;
|
||||
|
||||
if (! view_type)
|
||||
{
|
||||
GtkTypeInfo view_info =
|
||||
{
|
||||
"GimpBufferView",
|
||||
sizeof (GimpBufferView),
|
||||
sizeof (GimpBufferViewClass),
|
||||
(GtkClassInitFunc) gimp_buffer_view_class_init,
|
||||
(GtkObjectInitFunc) gimp_buffer_view_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
view_type = gtk_type_unique (GIMP_TYPE_CONTAINER_EDITOR, &view_info);
|
||||
}
|
||||
|
||||
return view_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_class_init (GimpBufferViewClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GIMP_TYPE_CONTAINER_EDITOR);
|
||||
|
||||
object_class->destroy = gimp_buffer_view_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_init (GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
/* paste */
|
||||
|
||||
view->paste_button =
|
||||
gimp_container_editor_add_button (editor,
|
||||
paste_xpm,
|
||||
_("Paste"), NULL,
|
||||
gimp_buffer_view_paste_clicked);
|
||||
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view->paste_button),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GIMP_TYPE_BUFFER,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_viewable_dest_set (GTK_WIDGET (view->paste_button),
|
||||
GIMP_TYPE_BUFFER,
|
||||
gimp_buffer_view_paste_dropped,
|
||||
view);
|
||||
|
||||
/* paste into */
|
||||
|
||||
view->paste_into_button =
|
||||
gimp_container_editor_add_button (editor,
|
||||
paste_into_xpm,
|
||||
_("Paste Into"), NULL,
|
||||
gimp_buffer_view_paste_into_clicked);
|
||||
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view->paste_into_button),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GIMP_TYPE_BUFFER,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_viewable_dest_set (GTK_WIDGET (view->paste_into_button),
|
||||
GIMP_TYPE_BUFFER,
|
||||
gimp_buffer_view_paste_into_dropped,
|
||||
view);
|
||||
|
||||
/* paste as new */
|
||||
|
||||
view->paste_as_new_button =
|
||||
gimp_container_editor_add_button (editor,
|
||||
paste_as_new_xpm,
|
||||
_("Paste Into"), NULL,
|
||||
gimp_buffer_view_paste_as_new_clicked);
|
||||
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view->paste_as_new_button),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GIMP_TYPE_BUFFER,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_viewable_dest_set (GTK_WIDGET (view->paste_as_new_button),
|
||||
GIMP_TYPE_BUFFER,
|
||||
gimp_buffer_view_paste_as_new_dropped,
|
||||
view);
|
||||
|
||||
/* delete */
|
||||
|
||||
view->delete_button =
|
||||
gimp_container_editor_add_button (editor,
|
||||
delete_xpm,
|
||||
_("Delete"), NULL,
|
||||
gimp_buffer_view_delete_clicked);
|
||||
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view->delete_button),
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
GIMP_TYPE_BUFFER,
|
||||
GDK_ACTION_COPY);
|
||||
gimp_dnd_viewable_dest_set (GTK_WIDGET (view->delete_button),
|
||||
GIMP_TYPE_BUFFER,
|
||||
gimp_buffer_view_delete_dropped,
|
||||
view);
|
||||
|
||||
gtk_widget_set_sensitive (view->paste_button, FALSE);
|
||||
gtk_widget_set_sensitive (view->paste_into_button, FALSE);
|
||||
gtk_widget_set_sensitive (view->paste_as_new_button, FALSE);
|
||||
gtk_widget_set_sensitive (view->delete_button, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_destroy (GtkObject *object)
|
||||
{
|
||||
GimpBufferView *view;
|
||||
|
||||
view = GIMP_BUFFER_VIEW (object);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_buffer_view_new (GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y)
|
||||
{
|
||||
GimpBufferView *buffer_view;
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
buffer_view = gtk_type_new (GIMP_TYPE_BUFFER_VIEW);
|
||||
|
||||
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view),
|
||||
view_type,
|
||||
container,
|
||||
context,
|
||||
preview_size,
|
||||
min_items_x,
|
||||
min_items_y))
|
||||
{
|
||||
gtk_object_unref (GTK_OBJECT (buffer_view));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (buffer_view);
|
||||
|
||||
gtk_signal_connect_while_alive
|
||||
(GTK_OBJECT (context), "buffer_changed",
|
||||
GTK_SIGNAL_FUNC (gimp_buffer_view_item_changed),
|
||||
buffer_view,
|
||||
GTK_OBJECT (buffer_view));
|
||||
|
||||
gtk_signal_connect_while_alive
|
||||
(GTK_OBJECT (editor->view), "activate_item",
|
||||
GTK_SIGNAL_FUNC (gimp_buffer_view_item_activate),
|
||||
buffer_view,
|
||||
GTK_OBJECT (buffer_view));
|
||||
|
||||
/* set button sensitivity */
|
||||
gimp_buffer_view_item_changed (context,
|
||||
(GimpViewable *)
|
||||
gimp_context_get_buffer (context),
|
||||
buffer_view);
|
||||
|
||||
return GTK_WIDGET (buffer_view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
{
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = gimp_context_get_image (editor->view->context);
|
||||
|
||||
if (gimage)
|
||||
{
|
||||
edit_paste (gimage,
|
||||
gimp_image_active_drawable (gimage),
|
||||
buffer->tiles,
|
||||
FALSE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = (GimpContainerEditor *) data;
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_context_set_buffer (editor->view->context,
|
||||
GIMP_BUFFER (viewable));
|
||||
|
||||
gimp_buffer_view_paste_clicked (NULL, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_into_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
{
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = gimp_context_get_image (editor->view->context);
|
||||
|
||||
if (gimage)
|
||||
{
|
||||
edit_paste (gimage,
|
||||
gimp_image_active_drawable (gimage),
|
||||
buffer->tiles,
|
||||
TRUE);
|
||||
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_into_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = (GimpContainerEditor *) data;
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_context_set_buffer (editor->view->context,
|
||||
GIMP_BUFFER (viewable));
|
||||
|
||||
gimp_buffer_view_paste_into_clicked (NULL, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_as_new_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
{
|
||||
GimpImage *gimage;
|
||||
|
||||
gimage = gimp_context_get_image (editor->view->context);
|
||||
|
||||
if (gimage)
|
||||
{
|
||||
edit_paste_as_new (gimage, buffer->tiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_paste_as_new_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = (GimpContainerEditor *) data;
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_context_set_buffer (editor->view->context,
|
||||
GIMP_BUFFER (viewable));
|
||||
|
||||
gimp_buffer_view_paste_as_new_clicked (NULL, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_delete_clicked (GtkWidget *widget,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpBuffer *buffer;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
buffer = gimp_context_get_buffer (editor->view->context);
|
||||
|
||||
if (buffer && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (buffer)))
|
||||
{
|
||||
gimp_container_remove (editor->view->container,
|
||||
GIMP_OBJECT (buffer));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_delete_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = (GimpContainerEditor *) data;
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_context_set_buffer (editor->view->context,
|
||||
GIMP_BUFFER (viewable));
|
||||
|
||||
gimp_buffer_view_delete_clicked (NULL, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_item_changed (GimpContext *context,
|
||||
GimpViewable *viewable,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
gboolean paste_sensitive = FALSE;
|
||||
gboolean paste_into_sensitive = FALSE;
|
||||
gboolean paste_as_new_sensitive = FALSE;
|
||||
gboolean delete_sensitive = FALSE;
|
||||
|
||||
if (viewable &&
|
||||
gimp_container_have (GIMP_CONTAINER_EDITOR (view)->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
paste_sensitive = TRUE;
|
||||
paste_into_sensitive = TRUE;
|
||||
paste_as_new_sensitive = TRUE;
|
||||
delete_sensitive = TRUE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (view->paste_button, paste_sensitive);
|
||||
gtk_widget_set_sensitive (view->paste_into_button, paste_into_sensitive);
|
||||
gtk_widget_set_sensitive (view->paste_as_new_button, paste_as_new_sensitive);
|
||||
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_buffer_view_item_activate (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
GimpBufferView *view)
|
||||
{
|
||||
if (viewable &&
|
||||
gimp_container_have (GIMP_CONTAINER_EDITOR (view)->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_buffer_view_paste_clicked (NULL, view);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpbufferview.h
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_BUFFER_VIEW_H__
|
||||
#define __GIMP_BUFFER_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpcontainereditor.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_BUFFER_VIEW (gimp_buffer_view_get_type ())
|
||||
#define GIMP_BUFFER_VIEW(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BUFFER_VIEW, GimpBufferView))
|
||||
#define GIMP_BUFFER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BUFFER_VIEW, GimpBufferViewClass))
|
||||
#define GIMP_IS_BUFFER_VIEW(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BUFFER_VIEW))
|
||||
#define GIMP_IS_BUFFER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BUFFER_VIEW))
|
||||
|
||||
|
||||
typedef struct _GimpBufferViewClass GimpBufferViewClass;
|
||||
|
||||
struct _GimpBufferView
|
||||
{
|
||||
GimpContainerEditor parent_instance;
|
||||
|
||||
GtkWidget *paste_button;
|
||||
GtkWidget *paste_into_button;
|
||||
GtkWidget *paste_as_new_button;
|
||||
GtkWidget *delete_button;
|
||||
};
|
||||
|
||||
struct _GimpBufferViewClass
|
||||
{
|
||||
GimpContainerEditorClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_buffer_view_get_type (void);
|
||||
|
||||
GtkWidget * gimp_buffer_view_new (GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y);
|
||||
|
||||
|
||||
#endif /* __GIMP_BUFFER_VIEW_H__ */
|
|
@ -0,0 +1,189 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcontainereditor.c
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
|
||||
#include "gimpcontainereditor.h"
|
||||
#include "gimpcontainergridview.h"
|
||||
#include "gimpcontainerlistview.h"
|
||||
|
||||
|
||||
static void gimp_container_editor_class_init (GimpContainerEditorClass *klass);
|
||||
static void gimp_container_editor_init (GimpContainerEditor *view);
|
||||
static void gimp_container_editor_destroy (GtkObject *object);
|
||||
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
||||
|
||||
GtkType
|
||||
gimp_container_editor_get_type (void)
|
||||
{
|
||||
static guint view_type = 0;
|
||||
|
||||
if (! view_type)
|
||||
{
|
||||
GtkTypeInfo view_info =
|
||||
{
|
||||
"GimpContainerEditor",
|
||||
sizeof (GimpContainerEditor),
|
||||
sizeof (GimpContainerEditorClass),
|
||||
(GtkClassInitFunc) gimp_container_editor_class_init,
|
||||
(GtkObjectInitFunc) gimp_container_editor_init,
|
||||
/* reserved_1 */ NULL,
|
||||
/* reserved_2 */ NULL,
|
||||
(GtkClassInitFunc) NULL
|
||||
};
|
||||
|
||||
view_type = gtk_type_unique (GTK_TYPE_VBOX, &view_info);
|
||||
}
|
||||
|
||||
return view_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_editor_class_init (GimpContainerEditorClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass *) klass;
|
||||
|
||||
parent_class = gtk_type_class (GTK_TYPE_VBOX);
|
||||
|
||||
object_class->destroy = gimp_container_editor_destroy;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_editor_init (GimpContainerEditor *view)
|
||||
{
|
||||
view->view = NULL;
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (view), 2);
|
||||
|
||||
view->button_box = gtk_hbox_new (TRUE, 2);
|
||||
gtk_box_pack_end (GTK_BOX (view), view->button_box, FALSE, FALSE, 0);
|
||||
gtk_widget_show (view->button_box);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_editor_destroy (GtkObject *object)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (object);
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_container_editor_construct (GimpContainerEditor *editor,
|
||||
GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y)
|
||||
{
|
||||
g_return_val_if_fail (editor != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_EDITOR (editor), FALSE);
|
||||
g_return_val_if_fail (container != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
|
||||
|
||||
g_return_val_if_fail (preview_size > 0 && preview_size <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, FALSE);
|
||||
|
||||
switch (view_type)
|
||||
{
|
||||
case GIMP_VIEW_TYPE_GRID:
|
||||
editor->view =
|
||||
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
min_items_x,
|
||||
min_items_y));
|
||||
break;
|
||||
|
||||
case GIMP_VIEW_TYPE_LIST:
|
||||
editor->view =
|
||||
GIMP_CONTAINER_VIEW (gimp_container_list_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
min_items_x,
|
||||
min_items_y));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("%s(): unknown GimpViewType passed", G_GNUC_FUNCTION);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (editor),
|
||||
GTK_WIDGET (editor->view));
|
||||
gtk_widget_show (GTK_WIDGET (editor->view));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_container_editor_add_button (GimpContainerEditor *editor,
|
||||
gchar **xpm_data,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_data,
|
||||
GtkSignalFunc callback)
|
||||
{
|
||||
GtkWidget *pixmap;
|
||||
GtkWidget *button;
|
||||
|
||||
g_return_val_if_fail (editor != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_EDITOR (editor), NULL);
|
||||
g_return_val_if_fail (xpm_data != NULL, NULL);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (editor->button_box), button,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
if (tooltip || help_data)
|
||||
gimp_help_set_help_data (button, tooltip, help_data);
|
||||
|
||||
if (callback)
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
callback, editor);
|
||||
|
||||
pixmap = gimp_pixmap_new (xpm_data);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
return button;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcontainereditor.h
|
||||
* Copyright (C) 2001 Michael Natterer
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_CONTAINER_EDITOR_H__
|
||||
#define __GIMP_CONTAINER_EDITOR_H__
|
||||
|
||||
|
||||
#include <gtk/gtkvbox.h>
|
||||
|
||||
|
||||
typedef void (* GimpContainerEditFunc) (GimpContainer *container);
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_VIEW_TYPE_GRID,
|
||||
GIMP_VIEW_TYPE_LIST
|
||||
} GimpViewType;
|
||||
|
||||
|
||||
#define GIMP_TYPE_CONTAINER_EDITOR (gimp_container_editor_get_type ())
|
||||
#define GIMP_CONTAINER_EDITOR(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_CONTAINER_EDITOR, GimpContainerEditor))
|
||||
#define GIMP_CONTAINER_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONTAINER_EDITOR, GimpContainerEditorClass))
|
||||
#define GIMP_IS_CONTAINER_EDITOR(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_CONTAINER_EDITOR))
|
||||
#define GIMP_IS_CONTAINER_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CONTAINER_EDITOR))
|
||||
|
||||
|
||||
typedef struct _GimpContainerEditorClass GimpContainerEditorClass;
|
||||
|
||||
struct _GimpContainerEditor
|
||||
{
|
||||
GtkVBox parent_instance;
|
||||
|
||||
GimpContainerView *view;
|
||||
|
||||
GtkWidget *button_box;
|
||||
};
|
||||
|
||||
struct _GimpContainerEditorClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GtkType gimp_container_editor_get_type (void);
|
||||
|
||||
|
||||
/* protected */
|
||||
|
||||
gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
|
||||
GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y);
|
||||
GtkWidget * gimp_container_editor_add_button (GimpContainerEditor *editor,
|
||||
gchar **xpm_data,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_data,
|
||||
GtkSignalFunc callback);
|
||||
|
||||
|
||||
#endif /* __GIMP_CONTAINER_EDITOR_H__ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue