using gimp_container_view_get_by_dockable() was a bad idea since not all

2003-09-24  Michael Natterer  <mitch@gimp.org>

	* app/gui/dialogs-constructors.c (dialogs_get_view_menu_func):
	using gimp_container_view_get_by_dockable() was a bad idea since
	not all our GimpEditor subclasses actually are GimpContainerViews.
	Find the right GimpEditor manually instead (fixes missing popup
	menus).

	* app/gui/colormap-editor-menu.c (colormap_editor_menu_update):
	make the menu entries insensitive if the image is not indexed.
	fixes bug #123066.
This commit is contained in:
Michael Natterer 2003-09-24 15:11:29 +00:00 committed by Michael Natterer
parent 968d257bf7
commit 55f938fa01
4 changed files with 38 additions and 8 deletions

View File

@ -1,3 +1,15 @@
2003-09-24 Michael Natterer <mitch@gimp.org>
* app/gui/dialogs-constructors.c (dialogs_get_view_menu_func):
using gimp_container_view_get_by_dockable() was a bad idea since
not all our GimpEditor subclasses actually are GimpContainerViews.
Find the right GimpEditor manually instead (fixes missing popup
menus).
* app/gui/colormap-editor-menu.c (colormap_editor_menu_update):
make the menu entries insensitive if the image is not indexed.
fixes bug #123066.
2003-09-24 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpwidgets-utils.c (gimp_menu_position)

View File

@ -1328,12 +1328,20 @@ static GimpItemFactory *
dialogs_get_view_menu_func (GimpDockable *dockable,
gpointer *item_factory_data)
{
GimpContainerView *view = gimp_container_view_get_by_dockable (dockable);
GtkWidget *widget = GTK_BIN (dockable)->child;
GimpEditor *editor = NULL;
if (view)
if (GIMP_IS_EDITOR (widget))
{
GimpEditor *editor = GIMP_EDITOR (view);
editor = GIMP_EDITOR (widget);
}
else if (GIMP_IS_CONTAINER_EDITOR (widget))
{
editor = GIMP_EDITOR (GIMP_CONTAINER_EDITOR (widget)->view);
}
if (editor)
{
if (item_factory_data)
*item_factory_data = editor->item_factory_data;

View File

@ -59,6 +59,7 @@ colormap_editor_menu_update (GtkItemFactory *factory,
{
GimpColormapEditor *editor;
GimpImage *gimage;
gboolean indexed = FALSE;
gint num_colors = 0;
editor = GIMP_COLORMAP_EDITOR (data);
@ -66,14 +67,15 @@ colormap_editor_menu_update (GtkItemFactory *factory,
if (gimage)
{
indexed = gimp_image_base_type (gimage) == GIMP_INDEXED;
num_colors = gimage->num_cols;
}
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Edit Color...", gimage);
SET_SENSITIVE ("/Add Color", gimage && num_colors < 256);
SET_SENSITIVE ("/Edit Color...", gimage && indexed);
SET_SENSITIVE ("/Add Color", gimage && indexed && num_colors < 256);
#undef SET_SENSITIVE
}

View File

@ -1328,12 +1328,20 @@ static GimpItemFactory *
dialogs_get_view_menu_func (GimpDockable *dockable,
gpointer *item_factory_data)
{
GimpContainerView *view = gimp_container_view_get_by_dockable (dockable);
GtkWidget *widget = GTK_BIN (dockable)->child;
GimpEditor *editor = NULL;
if (view)
if (GIMP_IS_EDITOR (widget))
{
GimpEditor *editor = GIMP_EDITOR (view);
editor = GIMP_EDITOR (widget);
}
else if (GIMP_IS_CONTAINER_EDITOR (widget))
{
editor = GIMP_EDITOR (GIMP_CONTAINER_EDITOR (widget)->view);
}
if (editor)
{
if (item_factory_data)
*item_factory_data = editor->item_factory_data;