mirror of https://github.com/GNOME/gimp.git
Added GtkTreeView versions of layers/channels/vectors:
2003-03-16 Michael Natterer <mitch@gimp.org> Added GtkTreeView versions of layers/channels/vectors: * app/core/core-enums.[ch]: renamed GIMP_UNDO_GROUP_LAYER_PROPERTIES to GIMP_UNDO_GROUP_ITEM_PROPERTIES. * app/core/gimpcontainer.c (gimp_container_reorder): don't try to reorder containers with num_children == 1. * app/core/gimpmarshal.list: added VOID: STRING, UINT marshaller. * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpchanneltreeview.[ch] * app/widgets/gimpdrawabletreeview.[ch] * app/widgets/gimpitemtreeview.[ch] * app/widgets/gimplayertreeview.[ch] * app/widgets/gimpvectorstreeview.[ch]: new widgets. * app/widgets/gimpcellrenderertoggle.c: draw the frame only if the cell is prelit. * app/widgets/gimpcellrendererviewable.[ch]: added "clicked" signal, unref the renderer in finalize(). Set the renderer's border color to black if the cell is not selected (a hack that saves tons of code in GimpLayerTreeView). * app/widgets/gimpcomponenteditor.c: no need to gtk_list_store_set() stuff we just got from the store. * app/widgets/gimpcontainertreeview.[ch]: added lots of state used by the new subclasses to the GimpContainerTreeView struct. Create the GtkListStore/GtkTreeView in GObject::constructor() and only collect parameters in init() so subclasses can modify store/view creation. Do most of the button_press_event stuff manually and return TRUE from the handler. * app/widgets/gimpcontainerview.c: cleanup. * app/widgets/gimpitemlistview.h * app/widgets/gimpvectorslistview.h: temp hacks before they die. * app/widgets/gimppreviewrenderer.[ch]: added gimp_preview_renderer_update_idle() which idle-emits "update" without invalidating. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added constructors for the new dialogs. * app/gui/channels-commands.c * app/gui/channels-menu.c * app/gui/layers-commands.c * app/gui/layers-menu.c * app/gui/vectors-commands.c * app/gui/vectors-menu.c: accept tree views as callback data.
This commit is contained in:
parent
db2f3e0596
commit
205cdf1353
57
ChangeLog
57
ChangeLog
|
@ -1,3 +1,60 @@
|
|||
2003-03-16 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Added GtkTreeView versions of layers/channels/vectors:
|
||||
|
||||
* app/core/core-enums.[ch]: renamed GIMP_UNDO_GROUP_LAYER_PROPERTIES
|
||||
to GIMP_UNDO_GROUP_ITEM_PROPERTIES.
|
||||
|
||||
* app/core/gimpcontainer.c (gimp_container_reorder): don't try
|
||||
to reorder containers with num_children == 1.
|
||||
|
||||
* app/core/gimpmarshal.list: added VOID: STRING, UINT marshaller.
|
||||
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/widgets-types.h
|
||||
* app/widgets/gimpchanneltreeview.[ch]
|
||||
* app/widgets/gimpdrawabletreeview.[ch]
|
||||
* app/widgets/gimpitemtreeview.[ch]
|
||||
* app/widgets/gimplayertreeview.[ch]
|
||||
* app/widgets/gimpvectorstreeview.[ch]: new widgets.
|
||||
|
||||
* app/widgets/gimpcellrenderertoggle.c: draw the frame only if the
|
||||
cell is prelit.
|
||||
|
||||
* app/widgets/gimpcellrendererviewable.[ch]: added "clicked"
|
||||
signal, unref the renderer in finalize(). Set the renderer's
|
||||
border color to black if the cell is not selected (a hack that
|
||||
saves tons of code in GimpLayerTreeView).
|
||||
|
||||
* app/widgets/gimpcomponenteditor.c: no need to gtk_list_store_set()
|
||||
stuff we just got from the store.
|
||||
|
||||
* app/widgets/gimpcontainertreeview.[ch]: added lots of state used
|
||||
by the new subclasses to the GimpContainerTreeView struct. Create
|
||||
the GtkListStore/GtkTreeView in GObject::constructor() and only
|
||||
collect parameters in init() so subclasses can modify store/view
|
||||
creation. Do most of the button_press_event stuff manually and
|
||||
return TRUE from the handler.
|
||||
|
||||
* app/widgets/gimpcontainerview.c: cleanup.
|
||||
|
||||
* app/widgets/gimpitemlistview.h
|
||||
* app/widgets/gimpvectorslistview.h: temp hacks before they die.
|
||||
|
||||
* app/widgets/gimppreviewrenderer.[ch]: added
|
||||
gimp_preview_renderer_update_idle() which idle-emits "update"
|
||||
without invalidating.
|
||||
|
||||
* app/gui/dialogs-constructors.[ch]
|
||||
* app/gui/dialogs.c: added constructors for the new dialogs.
|
||||
|
||||
* app/gui/channels-commands.c
|
||||
* app/gui/channels-menu.c
|
||||
* app/gui/layers-commands.c
|
||||
* app/gui/layers-menu.c
|
||||
* app/gui/vectors-commands.c
|
||||
* app/gui/vectors-menu.c: accept tree views as callback data.
|
||||
|
||||
2003-03-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/base/levels.c (levels_adjust_by_colors): implemented this
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "widgets/gimpcolorpanel.h"
|
||||
#include "widgets/gimpcomponenteditor.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -65,6 +66,8 @@ static void channels_color_changed (GimpColorButton *button,
|
|||
gimage = ((GimpImageEditor *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -70,6 +71,8 @@ static void layers_resize_layer_query (GimpImage *gimage,
|
|||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
@ -737,7 +740,7 @@ edit_layer_query_ok_callback (GtkWidget *widget,
|
|||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
|
||||
{
|
||||
gimp_image_undo_group_start (options->gimage,
|
||||
GIMP_UNDO_GROUP_LAYER_PROPERTIES,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Rename Layer"));
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -64,6 +65,8 @@
|
|||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
|
|
@ -435,7 +435,7 @@ static const GEnumValue gimp_undo_type_enum_values[] =
|
|||
{ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, N_("Merge Layers"), "group-image-layers-merge" },
|
||||
{ GIMP_UNDO_GROUP_IMAGE_QMASK, N_("QuickMask"), "group-image-qmask" },
|
||||
{ GIMP_UNDO_GROUP_IMAGE_GUIDE, N_("Guide"), "group-image-guide" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_PROPERTIES, N_("Layer Properties"), "group-layer-properties" },
|
||||
{ GIMP_UNDO_GROUP_ITEM_PROPERTIES, N_("Item Properties"), "group-item-properties" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_SCALE, N_("Scale Layer"), "group-layer-scale" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_RESIZE, N_("Resize Layer"), "group-layer-resize" },
|
||||
{ GIMP_UNDO_GROUP_LAYER_DISPLACE, N_("Move Layer"), "group-layer-displace" },
|
||||
|
|
|
@ -329,7 +329,7 @@ typedef enum /*< pdb-skip >*/
|
|||
GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, /*< desc="Merge Layers" >*/
|
||||
GIMP_UNDO_GROUP_IMAGE_QMASK, /*< desc="QuickMask" >*/
|
||||
GIMP_UNDO_GROUP_IMAGE_GUIDE, /*< desc="Guide" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_PROPERTIES, /*< desc="Layer Properties" >*/
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES, /*< desc="Item Properties" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_SCALE, /*< desc="Scale Layer" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_RESIZE, /*< desc="Resize Layer" >*/
|
||||
GIMP_UNDO_GROUP_LAYER_DISPLACE, /*< desc="Move Layer" >*/
|
||||
|
|
|
@ -759,6 +759,9 @@ gimp_container_reorder (GimpContainer *container,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (container->num_children == 1)
|
||||
return TRUE;
|
||||
|
||||
g_signal_emit (container, container_signals[REORDER], 0,
|
||||
object, new_index);
|
||||
|
||||
|
|
|
@ -36,5 +36,6 @@ VOID: OBJECT
|
|||
VOID: OBJECT, INT
|
||||
VOID: OBJECT, POINTER
|
||||
VOID: POINTER
|
||||
VOID: STRING, UINT
|
||||
VOID: UINT
|
||||
VOID: VOID
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "widgets/gimpimagedock.h"
|
||||
#include "widgets/gimpimageview.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpdockable.h"
|
||||
#include "widgets/gimpdockbook.h"
|
||||
#include "widgets/gimpdocumentview.h"
|
||||
|
@ -65,6 +66,7 @@
|
|||
#include "widgets/gimptoolbox-color-area.h"
|
||||
#include "widgets/gimpundoeditor.h"
|
||||
#include "widgets/gimpvectorslistview.h"
|
||||
#include "widgets/gimpvectorstreeview.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
@ -140,7 +142,7 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
|||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpItemListView *view);
|
||||
GimpContainerView *view);
|
||||
static void dialogs_path_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GtkWidget *view);
|
||||
|
@ -774,6 +776,40 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_layer_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_LAYER,
|
||||
"active_layer_changed",
|
||||
(GimpNewItemFunc) layers_new_layer_query,
|
||||
(GimpEditItemFunc) layers_edit_layer_query,
|
||||
(GimpActivateItemFunc) layers_edit_layer_query,
|
||||
factory->menu_factory, "<Layers>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Layer Tree", _("Layers"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -808,6 +844,40 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_channel_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_CHANNEL,
|
||||
"active_channel_changed",
|
||||
(GimpNewItemFunc) channels_new_channel_query,
|
||||
(GimpEditItemFunc) channels_edit_channel_query,
|
||||
(GimpActivateItemFunc) channels_edit_channel_query,
|
||||
factory->menu_factory, "<Channels>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Channel Tree", _("Channels"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -847,6 +917,45 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_vectors_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectorsTreeView *vectors_view;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_VECTORS,
|
||||
"active_vectors_changed",
|
||||
(GimpNewItemFunc) vectors_new_vectors_query,
|
||||
(GimpEditItemFunc) vectors_edit_vectors_query,
|
||||
(GimpActivateItemFunc) vectors_vectors_tool,
|
||||
factory->menu_factory, "<Vectors>");
|
||||
|
||||
vectors_view = GIMP_VECTORS_TREE_VIEW (view);
|
||||
|
||||
vectors_view->stroke_item_func = vectors_stroke_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Paths Tree", _("Paths"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_path_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -1453,10 +1562,10 @@ static void
|
|||
dialogs_set_image_item_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpItemListView *view;
|
||||
GimpContainerView *view;
|
||||
|
||||
view = (GimpItemListView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
return;
|
||||
|
@ -1613,11 +1722,14 @@ dialogs_dockable_new (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpItemListView *view)
|
||||
dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gimp_item_list_view_set_image (view, gimage);
|
||||
if (GIMP_IS_ITEM_LIST_VIEW (view))
|
||||
gimp_item_list_view_set_image (GIMP_ITEM_LIST_VIEW (view), gimage);
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (view))
|
||||
gimp_item_tree_view_set_image (GIMP_ITEM_TREE_VIEW (view), gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -130,12 +130,21 @@ GtkWidget * dialogs_buffer_tree_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_layer_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_channel_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_vectors_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
|
|
@ -108,10 +108,16 @@ static const GimpDialogFactoryEntry dock_entries[] =
|
|||
|
||||
{ "gimp-layer-list", dialogs_layer_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-layer-tree", dialogs_layer_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-channel-list", dialogs_channel_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-channel-tree", dialogs_channel_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-vectors-list", dialogs_vectors_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-vectors-tree", dialogs_vectors_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-path-list", dialogs_path_list_view_new,
|
||||
0, TRUE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "widgets/gimpcolorpanel.h"
|
||||
#include "widgets/gimpcomponenteditor.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -65,6 +66,8 @@ static void channels_color_changed (GimpColorButton *button,
|
|||
gimage = ((GimpImageEditor *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
|
|
@ -28,8 +28,9 @@
|
|||
#include "core/gimplist.h"
|
||||
|
||||
#include "widgets/gimpcomponenteditor.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
|
||||
#include "channels-commands.h"
|
||||
#include "channels-menu.h"
|
||||
|
@ -126,7 +127,12 @@ channels_menu_update (GtkItemFactory *factory,
|
|||
{
|
||||
GList *list;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
if (GIMP_IS_ITEM_LIST_VIEW (data))
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data))
|
||||
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
|
||||
else
|
||||
return;
|
||||
|
||||
channel = gimp_image_get_active_channel (gimage);
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "widgets/gimpimagedock.h"
|
||||
#include "widgets/gimpimageview.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpdockable.h"
|
||||
#include "widgets/gimpdockbook.h"
|
||||
#include "widgets/gimpdocumentview.h"
|
||||
|
@ -65,6 +66,7 @@
|
|||
#include "widgets/gimptoolbox-color-area.h"
|
||||
#include "widgets/gimpundoeditor.h"
|
||||
#include "widgets/gimpvectorslistview.h"
|
||||
#include "widgets/gimpvectorstreeview.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
@ -140,7 +142,7 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
|
|||
|
||||
static void dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpItemListView *view);
|
||||
GimpContainerView *view);
|
||||
static void dialogs_path_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GtkWidget *view);
|
||||
|
@ -774,6 +776,40 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_layer_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_LAYER,
|
||||
"active_layer_changed",
|
||||
(GimpNewItemFunc) layers_new_layer_query,
|
||||
(GimpEditItemFunc) layers_edit_layer_query,
|
||||
(GimpActivateItemFunc) layers_edit_layer_query,
|
||||
factory->menu_factory, "<Layers>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Layer Tree", _("Layers"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -808,6 +844,40 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_channel_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_CHANNEL,
|
||||
"active_channel_changed",
|
||||
(GimpNewItemFunc) channels_new_channel_query,
|
||||
(GimpEditItemFunc) channels_edit_channel_query,
|
||||
(GimpActivateItemFunc) channels_edit_channel_query,
|
||||
factory->menu_factory, "<Channels>");
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Channel Tree", _("Channels"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -847,6 +917,45 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
|||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_vectors_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpVectorsTreeView *vectors_view;
|
||||
GtkWidget *view;
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
if (preview_size < 1)
|
||||
preview_size = context->gimp->config->layer_preview_size;
|
||||
|
||||
view =
|
||||
gimp_item_tree_view_new (preview_size,
|
||||
gimage,
|
||||
GIMP_TYPE_VECTORS,
|
||||
"active_vectors_changed",
|
||||
(GimpNewItemFunc) vectors_new_vectors_query,
|
||||
(GimpEditItemFunc) vectors_edit_vectors_query,
|
||||
(GimpActivateItemFunc) vectors_vectors_tool,
|
||||
factory->menu_factory, "<Vectors>");
|
||||
|
||||
vectors_view = GIMP_VECTORS_TREE_VIEW (view);
|
||||
|
||||
vectors_view->stroke_item_func = vectors_stroke_vectors;
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
"Paths Tree", _("Paths"), NULL,
|
||||
NULL,
|
||||
dialogs_set_image_item_context_func);
|
||||
|
||||
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
|
||||
|
||||
return dockable;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
dialogs_path_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
|
@ -1453,10 +1562,10 @@ static void
|
|||
dialogs_set_image_item_context_func (GimpDockable *dockable,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpItemListView *view;
|
||||
GimpContainerView *view;
|
||||
|
||||
view = (GimpItemListView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
view = (GimpContainerView *) g_object_get_data (G_OBJECT (dockable),
|
||||
"gimp-dialogs-view");
|
||||
|
||||
if (! view)
|
||||
return;
|
||||
|
@ -1613,11 +1722,14 @@ dialogs_dockable_new (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpItemListView *view)
|
||||
dialogs_image_item_view_image_changed (GimpContext *context,
|
||||
GimpImage *gimage,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gimp_item_list_view_set_image (view, gimage);
|
||||
if (GIMP_IS_ITEM_LIST_VIEW (view))
|
||||
gimp_item_list_view_set_image (GIMP_ITEM_LIST_VIEW (view), gimage);
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (view))
|
||||
gimp_item_tree_view_set_image (GIMP_ITEM_TREE_VIEW (view), gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -130,12 +130,21 @@ GtkWidget * dialogs_buffer_tree_view_new (GimpDialogFactory *factory,
|
|||
GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_layer_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_channel_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_channel_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_vectors_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_vectors_tree_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size);
|
||||
|
|
|
@ -108,10 +108,16 @@ static const GimpDialogFactoryEntry dock_entries[] =
|
|||
|
||||
{ "gimp-layer-list", dialogs_layer_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-layer-tree", dialogs_layer_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-channel-list", dialogs_channel_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-channel-tree", dialogs_channel_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-vectors-list", dialogs_vectors_list_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-vectors-tree", dialogs_vectors_tree_view_new,
|
||||
0, FALSE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-path-list", dialogs_path_list_view_new,
|
||||
0, TRUE, FALSE, FALSE, TRUE },
|
||||
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -70,6 +71,8 @@ static void layers_resize_layer_query (GimpImage *gimage,
|
|||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
@ -737,7 +740,7 @@ edit_layer_query_ok_callback (GtkWidget *widget,
|
|||
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (layer))))
|
||||
{
|
||||
gimp_image_undo_group_start (options->gimage,
|
||||
GIMP_UNDO_GROUP_LAYER_PROPERTIES,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
_("Rename Layer"));
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
|
||||
#include "layers-commands.h"
|
||||
#include "layers-menu.h"
|
||||
|
@ -168,7 +169,12 @@ layers_menu_update (GtkItemFactory *factory,
|
|||
GList *next = NULL;
|
||||
GList *prev = NULL;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
if (GIMP_IS_ITEM_LIST_VIEW (data))
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data))
|
||||
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
|
||||
else
|
||||
return;
|
||||
|
||||
layer = gimp_image_get_active_layer (gimage);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -64,6 +65,8 @@
|
|||
gimage = gimp_context_get_image (gimp_get_user_context (GIMP (data))); \
|
||||
else if (GIMP_IS_ITEM_LIST_VIEW (data)) \
|
||||
gimage = ((GimpItemListView *) data)->gimage; \
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data)) \
|
||||
gimage = ((GimpItemTreeView *) data)->gimage; \
|
||||
else \
|
||||
gimage = NULL; \
|
||||
\
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpitemlistview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
|
||||
#include "vectors-commands.h"
|
||||
#include "vectors-menu.h"
|
||||
|
@ -155,7 +156,12 @@ vectors_menu_update (GtkItemFactory *factory,
|
|||
GList *next = NULL;
|
||||
GList *prev = NULL;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
if (GIMP_IS_ITEM_LIST_VIEW (data))
|
||||
gimage = GIMP_ITEM_LIST_VIEW (data)->gimage;
|
||||
else if (GIMP_IS_ITEM_TREE_VIEW (data))
|
||||
gimage = GIMP_ITEM_TREE_VIEW (data)->gimage;
|
||||
else
|
||||
return;
|
||||
|
||||
vectors = gimp_image_get_active_vectors (gimage);
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ libappwidgets_a_sources = \
|
|||
gimpchannellistitem.h \
|
||||
gimpchannellistview.c \
|
||||
gimpchannellistview.h \
|
||||
gimpchanneltreeview.c \
|
||||
gimpchanneltreeview.h \
|
||||
gimpcoloreditor.c \
|
||||
gimpcoloreditor.h \
|
||||
gimpcolormapeditor.c \
|
||||
|
@ -83,6 +85,8 @@ libappwidgets_a_sources = \
|
|||
gimpdrawablelistitem.h \
|
||||
gimpdrawablelistview.c \
|
||||
gimpdrawablelistview.h \
|
||||
gimpdrawabletreeview.c \
|
||||
gimpdrawabletreeview.h \
|
||||
gimpeditor.c \
|
||||
gimpeditor.h \
|
||||
gimpenummenu.c \
|
||||
|
@ -111,10 +115,14 @@ libappwidgets_a_sources = \
|
|||
gimpitemlistitem.h \
|
||||
gimpitemlistview.c \
|
||||
gimpitemlistview.h \
|
||||
gimpitemtreeview.c \
|
||||
gimpitemtreeview.h \
|
||||
gimplayerlistitem.c \
|
||||
gimplayerlistitem.h \
|
||||
gimplayerlistview.c \
|
||||
gimplayerlistview.h \
|
||||
gimplayertreeview.c \
|
||||
gimplayertreeview.h \
|
||||
gimplistitem.c \
|
||||
gimplistitem.h \
|
||||
gimpmenufactory.c \
|
||||
|
@ -159,6 +167,8 @@ libappwidgets_a_sources = \
|
|||
gimpundoeditor.h \
|
||||
gimpvectorslistview.c \
|
||||
gimpvectorslistview.h \
|
||||
gimpvectorstreeview.c \
|
||||
gimpvectorstreeview.h \
|
||||
gimpviewabledialog.c \
|
||||
gimpviewabledialog.h \
|
||||
gimpwidgets-constructors.c \
|
||||
|
|
|
@ -340,7 +340,8 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
|
||||
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect))
|
||||
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
|
||||
(flags & GTK_CELL_RENDERER_PRELIT))
|
||||
gtk_paint_shadow (widget->style,
|
||||
window,
|
||||
state,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpcellrendererviewable.h
|
||||
* gimpcellrendererviewable.c
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimpviewable.h"
|
||||
|
||||
#include "gimpcellrendererviewable.h"
|
||||
|
@ -32,6 +33,12 @@
|
|||
#include "gimppreviewrenderer.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CLICKED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -42,6 +49,7 @@ enum
|
|||
static void gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass);
|
||||
static void gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cell);
|
||||
|
||||
static void gimp_cell_renderer_viewable_finalize (GObject *object);
|
||||
static void gimp_cell_renderer_viewable_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
|
@ -73,6 +81,8 @@ static gboolean gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell,
|
|||
GtkCellRendererState flags);
|
||||
|
||||
|
||||
static guint viewable_cell_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GtkCellRendererClass *parent_class = NULL;
|
||||
|
||||
|
||||
|
@ -115,6 +125,18 @@ gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass)
|
|||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
viewable_cell_signals[CLICKED] =
|
||||
g_signal_new ("clicked",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpCellRendererViewableClass, clicked),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__STRING_UINT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_UINT);
|
||||
|
||||
object_class->finalize = gimp_cell_renderer_viewable_finalize;
|
||||
object_class->get_property = gimp_cell_renderer_viewable_get_property;
|
||||
object_class->set_property = gimp_cell_renderer_viewable_set_property;
|
||||
|
||||
|
@ -122,6 +144,8 @@ gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass)
|
|||
cell_class->render = gimp_cell_renderer_viewable_render;
|
||||
cell_class->activate = gimp_cell_renderer_viewable_activate;
|
||||
|
||||
klass->clicked = NULL;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_RENDERER,
|
||||
g_param_spec_object ("renderer",
|
||||
|
@ -136,6 +160,22 @@ gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cellviewable)
|
|||
GTK_CELL_RENDERER (cellviewable)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_cell_renderer_viewable_finalize (GObject *object)
|
||||
{
|
||||
GimpCellRendererViewable *cell;
|
||||
|
||||
cell = GIMP_CELL_RENDERER_VIEWABLE (object);
|
||||
|
||||
if (cell->renderer)
|
||||
{
|
||||
g_object_unref (cell->renderer);
|
||||
cell->renderer = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_cell_renderer_viewable_get_property (GObject *object,
|
||||
guint param_id,
|
||||
|
@ -248,8 +288,19 @@ gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
|
|||
cellviewable = GIMP_CELL_RENDERER_VIEWABLE (cell);
|
||||
|
||||
if (cellviewable->renderer)
|
||||
gimp_preview_renderer_draw (cellviewable->renderer, window, widget,
|
||||
cell_area, expose_area);
|
||||
{
|
||||
if (! flags & GTK_CELL_RENDERER_SELECTED)
|
||||
{
|
||||
GimpRGB black = { 0.0, 0.0, 0.0, 1.0 };
|
||||
|
||||
gimp_preview_renderer_set_border_color (cellviewable->renderer,
|
||||
&black);
|
||||
gimp_preview_renderer_remove_idle (cellviewable->renderer);
|
||||
}
|
||||
|
||||
gimp_preview_renderer_draw (cellviewable->renderer, window, widget,
|
||||
cell_area, expose_area);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -270,6 +321,9 @@ gimp_cell_renderer_viewable_activate (GtkCellRenderer *cell,
|
|||
if (((GdkEventAny *) event)->type == GDK_BUTTON_PRESS &&
|
||||
((GdkEventButton *) event)->button == 1)
|
||||
{
|
||||
g_signal_emit (cell, viewable_cell_signals[CLICKED], 0,
|
||||
path, ((GdkEventButton *) event)->state);
|
||||
|
||||
return gimp_preview_popup_show (widget,
|
||||
(GdkEventButton *) event,
|
||||
cellviewable->renderer->viewable,
|
||||
|
|
|
@ -46,6 +46,10 @@ struct _GimpCellRendererViewable
|
|||
struct _GimpCellRendererViewableClass
|
||||
{
|
||||
GtkCellRendererClass parent_class;
|
||||
|
||||
void (* clicked) (GimpCellRendererViewable *cell,
|
||||
const gchar *path,
|
||||
GdkModifierType state);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpchannellistview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpchanneltreeview.c
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -38,40 +38,39 @@
|
|||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-mask-select.h"
|
||||
|
||||
#include "gimpchannellistview.h"
|
||||
#include "gimpchanneltreeview.h"
|
||||
#include "gimpcomponenteditor.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimplistitem.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_channel_list_view_class_init (GimpChannelListViewClass *klass);
|
||||
static void gimp_channel_list_view_init (GimpChannelListView *view);
|
||||
static void gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass);
|
||||
static void gimp_channel_tree_view_init (GimpChannelTreeView *view);
|
||||
|
||||
static void gimp_channel_list_view_set_image (GimpItemListView *item_view,
|
||||
static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static void gimp_channel_list_view_select_item (GimpContainerView *view,
|
||||
static void gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_channel_list_view_set_preview_size (GimpContainerView *view);
|
||||
static void gimp_channel_tree_view_set_preview_size (GimpContainerView *view);
|
||||
|
||||
static void gimp_channel_list_view_toselection_clicked
|
||||
static void gimp_channel_tree_view_toselection_clicked
|
||||
(GtkWidget *widget,
|
||||
GimpChannelListView *view);
|
||||
static void gimp_channel_list_view_toselection_extended_clicked
|
||||
GimpChannelTreeView *view);
|
||||
static void gimp_channel_tree_view_toselection_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpChannelListView *view);
|
||||
GimpChannelTreeView *view);
|
||||
|
||||
|
||||
static GimpDrawableListViewClass *parent_class = NULL;
|
||||
static GimpDrawableTreeViewClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_channel_list_view_get_type (void)
|
||||
gimp_channel_tree_view_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
|
@ -79,19 +78,19 @@ gimp_channel_list_view_get_type (void)
|
|||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpChannelListViewClass),
|
||||
sizeof (GimpChannelTreeViewClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_channel_list_view_class_init,
|
||||
(GClassInitFunc) gimp_channel_tree_view_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpChannelListView),
|
||||
sizeof (GimpChannelTreeView),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_channel_list_view_init,
|
||||
(GInstanceInitFunc) gimp_channel_tree_view_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_DRAWABLE_LIST_VIEW,
|
||||
"GimpChannelListView",
|
||||
view_type = g_type_register_static (GIMP_TYPE_DRAWABLE_TREE_VIEW,
|
||||
"GimpChannelTreeView",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
|
@ -99,20 +98,20 @@ gimp_channel_list_view_get_type (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_class_init (GimpChannelListViewClass *klass)
|
||||
gimp_channel_tree_view_class_init (GimpChannelTreeViewClass *klass)
|
||||
{
|
||||
GimpContainerViewClass *container_view_class;
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
|
||||
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_CLASS (klass);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
container_view_class->select_item = gimp_channel_list_view_select_item;
|
||||
container_view_class->set_preview_size = gimp_channel_list_view_set_preview_size;
|
||||
container_view_class->select_item = gimp_channel_tree_view_select_item;
|
||||
container_view_class->set_preview_size = gimp_channel_tree_view_set_preview_size;
|
||||
|
||||
item_view_class->set_image = gimp_channel_list_view_set_image;
|
||||
item_view_class->set_image = gimp_channel_tree_view_set_image;
|
||||
|
||||
item_view_class->get_container = gimp_image_get_channels;
|
||||
item_view_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_channel;
|
||||
|
@ -129,10 +128,11 @@ gimp_channel_list_view_class_init (GimpChannelListViewClass *klass)
|
|||
item_view_class->raise_to_top_desc = _("Raise Channel to Top");
|
||||
item_view_class->lower_desc = _("Lower Channel");
|
||||
item_view_class->lower_to_bottom_desc = _("Lower Channel to Bottom");
|
||||
item_view_class->rename_desc = _("Rename Channel");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_init (GimpChannelListView *view)
|
||||
gimp_channel_tree_view_init (GimpChannelTreeView *view)
|
||||
{
|
||||
gchar *str;
|
||||
|
||||
|
@ -150,8 +150,8 @@ gimp_channel_list_view_init (GimpChannelListView *view)
|
|||
view->toselection_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (view),
|
||||
GIMP_STOCK_SELECTION_REPLACE, str, NULL,
|
||||
G_CALLBACK (gimp_channel_list_view_toselection_clicked),
|
||||
G_CALLBACK (gimp_channel_list_view_toselection_extended_clicked),
|
||||
G_CALLBACK (gimp_channel_tree_view_toselection_clicked),
|
||||
G_CALLBACK (gimp_channel_tree_view_toselection_extended_clicked),
|
||||
view);
|
||||
|
||||
g_free (str);
|
||||
|
@ -167,15 +167,15 @@ gimp_channel_list_view_init (GimpChannelListView *view)
|
|||
}
|
||||
|
||||
|
||||
/* GimpChannelListView methods */
|
||||
/* GimpItemTreeView methods */
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_set_image (GimpItemListView *item_view,
|
||||
gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
GimpChannelListView *channel_view;
|
||||
GimpChannelTreeView *channel_view;
|
||||
|
||||
channel_view = GIMP_CHANNEL_LIST_VIEW (item_view);
|
||||
channel_view = GIMP_CHANNEL_TREE_VIEW (item_view);
|
||||
|
||||
if (! channel_view->component_editor)
|
||||
{
|
||||
|
@ -194,8 +194,7 @@ gimp_channel_list_view_set_image (GimpItemListView *item_view,
|
|||
gimp_image_editor_set_image (GIMP_IMAGE_EDITOR (channel_view->component_editor),
|
||||
gimage);
|
||||
|
||||
if (GIMP_ITEM_LIST_VIEW_CLASS (parent_class)->set_image)
|
||||
GIMP_ITEM_LIST_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
||||
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
||||
|
||||
if (item_view->gimage)
|
||||
gtk_widget_show (channel_view->component_editor);
|
||||
|
@ -205,20 +204,19 @@ gimp_channel_list_view_set_image (GimpItemListView *item_view,
|
|||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_select_item (GimpContainerView *view,
|
||||
gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemListView *item_view;
|
||||
GimpChannelListView *list_view;
|
||||
GimpItemTreeView *item_view;
|
||||
GimpChannelTreeView *tree_view;
|
||||
|
||||
item_view = GIMP_ITEM_LIST_VIEW (view);
|
||||
list_view = GIMP_CHANNEL_LIST_VIEW (view);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
tree_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
|
||||
if (item_view->gimage)
|
||||
{
|
||||
|
@ -229,41 +227,40 @@ gimp_channel_list_view_select_item (GimpContainerView *view,
|
|||
gtk_widget_set_sensitive (GIMP_EDITOR (view)->button_box, ! floating_sel);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (list_view->toselection_button, item != NULL);
|
||||
gtk_widget_set_sensitive (tree_view->toselection_button, item != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_set_preview_size (GimpContainerView *view)
|
||||
gimp_channel_tree_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpChannelListView *channel_view;
|
||||
GimpChannelTreeView *channel_view;
|
||||
|
||||
channel_view = GIMP_CHANNEL_LIST_VIEW (view);
|
||||
channel_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size (view);
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_preview_size (view);
|
||||
|
||||
gimp_component_editor_set_preview_size (GIMP_COMPONENT_EDITOR (channel_view->component_editor),
|
||||
view->preview_size);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_toselection_clicked (GtkWidget *widget,
|
||||
GimpChannelListView *view)
|
||||
gimp_channel_tree_view_toselection_clicked (GtkWidget *widget,
|
||||
GimpChannelTreeView *view)
|
||||
{
|
||||
gimp_channel_list_view_toselection_extended_clicked (widget, 0, view);
|
||||
gimp_channel_tree_view_toselection_extended_clicked (widget, 0, view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_list_view_toselection_extended_clicked (GtkWidget *widget,
|
||||
gimp_channel_tree_view_toselection_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpChannelListView *view)
|
||||
GimpChannelTreeView *view)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpItem *item;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (view)->gimage;
|
||||
gimage = GIMP_ITEM_TREE_VIEW (view)->gimage;
|
||||
|
||||
item = GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
|
||||
if (item)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpchannellistview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpchanneltreeview.h
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,39 +19,39 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_CHANNEL_LIST_VIEW_H__
|
||||
#define __GIMP_CHANNEL_LIST_VIEW_H__
|
||||
#ifndef __GIMP_CHANNEL_TREE_VIEW_H__
|
||||
#define __GIMP_CHANNEL_TREE_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpdrawablelistview.h"
|
||||
#include "gimpdrawabletreeview.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_CHANNEL_LIST_VIEW (gimp_channel_list_view_get_type ())
|
||||
#define GIMP_CHANNEL_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL_LIST_VIEW, GimpChannelListView))
|
||||
#define GIMP_CHANNEL_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL_LIST_VIEW, GimpChannelListViewClass))
|
||||
#define GIMP_IS_CHANNEL_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_LIST_VIEW))
|
||||
#define GIMP_IS_CHANNEL_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL_LIST_VIEW))
|
||||
#define GIMP_CHANNEL_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHANNEL_LIST_VIEW, GimpChannelListViewClass))
|
||||
#define GIMP_TYPE_CHANNEL_TREE_VIEW (gimp_channel_tree_view_get_type ())
|
||||
#define GIMP_CHANNEL_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CHANNEL_TREE_VIEW, GimpChannelTreeView))
|
||||
#define GIMP_CHANNEL_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CHANNEL_TREE_VIEW, GimpChannelTreeViewClass))
|
||||
#define GIMP_IS_CHANNEL_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CHANNEL_TREE_VIEW))
|
||||
#define GIMP_IS_CHANNEL_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CHANNEL_TREE_VIEW))
|
||||
#define GIMP_CHANNEL_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CHANNEL_TREE_VIEW, GimpChannelTreeViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpChannelListViewClass GimpChannelListViewClass;
|
||||
typedef struct _GimpChannelTreeViewClass GimpChannelTreeViewClass;
|
||||
|
||||
struct _GimpChannelListView
|
||||
struct _GimpChannelTreeView
|
||||
{
|
||||
GimpDrawableListView parent_instance;
|
||||
GimpDrawableTreeView parent_instance;
|
||||
|
||||
GtkWidget *component_editor;
|
||||
|
||||
GtkWidget *toselection_button;
|
||||
};
|
||||
|
||||
struct _GimpChannelListViewClass
|
||||
struct _GimpChannelTreeViewClass
|
||||
{
|
||||
GimpDrawableListViewClass parent_class;
|
||||
GimpDrawableTreeViewClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_channel_list_view_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_channel_tree_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_CHANNEL_LIST_VIEW_H__ */
|
||||
#endif /* __GIMP_CHANNEL_TREE_VIEW_H__ */
|
||||
|
|
|
@ -109,8 +109,8 @@ gimp_component_editor_get_type (void)
|
|||
};
|
||||
|
||||
editor_type = g_type_register_static (GIMP_TYPE_IMAGE_EDITOR,
|
||||
"GimpComponentEditor",
|
||||
&editor_info, 0);
|
||||
"GimpComponentEditor",
|
||||
&editor_info, 0);
|
||||
}
|
||||
|
||||
return editor_type;
|
||||
|
@ -320,10 +320,6 @@ gimp_component_editor_set_preview_size (GimpComponentEditor *editor,
|
|||
|
||||
gimp_preview_renderer_set_size (renderer, preview_size, 1);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (editor->model), &iter,
|
||||
COLUMN_RENDERER, renderer,
|
||||
-1);
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
#include "gimpdnd.h"
|
||||
#include "gimppreview.h"
|
||||
#include "gimppreviewrenderer.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_VIEWABLE,
|
||||
COLUMN_RENDERER,
|
||||
COLUMN_NAME,
|
||||
NUM_COLUMNS
|
||||
|
@ -50,6 +50,9 @@ enum
|
|||
static void gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass);
|
||||
static void gimp_container_tree_view_init (GimpContainerTreeView *view);
|
||||
|
||||
static GObject *gimp_container_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_container_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container);
|
||||
|
||||
|
@ -74,7 +77,6 @@ static void gimp_container_tree_view_selection_changed (GtkTreeSelection *s
|
|||
static gboolean gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
GimpContainerTreeView *tree_view);
|
||||
|
||||
static void gimp_container_tree_view_renderer_update (GimpPreviewRenderer *renderer,
|
||||
GimpContainerTreeView *tree_view);
|
||||
static void gimp_container_tree_view_name_changed (GimpObject *object,
|
||||
|
@ -118,12 +120,16 @@ gimp_container_tree_view_get_type (void)
|
|||
static void
|
||||
gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpContainerViewClass *container_view_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->constructor = gimp_container_tree_view_constructor;
|
||||
|
||||
container_view_class->set_container = gimp_container_tree_view_set_container;
|
||||
container_view_class->insert_item = gimp_container_tree_view_insert_item;
|
||||
container_view_class->remove_item = gimp_container_tree_view_remove_item;
|
||||
|
@ -138,7 +144,15 @@ gimp_container_tree_view_class_init (GimpContainerTreeViewClass *klass)
|
|||
static void
|
||||
gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
|
||||
{
|
||||
GtkListStore *list;
|
||||
tree_view->n_model_columns = NUM_COLUMNS;
|
||||
|
||||
tree_view->model_columns[COLUMN_RENDERER] = GIMP_TYPE_PREVIEW_RENDERER;
|
||||
tree_view->model_columns[COLUMN_NAME] = G_TYPE_STRING;
|
||||
|
||||
tree_view->model_column_renderer = COLUMN_RENDERER;
|
||||
tree_view->model_column_name = COLUMN_NAME;
|
||||
|
||||
tree_view->preview_border_width = 1;
|
||||
|
||||
tree_view->scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (tree_view->scrolled_win),
|
||||
|
@ -150,45 +164,72 @@ gimp_container_tree_view_init (GimpContainerTreeView *tree_view)
|
|||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (tree_view->scrolled_win);
|
||||
|
||||
list = gtk_list_store_new (NUM_COLUMNS,
|
||||
GIMP_TYPE_VIEWABLE,
|
||||
GIMP_TYPE_PREVIEW_RENDERER,
|
||||
G_TYPE_STRING);
|
||||
GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW
|
||||
(tree_view->scrolled_win)->vscrollbar,
|
||||
GTK_CAN_FOCUS);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_container_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkListStore *list;
|
||||
GObject *object;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (object);
|
||||
|
||||
list = gtk_list_store_newv (tree_view->n_model_columns,
|
||||
tree_view->model_columns);
|
||||
tree_view->model = GTK_TREE_MODEL (list);
|
||||
|
||||
tree_view->view =
|
||||
GTK_TREE_VIEW (gtk_tree_view_new_with_model (tree_view->model));
|
||||
g_object_unref (list);
|
||||
|
||||
GIMP_CONTAINER_VIEW (tree_view)->dnd_widget = GTK_WIDGET (tree_view->view);
|
||||
|
||||
gtk_tree_view_set_headers_visible (tree_view->view, FALSE);
|
||||
|
||||
gtk_tree_view_insert_column_with_attributes (tree_view->view,
|
||||
-1, NULL,
|
||||
gimp_cell_renderer_viewable_new (),
|
||||
"renderer", COLUMN_RENDERER,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_insert_column_with_attributes (tree_view->view,
|
||||
-1, NULL,
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", COLUMN_NAME,
|
||||
NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (tree_view->scrolled_win),
|
||||
GTK_WIDGET (tree_view->view));
|
||||
gtk_widget_show (GTK_WIDGET (tree_view->view));
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW
|
||||
(tree_view->scrolled_win)->vscrollbar,
|
||||
GTK_CAN_FOCUS);
|
||||
GIMP_CONTAINER_VIEW (tree_view)->dnd_widget = GTK_WIDGET (tree_view->view);
|
||||
|
||||
tree_view->main_column = gtk_tree_view_column_new ();
|
||||
gtk_tree_view_insert_column (tree_view->view, tree_view->main_column, 0);
|
||||
|
||||
tree_view->renderer_cell = gimp_cell_renderer_viewable_new ();
|
||||
gtk_tree_view_column_pack_start (tree_view->main_column,
|
||||
tree_view->renderer_cell,
|
||||
FALSE);
|
||||
|
||||
gtk_tree_view_column_set_attributes (tree_view->main_column,
|
||||
tree_view->renderer_cell,
|
||||
"renderer", COLUMN_RENDERER,
|
||||
NULL);
|
||||
|
||||
tree_view->name_cell = gtk_cell_renderer_text_new ();
|
||||
g_object_set (tree_view->name_cell, "xalign", 0.0, NULL);
|
||||
gtk_tree_view_column_pack_end (tree_view->main_column,
|
||||
tree_view->name_cell,
|
||||
FALSE);
|
||||
|
||||
gtk_tree_view_column_set_attributes (tree_view->main_column,
|
||||
tree_view->name_cell,
|
||||
"text", COLUMN_NAME,
|
||||
NULL);
|
||||
|
||||
tree_view->renderer_cells = g_list_prepend (tree_view->renderer_cells,
|
||||
tree_view->renderer_cell);
|
||||
|
||||
tree_view->selection = gtk_tree_view_get_selection (tree_view->view);
|
||||
|
||||
g_signal_connect (tree_view->selection, "changed",
|
||||
G_CALLBACK (gimp_container_tree_view_selection_changed),
|
||||
tree_view);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -252,7 +293,9 @@ gimp_container_tree_view_set (GimpContainerTreeView *tree_view,
|
|||
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (viewable)));
|
||||
|
||||
renderer = gimp_preview_renderer_new (G_TYPE_FROM_INSTANCE (viewable),
|
||||
view->preview_size, 1, FALSE);
|
||||
view->preview_size,
|
||||
tree_view->preview_border_width,
|
||||
FALSE);
|
||||
gimp_preview_renderer_set_viewable (renderer, viewable);
|
||||
gimp_preview_renderer_remove_idle (renderer);
|
||||
|
||||
|
@ -261,7 +304,6 @@ gimp_container_tree_view_set (GimpContainerTreeView *tree_view,
|
|||
tree_view);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
COLUMN_VIEWABLE, viewable,
|
||||
COLUMN_RENDERER, renderer,
|
||||
COLUMN_NAME, name,
|
||||
-1);
|
||||
|
@ -399,16 +441,16 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
|
|||
|
||||
if (selected)
|
||||
{
|
||||
GimpViewable *selected_viewable;
|
||||
GimpPreviewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &selected_iter,
|
||||
COLUMN_VIEWABLE, &selected_viewable,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
if (selected_viewable != viewable)
|
||||
if (renderer->viewable != viewable)
|
||||
selected = FALSE;
|
||||
|
||||
g_object_unref (selected_viewable);
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
if (new_index == -1 || new_index == view->container->num_children - 1)
|
||||
|
@ -427,7 +469,7 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
|
|||
gint old_index;
|
||||
|
||||
path = gtk_tree_model_get_path (tree_view->model, iter);
|
||||
old_index = *(gtk_tree_path_get_indices (path));
|
||||
old_index = gtk_tree_path_get_indices (path)[0];
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (new_index != old_index)
|
||||
|
@ -475,33 +517,33 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
|
|||
if (gtk_tree_selection_get_selected (tree_view->selection, NULL,
|
||||
&selected_iter))
|
||||
{
|
||||
GimpViewable *selected_viewable;
|
||||
gboolean equal;
|
||||
GimpPreviewRenderer *renderer;
|
||||
gboolean equal;
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &selected_iter,
|
||||
COLUMN_VIEWABLE, &selected_viewable,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
equal = (selected_viewable == viewable);
|
||||
equal = (renderer->viewable == viewable);
|
||||
|
||||
g_object_unref (selected_viewable);
|
||||
g_object_unref (renderer);
|
||||
|
||||
if (equal)
|
||||
return;
|
||||
}
|
||||
|
||||
path = gtk_tree_model_get_path (tree_view->model, iter);
|
||||
|
||||
g_signal_handlers_block_by_func (tree_view->selection,
|
||||
gimp_container_tree_view_selection_changed,
|
||||
tree_view);
|
||||
|
||||
gtk_tree_selection_select_iter (tree_view->selection, iter);
|
||||
gtk_tree_selection_select_path (tree_view->selection, path);
|
||||
|
||||
g_signal_handlers_unblock_by_func (tree_view->selection,
|
||||
gimp_container_tree_view_selection_changed,
|
||||
tree_view);
|
||||
|
||||
path = gtk_tree_model_get_path (tree_view->model, iter);
|
||||
|
||||
gtk_tree_view_scroll_to_cell (tree_view->view, path,
|
||||
NULL, FALSE, 0.0, 0.0);
|
||||
|
||||
|
@ -529,10 +571,37 @@ static void
|
|||
gimp_container_tree_view_set_preview_size (GimpContainerView *view)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkWidget *tree_widget;
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
GList *list;
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
|
||||
tree_widget = GTK_WIDGET (tree_view->view);
|
||||
|
||||
for (list = tree_view->toggle_cells; list; list = g_list_next (list))
|
||||
{
|
||||
gchar *stock_id;
|
||||
GtkIconSize icon_size;
|
||||
|
||||
g_object_get (list->data, "stock-id", &stock_id, NULL);
|
||||
|
||||
if (stock_id)
|
||||
{
|
||||
icon_size = gimp_get_icon_size (tree_widget,
|
||||
stock_id,
|
||||
GTK_ICON_SIZE_BUTTON,
|
||||
view->preview_size -
|
||||
2 * tree_widget->style->xthickness,
|
||||
view->preview_size -
|
||||
2 * tree_widget->style->ythickness);
|
||||
|
||||
g_object_set (list->data, "stock-size", icon_size, NULL);
|
||||
|
||||
g_free (stock_id);
|
||||
}
|
||||
}
|
||||
|
||||
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
|
||||
iter_valid;
|
||||
|
@ -544,11 +613,8 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
|
|||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_preview_renderer_set_size (renderer, view->preview_size, 1);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
|
||||
COLUMN_RENDERER, renderer,
|
||||
-1);
|
||||
gimp_preview_renderer_set_size (renderer, view->preview_size,
|
||||
tree_view->preview_border_width);
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
@ -563,22 +629,19 @@ static void
|
|||
gimp_container_tree_view_selection_changed (GtkTreeSelection *selection,
|
||||
GimpContainerTreeView *tree_view)
|
||||
{
|
||||
GimpViewable *selected_viewable = NULL;
|
||||
GtkTreeIter selected_iter;
|
||||
gboolean selected;
|
||||
GtkTreeIter iter;
|
||||
|
||||
selected = gtk_tree_selection_get_selected (selection, NULL, &selected_iter);
|
||||
|
||||
if (selected)
|
||||
gtk_tree_model_get (tree_view->model, &selected_iter,
|
||||
COLUMN_VIEWABLE, &selected_viewable,
|
||||
-1);
|
||||
|
||||
if (selected_viewable)
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
GimpPreviewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (tree_view),
|
||||
selected_viewable);
|
||||
g_object_unref (selected_viewable);
|
||||
renderer->viewable);
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -587,36 +650,119 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
|||
GdkEventButton *bevent,
|
||||
GimpContainerTreeView *tree_view)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gboolean retval = FALSE;
|
||||
GimpContainerView *container_view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreePath *path;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
|
||||
tree_view->dnd_viewable = NULL;
|
||||
|
||||
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
|
||||
bevent->x,
|
||||
bevent->y,
|
||||
&path, NULL, NULL, NULL))
|
||||
&path, &column, NULL, NULL))
|
||||
{
|
||||
GimpViewable *viewable;
|
||||
GtkTreeIter iter;
|
||||
GimpPreviewRenderer *renderer;
|
||||
GtkCellRenderer *toggled_cell = NULL;
|
||||
GtkCellRenderer *clicked_cell = NULL;
|
||||
GdkRectangle column_area;
|
||||
gint tree_x;
|
||||
gint tree_y;
|
||||
GtkTreeIter iter;
|
||||
GList *list;
|
||||
|
||||
gtk_tree_model_get_iter (tree_view->model, &iter, path);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &iter,
|
||||
COLUMN_VIEWABLE, &viewable,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
tree_view->dnd_viewable = viewable;
|
||||
tree_view->dnd_viewable = renderer->viewable;
|
||||
|
||||
gtk_tree_view_widget_to_tree_coords (tree_view->view,
|
||||
bevent->x, bevent->y,
|
||||
&tree_x, &tree_y);
|
||||
|
||||
gtk_tree_view_get_background_area (tree_view->view, path,
|
||||
column, &column_area);
|
||||
|
||||
gtk_tree_view_column_cell_set_cell_data (column,
|
||||
tree_view->model,
|
||||
&iter,
|
||||
FALSE, FALSE);
|
||||
|
||||
for (list = tree_view->toggle_columns; list; list = g_list_next (list))
|
||||
{
|
||||
if (list->data == (gpointer) column)
|
||||
{
|
||||
toggled_cell = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (column == tree_view->main_column)
|
||||
{
|
||||
for (list = tree_view->renderer_cells;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GtkCellRenderer *cell_renderer = list->data;
|
||||
gint start_pos;
|
||||
gint width;
|
||||
|
||||
if (cell_renderer->visible &&
|
||||
gtk_tree_view_column_cell_get_position (column,
|
||||
cell_renderer,
|
||||
&start_pos,
|
||||
&width) &&
|
||||
width > 0 &&
|
||||
column_area.x + start_pos + cell_renderer->xpad <= tree_x &&
|
||||
column_area.x + start_pos + cell_renderer->xpad + width - 1 >= tree_x)
|
||||
{
|
||||
g_print ("click_cell at %d (%d width)\n", start_pos, width);
|
||||
|
||||
clicked_cell = cell_renderer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (bevent->button)
|
||||
{
|
||||
case 1:
|
||||
if (bevent->type == GDK_2BUTTON_PRESS)
|
||||
if (bevent->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
gimp_container_view_item_activated (GIMP_CONTAINER_VIEW (tree_view),
|
||||
viewable);
|
||||
if (toggled_cell || clicked_cell)
|
||||
{
|
||||
gchar *path_str;
|
||||
|
||||
path_str = gtk_tree_path_to_string (path);
|
||||
|
||||
if (toggled_cell)
|
||||
{
|
||||
g_signal_emit_by_name (toggled_cell, "toggled",
|
||||
path_str);
|
||||
}
|
||||
|
||||
if (clicked_cell)
|
||||
{
|
||||
gtk_tree_selection_select_path (tree_view->selection,
|
||||
path);
|
||||
g_signal_emit_by_name (clicked_cell, "clicked",
|
||||
path_str, bevent->state);
|
||||
}
|
||||
|
||||
g_free (path_str);
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
}
|
||||
else if (bevent->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
gimp_container_view_item_activated (container_view,
|
||||
renderer->viewable);
|
||||
retval = TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -626,15 +772,18 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
|||
break;
|
||||
|
||||
case 3:
|
||||
gtk_tree_selection_select_path (tree_view->selection, path);
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (tree_view),
|
||||
viewable);
|
||||
renderer->viewable);
|
||||
retval = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_object_unref (viewable);
|
||||
gtk_tree_path_free (path);
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
|
|
@ -41,10 +41,27 @@ struct _GimpContainerTreeView
|
|||
GimpContainerView parent_instance;
|
||||
|
||||
GtkWidget *scrolled_win;
|
||||
|
||||
GtkTreeModel *model;
|
||||
gint n_model_columns;
|
||||
GType model_columns[16];
|
||||
|
||||
gint model_column_renderer;
|
||||
gint model_column_name;
|
||||
|
||||
GtkTreeView *view;
|
||||
GtkTreeSelection *selection;
|
||||
|
||||
GtkTreeViewColumn *main_column;
|
||||
GtkCellRenderer *renderer_cell;
|
||||
GtkCellRenderer *name_cell;
|
||||
|
||||
GList *toggle_columns;
|
||||
GList *toggle_cells;
|
||||
GList *renderer_cells;
|
||||
|
||||
gint preview_border_width;
|
||||
|
||||
GQuark invalidate_preview_handler_id;
|
||||
GQuark name_changed_handler_id;
|
||||
|
||||
|
|
|
@ -212,8 +212,7 @@ gimp_container_view_destroy (GtkObject *object)
|
|||
view->hash_table = NULL;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -224,9 +223,7 @@ gimp_container_view_set_container (GimpContainerView *view,
|
|||
g_return_if_fail (! container || GIMP_IS_CONTAINER (container));
|
||||
|
||||
if (container != view->container)
|
||||
{
|
||||
GIMP_CONTAINER_VIEW_GET_CLASS (view)->set_container (view, container);
|
||||
}
|
||||
GIMP_CONTAINER_VIEW_GET_CLASS (view)->set_container (view, container);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -238,7 +235,6 @@ gimp_container_view_real_set_container (GimpContainerView *view,
|
|||
GimpContainerViewClass *view_class;
|
||||
|
||||
gimp_container_view_select_item (view, NULL);
|
||||
|
||||
gimp_container_view_clear_items (view);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (view->container,
|
||||
|
@ -288,7 +284,8 @@ gimp_container_view_real_set_container (GimpContainerView *view,
|
|||
{
|
||||
GimpItemGetNameFunc get_name_func;
|
||||
|
||||
get_name_func = gimp_container_view_get_built_in_name_func (view->container->children_type);
|
||||
get_name_func =
|
||||
gimp_container_view_get_built_in_name_func (view->container->children_type);
|
||||
|
||||
gimp_container_view_set_name_func (view, get_name_func);
|
||||
}
|
||||
|
@ -301,12 +298,10 @@ gimp_container_view_real_set_container (GimpContainerView *view,
|
|||
G_CALLBACK (gimp_container_view_add),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (view->container, "remove",
|
||||
G_CALLBACK (gimp_container_view_remove),
|
||||
view,
|
||||
G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (view->container, "reorder",
|
||||
G_CALLBACK (gimp_container_view_reorder),
|
||||
view,
|
||||
|
@ -328,8 +323,7 @@ gimp_container_view_real_set_container (GimpContainerView *view,
|
|||
object = gimp_context_get_by_type (view->context,
|
||||
view->container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view,
|
||||
object ? GIMP_VIEWABLE (object): NULL);
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
|
||||
if (view->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (view->dnd_widget),
|
||||
|
@ -391,8 +385,7 @@ gimp_container_view_set_context (GimpContainerView *view,
|
|||
object = gimp_context_get_by_type (view->context,
|
||||
view->container->children_type);
|
||||
|
||||
gimp_container_view_select_item (view,
|
||||
object ? GIMP_VIEWABLE (object) : NULL);
|
||||
gimp_container_view_select_item (view, (GimpViewable *) object);
|
||||
|
||||
if (view->dnd_widget)
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (view->dnd_widget),
|
||||
|
@ -424,10 +417,7 @@ gimp_container_view_set_name_func (GimpContainerView *view,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
|
||||
if (view->get_name_func != get_name_func)
|
||||
{
|
||||
view->get_name_func = get_name_func;
|
||||
}
|
||||
view->get_name_func = get_name_func;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -497,11 +487,9 @@ gimp_container_view_item_selected (GimpContainerView *view,
|
|||
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
||||
|
||||
if (view->container && view->context)
|
||||
{
|
||||
gimp_context_set_by_type (view->context,
|
||||
view->container->children_type,
|
||||
GIMP_OBJECT (viewable));
|
||||
}
|
||||
gimp_context_set_by_type (view->context,
|
||||
view->container->children_type,
|
||||
GIMP_OBJECT (viewable));
|
||||
|
||||
gimp_container_view_select_item (view, viewable);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdrawablelistview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpdrawabletreeview.c
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -41,42 +41,57 @@
|
|||
#include "core/gimppattern.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "gimpchannellistview.h"
|
||||
#include "gimpcellrenderertoggle.h"
|
||||
#include "gimpchanneltreeview.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimpdrawablelistview.h"
|
||||
#include "gimpitemfactory.h"
|
||||
#include "gimplayerlistview.h"
|
||||
#include "gimplistitem.h"
|
||||
#include "gimppreview.h"
|
||||
#include "gimplayertreeview.h"
|
||||
#include "gimppreviewrenderer.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass);
|
||||
static void gimp_drawable_list_view_init (GimpDrawableListView *view);
|
||||
static void gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass);
|
||||
static void gimp_drawable_tree_view_init (GimpDrawableTreeView *view);
|
||||
|
||||
static void gimp_drawable_list_view_set_image (GimpItemListView *view,
|
||||
static GObject *gimp_drawable_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_drawable_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container);
|
||||
static gpointer gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
|
||||
static void gimp_drawable_tree_view_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static void gimp_drawable_list_view_floating_selection_changed
|
||||
static void gimp_drawable_tree_view_floating_selection_changed
|
||||
(GimpImage *gimage,
|
||||
GimpDrawableListView *view);
|
||||
GimpDrawableTreeView *view);
|
||||
|
||||
static void gimp_drawable_list_view_new_pattern_dropped
|
||||
static void gimp_drawable_tree_view_new_pattern_dropped
|
||||
(GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
static void gimp_drawable_list_view_new_color_dropped
|
||||
static void gimp_drawable_tree_view_new_color_dropped
|
||||
(GtkWidget *widget,
|
||||
const GimpRGB *color,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_drawable_tree_view_visibility_changed
|
||||
(GimpDrawable *drawable,
|
||||
GimpDrawableTreeView *view);
|
||||
static void gimp_drawable_tree_view_eye_toggled(GtkCellRendererToggle *toggle,
|
||||
gchar *path,
|
||||
GimpDrawableTreeView *view);
|
||||
|
||||
static GimpItemListViewClass *parent_class = NULL;
|
||||
|
||||
static GimpItemTreeViewClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_drawable_list_view_get_type (void)
|
||||
gimp_drawable_tree_view_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
|
@ -84,19 +99,19 @@ gimp_drawable_list_view_get_type (void)
|
|||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpDrawableListViewClass),
|
||||
sizeof (GimpDrawableTreeViewClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_drawable_list_view_class_init,
|
||||
(GClassInitFunc) gimp_drawable_tree_view_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpDrawableListView),
|
||||
sizeof (GimpDrawableTreeView),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_drawable_list_view_init,
|
||||
(GInstanceInitFunc) gimp_drawable_tree_view_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_ITEM_LIST_VIEW,
|
||||
"GimpDrawableListView",
|
||||
view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW,
|
||||
"GimpDrawableTreeView",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
|
@ -104,69 +119,168 @@ gimp_drawable_list_view_get_type (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass)
|
||||
gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GObjectClass *object_class;
|
||||
GimpContainerViewClass *container_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
item_view_class->set_image = gimp_drawable_list_view_set_image;
|
||||
object_class->constructor = gimp_drawable_tree_view_constructor;
|
||||
|
||||
container_view_class->set_container = gimp_drawable_tree_view_set_container;
|
||||
container_view_class->insert_item = gimp_drawable_tree_view_insert_item;
|
||||
|
||||
item_view_class->set_image = gimp_drawable_tree_view_set_image;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_init (GimpDrawableListView *view)
|
||||
gimp_drawable_tree_view_init (GimpDrawableTreeView *view)
|
||||
{
|
||||
GimpItemListView *item_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpItemTreeView *item_view;
|
||||
|
||||
item_view = GIMP_ITEM_LIST_VIEW (view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
view->model_column_visible = tree_view->n_model_columns;
|
||||
|
||||
tree_view->model_columns[tree_view->n_model_columns++] = G_TYPE_BOOLEAN;
|
||||
|
||||
gimp_dnd_viewable_dest_add (item_view->new_button, GIMP_TYPE_PATTERN,
|
||||
gimp_drawable_list_view_new_pattern_dropped,
|
||||
gimp_drawable_tree_view_new_pattern_dropped,
|
||||
view);
|
||||
gimp_dnd_color_dest_add (item_view->new_button,
|
||||
gimp_drawable_list_view_new_color_dropped,
|
||||
gimp_drawable_tree_view_new_color_dropped,
|
||||
view);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gimp_drawable_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpDrawableTreeView *drawable_view;
|
||||
GObject *object;
|
||||
|
||||
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (object);
|
||||
drawable_view = GIMP_DRAWABLE_TREE_VIEW (object);
|
||||
|
||||
drawable_view->eye_column = gtk_tree_view_column_new ();
|
||||
gtk_tree_view_insert_column (tree_view->view, drawable_view->eye_column, 0);
|
||||
|
||||
drawable_view->eye_cell = gimp_cell_renderer_toggle_new (GIMP_STOCK_VISIBLE);
|
||||
gtk_tree_view_column_pack_start (drawable_view->eye_column,
|
||||
drawable_view->eye_cell,
|
||||
FALSE);
|
||||
gtk_tree_view_column_set_attributes (drawable_view->eye_column,
|
||||
drawable_view->eye_cell,
|
||||
"active",
|
||||
drawable_view->model_column_visible,
|
||||
NULL);
|
||||
|
||||
tree_view->toggle_columns = g_list_prepend (tree_view->toggle_columns,
|
||||
drawable_view->eye_column);
|
||||
tree_view->toggle_cells = g_list_prepend (tree_view->toggle_cells,
|
||||
drawable_view->eye_cell);
|
||||
|
||||
g_signal_connect (drawable_view->eye_cell, "toggled",
|
||||
G_CALLBACK (gimp_drawable_tree_view_eye_toggled),
|
||||
drawable_view);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_set_image (GimpItemListView *item_view,
|
||||
gimp_drawable_tree_view_set_container (GimpContainerView *view,
|
||||
GimpContainer *container)
|
||||
{
|
||||
GimpDrawableTreeView *drawable_view;
|
||||
|
||||
drawable_view = GIMP_DRAWABLE_TREE_VIEW (view);
|
||||
|
||||
if (view->container)
|
||||
{
|
||||
gimp_container_remove_handler (view->container,
|
||||
drawable_view->visibility_changed_handler_id);
|
||||
}
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->set_container (view, container);
|
||||
|
||||
if (view->container)
|
||||
{
|
||||
drawable_view->visibility_changed_handler_id =
|
||||
gimp_container_add_handler (view->container, "visibility_changed",
|
||||
G_CALLBACK (gimp_drawable_tree_view_visibility_changed),
|
||||
view);
|
||||
}
|
||||
}
|
||||
|
||||
static gpointer
|
||||
gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index)
|
||||
{
|
||||
GtkTreeIter *iter;
|
||||
|
||||
iter = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view, viewable,
|
||||
index);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (GIMP_CONTAINER_TREE_VIEW (view)->model),
|
||||
iter,
|
||||
GIMP_DRAWABLE_TREE_VIEW (view)->model_column_visible,
|
||||
gimp_drawable_get_visible (GIMP_DRAWABLE (viewable)),
|
||||
-1);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
GimpDrawableListView *view;
|
||||
GimpDrawableTreeView *view;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE_LIST_VIEW (item_view));
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE_TREE_VIEW (item_view));
|
||||
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
||||
|
||||
view = GIMP_DRAWABLE_LIST_VIEW (item_view);
|
||||
view = GIMP_DRAWABLE_TREE_VIEW (item_view);
|
||||
|
||||
if (item_view->gimage)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (item_view->gimage,
|
||||
gimp_drawable_list_view_floating_selection_changed,
|
||||
gimp_drawable_tree_view_floating_selection_changed,
|
||||
view);
|
||||
}
|
||||
|
||||
GIMP_ITEM_LIST_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
||||
GIMP_ITEM_TREE_VIEW_CLASS (parent_class)->set_image (item_view, gimage);
|
||||
|
||||
if (item_view->gimage)
|
||||
{
|
||||
g_signal_connect (item_view->gimage,
|
||||
"floating_selection_changed",
|
||||
G_CALLBACK (gimp_drawable_list_view_floating_selection_changed),
|
||||
G_CALLBACK (gimp_drawable_tree_view_floating_selection_changed),
|
||||
view);
|
||||
|
||||
if (gimp_image_floating_sel (item_view->gimage))
|
||||
gimp_drawable_list_view_floating_selection_changed (item_view->gimage,
|
||||
gimp_drawable_tree_view_floating_selection_changed (item_view->gimage,
|
||||
view);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage,
|
||||
GimpDrawableListView *view)
|
||||
gimp_drawable_tree_view_floating_selection_changed (GimpImage *gimage,
|
||||
GimpDrawableTreeView *view)
|
||||
{
|
||||
#if 0
|
||||
GimpViewable *floating_sel;
|
||||
GList *list;
|
||||
GList *free_list;
|
||||
|
@ -174,11 +288,11 @@ gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage
|
|||
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
|
||||
|
||||
list = free_list = gtk_container_get_children
|
||||
(GTK_CONTAINER (GIMP_CONTAINER_LIST_VIEW (view)->gtk_list));
|
||||
(GTK_CONTAINER (GIMP_CONTAINER_TREE_VIEW (view)->gtk_tree));
|
||||
|
||||
for (; list; list = g_list_next (list))
|
||||
{
|
||||
if (! (GIMP_PREVIEW (GIMP_LIST_ITEM (list->data)->preview)->viewable ==
|
||||
if (! (GIMP_PREVIEW (GIMP_TREE_ITEM (list->data)->preview)->viewable ==
|
||||
floating_sel))
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
|
||||
|
@ -189,11 +303,12 @@ gimp_drawable_list_view_floating_selection_changed (GimpImage *gimage
|
|||
g_list_free (free_list);
|
||||
|
||||
/* update button states */
|
||||
/* gimp_drawable_list_view_drawable_changed (gimage, view); */
|
||||
/* gimp_drawable_tree_view_drawable_changed (gimage, view); */
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_new_dropped (GimpItemListView *view,
|
||||
gimp_drawable_tree_view_new_dropped (GimpItemTreeView *view,
|
||||
GimpBucketFillMode fill_mode,
|
||||
const GimpRGB *color,
|
||||
GimpPattern *pattern)
|
||||
|
@ -237,23 +352,82 @@ gimp_drawable_list_view_new_dropped (GimpItemListView *view,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_new_pattern_dropped (GtkWidget *widget,
|
||||
gimp_drawable_tree_view_new_pattern_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_drawable_list_view_new_dropped (GIMP_ITEM_LIST_VIEW (data),
|
||||
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
||||
GIMP_PATTERN_BUCKET_FILL,
|
||||
NULL,
|
||||
GIMP_PATTERN (viewable));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_new_color_dropped (GtkWidget *widget,
|
||||
gimp_drawable_tree_view_new_color_dropped (GtkWidget *widget,
|
||||
const GimpRGB *color,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_drawable_list_view_new_dropped (GIMP_ITEM_LIST_VIEW (data),
|
||||
gimp_drawable_tree_view_new_dropped (GIMP_ITEM_TREE_VIEW (data),
|
||||
GIMP_FG_BUCKET_FILL,
|
||||
color,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_tree_view_visibility_changed (GimpDrawable *drawable,
|
||||
GimpDrawableTreeView *view)
|
||||
{
|
||||
GimpContainerView *container_view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkTreeIter *iter;
|
||||
|
||||
container_view = GIMP_CONTAINER_VIEW (view);
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
|
||||
iter = g_hash_table_lookup (container_view->hash_table, drawable);
|
||||
|
||||
if (iter)
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
|
||||
view->model_column_visible,
|
||||
gimp_drawable_get_visible (drawable),
|
||||
-1);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_tree_view_eye_toggled (GtkCellRendererToggle *toggle,
|
||||
gchar *path_str,
|
||||
GimpDrawableTreeView *view)
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (view);
|
||||
|
||||
path = gtk_tree_path_new_from_string (path_str);
|
||||
|
||||
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
|
||||
{
|
||||
GimpPreviewRenderer *renderer;
|
||||
GimpDrawable *drawable;
|
||||
GimpImage *gimage;
|
||||
gboolean active;
|
||||
|
||||
gtk_tree_model_get (tree_view->model, &iter,
|
||||
tree_view->model_column_renderer, &renderer,
|
||||
-1);
|
||||
g_object_get (toggle,
|
||||
"active", &active,
|
||||
NULL);
|
||||
|
||||
drawable = GIMP_DRAWABLE (renderer->viewable);
|
||||
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
gimp_drawable_set_visible (drawable, !active);
|
||||
gimp_image_flush (gimage);
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdrawablelistview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpdrawabletreeview.h
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,35 +19,42 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DRAWABLE_LIST_VIEW_H__
|
||||
#define __GIMP_DRAWABLE_LIST_VIEW_H__
|
||||
#ifndef __GIMP_DRAWABLE_TREE_VIEW_H__
|
||||
#define __GIMP_DRAWABLE_TREE_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpitemlistview.h"
|
||||
#include "gimpitemtreeview.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DRAWABLE_LIST_VIEW (gimp_drawable_list_view_get_type ())
|
||||
#define GIMP_DRAWABLE_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_LIST_VIEW, GimpDrawableListView))
|
||||
#define GIMP_DRAWABLE_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE_LIST_VIEW, GimpDrawableListViewClass))
|
||||
#define GIMP_IS_DRAWABLE_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_LIST_VIEW))
|
||||
#define GIMP_IS_DRAWABLE_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE_LIST_VIEW))
|
||||
#define GIMP_DRAWABLE_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE_LIST_VIEW, GimpDrawableListViewClass))
|
||||
#define GIMP_TYPE_DRAWABLE_TREE_VIEW (gimp_drawable_tree_view_get_type ())
|
||||
#define GIMP_DRAWABLE_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE_TREE_VIEW, GimpDrawableTreeView))
|
||||
#define GIMP_DRAWABLE_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE_TREE_VIEW, GimpDrawableTreeViewClass))
|
||||
#define GIMP_IS_DRAWABLE_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE_TREE_VIEW))
|
||||
#define GIMP_IS_DRAWABLE_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE_TREE_VIEW))
|
||||
#define GIMP_DRAWABLE_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE_TREE_VIEW, GimpDrawableTreeViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpDrawableListViewClass GimpDrawableListViewClass;
|
||||
typedef struct _GimpDrawableTreeViewClass GimpDrawableTreeViewClass;
|
||||
|
||||
struct _GimpDrawableListView
|
||||
struct _GimpDrawableTreeView
|
||||
{
|
||||
GimpItemListView parent_instance;
|
||||
GimpItemTreeView parent_instance;
|
||||
|
||||
gint model_column_visible;
|
||||
|
||||
GtkTreeViewColumn *eye_column;
|
||||
GtkCellRenderer *eye_cell;
|
||||
|
||||
GQuark visibility_changed_handler_id;
|
||||
};
|
||||
|
||||
struct _GimpDrawableListViewClass
|
||||
struct _GimpDrawableTreeViewClass
|
||||
{
|
||||
GimpItemListViewClass parent_class;
|
||||
GimpItemTreeViewClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_drawable_list_view_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_drawable_tree_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_DRAWABLE_LIST_VIEW_H__ */
|
||||
#endif /* __GIMP_DRAWABLE_TREE_VIEW_H__ */
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
|
||||
#include "gimpcontainerlistview.h"
|
||||
|
||||
#include "gimpitemtreeview.h"
|
||||
|
||||
#if 0
|
||||
typedef GimpContainer * (* GimpGetContainerFunc) (const GimpImage *gimage);
|
||||
typedef GimpItem * (* GimpGetItemFunc) (const GimpImage *gimage);
|
||||
typedef void (* GimpSetItemFunc) (GimpImage *gimage,
|
||||
|
@ -48,7 +50,7 @@ typedef void (* GimpNewItemFunc) (GimpImage *gimage,
|
|||
gboolean interactive);
|
||||
typedef void (* GimpEditItemFunc) (GimpItem *item);
|
||||
typedef void (* GimpActivateItemFunc) (GimpItem *item);
|
||||
|
||||
#endif
|
||||
|
||||
#define GIMP_TYPE_ITEM_LIST_VIEW (gimp_item_list_view_get_type ())
|
||||
#define GIMP_ITEM_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_LIST_VIEW, GimpItemListView))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpitemlistview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpitemtreeview.c
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -21,10 +21,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
@ -36,20 +33,24 @@
|
|||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-undo.h"
|
||||
#include "core/gimpimage-undo-push.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimpmarshal.h"
|
||||
|
||||
/* EEK */
|
||||
#include "core/gimplayer-floating-sel.h"
|
||||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "gimpchannellistview.h"
|
||||
#include "gimpchanneltreeview.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimpitemlistview.h"
|
||||
#include "gimpitemtreeview.h"
|
||||
#include "gimpitemfactory.h"
|
||||
#include "gimplayerlistview.h"
|
||||
#include "gimplistitem.h"
|
||||
#include "gimplayertreeview.h"
|
||||
#include "gimpmenufactory.h"
|
||||
#include "gimppreview.h"
|
||||
#include "gimpvectorslistview.h"
|
||||
#include "gimppreviewrenderer.h"
|
||||
#include "gimpvectorstreeview.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -62,64 +63,72 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static void gimp_item_list_view_class_init (GimpItemListViewClass *klass);
|
||||
static void gimp_item_list_view_init (GimpItemListView *view,
|
||||
GimpItemListViewClass *view_class);
|
||||
static void gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass);
|
||||
static void gimp_item_tree_view_init (GimpItemTreeView *view,
|
||||
GimpItemTreeViewClass *view_class);
|
||||
|
||||
static void gimp_item_list_view_destroy (GtkObject *object);
|
||||
static GObject * gimp_item_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_item_tree_view_destroy (GtkObject *object);
|
||||
|
||||
static void gimp_item_list_view_real_set_image (GimpItemListView *view,
|
||||
static void gimp_item_tree_view_real_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static void gimp_item_list_view_select_item (GimpContainerView *view,
|
||||
static void gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_item_list_view_activate_item (GimpContainerView *view,
|
||||
static void gimp_item_tree_view_activate_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_item_list_view_context_item (GimpContainerView *view,
|
||||
static void gimp_item_tree_view_context_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
||||
static void gimp_item_list_view_new_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_new_dropped (GtkWidget *widget,
|
||||
static void gimp_item_tree_view_new_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_item_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_raise_extended_clicked
|
||||
static void gimp_item_tree_view_raise_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_raise_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_lower_extended_clicked
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_lower_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_lower_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpItemListView *view);
|
||||
GimpItemTreeView *view);
|
||||
|
||||
static void gimp_item_list_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_edit_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_delete_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_tree_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_edit_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
static void gimp_item_tree_view_delete_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view);
|
||||
|
||||
static void gimp_item_list_view_item_changed (GimpImage *gimage,
|
||||
GimpItemListView *view);
|
||||
static void gimp_item_list_view_size_changed (GimpImage *gimage,
|
||||
GimpItemListView *view);
|
||||
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);
|
||||
|
||||
|
||||
static guint view_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static GimpContainerListViewClass *parent_class = NULL;
|
||||
static GimpContainerTreeViewClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_item_list_view_get_type (void)
|
||||
gimp_item_tree_view_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
|
@ -127,19 +136,19 @@ gimp_item_list_view_get_type (void)
|
|||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpItemListViewClass),
|
||||
sizeof (GimpItemTreeViewClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_item_list_view_class_init,
|
||||
(GClassInitFunc) gimp_item_tree_view_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpItemListView),
|
||||
sizeof (GimpItemTreeView),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_item_list_view_init,
|
||||
(GInstanceInitFunc) gimp_item_tree_view_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_CONTAINER_LIST_VIEW,
|
||||
"GimpItemListView",
|
||||
view_type = g_type_register_static (GIMP_TYPE_CONTAINER_TREE_VIEW,
|
||||
"GimpItemTreeView",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
|
@ -147,12 +156,14 @@ gimp_item_list_view_get_type (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_class_init (GimpItemListViewClass *klass)
|
||||
gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GtkObjectClass *gtk_object_class;
|
||||
GimpContainerViewClass *container_view_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gtk_object_class = GTK_OBJECT_CLASS (klass);
|
||||
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
@ -161,19 +172,21 @@ gimp_item_list_view_class_init (GimpItemListViewClass *klass)
|
|||
g_signal_new ("set_image",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpItemListViewClass, set_image),
|
||||
G_STRUCT_OFFSET (GimpItemTreeViewClass, set_image),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GIMP_TYPE_OBJECT);
|
||||
|
||||
object_class->destroy = gimp_item_list_view_destroy;
|
||||
object_class->constructor = gimp_item_tree_view_constructor;
|
||||
|
||||
container_view_class->select_item = gimp_item_list_view_select_item;
|
||||
container_view_class->activate_item = gimp_item_list_view_activate_item;
|
||||
container_view_class->context_item = gimp_item_list_view_context_item;
|
||||
gtk_object_class->destroy = gimp_item_tree_view_destroy;
|
||||
|
||||
klass->set_image = gimp_item_list_view_real_set_image;
|
||||
container_view_class->select_item = gimp_item_tree_view_select_item;
|
||||
container_view_class->activate_item = gimp_item_tree_view_activate_item;
|
||||
container_view_class->context_item = gimp_item_tree_view_context_item;
|
||||
|
||||
klass->set_image = gimp_item_tree_view_real_set_image;
|
||||
|
||||
klass->get_container = NULL;
|
||||
klass->get_active_item = NULL;
|
||||
|
@ -194,8 +207,8 @@ gimp_item_list_view_class_init (GimpItemListViewClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_init (GimpItemListView *view,
|
||||
GimpItemListViewClass *view_class)
|
||||
gimp_item_tree_view_init (GimpItemTreeView *view,
|
||||
GimpItemTreeViewClass *view_class)
|
||||
{
|
||||
GimpEditor *editor;
|
||||
gchar *str;
|
||||
|
@ -209,7 +222,7 @@ gimp_item_list_view_init (GimpItemListView *view,
|
|||
view->new_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GTK_STOCK_NEW, view_class->new_desc, NULL,
|
||||
G_CALLBACK (gimp_item_list_view_new_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_new_clicked),
|
||||
NULL,
|
||||
view);
|
||||
|
||||
|
@ -221,8 +234,8 @@ gimp_item_list_view_init (GimpItemListView *view,
|
|||
view->raise_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GTK_STOCK_GO_UP, str, NULL,
|
||||
G_CALLBACK (gimp_item_list_view_raise_clicked),
|
||||
G_CALLBACK (gimp_item_list_view_raise_extended_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_raise_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_raise_extended_clicked),
|
||||
view);
|
||||
|
||||
g_free (str);
|
||||
|
@ -235,8 +248,8 @@ gimp_item_list_view_init (GimpItemListView *view,
|
|||
view->lower_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GTK_STOCK_GO_DOWN, str, NULL,
|
||||
G_CALLBACK (gimp_item_list_view_lower_clicked),
|
||||
G_CALLBACK (gimp_item_list_view_lower_extended_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_lower_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_lower_extended_clicked),
|
||||
view);
|
||||
|
||||
g_free (str);
|
||||
|
@ -245,21 +258,21 @@ gimp_item_list_view_init (GimpItemListView *view,
|
|||
gimp_editor_add_button (editor,
|
||||
GIMP_STOCK_DUPLICATE, view_class->duplicate_desc,
|
||||
NULL,
|
||||
G_CALLBACK (gimp_item_list_view_duplicate_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_duplicate_clicked),
|
||||
NULL,
|
||||
view);
|
||||
|
||||
view->edit_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GIMP_STOCK_EDIT, view_class->edit_desc, NULL,
|
||||
G_CALLBACK (gimp_item_list_view_edit_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_edit_clicked),
|
||||
NULL,
|
||||
view);
|
||||
|
||||
view->delete_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GTK_STOCK_DELETE, view_class->delete_desc, NULL,
|
||||
G_CALLBACK (gimp_item_list_view_delete_clicked),
|
||||
G_CALLBACK (gimp_item_tree_view_delete_clicked),
|
||||
NULL,
|
||||
view);
|
||||
|
||||
|
@ -271,15 +284,39 @@ gimp_item_list_view_init (GimpItemListView *view,
|
|||
gtk_widget_set_sensitive (view->delete_button, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_destroy (GtkObject *object)
|
||||
static GObject *
|
||||
gimp_item_tree_view_constructor (GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params)
|
||||
{
|
||||
GimpItemListView *view;
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpItemTreeView *item_view;
|
||||
GObject *object;
|
||||
|
||||
view = GIMP_ITEM_LIST_VIEW (object);
|
||||
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;
|
||||
|
||||
g_signal_connect (tree_view->name_cell, "edited",
|
||||
G_CALLBACK (gimp_item_tree_view_name_edited),
|
||||
item_view);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_tree_view_destroy (GtkObject *object)
|
||||
{
|
||||
GimpItemTreeView *view;
|
||||
|
||||
view = GIMP_ITEM_TREE_VIEW (object);
|
||||
|
||||
if (view->gimage)
|
||||
gimp_item_list_view_set_image (view, NULL);
|
||||
gimp_item_tree_view_set_image (view, NULL);
|
||||
|
||||
if (view->signal_name)
|
||||
{
|
||||
|
@ -297,7 +334,7 @@ gimp_item_list_view_destroy (GtkObject *object)
|
|||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_item_list_view_new (gint preview_size,
|
||||
gimp_item_tree_view_new (gint preview_size,
|
||||
GimpImage *gimage,
|
||||
GType item_type,
|
||||
const gchar *signal_name,
|
||||
|
@ -307,7 +344,7 @@ gimp_item_list_view_new (gint preview_size,
|
|||
GimpMenuFactory *menu_factory,
|
||||
const gchar *menu_identifier)
|
||||
{
|
||||
GimpItemListView *list_view;
|
||||
GimpItemTreeView *tree_view;
|
||||
GimpContainerView *view;
|
||||
|
||||
g_return_val_if_fail (preview_size > 0 &&
|
||||
|
@ -322,79 +359,79 @@ gimp_item_list_view_new (gint preview_size,
|
|||
|
||||
if (item_type == GIMP_TYPE_LAYER)
|
||||
{
|
||||
list_view = g_object_new (GIMP_TYPE_LAYER_LIST_VIEW, NULL);
|
||||
tree_view = g_object_new (GIMP_TYPE_LAYER_TREE_VIEW, NULL);
|
||||
}
|
||||
else if (item_type == GIMP_TYPE_CHANNEL)
|
||||
{
|
||||
list_view = g_object_new (GIMP_TYPE_CHANNEL_LIST_VIEW, NULL);
|
||||
tree_view = g_object_new (GIMP_TYPE_CHANNEL_TREE_VIEW, NULL);
|
||||
}
|
||||
else if (item_type == GIMP_TYPE_VECTORS)
|
||||
{
|
||||
list_view = g_object_new (GIMP_TYPE_VECTORS_LIST_VIEW, NULL);
|
||||
tree_view = g_object_new (GIMP_TYPE_VECTORS_TREE_VIEW, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("gimp_item_list_view_new: unsupported item type '%s'\n",
|
||||
g_warning ("gimp_item_tree_view_new: unsupported item type '%s'\n",
|
||||
g_type_name (item_type));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
view = GIMP_CONTAINER_VIEW (tree_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
|
||||
list_view->item_type = item_type;
|
||||
list_view->signal_name = g_strdup (signal_name);
|
||||
list_view->new_item_func = new_item_func;
|
||||
list_view->edit_item_func = edit_item_func;
|
||||
list_view->activate_item_func = activate_item_func;
|
||||
tree_view->item_type = item_type;
|
||||
tree_view->signal_name = g_strdup (signal_name);
|
||||
tree_view->new_item_func = new_item_func;
|
||||
tree_view->edit_item_func = edit_item_func;
|
||||
tree_view->activate_item_func = activate_item_func;
|
||||
|
||||
list_view->menu_factory = menu_factory;
|
||||
list_view->item_factory = gimp_menu_factory_menu_new (menu_factory,
|
||||
tree_view->menu_factory = menu_factory;
|
||||
tree_view->item_factory = gimp_menu_factory_menu_new (menu_factory,
|
||||
menu_identifier,
|
||||
GTK_TYPE_MENU,
|
||||
list_view,
|
||||
tree_view,
|
||||
FALSE);
|
||||
|
||||
/* connect "drop to new" manually as it makes a difference whether
|
||||
* it was clicked or dropped
|
||||
*/
|
||||
gimp_dnd_viewable_dest_add (list_view->new_button,
|
||||
gimp_dnd_viewable_dest_add (tree_view->new_button,
|
||||
item_type,
|
||||
gimp_item_list_view_new_dropped,
|
||||
gimp_item_tree_view_new_dropped,
|
||||
view);
|
||||
|
||||
gimp_container_view_enable_dnd (view,
|
||||
GTK_BUTTON (list_view->duplicate_button),
|
||||
GTK_BUTTON (tree_view->duplicate_button),
|
||||
item_type);
|
||||
gimp_container_view_enable_dnd (view,
|
||||
GTK_BUTTON (list_view->edit_button),
|
||||
GTK_BUTTON (tree_view->edit_button),
|
||||
item_type);
|
||||
gimp_container_view_enable_dnd (view,
|
||||
GTK_BUTTON (list_view->delete_button),
|
||||
GTK_BUTTON (tree_view->delete_button),
|
||||
item_type);
|
||||
|
||||
gimp_item_list_view_set_image (list_view, gimage);
|
||||
gimp_item_tree_view_set_image (tree_view, gimage);
|
||||
|
||||
return GTK_WIDGET (list_view);
|
||||
return GTK_WIDGET (tree_view);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_item_list_view_set_image (GimpItemListView *view,
|
||||
gimp_item_tree_view_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_ITEM_LIST_VIEW (view));
|
||||
g_return_if_fail (GIMP_IS_ITEM_TREE_VIEW (view));
|
||||
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
||||
|
||||
g_signal_emit (view, view_signals[SET_IMAGE], 0, gimage);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_real_set_image (GimpItemListView *view,
|
||||
gimp_item_tree_view_real_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_ITEM_LIST_VIEW (view));
|
||||
g_return_if_fail (GIMP_IS_ITEM_TREE_VIEW (view));
|
||||
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
||||
|
||||
if (view->gimage == gimage)
|
||||
|
@ -403,10 +440,10 @@ gimp_item_list_view_real_set_image (GimpItemListView *view,
|
|||
if (view->gimage)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (view->gimage,
|
||||
gimp_item_list_view_item_changed,
|
||||
gimp_item_tree_view_item_changed,
|
||||
view);
|
||||
g_signal_handlers_disconnect_by_func (view->gimage,
|
||||
gimp_item_list_view_size_changed,
|
||||
gimp_item_tree_view_size_changed,
|
||||
view);
|
||||
|
||||
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), NULL);
|
||||
|
@ -419,18 +456,18 @@ gimp_item_list_view_real_set_image (GimpItemListView *view,
|
|||
GimpContainer *container;
|
||||
|
||||
container =
|
||||
GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_container (view->gimage);
|
||||
GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_container (view->gimage);
|
||||
|
||||
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view), container);
|
||||
|
||||
g_signal_connect (view->gimage, view->signal_name,
|
||||
G_CALLBACK (gimp_item_list_view_item_changed),
|
||||
G_CALLBACK (gimp_item_tree_view_item_changed),
|
||||
view);
|
||||
g_signal_connect (view->gimage, "size_changed",
|
||||
G_CALLBACK (gimp_item_list_view_size_changed),
|
||||
G_CALLBACK (gimp_item_tree_view_size_changed),
|
||||
view);
|
||||
|
||||
gimp_item_list_view_item_changed (view->gimage, view);
|
||||
gimp_item_tree_view_item_changed (view->gimage, view);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (view->new_button, (view->gimage != NULL));
|
||||
|
@ -440,40 +477,40 @@ gimp_item_list_view_real_set_image (GimpItemListView *view,
|
|||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_select_item (GimpContainerView *view,
|
||||
gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemListView *list_view;
|
||||
GimpItemTreeView *tree_view;
|
||||
gboolean raise_sensitive = FALSE;
|
||||
gboolean lower_sensitive = FALSE;
|
||||
gboolean duplicate_sensitive = FALSE;
|
||||
gboolean edit_sensitive = FALSE;
|
||||
gboolean delete_sensitive = FALSE;
|
||||
|
||||
list_view = GIMP_ITEM_LIST_VIEW (view);
|
||||
tree_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
g_print ("item: %p\n", item);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
if (item)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *active_item;
|
||||
gint index;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (list_view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (tree_view);
|
||||
|
||||
active_item = item_view_class->get_active_item (list_view->gimage);
|
||||
active_item = item_view_class->get_active_item (tree_view->gimage);
|
||||
|
||||
if (active_item != (GimpItem *) item)
|
||||
{
|
||||
item_view_class->set_active_item (list_view->gimage,
|
||||
item_view_class->set_active_item (tree_view->gimage,
|
||||
GIMP_ITEM (item));
|
||||
|
||||
gimp_image_flush (list_view->gimage);
|
||||
gimp_image_flush (tree_view->gimage);
|
||||
}
|
||||
|
||||
index = gimp_container_get_child_index (view->container,
|
||||
|
@ -493,21 +530,21 @@ gimp_item_list_view_select_item (GimpContainerView *view,
|
|||
delete_sensitive = TRUE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (list_view->raise_button, raise_sensitive);
|
||||
gtk_widget_set_sensitive (list_view->lower_button, lower_sensitive);
|
||||
gtk_widget_set_sensitive (list_view->duplicate_button, duplicate_sensitive);
|
||||
gtk_widget_set_sensitive (list_view->edit_button, edit_sensitive);
|
||||
gtk_widget_set_sensitive (list_view->delete_button, delete_sensitive);
|
||||
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->edit_button, edit_sensitive);
|
||||
gtk_widget_set_sensitive (tree_view->delete_button, delete_sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_activate_item (GimpContainerView *view,
|
||||
gimp_item_tree_view_activate_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemListView *item_view;
|
||||
GimpItemTreeView *item_view;
|
||||
|
||||
item_view = GIMP_ITEM_LIST_VIEW (view);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->activate_item (view,
|
||||
|
@ -518,45 +555,43 @@ gimp_item_list_view_activate_item (GimpContainerView *view,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_context_item (GimpContainerView *view,
|
||||
gimp_item_tree_view_context_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemListView *item_view;
|
||||
GimpItemTreeView *item_view;
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->context_item)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->context_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
|
||||
item_view = GIMP_ITEM_LIST_VIEW (view);
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
if (item_view->item_factory)
|
||||
{
|
||||
gimp_item_factory_popup_with_data (item_view->item_factory,
|
||||
item_view,
|
||||
NULL);
|
||||
}
|
||||
gimp_item_factory_popup_with_data (item_view->item_factory,
|
||||
item_view,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/* "New" functions */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_new_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_new_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
view->new_item_func (view->gimage, NULL, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_new_dropped (GtkWidget *widget,
|
||||
gimp_item_tree_view_new_dropped (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer data)
|
||||
{
|
||||
GimpItemListView *view;
|
||||
GimpItemTreeView *view;
|
||||
|
||||
view = GIMP_ITEM_LIST_VIEW (data);
|
||||
view = GIMP_ITEM_TREE_VIEW (data);
|
||||
|
||||
if (viewable && gimp_container_have (GIMP_CONTAINER_VIEW (view)->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
|
@ -571,13 +606,13 @@ gimp_item_list_view_new_dropped (GtkWidget *widget,
|
|||
/* "Duplicate" functions */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_duplicate_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -602,13 +637,13 @@ gimp_item_list_view_duplicate_clicked (GtkWidget *widget,
|
|||
/* "Raise/Lower" functions */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_raise_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_raise_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -632,14 +667,14 @@ gimp_item_list_view_raise_clicked (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_raise_extended_clicked (GtkWidget *widget,
|
||||
gimp_item_tree_view_raise_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpItemListView *view)
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -663,13 +698,13 @@ gimp_item_list_view_raise_extended_clicked (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_lower_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_lower_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -693,14 +728,14 @@ gimp_item_list_view_lower_clicked (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_lower_extended_clicked (GtkWidget *widget,
|
||||
gimp_item_tree_view_lower_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpItemListView *view)
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -728,12 +763,12 @@ gimp_item_list_view_lower_extended_clicked (GtkWidget *widget,
|
|||
/* "Edit" functions */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_edit_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_edit_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItem *item;
|
||||
|
||||
item = GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
||||
|
||||
if (item)
|
||||
view->edit_item_func (item);
|
||||
|
@ -743,13 +778,13 @@ gimp_item_list_view_edit_clicked (GtkWidget *widget,
|
|||
/* "Delete" functions */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_delete_clicked (GtkWidget *widget,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_delete_clicked (GtkWidget *widget,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
GimpItem *item;
|
||||
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_GET_CLASS (view);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
item = item_view_class->get_active_item (view->gimage);
|
||||
|
||||
|
@ -765,20 +800,20 @@ gimp_item_list_view_delete_clicked (GtkWidget *widget,
|
|||
/* GimpImage callbacks */
|
||||
|
||||
static void
|
||||
gimp_item_list_view_item_changed (GimpImage *gimage,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_item_changed (GimpImage *gimage,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
GimpItem *item;
|
||||
|
||||
item = GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (view->gimage);
|
||||
|
||||
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (view),
|
||||
(GimpViewable *) item);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_item_list_view_size_changed (GimpImage *gimage,
|
||||
GimpItemListView *view)
|
||||
gimp_item_tree_view_size_changed (GimpImage *gimage,
|
||||
GimpItemTreeView *view)
|
||||
{
|
||||
gint preview_size;
|
||||
|
||||
|
@ -787,3 +822,66 @@ gimp_item_list_view_size_changed (GimpImage *gimage,
|
|||
gimp_container_view_set_preview_size (GIMP_CONTAINER_VIEW (view),
|
||||
preview_size);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (strcmp (new_text, gimp_object_get_name (GIMP_OBJECT (item))))
|
||||
{
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_GET_CLASS (view);
|
||||
|
||||
gimp_image_undo_group_start (view->gimage,
|
||||
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
|
||||
item_view_class->rename_desc);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning need GimpItemTreeView::rename_item()
|
||||
#endif
|
||||
if (GIMP_IS_LAYER (item) &&
|
||||
gimp_layer_is_floating_sel (GIMP_LAYER (item)))
|
||||
{
|
||||
/* If the layer is a floating selection, make it a layer */
|
||||
|
||||
floating_sel_to_layer (GIMP_LAYER (item));
|
||||
}
|
||||
|
||||
gimp_image_undo_push_item_rename (view->gimage,
|
||||
item_view_class->rename_desc,
|
||||
item);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (item), new_text);
|
||||
|
||||
gimp_image_undo_group_end (view->gimage);
|
||||
|
||||
gimp_image_flush (view->gimage);
|
||||
}
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpitemlistview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpitemtreeview.h
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,11 +19,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_ITEM_LIST_VIEW_H__
|
||||
#define __GIMP_ITEM_LIST_VIEW_H__
|
||||
#ifndef __GIMP_ITEM_TREE_VIEW_H__
|
||||
#define __GIMP_ITEM_TREE_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpcontainerlistview.h"
|
||||
#include "gimpcontainertreeview.h"
|
||||
|
||||
|
||||
typedef GimpContainer * (* GimpGetContainerFunc) (const GimpImage *gimage);
|
||||
|
@ -50,19 +50,19 @@ typedef void (* GimpEditItemFunc) (GimpItem *item);
|
|||
typedef void (* GimpActivateItemFunc) (GimpItem *item);
|
||||
|
||||
|
||||
#define GIMP_TYPE_ITEM_LIST_VIEW (gimp_item_list_view_get_type ())
|
||||
#define GIMP_ITEM_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_LIST_VIEW, GimpItemListView))
|
||||
#define GIMP_ITEM_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM_LIST_VIEW, GimpItemListViewClass))
|
||||
#define GIMP_IS_ITEM_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM_LIST_VIEW))
|
||||
#define GIMP_IS_ITEM_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM_LIST_VIEW))
|
||||
#define GIMP_ITEM_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM_LIST_VIEW, GimpItemListViewClass))
|
||||
#define GIMP_TYPE_ITEM_TREE_VIEW (gimp_item_tree_view_get_type ())
|
||||
#define GIMP_ITEM_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeView))
|
||||
#define GIMP_ITEM_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeViewClass))
|
||||
#define GIMP_IS_ITEM_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM_TREE_VIEW))
|
||||
#define GIMP_IS_ITEM_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM_TREE_VIEW))
|
||||
#define GIMP_ITEM_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM_TREE_VIEW, GimpItemTreeViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpItemListViewClass GimpItemListViewClass;
|
||||
typedef struct _GimpItemTreeViewClass GimpItemTreeViewClass;
|
||||
|
||||
struct _GimpItemListView
|
||||
struct _GimpItemTreeView
|
||||
{
|
||||
GimpContainerListView parent_instance;
|
||||
GimpContainerTreeView parent_instance;
|
||||
|
||||
GimpImage *gimage;
|
||||
|
||||
|
@ -84,15 +84,15 @@ struct _GimpItemListView
|
|||
GtkWidget *delete_button;
|
||||
};
|
||||
|
||||
struct _GimpItemListViewClass
|
||||
struct _GimpItemTreeViewClass
|
||||
{
|
||||
GimpContainerListViewClass parent_class;
|
||||
GimpContainerTreeViewClass parent_class;
|
||||
|
||||
/* virtual functions */
|
||||
void (* set_image) (GimpItemListView *view,
|
||||
/* signals */
|
||||
void (* set_image) (GimpItemTreeView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
/* virtual functions for manipulating the image's item list */
|
||||
/* virtual functions for manipulating the image's item tree */
|
||||
GimpGetContainerFunc get_container;
|
||||
GimpGetItemFunc get_active_item;
|
||||
GimpSetItemFunc set_active_item;
|
||||
|
@ -110,12 +110,13 @@ struct _GimpItemListViewClass
|
|||
const gchar *raise_to_top_desc;
|
||||
const gchar *lower_desc;
|
||||
const gchar *lower_to_bottom_desc;
|
||||
const gchar *rename_desc;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_item_list_view_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_item_tree_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_item_list_view_new (gint preview_size,
|
||||
GtkWidget * gimp_item_tree_view_new (gint preview_size,
|
||||
GimpImage *gimage,
|
||||
GType item_type,
|
||||
const gchar *signal_name,
|
||||
|
@ -125,8 +126,8 @@ GtkWidget * gimp_item_list_view_new (gint preview_size,
|
|||
GimpMenuFactory *menu_facotry,
|
||||
const gchar *menu_identifier);
|
||||
|
||||
void gimp_item_list_view_set_image (GimpItemListView *view,
|
||||
void gimp_item_tree_view_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
|
||||
#endif /* __GIMP_ITEM_LIST_VIEW_H__ */
|
||||
#endif /* __GIMP_ITEM_TREE_VIEW_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimplayerlistview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimplayertreeview.h
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,26 +19,26 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_LAYER_LIST_VIEW_H__
|
||||
#define __GIMP_LAYER_LIST_VIEW_H__
|
||||
#ifndef __GIMP_LAYER_TREE_VIEW_H__
|
||||
#define __GIMP_LAYER_TREE_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpdrawablelistview.h"
|
||||
#include "gimpdrawabletreeview.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_LAYER_LIST_VIEW (gimp_layer_list_view_get_type ())
|
||||
#define GIMP_LAYER_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_LIST_VIEW, GimpLayerListView))
|
||||
#define GIMP_LAYER_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_LIST_VIEW, GimpLayerListViewClass))
|
||||
#define GIMP_IS_LAYER_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_LIST_VIEW))
|
||||
#define GIMP_IS_LAYER_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER_LIST_VIEW))
|
||||
#define GIMP_LAYER_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER_LIST_VIEW, GimpLayerListViewClass))
|
||||
#define GIMP_TYPE_LAYER_TREE_VIEW (gimp_layer_tree_view_get_type ())
|
||||
#define GIMP_LAYER_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER_TREE_VIEW, GimpLayerTreeView))
|
||||
#define GIMP_LAYER_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_TREE_VIEW, GimpLayerTreeViewClass))
|
||||
#define GIMP_IS_LAYER_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER_TREE_VIEW))
|
||||
#define GIMP_IS_LAYER_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER_TREE_VIEW))
|
||||
#define GIMP_LAYER_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER_TREE_VIEW, GimpLayerTreeViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpLayerListViewClass GimpLayerListViewClass;
|
||||
typedef struct _GimpLayerTreeViewClass GimpLayerTreeViewClass;
|
||||
|
||||
struct _GimpLayerListView
|
||||
struct _GimpLayerTreeView
|
||||
{
|
||||
GimpDrawableListView parent_instance;
|
||||
GimpDrawableTreeView parent_instance;
|
||||
|
||||
GtkWidget *options_box;
|
||||
|
||||
|
@ -48,19 +48,29 @@ struct _GimpLayerListView
|
|||
|
||||
GtkWidget *anchor_button;
|
||||
|
||||
gint model_column_linked;
|
||||
gint model_column_mask;
|
||||
gint model_column_mask_visible;
|
||||
|
||||
GtkTreeViewColumn *chain_column;
|
||||
GtkCellRenderer *chain_cell;
|
||||
GtkCellRenderer *mask_cell;
|
||||
|
||||
/*< private >*/
|
||||
GQuark mode_changed_handler_id;
|
||||
GQuark opacity_changed_handler_id;
|
||||
GQuark preserve_trans_changed_handler_id;
|
||||
GQuark linked_changed_handler_id;
|
||||
GQuark mask_changed_handler_id;
|
||||
};
|
||||
|
||||
struct _GimpLayerListViewClass
|
||||
struct _GimpLayerTreeViewClass
|
||||
{
|
||||
GimpDrawableListViewClass parent_class;
|
||||
GimpDrawableTreeViewClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_layer_list_view_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_layer_tree_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_LAYER_LIST_VIEW_H__ */
|
||||
#endif /* __GIMP_LAYER_TREE_VIEW_H__ */
|
||||
|
|
|
@ -61,7 +61,7 @@ static void gimp_preview_renderer_init (GimpPreviewRenderer *re
|
|||
|
||||
static void gimp_preview_renderer_finalize (GObject *object);
|
||||
|
||||
static gboolean gimp_preview_renderer_idle_invalidate (GimpPreviewRenderer *renderer);
|
||||
static gboolean gimp_preview_renderer_idle_update (GimpPreviewRenderer *renderer);
|
||||
static void gimp_preview_renderer_real_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
||||
|
@ -418,7 +418,7 @@ gimp_preview_renderer_set_border_color (GimpPreviewRenderer *renderer,
|
|||
gdk_gc_set_rgb_fg_color (renderer->border_gc, &gdk_color);
|
||||
}
|
||||
|
||||
gimp_preview_renderer_update (renderer);
|
||||
gimp_preview_renderer_update_idle (renderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ gimp_preview_renderer_invalidate (GimpPreviewRenderer *renderer)
|
|||
|
||||
renderer->idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_invalidate,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_update,
|
||||
renderer, NULL);
|
||||
}
|
||||
|
||||
|
@ -452,6 +452,20 @@ gimp_preview_renderer_update (GimpPreviewRenderer *renderer)
|
|||
g_signal_emit (renderer, renderer_signals[UPDATE], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_update_idle (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
|
||||
if (renderer->idle_id)
|
||||
g_source_remove (renderer->idle_id);
|
||||
|
||||
renderer->idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_update,
|
||||
renderer, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_remove_idle (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
|
@ -586,7 +600,7 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
|||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
gimp_preview_renderer_idle_invalidate (GimpPreviewRenderer *renderer)
|
||||
gimp_preview_renderer_idle_update (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
renderer->idle_id = 0;
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ void gimp_preview_renderer_set_border_color (GimpPreviewRenderer *renderer,
|
|||
|
||||
void gimp_preview_renderer_invalidate (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_update (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_update_idle (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_remove_idle (GimpPreviewRenderer *renderer);
|
||||
|
||||
void gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
||||
|
|
|
@ -25,8 +25,11 @@
|
|||
|
||||
#include "gimpitemlistview.h"
|
||||
|
||||
#include "gimpvectorstreeview.h"
|
||||
|
||||
#if 0
|
||||
typedef void (* GimpStrokeItemFunc) (GimpVectors *vectors);
|
||||
#endif
|
||||
|
||||
|
||||
#define GIMP_TYPE_VECTORS_LIST_VIEW (gimp_vectors_list_view_get_type ())
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpvectorslistview.c
|
||||
* gimpvectorstreeview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -35,37 +35,36 @@
|
|||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "gimpvectorslistview.h"
|
||||
#include "gimpvectorstreeview.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimplistitem.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_vectors_list_view_class_init (GimpVectorsListViewClass *klass);
|
||||
static void gimp_vectors_list_view_init (GimpVectorsListView *view);
|
||||
static void gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass);
|
||||
static void gimp_vectors_tree_view_init (GimpVectorsTreeView *view);
|
||||
|
||||
static void gimp_vectors_list_view_select_item (GimpContainerView *view,
|
||||
static void gimp_vectors_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_vectors_list_view_toselection_clicked
|
||||
static void gimp_vectors_tree_view_toselection_clicked
|
||||
(GtkWidget *widget,
|
||||
GimpVectorsListView *view);
|
||||
static void gimp_vectors_list_view_toselection_extended_clicked
|
||||
GimpVectorsTreeView *view);
|
||||
static void gimp_vectors_tree_view_toselection_extended_clicked
|
||||
(GtkWidget *widget,
|
||||
guint state,
|
||||
GimpVectorsListView *view);
|
||||
GimpVectorsTreeView *view);
|
||||
|
||||
static void gimp_vectors_list_view_stroke_clicked (GtkWidget *widget,
|
||||
GimpVectorsListView *view);
|
||||
static void gimp_vectors_tree_view_stroke_clicked (GtkWidget *widget,
|
||||
GimpVectorsTreeView *view);
|
||||
|
||||
|
||||
static GimpItemListViewClass *parent_class = NULL;
|
||||
static GimpItemTreeViewClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_vectors_list_view_get_type (void)
|
||||
gimp_vectors_tree_view_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
|
@ -73,19 +72,19 @@ gimp_vectors_list_view_get_type (void)
|
|||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpVectorsListViewClass),
|
||||
sizeof (GimpVectorsTreeViewClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_vectors_list_view_class_init,
|
||||
(GClassInitFunc) gimp_vectors_tree_view_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpVectorsListView),
|
||||
sizeof (GimpVectorsTreeView),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_vectors_list_view_init,
|
||||
(GInstanceInitFunc) gimp_vectors_tree_view_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_ITEM_LIST_VIEW,
|
||||
"GimpVectorsListView",
|
||||
view_type = g_type_register_static (GIMP_TYPE_ITEM_TREE_VIEW,
|
||||
"GimpVectorsTreeView",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
|
@ -93,17 +92,17 @@ gimp_vectors_list_view_get_type (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_class_init (GimpVectorsListViewClass *klass)
|
||||
gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass)
|
||||
{
|
||||
GimpContainerViewClass *container_view_class;
|
||||
GimpItemListViewClass *item_view_class;
|
||||
GimpItemTreeViewClass *item_view_class;
|
||||
|
||||
container_view_class = GIMP_CONTAINER_VIEW_CLASS (klass);
|
||||
item_view_class = GIMP_ITEM_LIST_VIEW_CLASS (klass);
|
||||
item_view_class = GIMP_ITEM_TREE_VIEW_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
container_view_class->select_item = gimp_vectors_list_view_select_item;
|
||||
container_view_class->select_item = gimp_vectors_tree_view_select_item;
|
||||
|
||||
item_view_class->get_container = gimp_image_get_vectors;
|
||||
item_view_class->get_active_item = (GimpGetItemFunc) gimp_image_get_active_vectors;
|
||||
|
@ -120,10 +119,11 @@ gimp_vectors_list_view_class_init (GimpVectorsListViewClass *klass)
|
|||
item_view_class->raise_to_top_desc = _("Raise Path to Top");
|
||||
item_view_class->lower_desc = _("Lower Path");
|
||||
item_view_class->lower_to_bottom_desc = _("Lower Path to Bottom");
|
||||
item_view_class->rename_desc = _("Rename Path");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_init (GimpVectorsListView *view)
|
||||
gimp_vectors_tree_view_init (GimpVectorsTreeView *view)
|
||||
{
|
||||
GimpEditor *editor;
|
||||
gchar *str;
|
||||
|
@ -143,8 +143,8 @@ gimp_vectors_list_view_init (GimpVectorsListView *view)
|
|||
view->toselection_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GIMP_STOCK_SELECTION_REPLACE, str, NULL,
|
||||
G_CALLBACK (gimp_vectors_list_view_toselection_clicked),
|
||||
G_CALLBACK (gimp_vectors_list_view_toselection_extended_clicked),
|
||||
G_CALLBACK (gimp_vectors_tree_view_toselection_clicked),
|
||||
G_CALLBACK (gimp_vectors_tree_view_toselection_extended_clicked),
|
||||
view);
|
||||
|
||||
g_free (str);
|
||||
|
@ -152,7 +152,7 @@ gimp_vectors_list_view_init (GimpVectorsListView *view)
|
|||
view->stroke_button =
|
||||
gimp_editor_add_button (editor,
|
||||
GIMP_STOCK_PATH_STROKE, _("Stroke Path"), NULL,
|
||||
G_CALLBACK (gimp_vectors_list_view_stroke_clicked),
|
||||
G_CALLBACK (gimp_vectors_tree_view_stroke_clicked),
|
||||
NULL,
|
||||
view);
|
||||
|
||||
|
@ -176,41 +176,39 @@ gimp_vectors_list_view_init (GimpVectorsListView *view)
|
|||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_select_item (GimpContainerView *view,
|
||||
gimp_vectors_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpVectorsListView *list_view;
|
||||
GimpVectorsTreeView *tree_view;
|
||||
|
||||
list_view = GIMP_VECTORS_LIST_VIEW (view);
|
||||
tree_view = GIMP_VECTORS_TREE_VIEW (view);
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
gtk_widget_set_sensitive (list_view->toselection_button, item != NULL);
|
||||
gtk_widget_set_sensitive (list_view->stroke_button, item != NULL);
|
||||
gtk_widget_set_sensitive (tree_view->toselection_button, item != NULL);
|
||||
gtk_widget_set_sensitive (tree_view->stroke_button, item != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_toselection_clicked (GtkWidget *widget,
|
||||
GimpVectorsListView *view)
|
||||
gimp_vectors_tree_view_toselection_clicked (GtkWidget *widget,
|
||||
GimpVectorsTreeView *view)
|
||||
{
|
||||
gimp_vectors_list_view_toselection_extended_clicked (widget, 0, view);
|
||||
gimp_vectors_tree_view_toselection_extended_clicked (widget, 0, view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_toselection_extended_clicked (GtkWidget *widget,
|
||||
gimp_vectors_tree_view_toselection_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpVectorsListView *view)
|
||||
GimpVectorsTreeView *view)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpItem *item;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (view)->gimage;
|
||||
gimage = GIMP_ITEM_TREE_VIEW (view)->gimage;
|
||||
|
||||
item = GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
|
||||
if (item)
|
||||
{
|
||||
|
@ -237,15 +235,15 @@ gimp_vectors_list_view_toselection_extended_clicked (GtkWidget *widget
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_vectors_list_view_stroke_clicked (GtkWidget *widget,
|
||||
GimpVectorsListView *view)
|
||||
gimp_vectors_tree_view_stroke_clicked (GtkWidget *widget,
|
||||
GimpVectorsTreeView *view)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpItem *item;
|
||||
|
||||
gimage = GIMP_ITEM_LIST_VIEW (view)->gimage;
|
||||
gimage = GIMP_ITEM_TREE_VIEW (view)->gimage;
|
||||
|
||||
item = GIMP_ITEM_LIST_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
|
||||
if (item && view->stroke_item_func)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpvectorslistview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
* gimpvectorstreeview.h
|
||||
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,29 +19,29 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_VECTORS_LIST_VIEW_H__
|
||||
#define __GIMP_VECTORS_LIST_VIEW_H__
|
||||
#ifndef __GIMP_VECTORS_TREE_VIEW_H__
|
||||
#define __GIMP_VECTORS_TREE_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpitemlistview.h"
|
||||
#include "gimpitemtreeview.h"
|
||||
|
||||
|
||||
typedef void (* GimpStrokeItemFunc) (GimpVectors *vectors);
|
||||
|
||||
|
||||
#define GIMP_TYPE_VECTORS_LIST_VIEW (gimp_vectors_list_view_get_type ())
|
||||
#define GIMP_VECTORS_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_LIST_VIEW, GimpVectorsListView))
|
||||
#define GIMP_VECTORS_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_LIST_VIEW, GimpVectorsListViewClass))
|
||||
#define GIMP_IS_VECTORS_LIST_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_LIST_VIEW))
|
||||
#define GIMP_IS_VECTORS_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_LIST_VIEW))
|
||||
#define GIMP_VECTORS_LIST_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_LIST_VIEW, GimpVectorsListViewClass))
|
||||
#define GIMP_TYPE_VECTORS_TREE_VIEW (gimp_vectors_tree_view_get_type ())
|
||||
#define GIMP_VECTORS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeView))
|
||||
#define GIMP_VECTORS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeViewClass))
|
||||
#define GIMP_IS_VECTORS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VECTORS_TREE_VIEW))
|
||||
#define GIMP_IS_VECTORS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VECTORS_TREE_VIEW))
|
||||
#define GIMP_VECTORS_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VECTORS_TREE_VIEW, GimpVectorsTreeViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpVectorsListViewClass GimpVectorsListViewClass;
|
||||
typedef struct _GimpVectorsTreeViewClass GimpVectorsTreeViewClass;
|
||||
|
||||
struct _GimpVectorsListView
|
||||
struct _GimpVectorsTreeView
|
||||
{
|
||||
GimpItemListView parent_instance;
|
||||
GimpItemTreeView parent_instance;
|
||||
|
||||
GimpStrokeItemFunc stroke_item_func;
|
||||
|
||||
|
@ -49,13 +49,13 @@ struct _GimpVectorsListView
|
|||
GtkWidget *stroke_button;
|
||||
};
|
||||
|
||||
struct _GimpVectorsListViewClass
|
||||
struct _GimpVectorsTreeViewClass
|
||||
{
|
||||
GimpItemListViewClass parent_class;
|
||||
GimpItemTreeViewClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_vectors_list_view_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_vectors_tree_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_VECTORS_LIST_VIEW_H__ */
|
||||
#endif /* __GIMP_VECTORS_TREE_VIEW_H__ */
|
||||
|
|
|
@ -61,7 +61,7 @@ static void gimp_preview_renderer_init (GimpPreviewRenderer *re
|
|||
|
||||
static void gimp_preview_renderer_finalize (GObject *object);
|
||||
|
||||
static gboolean gimp_preview_renderer_idle_invalidate (GimpPreviewRenderer *renderer);
|
||||
static gboolean gimp_preview_renderer_idle_update (GimpPreviewRenderer *renderer);
|
||||
static void gimp_preview_renderer_real_render (GimpPreviewRenderer *renderer,
|
||||
GtkWidget *widget);
|
||||
|
||||
|
@ -418,7 +418,7 @@ gimp_preview_renderer_set_border_color (GimpPreviewRenderer *renderer,
|
|||
gdk_gc_set_rgb_fg_color (renderer->border_gc, &gdk_color);
|
||||
}
|
||||
|
||||
gimp_preview_renderer_update (renderer);
|
||||
gimp_preview_renderer_update_idle (renderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ gimp_preview_renderer_invalidate (GimpPreviewRenderer *renderer)
|
|||
|
||||
renderer->idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_invalidate,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_update,
|
||||
renderer, NULL);
|
||||
}
|
||||
|
||||
|
@ -452,6 +452,20 @@ gimp_preview_renderer_update (GimpPreviewRenderer *renderer)
|
|||
g_signal_emit (renderer, renderer_signals[UPDATE], 0);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_update_idle (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW_RENDERER (renderer));
|
||||
|
||||
if (renderer->idle_id)
|
||||
g_source_remove (renderer->idle_id);
|
||||
|
||||
renderer->idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) gimp_preview_renderer_idle_update,
|
||||
renderer, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_renderer_remove_idle (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
|
@ -586,7 +600,7 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
|||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
gimp_preview_renderer_idle_invalidate (GimpPreviewRenderer *renderer)
|
||||
gimp_preview_renderer_idle_update (GimpPreviewRenderer *renderer)
|
||||
{
|
||||
renderer->idle_id = 0;
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ void gimp_preview_renderer_set_border_color (GimpPreviewRenderer *renderer,
|
|||
|
||||
void gimp_preview_renderer_invalidate (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_update (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_update_idle (GimpPreviewRenderer *renderer);
|
||||
void gimp_preview_renderer_remove_idle (GimpPreviewRenderer *renderer);
|
||||
|
||||
void gimp_preview_renderer_draw (GimpPreviewRenderer *renderer,
|
||||
|
|
|
@ -82,6 +82,12 @@ typedef struct _GimpLayerListView GimpLayerListView;
|
|||
typedef struct _GimpChannelListView GimpChannelListView;
|
||||
typedef struct _GimpVectorsListView GimpVectorsListView;
|
||||
|
||||
typedef struct _GimpItemTreeView GimpItemTreeView;
|
||||
typedef struct _GimpDrawableTreeView GimpDrawableTreeView;
|
||||
typedef struct _GimpLayerTreeView GimpLayerTreeView;
|
||||
typedef struct _GimpChannelTreeView GimpChannelTreeView;
|
||||
typedef struct _GimpVectorsTreeView GimpVectorsTreeView;
|
||||
|
||||
typedef struct _GimpContainerEditor GimpContainerEditor;
|
||||
typedef struct _GimpBufferView GimpBufferView;
|
||||
typedef struct _GimpDocumentView GimpDocumentView;
|
||||
|
|
|
@ -340,7 +340,8 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
|
||||
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect))
|
||||
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
|
||||
(flags & GTK_CELL_RENDERER_PRELIT))
|
||||
gtk_paint_shadow (widget->style,
|
||||
window,
|
||||
state,
|
||||
|
|
Loading…
Reference in New Issue