mirror of https://github.com/GNOME/gimp.git
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:
parent
2beabbaf04
commit
dbc227137c
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2001-02-19 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* gimp.m4
|
* gimp.m4
|
||||||
|
|
|
@ -188,8 +188,7 @@ context_manager_init (void)
|
||||||
sizeof (palette_loader_entries[0]));
|
sizeof (palette_loader_entries[0]));
|
||||||
|
|
||||||
/* Create the context of all existing images */
|
/* Create the context of all existing images */
|
||||||
image_context = GIMP_CONTAINER (gimp_list_new (GIMP_TYPE_IMAGE,
|
image_context = gimp_list_new (GIMP_TYPE_IMAGE, GIMP_CONTAINER_POLICY_WEAK);
|
||||||
GIMP_CONTAINER_POLICY_WEAK));
|
|
||||||
|
|
||||||
/* Create the global data factories */
|
/* Create the global data factories */
|
||||||
global_brush_factory =
|
global_brush_factory =
|
||||||
|
|
|
@ -124,7 +124,7 @@ gimp_data_factory_new (GtkType data_type,
|
||||||
|
|
||||||
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
|
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_ref (GTK_OBJECT (factory->container));
|
||||||
gtk_object_sink (GTK_OBJECT (factory->container));
|
gtk_object_sink (GTK_OBJECT (factory->container));
|
||||||
|
|
|
@ -128,7 +128,7 @@ gimp_data_list_remove (GimpContainer *container,
|
||||||
list->list = g_list_remove (list->list, object);
|
list->list = g_list_remove (list->list, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpDataList *
|
GimpContainer *
|
||||||
gimp_data_list_new (GtkType children_type)
|
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)->children_type = children_type;
|
||||||
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
|
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
|
||||||
|
|
||||||
return list;
|
return GIMP_CONTAINER (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -43,8 +43,8 @@ struct _GimpDataListClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GtkType gimp_data_list_get_type (void);
|
GtkType gimp_data_list_get_type (void);
|
||||||
GimpDataList * gimp_data_list_new (GtkType children_type);
|
GimpContainer * gimp_data_list_new (GtkType children_type);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DATA_LIST_H__ */
|
#endif /* __GIMP_DATA_LIST_H__ */
|
||||||
|
|
|
@ -185,7 +185,7 @@ gimp_list_foreach (GimpContainer *container,
|
||||||
g_list_foreach (list->list, func, user_data);
|
g_list_foreach (list->list, func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpList *
|
GimpContainer *
|
||||||
gimp_list_new (GtkType children_type,
|
gimp_list_new (GtkType children_type,
|
||||||
GimpContainerPolicy policy)
|
GimpContainerPolicy policy)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ gimp_list_new (GtkType children_type,
|
||||||
GIMP_CONTAINER (list)->children_type = children_type;
|
GIMP_CONTAINER (list)->children_type = children_type;
|
||||||
GIMP_CONTAINER (list)->policy = policy;
|
GIMP_CONTAINER (list)->policy = policy;
|
||||||
|
|
||||||
return list;
|
return GIMP_CONTAINER (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpObject *
|
static GimpObject *
|
||||||
|
|
|
@ -45,9 +45,9 @@ struct _GimpListClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GtkType gimp_list_get_type (void);
|
GtkType gimp_list_get_type (void);
|
||||||
GimpList * gimp_list_new (GtkType children_type,
|
GimpContainer * gimp_list_new (GtkType children_type,
|
||||||
GimpContainerPolicy policy);
|
GimpContainerPolicy policy);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_LIST_H__ */
|
#endif /* __GIMP_LIST_H__ */
|
||||||
|
|
|
@ -213,8 +213,7 @@ module_db_init (void)
|
||||||
|
|
||||||
/* Load and initialize gimp modules */
|
/* Load and initialize gimp modules */
|
||||||
|
|
||||||
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
|
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
|
||||||
GIMP_CONTAINER_POLICY_WEAK));
|
|
||||||
|
|
||||||
if (g_module_supported ())
|
if (g_module_supported ())
|
||||||
datafiles_read_directories (module_path, 0 /* no flags */,
|
datafiles_read_directories (module_path, 0 /* no flags */,
|
||||||
|
|
|
@ -124,7 +124,7 @@ gimp_data_factory_new (GtkType data_type,
|
||||||
|
|
||||||
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
|
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_ref (GTK_OBJECT (factory->container));
|
||||||
gtk_object_sink (GTK_OBJECT (factory->container));
|
gtk_object_sink (GTK_OBJECT (factory->container));
|
||||||
|
|
|
@ -128,7 +128,7 @@ gimp_data_list_remove (GimpContainer *container,
|
||||||
list->list = g_list_remove (list->list, object);
|
list->list = g_list_remove (list->list, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpDataList *
|
GimpContainer *
|
||||||
gimp_data_list_new (GtkType children_type)
|
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)->children_type = children_type;
|
||||||
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
|
GIMP_CONTAINER (list)->policy = GIMP_CONTAINER_POLICY_STRONG;
|
||||||
|
|
||||||
return list;
|
return GIMP_CONTAINER (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -43,8 +43,8 @@ struct _GimpDataListClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GtkType gimp_data_list_get_type (void);
|
GtkType gimp_data_list_get_type (void);
|
||||||
GimpDataList * gimp_data_list_new (GtkType children_type);
|
GimpContainer * gimp_data_list_new (GtkType children_type);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DATA_LIST_H__ */
|
#endif /* __GIMP_DATA_LIST_H__ */
|
||||||
|
|
|
@ -185,7 +185,7 @@ gimp_list_foreach (GimpContainer *container,
|
||||||
g_list_foreach (list->list, func, user_data);
|
g_list_foreach (list->list, func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpList *
|
GimpContainer *
|
||||||
gimp_list_new (GtkType children_type,
|
gimp_list_new (GtkType children_type,
|
||||||
GimpContainerPolicy policy)
|
GimpContainerPolicy policy)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ gimp_list_new (GtkType children_type,
|
||||||
GIMP_CONTAINER (list)->children_type = children_type;
|
GIMP_CONTAINER (list)->children_type = children_type;
|
||||||
GIMP_CONTAINER (list)->policy = policy;
|
GIMP_CONTAINER (list)->policy = policy;
|
||||||
|
|
||||||
return list;
|
return GIMP_CONTAINER (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpObject *
|
static GimpObject *
|
||||||
|
|
|
@ -45,9 +45,9 @@ struct _GimpListClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GtkType gimp_list_get_type (void);
|
GtkType gimp_list_get_type (void);
|
||||||
GimpList * gimp_list_new (GtkType children_type,
|
GimpContainer * gimp_list_new (GtkType children_type,
|
||||||
GimpContainerPolicy policy);
|
GimpContainerPolicy policy);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_LIST_H__ */
|
#endif /* __GIMP_LIST_H__ */
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
|
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
|
||||||
static void gimp_palette_preview_init (GimpPalettePreview *preview);
|
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 void gimp_palette_preview_render (GimpPreview *preview);
|
||||||
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
|
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
|
||||||
static gboolean gimp_palette_preview_needs_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);
|
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->render = gimp_palette_preview_render;
|
||||||
preview_class->create_popup = gimp_palette_preview_create_popup;
|
preview_class->create_popup = gimp_palette_preview_create_popup;
|
||||||
preview_class->needs_popup = gimp_palette_preview_needs_popup;
|
preview_class->needs_popup = gimp_palette_preview_needs_popup;
|
||||||
|
@ -99,6 +104,16 @@ gimp_palette_preview_init (GimpPalettePreview *palette_preview)
|
||||||
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
|
static void
|
||||||
gimp_palette_preview_render (GimpPreview *preview)
|
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);
|
popup_height = MAX (1, palette->n_colors / popup_width);
|
||||||
|
|
||||||
g_print ("columns: %d\n", palette->n_columns);
|
|
||||||
|
|
||||||
return gimp_preview_new_full (preview->viewable,
|
return gimp_preview_new_full (preview->viewable,
|
||||||
popup_width * 4,
|
popup_width * 4,
|
||||||
popup_height * 4,
|
popup_height * 4,
|
||||||
|
|
|
@ -213,8 +213,7 @@ module_db_init (void)
|
||||||
|
|
||||||
/* Load and initialize gimp modules */
|
/* Load and initialize gimp modules */
|
||||||
|
|
||||||
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
|
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
|
||||||
GIMP_CONTAINER_POLICY_WEAK));
|
|
||||||
|
|
||||||
if (g_module_supported ())
|
if (g_module_supported ())
|
||||||
datafiles_read_directories (module_path, 0 /* no flags */,
|
datafiles_read_directories (module_path, 0 /* no flags */,
|
||||||
|
|
|
@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
|
||||||
global_palette_factory,
|
global_palette_factory,
|
||||||
editor ? NULL : palette_dialog_edit_palette,
|
editor ? NULL : palette_dialog_edit_palette,
|
||||||
palette_dialog->context,
|
palette_dialog->context,
|
||||||
64, /* FIXME: SM_PREVIEW_WIDTH */
|
SM_PREVIEW_HEIGHT,
|
||||||
3, /* FIXME: STD_PALETTE_COLUMNS */
|
2, 4);
|
||||||
3); /* FIXME: STD_PALETTE_ROWS */
|
|
||||||
|
|
||||||
if (! editor)
|
if (! editor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,8 +213,7 @@ module_db_init (void)
|
||||||
|
|
||||||
/* Load and initialize gimp modules */
|
/* Load and initialize gimp modules */
|
||||||
|
|
||||||
modules = GIMP_CONTAINER (gimp_list_new (MODULE_INFO_TYPE,
|
modules = gimp_list_new (MODULE_INFO_TYPE, GIMP_CONTAINER_POLICY_WEAK);
|
||||||
GIMP_CONTAINER_POLICY_WEAK));
|
|
||||||
|
|
||||||
if (g_module_supported ())
|
if (g_module_supported ())
|
||||||
datafiles_read_directories (module_path, 0 /* no flags */,
|
datafiles_read_directories (module_path, 0 /* no flags */,
|
||||||
|
|
|
@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
|
||||||
global_palette_factory,
|
global_palette_factory,
|
||||||
editor ? NULL : palette_dialog_edit_palette,
|
editor ? NULL : palette_dialog_edit_palette,
|
||||||
palette_dialog->context,
|
palette_dialog->context,
|
||||||
64, /* FIXME: SM_PREVIEW_WIDTH */
|
SM_PREVIEW_HEIGHT,
|
||||||
3, /* FIXME: STD_PALETTE_COLUMNS */
|
2, 4);
|
||||||
3); /* FIXME: STD_PALETTE_ROWS */
|
|
||||||
|
|
||||||
if (! editor)
|
if (! editor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -485,9 +485,8 @@ palette_dialog_new (gboolean editor)
|
||||||
global_palette_factory,
|
global_palette_factory,
|
||||||
editor ? NULL : palette_dialog_edit_palette,
|
editor ? NULL : palette_dialog_edit_palette,
|
||||||
palette_dialog->context,
|
palette_dialog->context,
|
||||||
64, /* FIXME: SM_PREVIEW_WIDTH */
|
SM_PREVIEW_HEIGHT,
|
||||||
3, /* FIXME: STD_PALETTE_COLUMNS */
|
2, 4);
|
||||||
3); /* FIXME: STD_PALETTE_ROWS */
|
|
||||||
|
|
||||||
if (! editor)
|
if (! editor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
|
static void gimp_palette_preview_class_init (GimpPalettePreviewClass *klass);
|
||||||
static void gimp_palette_preview_init (GimpPalettePreview *preview);
|
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 void gimp_palette_preview_render (GimpPreview *preview);
|
||||||
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
|
static GtkWidget * gimp_palette_preview_create_popup (GimpPreview *preview);
|
||||||
static gboolean gimp_palette_preview_needs_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);
|
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->render = gimp_palette_preview_render;
|
||||||
preview_class->create_popup = gimp_palette_preview_create_popup;
|
preview_class->create_popup = gimp_palette_preview_create_popup;
|
||||||
preview_class->needs_popup = gimp_palette_preview_needs_popup;
|
preview_class->needs_popup = gimp_palette_preview_needs_popup;
|
||||||
|
@ -99,6 +104,16 @@ gimp_palette_preview_init (GimpPalettePreview *palette_preview)
|
||||||
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
|
static void
|
||||||
gimp_palette_preview_render (GimpPreview *preview)
|
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);
|
popup_height = MAX (1, palette->n_colors / popup_width);
|
||||||
|
|
||||||
g_print ("columns: %d\n", palette->n_columns);
|
|
||||||
|
|
||||||
return gimp_preview_new_full (preview->viewable,
|
return gimp_preview_new_full (preview->viewable,
|
||||||
popup_width * 4,
|
popup_width * 4,
|
||||||
popup_height * 4,
|
popup_height * 4,
|
||||||
|
|
Loading…
Reference in New Issue