From dbc227137c57ab28c565a552a969b568d885cf7f Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 19 Feb 2001 02:17:31 +0000 Subject: [PATCH] app/context_manager.c app/gimpdatafactory.c app/gimpdatalist.[ch] 2001-02-19 Michael Natterer * 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. --- ChangeLog | 12 ++++++++++++ app/context_manager.c | 3 +-- app/core/gimpdatafactory.c | 2 +- app/core/gimpdatalist.c | 4 ++-- app/core/gimpdatalist.h | 4 ++-- app/core/gimplist.c | 4 ++-- app/core/gimplist.h | 6 +++--- app/dialogs/module-dialog.c | 3 +-- app/gimpdatafactory.c | 2 +- app/gimpdatalist.c | 4 ++-- app/gimpdatalist.h | 4 ++-- app/gimplist.c | 4 ++-- app/gimplist.h | 6 +++--- app/gimppalettepreview.c | 17 +++++++++++++++-- app/gui/module-browser.c | 3 +-- app/gui/palette-editor.c | 5 ++--- app/module_db.c | 3 +-- app/palette.c | 5 ++--- app/widgets/gimppaletteeditor.c | 5 ++--- app/widgets/gimppalettepreview.c | 17 +++++++++++++++-- 20 files changed, 72 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37474912fa..3f90d4894d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2001-02-19 Michael Natterer + + * 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 * gimp.m4 diff --git a/app/context_manager.c b/app/context_manager.c index 7e3a654a43..ed6c261c62 100644 --- a/app/context_manager.c +++ b/app/context_manager.c @@ -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 = diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c index 7ddff12750..510c7f314f 100644 --- a/app/core/gimpdatafactory.c +++ b/app/core/gimpdatafactory.c @@ -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)); diff --git a/app/core/gimpdatalist.c b/app/core/gimpdatalist.c index 2ac1a6644e..b50fedd37e 100644 --- a/app/core/gimpdatalist.c +++ b/app/core/gimpdatalist.c @@ -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 diff --git a/app/core/gimpdatalist.h b/app/core/gimpdatalist.h index ff9cafda0f..ae75b1d524 100644 --- a/app/core/gimpdatalist.h +++ b/app/core/gimpdatalist.h @@ -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__ */ diff --git a/app/core/gimplist.c b/app/core/gimplist.c index 77c2cd3efe..ef63700a1e 100644 --- a/app/core/gimplist.c +++ b/app/core/gimplist.c @@ -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 * diff --git a/app/core/gimplist.h b/app/core/gimplist.h index 3d51d043a9..f1c79dada5 100644 --- a/app/core/gimplist.h +++ b/app/core/gimplist.h @@ -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__ */ diff --git a/app/dialogs/module-dialog.c b/app/dialogs/module-dialog.c index 5c281a00f3..a4d0c07712 100644 --- a/app/dialogs/module-dialog.c +++ b/app/dialogs/module-dialog.c @@ -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 */, diff --git a/app/gimpdatafactory.c b/app/gimpdatafactory.c index 7ddff12750..510c7f314f 100644 --- a/app/gimpdatafactory.c +++ b/app/gimpdatafactory.c @@ -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)); diff --git a/app/gimpdatalist.c b/app/gimpdatalist.c index 2ac1a6644e..b50fedd37e 100644 --- a/app/gimpdatalist.c +++ b/app/gimpdatalist.c @@ -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 diff --git a/app/gimpdatalist.h b/app/gimpdatalist.h index ff9cafda0f..ae75b1d524 100644 --- a/app/gimpdatalist.h +++ b/app/gimpdatalist.h @@ -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__ */ diff --git a/app/gimplist.c b/app/gimplist.c index 77c2cd3efe..ef63700a1e 100644 --- a/app/gimplist.c +++ b/app/gimplist.c @@ -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 * diff --git a/app/gimplist.h b/app/gimplist.h index 3d51d043a9..f1c79dada5 100644 --- a/app/gimplist.h +++ b/app/gimplist.h @@ -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__ */ diff --git a/app/gimppalettepreview.c b/app/gimppalettepreview.c index ee99362c9b..d07dae0ec8 100644 --- a/app/gimppalettepreview.c +++ b/app/gimppalettepreview.c @@ -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, diff --git a/app/gui/module-browser.c b/app/gui/module-browser.c index 5c281a00f3..a4d0c07712 100644 --- a/app/gui/module-browser.c +++ b/app/gui/module-browser.c @@ -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 */, diff --git a/app/gui/palette-editor.c b/app/gui/palette-editor.c index bcaf5e3431..aebdcb202a 100644 --- a/app/gui/palette-editor.c +++ b/app/gui/palette-editor.c @@ -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) { diff --git a/app/module_db.c b/app/module_db.c index 5c281a00f3..a4d0c07712 100644 --- a/app/module_db.c +++ b/app/module_db.c @@ -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 */, diff --git a/app/palette.c b/app/palette.c index bcaf5e3431..aebdcb202a 100644 --- a/app/palette.c +++ b/app/palette.c @@ -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) { diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index bcaf5e3431..aebdcb202a 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -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) { diff --git a/app/widgets/gimppalettepreview.c b/app/widgets/gimppalettepreview.c index ee99362c9b..d07dae0ec8 100644 --- a/app/widgets/gimppalettepreview.c +++ b/app/widgets/gimppalettepreview.c @@ -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,