app/context_manager.c app/gimpdatafactory.c app/gimpdatalist.[ch]

2001-02-19  Michael Natterer  <mitch@gimp.org>

	* app/context_manager.c
	* app/gimpdatafactory.c
	* app/gimpdatalist.[ch]
	* app/gimplist.[ch]
	* app/module_db.c: return a GimpContainer from all container
	subclass constructors.

	* app/gimppalettepreview.c
	* app/palette.c: changed the preview a bit. Still ugly.
This commit is contained in:
Michael Natterer 2001-02-19 02:17:31 +00:00 committed by Michael Natterer
parent 2beabbaf04
commit dbc227137c
20 changed files with 72 additions and 41 deletions

View File

@ -1,3 +1,15 @@
2001-02-19 Michael Natterer <mitch@gimp.org>
* app/context_manager.c
* app/gimpdatafactory.c
* app/gimpdatalist.[ch]
* app/gimplist.[ch]
* app/module_db.c: return a GimpContainer from all container
subclass constructors.
* app/gimppalettepreview.c
* app/palette.c: changed the preview a bit. Still ugly.
2001-02-19 Michael Natterer <mitch@gimp.org>
* gimp.m4

View File

@ -188,8 +188,7 @@ context_manager_init (void)
sizeof (palette_loader_entries[0]));
/* Create the context of all existing images */
image_context = GIMP_CONTAINER (gimp_list_new (GIMP_TYPE_IMAGE,
GIMP_CONTAINER_POLICY_WEAK));
image_context = gimp_list_new (GIMP_TYPE_IMAGE, GIMP_CONTAINER_POLICY_WEAK);
/* Create the global data factories */
global_brush_factory =

View File

@ -124,7 +124,7 @@ gimp_data_factory_new (GtkType data_type,
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
factory->container = GIMP_CONTAINER (gimp_data_list_new (data_type));
factory->container = gimp_data_list_new (data_type);
gtk_object_ref (GTK_OBJECT (factory->container));
gtk_object_sink (GTK_OBJECT (factory->container));

View File

@ -128,7 +128,7 @@ gimp_data_list_remove (GimpContainer *container,
list->list = g_list_remove (list->list, object);
}
GimpDataList *
GimpContainer *
gimp_data_list_new (GtkType children_type)
{
@ -141,7 +141,7 @@ gimp_data_list_new (GtkType children_type)
GIMP_CONTAINER (list)->children_type = children_type;
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
return list;
return GIMP_CONTAINER (list);
}
static void

View File

@ -43,8 +43,8 @@ struct _GimpDataListClass
};
GtkType gimp_data_list_get_type (void);
GimpDataList * gimp_data_list_new (GtkType children_type);
GtkType gimp_data_list_get_type (void);
GimpContainer * gimp_data_list_new (GtkType children_type);
#endif /* __GIMP_DATA_LIST_H__ */

View File

@ -185,7 +185,7 @@ gimp_list_foreach (GimpContainer *container,
g_list_foreach (list->list, func, user_data);
}
GimpList *
GimpContainer *
gimp_list_new (GtkType children_type,
GimpContainerPolicy policy)
{
@ -200,7 +200,7 @@ gimp_list_new (GtkType children_type,
GIMP_CONTAINER (list)->children_type = children_type;
GIMP_CONTAINER (list)->policy = policy;
return list;
return GIMP_CONTAINER (list);
}
static GimpObject *

View File

@ -45,9 +45,9 @@ struct _GimpListClass
};
GtkType gimp_list_get_type (void);
GimpList * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
GtkType gimp_list_get_type (void);
GimpContainer * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
#endif /* __GIMP_LIST_H__ */

View File

@ -213,8 +213,7 @@ module_db_init (void)
/* Load and initialize gimp modules */
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
GIMP_CONTAINER_POLICY_WEAK));
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
if (g_module_supported ())
datafiles_read_directories (module_path, 0 /* no flags */,

View File

@ -124,7 +124,7 @@ gimp_data_factory_new (GtkType data_type,
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
factory->container = GIMP_CONTAINER (gimp_data_list_new (data_type));
factory->container = gimp_data_list_new (data_type);
gtk_object_ref (GTK_OBJECT (factory->container));
gtk_object_sink (GTK_OBJECT (factory->container));

View File

@ -128,7 +128,7 @@ gimp_data_list_remove (GimpContainer *container,
list->list = g_list_remove (list->list, object);
}
GimpDataList *
GimpContainer *
gimp_data_list_new (GtkType children_type)
{
@ -141,7 +141,7 @@ gimp_data_list_new (GtkType children_type)
GIMP_CONTAINER (list)->children_type = children_type;
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
return list;
return GIMP_CONTAINER (list);
}
static void

View File

@ -43,8 +43,8 @@ struct _GimpDataListClass
};
GtkType gimp_data_list_get_type (void);
GimpDataList * gimp_data_list_new (GtkType children_type);
GtkType gimp_data_list_get_type (void);
GimpContainer * gimp_data_list_new (GtkType children_type);
#endif /* __GIMP_DATA_LIST_H__ */

View File

@ -185,7 +185,7 @@ gimp_list_foreach (GimpContainer *container,
g_list_foreach (list->list, func, user_data);
}
GimpList *
GimpContainer *
gimp_list_new (GtkType children_type,
GimpContainerPolicy policy)
{
@ -200,7 +200,7 @@ gimp_list_new (GtkType children_type,
GIMP_CONTAINER (list)->children_type = children_type;
GIMP_CONTAINER (list)->policy = policy;
return list;
return GIMP_CONTAINER (list);
}
static GimpObject *

View File

@ -45,9 +45,9 @@ struct _GimpListClass
};
GtkType gimp_list_get_type (void);
GimpList * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
GtkType gimp_list_get_type (void);
GimpContainer * gimp_list_new (GtkType children_type,
GimpContainerPolicy policy);
#endif /* __GIMP_LIST_H__ */

View File

@ -34,6 +34,10 @@
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
static void gimp_palette_preview_init (GimpPalettePreview *preview);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
@ -81,6 +85,7 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_PREVIEW);
preview_class->get_size = gimp_palette_preview_get_size;
preview_class->render = gimp_palette_preview_render;
preview_class->create_popup = gimp_palette_preview_create_popup;
preview_class->needs_popup = gimp_palette_preview_needs_popup;
@ -99,6 +104,16 @@ gimp_palette_preview_init (GimpPalettePreview *palette_preview)
palette_preview);
}
static void
gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height)
{
*width = size * 3;
*height = size;
}
static void
gimp_palette_preview_render (GimpPreview *preview)
{
@ -138,8 +153,6 @@ gimp_palette_preview_create_popup (GimpPreview *preview)
popup_height = MAX (1, palette->n_colors / popup_width);
g_print ("columns: %d\n", palette->n_columns);
return gimp_preview_new_full (preview->viewable,
popup_width * 4,
popup_height * 4,

View File

@ -213,8 +213,7 @@ module_db_init (void)
/* Load and initialize gimp modules */
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
GIMP_CONTAINER_POLICY_WEAK));
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
if (g_module_supported ())
datafiles_read_directories (module_path, 0 /* no flags */,

View File

@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
global_palette_factory,
editor ? NULL : palette_dialog_edit_palette,
palette_dialog->context,
64, /* FIXME: SM_PREVIEW_WIDTH */
3, /* FIXME: STD_PALETTE_COLUMNS */
3); /* FIXME: STD_PALETTE_ROWS */
SM_PREVIEW_HEIGHT,
2, 4);
if (! editor)
{

View File

@ -213,8 +213,7 @@ module_db_init (void)
/* Load and initialize gimp modules */
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
GIMP_CONTAINER_POLICY_WEAK));
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
if (g_module_supported ())
datafiles_read_directories (module_path, 0 /* no flags */,

View File

@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
global_palette_factory,
editor ? NULL : palette_dialog_edit_palette,
palette_dialog->context,
64, /* FIXME: SM_PREVIEW_WIDTH */
3, /* FIXME: STD_PALETTE_COLUMNS */
3); /* FIXME: STD_PALETTE_ROWS */
SM_PREVIEW_HEIGHT,
2, 4);
if (! editor)
{

View File

@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
global_palette_factory,
editor ? NULL : palette_dialog_edit_palette,
palette_dialog->context,
64, /* FIXME: SM_PREVIEW_WIDTH */
3, /* FIXME: STD_PALETTE_COLUMNS */
3); /* FIXME: STD_PALETTE_ROWS */
SM_PREVIEW_HEIGHT,
2, 4);
if (! editor)
{

View File

@ -34,6 +34,10 @@
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
static void gimp_palette_preview_init (GimpPalettePreview *preview);
static void gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height);
static void gimp_palette_preview_render (GimpPreview *preview);
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
static gboolean gimp_palette_preview_needs_popup (GimpPreview *preview);
@ -81,6 +85,7 @@ gimp_palette_preview_class_init (GimpPalettePreviewClass *klass)
parent_class = gtk_type_class (GIMP_TYPE_PREVIEW);
preview_class->get_size = gimp_palette_preview_get_size;
preview_class->render = gimp_palette_preview_render;
preview_class->create_popup = gimp_palette_preview_create_popup;
preview_class->needs_popup = gimp_palette_preview_needs_popup;
@ -99,6 +104,16 @@ gimp_palette_preview_init (GimpPalettePreview *palette_preview)
palette_preview);
}
static void
gimp_palette_preview_get_size (GimpPreview *preview,
gint size,
gint *width,
gint *height)
{
*width = size * 3;
*height = size;
}
static void
gimp_palette_preview_render (GimpPreview *preview)
{
@ -138,8 +153,6 @@ gimp_palette_preview_create_popup (GimpPreview *preview)
popup_height = MAX (1, palette->n_colors / popup_width);
g_print ("columns: %d\n", palette->n_columns);
return gimp_preview_new_full (preview->viewable,
popup_width * 4,
popup_height * 4,