2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-05-13 20:16:55 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "widgets-types.h"
|
2001-05-13 20:16:55 +08:00
|
|
|
|
2007-05-27 23:13:45 +08:00
|
|
|
#include "core/gimp-utils.h"
|
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
|
2001-11-24 00:25:01 +08:00
|
|
|
#include "gimpcontainereditor.h"
|
2001-07-05 03:31:35 +08:00
|
|
|
#include "gimpcontainerview.h"
|
|
|
|
#include "gimpcontainerview-utils.h"
|
2001-11-24 00:25:01 +08:00
|
|
|
#include "gimpdockable.h"
|
2001-05-13 20:16:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
2001-11-24 00:25:01 +08:00
|
|
|
GimpContainerView *
|
|
|
|
gimp_container_view_get_by_dockable (GimpDockable *dockable)
|
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
GtkWidget *child;
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2003-04-12 00:51:49 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), NULL);
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (dockable));
|
2001-11-24 00:25:01 +08:00
|
|
|
|
2008-03-13 00:58:28 +08:00
|
|
|
if (child)
|
2003-04-12 00:51:49 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
if (GIMP_IS_CONTAINER_EDITOR (child))
|
2001-11-24 00:25:01 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
return GIMP_CONTAINER_EDITOR (child)->view;
|
2001-11-24 00:25:01 +08:00
|
|
|
}
|
2008-03-13 00:58:28 +08:00
|
|
|
else if (GIMP_IS_CONTAINER_VIEW (child))
|
2001-11-24 00:25:01 +08:00
|
|
|
{
|
2008-03-13 00:58:28 +08:00
|
|
|
return GIMP_CONTAINER_VIEW (child);
|
2001-11-24 00:25:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2007-05-27 23:13:45 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
gimp_container_view_remove_active (GimpContainerView *view)
|
|
|
|
{
|
|
|
|
GimpContext *context;
|
|
|
|
GimpContainer *container;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER_VIEW (view));
|
|
|
|
|
|
|
|
context = gimp_container_view_get_context (view);
|
|
|
|
container = gimp_container_view_get_container (view);
|
|
|
|
|
|
|
|
if (context && container)
|
|
|
|
{
|
|
|
|
GimpObject *active;
|
|
|
|
|
|
|
|
active = gimp_context_get_by_type (context, container->children_type);
|
|
|
|
|
|
|
|
if (active)
|
|
|
|
{
|
|
|
|
GimpObject *new;
|
|
|
|
|
|
|
|
new = gimp_container_get_neighbor_of_active (container, context,
|
|
|
|
active);
|
|
|
|
|
|
|
|
if (new)
|
|
|
|
gimp_context_set_by_type (context, container->children_type,
|
|
|
|
new);
|
|
|
|
|
|
|
|
gimp_container_remove (container, active);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|