Commit ff722d0c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed unused commented out prototype.

2002-05-08  Michael Natterer  <mitch@gimp.org>

	* app/core/gimp.h: removed unused commented out prototype.

	* app/core/gimpimage.c (gimp_image_set_tattoo_state): fixed it
	again after I have b0rked it when using vectors instead of paths.

	* app/display/gimpdisplay.c: some comments and one more
	g_return_val_if_fail().

	* app/widgets/gimpimagedock.c: more fixes for the subtle
	active_image <-> active_display difference.

	* tools/pdbgen/pdb/display.pdb (gimp_display_delete): call
	gimp_display_delete() instead of just destroying it's shell (eek).

	* app/pdb/display_cmds.c: regenerated.

	Added a special view type for the image list so we can implement
	stuff like deleting images which are left over from crashed
	plug-ins:

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpimageview.[ch]: new widget: a view on the image
	container.

	* app/gui/Makefile.am
	* app/gui/images-commands.[ch]: new callbacks for it's context menu.

	* app/gui/dialogs-constructors.c: use the new widget instead of
	plain GimpContainerViews.

	* app/gui/menus.c: added an item_factory for it.
parent e1b20e1c
2002-05-08 Michael Natterer <mitch@gimp.org>
* app/core/gimp.h: removed unused commented out prototype.
* app/core/gimpimage.c (gimp_image_set_tattoo_state): fixed it
again after I have b0rked it when using vectors instead of paths.
* app/display/gimpdisplay.c: some comments and one more
g_return_val_if_fail().
* app/widgets/gimpimagedock.c: more fixes for the subtle
active_image <-> active_display difference.
* tools/pdbgen/pdb/display.pdb (gimp_display_delete): call
gimp_display_delete() instead of just destroying it's shell (eek).
* app/pdb/display_cmds.c: regenerated.
Added a special view type for the image list so we can implement
stuff like deleting images which are left over from crashed
plug-ins:
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpimageview.[ch]: new widget: a view on the image
container.
* app/gui/Makefile.am
* app/gui/images-commands.[ch]: new callbacks for it's context menu.
* app/gui/dialogs-constructors.c: use the new widget instead of
plain GimpContainerViews.
* app/gui/menus.c: added an item_factory for it.
2002-05-08 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpwidgets.c (gimp_scale_entry_new)
......
/* The GIMP -- an image manipulation program
* 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>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "images-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
void
images_raise_displays_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->raise_button));
}
void
images_new_display_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
images_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImage *image;
editor = GIMP_CONTAINER_EDITOR (data);
image = gimp_context_get_image (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Raise Displays", image);
SET_SENSITIVE ("/New Display", image);
SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0);
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* 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.
*/
#ifndef __IMAGES_COMMANDS_H__
#define __IMAGES_COMMANDS_H__
void images_raise_displays_cmd_callback (GtkWidget *widget,
gpointer data);
void images_new_display_cmd_callback (GtkWidget *widget,
gpointer data);
void images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data);
void images_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGES_COMMANDS_H__ */
......@@ -166,12 +166,6 @@ GimpObject * gimp_create_display (Gimp *gimp,
GimpImage *gimage,
guint scale);
/*
void gimp_open_file (Gimp *gimp,
const gchar *filename,
gboolean with_display);
*/
GimpContext * gimp_get_standard_context (Gimp *gimp);
void gimp_set_default_context (Gimp *gimp,
......
......@@ -2165,49 +2165,44 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
for (list = GIMP_LIST (gimage->layers)->list;
list;
/* Check that the layer tatoos don't overlap with channel or vector ones */
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
GimpTattoo ltattoo;
ltattoo = gimp_item_get_tattoo (GIMP_ITEM (list->data));
if (ltattoo > maxval)
maxval = ltattoo;
if (gimp_image_get_channel_by_tattoo (gimage, ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in channel */
}
if (gimp_image_get_channel_by_tattoo (gimage, ltattoo))
retval = FALSE; /* Oopps duplicated tattoo in channel */
if (gimp_image_get_vectors_by_tattoo (gimage, ltattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
if (gimp_image_get_vectors_by_tattoo (gimage, ltattoo))
retval = FALSE; /* Oopps duplicated tattoo in vectors */
}
/* Now check that the paths channel tattoos don't overlap */
for (list = GIMP_LIST (gimage->channels)->list;
list;
/* Now check that the channel and vectors tattoos don't overlap */
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
GimpTattoo ctattoo;
channel = (GimpChannel *) list->data;
ctattoo = gimp_item_get_tattoo (GIMP_ITEM (channel));
if (ctattoo > maxval)
maxval = ctattoo;
if (gimp_image_get_vectors_by_tattoo (gimage, ctattoo) != NULL)
{
retval = FALSE; /* Oopps duplicated tattoo in layer */
}
if (gimp_image_get_vectors_by_tattoo (gimage, ctattoo))
retval = FALSE; /* Oopps duplicated tattoo in vectors */
}
/* Find the max tatto value in the vectors */
for (list = GIMP_LIST (gimage->channels)->list;
list;
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
GimpTattoo vtattoo;
......@@ -2219,7 +2214,8 @@ gimp_image_set_tattoo_state (GimpImage *gimage,
if (val < maxval)
retval = FALSE;
/* Must check the state is valid */
/* Must check if the state is valid */
if (retval == TRUE)
gimage->tattoo_state = val;
......
......@@ -155,16 +155,15 @@ gimp_display_new (GimpImage *gimage,
if (gimage->gimp->no_interface)
return NULL;
/*
* Set all GimpDisplay parameters...
*/
gdisp = g_object_new (GIMP_TYPE_DISPLAY, NULL);
/* add the new display to the list so that it isn't lost */
display_list = g_slist_append (display_list, gdisp);
/* refs the image */
gimp_display_connect (gdisp, gimage);
/* FIXME: this needs to go to GimpDisplayShell */
gdisp->scale = scale;
/* create the shell for the image */
......@@ -216,7 +215,7 @@ gimp_display_delete (GimpDisplay *gdisp)
gdisp->shell = NULL;
}
/* free the gimage */
/* unrefs the gimage */
gimp_display_disconnect (gdisp);
g_object_unref (G_OBJECT (gdisp));
......@@ -237,6 +236,8 @@ gimp_display_get_by_ID (Gimp *gimp,
GimpDisplay *gdisp;
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
/* Traverse the list of displays, returning the one that matches the ID
* If no display in the list is a match, return NULL.
*/
......
......@@ -47,6 +47,7 @@
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpdockable.h"
......@@ -323,16 +324,17 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (context->gimp->images,
context,
preview_size,
FALSE,
5, 3);
view = gimp_image_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->images,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Images>"));
return dialogs_dockable_new (view,
_("Image List"), _("Images"),
NULL,
dialogs_set_view_context_func);
dialogs_set_editor_context_func);
}
GtkWidget *
......@@ -469,16 +471,17 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (context->gimp->images,
context,
preview_size,
FALSE,
5, 3);
view = gimp_image_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->images,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Images>"));
return dialogs_dockable_new (view,
_("Image Grid"), _("Images"),
NULL,
dialogs_set_view_context_func);
dialogs_set_editor_context_func);
}
GtkWidget *
......
......@@ -155,16 +155,15 @@ gimp_display_new (GimpImage *gimage,
if (gimage->gimp->no_interface)
return NULL;
/*
* Set all GimpDisplay parameters...
*/
gdisp = g_object_new (GIMP_TYPE_DISPLAY, NULL);
/* add the new display to the list so that it isn't lost */
display_list = g_slist_append (display_list, gdisp);
/* refs the image */
gimp_display_connect (gdisp, gimage);
/* FIXME: this needs to go to GimpDisplayShell */
gdisp->scale = scale;
/* create the shell for the image */
......@@ -216,7 +215,7 @@ gimp_display_delete (GimpDisplay *gdisp)
gdisp->shell = NULL;
}
/* free the gimage */
/* unrefs the gimage */
gimp_display_disconnect (gdisp);
g_object_unref (G_OBJECT (gdisp));
......@@ -237,6 +236,8 @@ gimp_display_get_by_ID (Gimp *gimp,
GimpDisplay *gdisp;
GSList *list;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
/* Traverse the list of displays, returning the one that matches the ID
* If no display in the list is a match, return NULL.
*/
......
......@@ -63,6 +63,8 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
help-commands.h \
image-commands.c \
image-commands.h \
images-commands.c \
images-commands.h \
info-dialog.c \
info-dialog.h \
info-window.c \
......
......@@ -47,6 +47,7 @@
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpitemlistview.h"
#include "widgets/gimpdockable.h"
......@@ -323,16 +324,17 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (context->gimp->images,
context,
preview_size,
FALSE,
5, 3);
view = gimp_image_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->images,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Images>"));
return dialogs_dockable_new (view,
_("Image List"), _("Images"),
NULL,
dialogs_set_view_context_func);
dialogs_set_editor_context_func);
}
GtkWidget *
......@@ -469,16 +471,17 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (context->gimp->images,
context,
preview_size,
FALSE,
5, 3);
view = gimp_image_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->images,
context,
preview_size,
5, 3,
gimp_item_factory_from_path ("<Images>"));
return dialogs_dockable_new (view,
_("Image Grid"), _("Images"),
NULL,
dialogs_set_view_context_func);
dialogs_set_editor_context_func);
}
GtkWidget *
......
/* The GIMP -- an image manipulation program
* 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>
#include "libgimpwidgets/gimpwidgets.h"
#include "gui-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "images-commands.h"
#include "libgimp/gimpintl.h"
/* public functionss */
void
images_raise_displays_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->raise_button));
}
void
images_new_display_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
images_menu_update (GtkItemFactory *factory,
gpointer data)
{
GimpContainerEditor *editor;
GimpImage *image;
editor = GIMP_CONTAINER_EDITOR (data);
image = gimp_context_get_image (editor->view->context);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Raise Displays", image);
SET_SENSITIVE ("/New Display", image);
SET_SENSITIVE ("/Delete Image", image && image->disp_count == 0);
#undef SET_SENSITIVE
}
/* The GIMP -- an image manipulation program
* 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.
*/
#ifndef __IMAGES_COMMANDS_H__
#define __IMAGES_COMMANDS_H__
void images_raise_displays_cmd_callback (GtkWidget *widget,
gpointer data);
void images_new_display_cmd_callback (GtkWidget *widget,
gpointer data);
void images_delete_image_cmd_callback (GtkWidget *widget,
gpointer data);
void images_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __IMAGES_COMMANDS_H__ */
......@@ -52,6 +52,7 @@
#include "gradients-commands.h"
#include "help-commands.h"
#include "image-commands.h"
#include "images-commands.h"
#include "layers-commands.h"
#include "menus.h"
#include "palette-editor-commands.h"
......@@ -1860,6 +1861,25 @@ static GimpItemFactoryEntry colormap_editor_entries[] =
};
/***** <Images> *****/
static GimpItemFactoryEntry images_entries[] =
{
{ { N_("/Raise Displays"), NULL,
images_raise_displays_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GOTO_TOP },
NULL, NULL, NULL },
{ { N_("/New Display"), NULL,
images_new_display_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL, NULL, NULL },
{ { N_("/Delete Image"), NULL,
images_delete_image_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL, NULL, NULL }
};
/***** <Documents> *****/
static GimpItemFactoryEntry documents_entries[] =
......@@ -2084,6 +2104,14 @@ menus_init (Gimp *gimp)
documents_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Images>", "images",
images_menu_update,
G_N_ELEMENTS (images_entries),
images_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<ColormapEditor>", "colormap_editor",
......
......@@ -52,6 +52,7 @@
#include "gradients-commands.h"
#include "help-commands.h"
#include "image-commands.h"
#include "images-commands.h"
#include "layers-commands.h"
#include "menus.h"
#include "palette-editor-commands.h"
......@@ -1860,6 +1861,25 @@ static GimpItemFactoryEntry colormap_editor_entries[] =
};
/***** <Images> *****/
static GimpItemFactoryEntry images_entries[] =
{
{ { N_("/Raise Displays"), NULL,
images_raise_displays_cmd_callback, 0,
"<StockItem>", GTK_STOCK_GOTO_TOP },
NULL, NULL, NULL },
{ { N_("/New Display"), NULL,
images_new_display_cmd_callback, 0,
"<StockItem>", GTK_STOCK_NEW },
NULL, NULL, NULL },
{ { N_("/Delete Image"), NULL,
images_delete_image_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL, NULL, NULL }
};
/***** <Documents> *****/
static GimpItemFactoryEntry documents_entries[] =
......@@ -2084,6 +2104,14 @@ menus_init (Gimp *gimp)
documents_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Images>", "images",
images_menu_update,
G_N_ELEMENTS (images_entries),
images_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<ColormapEditor>", "colormap_editor",
......
......@@ -120,7 +120,7 @@ display_delete_invoker (Gimp *gimp,