Commit 1a5a50d9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

some percentage updates.

2001-05-13  Michael Natterer  <mitch@gimp.org>

	* TODO.xml: some percentage updates.

	* autogen.sh: correctly parse latest autoconf's broken "--version"
	string.

	* app/widgets/Makefile.am
	* app/widgets/gimpcontainerview-utils.[ch]: new files which
	provide a set of built-in get_name_func()s for GimpContainerView
	and GimpContainerMenu.

	* app/widgets/gimpcontainermenu.c
	* app/widgets/gimpcontainerview.c: use them.

	* app/widgets/gimpimagedock.c
	* app/gui/dialogs-constructors.c: removed the get_name_func()s here.
parent 637c714a
2001-05-13 Michael Natterer <mitch@gimp.org>
* TODO.xml: some percentage updates.
* autogen.sh: correctly parse latest autoconf's broken "--version"
string.
* app/widgets/Makefile.am
* app/widgets/gimpcontainerview-utils.[ch]: new files which
provide a set of built-in get_name_func()s for GimpContainerView
and GimpContainerMenu.
* app/widgets/gimpcontainermenu.c
* app/widgets/gimpcontainerview.c: use them.
* app/widgets/gimpimagedock.c
* app/gui/dialogs-constructors.c: removed the get_name_func()s here.
2001-05-13 Michael Natterer <mitch@gimp.org>
* app/apptypes.h: removed some forgotten tools types.
......
......@@ -44,7 +44,7 @@
</contact>
</entry>
<entry size="big" difficulty="medium" status="20%" target="1.4">
<entry size="big" difficulty="medium" status="30%" target="1.4">
<title>Code reorganization</title>
<description>
<p>
......@@ -106,7 +106,7 @@
</contact>
</entry>
<entry size="medium" difficulty="medium" status="30%" target="1.4">
<entry size="medium" difficulty="medium" status="40%" target="1.4">
<title>Cleanup existing internal objects</title>
<description>
<p>
......
......@@ -33,8 +33,6 @@
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppalette.h"
#include "core/gimppattern.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcontainerlistview.h"
......@@ -78,8 +76,6 @@
#include "module_db.h"
#include "undo_history.h"
#include "temp_buf.h"
#ifdef DISPLAY_FILTERS
#include "gdisplay_color_ui.h"
#endif /* DISPLAY_FILTERS */
......@@ -128,12 +124,6 @@ static void dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *view);
static gchar * dialogs_tool_name_func (GtkWidget *widget);
static gchar * dialogs_image_name_func (GtkWidget *widget);
static gchar * dialogs_brush_name_func (GtkWidget *widget);
static gchar * dialogs_pattern_name_func (GtkWidget *widget);
static gchar * dialogs_palette_name_func (GtkWidget *widget);
/* public functions */
......@@ -308,16 +298,11 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (NULL,
view = gimp_container_list_view_new (image_context,
context,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_image_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
image_context);
return dialogs_dockable_new (view,
"Image List", "Images",
NULL,
......@@ -406,16 +391,11 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (NULL,
view = gimp_container_list_view_new (global_tool_info_list,
context,
22,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_tool_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
global_tool_info_list);
return dialogs_dockable_new (view,
"Tool List", "Tools",
dialogs_tool_tab_func,
......@@ -431,16 +411,11 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (NULL,
view = gimp_container_grid_view_new (image_context,
context,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_image_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
image_context);
return dialogs_dockable_new (view,
"Image Grid", "Images",
NULL,
......@@ -460,9 +435,6 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_brush_name_func);
return dialogs_dockable_new (view,
"Brush Grid", "Brushes",
dialogs_brush_tab_func,
......@@ -482,9 +454,6 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_pattern_name_func);
return dialogs_dockable_new (view,
"Pattern Grid", "Patterns",
dialogs_pattern_tab_func,
......@@ -523,9 +492,6 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_palette_name_func);
return dialogs_dockable_new (view,
"Palette Grid", "Palettes",
dialogs_palette_tab_func,
......@@ -538,16 +504,11 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (NULL,
view = gimp_container_grid_view_new (global_tool_info_list,
context,
22,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_tool_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
global_tool_info_list);
return dialogs_dockable_new (view,
"Tool Grid", "Tools",
dialogs_tool_tab_func,
......@@ -998,133 +959,3 @@ dialogs_path_view_image_changed (GimpContext *context,
{
paths_dialog_update (gimage);
}
/* get_name_funcs */
static GimpPreview *
dialogs_get_name_func_preview (GtkWidget *widget)
{
if (GIMP_IS_PREVIEW (widget))
{
return GIMP_PREVIEW (widget);
}
else if (GIMP_IS_LIST_ITEM (widget))
{
return GIMP_PREVIEW (GIMP_LIST_ITEM (widget)->preview);
}
g_warning ("dialogs_get_name_func_preview(): widget type does not match");
return NULL;
}
static gchar *
dialogs_tool_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpToolInfo *tool_info;
tool_info = GIMP_TOOL_INFO (preview->viewable);
if (tool_info)
return g_strdup (tool_info->blurb);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_image_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpImage *gimage;
gimage = GIMP_IMAGE (preview->viewable);
if (gimage)
return g_strdup_printf ("%s-%d",
g_basename (gimp_image_filename (gimage)),
gimp_image_get_ID (gimage));
}
return g_strdup ("EEK");
}
static gchar *
dialogs_brush_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpBrush *brush;
brush = GIMP_BRUSH (preview->viewable);
if (brush)
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (brush)->name,
brush->mask->width,
brush->mask->height);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_pattern_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpPattern *pattern;
pattern = GIMP_PATTERN (preview->viewable);
if (pattern)
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (pattern)->name,
pattern->mask->width,
pattern->mask->height);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_palette_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpPalette *palette;
palette = GIMP_PALETTE (preview->viewable);
if (palette)
return g_strdup_printf ("%s (%d)",
GIMP_OBJECT (palette)->name,
palette->n_colors);
}
return g_strdup ("EEK");
}
......@@ -33,8 +33,6 @@
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppalette.h"
#include "core/gimppattern.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcontainerlistview.h"
......@@ -78,8 +76,6 @@
#include "module_db.h"
#include "undo_history.h"
#include "temp_buf.h"
#ifdef DISPLAY_FILTERS
#include "gdisplay_color_ui.h"
#endif /* DISPLAY_FILTERS */
......@@ -128,12 +124,6 @@ static void dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *view);
static gchar * dialogs_tool_name_func (GtkWidget *widget);
static gchar * dialogs_image_name_func (GtkWidget *widget);
static gchar * dialogs_brush_name_func (GtkWidget *widget);
static gchar * dialogs_pattern_name_func (GtkWidget *widget);
static gchar * dialogs_palette_name_func (GtkWidget *widget);
/* public functions */
......@@ -308,16 +298,11 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (NULL,
view = gimp_container_list_view_new (image_context,
context,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_image_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
image_context);
return dialogs_dockable_new (view,
"Image List", "Images",
NULL,
......@@ -406,16 +391,11 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (NULL,
view = gimp_container_list_view_new (global_tool_info_list,
context,
22,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_tool_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
global_tool_info_list);
return dialogs_dockable_new (view,
"Tool List", "Tools",
dialogs_tool_tab_func,
......@@ -431,16 +411,11 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (NULL,
view = gimp_container_grid_view_new (image_context,
context,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_image_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
image_context);
return dialogs_dockable_new (view,
"Image Grid", "Images",
NULL,
......@@ -460,9 +435,6 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_brush_name_func);
return dialogs_dockable_new (view,
"Brush Grid", "Brushes",
dialogs_brush_tab_func,
......@@ -482,9 +454,6 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_pattern_name_func);
return dialogs_dockable_new (view,
"Pattern Grid", "Patterns",
dialogs_pattern_tab_func,
......@@ -523,9 +492,6 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
32,
5, 3);
gimp_container_view_set_name_func (GIMP_DATA_FACTORY_VIEW (view)->view,
dialogs_palette_name_func);
return dialogs_dockable_new (view,
"Palette Grid", "Palettes",
dialogs_palette_tab_func,
......@@ -538,16 +504,11 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_grid_view_new (NULL,
view = gimp_container_grid_view_new (global_tool_info_list,
context,
22,
5, 3);
gimp_container_view_set_name_func (GIMP_CONTAINER_VIEW (view),
dialogs_tool_name_func);
gimp_container_view_set_container (GIMP_CONTAINER_VIEW (view),
global_tool_info_list);
return dialogs_dockable_new (view,
"Tool Grid", "Tools",
dialogs_tool_tab_func,
......@@ -998,133 +959,3 @@ dialogs_path_view_image_changed (GimpContext *context,
{
paths_dialog_update (gimage);
}
/* get_name_funcs */
static GimpPreview *
dialogs_get_name_func_preview (GtkWidget *widget)
{
if (GIMP_IS_PREVIEW (widget))
{
return GIMP_PREVIEW (widget);
}
else if (GIMP_IS_LIST_ITEM (widget))
{
return GIMP_PREVIEW (GIMP_LIST_ITEM (widget)->preview);
}
g_warning ("dialogs_get_name_func_preview(): widget type does not match");
return NULL;
}
static gchar *
dialogs_tool_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpToolInfo *tool_info;
tool_info = GIMP_TOOL_INFO (preview->viewable);
if (tool_info)
return g_strdup (tool_info->blurb);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_image_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpImage *gimage;
gimage = GIMP_IMAGE (preview->viewable);
if (gimage)
return g_strdup_printf ("%s-%d",
g_basename (gimp_image_filename (gimage)),
gimp_image_get_ID (gimage));
}
return g_strdup ("EEK");
}
static gchar *
dialogs_brush_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpBrush *brush;
brush = GIMP_BRUSH (preview->viewable);
if (brush)
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (brush)->name,
brush->mask->width,
brush->mask->height);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_pattern_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpPattern *pattern;
pattern = GIMP_PATTERN (preview->viewable);
if (pattern)
return g_strdup_printf ("%s (%d x %d)",
GIMP_OBJECT (pattern)->name,
pattern->mask->width,
pattern->mask->height);
}
return g_strdup ("EEK");
}
static gchar *
dialogs_palette_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = dialogs_get_name_func_preview (widget);
if (preview)
{
GimpPalette *palette;
palette = GIMP_PALETTE (preview->viewable);
if (palette)
return g_strdup_printf ("%s (%d)",
GIMP_OBJECT (palette)->name,
palette->n_colors);
}
return g_strdup ("EEK");
}
......@@ -23,6 +23,8 @@ libappwidgets_la_SOURCES = \
gimpcontainermenuimpl.h \
gimpcontainerview.c \
gimpcontainerview.h \
gimpcontainerview-utils.c \
gimpcontainerview-utils.h \
gimpdatafactoryview.c \
gimpdatafactoryview.h \
gimpdialogfactory.c \
......
......@@ -31,6 +31,7 @@
#include "core/gimpviewable.h"
#include "gimpcontainermenu.h"
#include "gimpcontainerview-utils.h"
enum
......@@ -300,12 +301,27 @@ gimp_container_menu_real_set_container (GimpContainerMenu *menu,
gimp_container_menu_context_changed,
menu);
}
if (menu->get_name_func &&
gimp_container_view_is_built_in_name_func (menu->get_name_func))
{
gimp_container_menu_set_name_func (menu, NULL);
}
}
menu->container = container;
if (menu->container)
{
if (! menu->get_name_func)
{
GimpItemGetNameFunc get_name_func;
get_name_func = gimp_container_view_get_built_in_name_func (menu->container->children_type);
gimp_container_menu_set_name_func (menu, get_name_func);
}
gimp_container_foreach (menu->container,
(GFunc) gimp_container_menu_add_foreach,
menu);
......
/* 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 "widgets/widgets-types.h"
#include "core/gimpbrush.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
#include "core/gimppattern.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimpmenuitem.h"
#include "widgets/gimppreview.h"
#include "temp_buf.h"
static gchar * gimp_container_view_tool_name_func (GtkWidget *widget);
static gchar * gimp_container_view_image_name_func (GtkWidget *widget);
static gchar * gimp_container_view_brush_name_func (GtkWidget *widget);
static gchar * gimp_container_view_pattern_name_func (GtkWidget *widget);
static gchar * gimp_container_view_palette_name_func (GtkWidget *widget);
/* public functions */
GimpItemGetNameFunc
gimp_container_view_get_built_in_name_func (GtkType type)
{
if (type == GIMP_TYPE_TOOL_INFO)
{
return gimp_container_view_tool_name_func;
}
else if (type == GIMP_TYPE_IMAGE)
{
return gimp_container_view_image_name_func;
}
else if (type == GIMP_TYPE_BRUSH)
{
return gimp_container_view_brush_name_func;
}
else if (type == GIMP_TYPE_PATTERN)
{
return gimp_container_view_pattern_name_func;
}
else if (type == GIMP_TYPE_PALETTE)
{
return gimp_container_view_palette_name_func;
}
return NULL;
}
gboolean
gimp_container_view_is_built_in_name_func (GimpItemGetNameFunc get_name_func)
{
if (get_name_func == gimp_container_view_tool_name_func ||
get_name_func == gimp_container_view_image_name_func ||
get_name_func == gimp_container_view_brush_name_func ||
get_name_func == gimp_container_view_pattern_name_func ||
get_name_func == gimp_container_view_palette_name_func)
{
return TRUE;
}
return FALSE;
}
/* private functions */
static GimpPreview *
gimp_container_view_get_name_func_preview (GtkWidget *widget)
{
if (GIMP_IS_PREVIEW (widget))
{
return GIMP_PREVIEW (widget);
}
else if (GIMP_IS_LIST_ITEM (widget))
{
return GIMP_PREVIEW (GIMP_LIST_ITEM (widget)->preview);
}
else if (GIMP_IS_MENU_ITEM (widget))
{
return GIMP_PREVIEW (GIMP_MENU_ITEM (widget)->preview);
}
g_warning ("gimp_container_view_get_name_func_preview(): "
"widget type does not match");
return NULL;
}
static gchar *
gimp_container_view_tool_name_func (GtkWidget *widget)
{
GimpPreview *preview;
preview = gimp_container_view_get_name_func_preview (widget);
if (preview)
{
GimpToolInfo *tool_info;
tool_info = GIMP_TOOL_INFO (preview->viewable);
if (tool_info)
return g_strdup (tool_info->blurb);
}
return g_strdup ("EEK");
}
static gchar *
gimp_container_view_image_name_func (GtkWidget *widget)
{
GimpPreview *preview;