Commit 3e695dd0 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added a GimpAnchorItemFunc and use it if it's set.

2002-03-11  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimplayerlistview.[ch]: added a GimpAnchorItemFunc
	and use it if it's set.

	* app/widgets/gimpitemlistview.c: removed the floating selection
	special case hack from the remove_item callback.

	* app/gui/layers-commands.[ch]: added layers_remove_layer() and
	layers_anchor_layer(). Fixed sensitive setting of the "Anchor"
	menu item.

	* app/gui/dialogs-constructors.c: use the new functions when
	constructing the layers dialog. Makes deleting and anchoring
	floating selections from the layers dialog work without hacking
	or code duplication.

	* app/widgets/gimpdialogfactory.c: added comments about dialog
	destruction in dispose().
parent 51dbc478
2002-03-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimplayerlistview.[ch]: added a GimpAnchorItemFunc
and use it if it's set.
* app/widgets/gimpitemlistview.c: removed the floating selection
special case hack from the remove_item callback.
* app/gui/layers-commands.[ch]: added layers_remove_layer() and
layers_anchor_layer(). Fixed sensitive setting of the "Anchor"
menu item.
* app/gui/dialogs-constructors.c: use the new functions when
constructing the layers dialog. Makes deleting and anchoring
floating selections from the layers dialog work without hacking
or code duplication.
* app/widgets/gimpdialogfactory.c: added comments about dialog
destruction in dispose().
2002-03-10 Michael Natterer <mitch@gimp.org> 2002-03-10 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpwidgets.h: removed type checking casts from * libgimpwidgets/gimpwidgets.h: removed type checking casts from
......
...@@ -209,11 +209,7 @@ layers_anchor_cmd_callback (GtkWidget *widget, ...@@ -209,11 +209,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
GimpLayer *active_layer; GimpLayer *active_layer;
return_if_no_layer (gimage, active_layer); return_if_no_layer (gimage, active_layer);
if (gimp_layer_is_floating_sel (active_layer)) layers_anchor_layer (active_layer);
{
floating_sel_anchor (active_layer);
gdisplays_flush ();
}
} }
void void
...@@ -384,6 +380,31 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget, ...@@ -384,6 +380,31 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget,
layers_edit_layer_query (active_layer); layers_edit_layer_query (active_layer);
} }
void
layers_remove_layer (GimpImage *gimage,
GimpLayer *layer)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_LAYER (layer));
if (gimp_layer_is_floating_sel (layer))
floating_sel_remove (layer);
else
gimp_image_remove_layer (gimage, layer);
}
void
layers_anchor_layer (GimpLayer *layer)
{
g_return_if_fail (GIMP_IS_LAYER (layer));
if (gimp_layer_is_floating_sel (layer))
{
floating_sel_anchor (layer);
gdisplays_flush ();
}
}
/********************************/ /********************************/
/* The new layer query dialog */ /* The new layer query dialog */
...@@ -1140,30 +1161,27 @@ layers_menu_update (GtkItemFactory *factory, ...@@ -1140,30 +1161,27 @@ layers_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/New Layer...", gimage); SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev); SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev); SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Lower Layer", SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha); SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom",
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next); SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp); SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp); SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp); SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp); SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Add Layer Mask...", SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha && !indexed);
!fs && !ac && gimage && !lm && lp && alpha && !indexed); SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp); SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp); SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha); SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha); SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
......
...@@ -70,8 +70,11 @@ void layers_edit_attributes_cmd_callback (GtkWidget *widet, ...@@ -70,8 +70,11 @@ void layers_edit_attributes_cmd_callback (GtkWidget *widet,
void layers_menu_update (GtkItemFactory *factory, void layers_menu_update (GtkItemFactory *factory,
gpointer data); gpointer data);
void layers_remove_layer (GimpImage *gimage,
GimpLayer *layer);
void layers_anchor_layer (GimpLayer *layer);
void layers_new_layer_query (GimpImage *gimage, void layers_new_layer_query (GimpImage *gimage,
GimpLayer *tamplate); GimpLayer *template);
void layers_edit_layer_query (GimpLayer *layer); void layers_edit_layer_query (GimpLayer *layer);
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "widgets/gimpdockbook.h" #include "widgets/gimpdockbook.h"
#include "widgets/gimpdocumentview.h" #include "widgets/gimpdocumentview.h"
#include "widgets/gimpgradienteditor.h" #include "widgets/gimpgradienteditor.h"
#include "widgets/gimplayerlistview.h"
#include "widgets/gimplistitem.h" #include "widgets/gimplistitem.h"
#include "widgets/gimppaletteeditor.h" #include "widgets/gimppaletteeditor.h"
#include "widgets/gimppreview.h" #include "widgets/gimppreview.h"
...@@ -636,9 +637,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -636,9 +637,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
GimpContext *context, GimpContext *context,
gint preview_size) gint preview_size)
{ {
GimpImage *gimage; GimpImage *gimage;
GtkWidget *view; GimpLayerListView *layer_view;
GtkWidget *dockable; GtkWidget *view;
GtkWidget *dockable;
gimage = gimp_context_get_image (context); gimage = gimp_context_get_image (context);
...@@ -652,7 +654,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -652,7 +654,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpSetItemFunc) gimp_image_set_active_layer, (GimpSetItemFunc) gimp_image_set_active_layer,
(GimpReorderItemFunc) gimp_image_position_layer, (GimpReorderItemFunc) gimp_image_position_layer,
(GimpAddItemFunc) gimp_image_add_layer, (GimpAddItemFunc) gimp_image_add_layer,
(GimpRemoveItemFunc) gimp_image_remove_layer, (GimpRemoveItemFunc) layers_remove_layer,
(GimpCopyItemFunc) gimp_layer_copy, (GimpCopyItemFunc) gimp_layer_copy,
(GimpConvertItemFunc) gimp_layer_new_from_drawable, (GimpConvertItemFunc) gimp_layer_new_from_drawable,
(GimpNewItemFunc) layers_new_layer_query, (GimpNewItemFunc) layers_new_layer_query,
...@@ -660,6 +662,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -660,6 +662,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpActivateItemFunc) layers_edit_layer_query, (GimpActivateItemFunc) layers_edit_layer_query,
gimp_item_factory_from_path ("<Layers>")); gimp_item_factory_from_path ("<Layers>"));
layer_view = GIMP_LAYER_LIST_VIEW (view);
layer_view->anchor_item_func = layers_anchor_layer;
dockable = dialogs_dockable_new (view, dockable = dialogs_dockable_new (view,
"Layer List", "Layers", "Layer List", "Layers",
NULL, NULL,
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "widgets/gimpdockbook.h" #include "widgets/gimpdockbook.h"
#include "widgets/gimpdocumentview.h" #include "widgets/gimpdocumentview.h"
#include "widgets/gimpgradienteditor.h" #include "widgets/gimpgradienteditor.h"
#include "widgets/gimplayerlistview.h"
#include "widgets/gimplistitem.h" #include "widgets/gimplistitem.h"
#include "widgets/gimppaletteeditor.h" #include "widgets/gimppaletteeditor.h"
#include "widgets/gimppreview.h" #include "widgets/gimppreview.h"
...@@ -636,9 +637,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -636,9 +637,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
GimpContext *context, GimpContext *context,
gint preview_size) gint preview_size)
{ {
GimpImage *gimage; GimpImage *gimage;
GtkWidget *view; GimpLayerListView *layer_view;
GtkWidget *dockable; GtkWidget *view;
GtkWidget *dockable;
gimage = gimp_context_get_image (context); gimage = gimp_context_get_image (context);
...@@ -652,7 +654,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -652,7 +654,7 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpSetItemFunc) gimp_image_set_active_layer, (GimpSetItemFunc) gimp_image_set_active_layer,
(GimpReorderItemFunc) gimp_image_position_layer, (GimpReorderItemFunc) gimp_image_position_layer,
(GimpAddItemFunc) gimp_image_add_layer, (GimpAddItemFunc) gimp_image_add_layer,
(GimpRemoveItemFunc) gimp_image_remove_layer, (GimpRemoveItemFunc) layers_remove_layer,
(GimpCopyItemFunc) gimp_layer_copy, (GimpCopyItemFunc) gimp_layer_copy,
(GimpConvertItemFunc) gimp_layer_new_from_drawable, (GimpConvertItemFunc) gimp_layer_new_from_drawable,
(GimpNewItemFunc) layers_new_layer_query, (GimpNewItemFunc) layers_new_layer_query,
...@@ -660,6 +662,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory, ...@@ -660,6 +662,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpActivateItemFunc) layers_edit_layer_query, (GimpActivateItemFunc) layers_edit_layer_query,
gimp_item_factory_from_path ("<Layers>")); gimp_item_factory_from_path ("<Layers>"));
layer_view = GIMP_LAYER_LIST_VIEW (view);
layer_view->anchor_item_func = layers_anchor_layer;
dockable = dialogs_dockable_new (view, dockable = dialogs_dockable_new (view,
"Layer List", "Layers", "Layer List", "Layers",
NULL, NULL,
......
...@@ -209,11 +209,7 @@ layers_anchor_cmd_callback (GtkWidget *widget, ...@@ -209,11 +209,7 @@ layers_anchor_cmd_callback (GtkWidget *widget,
GimpLayer *active_layer; GimpLayer *active_layer;
return_if_no_layer (gimage, active_layer); return_if_no_layer (gimage, active_layer);
if (gimp_layer_is_floating_sel (active_layer)) layers_anchor_layer (active_layer);
{
floating_sel_anchor (active_layer);
gdisplays_flush ();
}
} }
void void
...@@ -384,6 +380,31 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget, ...@@ -384,6 +380,31 @@ layers_edit_attributes_cmd_callback (GtkWidget *widget,
layers_edit_layer_query (active_layer); layers_edit_layer_query (active_layer);
} }
void
layers_remove_layer (GimpImage *gimage,
GimpLayer *layer)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_LAYER (layer));
if (gimp_layer_is_floating_sel (layer))
floating_sel_remove (layer);
else
gimp_image_remove_layer (gimage, layer);
}
void
layers_anchor_layer (GimpLayer *layer)
{
g_return_if_fail (GIMP_IS_LAYER (layer));
if (gimp_layer_is_floating_sel (layer))
{
floating_sel_anchor (layer);
gdisplays_flush ();
}
}
/********************************/ /********************************/
/* The new layer query dialog */ /* The new layer query dialog */
...@@ -1140,30 +1161,27 @@ layers_menu_update (GtkItemFactory *factory, ...@@ -1140,30 +1161,27 @@ layers_menu_update (GtkItemFactory *factory,
SET_SENSITIVE ("/New Layer...", gimage); SET_SENSITIVE ("/New Layer...", gimage);
SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev); SET_SENSITIVE ("/Raise Layer", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev); SET_SENSITIVE ("/Layer to Top", !fs && !ac && gimage && lp && alpha && prev);
SET_SENSITIVE ("/Lower Layer", SET_SENSITIVE ("/Lower Layer", !fs && !ac && gimage && lp && next && next_alpha);
!fs && !ac && gimage && lp && next && next_alpha); SET_SENSITIVE ("/Layer to Bottom", !fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Layer to Bottom",
!fs && !ac && gimage && lp && next && next_alpha);
SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Duplicate Layer", !fs && !ac && gimage && lp);
SET_SENSITIVE ("/Anchor Layer", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Anchor Layer", fs && !ac && gimage && lp);
SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next); SET_SENSITIVE ("/Merge Down", !fs && !ac && gimage && lp && next);
SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp); SET_SENSITIVE ("/Delete Layer", !ac && gimage && lp);
SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp); SET_SENSITIVE ("/Layer Boundary Size...", !ac && gimage && lp);
SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp); SET_SENSITIVE ("/Layer to Imagesize", !ac && gimage && lp);
SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp); SET_SENSITIVE ("/Scale Layer...", !ac && gimage && lp);
SET_SENSITIVE ("/Add Layer Mask...", SET_SENSITIVE ("/Add Layer Mask...", !fs && !ac && gimage && !lm && lp && alpha && !indexed);
!fs && !ac && gimage && !lm && lp && alpha && !indexed); SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Apply Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp); SET_SENSITIVE ("/Delete Layer Mask", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp); SET_SENSITIVE ("/Mask to Selection", !fs && !ac && gimage && lm && lp);
SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha); SET_SENSITIVE ("/Add Alpha Channel", !fs && !alpha);
SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha); SET_SENSITIVE ("/Alpha to Selection", !fs && !ac && gimage && lp && alpha);
SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp); SET_SENSITIVE ("/Edit Layer Attributes...", !fs && !ac && gimage && lp);
......
...@@ -70,8 +70,11 @@ void layers_edit_attributes_cmd_callback (GtkWidget *widet, ...@@ -70,8 +70,11 @@ void layers_edit_attributes_cmd_callback (GtkWidget *widet,
void layers_menu_update (GtkItemFactory *factory, void layers_menu_update (GtkItemFactory *factory,
gpointer data); gpointer data);
void layers_remove_layer (GimpImage *gimage,
GimpLayer *layer);
void layers_anchor_layer (GimpLayer *layer);
void layers_new_layer_query (GimpImage *gimage, void layers_new_layer_query (GimpImage *gimage,
GimpLayer *tamplate); GimpLayer *template);
void layers_edit_layer_query (GimpLayer *layer); void layers_edit_layer_query (GimpLayer *layer);
......
...@@ -156,6 +156,10 @@ gimp_dialog_factory_dispose (GObject *object) ...@@ -156,6 +156,10 @@ gimp_dialog_factory_dispose (GObject *object)
factory = GIMP_DIALOG_FACTORY (object); factory = GIMP_DIALOG_FACTORY (object);
/* start iterating from the beginning each time we destroyed a
* toplevel because destroying a dock may cause lots of items
* to be removed from factory->open_dialogs
*/
while (factory->open_dialogs) while (factory->open_dialogs)
{ {
for (list = factory->open_dialogs; list; list = g_list_next (list)) for (list = factory->open_dialogs; list; list = g_list_next (list))
...@@ -167,9 +171,12 @@ gimp_dialog_factory_dispose (GObject *object) ...@@ -167,9 +171,12 @@ gimp_dialog_factory_dispose (GObject *object)
} }
} }
/* the list being non-empty without any toplevel is an error,
* so eek and chain up
*/
if (! list) if (! list)
{ {
g_warning ("%s: stale entries in factory->open_dialogs", g_warning ("%s: stale non-toplevel entries in factory->open_dialogs",
G_GNUC_FUNCTION); G_GNUC_FUNCTION);
break; break;
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
#include "vectors/gimpvectors.h" #include "vectors/gimpvectors.h"
...@@ -701,12 +700,7 @@ gimp_item_list_view_delete_clicked (GtkWidget *widget, ...@@ -701,12 +700,7 @@ gimp_item_list_view_delete_clicked (GtkWidget *widget,
viewable = view->get_item_func (view->gimage); viewable = view->get_item_func (view->gimage);
/* EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEK */ view->remove_item_func (view->gimage, viewable);
if (GIMP_IS_LAYER (viewable) &&
gimp_layer_is_floating_sel (GIMP_LAYER (viewable)))
floating_sel_remove (GIMP_LAYER (viewable));
else
view->remove_item_func (view->gimage, viewable);
gdisplays_flush (); gdisplays_flush ();
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "core/gimpcontainer.h" #include "core/gimpcontainer.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimpmarshal.h" #include "core/gimpmarshal.h"
#include "vectors/gimpvectors.h" #include "vectors/gimpvectors.h"
...@@ -701,12 +700,7 @@ gimp_item_list_view_delete_clicked (GtkWidget *widget, ...@@ -701,12 +700,7 @@ gimp_item_list_view_delete_clicked (GtkWidget *widget,
viewable = view->get_item_func (view->gimage); viewable = view->get_item_func (view->gimage);
/* EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEK */ view->remove_item_func (view->gimage, viewable);
if (GIMP_IS_LAYER (viewable) &&
gimp_layer_is_floating_sel (GIMP_LAYER (viewable)))
floating_sel_remove (GIMP_LAYER (viewable));
else
view->remove_item_func (view->gimage, viewable);
gdisplays_flush (); gdisplays_flush ();
} }
......
...@@ -340,9 +340,9 @@ gimp_layer_list_view_anchor_clicked (GtkWidget *widget, ...@@ -340,9 +340,9 @@ gimp_layer_list_view_anchor_clicked (GtkWidget *widget,
layer = (GimpLayer *) item_view->get_item_func (item_view->gimage); layer = (GimpLayer *) item_view->get_item_func (item_view->gimage);
if (GIMP_IS_LAYER (layer)) if (view->anchor_item_func)
{ {
g_print ("anchor \"%s\"\n", GIMP_OBJECT (layer)->name); view->anchor_item_func (layer);
} }
} }
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "gimpdrawablelistview.h" #include "gimpdrawablelistview.h"
typedef void (* GimpAnchorItemFunc) (GimpLayer *layer);
#define GIMP_TYPE_LAYER_LIST_VIEW (gimp_layer_list_view_get_type ()) #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(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_LAYER_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_LIST_VIEW, GimpLayerListViewClass))
...@@ -40,6 +43,8 @@ struct _GimpLayerListView ...@@ -40,6 +43,8 @@ struct _GimpLayerListView
{ {
GimpDrawableListView parent_instance; GimpDrawableListView parent_instance;
GimpAnchorItemFunc anchor_item_func;
GtkWidget *options_box; GtkWidget *options_box;
GtkWidget *paint_mode_menu; GtkWidget *paint_mode_menu;
......
...@@ -340,9 +340,9 @@ gimp_layer_list_view_anchor_clicked (GtkWidget *widget, ...@@ -340,9 +340,9 @@ gimp_layer_list_view_anchor_clicked (GtkWidget *widget,
layer = (GimpLayer *) item_view->get_item_func (item_view->gimage); layer = (GimpLayer *) item_view->get_item_func (item_view->gimage);
if (GIMP_IS_LAYER (layer)) if (view->anchor_item_func)
{ {
g_print ("anchor \"%s\"\n", GIMP_OBJECT (layer)->name); view->anchor_item_func (layer);
} }
} }
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "gimpdrawablelistview.h" #include "gimpdrawablelistview.h"
typedef void (* GimpAnchorItemFunc) (GimpLayer *layer);
#define GIMP_TYPE_LAYER_LIST_VIEW (gimp_layer_list_view_get_type ()) #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(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_LAYER_LIST_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER_LIST_VIEW, GimpLayerListViewClass))
...@@ -40,6 +43,8 @@ struct _GimpLayerListView ...@@ -40,6 +43,8 @@ struct _GimpLayerListView
{ {
GimpDrawableListView parent_instance; GimpDrawableListView parent_instance;
GimpAnchorItemFunc anchor_item_func;
GtkWidget *options_box; GtkWidget *options_box;
GtkWidget *paint_mode_menu; GtkWidget *paint_mode_menu;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment