2001-02-05 23:22:20 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-04-22 08:38:56 +08:00
|
|
|
* gimpcontainerlistview.c
|
|
|
|
* Copyright (C) 2001 Michael Natterer
|
|
|
|
*
|
2001-02-05 23:22:20 +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 <stdio.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
#include "gimpcontainerlistview.h"
|
2001-02-19 03:44:28 +08:00
|
|
|
#include "gimpdnd.h"
|
2001-03-04 07:23:36 +08:00
|
|
|
#include "gimplistitem.h"
|
2001-02-05 23:22:20 +08:00
|
|
|
#include "gimppreview.h"
|
|
|
|
|
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
static void gimp_container_list_view_class_init (GimpContainerListViewClass *klass);
|
|
|
|
static void gimp_container_list_view_init (GimpContainerListView *panel);
|
|
|
|
static void gimp_container_list_view_destroy (GtkObject *object);
|
|
|
|
|
|
|
|
static gpointer gimp_container_list_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index);
|
|
|
|
static void gimp_container_list_view_remove_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer insert_data);
|
2001-02-18 05:20:10 +08:00
|
|
|
static void gimp_container_list_view_reorder_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint new_index,
|
|
|
|
gpointer insert_data);
|
2001-02-07 23:01:52 +08:00
|
|
|
static void gimp_container_list_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer insert_data);
|
2001-02-06 03:10:40 +08:00
|
|
|
static void gimp_container_list_view_clear_items (GimpContainerView *view);
|
2001-02-06 07:14:14 +08:00
|
|
|
static void gimp_container_list_view_set_preview_size (GimpContainerView *view);
|
2001-02-06 03:10:40 +08:00
|
|
|
|
2001-02-07 23:01:52 +08:00
|
|
|
static void gimp_container_list_view_item_selected (GtkWidget *widget,
|
|
|
|
GtkWidget *child,
|
|
|
|
gpointer data);
|
2001-02-27 22:14:13 +08:00
|
|
|
static gint gimp_container_list_view_item_activated (GtkWidget *widget,
|
2001-02-19 03:44:28 +08:00
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
static GimpContainerViewClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
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
|
2001-02-05 23:22:20 +08:00
|
|
|
gimp_container_list_view_get_type (void)
|
|
|
|
{
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
static GType list_view_type = 0;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
|
|
if (! list_view_type)
|
|
|
|
{
|
|
|
|
GtkTypeInfo list_view_info =
|
|
|
|
{
|
|
|
|
"GimpContainerListView",
|
|
|
|
sizeof (GimpContainerListView),
|
|
|
|
sizeof (GimpContainerListViewClass),
|
|
|
|
(GtkClassInitFunc) gimp_container_list_view_class_init,
|
|
|
|
(GtkObjectInitFunc) gimp_container_list_view_init,
|
|
|
|
/* reserved_1 */ NULL,
|
|
|
|
/* reserved_2 */ NULL,
|
|
|
|
(GtkClassInitFunc) NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
list_view_type = gtk_type_unique (GIMP_TYPE_CONTAINER_VIEW,
|
|
|
|
&list_view_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return list_view_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_list_view_class_init (GimpContainerListViewClass *klass)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
GimpContainerViewClass *container_view_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass *) klass;
|
|
|
|
container_view_class = (GimpContainerViewClass *) klass;
|
|
|
|
|
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-05 23:22:20 +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
|
|
|
object_class->destroy = gimp_container_list_view_destroy;
|
2001-02-06 03:10:40 +08:00
|
|
|
|
2001-02-06 07:14:14 +08:00
|
|
|
container_view_class->insert_item = gimp_container_list_view_insert_item;
|
|
|
|
container_view_class->remove_item = gimp_container_list_view_remove_item;
|
2001-02-18 05:20:10 +08:00
|
|
|
container_view_class->reorder_item = gimp_container_list_view_reorder_item;
|
2001-02-07 23:01:52 +08:00
|
|
|
container_view_class->select_item = gimp_container_list_view_select_item;
|
2001-02-06 07:14:14 +08:00
|
|
|
container_view_class->clear_items = gimp_container_list_view_clear_items;
|
|
|
|
container_view_class->set_preview_size = gimp_container_list_view_set_preview_size;
|
2001-02-05 23:22:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_list_view_init (GimpContainerListView *list_view)
|
|
|
|
{
|
2001-02-09 07:24:06 +08:00
|
|
|
list_view->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view->scrolled_win),
|
2001-02-05 23:22:20 +08:00
|
|
|
GTK_POLICY_AUTOMATIC,
|
2001-05-07 02:58:04 +08:00
|
|
|
GTK_POLICY_AUTOMATIC);
|
2001-02-09 07:24:06 +08:00
|
|
|
gtk_box_pack_start (GTK_BOX (list_view), list_view->scrolled_win,
|
|
|
|
TRUE, TRUE, 0);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
|
|
list_view->gtk_list = gtk_list_new ();
|
2001-02-09 07:24:06 +08:00
|
|
|
gtk_scrolled_window_add_with_viewport
|
|
|
|
(GTK_SCROLLED_WINDOW (list_view->scrolled_win),
|
|
|
|
list_view->gtk_list);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
gtk_list_set_selection_mode (GTK_LIST (list_view->gtk_list),
|
2001-02-11 03:35:29 +08:00
|
|
|
GTK_SELECTION_SINGLE);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
gtk_container_set_focus_vadjustment
|
|
|
|
(GTK_CONTAINER (list_view->gtk_list),
|
2001-02-09 07:24:06 +08:00
|
|
|
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW
|
|
|
|
(list_view->scrolled_win)));
|
2001-02-06 23:57:07 +08:00
|
|
|
|
2001-02-09 07:24:06 +08:00
|
|
|
GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW
|
|
|
|
(list_view->scrolled_win)->vscrollbar,
|
2001-02-05 23:22:20 +08:00
|
|
|
GTK_CAN_FOCUS);
|
|
|
|
|
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_connect_object (G_OBJECT (list_view->gtk_list), "select_child",
|
|
|
|
G_CALLBACK (gimp_container_list_view_item_selected),
|
|
|
|
G_OBJECT (list_view),
|
|
|
|
0);
|
2001-02-07 23:01:52 +08:00
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
gtk_widget_show (list_view->gtk_list);
|
2001-02-09 07:24:06 +08:00
|
|
|
gtk_widget_show (list_view->scrolled_win);
|
2001-02-05 23:22:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_list_view_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
|
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (object);
|
|
|
|
|
|
|
|
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
|
|
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
2001-02-06 05:52:57 +08:00
|
|
|
gimp_container_list_view_new (GimpContainer *container,
|
2001-02-07 23:01:52 +08:00
|
|
|
GimpContext *context,
|
2001-02-10 05:49:47 +08:00
|
|
|
gint preview_size,
|
2001-02-07 05:43:59 +08:00
|
|
|
gint min_items_x,
|
|
|
|
gint min_items_y)
|
2001-02-05 23:22:20 +08:00
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GimpContainerView *view;
|
2001-02-09 07:24:06 +08:00
|
|
|
gint window_border;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-02-20 06:54:12 +08:00
|
|
|
g_return_val_if_fail (! container || GIMP_IS_CONTAINER (container), NULL);
|
2001-02-07 23:01:52 +08:00
|
|
|
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
|
2001-02-10 05:49:47 +08:00
|
|
|
g_return_val_if_fail (preview_size > 0 && preview_size <= 64, NULL);
|
2001-02-07 05:43:59 +08:00
|
|
|
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, NULL);
|
|
|
|
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, NULL);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
|
|
list_view = gtk_type_new (GIMP_TYPE_CONTAINER_LIST_VIEW);
|
|
|
|
|
|
|
|
view = GIMP_CONTAINER_VIEW (list_view);
|
|
|
|
|
2001-02-10 05:49:47 +08:00
|
|
|
view->preview_size = preview_size;
|
2001-02-06 07:14:14 +08:00
|
|
|
|
2001-02-09 07:24:06 +08:00
|
|
|
window_border =
|
|
|
|
GTK_SCROLLED_WINDOW (list_view->scrolled_win)->vscrollbar->requisition.width +
|
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
|
|
|
GTK_SCROLLED_WINDOW_GET_CLASS (list_view->scrolled_win)->scrollbar_spacing +
|
|
|
|
list_view->scrolled_win->style->xthickness * 4;
|
2001-02-09 07:24:06 +08:00
|
|
|
|
2001-02-07 05:43:59 +08:00
|
|
|
gtk_widget_set_usize (list_view->gtk_list->parent,
|
2001-02-10 05:49:47 +08:00
|
|
|
(preview_size + 2) * min_items_x + window_border,
|
2001-02-13 08:12:15 +08:00
|
|
|
(preview_size + 6) * min_items_y + window_border);
|
2001-02-07 05:43:59 +08:00
|
|
|
|
2001-02-20 06:54:12 +08:00
|
|
|
if (container)
|
|
|
|
gimp_container_view_set_container (view, container);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-02-07 23:01:52 +08:00
|
|
|
gimp_container_view_set_context (view, context);
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
return GTK_WIDGET (list_view);
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* GimpContainerView methods */
|
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
static gpointer
|
|
|
|
gimp_container_list_view_insert_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint index)
|
2001-02-05 23:22:20 +08:00
|
|
|
{
|
2001-02-06 03:10:40 +08:00
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GtkWidget *list_item;
|
|
|
|
GList *list;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-03-04 07:23:36 +08:00
|
|
|
list_item = gimp_list_item_new (viewable, view->preview_size);
|
2001-02-13 08:12:15 +08:00
|
|
|
|
2001-05-04 06:19:17 +08:00
|
|
|
gimp_list_item_set_name_func (GIMP_LIST_ITEM (list_item),
|
|
|
|
view->get_name_func);
|
|
|
|
|
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_connect (G_OBJECT (list_item), "button_press_event",
|
|
|
|
G_CALLBACK (gimp_container_list_view_item_activated),
|
|
|
|
list_view);
|
2001-02-19 03:44:28 +08:00
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
gtk_widget_show (list_item);
|
|
|
|
|
|
|
|
list = g_list_prepend (NULL, list_item);
|
|
|
|
|
|
|
|
if (index == -1)
|
|
|
|
gtk_list_append_items (GTK_LIST (list_view->gtk_list), list);
|
|
|
|
else
|
|
|
|
gtk_list_insert_items (GTK_LIST (list_view->gtk_list), list, index);
|
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
return (gpointer) list_item;
|
2001-02-05 23:22:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-02-06 03:10:40 +08:00
|
|
|
gimp_container_list_view_remove_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer insert_data)
|
2001-02-05 23:22:20 +08:00
|
|
|
{
|
2001-02-06 03:10:40 +08:00
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GtkWidget *list_item;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
2001-02-08 12:16:41 +08:00
|
|
|
|
|
|
|
if (insert_data)
|
|
|
|
list_item = GTK_WIDGET (insert_data);
|
|
|
|
else
|
|
|
|
list_item = NULL;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
|
|
if (list_item)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
list = g_list_prepend (NULL, list_item);
|
|
|
|
|
|
|
|
gtk_list_remove_items (GTK_LIST (list_view->gtk_list), list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-18 05:20:10 +08:00
|
|
|
static void
|
|
|
|
gimp_container_list_view_reorder_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gint new_index,
|
|
|
|
gpointer insert_data)
|
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GtkWidget *list_item;
|
|
|
|
gboolean selected;
|
|
|
|
|
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
|
|
|
|
|
|
|
if (insert_data)
|
|
|
|
list_item = GTK_WIDGET (insert_data);
|
|
|
|
else
|
|
|
|
list_item = NULL;
|
|
|
|
|
|
|
|
if (list_item)
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
list = g_list_prepend (NULL, list_item);
|
|
|
|
|
|
|
|
selected = GTK_WIDGET_STATE (list_item) == GTK_STATE_SELECTED;
|
|
|
|
|
|
|
|
gtk_object_ref (GTK_OBJECT (list_item));
|
|
|
|
|
|
|
|
gtk_list_remove_items (GTK_LIST (list_view->gtk_list), list);
|
|
|
|
|
|
|
|
if (new_index == -1 || new_index == view->container->num_children - 1)
|
|
|
|
gtk_list_append_items (GTK_LIST (list_view->gtk_list), list);
|
|
|
|
else
|
|
|
|
gtk_list_insert_items (GTK_LIST (list_view->gtk_list), list, new_index);
|
|
|
|
|
|
|
|
if (selected)
|
2001-03-06 21:28:39 +08:00
|
|
|
gimp_container_view_select_item (view, viewable);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
|
|
|
gtk_object_unref (GTK_OBJECT (list_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-07 23:01:52 +08:00
|
|
|
static void
|
|
|
|
gimp_container_list_view_select_item (GimpContainerView *view,
|
|
|
|
GimpViewable *viewable,
|
|
|
|
gpointer insert_data)
|
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GtkWidget *list_item;
|
|
|
|
|
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
2001-02-08 12:16:41 +08:00
|
|
|
|
|
|
|
if (insert_data)
|
|
|
|
list_item = GTK_WIDGET (insert_data);
|
|
|
|
else
|
|
|
|
list_item = NULL;
|
2001-02-07 23:01:52 +08:00
|
|
|
|
|
|
|
if (list_item)
|
|
|
|
{
|
2001-02-09 07:24:06 +08:00
|
|
|
GtkAdjustment *adj;
|
|
|
|
gint item_height;
|
|
|
|
gint index;
|
|
|
|
|
|
|
|
adj = gtk_scrolled_window_get_vadjustment
|
|
|
|
(GTK_SCROLLED_WINDOW (list_view->scrolled_win));
|
|
|
|
|
2001-03-06 21:28:39 +08:00
|
|
|
item_height = list_item->requisition.height;
|
2001-02-09 07:24:06 +08:00
|
|
|
|
|
|
|
index = gimp_container_get_child_index (view->container,
|
|
|
|
GIMP_OBJECT (viewable));
|
|
|
|
|
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_handlers_block_by_func (G_OBJECT (list_view->gtk_list),
|
|
|
|
gimp_container_list_view_item_selected,
|
|
|
|
list_view);
|
2001-02-07 23:01:52 +08:00
|
|
|
|
|
|
|
gtk_list_select_child (GTK_LIST (list_view->gtk_list), list_item);
|
|
|
|
|
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_handlers_unblock_by_func (G_OBJECT (list_view->gtk_list),
|
|
|
|
gimp_container_list_view_item_selected,
|
|
|
|
list_view);
|
2001-03-06 21:28:39 +08:00
|
|
|
|
2001-02-09 07:24:06 +08:00
|
|
|
if (index * item_height < adj->value)
|
|
|
|
{
|
|
|
|
gtk_adjustment_set_value (adj, index * item_height);
|
|
|
|
}
|
|
|
|
else if ((index + 1) * item_height > adj->value + adj->page_size)
|
|
|
|
{
|
|
|
|
gtk_adjustment_set_value (adj,
|
|
|
|
(index + 1) * item_height - adj->page_size);
|
|
|
|
}
|
2001-02-07 23:01:52 +08:00
|
|
|
}
|
2001-02-27 22:14:13 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_list_unselect_all (GTK_LIST (list_view->gtk_list));
|
|
|
|
}
|
2001-02-07 23:01:52 +08:00
|
|
|
}
|
|
|
|
|
2001-02-06 03:10:40 +08:00
|
|
|
static void
|
|
|
|
gimp_container_list_view_clear_items (GimpContainerView *view)
|
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
|
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
|
|
|
|
|
|
|
gtk_list_clear_items (GTK_LIST (list_view->gtk_list), 0, -1);
|
2001-02-08 12:16:41 +08:00
|
|
|
|
|
|
|
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->clear_items)
|
|
|
|
GIMP_CONTAINER_VIEW_CLASS (parent_class)->clear_items (view);
|
2001-02-06 03:10:40 +08:00
|
|
|
}
|
|
|
|
|
2001-02-06 07:14:14 +08:00
|
|
|
static void
|
|
|
|
gimp_container_list_view_set_preview_size (GimpContainerView *view)
|
|
|
|
{
|
|
|
|
GimpContainerListView *list_view;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
list_view = GIMP_CONTAINER_LIST_VIEW (view);
|
|
|
|
|
|
|
|
for (list = GTK_LIST (list_view->gtk_list)->children;
|
|
|
|
list;
|
|
|
|
list = g_list_next (list))
|
|
|
|
{
|
2001-05-07 01:56:10 +08:00
|
|
|
gimp_list_item_set_preview_size (GIMP_LIST_ITEM (list->data),
|
|
|
|
view->preview_size);
|
2001-02-06 07:14:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (list_view->gtk_list);
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* GtkClist callbacks */
|
|
|
|
|
2001-02-07 23:01:52 +08:00
|
|
|
static void
|
|
|
|
gimp_container_list_view_item_selected (GtkWidget *widget,
|
|
|
|
GtkWidget *child,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpViewable *viewable;
|
|
|
|
|
2001-03-04 07:23:36 +08:00
|
|
|
viewable = GIMP_PREVIEW (GIMP_LIST_ITEM (child)->preview)->viewable;
|
2001-02-07 23:01:52 +08:00
|
|
|
|
2001-02-19 03:44:28 +08:00
|
|
|
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data), viewable);
|
|
|
|
}
|
|
|
|
|
2001-03-12 01:24:47 +08:00
|
|
|
|
|
|
|
/* GtkListItem callbacks */
|
|
|
|
|
2001-02-19 03:44:28 +08:00
|
|
|
static gint
|
2001-02-27 22:14:13 +08:00
|
|
|
gimp_container_list_view_item_activated (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent,
|
|
|
|
gpointer data)
|
2001-02-19 03:44:28 +08:00
|
|
|
{
|
2001-04-29 23:23:01 +08:00
|
|
|
GimpViewable *viewable;
|
2001-02-19 03:44:28 +08:00
|
|
|
|
2001-04-29 23:23:01 +08:00
|
|
|
viewable = GIMP_PREVIEW (GIMP_LIST_ITEM (widget)->preview)->viewable;
|
2001-02-19 03:44:28 +08:00
|
|
|
|
2001-04-29 23:23:01 +08:00
|
|
|
switch (bevent->button)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
if (bevent->type == GDK_2BUTTON_PRESS)
|
|
|
|
gimp_container_view_item_activated (GIMP_CONTAINER_VIEW (data),
|
|
|
|
viewable);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
|
|
|
|
viewable);
|
|
|
|
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (data),
|
|
|
|
viewable);
|
|
|
|
break;
|
2001-02-19 03:44:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|