2001-02-27 22:14:13 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2003-03-16 19:14:29 +08:00
|
|
|
* gimpdrawabletreeview.c
|
|
|
|
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
2001-04-22 08:38:56 +08:00
|
|
|
*
|
2001-02-27 22:14:13 +08:00
|
|
|
* 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"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpchannel.h"
|
|
|
|
#include "core/gimpcontainer.h"
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpdrawable.h"
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimpdrawable-bucket-fill.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2003-02-13 19:23:50 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimplayer.h"
|
|
|
|
#include "core/gimpmarshal.h"
|
2002-09-02 22:39:08 +08:00
|
|
|
#include "core/gimppattern.h"
|
|
|
|
#include "core/gimptoolinfo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimpcellrenderertoggle.h"
|
|
|
|
#include "gimpchanneltreeview.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.h"
|
2001-11-30 22:41:56 +08:00
|
|
|
#include "gimpitemfactory.h"
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimplayertreeview.h"
|
|
|
|
#include "gimppreviewrenderer.h"
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass);
|
|
|
|
static void gimp_drawable_tree_view_init (GimpDrawableTreeView *view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GObject *gimp_drawable_tree_view_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params);
|
|
|
|
static void gimp_drawable_tree_view_set_container (GimpContainerView *view,
|
|
|
|
GimpContainer *container);
|
|
|
|
static gpointer gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index);
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
static void gimp_drawable_tree_view_set_image (GimpItemTreeView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_floating_selection_changed
|
2002-02-26 01:58:50 +08:00
|
|
|
(GimpImage *gimage,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpDrawableTreeView *view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_new_pattern_dropped
|
2002-09-02 22:39:08 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_new_color_dropped
|
2002-09-02 22:39:08 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_drawable_tree_view_visibility_changed
|
|
|
|
(GimpDrawable *drawable,
|
|
|
|
GimpDrawableTreeView *view);
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
static void gimp_drawable_tree_view_eye_clicked(GtkCellRendererToggle *toggle,
|
2003-03-16 19:14:29 +08:00
|
|
|
gchar *path,
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
GdkModifierType state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpDrawableTreeView *view);
|
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GimpItemTreeViewClass *parent_class = NULL;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
GType
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_get_type (void)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
static GType view_type = 0;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
if (! view_type)
|
|
|
|
{
|
2001-10-17 19:33:43 +08:00
|
|
|
static const GTypeInfo view_info =
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
sizeof (GimpDrawableTreeViewClass),
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GClassInitFunc) gimp_drawable_tree_view_class_init,
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
2003-03-16 19:14:29 +08:00
|
|
|
sizeof (GimpDrawableTreeView),
|
2001-10-17 19:33:43 +08:00
|
|
|
0, /* n_preallocs */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GInstanceInitFunc) gimp_drawable_tree_view_init,
|
2001-02-27 22:14:13 +08:00
|
|
|
};
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW,
|
|
|
|
"GimpDrawableTreeView",
|
2001-10-17 19:33:43 +08:00
|
|
|
&view_info, 0);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return view_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GObjectClass *object_class;
|
|
|
|
GimpContainerViewClass *container_view_class;
|
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
object_class->constructor = gimp_drawable_tree_view_constructor;
|
|
|
|
|
|
|
|
container_view_class->set_container = gimp_drawable_tree_view_set_container;
|
|
|
|
container_view_class->insert_item = gimp_drawable_tree_view_insert_item;
|
2003-05-18 21:28:27 +08:00
|
|
|
container_view_class->select_item = gimp_drawable_tree_view_select_item;
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
item_view_class->set_image = gimp_drawable_tree_view_set_image;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_init (GimpDrawableTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GimpItemTreeView *item_view;
|
2002-09-02 22:39:08 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
|
|
|
|
view->model_column_visible = tree_view->n_model_columns;
|
|
|
|
|
|
|
|
tree_view->model_columns[tree_view->n_model_columns++] = G_TYPE_BOOLEAN;
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
gimp_dnd_viewable_dest_add (item_view->new_button, GIMP_TYPE_PATTERN,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_pattern_dropped,
|
2002-09-02 22:39:08 +08:00
|
|
|
view);
|
|
|
|
gimp_dnd_color_dest_add (item_view->new_button,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_color_dropped,
|
2002-09-02 22:39:08 +08:00
|
|
|
view);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GObject *
|
|
|
|
gimp_drawable_tree_view_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params)
|
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GimpDrawableTreeView *drawable_view;
|
|
|
|
GObject *object;
|
2003-03-16 21:19:43 +08:00
|
|
|
GtkTreeViewColumn *column;
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
|
|
|
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (object);
|
|
|
|
drawable_view = GIMP_DRAWABLE_TREE_VIEW (object);
|
|
|
|
|
2003-03-16 21:19:43 +08:00
|
|
|
column = gtk_tree_view_column_new ();
|
|
|
|
gtk_tree_view_insert_column (tree_view->view, column, 0);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
drawable_view->eye_cell = gimp_cell_renderer_toggle_new (GIMP_STOCK_VISIBLE);
|
2003-03-16 21:19:43 +08:00
|
|
|
gtk_tree_view_column_pack_start (column, drawable_view->eye_cell, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes (column, drawable_view->eye_cell,
|
2003-03-16 19:14:29 +08:00
|
|
|
"active",
|
|
|
|
drawable_view->model_column_visible,
|
|
|
|
NULL);
|
|
|
|
|
2003-03-16 21:19:43 +08:00
|
|
|
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
|
|
|
|
drawable_view->eye_cell);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
g_signal_connect (drawable_view->eye_cell, "clicked",
|
|
|
|
G_CALLBACK (gimp_drawable_tree_view_eye_clicked),
|
2003-03-16 19:14:29 +08:00
|
|
|
drawable_view);
|
|
|
|
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* GimpContainerView methods */
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void
|
|
|
|
gimp_drawable_tree_view_set_container (GimpContainerView *view,
|
|
|
|
GimpContainer *container)
|
|
|
|
{
|
|
|
|
GimpDrawableTreeView *drawable_view;
|
|
|
|
|
|
|
|
drawable_view = GIMP_DRAWABLE_TREE_VIEW (view);
|
|
|
|
|
|
|
|
if (view->container)
|
|
|
|
{
|
|
|
|
gimp_container_remove_handler (view->container,
|
|
|
|
drawable_view->visibility_changed_handler_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_container (view, container);
|
|
|
|
|
|
|
|
if (view->container)
|
|
|
|
{
|
|
|
|
drawable_view->visibility_changed_handler_id =
|
|
|
|
gimp_container_add_handler (view->container, "visibility_changed",
|
|
|
|
G_CALLBACK (gimp_drawable_tree_view_visibility_changed),
|
|
|
|
view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index)
|
|
|
|
{
|
|
|
|
GtkTreeIter *iter;
|
|
|
|
|
|
|
|
iter = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view, viewable,
|
|
|
|
index);
|
|
|
|
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (GIMP_CONTAINER_TREE_VIEW (view)->model),
|
|
|
|
iter,
|
|
|
|
GIMP_DRAWABLE_TREE_VIEW (view)->model_column_visible,
|
|
|
|
gimp_drawable_get_visible (GIMP_DRAWABLE (viewable)),
|
|
|
|
-1);
|
|
|
|
|
|
|
|
return iter;
|
|
|
|
}
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
|
|
|
{
|
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
|
|
|
|
if (item_view->gimage)
|
|
|
|
{
|
|
|
|
GimpViewable *floating_sel;
|
|
|
|
|
|
|
|
floating_sel = (GimpViewable *)
|
|
|
|
gimp_image_floating_sel (item_view->gimage);
|
|
|
|
|
|
|
|
success = (item == NULL || floating_sel == NULL || item == floating_sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
return GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
|
|
|
insert_data);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* GimpItemTreeView methods */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_set_image (GimpItemTreeView *item_view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpDrawableTreeView *view;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
view = GIMP_DRAWABLE_TREE_VIEW (item_view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
if (item_view->gimage)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (item_view->gimage,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_floating_selection_changed,
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
view);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
if (item_view->gimage)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (item_view->gimage,
|
2002-02-26 01:58:50 +08:00
|
|
|
"floating_selection_changed",
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_drawable_tree_view_floating_selection_changed),
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
view);
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-20 00:37:24 +08:00
|
|
|
|
|
|
|
/* callbacks */
|
|
|
|
|
2001-05-08 09:32:25 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_floating_selection_changed (GimpImage *gimage,
|
|
|
|
GimpDrawableTreeView *view)
|
2001-05-08 09:32:25 +08:00
|
|
|
{
|
2003-05-18 21:28:27 +08:00
|
|
|
GimpItem *item;
|
2001-05-08 09:32:25 +08:00
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2001-05-08 09:32:25 +08:00
|
|
|
/* update button states */
|
2003-05-18 21:28:27 +08:00
|
|
|
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (view),
|
|
|
|
(GimpViewable *) item);
|
2001-05-08 09:32:25 +08:00
|
|
|
}
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
|
2002-09-02 22:39:08 +08:00
|
|
|
GimpBucketFillMode fill_mode,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpPattern *pattern)
|
|
|
|
{
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpToolInfo *tool_info;
|
|
|
|
GimpContext *context;
|
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
gimp_image_undo_group_start (view->gimage, GIMP_UNDO_GROUP_EDIT_PASTE,
|
|
|
|
_("New Layer"));
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
view->new_item_func (view->gimage, NULL, FALSE);
|
|
|
|
|
|
|
|
drawable = gimp_image_active_drawable (view->gimage);
|
|
|
|
|
|
|
|
/* Get the bucket fill context */
|
|
|
|
tool_info = (GimpToolInfo *)
|
|
|
|
gimp_container_get_child_by_name (view->gimage->gimp->tool_info_list,
|
|
|
|
"gimp-bucket-fill-tool");
|
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
if (tool_info && tool_info->tool_options)
|
2002-09-02 22:39:08 +08:00
|
|
|
{
|
2003-02-05 22:39:40 +08:00
|
|
|
context = GIMP_CONTEXT (tool_info->tool_options);
|
2002-09-02 22:39:08 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
context = gimp_get_user_context (view->gimage->gimp);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_bucket_fill_full (drawable,
|
|
|
|
fill_mode,
|
|
|
|
gimp_context_get_paint_mode (context),
|
|
|
|
gimp_context_get_opacity (context),
|
|
|
|
FALSE /* no seed fill */,
|
2003-02-15 06:33:22 +08:00
|
|
|
FALSE, 0.0, FALSE, 0.0, 0.0 /* fill params */,
|
|
|
|
color, pattern);
|
2002-09-02 22:39:08 +08:00
|
|
|
|
2003-02-13 19:23:50 +08:00
|
|
|
gimp_image_undo_group_end (view->gimage);
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_pattern_dropped (GtkWidget *widget,
|
2002-09-02 22:39:08 +08:00
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
2002-09-02 22:39:08 +08:00
|
|
|
GIMP_PATTERN_BUCKET_FILL,
|
|
|
|
NULL,
|
|
|
|
GIMP_PATTERN (viewable));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_color_dropped (GtkWidget *widget,
|
2002-09-02 22:39:08 +08:00
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
2002-09-02 22:39:08 +08:00
|
|
|
GIMP_FG_BUCKET_FILL,
|
|
|
|
color,
|
|
|
|
NULL);
|
|
|
|
}
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_drawable_tree_view_visibility_changed (GimpDrawable *drawable,
|
|
|
|
GimpDrawableTreeView *view)
|
|
|
|
{
|
|
|
|
GimpContainerView *container_view;
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GtkTreeIter *iter;
|
|
|
|
|
|
|
|
container_view = GIMP_CONTAINER_VIEW (view);
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
|
|
|
|
iter = g_hash_table_lookup (container_view->hash_table, drawable);
|
|
|
|
|
|
|
|
if (iter)
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
|
|
|
view->model_column_visible,
|
|
|
|
gimp_drawable_get_visible (drawable),
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
gimp_drawable_tree_view_eye_clicked (GtkCellRendererToggle *toggle,
|
2003-03-16 19:14:29 +08:00
|
|
|
gchar *path_str,
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
GdkModifierType state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpDrawableTreeView *view)
|
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GtkTreePath *path;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
|
|
|
|
path = gtk_tree_path_new_from_string (path_str);
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
|
|
|
|
{
|
|
|
|
GimpPreviewRenderer *renderer;
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpImage *gimage;
|
|
|
|
gboolean active;
|
|
|
|
|
|
|
|
gtk_tree_model_get (tree_view->model, &iter,
|
|
|
|
tree_view->model_column_renderer, &renderer,
|
|
|
|
-1);
|
|
|
|
g_object_get (toggle,
|
|
|
|
"active", &active,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
drawable = GIMP_DRAWABLE (renderer->viewable);
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
g_object_unref (renderer);
|
2003-03-16 19:14:29 +08:00
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
2003-03-16 19:14:29 +08:00
|
|
|
|
Made drawable/layer properties (visibility, opacity etc.) undoable (fixes
2003-03-17 Michael Natterer <mitch@gimp.org>
Made drawable/layer properties (visibility, opacity etc.)
undoable (fixes bug #73893).
* app/core/core-enums.[ch]: added undo types/groups for
visibility, mode, opacity, linked and preserve_trans.
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemundo.[ch]: new GimpUndo subclass which holds a
ref'ed GimpItem pointer so (1) this doesn't need to be done by all
undo steps related to an item and (2) the item the undo step is
for can be determined from outside the undo system.
* app/core/gimpimage-undo.[ch]: added gimp_image_undo_push_item()
which returns a new GimpItemUndo.
* app/core/gimpimage-undo-push.[ch]: use it for all item related
undo steps. Removed lots of GimpItem, GimpLayer, GimpDrawable
and GimpVectors pointers from the private undo structs. Added
undo push functions for the new undo types added above.
* app/core/gimpdrawable.[ch] (gimp_drawable_set_visible): added
"gboolean push_undo" parameter.
* app/core/gimplayer.[ch] (gimp_layer_set_opacity, _mode,
_preserve_trans, _linked): added "gboolean push_undo" parameters.
* app/core/gimpimage-mask.c
* app/core/gimpimage-merge.c
* app/core/gimplayer-floating-sel.c
* app/tools/gimpmovetool.c
* app/xcf/xcf-load.c
* app/widgets/gimpdrawablelistitem.c
* app/widgets/gimplayerlistitem.c
* app/widgets/gimplayerlistview.c: changed accordingly.
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: ditto. Added '$undo' paramaters to
the foo_accessors() functions. Removed $func from foo_accesors()
because we don't manipulate items without using getters/setters
any longer.
* app/pdb/channel_cmds.c
* app/pdb/layer_cmds.c: regenerated.
* app/widgets/gimpcellrenderertoggle.[ch]: added "clicked" signal
which carries an additional "GdkModifierType state" parameter as
in GimpCellRendererViewable .
* app/widgets/gimpcontainertreeview.c: emit "clicked" from
the toggle renderer, not "toggled" so the callbacks get the
modifier state.
* app/widgets/gimpdrawabletreeview.c: resurrected the "exclusive
visible by <shift>+click" feature as in 1.2.
* app/widgets/gimplayertreeview.c: compress layer opacity undos by
looking at the top of the undo stack and not pushing an undo if
there already is a GIMP_UNDO_DRAWABLE_OPACITY for the active
layer.
2003-03-18 02:02:41 +08:00
|
|
|
if (state & GDK_SHIFT_MASK)
|
|
|
|
{
|
|
|
|
gboolean iter_valid;
|
|
|
|
|
|
|
|
gimp_image_undo_group_start (gimage,
|
|
|
|
GIMP_UNDO_GROUP_DRAWABLE_VISIBILITY,
|
|
|
|
_("Set Drawable Exclusive Visible"));
|
|
|
|
|
|
|
|
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model,
|
|
|
|
&iter);
|
|
|
|
iter_valid;
|
|
|
|
iter_valid = gtk_tree_model_iter_next (tree_view->model,
|
|
|
|
&iter))
|
|
|
|
{
|
|
|
|
gtk_tree_model_get (tree_view->model, &iter,
|
|
|
|
tree_view->model_column_renderer, &renderer,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
if (renderer->viewable != (GimpViewable *) drawable)
|
|
|
|
gimp_drawable_set_visible (GIMP_DRAWABLE (renderer->viewable),
|
|
|
|
FALSE, TRUE);
|
|
|
|
|
|
|
|
g_object_unref (renderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_drawable_set_visible (drawable, TRUE, TRUE);
|
|
|
|
|
|
|
|
gimp_image_undo_group_end (gimage);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_drawable_set_visible (drawable, !active, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_image_flush (gimage);
|
2003-03-16 19:14:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|