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
|
|
|
* gimpitemtreeview.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
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpchannel.h"
|
|
|
|
#include "core/gimpcontainer.h"
|
2003-10-11 05:24:12 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2003-09-12 03:52:29 +08:00
|
|
|
#include "core/gimpimage-undo.h"
|
2004-03-19 03:39:19 +08:00
|
|
|
#include "core/gimpimage-undo-push.h"
|
2004-03-19 01:01:46 +08:00
|
|
|
#include "core/gimpitemundo.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimplayer.h"
|
|
|
|
#include "core/gimpmarshal.h"
|
2004-03-19 01:01:46 +08:00
|
|
|
#include "core/gimpundostack.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
|
2002-02-26 13:42:14 +08:00
|
|
|
#include "vectors/gimpvectors.h"
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimpchanneltreeview.h"
|
2003-05-09 04:26:01 +08:00
|
|
|
#include "gimpcellrenderertoggle.h"
|
2004-05-11 07:22:39 +08:00
|
|
|
#include "gimpcontainerview.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "gimpdnd.h"
|
2003-10-11 05:24:12 +08:00
|
|
|
#include "gimpdocked.h"
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimplayertreeview.h"
|
2003-01-11 01:55:53 +08:00
|
|
|
#include "gimpmenufactory.h"
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimppreviewrenderer.h"
|
2004-04-23 01:14:22 +08:00
|
|
|
#include "gimpuimanager.h"
|
2003-03-16 19:14:29 +08:00
|
|
|
#include "gimpvectorstreeview.h"
|
2002-12-20 00:33:29 +08:00
|
|
|
#include "gimpwidgets-utils.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-12-21 20:11:44 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_ITEM_TYPE,
|
|
|
|
PROP_SIGNAL_NAME
|
|
|
|
};
|
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SET_IMAGE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass);
|
|
|
|
static void gimp_item_tree_view_init (GimpItemTreeView *view,
|
|
|
|
GimpItemTreeViewClass *view_class);
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static void gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *view_iface);
|
|
|
|
static void gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface);
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void gimp_item_tree_view_set_docked_context (GimpDocked *docked,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpContext *prev_context);
|
2003-02-17 21:33:29 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GObject * gimp_item_tree_view_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params);
|
2003-12-21 20:11:44 +08:00
|
|
|
static void gimp_item_tree_view_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_item_tree_view_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_destroy (GtkObject *object);
|
2002-02-26 01:58:50 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_real_set_image (GimpItemTreeView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage);
|
|
|
|
|
2003-05-09 04:26:01 +08:00
|
|
|
static void gimp_item_tree_view_set_container (GimpContainerView *view,
|
|
|
|
GimpContainer *container);
|
|
|
|
static gpointer gimp_item_tree_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index);
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean gimp_item_tree_view_select_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_activate_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_context_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data);
|
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
static gboolean gimp_item_tree_view_drop_possible (GimpContainerTreeView *view,
|
|
|
|
GimpViewable *src_viewable,
|
|
|
|
GimpViewable *dest_viewable,
|
|
|
|
GtkTreeViewDropPosition drop_pos,
|
|
|
|
GdkDragAction *drag_action);
|
|
|
|
static void gimp_item_tree_view_drop (GimpContainerTreeView *view,
|
|
|
|
GimpViewable *src_viewable,
|
|
|
|
GimpViewable *dest_viewable,
|
|
|
|
GtkTreeViewDropPosition drop_pos);
|
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
static void gimp_item_tree_view_edit_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_new_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
2004-03-17 07:45:48 +08:00
|
|
|
static void gimp_item_tree_view_new_extended_clicked
|
|
|
|
(GtkWidget *widget,
|
|
|
|
guint state,
|
|
|
|
GimpItemTreeView *view);
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_raise_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
static void gimp_item_tree_view_raise_extended_clicked
|
2002-02-26 01:58:50 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeView *view);
|
|
|
|
static void gimp_item_tree_view_lower_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
static void gimp_item_tree_view_lower_extended_clicked
|
2002-02-26 01:58:50 +08:00
|
|
|
(GtkWidget *widget,
|
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeView *view);
|
2002-02-26 01:58:50 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_duplicate_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
static void gimp_item_tree_view_delete_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view);
|
2002-02-26 01:58:50 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static void gimp_item_tree_view_item_changed (GimpImage *gimage,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
static void gimp_item_tree_view_size_changed (GimpImage *gimage,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
|
|
|
|
static void gimp_item_tree_view_name_edited (GtkCellRendererText *cell,
|
|
|
|
const gchar *path,
|
|
|
|
const gchar *name,
|
|
|
|
GimpItemTreeView *view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
static void gimp_item_tree_view_visible_changed (GimpItem *item,
|
|
|
|
GimpItemTreeView *view);
|
2003-05-09 04:26:01 +08:00
|
|
|
static void gimp_item_tree_view_linked_changed (GimpItem *item,
|
|
|
|
GimpItemTreeView *view);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
|
|
|
static void gimp_item_tree_view_eye_clicked (GtkCellRendererToggle *toggle,
|
|
|
|
gchar *path,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view);
|
2003-05-09 04:26:01 +08:00
|
|
|
static void gimp_item_tree_view_chain_clicked (GtkCellRendererToggle *toggle,
|
|
|
|
gchar *path,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view);
|
|
|
|
|
2003-11-15 01:35:51 +08:00
|
|
|
/* utility function to avoid code duplication */
|
|
|
|
static void gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *toggle,
|
2004-03-19 03:39:19 +08:00
|
|
|
gchar *path_str,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view,
|
|
|
|
GimpUndoType undo_type);
|
2003-11-15 01:35:51 +08:00
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
static guint view_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static GimpContainerTreeViewClass *parent_class = NULL;
|
|
|
|
static GimpContainerViewInterface *parent_view_iface = 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_item_tree_view_get_type (void)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-10-11 05:24:12 +08:00
|
|
|
static GType type = 0;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
if (! type)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
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 (GimpItemTreeViewClass),
|
2001-10-17 19:33:43 +08:00
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GClassInitFunc) gimp_item_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 (GimpItemTreeView),
|
2001-10-17 19:33:43 +08:00
|
|
|
0, /* n_preallocs */
|
2003-03-16 19:14:29 +08:00
|
|
|
(GInstanceInitFunc) gimp_item_tree_view_init,
|
2001-02-27 22:14:13 +08:00
|
|
|
};
|
2004-05-11 07:22:39 +08:00
|
|
|
|
|
|
|
static const GInterfaceInfo view_iface_info =
|
|
|
|
{
|
|
|
|
(GInterfaceInitFunc) gimp_item_tree_view_view_iface_init,
|
|
|
|
NULL, /* iface_finalize */
|
|
|
|
NULL /* iface_data */
|
|
|
|
};
|
2003-10-11 05:24:12 +08:00
|
|
|
static const GInterfaceInfo docked_iface_info =
|
|
|
|
{
|
|
|
|
(GInterfaceInitFunc) gimp_item_tree_view_docked_iface_init,
|
|
|
|
NULL, /* iface_finalize */
|
|
|
|
NULL /* iface_data */
|
|
|
|
};
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
type = g_type_register_static (GIMP_TYPE_CONTAINER_TREE_VIEW,
|
|
|
|
"GimpItemTreeView",
|
|
|
|
&view_info, 0);
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
g_type_add_interface_static (type, GIMP_TYPE_CONTAINER_VIEW,
|
|
|
|
&view_iface_info);
|
2003-10-11 05:24:12 +08:00
|
|
|
g_type_add_interface_static (type, GIMP_TYPE_DOCKED,
|
|
|
|
&docked_iface_info);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
return type;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-19 23:17:13 +08:00
|
|
|
GObjectClass *object_class;
|
|
|
|
GtkObjectClass *gtk_object_class;
|
|
|
|
GimpContainerTreeViewClass *tree_view_class;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
object_class = G_OBJECT_CLASS (klass);
|
|
|
|
gtk_object_class = GTK_OBJECT_CLASS (klass);
|
2003-03-19 23:17:13 +08:00
|
|
|
tree_view_class = GIMP_CONTAINER_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
|
|
|
|
2001-05-03 20:26:05 +08:00
|
|
|
view_signals[SET_IMAGE] =
|
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
|
|
|
g_signal_new ("set_image",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_STRUCT_OFFSET (GimpItemTreeViewClass, set_image),
|
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
|
|
|
NULL, NULL,
|
2001-11-23 07:46:13 +08:00
|
|
|
gimp_marshal_VOID__OBJECT,
|
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
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_OBJECT);
|
2001-05-03 20:26:05 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
object_class->constructor = gimp_item_tree_view_constructor;
|
|
|
|
object_class->set_property = gimp_item_tree_view_set_property;
|
|
|
|
object_class->get_property = gimp_item_tree_view_get_property;
|
|
|
|
|
|
|
|
gtk_object_class->destroy = gimp_item_tree_view_destroy;
|
|
|
|
|
|
|
|
tree_view_class->drop_possible = gimp_item_tree_view_drop_possible;
|
|
|
|
tree_view_class->drop = gimp_item_tree_view_drop;
|
|
|
|
|
|
|
|
klass->set_image = gimp_item_tree_view_real_set_image;
|
|
|
|
|
|
|
|
klass->get_container = NULL;
|
|
|
|
klass->get_active_item = NULL;
|
|
|
|
klass->set_active_item = NULL;
|
|
|
|
klass->reorder_item = NULL;
|
|
|
|
klass->add_item = NULL;
|
|
|
|
klass->remove_item = NULL;
|
|
|
|
|
|
|
|
klass->edit_desc = NULL;
|
|
|
|
klass->edit_help_id = NULL;
|
|
|
|
klass->new_desc = NULL;
|
|
|
|
klass->new_help_id = NULL;
|
|
|
|
klass->duplicate_desc = NULL;
|
|
|
|
klass->duplicate_help_id = NULL;
|
|
|
|
klass->delete_desc = NULL;
|
|
|
|
klass->delete_help_id = NULL;
|
|
|
|
klass->raise_desc = NULL;
|
|
|
|
klass->raise_help_id = NULL;
|
|
|
|
klass->raise_to_top_desc = NULL;
|
|
|
|
klass->raise_to_top_help_id = NULL;
|
|
|
|
klass->lower_desc = NULL;
|
|
|
|
klass->lower_help_id = NULL;
|
|
|
|
klass->lower_to_bottom_desc = NULL;
|
|
|
|
klass->lower_to_bottom_help_id = NULL;
|
2003-12-21 20:11:44 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ITEM_TYPE,
|
|
|
|
g_param_spec_pointer ("item-type",
|
|
|
|
NULL, NULL,
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_SIGNAL_NAME,
|
|
|
|
g_param_spec_string ("signal-name",
|
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_init (GimpItemTreeView *view,
|
|
|
|
GimpItemTreeViewClass *view_class)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-05-09 04:26:01 +08:00
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GimpEditor *editor;
|
|
|
|
gchar *str;
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2003-05-09 04:26:01 +08:00
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
editor = GIMP_EDITOR (view);
|
|
|
|
|
2003-10-13 07:15:51 +08:00
|
|
|
/* The following used to read:
|
|
|
|
*
|
|
|
|
* tree_view->model_columns[tree_view->n_model_columns++] = ...
|
|
|
|
*
|
|
|
|
* but combining the two lead to gcc miscompiling the function on ppc/ia64
|
|
|
|
* (model_column_mask and model_column_mask_visible would have the same
|
|
|
|
* value, probably due to bad instruction reordering). See bug #113144 for
|
|
|
|
* more info.
|
|
|
|
*/
|
2003-09-12 03:52:29 +08:00
|
|
|
view->model_column_visible = tree_view->n_model_columns;
|
2003-10-13 07:15:51 +08:00
|
|
|
tree_view->model_columns[tree_view->n_model_columns] = G_TYPE_BOOLEAN;
|
|
|
|
tree_view->n_model_columns++;
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2003-05-09 04:26:01 +08:00
|
|
|
view->model_column_linked = tree_view->n_model_columns;
|
2003-10-13 07:15:51 +08:00
|
|
|
tree_view->model_columns[tree_view->n_model_columns] = G_TYPE_BOOLEAN;
|
|
|
|
tree_view->n_model_columns++;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
view->gimage = NULL;
|
|
|
|
view->item_type = G_TYPE_NONE;
|
|
|
|
view->signal_name = NULL;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
view->edit_button =
|
|
|
|
gimp_editor_add_button (editor,
|
|
|
|
GIMP_STOCK_EDIT, view_class->edit_desc,
|
|
|
|
view_class->edit_help_id,
|
|
|
|
G_CALLBACK (gimp_item_tree_view_edit_clicked),
|
|
|
|
NULL,
|
|
|
|
view);
|
|
|
|
|
2004-03-18 00:12:21 +08:00
|
|
|
str = g_strdup_printf (view_class->new_desc,
|
|
|
|
gimp_get_mod_name_shift ());
|
2004-03-17 07:45:48 +08:00
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
view->new_button =
|
2002-03-08 08:27:45 +08:00
|
|
|
gimp_editor_add_button (editor,
|
2004-03-17 07:45:48 +08:00
|
|
|
GTK_STOCK_NEW, str, view_class->new_help_id,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_new_clicked),
|
2004-03-17 07:45:48 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_new_extended_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
view);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2004-03-17 07:45:48 +08:00
|
|
|
g_free (str);
|
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
str = g_strdup_printf (_("%s\n"
|
2002-12-20 00:33:29 +08:00
|
|
|
"%s To Top"),
|
2003-02-17 21:33:29 +08:00
|
|
|
view_class->raise_desc,
|
2002-12-20 00:33:29 +08:00
|
|
|
gimp_get_mod_name_shift ());
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
view->raise_button =
|
2002-03-08 08:27:45 +08:00
|
|
|
gimp_editor_add_button (editor,
|
2003-08-24 21:52:51 +08:00
|
|
|
GTK_STOCK_GO_UP, str, view_class->raise_help_id,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_raise_clicked),
|
|
|
|
G_CALLBACK (gimp_item_tree_view_raise_extended_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
view);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2002-12-20 00:33:29 +08:00
|
|
|
g_free (str);
|
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
str = g_strdup_printf (_("%s\n"
|
2002-12-20 00:33:29 +08:00
|
|
|
"%s To Bottom"),
|
2003-02-17 21:33:29 +08:00
|
|
|
view_class->lower_desc,
|
2002-12-20 00:33:29 +08:00
|
|
|
gimp_get_mod_name_shift ());
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
view->lower_button =
|
2002-03-08 08:27:45 +08:00
|
|
|
gimp_editor_add_button (editor,
|
2003-08-24 21:52:51 +08:00
|
|
|
GTK_STOCK_GO_DOWN, str, view_class->lower_help_id,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_lower_clicked),
|
|
|
|
G_CALLBACK (gimp_item_tree_view_lower_extended_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
view);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2002-12-20 00:33:29 +08:00
|
|
|
g_free (str);
|
|
|
|
|
2001-08-05 04:38:54 +08:00
|
|
|
view->duplicate_button =
|
2002-03-08 08:27:45 +08:00
|
|
|
gimp_editor_add_button (editor,
|
2003-02-17 21:33:29 +08:00
|
|
|
GIMP_STOCK_DUPLICATE, view_class->duplicate_desc,
|
2003-08-24 21:52:51 +08:00
|
|
|
view_class->duplicate_help_id,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_duplicate_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
NULL,
|
|
|
|
view);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
|
|
|
view->delete_button =
|
2002-03-08 08:27:45 +08:00
|
|
|
gimp_editor_add_button (editor,
|
2003-08-24 21:52:51 +08:00
|
|
|
GTK_STOCK_DELETE, view_class->delete_desc,
|
|
|
|
view_class->delete_help_id,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_delete_clicked),
|
2002-03-08 08:27:45 +08:00
|
|
|
NULL,
|
|
|
|
view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
gtk_widget_set_sensitive (view->edit_button, FALSE);
|
2001-03-06 21:28:39 +08:00
|
|
|
gtk_widget_set_sensitive (view->new_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (view->raise_button, FALSE);
|
|
|
|
gtk_widget_set_sensitive (view->lower_button, FALSE);
|
2001-02-27 22:14:13 +08:00
|
|
|
gtk_widget_set_sensitive (view->duplicate_button, FALSE);
|
2001-03-06 21:28:39 +08:00
|
|
|
gtk_widget_set_sensitive (view->delete_button, FALSE);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-15 22:39:48 +08:00
|
|
|
view->visible_changed_handler_id = 0;
|
|
|
|
view->linked_changed_handler_id = 0;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
static void
|
|
|
|
gimp_item_tree_view_view_iface_init (GimpContainerViewInterface *view_iface)
|
|
|
|
{
|
|
|
|
parent_view_iface = g_type_interface_peek_parent (view_iface);
|
|
|
|
|
|
|
|
view_iface->set_container = gimp_item_tree_view_set_container;
|
|
|
|
view_iface->insert_item = gimp_item_tree_view_insert_item;
|
|
|
|
view_iface->select_item = gimp_item_tree_view_select_item;
|
|
|
|
view_iface->activate_item = gimp_item_tree_view_activate_item;
|
|
|
|
view_iface->context_item = gimp_item_tree_view_context_item;
|
|
|
|
}
|
|
|
|
|
2003-10-11 05:24:12 +08:00
|
|
|
static void
|
2003-10-11 22:30:18 +08:00
|
|
|
gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked_iface)
|
2003-10-11 05:24:12 +08:00
|
|
|
{
|
2003-10-19 01:10:36 +08:00
|
|
|
docked_iface->get_preview = NULL;
|
2003-10-11 05:24:12 +08:00
|
|
|
docked_iface->set_context = gimp_item_tree_view_set_docked_context;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_docked_context_changed (GimpContext *context,
|
|
|
|
GimpImage *gimage,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
|
|
|
gimp_item_tree_view_set_image (view, gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_set_docked_context (GimpDocked *docked,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpContext *prev_context)
|
|
|
|
{
|
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (docked);
|
|
|
|
GimpImage *gimage = NULL;
|
|
|
|
|
|
|
|
if (prev_context)
|
|
|
|
g_signal_handlers_disconnect_by_func (prev_context,
|
|
|
|
gimp_item_tree_view_docked_context_changed,
|
|
|
|
view);
|
|
|
|
|
|
|
|
if (context)
|
|
|
|
{
|
|
|
|
g_signal_connect (context, "image_changed",
|
|
|
|
G_CALLBACK (gimp_item_tree_view_docked_context_changed),
|
|
|
|
view);
|
|
|
|
|
|
|
|
gimage = gimp_context_get_image (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_item_tree_view_set_image (view, gimage);
|
|
|
|
}
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
static GObject *
|
|
|
|
gimp_item_tree_view_constructor (GType type,
|
|
|
|
guint n_params,
|
|
|
|
GObjectConstructParam *params)
|
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
GObject *object;
|
|
|
|
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);
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (object);
|
|
|
|
|
|
|
|
tree_view->name_cell->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
|
|
|
|
GTK_CELL_RENDERER_TEXT (tree_view->name_cell)->editable = TRUE;
|
|
|
|
|
2003-03-23 00:26:11 +08:00
|
|
|
tree_view->editable_cells = g_list_prepend (tree_view->editable_cells,
|
|
|
|
tree_view->name_cell);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
g_signal_connect (tree_view->name_cell, "edited",
|
|
|
|
G_CALLBACK (gimp_item_tree_view_name_edited),
|
|
|
|
item_view);
|
|
|
|
|
2003-05-09 04:26:01 +08:00
|
|
|
column = gtk_tree_view_column_new ();
|
|
|
|
gtk_tree_view_insert_column (tree_view->view, column, 0);
|
|
|
|
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->eye_cell = gimp_cell_renderer_toggle_new (GIMP_STOCK_VISIBLE);
|
|
|
|
gtk_tree_view_column_pack_start (column, item_view->eye_cell, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes (column, item_view->eye_cell,
|
2003-09-12 03:52:29 +08:00
|
|
|
"active",
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->model_column_visible,
|
2003-09-12 03:52:29 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->eye_cell);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2003-09-15 22:39:48 +08:00
|
|
|
g_signal_connect (item_view->eye_cell, "clicked",
|
|
|
|
G_CALLBACK (gimp_item_tree_view_eye_clicked),
|
2003-09-12 03:52:29 +08:00
|
|
|
item_view);
|
|
|
|
|
|
|
|
column = gtk_tree_view_column_new ();
|
2003-09-15 22:39:48 +08:00
|
|
|
gtk_tree_view_insert_column (tree_view->view, column, 1);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->chain_cell = gimp_cell_renderer_toggle_new (GIMP_STOCK_LINKED);
|
|
|
|
gtk_tree_view_column_pack_start (column, item_view->chain_cell, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes (column, item_view->chain_cell,
|
2003-05-09 04:26:01 +08:00
|
|
|
"active",
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->model_column_linked,
|
2003-05-09 04:26:01 +08:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
|
2003-09-15 22:39:48 +08:00
|
|
|
item_view->chain_cell);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2003-09-15 22:39:48 +08:00
|
|
|
g_signal_connect (item_view->chain_cell, "clicked",
|
|
|
|
G_CALLBACK (gimp_item_tree_view_chain_clicked),
|
2003-05-09 04:26:01 +08:00
|
|
|
item_view);
|
|
|
|
|
2003-12-22 00:15:34 +08:00
|
|
|
/* disable the default GimpContainerView drop handler */
|
2004-05-11 07:22:39 +08:00
|
|
|
gimp_container_view_set_dnd_widget (GIMP_CONTAINER_VIEW (item_view), NULL);
|
2003-12-22 00:15:34 +08:00
|
|
|
|
2003-12-21 20:11:44 +08:00
|
|
|
gimp_dnd_drag_dest_set_by_type (GTK_WIDGET (tree_view->view),
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
item_view->item_type,
|
|
|
|
GDK_ACTION_MOVE | GDK_ACTION_COPY);
|
|
|
|
|
|
|
|
/* connect "drop to new" manually as it makes a difference whether
|
|
|
|
* it was clicked or dropped
|
|
|
|
*/
|
|
|
|
gimp_dnd_viewable_dest_add (item_view->new_button,
|
|
|
|
item_view->item_type,
|
|
|
|
gimp_item_tree_view_new_dropped,
|
|
|
|
item_view);
|
|
|
|
|
|
|
|
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (item_view),
|
|
|
|
GTK_BUTTON (item_view->edit_button),
|
|
|
|
item_view->item_type);
|
|
|
|
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (item_view),
|
|
|
|
GTK_BUTTON (item_view->duplicate_button),
|
|
|
|
item_view->item_type);
|
|
|
|
gimp_container_view_enable_dnd (GIMP_CONTAINER_VIEW (item_view),
|
|
|
|
GTK_BUTTON (item_view->delete_button),
|
|
|
|
item_view->item_type);
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-12-21 20:11:44 +08:00
|
|
|
gimp_item_tree_view_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-12-21 20:11:44 +08:00
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (object);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-12-21 20:11:44 +08:00
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ITEM_TYPE:
|
|
|
|
view->item_type = (GType) g_value_get_pointer (value);
|
|
|
|
break;
|
|
|
|
case PROP_SIGNAL_NAME:
|
|
|
|
view->signal_name = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_ITEM_TYPE:
|
|
|
|
g_value_set_pointer (value, (gpointer) view->item_type);
|
|
|
|
break;
|
|
|
|
case PROP_SIGNAL_NAME:
|
|
|
|
g_value_set_string (value, view->signal_name);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (object);
|
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
|
|
|
if (view->gimage)
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_set_image (view, NULL);
|
2001-05-01 22:58: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
|
|
|
if (view->signal_name)
|
|
|
|
{
|
|
|
|
g_free (view->signal_name);
|
|
|
|
view->signal_name = NULL;
|
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_new (gint preview_size,
|
2003-04-08 20:39:02 +08:00
|
|
|
gint preview_border_width,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage,
|
|
|
|
GType item_type,
|
|
|
|
const gchar *signal_name,
|
|
|
|
GimpEditItemFunc edit_item_func,
|
2003-09-18 06:54:48 +08:00
|
|
|
GimpNewItemFunc new_item_func,
|
2002-02-26 22:40:30 +08:00
|
|
|
GimpActivateItemFunc activate_item_func,
|
2003-01-11 01:55:53 +08:00
|
|
|
GimpMenuFactory *menu_factory,
|
2004-04-22 00:33:17 +08:00
|
|
|
const gchar *menu_identifier,
|
|
|
|
const gchar *ui_identifier)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
GType view_type;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-04-01 21:53:47 +08:00
|
|
|
g_return_val_if_fail (preview_size > 0 &&
|
|
|
|
preview_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
|
2003-04-08 20:39:02 +08:00
|
|
|
g_return_val_if_fail (preview_border_width >= 0 &&
|
|
|
|
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
|
|
|
|
NULL);
|
2003-04-01 21:53:47 +08:00
|
|
|
g_return_val_if_fail (gimage == NULL || GIMP_IS_IMAGE (gimage), NULL);
|
2001-02-27 22:14:13 +08:00
|
|
|
g_return_val_if_fail (signal_name != NULL, NULL);
|
2002-02-26 01:58:50 +08:00
|
|
|
g_return_val_if_fail (edit_item_func != NULL, NULL);
|
2003-09-18 06:54:48 +08:00
|
|
|
g_return_val_if_fail (new_item_func != NULL, NULL);
|
2002-02-26 22:40:30 +08:00
|
|
|
g_return_val_if_fail (activate_item_func != NULL, NULL);
|
2003-01-11 01:55:53 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
|
|
|
|
g_return_val_if_fail (menu_identifier != NULL, NULL);
|
2004-04-22 00:33:17 +08:00
|
|
|
g_return_val_if_fail (ui_identifier != NULL, NULL);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2002-02-26 01:58:50 +08:00
|
|
|
if (item_type == GIMP_TYPE_LAYER)
|
2001-03-12 01:24:47 +08:00
|
|
|
{
|
2003-12-21 20:11:44 +08:00
|
|
|
view_type = GIMP_TYPE_LAYER_TREE_VIEW;
|
2001-03-12 01:24:47 +08:00
|
|
|
}
|
2002-02-26 01:58:50 +08:00
|
|
|
else if (item_type == GIMP_TYPE_CHANNEL)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-12-21 20:11:44 +08:00
|
|
|
view_type = GIMP_TYPE_CHANNEL_TREE_VIEW;
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
2002-02-26 13:42:14 +08:00
|
|
|
else if (item_type == GIMP_TYPE_VECTORS)
|
|
|
|
{
|
2003-12-21 20:11:44 +08:00
|
|
|
view_type = GIMP_TYPE_VECTORS_TREE_VIEW;
|
2002-02-26 13:42:14 +08:00
|
|
|
}
|
2001-03-12 01:24:47 +08:00
|
|
|
else
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
g_warning ("gimp_item_tree_view_new: unsupported item type '%s'\n",
|
2003-02-17 21:33:29 +08:00
|
|
|
g_type_name (item_type));
|
|
|
|
return NULL;
|
2001-03-12 01:24:47 +08:00
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-12-21 20:11:44 +08:00
|
|
|
item_view = g_object_new (view_type,
|
2004-05-11 07:22:39 +08:00
|
|
|
"reorderable", TRUE,
|
2003-12-21 20:11:44 +08:00
|
|
|
"item-type", item_type,
|
|
|
|
"signal-name", signal_name,
|
|
|
|
NULL);
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (item_view),
|
|
|
|
preview_size, preview_border_width);
|
2003-03-27 01:49:42 +08:00
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
item_view->edit_item_func = edit_item_func;
|
2003-09-18 06:54:48 +08:00
|
|
|
item_view->new_item_func = new_item_func;
|
2003-03-19 23:17:13 +08:00
|
|
|
item_view->activate_item_func = activate_item_func;
|
2001-11-30 22:41:56 +08:00
|
|
|
|
2003-03-21 19:47:37 +08:00
|
|
|
gimp_editor_create_menu (GIMP_EDITOR (item_view),
|
2004-04-22 00:33:17 +08:00
|
|
|
menu_factory, menu_identifier, ui_identifier,
|
|
|
|
item_view);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
gimp_item_tree_view_set_image (item_view, gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
return GTK_WIDGET (item_view);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_set_image (GimpItemTreeView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage)
|
2001-05-03 20:26:05 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
g_return_if_fail (GIMP_IS_ITEM_TREE_VIEW (view));
|
2001-05-03 20:26:05 +08:00
|
|
|
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (view, view_signals[SET_IMAGE], 0, gimage);
|
2001-05-03 20:26:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_real_set_image (GimpItemTreeView *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
|
|
|
g_return_if_fail (GIMP_IS_ITEM_TREE_VIEW (view));
|
2001-02-27 22:14:13 +08:00
|
|
|
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
|
|
|
|
|
|
|
if (view->gimage == gimage)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (view->gimage)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (view->gimage,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_item_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);
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (view->gimage,
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_size_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
|
|
|
|
|
|
|
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
view->gimage = gimage;
|
|
|
|
|
|
|
|
if (view->gimage)
|
|
|
|
{
|
|
|
|
GimpContainer *container;
|
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
container =
|
2003-03-16 19:14:29 +08:00
|
|
|
GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_container (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
|
|
|
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), container);
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (view->gimage, view->signal_name,
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_item_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);
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (view->gimage, "size_changed",
|
2003-03-16 19:14:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_size_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-12 01:24:47 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_item_changed (view->gimage, view);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
2001-03-06 21:28:39 +08:00
|
|
|
|
|
|
|
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* GimpContainerView methods */
|
|
|
|
|
2003-05-09 04:26:01 +08:00
|
|
|
static void
|
|
|
|
gimp_item_tree_view_set_container (GimpContainerView *view,
|
|
|
|
GimpContainer *container)
|
|
|
|
{
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
GimpContainer *old_container;
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
old_container = gimp_container_view_get_container (view);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
if (old_container)
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2004-05-11 01:16:50 +08:00
|
|
|
gimp_container_remove_handler (old_container,
|
2003-09-12 03:52:29 +08:00
|
|
|
item_view->visible_changed_handler_id);
|
2004-05-11 01:16:50 +08:00
|
|
|
gimp_container_remove_handler (old_container,
|
2003-05-09 04:26:01 +08:00
|
|
|
item_view->linked_changed_handler_id);
|
2003-09-15 22:39:48 +08:00
|
|
|
|
|
|
|
item_view->visible_changed_handler_id = 0;
|
|
|
|
item_view->linked_changed_handler_id = 0;
|
2003-05-09 04:26:01 +08:00
|
|
|
}
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
parent_view_iface->set_container (view, container);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
if (container)
|
2003-05-09 04:26:01 +08:00
|
|
|
{
|
2003-09-12 03:52:29 +08:00
|
|
|
item_view->visible_changed_handler_id =
|
2004-05-11 01:16:50 +08:00
|
|
|
gimp_container_add_handler (container, "visibility_changed",
|
2003-09-12 03:52:29 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_visible_changed),
|
|
|
|
view);
|
2003-05-09 04:26:01 +08:00
|
|
|
item_view->linked_changed_handler_id =
|
2004-05-11 01:16:50 +08:00
|
|
|
gimp_container_add_handler (container, "linked_changed",
|
2003-05-09 04:26:01 +08:00
|
|
|
G_CALLBACK (gimp_item_tree_view_linked_changed),
|
|
|
|
view);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gimp_item_tree_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index)
|
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
GimpItem *item;
|
|
|
|
GtkTreeIter *iter;
|
|
|
|
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (view);
|
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
iter = parent_view_iface->insert_item (view, viewable, index);
|
2003-05-09 04:26:01 +08:00
|
|
|
|
|
|
|
item = GIMP_ITEM (viewable);
|
|
|
|
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
2003-09-12 03:52:29 +08:00
|
|
|
item_view->model_column_visible,
|
|
|
|
gimp_item_get_visible (item),
|
2003-05-09 04:26:01 +08:00
|
|
|
item_view->model_column_linked,
|
|
|
|
gimp_item_get_linked (item),
|
|
|
|
-1);
|
|
|
|
|
|
|
|
return iter;
|
|
|
|
}
|
|
|
|
|
2003-05-18 21:28:27 +08:00
|
|
|
static gboolean
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_select_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeView *tree_view = GIMP_ITEM_TREE_VIEW (view);
|
2003-09-18 06:54:48 +08:00
|
|
|
gboolean edit_sensitive = FALSE;
|
2002-02-26 01:58:50 +08:00
|
|
|
gboolean raise_sensitive = FALSE;
|
|
|
|
gboolean lower_sensitive = FALSE;
|
|
|
|
gboolean duplicate_sensitive = FALSE;
|
|
|
|
gboolean delete_sensitive = FALSE;
|
2003-05-18 21:28:27 +08:00
|
|
|
gboolean success;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
success = parent_view_iface->select_item (view, item, insert_data);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2001-03-06 21:28:39 +08:00
|
|
|
if (item)
|
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *active_item;
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpContainer *container;
|
2003-02-17 21:33:29 +08:00
|
|
|
gint index;
|
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (tree_view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
active_item = item_view_class->get_active_item (tree_view->gimage);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (active_item != (GimpItem *) item)
|
2001-03-06 21:28:39 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class->set_active_item (tree_view->gimage,
|
2003-02-17 21:33:29 +08:00
|
|
|
GIMP_ITEM (item));
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_image_flush (tree_view->gimage);
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
if (container->num_children > 1)
|
2001-03-06 21:28:39 +08:00
|
|
|
{
|
|
|
|
if (index > 0)
|
|
|
|
raise_sensitive = TRUE;
|
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
if (index < (container->num_children - 1))
|
2001-03-06 21:28:39 +08:00
|
|
|
lower_sensitive = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
edit_sensitive = TRUE;
|
2003-09-18 06:54:48 +08:00
|
|
|
duplicate_sensitive = TRUE;
|
2001-03-06 21:28:39 +08:00
|
|
|
delete_sensitive = TRUE;
|
|
|
|
}
|
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
gtk_widget_set_sensitive (tree_view->edit_button, edit_sensitive);
|
2003-03-16 19:14:29 +08:00
|
|
|
gtk_widget_set_sensitive (tree_view->raise_button, raise_sensitive);
|
|
|
|
gtk_widget_set_sensitive (tree_view->lower_button, lower_sensitive);
|
|
|
|
gtk_widget_set_sensitive (tree_view->duplicate_button, duplicate_sensitive);
|
|
|
|
gtk_widget_set_sensitive (tree_view->delete_button, delete_sensitive);
|
2003-05-18 21:28:27 +08:00
|
|
|
|
|
|
|
return success;
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_activate_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
2002-02-26 22:40:30 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
if (parent_view_iface->activate_item)
|
|
|
|
parent_view_iface->activate_item (view, item, insert_data);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-11-08 23:32:38 +08:00
|
|
|
item_view->activate_item_func (GIMP_ITEM (item), GTK_WIDGET (view));
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
|
|
|
|
2001-04-29 23:23:01 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_context_item (GimpContainerView *view,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *item,
|
|
|
|
gpointer insert_data)
|
2001-04-29 23:23:01 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpEditor *editor = GIMP_EDITOR (view);
|
2001-11-30 22:41:56 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
if (parent_view_iface->context_item)
|
|
|
|
parent_view_iface->context_item (view, item, insert_data);
|
2001-04-29 23:23:01 +08:00
|
|
|
|
2004-04-23 01:14:22 +08:00
|
|
|
if (editor->ui_manager)
|
|
|
|
{
|
|
|
|
gimp_ui_manager_update (editor->ui_manager,
|
|
|
|
editor->popup_data);
|
|
|
|
gimp_ui_manager_ui_popup (editor->ui_manager,
|
2004-04-29 20:52:29 +08:00
|
|
|
editor->ui_path,
|
2004-04-23 01:14:22 +08:00
|
|
|
editor->popup_data,
|
|
|
|
GTK_WIDGET (editor),
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
}
|
2001-04-29 23:23:01 +08:00
|
|
|
}
|
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_item_tree_view_drop_possible (GimpContainerTreeView *tree_view,
|
|
|
|
GimpViewable *src_viewable,
|
|
|
|
GimpViewable *dest_viewable,
|
|
|
|
GtkTreeViewDropPosition drop_pos,
|
|
|
|
GdkDragAction *drag_action)
|
|
|
|
{
|
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (tree_view);
|
|
|
|
|
|
|
|
if (gimp_item_get_image (GIMP_ITEM (src_viewable)) !=
|
|
|
|
gimp_item_get_image (GIMP_ITEM (dest_viewable)))
|
|
|
|
{
|
2003-08-28 01:21:49 +08:00
|
|
|
if (drag_action)
|
|
|
|
*drag_action = GDK_ACTION_COPY;
|
2003-03-19 23:17:13 +08:00
|
|
|
|
2003-08-28 01:21:49 +08:00
|
|
|
return TRUE;
|
2003-03-19 23:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return GIMP_CONTAINER_TREE_VIEW_CLASS (parent_class)->drop_possible (tree_view,
|
|
|
|
src_viewable,
|
|
|
|
dest_viewable,
|
|
|
|
drop_pos,
|
|
|
|
drag_action);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_drop (GimpContainerTreeView *tree_view,
|
|
|
|
GimpViewable *src_viewable,
|
|
|
|
GimpViewable *dest_viewable,
|
|
|
|
GtkTreeViewDropPosition drop_pos)
|
|
|
|
{
|
|
|
|
GimpContainerView *container_view;
|
|
|
|
GimpItemTreeView *item_view;
|
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpContainer *container;
|
2003-03-19 23:17:13 +08:00
|
|
|
GimpObject *src_object;
|
|
|
|
GimpObject *dest_object;
|
|
|
|
gint src_index;
|
|
|
|
gint dest_index;
|
|
|
|
|
|
|
|
container_view = GIMP_CONTAINER_VIEW (tree_view);
|
|
|
|
item_view = GIMP_ITEM_TREE_VIEW (tree_view);
|
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (container_view);
|
|
|
|
|
2003-03-19 23:17:13 +08:00
|
|
|
src_object = GIMP_OBJECT (src_viewable);
|
|
|
|
dest_object = GIMP_OBJECT (dest_viewable);
|
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
src_index = gimp_container_get_child_index (container, src_object);
|
|
|
|
dest_index = gimp_container_get_child_index (container, dest_object);
|
2003-03-19 23:17:13 +08:00
|
|
|
|
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (item_view);
|
|
|
|
|
|
|
|
if (item_view->gimage != gimp_item_get_image (GIMP_ITEM (src_viewable)))
|
|
|
|
{
|
|
|
|
GimpItem *new_item;
|
|
|
|
|
|
|
|
if (drop_pos == GTK_TREE_VIEW_DROP_AFTER)
|
|
|
|
dest_index++;
|
|
|
|
|
2003-08-28 01:21:49 +08:00
|
|
|
new_item = gimp_item_convert (GIMP_ITEM (src_viewable),
|
|
|
|
item_view->gimage,
|
|
|
|
G_TYPE_FROM_INSTANCE (src_viewable),
|
|
|
|
TRUE);
|
2003-03-19 23:17:13 +08:00
|
|
|
|
|
|
|
item_view_class->add_item (item_view->gimage,
|
|
|
|
new_item,
|
|
|
|
dest_index);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (drop_pos == GTK_TREE_VIEW_DROP_AFTER && src_index > dest_index)
|
|
|
|
{
|
|
|
|
dest_index++;
|
|
|
|
}
|
|
|
|
else if (drop_pos == GTK_TREE_VIEW_DROP_BEFORE && src_index < dest_index)
|
|
|
|
{
|
|
|
|
dest_index--;
|
|
|
|
}
|
|
|
|
|
|
|
|
item_view_class->reorder_item (item_view->gimage,
|
|
|
|
GIMP_ITEM (src_object),
|
|
|
|
dest_index,
|
|
|
|
TRUE,
|
2003-03-20 00:37:24 +08:00
|
|
|
item_view_class->reorder_desc);
|
2003-03-19 23:17:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_image_flush (item_view->gimage);
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
2003-09-18 06:54:48 +08:00
|
|
|
/* "Edit" functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_edit_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
|
|
|
GimpItem *item;
|
|
|
|
|
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
|
|
|
|
|
|
|
if (item)
|
2003-11-08 23:32:38 +08:00
|
|
|
view->edit_item_func (item, GTK_WIDGET (view));
|
2003-09-18 06:54:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
/* "New" functions */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_new_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-03-17 22:14:18 +08:00
|
|
|
view->new_item_func (view->gimage, NULL, FALSE, GTK_WIDGET (view));
|
2004-03-18 00:45:18 +08:00
|
|
|
gimp_image_flush (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2004-03-17 07:45:48 +08:00
|
|
|
static void
|
|
|
|
gimp_item_tree_view_new_extended_clicked (GtkWidget *widget,
|
|
|
|
guint state,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
2004-03-17 22:14:18 +08:00
|
|
|
view->new_item_func (view->gimage, NULL, TRUE, GTK_WIDGET (view));
|
2004-03-17 07:45:48 +08:00
|
|
|
}
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer data)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (data);
|
|
|
|
GimpContainer *container;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-11-08 23:32:38 +08:00
|
|
|
view->new_item_func (view->gimage, GIMP_ITEM (viewable), FALSE,
|
|
|
|
GTK_WIDGET (view));
|
2002-09-02 22:39:08 +08:00
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* "Duplicate" functions */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_duplicate_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2002-02-26 01:58:50 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *new_item;
|
2002-02-26 01:58:50 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
new_item = gimp_item_duplicate (item,
|
|
|
|
G_TYPE_FROM_INSTANCE (item),
|
|
|
|
TRUE);
|
|
|
|
|
|
|
|
if (new_item)
|
|
|
|
{
|
|
|
|
item_view_class->add_item (view->gimage, new_item, -1);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2002-02-26 01:58:50 +08:00
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* "Raise/Lower" functions */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_raise_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2001-03-06 21:28:39 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpContainer *container;
|
|
|
|
gint index;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
2003-02-17 21:33:29 +08:00
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
if (index > 0)
|
|
|
|
{
|
|
|
|
item_view_class->reorder_item (view->gimage, item, index - 1, TRUE,
|
|
|
|
item_view_class->raise_desc);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2001-05-07 04:31:46 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_raise_extended_clicked (GtkWidget *widget,
|
2002-02-26 01:58:50 +08:00
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeView *view)
|
2001-05-07 04:31:46 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2001-05-07 04:31:46 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpContainer *container;
|
|
|
|
gint index;
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
2003-02-17 21:33:29 +08:00
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
if ((state & GDK_SHIFT_MASK) && (index > 0))
|
|
|
|
{
|
|
|
|
item_view_class->reorder_item (view->gimage, item, 0, TRUE,
|
|
|
|
item_view_class->raise_to_top_desc);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2001-05-07 04:31:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_lower_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2001-03-06 21:28:39 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpContainer *container;
|
|
|
|
gint index;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
2003-02-17 21:33:29 +08:00
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
if (index < container->num_children - 1)
|
|
|
|
{
|
|
|
|
item_view_class->reorder_item (view->gimage, item, index + 1, TRUE,
|
|
|
|
item_view_class->lower_desc);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2001-03-06 21:28:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-07 04:31:46 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_lower_extended_clicked (GtkWidget *widget,
|
2002-02-26 01:58:50 +08:00
|
|
|
guint state,
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeView *view)
|
2001-05-07 04:31:46 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
2001-05-07 04:31:46 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpContainer *container;
|
|
|
|
gint index;
|
2001-05-07 04:31:46 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
container = gimp_container_view_get_container (GIMP_CONTAINER_VIEW (view));
|
2003-02-17 21:33:29 +08:00
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, GIMP_OBJECT (item));
|
|
|
|
|
|
|
|
if ((state & GDK_SHIFT_MASK) && (index < container->num_children - 1))
|
|
|
|
{
|
|
|
|
item_view_class->reorder_item (view->gimage, item,
|
|
|
|
container->num_children - 1, TRUE,
|
|
|
|
item_view_class->lower_to_bottom_desc);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2001-05-07 04:31:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* "Delete" functions */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_delete_clicked (GtkWidget *widget,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-03-16 19:14:29 +08:00
|
|
|
GimpItemTreeViewClass *item_view_class;
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
item = item_view_class->get_active_item (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
if (item)
|
|
|
|
{
|
|
|
|
item_view_class->remove_item (view->gimage, item);
|
|
|
|
|
|
|
|
gimp_image_flush (view->gimage);
|
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* GimpImage callbacks */
|
|
|
|
|
2001-02-27 22:14:13 +08:00
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_item_changed (GimpImage *gimage,
|
|
|
|
GimpItemTreeView *view)
|
2001-02-27 22:14:13 +08:00
|
|
|
{
|
2003-02-17 21:33:29 +08:00
|
|
|
GimpItem *item;
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-03-16 19:14:29 +08:00
|
|
|
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
2001-02-27 22:14:13 +08:00
|
|
|
|
2003-02-17 21:33:29 +08:00
|
|
|
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (view),
|
|
|
|
(GimpViewable *) item);
|
2001-02-27 22:14:13 +08:00
|
|
|
}
|
2001-05-07 01:56:10 +08:00
|
|
|
|
|
|
|
static void
|
2003-03-16 19:14:29 +08:00
|
|
|
gimp_item_tree_view_size_changed (GimpImage *gimage,
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpItemTreeView *tree_view)
|
2001-05-07 01:56:10 +08:00
|
|
|
{
|
2004-05-11 01:16:50 +08:00
|
|
|
GimpContainerView *view = GIMP_CONTAINER_VIEW (tree_view);;
|
|
|
|
gint preview_size;
|
|
|
|
gint border_width;
|
2001-05-07 01:56:10 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
preview_size = gimp_container_view_get_preview_size (view, &border_width);
|
2001-05-07 01:56:10 +08:00
|
|
|
|
2004-05-11 01:16:50 +08:00
|
|
|
gimp_container_view_set_preview_size (view, preview_size, border_width);
|
2001-05-07 01:56:10 +08:00
|
|
|
}
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_name_edited (GtkCellRendererText *cell,
|
|
|
|
const gchar *path_str,
|
|
|
|
const gchar *new_text,
|
|
|
|
GimpItemTreeView *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;
|
|
|
|
GimpItem *item;
|
|
|
|
|
|
|
|
gtk_tree_model_get (tree_view->model, &iter,
|
|
|
|
tree_view->model_column_renderer, &renderer,
|
|
|
|
-1);
|
|
|
|
|
|
|
|
item = GIMP_ITEM (renderer->viewable);
|
|
|
|
|
2004-02-02 04:38:26 +08:00
|
|
|
if (gimp_item_rename (item, new_text))
|
|
|
|
{
|
|
|
|
gimp_image_flush (gimp_item_get_image (item));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gchar *name = gimp_viewable_get_description (renderer->viewable, NULL);
|
|
|
|
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
|
|
|
|
tree_view->model_column_name, name,
|
|
|
|
-1);
|
|
|
|
g_free (name);
|
|
|
|
}
|
2003-03-16 19:14:29 +08:00
|
|
|
|
|
|
|
g_object_unref (renderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
2003-05-09 04:26:01 +08:00
|
|
|
|
|
|
|
|
2003-09-12 03:52:29 +08:00
|
|
|
/* "Visible" callbacks */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_visible_changed (GimpItem *item,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpContainerView *container_view = GIMP_CONTAINER_VIEW (view);
|
|
|
|
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
GtkTreeIter *iter;
|
2004-05-11 01:16:50 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
iter = gimp_container_view_lookup (container_view,
|
|
|
|
(GimpViewable *) item);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
|
|
|
if (iter)
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
|
|
|
view->model_column_visible,
|
|
|
|
gimp_item_get_visible (item),
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_eye_clicked (GtkCellRendererToggle *toggle,
|
|
|
|
gchar *path_str,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
2003-11-15 01:35:51 +08:00
|
|
|
gimp_item_tree_view_toggle_clicked (toggle, path_str, state, view,
|
2004-03-19 03:39:19 +08:00
|
|
|
GIMP_UNDO_ITEM_VISIBILITY);
|
2003-11-15 01:35:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* "Linked" callbacks */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_linked_changed (GimpItem *item,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
2004-05-11 07:22:39 +08:00
|
|
|
GimpContainerView *container_view = GIMP_CONTAINER_VIEW (view);
|
|
|
|
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
|
|
|
GtkTreeIter *iter;
|
2004-05-11 01:16:50 +08:00
|
|
|
|
2004-05-11 07:22:39 +08:00
|
|
|
iter = gimp_container_view_lookup (container_view,
|
|
|
|
(GimpViewable *) item);
|
2003-11-15 01:35:51 +08:00
|
|
|
|
|
|
|
if (iter)
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
|
|
|
view->model_column_linked,
|
|
|
|
gimp_item_get_linked (item),
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_chain_clicked (GtkCellRendererToggle *toggle,
|
|
|
|
gchar *path_str,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view)
|
|
|
|
{
|
|
|
|
gimp_item_tree_view_toggle_clicked (toggle, path_str, state, view,
|
2004-03-19 03:39:19 +08:00
|
|
|
GIMP_UNDO_ITEM_LINKED);
|
2003-11-15 01:35:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Utility functions used from eye_clicked and chain_clicked.
|
|
|
|
* Would make sense to do this in a generic fashion using
|
|
|
|
* properties, but for now it's better than duplicating the code.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gimp_item_tree_view_toggle_clicked (GtkCellRendererToggle *toggle,
|
|
|
|
gchar *path_str,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpItemTreeView *view,
|
2004-03-19 03:39:19 +08:00
|
|
|
GimpUndoType undo_type)
|
2003-11-15 01:35:51 +08:00
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
2003-09-12 03:52:29 +08:00
|
|
|
GtkTreePath *path;
|
|
|
|
GtkTreeIter iter;
|
2004-03-19 03:39:19 +08:00
|
|
|
GimpUndoType group_type;
|
2003-11-15 01:35:51 +08:00
|
|
|
const gchar *undo_desc;
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2003-11-15 01:35:51 +08:00
|
|
|
gboolean (* getter) (const GimpItem *item);
|
|
|
|
void (* setter) (GimpItem *item,
|
|
|
|
gboolean value,
|
|
|
|
gboolean push_undo);
|
2004-03-19 03:39:19 +08:00
|
|
|
gboolean (* pusher) (GimpImage *gimage,
|
|
|
|
const gchar *undo_desc,
|
|
|
|
GimpItem *item);
|
2003-11-15 01:35:51 +08:00
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
switch (undo_type)
|
2003-11-15 01:35:51 +08:00
|
|
|
{
|
2004-03-19 03:39:19 +08:00
|
|
|
case GIMP_UNDO_ITEM_VISIBILITY:
|
|
|
|
getter = gimp_item_get_visible;
|
|
|
|
setter = gimp_item_set_visible;
|
|
|
|
pusher = gimp_image_undo_push_item_visibility;
|
|
|
|
group_type = GIMP_UNDO_GROUP_ITEM_VISIBILITY;
|
|
|
|
undo_desc = _("Set Item Exclusive Visible");
|
2003-11-15 01:35:51 +08:00
|
|
|
break;
|
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
case GIMP_UNDO_ITEM_LINKED:
|
|
|
|
getter = gimp_item_get_linked;
|
|
|
|
setter = gimp_item_set_linked;
|
|
|
|
pusher = gimp_image_undo_push_item_linked;
|
|
|
|
group_type = GIMP_UNDO_GROUP_ITEM_LINKED;
|
|
|
|
undo_desc = _("Set Item Exclusive Linked");
|
2003-11-15 01:35:51 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2003-09-12 03:52:29 +08:00
|
|
|
|
|
|
|
path = gtk_tree_path_new_from_string (path_str);
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
|
|
|
|
{
|
|
|
|
GimpPreviewRenderer *renderer;
|
|
|
|
GimpItem *item;
|
|
|
|
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);
|
|
|
|
|
|
|
|
item = GIMP_ITEM (renderer->viewable);
|
|
|
|
g_object_unref (renderer);
|
|
|
|
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
|
|
|
|
if (state & GDK_SHIFT_MASK)
|
|
|
|
{
|
2003-11-15 01:35:51 +08:00
|
|
|
GList *on = NULL;
|
|
|
|
GList *off = NULL;
|
2003-09-12 03:52:29 +08:00
|
|
|
GList *list;
|
|
|
|
gboolean iter_valid;
|
|
|
|
|
|
|
|
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 ((GimpItem *) renderer->viewable != item)
|
|
|
|
{
|
2003-11-15 01:35:51 +08:00
|
|
|
if (getter (GIMP_ITEM (renderer->viewable)))
|
|
|
|
on = g_list_prepend (on, renderer->viewable);
|
2003-09-12 03:52:29 +08:00
|
|
|
else
|
2003-11-15 01:35:51 +08:00
|
|
|
off = g_list_prepend (off, renderer->viewable);
|
2003-09-12 03:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref (renderer);
|
|
|
|
}
|
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
if (on || off || ! getter (item))
|
|
|
|
{
|
|
|
|
GimpUndo *undo = gimp_undo_stack_peek (gimage->undo_stack);
|
|
|
|
gboolean push_undo = TRUE;
|
|
|
|
|
|
|
|
/* compress exclusive visibility/linked undos */
|
|
|
|
if (! gimp_undo_stack_peek (gimage->redo_stack) &&
|
|
|
|
GIMP_IS_UNDO_STACK (undo) &&
|
|
|
|
undo->undo_type == group_type &&
|
|
|
|
g_object_get_data (G_OBJECT (undo), "item-type")
|
|
|
|
== (gpointer) view->item_type)
|
|
|
|
push_undo = FALSE;
|
|
|
|
|
|
|
|
if (push_undo)
|
|
|
|
{
|
|
|
|
if (gimp_image_undo_group_start (gimage, group_type,
|
|
|
|
undo_desc))
|
|
|
|
{
|
|
|
|
undo = gimp_undo_stack_peek (gimage->undo_stack);
|
2004-03-19 01:01:46 +08:00
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
if (GIMP_IS_UNDO_STACK (undo) &&
|
|
|
|
undo->undo_type == group_type)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (undo), "item-type",
|
|
|
|
(gpointer) view->item_type);
|
|
|
|
}
|
|
|
|
}
|
2004-03-19 01:01:46 +08:00
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
pusher (gimage, NULL, item);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
for (list = on; list; list = g_list_next (list))
|
|
|
|
pusher (gimage, NULL, list->data);
|
|
|
|
|
|
|
|
for (list = off; list; list = g_list_next (list))
|
|
|
|
pusher (gimage, NULL, list->data);
|
|
|
|
|
|
|
|
gimp_image_undo_group_end (gimage);
|
|
|
|
}
|
2004-03-20 07:42:42 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_undo_refresh_preview (undo);
|
|
|
|
}
|
2004-03-19 03:39:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
setter (item, TRUE, FALSE);
|
2003-09-12 03:52:29 +08:00
|
|
|
|
2003-11-15 01:35:51 +08:00
|
|
|
if (on)
|
2003-09-12 03:52:29 +08:00
|
|
|
{
|
2003-11-15 01:35:51 +08:00
|
|
|
for (list = on; list; list = g_list_next (list))
|
2004-03-19 03:39:19 +08:00
|
|
|
setter (GIMP_ITEM (list->data), FALSE, FALSE);
|
2003-09-12 03:52:29 +08:00
|
|
|
}
|
2003-11-15 01:35:51 +08:00
|
|
|
else if (off)
|
2003-09-12 03:52:29 +08:00
|
|
|
{
|
2003-11-15 01:35:51 +08:00
|
|
|
for (list = off; list; list = g_list_next (list))
|
2004-03-19 03:39:19 +08:00
|
|
|
setter (GIMP_ITEM (list->data), TRUE, FALSE);
|
2003-09-12 03:52:29 +08:00
|
|
|
}
|
|
|
|
|
2003-11-15 01:35:51 +08:00
|
|
|
g_list_free (on);
|
|
|
|
g_list_free (off);
|
2003-09-12 03:52:29 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-19 01:01:46 +08:00
|
|
|
GimpUndo *undo;
|
|
|
|
gboolean push_undo = TRUE;
|
|
|
|
|
|
|
|
undo = gimp_undo_stack_peek (gimage->undo_stack);
|
|
|
|
|
2004-03-19 03:39:19 +08:00
|
|
|
/* compress undos */
|
|
|
|
if (! gimp_undo_stack_peek (gimage->redo_stack) &&
|
|
|
|
GIMP_IS_ITEM_UNDO (undo) &&
|
|
|
|
GIMP_ITEM_UNDO (undo)->item == item &&
|
|
|
|
undo->undo_type == undo_type)
|
2004-03-19 01:01:46 +08:00
|
|
|
push_undo = FALSE;
|
|
|
|
|
|
|
|
setter (item, ! active, push_undo);
|
2004-03-20 07:42:42 +08:00
|
|
|
|
|
|
|
if (!push_undo)
|
|
|
|
gimp_undo_refresh_preview (undo);
|
2003-09-12 03:52:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gimp_image_flush (gimage);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|