added BOOLEAN: OBJECT, POINTER.
2003-05-18 Michael Natterer <mitch@gimp.org> * app/core/gimpmarshal.list: added BOOLEAN: OBJECT, POINTER. * app/widgets/gimpcontainerview.[ch]: added a boolean return value to GimpContainerView::select_item() which indicates if the select operation was successful. * app/widgets/gimpchanneltreeview.c * app/widgets/gimpcontainereditor.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainertreeview.c * app/widgets/gimpitemtreeview.c * app/widgets/gimplayertreeview.c * app/widgets/gimpvectorstreeview.c: changed accordingly. * app/widgets/gimpdrawabletreeview.c: ditto. Removed the tree_view's select_function because it was only constraining the widget, not the underlying select operation. Instead, implement GimpContainerView::select_item() and disallow anything but the floating selection to be selected. Also re-enabled the "floating_selection_changed" callback and explicitely set the active item so the button states get updated. Fixes bug #112487.
This commit is contained in:
parent
bda46bbc35
commit
256701f68d
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
2003-05-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpmarshal.list: added BOOLEAN: OBJECT, POINTER.
|
||||
|
||||
* app/widgets/gimpcontainerview.[ch]: added a boolean return
|
||||
value to GimpContainerView::select_item() which indicates if
|
||||
the select operation was successful.
|
||||
|
||||
* app/widgets/gimpchanneltreeview.c
|
||||
* app/widgets/gimpcontainereditor.c
|
||||
* app/widgets/gimpcontainergridview.c
|
||||
* app/widgets/gimpcontainertreeview.c
|
||||
* app/widgets/gimpitemtreeview.c
|
||||
* app/widgets/gimplayertreeview.c
|
||||
* app/widgets/gimpvectorstreeview.c: changed accordingly.
|
||||
|
||||
* app/widgets/gimpdrawabletreeview.c: ditto. Removed the
|
||||
tree_view's select_function because it was only constraining the
|
||||
widget, not the underlying select operation. Instead, implement
|
||||
GimpContainerView::select_item() and disallow anything but the
|
||||
floating selection to be selected. Also re-enabled the
|
||||
"floating_selection_changed" callback and explicitely set the
|
||||
active item so the button states get updated. Fixes bug #112487.
|
||||
|
||||
2003-05-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/vectors/gimpvectors.[ch]: added new function
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
BOOLEAN: BOOLEAN
|
||||
BOOLEAN: ENUM, INT
|
||||
BOOLEAN: OBJECT, POINTER
|
||||
|
||||
VOID: BOXED
|
||||
VOID: DOUBLE
|
||||
|
@ -47,7 +47,7 @@ static void gimp_channel_tree_view_init (GimpChannelTreeView *view)
|
||||
static void gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static void gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_channel_tree_view_set_preview_size (GimpContainerView *view);
|
||||
@ -198,20 +198,20 @@ gimp_channel_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemTreeView *item_view;
|
||||
GimpChannelTreeView *tree_view;
|
||||
gboolean success;
|
||||
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
tree_view = GIMP_CHANNEL_TREE_VIEW (view);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view,
|
||||
item,
|
||||
insert_data);
|
||||
success = GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
if (item_view->gimage)
|
||||
{
|
||||
@ -222,7 +222,10 @@ gimp_channel_tree_view_select_item (GimpContainerView *view,
|
||||
gtk_widget_set_sensitive (GIMP_EDITOR (view)->button_box, ! floating_sel);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (tree_view->toselection_button, item != NULL);
|
||||
gtk_widget_set_sensitive (tree_view->toselection_button,
|
||||
success && item != NULL);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,7 +42,7 @@
|
||||
static void gimp_container_editor_class_init (GimpContainerEditorClass *klass);
|
||||
static void gimp_container_editor_init (GimpContainerEditor *view);
|
||||
|
||||
static void gimp_container_editor_select_item (GtkWidget *widget,
|
||||
static gboolean gimp_container_editor_select_item (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
GimpContainerEditor *editor);
|
||||
@ -180,7 +180,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_container_editor_select_item (GtkWidget *widget,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data,
|
||||
@ -192,6 +192,8 @@ gimp_container_editor_select_item (GtkWidget *widget,
|
||||
|
||||
if (klass->select_item)
|
||||
klass->select_item (editor, viewable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -69,7 +69,7 @@ static void gimp_container_grid_view_reorder_item (GimpContainerView *v
|
||||
GimpViewable *viewable,
|
||||
gint new_index,
|
||||
gpointer insert_data);
|
||||
static void gimp_container_grid_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_container_grid_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data);
|
||||
static void gimp_container_grid_view_clear_items (GimpContainerView *view);
|
||||
@ -433,12 +433,14 @@ gimp_container_grid_view_reorder_item (GimpContainerView *view,
|
||||
preview, new_index);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_container_grid_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data)
|
||||
{
|
||||
gimp_container_grid_view_highlight_item (view, viewable, insert_data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -503,10 +505,12 @@ static void
|
||||
gimp_container_grid_view_item_context (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
|
||||
GIMP_PREVIEW (widget)->viewable);
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (data),
|
||||
GIMP_PREVIEW (widget)->viewable);
|
||||
if (gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
|
||||
GIMP_PREVIEW (widget)->viewable))
|
||||
{
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (data),
|
||||
GIMP_PREVIEW (widget)->viewable);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -69,7 +69,7 @@ static void gimp_container_tree_view_reorder_item (GimpContainerView *v
|
||||
GimpViewable *viewable,
|
||||
gint new_index,
|
||||
gpointer insert_data);
|
||||
static void gimp_container_tree_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_container_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data);
|
||||
static void gimp_container_tree_view_clear_items (GimpContainerView *view);
|
||||
@ -493,7 +493,7 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_container_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gpointer insert_data)
|
||||
@ -525,7 +525,7 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
|
||||
g_object_unref (renderer);
|
||||
|
||||
if (equal)
|
||||
return;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
path = gtk_tree_model_get_path (tree_view->model, iter);
|
||||
@ -556,6 +556,8 @@ gimp_container_tree_view_select_item (GimpContainerView *view,
|
||||
{
|
||||
gtk_tree_selection_unselect_all (tree_view->selection);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -758,10 +760,12 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
case 1:
|
||||
if (bevent->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
|
||||
/* don't select item if a toggle was clicked */
|
||||
if (! toggled_cell)
|
||||
gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable);
|
||||
success = gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable);
|
||||
|
||||
/* a callback invoked by selecting the item may have
|
||||
* destroyed us, so check if the container is still there
|
||||
@ -798,38 +802,48 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
}
|
||||
else if (bevent->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
if (edit_cell)
|
||||
gboolean success = TRUE;
|
||||
|
||||
/* don't select item if a toggle was clicked */
|
||||
if (! toggled_cell)
|
||||
success = gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (edit_cell)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: remove this hack as soon as #108956 is fixed.
|
||||
#endif
|
||||
if (column->editable_widget)
|
||||
gtk_cell_editable_remove_widget (column->editable_widget);
|
||||
if (column->editable_widget)
|
||||
gtk_cell_editable_remove_widget (column->editable_widget);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: make sure the orig text gets restored when cancelling editing
|
||||
#endif
|
||||
if (edit_cell == tree_view->name_cell)
|
||||
{
|
||||
const gchar *real_name;
|
||||
if (edit_cell == tree_view->name_cell)
|
||||
{
|
||||
const gchar *real_name;
|
||||
|
||||
real_name =
|
||||
gimp_object_get_name (GIMP_OBJECT (renderer->viewable));
|
||||
real_name =
|
||||
gimp_object_get_name (GIMP_OBJECT (renderer->viewable));
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model),
|
||||
&iter,
|
||||
tree_view->model_column_name,
|
||||
real_name,
|
||||
-1);
|
||||
gtk_list_store_set (GTK_LIST_STORE (tree_view->model),
|
||||
&iter,
|
||||
tree_view->model_column_name,
|
||||
real_name,
|
||||
-1);
|
||||
}
|
||||
|
||||
gtk_tree_view_set_cursor_on_cell (tree_view->view, path,
|
||||
column, edit_cell, TRUE);
|
||||
}
|
||||
else if (! toggled_cell) /* ignore double click on toggles */
|
||||
{
|
||||
gimp_container_view_item_activated (container_view,
|
||||
renderer->viewable);
|
||||
}
|
||||
|
||||
gtk_tree_view_set_cursor_on_cell (tree_view->view, path,
|
||||
column, edit_cell, TRUE);
|
||||
}
|
||||
else if (! toggled_cell) /* ignore double click on toggles */
|
||||
{
|
||||
gimp_container_view_item_activated (container_view,
|
||||
renderer->viewable);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -838,12 +852,13 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable);
|
||||
|
||||
if (container_view->container)
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (tree_view),
|
||||
renderer->viewable);
|
||||
if (gimp_container_view_item_selected (container_view,
|
||||
renderer->viewable))
|
||||
{
|
||||
if (container_view->container)
|
||||
gimp_container_view_item_context (GIMP_CONTAINER_VIEW (tree_view),
|
||||
renderer->viewable);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -127,11 +127,11 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
|
||||
view_signals[SELECT_ITEM] =
|
||||
g_signal_new ("select_item",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GimpContainerViewClass, select_item),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__OBJECT_POINTER,
|
||||
G_TYPE_NONE, 2,
|
||||
gimp_marshal_BOOLEAN__OBJECT_POINTER,
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
GIMP_TYPE_OBJECT,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
@ -483,12 +483,14 @@ gimp_container_view_set_size_request (GimpContainerView *view,
|
||||
height > 0 ? height + border_y : -1);
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gimp_container_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (! viewable || GIMP_IS_VIEWABLE (viewable));
|
||||
gboolean success = FALSE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), FALSE);
|
||||
g_return_val_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable), FALSE);
|
||||
|
||||
if (view->hash_table)
|
||||
{
|
||||
@ -497,8 +499,10 @@ gimp_container_view_select_item (GimpContainerView *view,
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[SELECT_ITEM], 0,
|
||||
viewable, insert_data);
|
||||
viewable, insert_data, &success);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
@ -537,16 +541,18 @@ gimp_container_view_context_item (GimpContainerView *view,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gimp_container_view_item_selected (GimpContainerView *view,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
||||
gboolean success;
|
||||
|
||||
gimp_container_view_select_item (view, viewable);
|
||||
g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (view), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), FALSE);
|
||||
|
||||
if (view->container && view->context)
|
||||
success = gimp_container_view_select_item (view, viewable);
|
||||
|
||||
if (success && view->container && view->context)
|
||||
{
|
||||
GimpContext *context;
|
||||
|
||||
@ -569,6 +575,8 @@ gimp_container_view_item_selected (GimpContainerView *view,
|
||||
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
@ -686,10 +694,16 @@ gimp_container_view_context_changed (GimpContext *context,
|
||||
GimpContainerView *view)
|
||||
{
|
||||
gpointer insert_data;
|
||||
gboolean success = FALSE;
|
||||
|
||||
insert_data = g_hash_table_lookup (view->hash_table, viewable);
|
||||
|
||||
g_signal_emit (view, view_signals[SELECT_ITEM], 0, viewable, insert_data);
|
||||
g_signal_emit (view, view_signals[SELECT_ITEM], 0,
|
||||
viewable, insert_data, &success);
|
||||
|
||||
if (! success)
|
||||
g_warning ("gimp_container_view_context_changed(): select_item() failed "
|
||||
"(should not happen)");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -60,7 +60,7 @@ struct _GimpContainerViewClass
|
||||
GimpEditorClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* select_item) (GimpContainerView *view,
|
||||
gboolean (* select_item) (GimpContainerView *view,
|
||||
GimpViewable *object,
|
||||
gpointer insert_data);
|
||||
void (* activate_item) (GimpContainerView *view,
|
||||
@ -115,7 +115,7 @@ void gimp_container_view_set_size_request (GimpContainerView *view,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void gimp_container_view_select_item (GimpContainerView *view,
|
||||
gboolean gimp_container_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *viewable);
|
||||
void gimp_container_view_activate_item (GimpContainerView *view,
|
||||
GimpViewable *viewable);
|
||||
@ -125,7 +125,7 @@ void gimp_container_view_context_item (GimpContainerView *view,
|
||||
|
||||
/* protected */
|
||||
|
||||
void gimp_container_view_item_selected (GimpContainerView *view,
|
||||
gboolean gimp_container_view_item_selected (GimpContainerView *view,
|
||||
GimpViewable *item);
|
||||
void gimp_container_view_item_activated (GimpContainerView *view,
|
||||
GimpViewable *item);
|
||||
|
@ -62,16 +62,13 @@ static void gimp_drawable_tree_view_set_container (GimpContainerView *view,
|
||||
static gpointer gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static gboolean gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
||||
static void gimp_drawable_tree_view_set_image (GimpItemTreeView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static gboolean gimp_drawable_tree_view_select (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gboolean path_currently_selected,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_drawable_tree_view_floating_selection_changed
|
||||
(GimpImage *gimage,
|
||||
GimpDrawableTreeView *view);
|
||||
@ -142,6 +139,7 @@ gimp_drawable_tree_view_class_init (GimpDrawableTreeViewClass *klass)
|
||||
|
||||
container_view_class->set_container = gimp_drawable_tree_view_set_container;
|
||||
container_view_class->insert_item = gimp_drawable_tree_view_insert_item;
|
||||
container_view_class->select_item = gimp_drawable_tree_view_select_item;
|
||||
|
||||
item_view_class->set_image = gimp_drawable_tree_view_set_image;
|
||||
}
|
||||
@ -199,10 +197,6 @@ gimp_drawable_tree_view_constructor (GType type,
|
||||
G_CALLBACK (gimp_drawable_tree_view_eye_clicked),
|
||||
drawable_view);
|
||||
|
||||
gtk_tree_selection_set_select_function (tree_view->selection,
|
||||
gimp_drawable_tree_view_select,
|
||||
drawable_view, NULL);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -253,6 +247,33 @@ gimp_drawable_tree_view_insert_item (GimpContainerView *view,
|
||||
return iter;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpItemTreeView *item_view;
|
||||
gboolean success = TRUE;
|
||||
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
if (item_view->gimage)
|
||||
{
|
||||
GimpViewable *floating_sel;
|
||||
|
||||
floating_sel = (GimpViewable *)
|
||||
gimp_image_floating_sel (item_view->gimage);
|
||||
|
||||
success = (item == NULL || floating_sel == NULL || item == floating_sel);
|
||||
}
|
||||
|
||||
if (success)
|
||||
return GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/* GimpItemTreeView methods */
|
||||
|
||||
@ -282,88 +303,23 @@ gimp_drawable_tree_view_set_image (GimpItemTreeView *item_view,
|
||||
"floating_selection_changed",
|
||||
G_CALLBACK (gimp_drawable_tree_view_floating_selection_changed),
|
||||
view);
|
||||
|
||||
if (gimp_image_floating_sel (item_view->gimage))
|
||||
gimp_drawable_tree_view_floating_selection_changed (item_view->gimage,
|
||||
view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* callbacks */
|
||||
|
||||
static gboolean
|
||||
gimp_drawable_tree_view_select (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gboolean path_currently_selected,
|
||||
gpointer data)
|
||||
{
|
||||
GimpItemTreeView *item_view;
|
||||
GtkTreeIter iter;
|
||||
gboolean retval = TRUE;
|
||||
|
||||
item_view = GIMP_ITEM_TREE_VIEW (data);
|
||||
|
||||
if (gimp_image_floating_sel (item_view->gimage) &&
|
||||
gtk_tree_model_get_iter (model, &iter, path))
|
||||
{
|
||||
GimpContainerTreeView *tree_view;
|
||||
GimpPreviewRenderer *renderer;
|
||||
|
||||
tree_view = GIMP_CONTAINER_TREE_VIEW (item_view);
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
tree_view->model_column_renderer, &renderer,
|
||||
-1);
|
||||
|
||||
if (((GimpLayer *) renderer->viewable ==
|
||||
gimp_image_floating_sel (item_view->gimage)))
|
||||
{
|
||||
if (path_currently_selected)
|
||||
retval = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! path_currently_selected)
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
g_object_unref (renderer);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_tree_view_floating_selection_changed (GimpImage *gimage,
|
||||
GimpDrawableTreeView *view)
|
||||
{
|
||||
#if 0
|
||||
GimpViewable *floating_sel;
|
||||
GList *list;
|
||||
GList *free_list;
|
||||
GimpItem *item;
|
||||
|
||||
floating_sel = (GimpViewable *) gimp_image_floating_sel (gimage);
|
||||
|
||||
list = free_list = gtk_container_get_children
|
||||
(GTK_CONTAINER (GIMP_CONTAINER_TREE_VIEW (view)->gtk_tree));
|
||||
|
||||
for (; list; list = g_list_next (list))
|
||||
{
|
||||
if (! (GIMP_PREVIEW (GIMP_TREE_ITEM (list->data)->preview)->viewable ==
|
||||
floating_sel))
|
||||
{
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (list->data),
|
||||
floating_sel == NULL);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (free_list);
|
||||
item = GIMP_ITEM_TREE_VIEW_GET_CLASS (view)->get_active_item (gimage);
|
||||
|
||||
/* update button states */
|
||||
/* gimp_drawable_tree_view_drawable_changed (gimage, view); */
|
||||
#endif
|
||||
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (view),
|
||||
(GimpViewable *) item);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -74,7 +74,7 @@ static void gimp_item_tree_view_set_container (GimpContainerView *view,
|
||||
static gpointer gimp_item_tree_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_item_tree_view_activate_item (GimpContainerView *view,
|
||||
@ -582,7 +582,7 @@ gimp_item_tree_view_insert_item (GimpContainerView *view,
|
||||
return iter;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
@ -593,11 +593,12 @@ gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
gboolean duplicate_sensitive = FALSE;
|
||||
gboolean edit_sensitive = FALSE;
|
||||
gboolean delete_sensitive = FALSE;
|
||||
gboolean success;
|
||||
|
||||
tree_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
success = GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
if (item)
|
||||
{
|
||||
@ -639,6 +640,8 @@ gimp_item_tree_view_select_item (GimpContainerView *view,
|
||||
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);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -61,7 +61,7 @@ static void gimp_layer_tree_view_set_container (GimpContainerView *view,
|
||||
static gpointer gimp_layer_tree_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_layer_tree_view_set_preview_size (GimpContainerView *view);
|
||||
@ -434,7 +434,7 @@ gimp_layer_tree_view_insert_item (GimpContainerView *view,
|
||||
return iter;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
@ -444,22 +444,26 @@ gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
gboolean options_sensitive = FALSE;
|
||||
gboolean anchor_sensitive = FALSE;
|
||||
gboolean raise_sensitive = FALSE;
|
||||
gboolean success;
|
||||
|
||||
item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
layer_view = GIMP_LAYER_TREE_VIEW (view);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
success = GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
if (item)
|
||||
{
|
||||
gimp_layer_tree_view_update_borders (layer_view,
|
||||
(GtkTreeIter *) insert_data);
|
||||
gimp_layer_tree_view_update_options (layer_view, GIMP_LAYER (item));
|
||||
if (success)
|
||||
{
|
||||
gimp_layer_tree_view_update_borders (layer_view,
|
||||
(GtkTreeIter *) insert_data);
|
||||
gimp_layer_tree_view_update_options (layer_view, GIMP_LAYER (item));
|
||||
}
|
||||
|
||||
options_sensitive = TRUE;
|
||||
|
||||
if (gimp_layer_is_floating_sel (GIMP_LAYER (item)))
|
||||
if (! success || gimp_layer_is_floating_sel (GIMP_LAYER (item)))
|
||||
{
|
||||
anchor_sensitive = TRUE;
|
||||
|
||||
@ -481,6 +485,8 @@ gimp_layer_tree_view_select_item (GimpContainerView *view,
|
||||
gtk_widget_set_sensitive (layer_view->options_box, options_sensitive);
|
||||
gtk_widget_set_sensitive (item_view->raise_button, raise_sensitive);
|
||||
gtk_widget_set_sensitive (layer_view->anchor_button, anchor_sensitive);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -45,7 +45,7 @@
|
||||
static void gimp_vectors_tree_view_class_init (GimpVectorsTreeViewClass *klass);
|
||||
static void gimp_vectors_tree_view_init (GimpVectorsTreeView *view);
|
||||
|
||||
static void gimp_vectors_tree_view_select_item (GimpContainerView *view,
|
||||
static gboolean gimp_vectors_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
static void gimp_vectors_tree_view_toselection_clicked
|
||||
@ -199,20 +199,23 @@ gimp_vectors_tree_view_init (GimpVectorsTreeView *view)
|
||||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gimp_vectors_tree_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data)
|
||||
{
|
||||
GimpVectorsTreeView *tree_view;
|
||||
gboolean success;
|
||||
|
||||
tree_view = GIMP_VECTORS_TREE_VIEW (view);
|
||||
|
||||
GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
success = GIMP_CONTAINER_VIEW_CLASS (parent_class)->select_item (view, item,
|
||||
insert_data);
|
||||
|
||||
gtk_widget_set_sensitive (tree_view->toselection_button, item != NULL);
|
||||
gtk_widget_set_sensitive (tree_view->stroke_button, item != NULL);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user