gimprc.in user_install user_install.bat app/gimprc.[ch] removed the

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

	* gimprc.in
	* user_install
	* user_install.bat
	* app/gimprc.[ch]
	* app/preferences_dialog.c: removed the "brush_vbr_path" variable,
	because all data types will be editable and saveable soon.

	* app/Makefile.am
	* app/apptypes.h
	* app/gimpdatafactory.[ch]: new object which holds a data list and
	knows how to create, edit, duplicate etc. the items in it. Will
	completely replace the brushes.[ch], patterns.[ch], ... files soon.

	* po/POTFILES.in
	* app/gimpdatacontainerview.[ch]: removed.
	* app/gimpdatafactoryview.[ch]: added.

	A view on the GimpDataFactory with a GUI for creating, editing,
	deleting etc. items (mostly unimplemented).

	* app/context_manager.[ch]: replaced the global data lists by global
	data factories.

	* app/brush_select.c
	* app/brushes.[ch]
	* app/commands.c
	* app/convert.c
	* app/devices.c
	* app/gimpbrush.[ch]
	* app/gimpbrushgenerated.c
	* app/gimpcontext.c
	* app/gimpdata.[ch]
	* app/gimpdatalist.[ch]
	* app/gimpdnd.c
	* app/gimpgradient.[ch]
	* app/gimppalette.[ch]
	* app/gimppattern.[ch]
	* app/gradient_editor.c
	* app/gradient_select.c
	* app/gradients.[ch]
	* app/indicator_area.c
	* app/palette.c
	* app/palette_import.c
	* app/palette_select.c
	* app/palettes.[ch]
	* app/pattern_select.c
	* app/patterns.[ch]
	* app/pdb/brush_select_cmds.c
	* app/pdb/brushes_cmds.c
	* app/pdb/convert_cmds.c
	* app/pdb/gradient_select_cmds.c
	* app/pdb/gradients_cmds.c
	* app/pdb/pattern_select_cmds.c
	* app/pdb/patterns_cmds.c
	* tools/pdbgen/pdb/brush_select.pdb
	* tools/pdbgen/pdb/brushes.pdb
	* tools/pdbgen/pdb/convert.pdb
	* tools/pdbgen/pdb/gradient_select.pdb
	* tools/pdbgen/pdb/gradients.pdb
	* tools/pdbgen/pdb/pattern_select.pdb
	* tools/pdbgen/pdb/patterns.pdb: changed accordingly.
This commit is contained in:
Michael Natterer 2001-02-13 19:53:07 +00:00 committed by Michael Natterer
parent 1501e3cf8e
commit b5d8536f3f
109 changed files with 2488 additions and 1028 deletions

View File

@ -1,3 +1,67 @@
2001-02-13 Michael Natterer <mitch@gimp.org>
* gimprc.in
* user_install
* user_install.bat
* app/gimprc.[ch]
* app/preferences_dialog.c: removed the "brush_vbr_path" variable,
because all data types will be editable and saveable soon.
* app/Makefile.am
* app/apptypes.h
* app/gimpdatafactory.[ch]: new object which holds a data list and
knows how to create, edit, duplicate etc. the items in it. Will
completely replace the brushes.[ch], patterns.[ch], ... files soon.
* po/POTFILES.in
* app/gimpdatacontainerview.[ch]: removed.
* app/gimpdatafactoryview.[ch]: added.
A view on the GimpDataFactory with a GUI for creating, editing,
deleting etc. items (mostly unimplemented).
* app/context_manager.[ch]: replaced the global data lists by global
data factories.
* app/brush_select.c
* app/brushes.[ch]
* app/commands.c
* app/convert.c
* app/devices.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.c
* app/gimpcontext.c
* app/gimpdata.[ch]
* app/gimpdatalist.[ch]
* app/gimpdnd.c
* app/gimpgradient.[ch]
* app/gimppalette.[ch]
* app/gimppattern.[ch]
* app/gradient_editor.c
* app/gradient_select.c
* app/gradients.[ch]
* app/indicator_area.c
* app/palette.c
* app/palette_import.c
* app/palette_select.c
* app/palettes.[ch]
* app/pattern_select.c
* app/patterns.[ch]
* app/pdb/brush_select_cmds.c
* app/pdb/brushes_cmds.c
* app/pdb/convert_cmds.c
* app/pdb/gradient_select_cmds.c
* app/pdb/gradients_cmds.c
* app/pdb/pattern_select_cmds.c
* app/pdb/patterns_cmds.c
* tools/pdbgen/pdb/brush_select.pdb
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/convert.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/gradients.pdb
* tools/pdbgen/pdb/pattern_select.pdb
* tools/pdbgen/pdb/patterns.pdb: changed accordingly.
2001-02-13 Michael Natterer <mitch@gimp.org>
* app/Makefile.am

View File

@ -116,6 +116,8 @@ gimp_SOURCES = \
gimpcontext.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdatalist.c \
gimpdatalist.h \
gimpdnd.c \
@ -295,8 +297,8 @@ gimp_SOURCES = \
gimpcontainerlistview.c \
gimpcontainerview.h \
gimpcontainerview.c \
gimpdatacontainerview.h \
gimpdatacontainerview.c \
gimpdatafactoryview.h \
gimpdatafactoryview.c \
gimpdrawablepreview.c \
gimpdrawablepreview.h \
gimpgradientpreview.h \

View File

@ -84,7 +84,8 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
#include "gimpdatacontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1356,7 +1357,7 @@ brushes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_list);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1376,7 +1377,7 @@ patterns_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_list);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1396,7 +1397,7 @@ gradients_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_list);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1416,7 +1417,7 @@ palettes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_list);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1508,11 +1509,11 @@ container_view_new (gboolean list,
}
static void
data_container_view_new (GimpViewType view_type,
gchar *title,
GimpContainer *container,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1532,11 +1533,11 @@ data_container_view_new (GimpViewType view_type,
gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
view = gimp_data_container_view_new (view_type,
container,
context,
preview_size,
5, 5);
view = gimp_data_factory_view_new (view_type,
factory,
context,
preview_size,
5, 5);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
gtk_widget_show (view);
@ -1549,7 +1550,7 @@ data_container_view_new (GimpViewType view_type,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (container_view_scale_callback),
GIMP_DATA_CONTAINER_VIEW (view)->view);
GIMP_DATA_FACTORY_VIEW (view)->view);
gtk_widget_show (dialog);
}
@ -1742,88 +1743,88 @@ void
dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_list,
gimp_context_get_user (),
32);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
gimp_context_get_user (),
32);
}
void
dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
@ -1831,7 +1832,7 @@ dialogs_test_multi_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (TRUE, "Multi List",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
24);
}
@ -1841,7 +1842,7 @@ dialogs_test_multi_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (FALSE, "Multi Grid",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
32);
}

View File

@ -38,6 +38,8 @@ typedef struct _GimpContainer GimpContainer;
typedef struct _GimpList GimpList;
typedef struct _GimpDataList GimpDataList;
typedef struct _GimpDataFactory GimpDataFactory;
typedef struct _GimpContext GimpContext;
typedef struct _GimpViewable GimpViewable;

View File

@ -37,6 +37,7 @@
#include "gimpcontainergridview.h"
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "session.h"
@ -205,7 +206,7 @@ brush_select_new (gchar *title,
if (title && init_name && strlen (init_name))
{
active = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
init_name);
}
else
@ -242,7 +243,7 @@ brush_select_new (gchar *title,
gtk_container_add (GTK_CONTAINER (bsp->left_box), bsp->brush_selection_box);
/* The Brush Grid */
bsp->view = gimp_container_grid_view_new (global_brush_list,
bsp->view = gimp_container_grid_view_new (global_brush_factory->container,
bsp->context,
MIN_CELL_SIZE,
STD_BRUSH_COLUMNS,
@ -386,7 +387,7 @@ brush_select_new (gchar *title,
/* add callbacks to keep the display area current */
bsp->name_changed_handler_id =
gimp_container_add_handler
(GIMP_CONTAINER (global_brush_list), "name_changed",
(global_brush_factory->container, "name_changed",
GTK_SIGNAL_FUNC (brush_select_brush_renamed_callback),
bsp);
@ -435,7 +436,7 @@ brush_select_free (BrushSelect *bsp)
gtk_object_unref (GTK_OBJECT (bsp->context));
}
gimp_container_remove_handler (GIMP_CONTAINER (global_brush_list),
gimp_container_remove_handler (global_brush_factory->container,
bsp->name_changed_handler_id);
g_free (bsp);
@ -623,7 +624,8 @@ static void
brush_select_select (BrushSelect *bsp,
GimpBrush *brush)
{
if (! gimp_container_have (global_brush_list, GIMP_OBJECT (brush)));
if (! gimp_container_have (global_brush_factory->container,
GIMP_OBJECT (brush)));
if (GIMP_IS_BRUSH_GENERATED (brush))
{
@ -758,7 +760,7 @@ brush_select_new_brush_callback (GtkWidget *widget,
brush = gimp_brush_generated_new (10, .5, 0.0, 1.0);
gimp_container_add (GIMP_CONTAINER (global_brush_list),
gimp_container_add (global_brush_factory->container,
GIMP_OBJECT (brush));
gimp_context_set_brush (bsp->context, brush);
@ -817,7 +819,8 @@ brush_select_delete_brush_callback (GtkWidget *widget,
if (GIMP_DATA (brush)->filename)
gimp_data_delete_from_disk (GIMP_DATA (brush));
gimp_container_remove (global_brush_list, GIMP_OBJECT (brush));
gimp_container_remove (global_brush_factory->container,
GIMP_OBJECT (brush));
}
else
{

View File

@ -27,6 +27,7 @@
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushpipe.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimprc.h"
@ -40,15 +41,8 @@ brushes_init (gboolean no_data)
if (brush_path != NULL && !no_data)
{
gchar *common_brush_path;
common_brush_path = g_strconcat (brush_path,
G_SEARCHPATH_SEPARATOR_S,
brush_vbr_path,
NULL);
gimp_data_list_load (GIMP_DATA_LIST (global_brush_list),
common_brush_path,
gimp_data_list_load (GIMP_DATA_LIST (global_brush_factory->container),
brush_path,
(GimpDataObjectLoaderFunc) gimp_brush_load,
GIMP_BRUSH_FILE_EXTENSION,
@ -63,39 +57,16 @@ brushes_init (gboolean no_data)
GIMP_BRUSH_PIPE_FILE_EXTENSION,
NULL);
g_free (common_brush_path);
}
}
void
brushes_free (void)
{
if (gimp_container_num_children (global_brush_list) == 0)
if (gimp_container_num_children (global_brush_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_brush_list),
brush_vbr_path,
GIMP_BRUSH_GENERATED_FILE_EXTENSION);
}
GimpBrush *
brushes_get_standard_brush (void)
{
static GimpBrush *standard_brush = NULL;
if (! standard_brush)
{
standard_brush =
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
/* set ref_count to 2 --> never swap the standard brush */
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
gimp_data_list_save_and_clear
(GIMP_DATA_LIST (global_brush_factory->container),
brush_path);
}

View File

@ -23,7 +23,5 @@
void brushes_init (gboolean no_data);
void brushes_free (void);
GimpBrush * brushes_get_standard_brush (void);
#endif /* __BRUSHES_H__ */

View File

@ -84,7 +84,8 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
#include "gimpdatacontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1356,7 +1357,7 @@ brushes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_list);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1376,7 +1377,7 @@ patterns_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_list);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1396,7 +1397,7 @@ gradients_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_list);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1416,7 +1417,7 @@ palettes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_list);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1508,11 +1509,11 @@ container_view_new (gboolean list,
}
static void
data_container_view_new (GimpViewType view_type,
gchar *title,
GimpContainer *container,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1532,11 +1533,11 @@ data_container_view_new (GimpViewType view_type,
gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
view = gimp_data_container_view_new (view_type,
container,
context,
preview_size,
5, 5);
view = gimp_data_factory_view_new (view_type,
factory,
context,
preview_size,
5, 5);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
gtk_widget_show (view);
@ -1549,7 +1550,7 @@ data_container_view_new (GimpViewType view_type,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (container_view_scale_callback),
GIMP_DATA_CONTAINER_VIEW (view)->view);
GIMP_DATA_FACTORY_VIEW (view)->view);
gtk_widget_show (dialog);
}
@ -1742,88 +1743,88 @@ void
dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_list,
gimp_context_get_user (),
32);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
gimp_context_get_user (),
32);
}
void
dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
@ -1831,7 +1832,7 @@ dialogs_test_multi_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (TRUE, "Multi List",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
24);
}
@ -1841,7 +1842,7 @@ dialogs_test_multi_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (FALSE, "Multi Grid",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
32);
}

View File

@ -29,6 +29,7 @@
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpgradient.h"
#include "gimpimage.h"
@ -49,10 +50,10 @@ GimpContainer *image_context = NULL;
/*
* the global data lists
*/
GimpContainer *global_brush_list = NULL;
GimpContainer *global_pattern_list = NULL;
GimpContainer *global_gradient_list = NULL;
GimpContainer *global_palette_list = NULL;
GimpDataFactory *global_brush_factory = NULL;
GimpDataFactory *global_pattern_factory = NULL;
GimpDataFactory *global_gradient_factory = NULL;
GimpDataFactory *global_palette_factory = NULL;
static GimpContext *global_tool_context = NULL;
@ -150,11 +151,30 @@ context_manager_init (void)
image_context = GIMP_CONTAINER (gimp_list_new (GIMP_TYPE_IMAGE,
GIMP_CONTAINER_POLICY_WEAK));
/* Create the global data lists */
global_brush_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_BRUSH));
global_pattern_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_PATTERN));
global_gradient_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_GRADIENT));
global_palette_list = GIMP_CONTAINER (gimp_data_list_new (GIMP_TYPE_PALETTE));
/* Create the global data factories */
global_brush_factory =
gimp_data_factory_new (GIMP_TYPE_BRUSH,
(const gchar **) &brush_path,
gimp_brush_new,
gimp_brush_get_standard);
global_pattern_factory =
gimp_data_factory_new (GIMP_TYPE_PATTERN,
(const gchar **) &pattern_path,
gimp_pattern_new,
gimp_pattern_get_standard);
global_gradient_factory =
gimp_data_factory_new (GIMP_TYPE_GRADIENT,
(const gchar **) &gradient_path,
gimp_gradient_new,
gimp_gradient_get_standard);
global_palette_factory =
gimp_data_factory_new (GIMP_TYPE_PALETTE,
(const gchar **) &palette_path,
gimp_palette_new,
gimp_palette_get_standard);
/* Implicitly create the standard context */
standard_context = gimp_context_get_standard ();

View File

@ -26,12 +26,12 @@
extern GimpContainer *image_context;
/*
* the global data lists
* the global data factories which contain the global data lists
*/
extern GimpContainer *global_brush_list;
extern GimpContainer *global_pattern_list;
extern GimpContainer *global_gradient_list;
extern GimpContainer *global_palette_list;
extern GimpDataFactory *global_brush_factory;
extern GimpDataFactory *global_pattern_factory;
extern GimpDataFactory *global_gradient_factory;
extern GimpDataFactory *global_palette_factory;
void context_manager_init (void);

View File

@ -103,6 +103,7 @@
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpdatafactory.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplist.h"
@ -793,7 +794,7 @@ build_palette_button (void)
UserHasWebPal = FALSE;
list = GIMP_LIST (global_palette_list)->list;
list = GIMP_LIST (global_palette_factory->container)->list;
if (! list)
{
@ -835,7 +836,7 @@ build_palette_button (void)
}
else
{
for (i = 0, list = GIMP_LIST (global_palette_list)->list;
for (i = 0, list = GIMP_LIST (global_palette_factory->container)->list;
list && default_palette == -1;
i++, list = g_list_next (list))
{

View File

@ -46,6 +46,7 @@
#include "brush_header.h"
#include "brush_scale.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
@ -62,6 +63,7 @@ static void gimp_brush_destroy (GtkObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static GimpBrush * gimp_brush_select_brush (PaintCore *paint_core);
static gboolean gimp_brush_want_null_motion (PaintCore *paint_core);
@ -99,9 +101,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
@ -109,6 +113,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
viewable_class->get_new_preview = gimp_brush_get_new_preview;
data_class->get_extension = gimp_brush_get_extension;
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
}
@ -249,6 +255,47 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
return return_buf;
}
static gchar *
gimp_brush_get_extension (GimpData *data)
{
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpBrush *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
g_return_val_if_fail (name != NULL, NULL);
brush = GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (brush), name);
return brush;
}
GimpBrush *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
if (! standard_brush)
{
standard_brush =
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
/* set ref_count to 2 --> never swap the standard brush */
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
}
GimpBrush *
gimp_brush_load (const gchar *filename)
{

View File

@ -46,6 +46,7 @@
#include "brush_header.h"
#include "brush_scale.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
@ -62,6 +63,7 @@ static void gimp_brush_destroy (GtkObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static GimpBrush * gimp_brush_select_brush (PaintCore *paint_core);
static gboolean gimp_brush_want_null_motion (PaintCore *paint_core);
@ -99,9 +101,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
@ -109,6 +113,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
viewable_class->get_new_preview = gimp_brush_get_new_preview;
data_class->get_extension = gimp_brush_get_extension;
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
}
@ -249,6 +255,47 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
return return_buf;
}
static gchar *
gimp_brush_get_extension (GimpData *data)
{
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpBrush *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
g_return_val_if_fail (name != NULL, NULL);
brush = GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (brush), name);
return brush;
}
GimpBrush *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
if (! standard_brush)
{
standard_brush =
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
/* set ref_count to 2 --> never swap the standard brush */
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
}
GimpBrush *
gimp_brush_load (const gchar *filename)
{

View File

@ -58,18 +58,22 @@ struct _GimpBrushClass
};
GtkType gimp_brush_get_type (void);
GimpBrush * gimp_brush_load (const gchar *filename);
GtkType gimp_brush_get_type (void);
GimpBrush * gimp_brush_new (const gchar *name);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
GimpBrush * gimp_brush_get_standard (void);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
GimpBrush * gimp_brush_load (const gchar *filename);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
#endif /* __GIMP_BRUSH_H__ */

View File

@ -53,6 +53,7 @@ static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -96,8 +97,9 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
}
static void
@ -164,6 +166,12 @@ gimp_brush_generated_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_brush_generated_get_extension (GimpData *data)
{
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static double
gauss (gdouble f)
{

View File

@ -53,6 +53,7 @@ static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -96,8 +97,9 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
}
static void
@ -164,6 +166,12 @@ gimp_brush_generated_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_brush_generated_get_extension (GimpData *data)
{
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static double
gauss (gdouble f)
{

View File

@ -53,6 +53,7 @@ static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -96,8 +97,9 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
}
static void
@ -164,6 +166,12 @@ gimp_brush_generated_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_brush_generated_get_extension (GimpData *data)
{
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static double
gauss (gdouble f)
{

View File

@ -26,21 +26,18 @@
#include "apptypes.h"
#include "brushes.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimpmarshal.h"
#include "gimppalette.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "temp_buf.h"
@ -719,38 +716,46 @@ gimp_context_new (const gchar *name,
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_brush_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_brush_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_pattern_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_pattern_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_gradient_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_gradient_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_palette_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_palette_list_thaw),
context,
GTK_OBJECT (context));
@ -1606,7 +1611,7 @@ gimp_context_brush_list_thaw (GimpContainer *container,
gimp_context_real_set_brush
(context, GIMP_BRUSH (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_brush (context, brushes_get_standard_brush ());
gimp_context_real_set_brush (context, gimp_brush_get_standard ());
}
/* the active brush disappeared */
@ -1634,7 +1639,7 @@ gimp_context_real_set_brush (GimpContext *context,
GimpBrush *brush)
{
if (! standard_brush)
standard_brush = brushes_get_standard_brush ();
standard_brush = gimp_brush_get_standard ();
if (context->brush == brush)
return;
@ -1773,7 +1778,7 @@ gimp_context_pattern_list_thaw (GimpContainer *container,
(context,
GIMP_PATTERN (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_pattern (context, patterns_get_standard_pattern ());
gimp_context_real_set_pattern (context, gimp_pattern_get_standard ());
}
/* the active pattern disappeared */
@ -1801,7 +1806,7 @@ gimp_context_real_set_pattern (GimpContext *context,
GimpPattern *pattern)
{
if (! standard_pattern)
standard_pattern = patterns_get_standard_pattern ();
standard_pattern = gimp_pattern_get_standard ();
if (context->pattern == pattern)
return;
@ -1937,7 +1942,7 @@ gimp_context_gradient_list_thaw (GimpContainer *container,
(context,
GIMP_GRADIENT (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_gradient (context, gradients_get_standard_gradient ());
gimp_context_real_set_gradient (context, gimp_gradient_get_standard ());
}
/* the active gradient disappeared */
@ -1965,7 +1970,7 @@ gimp_context_real_set_gradient (GimpContext *context,
GimpGradient *gradient)
{
if (! standard_gradient)
standard_gradient = gradients_get_standard_gradient ();
standard_gradient = gimp_gradient_get_standard ();
if (context->gradient == gradient)
return;
@ -2086,7 +2091,7 @@ gimp_context_palette_list_thaw (GimpContainer *container,
(context,
GIMP_PALETTE (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_palette (context, palettes_get_standard_palette ());
gimp_context_real_set_palette (context, gimp_palette_get_standard ());
}
/* the active palette disappeared */
@ -2114,7 +2119,7 @@ gimp_context_real_set_palette (GimpContext *context,
GimpPalette *palette)
{
if (! standard_palette)
standard_palette = palettes_get_standard_palette ();
standard_palette = gimp_palette_get_standard ();
if (context->palette == palette)
return;

View File

@ -31,6 +31,7 @@
#include "apptypes.h"
#include "gimpdata.h"
#include "gimpmarshal.h"
#include "libgimp/gimpenv.h"
@ -39,15 +40,16 @@ enum
{
DIRTY,
SAVE,
GET_EXTENSION,
LAST_SIGNAL
};
static void gimp_data_class_init (GimpDataClass *klass);
static void gimp_data_init (GimpData *data);
static void gimp_data_destroy (GtkObject *object);
static void gimp_data_name_changed (GimpObject *object);
static void gimp_data_real_dirty (GimpData *data);
static void gimp_data_class_init (GimpDataClass *klass);
static void gimp_data_init (GimpData *data);
static void gimp_data_destroy (GtkObject *object);
static void gimp_data_name_changed (GimpObject *object);
static void gimp_data_real_dirty (GimpData *data);
static guint data_signals[LAST_SIGNAL] = { 0 };
@ -109,12 +111,22 @@ gimp_data_class_init (GimpDataClass *klass)
gtk_marshal_BOOL__NONE,
GTK_TYPE_BOOL, 0);
data_signals[GET_EXTENSION] =
gtk_signal_new ("get_extension",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpDataClass,
get_extension),
gimp_marshal_POINTER__NONE,
GTK_TYPE_POINTER, 0);
object_class->destroy = gimp_data_destroy;
gimp_object_class->name_changed = gimp_data_name_changed;
klass->dirty = gimp_data_real_dirty;
klass->save = NULL;
klass->dirty = gimp_data_real_dirty;
klass->save = NULL;
klass->get_extension = NULL;
}
static void
@ -204,6 +216,20 @@ gimp_data_delete_from_disk (GimpData *data)
return TRUE;
}
const gchar *
gimp_data_get_extension (GimpData *data)
{
const gchar *extension = NULL;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA (data), NULL);
gtk_signal_emit (GTK_OBJECT (data), data_signals[GET_EXTENSION],
&extension);
return extension;
}
void
gimp_data_set_filename (GimpData *data,
const gchar *filename)
@ -219,7 +245,6 @@ gimp_data_set_filename (GimpData *data,
void
gimp_data_create_filename (GimpData *data,
const gchar *basename,
const gchar *extension,
const gchar *data_path)
{
GList *path;
@ -233,7 +258,6 @@ gimp_data_create_filename (GimpData *data,
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_DATA (data));
g_return_if_fail (basename != NULL);
g_return_if_fail (extension != NULL);
g_return_if_fail (data_path != NULL);
path = gimp_path_parse (data_path, 16, TRUE, NULL);
@ -250,14 +274,18 @@ gimp_data_create_filename (GimpData *data,
if (safe_name[i] == G_DIR_SEPARATOR || isspace (safe_name[i]))
safe_name[i] = '_';
filename = g_strdup_printf ("%s%s%s", dir, safe_name, extension);
filename = g_strdup_printf ("%s%s%s",
dir, safe_name,
gimp_data_get_extension (data));
while ((file = fopen (filename, "r")))
{
fclose (file);
g_free (filename);
filename = g_strdup_printf ("%s%s_%d%s", dir, safe_name, unum, extension);
filename = g_strdup_printf ("%s%s_%d%s",
dir, safe_name, unum,
gimp_data_get_extension (data));
unum++;
}

View File

@ -44,24 +44,26 @@ struct _GimpDataClass
{
GimpViewableClass parent_class;
void (* dirty) (GimpData *data);
gboolean (* save) (GimpData *data);
void (* dirty) (GimpData *data);
gboolean (* save) (GimpData *data);
gchar * (* get_extension) (GimpData *data);
};
GtkType gimp_data_get_type (void);
GtkType gimp_data_get_type (void);
gboolean gimp_data_save (GimpData *data);
gboolean gimp_data_save (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *extension,
const gchar *data_path);
const gchar * gimp_data_get_extension (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *data_path);
#endif /* __GIMP_DATA_H__ */

150
app/core/gimpdatafactory.c Normal file
View File

@ -0,0 +1,150 @@
/* 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 "apptypes.h"
#include "gimpdata.h"
#include "gimpdatalist.h"
#include "gimpdatafactory.h"
#include "gimpcontext.h"
#include "gimpmarshal.h"
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
static void gimp_data_factory_init (GimpDataFactory *factory);
static void gimp_data_factory_destroy (GtkObject *object);
static GimpObjectClass *parent_class = NULL;
GtkType
gimp_data_factory_get_type (void)
{
static guint factory_type = 0;
if (! factory_type)
{
GtkTypeInfo factory_info =
{
"GimpDataFactory",
sizeof (GimpDataFactory),
sizeof (GimpDataFactoryClass),
(GtkClassInitFunc) gimp_data_factory_class_init,
(GtkObjectInitFunc) gimp_data_factory_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
factory_type = gtk_type_unique (GIMP_TYPE_OBJECT, &factory_info);
}
return factory_type;
}
static void
gimp_data_factory_class_init (GimpDataFactoryClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = gtk_type_class (GTK_TYPE_VBOX);
object_class->destroy = gimp_data_factory_destroy;
}
static void
gimp_data_factory_init (GimpDataFactory *factory)
{
factory->container = NULL;
factory->data_path = NULL;
factory->new_default_data_func = NULL;
factory->new_standard_data_func = NULL;
}
static void
gimp_data_factory_destroy (GtkObject *object)
{
GimpDataFactory *factory;
factory = GIMP_DATA_FACTORY (object);
if (factory->container)
gtk_object_unref (GTK_OBJECT (factory->container));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GimpDataFactory *
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func)
{
GimpDataFactory *factory;
g_return_val_if_fail (gtk_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
g_return_val_if_fail (data_path != NULL, NULL);
g_return_val_if_fail (default_func != NULL, NULL);
g_return_val_if_fail (standard_func != NULL, NULL);
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
factory->container = GIMP_CONTAINER (gimp_data_list_new (data_type));
gtk_object_ref (GTK_OBJECT (factory->container));
gtk_object_sink (GTK_OBJECT (factory->container));
factory->data_path = data_path;
factory->new_default_data_func = default_func;
factory->new_standard_data_func = standard_func;
return factory;
}
void
gimp_data_factory_data_init (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
}
void
gimp_data_factory_data_free (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
return;
if (! (factory->data_path && *factory->data_path))
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (factory->container),
*factory->data_path);
}

View File

@ -0,0 +1,67 @@
/* 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 __GIMP_DATA_FACTORY_H__
#define __GIMP_DATA_FACTORY_H__
#include "gimpobject.h"
typedef GimpData * (* GimpDataNewDefaultFunc) (const gchar *name);
typedef GimpData * (* GimpDataNewStandardFunc) (void);
#define GIMP_TYPE_DATA_FACTORY (gimp_data_factory_get_type ())
#define GIMP_DATA_FACTORY(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DATA_FACTORY, GimpDataFactory))
#define GIMP_DATA_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_FACTORY, GimpDataFactoryClass))
#define GIMP_IS_DATA_FACTORY(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DATA_FACTORY))
#define GIMP_IS_DATA_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY))
typedef struct _GimpDataFactoryClass GimpDataFactoryClass;
struct _GimpDataFactory
{
GimpObject *object;
GimpContainer *container;
const gchar **data_path;
GimpDataNewDefaultFunc new_default_data_func;
GimpDataNewStandardFunc new_standard_data_func;
};
struct _GimpDataFactoryClass
{
GimpObjectClass parent_class;
};
GtkType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func);
void gimp_data_factory_data_init (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
#endif /* __GIMP_DATA_FACTORY_H__ */

View File

@ -265,8 +265,7 @@ gimp_data_list_load (GimpDataList *data_list,
void
gimp_data_list_save_and_clear (GimpDataList *data_list,
const gchar *data_path,
const gchar *extension)
const gchar *data_path)
{
GimpList *list;
@ -286,7 +285,6 @@ gimp_data_list_save_and_clear (GimpDataList *data_list,
if (! data->filename)
gimp_data_create_filename (data,
GIMP_OBJECT (data)->name,
extension,
data_path);
if (data->dirty)

View File

@ -53,8 +53,7 @@ void gimp_data_list_load (GimpDataList *data_list,
...);
void gimp_data_list_save_and_clear (GimpDataList *data_list,
const gchar *data_path,
const gchar *extension);
const gchar *data_path);
#endif /* __GIMP_DATA_LIST_H__ */

View File

@ -52,6 +52,7 @@ static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_gradient_dirty (GimpData *data);
static gboolean gimp_gradient_save (GimpData *data);
static gchar * gimp_gradient_get_extension (GimpData *data);
static gdouble gimp_gradient_calc_linear_factor (gdouble middle,
gdouble pos);
@ -110,8 +111,9 @@ gimp_gradient_class_init (GimpGradientClass *klass)
viewable_class->get_new_preview = gimp_gradient_get_new_preview;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->get_extension = gimp_gradient_get_extension;
}
static void
@ -226,6 +228,22 @@ gimp_gradient_new (const gchar *name)
return gradient;
}
GimpGradient *
gimp_gradient_get_standard (void)
{
static GimpGradient *standard_gradient = NULL;
if (! standard_gradient)
{
standard_gradient = gimp_gradient_new ("Standard");
gtk_object_ref (GTK_OBJECT (standard_gradient));
gtk_object_sink (GTK_OBJECT (standard_gradient));
}
return standard_gradient;
}
GimpGradient *
gimp_gradient_load (const gchar *filename)
{
@ -405,6 +423,12 @@ gimp_gradient_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_gradient_get_extension (GimpData *data)
{
return GIMP_GRADIENT_FILE_EXTENSION;
}
void
gimp_gradient_get_color_at (GimpGradient *gradient,
gdouble pos,

View File

@ -86,6 +86,8 @@ struct _GimpGradientClass
GtkType gimp_gradient_get_type (void);
GimpGradient * gimp_gradient_new (const gchar *name);
GimpGradient * gimp_gradient_get_standard (void);
GimpGradient * gimp_gradient_load (const gchar *filename);
void gimp_gradient_get_color_at (GimpGradient *gradient,

View File

@ -103,6 +103,7 @@
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpdatafactory.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplist.h"
@ -793,7 +794,7 @@ build_palette_button (void)
UserHasWebPal = FALSE;
list = GIMP_LIST (global_palette_list)->list;
list = GIMP_LIST (global_palette_factory->container)->list;
if (! list)
{
@ -835,7 +836,7 @@ build_palette_button (void)
}
else
{
for (i = 0, list = GIMP_LIST (global_palette_list)->list;
for (i = 0, list = GIMP_LIST (global_palette_factory->container)->list;
list && default_palette == -1;
i++, list = g_list_next (list))
{

View File

@ -51,6 +51,7 @@ static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_palette_dirty (GimpData *data);
static gboolean gimp_palette_save (GimpData *data);
static gchar * gimp_palette_get_extension (GimpData *data);
static void gimp_palette_entry_free (GimpPaletteEntry *entry);
@ -102,8 +103,9 @@ gimp_palette_class_init (GimpPaletteClass *klass)
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -230,6 +232,21 @@ gimp_palette_new (const gchar *name)
return palette;
}
GimpPalette *
gimp_palette_get_standard (void)
{
static GimpPalette *standard_palette = NULL;
if (! standard_palette)
{
standard_palette = GIMP_PALETTE (gtk_type_new (GIMP_TYPE_PALETTE));
gimp_object_set_name (GIMP_OBJECT (standard_palette), "Standard");
}
return standard_palette;
}
GimpPalette *
gimp_palette_load (const gchar *filename)
{
@ -460,6 +477,12 @@ gimp_palette_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_palette_get_extension (GimpData *data)
{
return GIMP_PALETTE_FILE_EXTENSION;
}
GimpPaletteEntry *
gimp_palette_add_entry (GimpPalette *palette,
const gchar *name,

View File

@ -51,6 +51,7 @@ static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_palette_dirty (GimpData *data);
static gboolean gimp_palette_save (GimpData *data);
static gchar * gimp_palette_get_extension (GimpData *data);
static void gimp_palette_entry_free (GimpPaletteEntry *entry);
@ -102,8 +103,9 @@ gimp_palette_class_init (GimpPaletteClass *klass)
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -230,6 +232,21 @@ gimp_palette_new (const gchar *name)
return palette;
}
GimpPalette *
gimp_palette_get_standard (void)
{
static GimpPalette *standard_palette = NULL;
if (! standard_palette)
{
standard_palette = GIMP_PALETTE (gtk_type_new (GIMP_TYPE_PALETTE));
gimp_object_set_name (GIMP_OBJECT (standard_palette), "Standard");
}
return standard_palette;
}
GimpPalette *
gimp_palette_load (const gchar *filename)
{
@ -460,6 +477,12 @@ gimp_palette_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_palette_get_extension (GimpData *data)
{
return GIMP_PALETTE_FILE_EXTENSION;
}
GimpPaletteEntry *
gimp_palette_add_entry (GimpPalette *palette,
const gchar *name,

View File

@ -51,6 +51,7 @@ static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_palette_dirty (GimpData *data);
static gboolean gimp_palette_save (GimpData *data);
static gchar * gimp_palette_get_extension (GimpData *data);
static void gimp_palette_entry_free (GimpPaletteEntry *entry);
@ -102,8 +103,9 @@ gimp_palette_class_init (GimpPaletteClass *klass)
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -230,6 +232,21 @@ gimp_palette_new (const gchar *name)
return palette;
}
GimpPalette *
gimp_palette_get_standard (void)
{
static GimpPalette *standard_palette = NULL;
if (! standard_palette)
{
standard_palette = GIMP_PALETTE (gtk_type_new (GIMP_TYPE_PALETTE));
gimp_object_set_name (GIMP_OBJECT (standard_palette), "Standard");
}
return standard_palette;
}
GimpPalette *
gimp_palette_load (const gchar *filename)
{
@ -460,6 +477,12 @@ gimp_palette_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_palette_get_extension (GimpData *data)
{
return GIMP_PALETTE_FILE_EXTENSION;
}
GimpPaletteEntry *
gimp_palette_add_entry (GimpPalette *palette,
const gchar *name,

View File

@ -69,6 +69,8 @@ struct _GimpPaletteClass
GtkType gimp_palette_get_type (void);
GimpPalette * gimp_palette_new (const gchar *name);
GimpPalette * gimp_palette_get_standard (void);
GimpPalette * gimp_palette_load (const gchar *filename);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,

View File

@ -58,6 +58,7 @@ static void gimp_pattern_destroy (GtkObject *object);
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_pattern_get_extension (GimpData *data);
static GimpDataClass *parent_class = NULL;
@ -93,15 +94,19 @@ gimp_pattern_class_init (GimpPatternClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
object_class->destroy = gimp_pattern_destroy;
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
data_class->get_extension = gimp_pattern_get_extension;
}
static void
@ -157,6 +162,73 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
return temp_buf;
}
static gchar *
gimp_pattern_get_extension (GimpData *data)
{
return GIMP_PATTERN_FILE_EXTENSION;
}
GimpPattern *
gimp_pattern_new (const gchar *name)
{
GimpPattern *pattern;
guchar *data;
gint row, col;
g_return_val_if_fail (name != NULL, NULL);
pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (pattern), name);
pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (pattern->mask);
for (row = 0; row < pattern->mask->height; row++)
for (col = 0; col < pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
return pattern;
}
GimpPattern *
gimp_pattern_get_standard (void)
{
static GimpPattern *standard_pattern = NULL;
if (! standard_pattern)
{
guchar *data;
gint row, col;
standard_pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (standard_pattern), "Standard");
standard_pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (standard_pattern->mask);
for (row = 0; row < standard_pattern->mask->height; row++)
for (col = 0; col < standard_pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
/* set ref_count to 2 --> never swap the standard pattern */
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_sink (GTK_OBJECT (standard_pattern));
}
return standard_pattern;
}
GimpPattern *
gimp_pattern_load (const gchar *filename)
{

View File

@ -58,6 +58,7 @@ static void gimp_pattern_destroy (GtkObject *object);
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_pattern_get_extension (GimpData *data);
static GimpDataClass *parent_class = NULL;
@ -93,15 +94,19 @@ gimp_pattern_class_init (GimpPatternClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
object_class->destroy = gimp_pattern_destroy;
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
data_class->get_extension = gimp_pattern_get_extension;
}
static void
@ -157,6 +162,73 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
return temp_buf;
}
static gchar *
gimp_pattern_get_extension (GimpData *data)
{
return GIMP_PATTERN_FILE_EXTENSION;
}
GimpPattern *
gimp_pattern_new (const gchar *name)
{
GimpPattern *pattern;
guchar *data;
gint row, col;
g_return_val_if_fail (name != NULL, NULL);
pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (pattern), name);
pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (pattern->mask);
for (row = 0; row < pattern->mask->height; row++)
for (col = 0; col < pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
return pattern;
}
GimpPattern *
gimp_pattern_get_standard (void)
{
static GimpPattern *standard_pattern = NULL;
if (! standard_pattern)
{
guchar *data;
gint row, col;
standard_pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (standard_pattern), "Standard");
standard_pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (standard_pattern->mask);
for (row = 0; row < standard_pattern->mask->height; row++)
for (col = 0; col < standard_pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
/* set ref_count to 2 --> never swap the standard pattern */
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_sink (GTK_OBJECT (standard_pattern));
}
return standard_pattern;
}
GimpPattern *
gimp_pattern_load (const gchar *filename)
{

View File

@ -48,10 +48,14 @@ struct _GimpPatternClass
};
GtkType gimp_pattern_get_type (void);
GimpPattern * gimp_pattern_load (const gchar *filename);
GtkType gimp_pattern_get_type (void);
GimpPattern * gimp_pattern_new (const gchar *name);
TempBuf * gimp_pattern_get_mask (const GimpPattern *pattern);
GimpPattern * gimp_pattern_get_standard (void);
GimpPattern * gimp_pattern_load (const gchar *filename);
TempBuf * gimp_pattern_get_mask (const GimpPattern *pattern);
#endif /* __GIMP_PATTERN_H__ */

View File

@ -35,6 +35,7 @@
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimppattern.h"
@ -131,13 +132,13 @@ static void device_status_foreground_changed (GtkWidget *widget,
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data);
static void device_status_data_changed (GimpContext *context,
@ -470,7 +471,7 @@ devices_rc_update (gchar *name,
GimpBrush *brush;
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (brush)
@ -489,7 +490,7 @@ devices_rc_update (gchar *name,
GimpPattern *pattern;
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (pattern)
@ -508,7 +509,7 @@ devices_rc_update (gchar *name,
GimpGradient *gradient;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (gradient)
@ -1202,9 +1203,9 @@ device_status_background_changed (GtkWidget *widget,
}
static void
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
device_status_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1212,14 +1213,14 @@ device_status_drop_brush (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_brush (device_info->context, brush);
gimp_context_set_brush (device_info->context, GIMP_BRUSH (viewable));
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
device_status_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1227,13 +1228,13 @@ device_status_drop_pattern (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
gimp_context_set_pattern (device_info->context, GIMP_PATTERN (viewable));
}
}
static void
device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1242,7 +1243,7 @@ device_status_drop_gradient (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_gradient (device_info->context, gradient);
gimp_context_set_gradient (device_info->context, GIMP_GRADIENT (viewable));
}
}

View File

@ -31,6 +31,7 @@
#include "gimage.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimppalette.h"
@ -570,7 +571,8 @@ palette_import_create_from_grad (gchar *name)
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -755,7 +757,7 @@ palette_import_image_make_palette (GHashTable *h_array,
g_hash_table_destroy (h_array);
g_slist_free (sorted_list);
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -871,7 +873,7 @@ palette_import_create_from_indexed (GImage *gimage,
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}

View File

@ -137,7 +137,6 @@ static gchar * old_swap_path;
static gchar * old_plug_in_path;
static gchar * old_module_path;
static gchar * old_brush_path;
static gchar * old_brush_vbr_path;
static gchar * old_pattern_path;
static gchar * old_palette_path;
static gchar * old_gradient_path;
@ -172,7 +171,6 @@ static gboolean edit_disable_tearoff_menus;
static gchar * edit_temp_path = NULL;
static gchar * edit_swap_path = NULL;
static gchar * edit_brush_path = NULL;
static gchar * edit_brush_vbr_path = NULL;
static gchar * edit_pattern_path = NULL;
static gchar * edit_palette_path = NULL;
static gchar * edit_gradient_path = NULL;
@ -350,7 +348,6 @@ prefs_check_settings (void)
prefs_strcmp (old_temp_path, edit_temp_path) ||
prefs_strcmp (old_swap_path, edit_swap_path) ||
prefs_strcmp (old_brush_path, edit_brush_path) ||
prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path) ||
prefs_strcmp (old_pattern_path, edit_pattern_path) ||
prefs_strcmp (old_palette_path, edit_palette_path) ||
prefs_strcmp (old_gradient_path, edit_gradient_path) ||
@ -482,7 +479,6 @@ prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
@ -530,7 +526,6 @@ prefs_save_callback (GtkWidget *widget,
save_temp_path = temp_path;
save_swap_path = swap_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
@ -778,11 +773,6 @@ prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
update = g_list_append (update, "brush-path");
}
if (prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path))
{
brush_vbr_path = edit_brush_vbr_path;
update = g_list_append (update, "brush-vbr-path");
}
if (prefs_strcmp (old_pattern_path, edit_pattern_path))
{
pattern_path = edit_pattern_path;
@ -836,7 +826,6 @@ prefs_save_callback (GtkWidget *widget,
temp_path = save_temp_path;
swap_path = save_swap_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
@ -937,7 +926,6 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_strset (&edit_temp_path, old_temp_path);
prefs_strset (&edit_swap_path, old_swap_path);
prefs_strset (&edit_brush_path, old_brush_path);
prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
prefs_strset (&edit_pattern_path, old_pattern_path);
prefs_strset (&edit_palette_path, old_palette_path);
prefs_strset (&edit_gradient_path, old_gradient_path);
@ -1416,7 +1404,6 @@ prefs_cmd_callback (GtkWidget *widget,
edit_plug_in_path = prefs_strdup (plug_in_path);
edit_module_path = prefs_strdup (module_path);
edit_brush_path = prefs_strdup (brush_path);
edit_brush_vbr_path = prefs_strdup (brush_vbr_path);
edit_pattern_path = prefs_strdup (pattern_path);
edit_palette_path = prefs_strdup (palette_path);
edit_gradient_path = prefs_strdup (gradient_path);
@ -1486,7 +1473,6 @@ prefs_cmd_callback (GtkWidget *widget,
prefs_strset (&old_plug_in_path, edit_plug_in_path);
prefs_strset (&old_module_path, edit_module_path);
prefs_strset (&old_brush_path, edit_brush_path);
prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
prefs_strset (&old_pattern_path, edit_pattern_path);
prefs_strset (&old_palette_path, edit_palette_path);
prefs_strset (&old_gradient_path, edit_gradient_path);
@ -2570,10 +2556,6 @@ prefs_cmd_callback (GtkWidget *widget,
"dialogs/preferences/directories.html#brushes",
N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"),
"dialogs/preferences/directories.html#generated_brushes",
N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"),
"dialogs/preferences/directories.html#patterns",
N_("Select Patterns Dir"),

View File

@ -46,6 +46,7 @@
#include "brush_header.h"
#include "brush_scale.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
@ -62,6 +63,7 @@ static void gimp_brush_destroy (GtkObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static GimpBrush * gimp_brush_select_brush (PaintCore *paint_core);
static gboolean gimp_brush_want_null_motion (PaintCore *paint_core);
@ -99,9 +101,11 @@ gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
@ -109,6 +113,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
viewable_class->get_new_preview = gimp_brush_get_new_preview;
data_class->get_extension = gimp_brush_get_extension;
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
}
@ -249,6 +255,47 @@ gimp_brush_get_new_preview (GimpViewable *viewable,
return return_buf;
}
static gchar *
gimp_brush_get_extension (GimpData *data)
{
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpBrush *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
g_return_val_if_fail (name != NULL, NULL);
brush = GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (brush), name);
return brush;
}
GimpBrush *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
if (! standard_brush)
{
standard_brush =
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
/* set ref_count to 2 --> never swap the standard brush */
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return standard_brush;
}
GimpBrush *
gimp_brush_load (const gchar *filename)
{

View File

@ -58,18 +58,22 @@ struct _GimpBrushClass
};
GtkType gimp_brush_get_type (void);
GimpBrush * gimp_brush_load (const gchar *filename);
GtkType gimp_brush_get_type (void);
GimpBrush * gimp_brush_new (const gchar *name);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
GimpBrush * gimp_brush_get_standard (void);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
GimpBrush * gimp_brush_load (const gchar *filename);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
#endif /* __GIMP_BRUSH_H__ */

View File

@ -53,6 +53,7 @@ static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpBrushClass *parent_class = NULL;
@ -96,8 +97,9 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
}
static void
@ -164,6 +166,12 @@ gimp_brush_generated_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_brush_generated_get_extension (GimpData *data)
{
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static double
gauss (gdouble f)
{

View File

@ -26,21 +26,18 @@
#include "apptypes.h"
#include "brushes.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimpmarshal.h"
#include "gimppalette.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "temp_buf.h"
@ -719,38 +716,46 @@ gimp_context_new (const gchar *name,
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_brush_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_brush_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_brush_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_pattern_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_pattern_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_pattern_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_gradient_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_gradient_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_gradient_list_thaw),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "remove",
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_factory->container),
"remove",
GTK_SIGNAL_FUNC (gimp_context_palette_removed),
context,
GTK_OBJECT (context));
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_list), "thaw",
gtk_signal_connect_while_alive (GTK_OBJECT (global_palette_factory->container),
"thaw",
GTK_SIGNAL_FUNC (gimp_context_palette_list_thaw),
context,
GTK_OBJECT (context));
@ -1606,7 +1611,7 @@ gimp_context_brush_list_thaw (GimpContainer *container,
gimp_context_real_set_brush
(context, GIMP_BRUSH (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_brush (context, brushes_get_standard_brush ());
gimp_context_real_set_brush (context, gimp_brush_get_standard ());
}
/* the active brush disappeared */
@ -1634,7 +1639,7 @@ gimp_context_real_set_brush (GimpContext *context,
GimpBrush *brush)
{
if (! standard_brush)
standard_brush = brushes_get_standard_brush ();
standard_brush = gimp_brush_get_standard ();
if (context->brush == brush)
return;
@ -1773,7 +1778,7 @@ gimp_context_pattern_list_thaw (GimpContainer *container,
(context,
GIMP_PATTERN (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_pattern (context, patterns_get_standard_pattern ());
gimp_context_real_set_pattern (context, gimp_pattern_get_standard ());
}
/* the active pattern disappeared */
@ -1801,7 +1806,7 @@ gimp_context_real_set_pattern (GimpContext *context,
GimpPattern *pattern)
{
if (! standard_pattern)
standard_pattern = patterns_get_standard_pattern ();
standard_pattern = gimp_pattern_get_standard ();
if (context->pattern == pattern)
return;
@ -1937,7 +1942,7 @@ gimp_context_gradient_list_thaw (GimpContainer *container,
(context,
GIMP_GRADIENT (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_gradient (context, gradients_get_standard_gradient ());
gimp_context_real_set_gradient (context, gimp_gradient_get_standard ());
}
/* the active gradient disappeared */
@ -1965,7 +1970,7 @@ gimp_context_real_set_gradient (GimpContext *context,
GimpGradient *gradient)
{
if (! standard_gradient)
standard_gradient = gradients_get_standard_gradient ();
standard_gradient = gimp_gradient_get_standard ();
if (context->gradient == gradient)
return;
@ -2086,7 +2091,7 @@ gimp_context_palette_list_thaw (GimpContainer *container,
(context,
GIMP_PALETTE (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_real_set_palette (context, palettes_get_standard_palette ());
gimp_context_real_set_palette (context, gimp_palette_get_standard ());
}
/* the active palette disappeared */
@ -2114,7 +2119,7 @@ gimp_context_real_set_palette (GimpContext *context,
GimpPalette *palette)
{
if (! standard_palette)
standard_palette = palettes_get_standard_palette ();
standard_palette = gimp_palette_get_standard ();
if (context->palette == palette)
return;

View File

@ -31,6 +31,7 @@
#include "apptypes.h"
#include "gimpdata.h"
#include "gimpmarshal.h"
#include "libgimp/gimpenv.h"
@ -39,15 +40,16 @@ enum
{
DIRTY,
SAVE,
GET_EXTENSION,
LAST_SIGNAL
};
static void gimp_data_class_init (GimpDataClass *klass);
static void gimp_data_init (GimpData *data);
static void gimp_data_destroy (GtkObject *object);
static void gimp_data_name_changed (GimpObject *object);
static void gimp_data_real_dirty (GimpData *data);
static void gimp_data_class_init (GimpDataClass *klass);
static void gimp_data_init (GimpData *data);
static void gimp_data_destroy (GtkObject *object);
static void gimp_data_name_changed (GimpObject *object);
static void gimp_data_real_dirty (GimpData *data);
static guint data_signals[LAST_SIGNAL] = { 0 };
@ -109,12 +111,22 @@ gimp_data_class_init (GimpDataClass *klass)
gtk_marshal_BOOL__NONE,
GTK_TYPE_BOOL, 0);
data_signals[GET_EXTENSION] =
gtk_signal_new ("get_extension",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GimpDataClass,
get_extension),
gimp_marshal_POINTER__NONE,
GTK_TYPE_POINTER, 0);
object_class->destroy = gimp_data_destroy;
gimp_object_class->name_changed = gimp_data_name_changed;
klass->dirty = gimp_data_real_dirty;
klass->save = NULL;
klass->dirty = gimp_data_real_dirty;
klass->save = NULL;
klass->get_extension = NULL;
}
static void
@ -204,6 +216,20 @@ gimp_data_delete_from_disk (GimpData *data)
return TRUE;
}
const gchar *
gimp_data_get_extension (GimpData *data)
{
const gchar *extension = NULL;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA (data), NULL);
gtk_signal_emit (GTK_OBJECT (data), data_signals[GET_EXTENSION],
&extension);
return extension;
}
void
gimp_data_set_filename (GimpData *data,
const gchar *filename)
@ -219,7 +245,6 @@ gimp_data_set_filename (GimpData *data,
void
gimp_data_create_filename (GimpData *data,
const gchar *basename,
const gchar *extension,
const gchar *data_path)
{
GList *path;
@ -233,7 +258,6 @@ gimp_data_create_filename (GimpData *data,
g_return_if_fail (data != NULL);
g_return_if_fail (GIMP_IS_DATA (data));
g_return_if_fail (basename != NULL);
g_return_if_fail (extension != NULL);
g_return_if_fail (data_path != NULL);
path = gimp_path_parse (data_path, 16, TRUE, NULL);
@ -250,14 +274,18 @@ gimp_data_create_filename (GimpData *data,
if (safe_name[i] == G_DIR_SEPARATOR || isspace (safe_name[i]))
safe_name[i] = '_';
filename = g_strdup_printf ("%s%s%s", dir, safe_name, extension);
filename = g_strdup_printf ("%s%s%s",
dir, safe_name,
gimp_data_get_extension (data));
while ((file = fopen (filename, "r")))
{
fclose (file);
g_free (filename);
filename = g_strdup_printf ("%s%s_%d%s", dir, safe_name, unum, extension);
filename = g_strdup_printf ("%s%s_%d%s",
dir, safe_name, unum,
gimp_data_get_extension (data));
unum++;
}

View File

@ -44,24 +44,26 @@ struct _GimpDataClass
{
GimpViewableClass parent_class;
void (* dirty) (GimpData *data);
gboolean (* save) (GimpData *data);
void (* dirty) (GimpData *data);
gboolean (* save) (GimpData *data);
gchar * (* get_extension) (GimpData *data);
};
GtkType gimp_data_get_type (void);
GtkType gimp_data_get_type (void);
gboolean gimp_data_save (GimpData *data);
gboolean gimp_data_save (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *extension,
const gchar *data_path);
const gchar * gimp_data_get_extension (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *data_path);
#endif /* __GIMP_DATA_H__ */

View File

@ -1,74 +0,0 @@
/* 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 __GIMP_DATA_CONTAINER_VIEW_H__
#define __GIMP_DATA_CONTAINER_VIEW_H__
#include <gtk/gtkvbox.h>
typedef enum
{
GIMP_VIEW_TYPE_GRID,
GIMP_VIEW_TYPE_LIST
} GimpViewType;
#define GIMP_TYPE_DATA_CONTAINER_VIEW (gimp_data_container_view_get_type ())
#define GIMP_DATA_CONTAINER_VIEW(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DATA_CONTAINER_VIEW, GimpDataContainerView))
#define GIMP_DATA_CONTAINER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_CONTAINER_VIEW, GimpDataContainerViewClass))
#define GIMP_IS_DATA_CONTAINER_VIEW(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DATA_CONTAINER_VIEW))
#define GIMP_IS_DATA_CONTAINER_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_CONTAINER_VIEW))
typedef struct _GimpDataContainerView GimpDataContainerView;
typedef struct _GimpDataContainerViewClass GimpDataContainerViewClass;
struct _GimpDataContainerView
{
GtkVBox parent_instance;
GimpContainerView *view;
GtkWidget *button_box;
GtkWidget *new_button;
GtkWidget *duplicate_button;
GtkWidget *edit_button;
GtkWidget *delete_button;
GtkWidget *refresh_button;
};
struct _GimpDataContainerViewClass
{
GtkVBoxClass parent_class;
};
GtkType gimp_data_container_view_get_type (void);
GtkWidget * gimp_data_container_view_new (GimpViewType view_type,
GimpContainer *container,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
#endif /* __GIMP_DATA_CONTAINER_VIEW_H__ */

150
app/gimpdatafactory.c Normal file
View File

@ -0,0 +1,150 @@
/* 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 "apptypes.h"
#include "gimpdata.h"
#include "gimpdatalist.h"
#include "gimpdatafactory.h"
#include "gimpcontext.h"
#include "gimpmarshal.h"
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
static void gimp_data_factory_init (GimpDataFactory *factory);
static void gimp_data_factory_destroy (GtkObject *object);
static GimpObjectClass *parent_class = NULL;
GtkType
gimp_data_factory_get_type (void)
{
static guint factory_type = 0;
if (! factory_type)
{
GtkTypeInfo factory_info =
{
"GimpDataFactory",
sizeof (GimpDataFactory),
sizeof (GimpDataFactoryClass),
(GtkClassInitFunc) gimp_data_factory_class_init,
(GtkObjectInitFunc) gimp_data_factory_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
factory_type = gtk_type_unique (GIMP_TYPE_OBJECT, &factory_info);
}
return factory_type;
}
static void
gimp_data_factory_class_init (GimpDataFactoryClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = gtk_type_class (GTK_TYPE_VBOX);
object_class->destroy = gimp_data_factory_destroy;
}
static void
gimp_data_factory_init (GimpDataFactory *factory)
{
factory->container = NULL;
factory->data_path = NULL;
factory->new_default_data_func = NULL;
factory->new_standard_data_func = NULL;
}
static void
gimp_data_factory_destroy (GtkObject *object)
{
GimpDataFactory *factory;
factory = GIMP_DATA_FACTORY (object);
if (factory->container)
gtk_object_unref (GTK_OBJECT (factory->container));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GimpDataFactory *
gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func)
{
GimpDataFactory *factory;
g_return_val_if_fail (gtk_type_is_a (data_type, GIMP_TYPE_DATA), NULL);
g_return_val_if_fail (data_path != NULL, NULL);
g_return_val_if_fail (default_func != NULL, NULL);
g_return_val_if_fail (standard_func != NULL, NULL);
factory = gtk_type_new (GIMP_TYPE_DATA_FACTORY);
factory->container = GIMP_CONTAINER (gimp_data_list_new (data_type));
gtk_object_ref (GTK_OBJECT (factory->container));
gtk_object_sink (GTK_OBJECT (factory->container));
factory->data_path = data_path;
factory->new_default_data_func = default_func;
factory->new_standard_data_func = standard_func;
return factory;
}
void
gimp_data_factory_data_init (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
}
void
gimp_data_factory_data_free (GimpDataFactory *factory)
{
g_return_if_fail (factory != NULL);
g_return_if_fail (GIMP_IS_DATA_FACTORY (factory));
if (gimp_container_num_children (factory->container) == 0)
return;
if (! (factory->data_path && *factory->data_path))
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (factory->container),
*factory->data_path);
}

67
app/gimpdatafactory.h Normal file
View File

@ -0,0 +1,67 @@
/* 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 __GIMP_DATA_FACTORY_H__
#define __GIMP_DATA_FACTORY_H__
#include "gimpobject.h"
typedef GimpData * (* GimpDataNewDefaultFunc) (const gchar *name);
typedef GimpData * (* GimpDataNewStandardFunc) (void);
#define GIMP_TYPE_DATA_FACTORY (gimp_data_factory_get_type ())
#define GIMP_DATA_FACTORY(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DATA_FACTORY, GimpDataFactory))
#define GIMP_DATA_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_FACTORY, GimpDataFactoryClass))
#define GIMP_IS_DATA_FACTORY(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DATA_FACTORY))
#define GIMP_IS_DATA_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY))
typedef struct _GimpDataFactoryClass GimpDataFactoryClass;
struct _GimpDataFactory
{
GimpObject *object;
GimpContainer *container;
const gchar **data_path;
GimpDataNewDefaultFunc new_default_data_func;
GimpDataNewStandardFunc new_standard_data_func;
};
struct _GimpDataFactoryClass
{
GimpObjectClass parent_class;
};
GtkType gimp_data_factory_get_type (void);
GimpDataFactory * gimp_data_factory_new (GtkType data_type,
const gchar **data_path,
GimpDataNewDefaultFunc default_func,
GimpDataNewStandardFunc standard_func);
void gimp_data_factory_data_init (GimpDataFactory *factory);
void gimp_data_factory_data_free (GimpDataFactory *factory);
#endif /* __GIMP_DATA_FACTORY_H__ */

View File

@ -26,7 +26,8 @@
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpdatacontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpcontainergridview.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
@ -42,27 +43,27 @@
#include "pixmaps/refresh.xpm"
static void gimp_data_container_view_class_init (GimpDataContainerViewClass *klass);
static void gimp_data_container_view_init (GimpDataContainerView *view);
static void gimp_data_container_view_destroy (GtkObject *object);
static void gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass);
static void gimp_data_factory_view_init (GimpDataFactoryView *view);
static void gimp_data_factory_view_destroy (GtkObject *object);
static void gimp_data_container_view_new_clicked (GtkWidget *widget,
GimpDataContainerView *view);
static void gimp_data_container_view_duplicate_clicked (GtkWidget *widget,
GimpDataContainerView *view);
static void gimp_data_container_view_edit_clicked (GtkWidget *widget,
GimpDataContainerView *view);
static void gimp_data_container_view_delete_clicked (GtkWidget *widget,
GimpDataContainerView *view);
static void gimp_data_container_view_refresh_clicked (GtkWidget *widget,
GimpDataContainerView *view);
static void gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
GtkType
gimp_data_container_view_get_type (void)
gimp_data_factory_view_get_type (void)
{
static guint view_type = 0;
@ -70,11 +71,11 @@ gimp_data_container_view_get_type (void)
{
GtkTypeInfo view_info =
{
"GimpDataContainerView",
sizeof (GimpDataContainerView),
sizeof (GimpDataContainerViewClass),
(GtkClassInitFunc) gimp_data_container_view_class_init,
(GtkObjectInitFunc) gimp_data_container_view_init,
"GimpDataFactoryView",
sizeof (GimpDataFactoryView),
sizeof (GimpDataFactoryViewClass),
(GtkClassInitFunc) gimp_data_factory_view_class_init,
(GtkObjectInitFunc) gimp_data_factory_view_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
@ -87,7 +88,7 @@ gimp_data_container_view_get_type (void)
}
static void
gimp_data_container_view_class_init (GimpDataContainerViewClass *klass)
gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass)
{
GtkObjectClass *object_class;
@ -95,11 +96,11 @@ gimp_data_container_view_class_init (GimpDataContainerViewClass *klass)
parent_class = gtk_type_class (GTK_TYPE_VBOX);
object_class->destroy = gimp_data_container_view_destroy;
object_class->destroy = gimp_data_factory_view_destroy;
}
static void
gimp_data_container_view_init (GimpDataContainerView *view)
gimp_data_factory_view_init (GimpDataFactoryView *view)
{
GtkWidget *pixmap;
@ -121,7 +122,7 @@ gimp_data_container_view_init (GimpDataContainerView *view)
gimp_help_set_help_data (view->new_button, _("New"), NULL);
gtk_signal_connect (GTK_OBJECT (view->new_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_container_view_new_clicked),
GTK_SIGNAL_FUNC (gimp_data_factory_view_new_clicked),
view);
pixmap = gimp_pixmap_new (new_xpm);
@ -138,7 +139,7 @@ gimp_data_container_view_init (GimpDataContainerView *view)
gimp_help_set_help_data (view->duplicate_button, _("Duplicate"), NULL);
gtk_signal_connect (GTK_OBJECT (view->duplicate_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_container_view_duplicate_clicked),
GTK_SIGNAL_FUNC (gimp_data_factory_view_duplicate_clicked),
view);
pixmap = gimp_pixmap_new (duplicate_xpm);
@ -155,7 +156,7 @@ gimp_data_container_view_init (GimpDataContainerView *view)
gimp_help_set_help_data (view->edit_button, _("Edit"), NULL);
gtk_signal_connect (GTK_OBJECT (view->edit_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_container_view_edit_clicked),
GTK_SIGNAL_FUNC (gimp_data_factory_view_edit_clicked),
view);
pixmap = gimp_pixmap_new (pennorm_xpm);
@ -172,7 +173,7 @@ gimp_data_container_view_init (GimpDataContainerView *view)
gimp_help_set_help_data (view->delete_button, _("Delete"), NULL);
gtk_signal_connect (GTK_OBJECT (view->delete_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_container_view_delete_clicked),
GTK_SIGNAL_FUNC (gimp_data_factory_view_delete_clicked),
view);
pixmap = gimp_pixmap_new (delete_xpm);
@ -189,7 +190,7 @@ gimp_data_container_view_init (GimpDataContainerView *view)
gimp_help_set_help_data (view->refresh_button, _("Refresh"), NULL);
gtk_signal_connect (GTK_OBJECT (view->refresh_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_container_view_refresh_clicked),
GTK_SIGNAL_FUNC (gimp_data_factory_view_refresh_clicked),
view);
pixmap = gimp_pixmap_new (refresh_xpm);
@ -198,40 +199,41 @@ gimp_data_container_view_init (GimpDataContainerView *view)
}
static void
gimp_data_container_view_destroy (GtkObject *object)
gimp_data_factory_view_destroy (GtkObject *object)
{
GimpDataContainerView *view;
GimpDataFactoryView *view;
view = GIMP_DATA_CONTAINER_VIEW (object);
view = GIMP_DATA_FACTORY_VIEW (object);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GtkWidget *
gimp_data_container_view_new (GimpViewType view_type,
GimpContainer *container,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
{
GimpDataContainerView *data_view;
GimpDataFactoryView *factory_view;
g_return_val_if_fail (container != NULL, NULL);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (preview_size > 0 && preview_size <= 64, NULL);
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, NULL);
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, NULL);
data_view = gtk_type_new (GIMP_TYPE_DATA_CONTAINER_VIEW);
factory_view = gtk_type_new (GIMP_TYPE_DATA_FACTORY_VIEW);
factory_view->factory = factory;
switch (view_type)
{
case GIMP_VIEW_TYPE_GRID:
data_view->view =
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (container,
factory_view->view =
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (factory->container,
context,
preview_size,
min_items_x,
@ -239,8 +241,8 @@ gimp_data_container_view_new (GimpViewType view_type,
break;
case GIMP_VIEW_TYPE_LIST:
data_view->view =
GIMP_CONTAINER_VIEW (gimp_container_list_view_new (container,
factory_view->view =
GIMP_CONTAINER_VIEW (gimp_container_list_view_new (factory->container,
context,
preview_size,
min_items_x,
@ -249,47 +251,49 @@ gimp_data_container_view_new (GimpViewType view_type,
default:
g_warning ("%s(): unknown GimpViewType passed", G_GNUC_FUNCTION);
gtk_object_unref (GTK_OBJECT (data_view));
gtk_object_unref (GTK_OBJECT (factory_view));
return NULL;
}
gtk_container_add (GTK_CONTAINER (data_view), GTK_WIDGET (data_view->view));
gtk_widget_show (GTK_WIDGET (data_view->view));
gtk_container_add (GTK_CONTAINER (factory_view),
GTK_WIDGET (factory_view->view));
gtk_widget_show (GTK_WIDGET (factory_view->view));
return GTK_WIDGET (data_view);
return GTK_WIDGET (factory_view);
}
static void
gimp_data_container_view_new_clicked (GtkWidget *widget,
GimpDataContainerView *view)
gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("new %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->view->container->children_type)));
g_print ("new %s\n",
gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_container_view_duplicate_clicked (GtkWidget *widget,
GimpDataContainerView *view)
gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("duplicate %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->view->container->children_type)));
g_print ("duplicate %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_container_view_edit_clicked (GtkWidget *widget,
GimpDataContainerView *view)
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("edit %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->view->container->children_type)));
g_print ("edit %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_container_view_delete_clicked (GtkWidget *widget,
GimpDataContainerView *view)
gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("delete %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->view->container->children_type)));
g_print ("delete %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_container_view_refresh_clicked (GtkWidget *widget,
GimpDataContainerView *view)
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("refresh\n");
}

75
app/gimpdatafactoryview.h Normal file
View File

@ -0,0 +1,75 @@
/* 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 __GIMP_DATA_FACTORY_VIEW_H__
#define __GIMP_DATA_FACTORY_VIEW_H__
#include <gtk/gtkvbox.h>
typedef enum
{
GIMP_VIEW_TYPE_GRID,
GIMP_VIEW_TYPE_LIST
} GimpViewType;
#define GIMP_TYPE_DATA_FACTORY_VIEW (gimp_data_factory_view_get_type ())
#define GIMP_DATA_FACTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DATA_FACTORY_VIEW, GimpDataFactoryView))
#define GIMP_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_FACTORY_VIEW, GimpDataFactoryViewClass))
#define GIMP_IS_DATA_FACTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DATA_FACTORY_VIEW))
#define GIMP_IS_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY_VIEW))
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpDataFactoryViewClass GimpDataFactoryViewClass;
struct _GimpDataFactoryView
{
GtkVBox parent_instance;
GimpDataFactory *factory;
GimpContainerView *view;
GtkWidget *button_box;
GtkWidget *new_button;
GtkWidget *duplicate_button;
GtkWidget *edit_button;
GtkWidget *delete_button;
GtkWidget *refresh_button;
};
struct _GimpDataFactoryViewClass
{
GtkVBoxClass parent_class;
};
GtkType gimp_data_factory_view_get_type (void);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
#endif /* __GIMP_DATA_FACTORY_VIEW_H__ */

View File

@ -265,8 +265,7 @@ gimp_data_list_load (GimpDataList *data_list,
void
gimp_data_list_save_and_clear (GimpDataList *data_list,
const gchar *data_path,
const gchar *extension)
const gchar *data_path)
{
GimpList *list;
@ -286,7 +285,6 @@ gimp_data_list_save_and_clear (GimpDataList *data_list,
if (! data->filename)
gimp_data_create_filename (data,
GIMP_OBJECT (data)->name,
extension,
data_path);
if (data->dirty)

View File

@ -53,8 +53,7 @@ void gimp_data_list_load (GimpDataList *data_list,
...);
void gimp_data_list_save_and_clear (GimpDataList *data_list,
const gchar *data_path,
const gchar *extension);
const gchar *data_path);
#endif /* __GIMP_DATA_LIST_H__ */

View File

@ -28,11 +28,11 @@
#include "apptypes.h"
#include "context_manager.h"
#include "brushes.h"
#include "fileops.h"
#include "gimpimage.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpgradient.h"
@ -40,9 +40,6 @@
#include "gimppattern.h"
#include "gimppreview.h"
#include "gimprc.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "temp_buf.h"
#include "tools/tools.h"
@ -65,6 +62,7 @@ typedef enum
GIMP_DND_DATA_LAST = GIMP_DND_DATA_TOOL
} GimpDndDataType;
typedef GtkWidget * (* GimpDndGetIconFunc) (GtkWidget *widget,
GtkSignalFunc get_data_func,
gpointer get_data_data);
@ -80,6 +78,7 @@ typedef void (* GimpDndDropDataFunc) (GtkWidget *widget,
gint format,
gint length);
typedef struct _GimpDndDataDef GimpDndDataDef;
struct _GimpDndDataDef
@ -94,6 +93,7 @@ struct _GimpDndDataDef
GimpDndDropDataFunc set_data_func;
};
static GtkWidget * gimp_dnd_get_color_icon (GtkWidget *widget,
GtkSignalFunc get_color_func,
gpointer get_color_data);
@ -181,6 +181,7 @@ static void gimp_dnd_set_tool_data (GtkWidget *widget,
gint format,
gint length);
static GimpDndDataDef dnd_data_defs[] =
{
{
@ -261,6 +262,7 @@ static GimpDndDataDef dnd_data_defs[] =
}
};
/********************************/
/* general data dnd functions */
/********************************/
@ -511,6 +513,7 @@ gimp_dnd_data_dest_unset (GimpDndDataType data_type,
NULL);
}
/*************************/
/* color dnd functions */
/*************************/
@ -616,6 +619,7 @@ gimp_dnd_color_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_COLOR, widget);
}
/*********************************************/
/* GimpViewable (by GtkType) dnd functions */
/*********************************************/
@ -753,6 +757,7 @@ gimp_dnd_viewable_dest_unset (GtkWidget *widget,
}
}
/*************************/
/* brush dnd functions */
/*************************/
@ -821,10 +826,11 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
brush = gimp_brush_get_standard ();
else
brush = (GimpBrush *) gimp_container_get_child_by_name (global_brush_list,
name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (global_brush_factory->container,
name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -856,6 +862,7 @@ gimp_dnd_brush_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_BRUSH, widget);
}
/***************************/
/* pattern dnd functions */
/***************************/
@ -923,10 +930,11 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
pattern = gimp_pattern_get_standard ();
else
pattern = (GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_factory->container,
name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,
@ -959,6 +967,7 @@ gimp_dnd_pattern_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_PATTERN, widget);
}
/****************************/
/* gradient dnd functions */
/****************************/
@ -1029,10 +1038,11 @@ gimp_dnd_set_gradient_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
gradient = gradients_get_standard_gradient ();
gradient = gimp_gradient_get_standard ();
else
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list, name);
gimp_container_get_child_by_name (global_gradient_factory->container,
name);
if (gradient)
(* (GimpDndDropGradientFunc) set_gradient_func) (widget, gradient,
@ -1065,6 +1075,7 @@ gimp_dnd_gradient_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_GRADIENT, widget);
}
/***************************/
/* palette dnd functions */
/***************************/
@ -1132,10 +1143,11 @@ gimp_dnd_set_palette_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
palette = palettes_get_standard_palette ();
palette = gimp_palette_get_standard ();
else
palette = (GimpPalette *) gimp_container_get_child_by_name (global_palette_list,
name);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
name);
if (palette)
(* (GimpDndDropPaletteFunc) set_palette_func) (widget, palette,
@ -1168,6 +1180,7 @@ gimp_dnd_palette_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_PALETTE, widget);
}
/************************/
/* tool dnd functions */
/************************/
@ -1269,6 +1282,7 @@ gimp_dnd_tool_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_TOOL, widget);
}
/****************************/
/* drawable dnd functions */
/****************************/
@ -1434,6 +1448,7 @@ gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
DRAG_ICON_OFFSET, DRAG_ICON_OFFSET);
}
/******************************/
/* file / url dnd functions */
/******************************/

View File

@ -52,6 +52,7 @@ static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_gradient_dirty (GimpData *data);
static gboolean gimp_gradient_save (GimpData *data);
static gchar * gimp_gradient_get_extension (GimpData *data);
static gdouble gimp_gradient_calc_linear_factor (gdouble middle,
gdouble pos);
@ -110,8 +111,9 @@ gimp_gradient_class_init (GimpGradientClass *klass)
viewable_class->get_new_preview = gimp_gradient_get_new_preview;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->dirty = gimp_gradient_dirty;
data_class->save = gimp_gradient_save;
data_class->get_extension = gimp_gradient_get_extension;
}
static void
@ -226,6 +228,22 @@ gimp_gradient_new (const gchar *name)
return gradient;
}
GimpGradient *
gimp_gradient_get_standard (void)
{
static GimpGradient *standard_gradient = NULL;
if (! standard_gradient)
{
standard_gradient = gimp_gradient_new ("Standard");
gtk_object_ref (GTK_OBJECT (standard_gradient));
gtk_object_sink (GTK_OBJECT (standard_gradient));
}
return standard_gradient;
}
GimpGradient *
gimp_gradient_load (const gchar *filename)
{
@ -405,6 +423,12 @@ gimp_gradient_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_gradient_get_extension (GimpData *data)
{
return GIMP_GRADIENT_FILE_EXTENSION;
}
void
gimp_gradient_get_color_at (GimpGradient *gradient,
gdouble pos,

View File

@ -86,6 +86,8 @@ struct _GimpGradientClass
GtkType gimp_gradient_get_type (void);
GimpGradient * gimp_gradient_new (const gchar *name);
GimpGradient * gimp_gradient_get_standard (void);
GimpGradient * gimp_gradient_load (const gchar *filename);
void gimp_gradient_get_color_at (GimpGradient *gradient,

View File

@ -103,6 +103,7 @@
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "gimpdatafactory.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplist.h"
@ -793,7 +794,7 @@ build_palette_button (void)
UserHasWebPal = FALSE;
list = GIMP_LIST (global_palette_list)->list;
list = GIMP_LIST (global_palette_factory->container)->list;
if (! list)
{
@ -835,7 +836,7 @@ build_palette_button (void)
}
else
{
for (i = 0, list = GIMP_LIST (global_palette_list)->list;
for (i = 0, list = GIMP_LIST (global_palette_factory->container)->list;
list && default_palette == -1;
i++, list = g_list_next (list))
{

View File

@ -51,6 +51,7 @@ static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
gint height);
static void gimp_palette_dirty (GimpData *data);
static gboolean gimp_palette_save (GimpData *data);
static gchar * gimp_palette_get_extension (GimpData *data);
static void gimp_palette_entry_free (GimpPaletteEntry *entry);
@ -102,8 +103,9 @@ gimp_palette_class_init (GimpPaletteClass *klass)
viewable_class->get_new_preview = gimp_palette_get_new_preview;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->dirty = gimp_palette_dirty;
data_class->save = gimp_palette_save;
data_class->get_extension = gimp_palette_get_extension;
}
static void
@ -230,6 +232,21 @@ gimp_palette_new (const gchar *name)
return palette;
}
GimpPalette *
gimp_palette_get_standard (void)
{
static GimpPalette *standard_palette = NULL;
if (! standard_palette)
{
standard_palette = GIMP_PALETTE (gtk_type_new (GIMP_TYPE_PALETTE));
gimp_object_set_name (GIMP_OBJECT (standard_palette), "Standard");
}
return standard_palette;
}
GimpPalette *
gimp_palette_load (const gchar *filename)
{
@ -460,6 +477,12 @@ gimp_palette_save (GimpData *data)
return TRUE;
}
static gchar *
gimp_palette_get_extension (GimpData *data)
{
return GIMP_PALETTE_FILE_EXTENSION;
}
GimpPaletteEntry *
gimp_palette_add_entry (GimpPalette *palette,
const gchar *name,

View File

@ -69,6 +69,8 @@ struct _GimpPaletteClass
GtkType gimp_palette_get_type (void);
GimpPalette * gimp_palette_new (const gchar *name);
GimpPalette * gimp_palette_get_standard (void);
GimpPalette * gimp_palette_load (const gchar *filename);
GimpPaletteEntry * gimp_palette_add_entry (GimpPalette *palette,

View File

@ -58,6 +58,7 @@ static void gimp_pattern_destroy (GtkObject *object);
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_pattern_get_extension (GimpData *data);
static GimpDataClass *parent_class = NULL;
@ -93,15 +94,19 @@ gimp_pattern_class_init (GimpPatternClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
object_class->destroy = gimp_pattern_destroy;
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
data_class->get_extension = gimp_pattern_get_extension;
}
static void
@ -157,6 +162,73 @@ gimp_pattern_get_new_preview (GimpViewable *viewable,
return temp_buf;
}
static gchar *
gimp_pattern_get_extension (GimpData *data)
{
return GIMP_PATTERN_FILE_EXTENSION;
}
GimpPattern *
gimp_pattern_new (const gchar *name)
{
GimpPattern *pattern;
guchar *data;
gint row, col;
g_return_val_if_fail (name != NULL, NULL);
pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (pattern), name);
pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (pattern->mask);
for (row = 0; row < pattern->mask->height; row++)
for (col = 0; col < pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
return pattern;
}
GimpPattern *
gimp_pattern_get_standard (void)
{
static GimpPattern *standard_pattern = NULL;
if (! standard_pattern)
{
guchar *data;
gint row, col;
standard_pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (standard_pattern), "Standard");
standard_pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (standard_pattern->mask);
for (row = 0; row < standard_pattern->mask->height; row++)
for (col = 0; col < standard_pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
/* set ref_count to 2 --> never swap the standard pattern */
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_sink (GTK_OBJECT (standard_pattern));
}
return standard_pattern;
}
GimpPattern *
gimp_pattern_load (const gchar *filename)
{

View File

@ -48,10 +48,14 @@ struct _GimpPatternClass
};
GtkType gimp_pattern_get_type (void);
GimpPattern * gimp_pattern_load (const gchar *filename);
GtkType gimp_pattern_get_type (void);
GimpPattern * gimp_pattern_new (const gchar *name);
TempBuf * gimp_pattern_get_mask (const GimpPattern *pattern);
GimpPattern * gimp_pattern_get_standard (void);
GimpPattern * gimp_pattern_load (const gchar *filename);
TempBuf * gimp_pattern_get_mask (const GimpPattern *pattern);
#endif /* __GIMP_PATTERN_H__ */

View File

@ -120,7 +120,6 @@ gchar *plug_in_path = NULL;
gchar *temp_path = NULL;
gchar *swap_path = NULL;
gchar *brush_path = NULL;
gchar *brush_vbr_path = NULL;
gchar *default_brush = NULL;
gchar *pattern_path = NULL;
gchar *default_pattern = NULL;
@ -269,7 +268,6 @@ static ParseFunc funcs[] =
{ "temp-path", TT_PATH, &temp_path, NULL },
{ "swap-path", TT_PATH, &swap_path, NULL },
{ "brush-path", TT_PATH, &brush_path, NULL },
{ "brush-vbr-path", TT_PATH, &brush_vbr_path, NULL },
{ "pattern-path", TT_PATH, &pattern_path, NULL },
{ "plug-in-path", TT_PATH, &plug_in_path, NULL },
{ "palette-path", TT_PATH, &palette_path, NULL },

View File

@ -25,7 +25,6 @@ extern gchar *plug_in_path;
extern gchar *temp_path;
extern gchar *swap_path;
extern gchar *brush_path;
extern gchar *brush_vbr_path;
extern gchar *default_brush;
extern gchar *pattern_path;
extern gchar *default_pattern;

View File

@ -71,6 +71,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimplist.h"
@ -585,9 +586,10 @@ gradient_editor_create (void)
GTK_SIGNAL_FUNC (gradient_editor_gradient_changed),
g_editor);
g_editor->view = gimp_container_list_view_new (global_gradient_list,
g_editor->context,
16, 10, 6);
g_editor->view =
gimp_container_list_view_new (global_gradient_factory->container,
g_editor->context,
16, 10, 6);
gtk_box_pack_start (GTK_BOX (hbox), g_editor->view, TRUE, TRUE, 0);
gtk_widget_show (g_editor->view);
@ -835,10 +837,10 @@ gradient_editor_create (void)
ed_initialize_saved_colors ();
cpopup_create_main_menu ();
if (gimp_container_num_children (global_gradient_list))
if (gimp_container_num_children (global_gradient_factory->container))
{
gimp_context_set_gradient (g_editor->context,
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_list, 0)));
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_factory->container, 0)));
}
else
{
@ -846,7 +848,8 @@ gradient_editor_create (void)
gradient = gimp_gradient_new (_("Default"));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
gtk_widget_show (g_editor->shell);
@ -860,7 +863,8 @@ gradient_editor_free (void)
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_list, GIMP_OBJECT (gradient)) &&
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
@ -1049,7 +1053,8 @@ ed_do_new_gradient_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (grad));
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1128,7 +1133,7 @@ ed_do_copy_gradient_callback (GtkWidget *widget,
grad->segments = head;
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container, GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1188,7 +1193,8 @@ ed_delete_gradient_callback (GtkWidget *widget,
gradient = gimp_context_get_gradient (g_editor->context);
if (! (gimp_container_num_children (global_gradient_list) && gradient))
if (! (gimp_container_num_children (global_gradient_factory->container) &&
gradient))
return;
gtk_widget_set_sensitive (g_editor->shell, FALSE);
@ -1227,14 +1233,15 @@ ed_do_delete_gradient_callback (GtkWidget *widget,
delete_gradient = (GimpGradient *) data;
if (! gimp_container_have (global_gradient_list,
if (! gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient)))
return;
if (GIMP_DATA (delete_gradient)->filename)
gimp_data_delete_from_disk (GIMP_DATA (delete_gradient));
gimp_container_remove (global_gradient_list, GIMP_OBJECT (delete_gradient));
gimp_container_remove (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient));
}
/***** The "save as pov" dialog functions *****/
@ -1370,7 +1377,7 @@ ed_refresh_grads_callback (GtkWidget *widget,
{
gradients_init (FALSE);
if (! gimp_container_num_children (global_gradient_list))
if (! gimp_container_num_children (global_gradient_factory->container))
{
GimpGradient *gradient;
@ -1378,7 +1385,8 @@ ed_refresh_grads_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (gradient));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);

View File

@ -33,6 +33,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
@ -147,7 +148,7 @@ gradient_select_new (gchar *title,
if (title && initial_gradient && strlen (initial_gradient))
{
active = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
initial_gradient);
}
else
@ -166,7 +167,7 @@ gradient_select_new (gchar *title,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox), vbox);
/* The Gradient List */
gsp->view = gimp_container_list_view_new (global_gradient_list,
gsp->view = gimp_container_list_view_new (global_gradient_factory->container,
gsp->context,
16,
10, 10);

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpgradient.h"
#include "gimprc.h"
@ -38,7 +39,7 @@ gradients_init (gint no_data)
if (gradient_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_gradient_list),
gimp_data_list_load (GIMP_DATA_LIST (global_gradient_factory->container),
gradient_path,
(GimpDataObjectLoaderFunc) gimp_gradient_load,
@ -52,26 +53,9 @@ gradients_init (gint no_data)
void
gradients_free (void)
{
if (gimp_container_num_children (global_gradient_list) == 0)
if (gimp_container_num_children (global_gradient_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_gradient_list),
gradient_path,
GIMP_GRADIENT_FILE_EXTENSION);
}
GimpGradient *
gradients_get_standard_gradient (void)
{
static GimpGradient *standard_gradient = NULL;
if (! standard_gradient)
{
standard_gradient = gimp_gradient_new ("Standard");
gtk_object_ref (GTK_OBJECT (standard_gradient));
gtk_object_sink (GTK_OBJECT (standard_gradient));
}
return standard_gradient;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_gradient_factory->container),
gradient_path);
}

View File

@ -23,7 +23,5 @@
void gradients_init (gboolean no_data);
void gradients_free (void);
GimpGradient * gradients_get_standard_gradient (void);
#endif /* __GRADIENTS_H__ */

View File

@ -37,6 +37,7 @@
#include "gimpcontainergridview.h"
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "session.h"
@ -205,7 +206,7 @@ brush_select_new (gchar *title,
if (title && init_name && strlen (init_name))
{
active = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
init_name);
}
else
@ -242,7 +243,7 @@ brush_select_new (gchar *title,
gtk_container_add (GTK_CONTAINER (bsp->left_box), bsp->brush_selection_box);
/* The Brush Grid */
bsp->view = gimp_container_grid_view_new (global_brush_list,
bsp->view = gimp_container_grid_view_new (global_brush_factory->container,
bsp->context,
MIN_CELL_SIZE,
STD_BRUSH_COLUMNS,
@ -386,7 +387,7 @@ brush_select_new (gchar *title,
/* add callbacks to keep the display area current */
bsp->name_changed_handler_id =
gimp_container_add_handler
(GIMP_CONTAINER (global_brush_list), "name_changed",
(global_brush_factory->container, "name_changed",
GTK_SIGNAL_FUNC (brush_select_brush_renamed_callback),
bsp);
@ -435,7 +436,7 @@ brush_select_free (BrushSelect *bsp)
gtk_object_unref (GTK_OBJECT (bsp->context));
}
gimp_container_remove_handler (GIMP_CONTAINER (global_brush_list),
gimp_container_remove_handler (global_brush_factory->container,
bsp->name_changed_handler_id);
g_free (bsp);
@ -623,7 +624,8 @@ static void
brush_select_select (BrushSelect *bsp,
GimpBrush *brush)
{
if (! gimp_container_have (global_brush_list, GIMP_OBJECT (brush)));
if (! gimp_container_have (global_brush_factory->container,
GIMP_OBJECT (brush)));
if (GIMP_IS_BRUSH_GENERATED (brush))
{
@ -758,7 +760,7 @@ brush_select_new_brush_callback (GtkWidget *widget,
brush = gimp_brush_generated_new (10, .5, 0.0, 1.0);
gimp_container_add (GIMP_CONTAINER (global_brush_list),
gimp_container_add (global_brush_factory->container,
GIMP_OBJECT (brush));
gimp_context_set_brush (bsp->context, brush);
@ -817,7 +819,8 @@ brush_select_delete_brush_callback (GtkWidget *widget,
if (GIMP_DATA (brush)->filename)
gimp_data_delete_from_disk (GIMP_DATA (brush));
gimp_container_remove (global_brush_list, GIMP_OBJECT (brush));
gimp_container_remove (global_brush_factory->container,
GIMP_OBJECT (brush));
}
else
{

View File

@ -84,7 +84,8 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
#include "gimpdatacontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1356,7 +1357,7 @@ brushes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_list);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1376,7 +1377,7 @@ patterns_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_list);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1396,7 +1397,7 @@ gradients_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_list);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1416,7 +1417,7 @@ palettes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_list);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1508,11 +1509,11 @@ container_view_new (gboolean list,
}
static void
data_container_view_new (GimpViewType view_type,
gchar *title,
GimpContainer *container,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1532,11 +1533,11 @@ data_container_view_new (GimpViewType view_type,
gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
view = gimp_data_container_view_new (view_type,
container,
context,
preview_size,
5, 5);
view = gimp_data_factory_view_new (view_type,
factory,
context,
preview_size,
5, 5);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
gtk_widget_show (view);
@ -1549,7 +1550,7 @@ data_container_view_new (GimpViewType view_type,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (container_view_scale_callback),
GIMP_DATA_CONTAINER_VIEW (view)->view);
GIMP_DATA_FACTORY_VIEW (view)->view);
gtk_widget_show (dialog);
}
@ -1742,88 +1743,88 @@ void
dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_list,
gimp_context_get_user (),
32);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
gimp_context_get_user (),
32);
}
void
dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
@ -1831,7 +1832,7 @@ dialogs_test_multi_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (TRUE, "Multi List",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
24);
}
@ -1841,7 +1842,7 @@ dialogs_test_multi_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (FALSE, "Multi Grid",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
32);
}

View File

@ -35,6 +35,7 @@
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimppattern.h"
@ -131,13 +132,13 @@ static void device_status_foreground_changed (GtkWidget *widget,
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data);
static void device_status_data_changed (GimpContext *context,
@ -470,7 +471,7 @@ devices_rc_update (gchar *name,
GimpBrush *brush;
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (brush)
@ -489,7 +490,7 @@ devices_rc_update (gchar *name,
GimpPattern *pattern;
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (pattern)
@ -508,7 +509,7 @@ devices_rc_update (gchar *name,
GimpGradient *gradient;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (gradient)
@ -1202,9 +1203,9 @@ device_status_background_changed (GtkWidget *widget,
}
static void
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
device_status_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1212,14 +1213,14 @@ device_status_drop_brush (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_brush (device_info->context, brush);
gimp_context_set_brush (device_info->context, GIMP_BRUSH (viewable));
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
device_status_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1227,13 +1228,13 @@ device_status_drop_pattern (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
gimp_context_set_pattern (device_info->context, GIMP_PATTERN (viewable));
}
}
static void
device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1242,7 +1243,7 @@ device_status_drop_gradient (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_gradient (device_info->context, gradient);
gimp_context_set_gradient (device_info->context, GIMP_GRADIENT (viewable));
}
}

View File

@ -71,6 +71,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimplist.h"
@ -585,9 +586,10 @@ gradient_editor_create (void)
GTK_SIGNAL_FUNC (gradient_editor_gradient_changed),
g_editor);
g_editor->view = gimp_container_list_view_new (global_gradient_list,
g_editor->context,
16, 10, 6);
g_editor->view =
gimp_container_list_view_new (global_gradient_factory->container,
g_editor->context,
16, 10, 6);
gtk_box_pack_start (GTK_BOX (hbox), g_editor->view, TRUE, TRUE, 0);
gtk_widget_show (g_editor->view);
@ -835,10 +837,10 @@ gradient_editor_create (void)
ed_initialize_saved_colors ();
cpopup_create_main_menu ();
if (gimp_container_num_children (global_gradient_list))
if (gimp_container_num_children (global_gradient_factory->container))
{
gimp_context_set_gradient (g_editor->context,
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_list, 0)));
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_factory->container, 0)));
}
else
{
@ -846,7 +848,8 @@ gradient_editor_create (void)
gradient = gimp_gradient_new (_("Default"));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
gtk_widget_show (g_editor->shell);
@ -860,7 +863,8 @@ gradient_editor_free (void)
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_list, GIMP_OBJECT (gradient)) &&
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
@ -1049,7 +1053,8 @@ ed_do_new_gradient_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (grad));
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1128,7 +1133,7 @@ ed_do_copy_gradient_callback (GtkWidget *widget,
grad->segments = head;
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container, GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1188,7 +1193,8 @@ ed_delete_gradient_callback (GtkWidget *widget,
gradient = gimp_context_get_gradient (g_editor->context);
if (! (gimp_container_num_children (global_gradient_list) && gradient))
if (! (gimp_container_num_children (global_gradient_factory->container) &&
gradient))
return;
gtk_widget_set_sensitive (g_editor->shell, FALSE);
@ -1227,14 +1233,15 @@ ed_do_delete_gradient_callback (GtkWidget *widget,
delete_gradient = (GimpGradient *) data;
if (! gimp_container_have (global_gradient_list,
if (! gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient)))
return;
if (GIMP_DATA (delete_gradient)->filename)
gimp_data_delete_from_disk (GIMP_DATA (delete_gradient));
gimp_container_remove (global_gradient_list, GIMP_OBJECT (delete_gradient));
gimp_container_remove (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient));
}
/***** The "save as pov" dialog functions *****/
@ -1370,7 +1377,7 @@ ed_refresh_grads_callback (GtkWidget *widget,
{
gradients_init (FALSE);
if (! gimp_container_num_children (global_gradient_list))
if (! gimp_container_num_children (global_gradient_factory->container))
{
GimpGradient *gradient;
@ -1378,7 +1385,8 @@ ed_refresh_grads_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (gradient));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);

View File

@ -33,6 +33,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gradient_editor.h"
@ -147,7 +148,7 @@ gradient_select_new (gchar *title,
if (title && initial_gradient && strlen (initial_gradient))
{
active = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
initial_gradient);
}
else
@ -166,7 +167,7 @@ gradient_select_new (gchar *title,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox), vbox);
/* The Gradient List */
gsp->view = gimp_container_list_view_new (global_gradient_list,
gsp->view = gimp_container_list_view_new (global_gradient_factory->container,
gsp->context,
16,
10, 10);

View File

@ -84,7 +84,8 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontainergridview.h"
#include "gimpdatacontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpdnd.h"
#include "gimppreview.h"
@ -1356,7 +1357,7 @@ brushes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_brush_list);
gimp_container_view_set_container (view, global_brush_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1376,7 +1377,7 @@ patterns_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_pattern_list);
gimp_container_view_set_container (view, global_pattern_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1396,7 +1397,7 @@ gradients_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_gradient_list);
gimp_container_view_set_container (view, global_gradient_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1416,7 +1417,7 @@ palettes_callback (GtkWidget *widget,
gimp_dnd_viewable_dest_unset (GTK_WIDGET (view),
view->container->children_type);
gimp_container_view_set_container (view, global_palette_list);
gimp_container_view_set_container (view, global_palette_factory->container);
gimp_gtk_drag_dest_set_by_type (GTK_WIDGET (view),
GTK_DEST_DEFAULT_ALL,
@ -1508,11 +1509,11 @@ container_view_new (gboolean list,
}
static void
data_container_view_new (GimpViewType view_type,
gchar *title,
GimpContainer *container,
GimpContext *context,
gint preview_size)
data_factory_view_new (GimpViewType view_type,
gchar *title,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *dialog;
GtkWidget *view;
@ -1532,11 +1533,11 @@ data_container_view_new (GimpViewType view_type,
gtk_widget_hide (GTK_DIALOG (dialog)->action_area);
view = gimp_data_container_view_new (view_type,
container,
context,
preview_size,
5, 5);
view = gimp_data_factory_view_new (view_type,
factory,
context,
preview_size,
5, 5);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
gtk_widget_show (view);
@ -1549,7 +1550,7 @@ data_container_view_new (GimpViewType view_type,
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (container_view_scale_callback),
GIMP_DATA_CONTAINER_VIEW (view)->view);
GIMP_DATA_FACTORY_VIEW (view)->view);
gtk_widget_show (dialog);
}
@ -1742,88 +1743,88 @@ void
dialogs_test_brush_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Brush List",
global_brush_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_pattern_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Pattern List",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Gradient List",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_LIST,
"Palette List",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_brush_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_list,
gimp_context_get_user (),
32);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Brush Grid",
global_brush_factory,
gimp_context_get_user (),
32);
}
void
dialogs_test_pattern_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Pattern Grid",
global_pattern_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_gradient_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Gradient Grid",
global_gradient_factory,
gimp_context_get_user (),
24);
}
void
dialogs_test_palette_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
data_container_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_list,
gimp_context_get_user (),
24);
data_factory_view_new (GIMP_VIEW_TYPE_GRID,
"Palette Grid",
global_palette_factory,
gimp_context_get_user (),
24);
}
void
@ -1831,7 +1832,7 @@ dialogs_test_multi_container_list_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (TRUE, "Multi List",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
24);
}
@ -1841,7 +1842,7 @@ dialogs_test_multi_container_grid_view_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
container_multi_view_new (FALSE, "Multi Grid",
global_brush_list,
global_brush_factory->container,
gimp_context_get_user (),
32);
}

View File

@ -61,12 +61,11 @@ brush_preview_clicked (GtkWidget *widget,
}
static void
brush_preview_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
brush_preview_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
if (brush)
gimp_context_set_brush (gimp_context_get_user (), brush);
gimp_context_set_brush (gimp_context_get_user (), GIMP_BRUSH (viewable));
}
static void
@ -77,12 +76,11 @@ pattern_preview_clicked (GtkWidget *widget,
}
static void
pattern_preview_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
pattern_preview_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
if (pattern)
gimp_context_set_pattern (gimp_context_get_user (), pattern);
gimp_context_set_pattern (gimp_context_get_user (), GIMP_PATTERN (viewable));
}
static void
@ -94,11 +92,10 @@ gradient_preview_clicked (GtkWidget *widget,
static void
gradient_preview_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
if (gradient)
gimp_context_set_gradient (gimp_context_get_user (), gradient);
gimp_context_set_gradient (gimp_context_get_user (), GIMP_GRADIENT (viewable));
}
GtkWidget *
@ -113,7 +110,6 @@ indicator_area_create (void)
gtk_table_set_row_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
gtk_table_set_col_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
/* brush preview */
brush_preview =

View File

@ -35,6 +35,7 @@
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimppattern.h"
@ -131,13 +132,13 @@ static void device_status_foreground_changed (GtkWidget *widget,
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data);
static void device_status_data_changed (GimpContext *context,
@ -470,7 +471,7 @@ devices_rc_update (gchar *name,
GimpBrush *brush;
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (brush)
@ -489,7 +490,7 @@ devices_rc_update (gchar *name,
GimpPattern *pattern;
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (pattern)
@ -508,7 +509,7 @@ devices_rc_update (gchar *name,
GimpGradient *gradient;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (gradient)
@ -1202,9 +1203,9 @@ device_status_background_changed (GtkWidget *widget,
}
static void
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
device_status_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1212,14 +1213,14 @@ device_status_drop_brush (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_brush (device_info->context, brush);
gimp_context_set_brush (device_info->context, GIMP_BRUSH (viewable));
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
device_status_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1227,13 +1228,13 @@ device_status_drop_pattern (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
gimp_context_set_pattern (device_info->context, GIMP_PATTERN (viewable));
}
}
static void
device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1242,7 +1243,7 @@ device_status_drop_gradient (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_gradient (device_info->context, gradient);
gimp_context_set_gradient (device_info->context, GIMP_GRADIENT (viewable));
}
}

View File

@ -31,6 +31,7 @@
#include "dialog_handler.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpdnd.h"
#include "gimppalette.h"
@ -189,7 +190,7 @@ palette_clist_init (GtkWidget *clist,
GList *list;
gint pos;
for (list = GIMP_LIST (global_palette_list)->list, pos = 0;
for (list = GIMP_LIST (global_palette_factory->container)->list, pos = 0;
list;
list = g_list_next (list), pos++)
{
@ -237,7 +238,7 @@ palette_dialog_clist_insert (PaletteDialog *palette_dialog,
{
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_clist_freeze (GTK_CLIST (palette_dialog->clist));
@ -258,7 +259,7 @@ palette_dialog_clist_set_text (PaletteDialog *palette_dialog,
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
num_buf = g_strdup_printf ("%d", palette->n_colors);;
@ -281,7 +282,7 @@ palette_dialog_clist_refresh (PaletteDialog *palette_dialog)
gtk_clist_thaw (GTK_CLIST (palette_dialog->clist));
palette_dialog->palette = (GimpPalette *)
gimp_container_get_child_by_index (global_palette_list, 0);
gimp_container_get_child_by_index (global_palette_factory->container, 0);
}
static void
@ -292,7 +293,7 @@ palette_dialog_clist_scroll_to_current (PaletteDialog *palette_dialog)
if (! (palette_dialog && palette_dialog->palette))
return;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette_dialog->palette));
gtk_clist_unselect_all (GTK_CLIST (palette_dialog->clist));
@ -1261,7 +1262,7 @@ palette_dialog_add_entries_callback (GtkWidget *widget,
palette = gimp_palette_new (palette_name);
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
/* update all dialogs */
palette_insert_all (palette);
@ -1306,7 +1307,8 @@ palette_dialog_do_delete_callback (GtkWidget *widget,
if (GIMP_DATA (palette)->filename)
gimp_data_delete_from_disk (GIMP_DATA (palette));
gimp_container_remove (global_palette_list, GIMP_OBJECT (palette));
gimp_container_remove (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_refresh_all ();
}
@ -1390,7 +1392,8 @@ palette_dialog_merge_entries_callback (GtkWidget *widget,
sel_list = sel_list->next;
}
gimp_container_add (global_palette_list, GIMP_OBJECT (new_palette));
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (new_palette));
/* update all dialogs */
palette_insert_all (new_palette);

View File

@ -31,6 +31,7 @@
#include "gimage.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimppalette.h"
@ -570,7 +571,8 @@ palette_import_create_from_grad (gchar *name)
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -755,7 +757,7 @@ palette_import_image_make_palette (GHashTable *h_array,
g_hash_table_destroy (h_array);
g_slist_free (sorted_list);
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -871,7 +873,7 @@ palette_import_create_from_indexed (GImage *gimage,
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}

View File

@ -29,6 +29,7 @@
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpdatafactory.h"
#include "gimppalette.h"
#include "palette_select.h"
#include "palette.h"
@ -117,11 +118,11 @@ palette_select_new (const gchar *title,
gtk_widget_show (psp->clist);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_list,
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
if (palette)
select_pos = gimp_container_get_child_index (global_palette_list,
select_pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_widget_realize (psp->shell);
@ -156,7 +157,7 @@ palette_select_clist_insert_all (GimpPalette *entries)
GSList *list;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
for (list = active_dialogs; list; list = g_slist_next (list))
@ -177,7 +178,7 @@ palette_select_set_text_all (GimpPalette *entries)
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
num_buf = g_strdup_printf ("%d", entries->n_colors);

View File

@ -32,6 +32,7 @@
#include "gimpcontainer.h"
#include "gimpcontainergridview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "patterns.h"
@ -161,7 +162,7 @@ pattern_select_new (gchar *title,
if (title && initial_pattern && strlen (initial_pattern))
{
active = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
gimp_container_get_child_by_name (global_pattern_factory->container,
initial_pattern);
}
else
@ -199,7 +200,7 @@ pattern_select_new (gchar *title,
gtk_widget_show (psp->pattern_size);
/* The Brush Grid */
psp->view = gimp_container_grid_view_new (global_pattern_list,
psp->view = gimp_container_grid_view_new (global_pattern_factory->container,
psp->context,
MIN_CELL_SIZE,
STD_PATTERN_COLUMNS,
@ -220,8 +221,8 @@ pattern_select_new (gchar *title,
/* add callbacks to keep the display area current */
psp->name_changed_handler_id =
gimp_container_add_handler
(GIMP_CONTAINER (global_pattern_list), "name_changed",
gimp_container_add_handler
(global_pattern_factory->container, "name_changed",
GTK_SIGNAL_FUNC (pattern_select_pattern_dirty_callback),
psp);
@ -257,7 +258,7 @@ pattern_select_free (PatternSelect *psp)
gtk_object_unref (GTK_OBJECT (psp->context));
}
gimp_container_remove_handler (GIMP_CONTAINER (global_pattern_list),
gimp_container_remove_handler (global_pattern_factory->container,
psp->name_changed_handler_id);
g_free (psp);

View File

@ -137,7 +137,6 @@ static gchar * old_swap_path;
static gchar * old_plug_in_path;
static gchar * old_module_path;
static gchar * old_brush_path;
static gchar * old_brush_vbr_path;
static gchar * old_pattern_path;
static gchar * old_palette_path;
static gchar * old_gradient_path;
@ -172,7 +171,6 @@ static gboolean edit_disable_tearoff_menus;
static gchar * edit_temp_path = NULL;
static gchar * edit_swap_path = NULL;
static gchar * edit_brush_path = NULL;
static gchar * edit_brush_vbr_path = NULL;
static gchar * edit_pattern_path = NULL;
static gchar * edit_palette_path = NULL;
static gchar * edit_gradient_path = NULL;
@ -350,7 +348,6 @@ prefs_check_settings (void)
prefs_strcmp (old_temp_path, edit_temp_path) ||
prefs_strcmp (old_swap_path, edit_swap_path) ||
prefs_strcmp (old_brush_path, edit_brush_path) ||
prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path) ||
prefs_strcmp (old_pattern_path, edit_pattern_path) ||
prefs_strcmp (old_palette_path, edit_palette_path) ||
prefs_strcmp (old_gradient_path, edit_gradient_path) ||
@ -482,7 +479,6 @@ prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
@ -530,7 +526,6 @@ prefs_save_callback (GtkWidget *widget,
save_temp_path = temp_path;
save_swap_path = swap_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
@ -778,11 +773,6 @@ prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
update = g_list_append (update, "brush-path");
}
if (prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path))
{
brush_vbr_path = edit_brush_vbr_path;
update = g_list_append (update, "brush-vbr-path");
}
if (prefs_strcmp (old_pattern_path, edit_pattern_path))
{
pattern_path = edit_pattern_path;
@ -836,7 +826,6 @@ prefs_save_callback (GtkWidget *widget,
temp_path = save_temp_path;
swap_path = save_swap_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
@ -937,7 +926,6 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_strset (&edit_temp_path, old_temp_path);
prefs_strset (&edit_swap_path, old_swap_path);
prefs_strset (&edit_brush_path, old_brush_path);
prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
prefs_strset (&edit_pattern_path, old_pattern_path);
prefs_strset (&edit_palette_path, old_palette_path);
prefs_strset (&edit_gradient_path, old_gradient_path);
@ -1416,7 +1404,6 @@ prefs_cmd_callback (GtkWidget *widget,
edit_plug_in_path = prefs_strdup (plug_in_path);
edit_module_path = prefs_strdup (module_path);
edit_brush_path = prefs_strdup (brush_path);
edit_brush_vbr_path = prefs_strdup (brush_vbr_path);
edit_pattern_path = prefs_strdup (pattern_path);
edit_palette_path = prefs_strdup (palette_path);
edit_gradient_path = prefs_strdup (gradient_path);
@ -1486,7 +1473,6 @@ prefs_cmd_callback (GtkWidget *widget,
prefs_strset (&old_plug_in_path, edit_plug_in_path);
prefs_strset (&old_module_path, edit_module_path);
prefs_strset (&old_brush_path, edit_brush_path);
prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
prefs_strset (&old_pattern_path, edit_pattern_path);
prefs_strset (&old_palette_path, edit_palette_path);
prefs_strset (&old_gradient_path, edit_gradient_path);
@ -2570,10 +2556,6 @@ prefs_cmd_callback (GtkWidget *widget,
"dialogs/preferences/directories.html#brushes",
N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"),
"dialogs/preferences/directories.html#generated_brushes",
N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"),
"dialogs/preferences/directories.html#patterns",
N_("Select Patterns Dir"),

View File

@ -61,12 +61,11 @@ brush_preview_clicked (GtkWidget *widget,
}
static void
brush_preview_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
brush_preview_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
if (brush)
gimp_context_set_brush (gimp_context_get_user (), brush);
gimp_context_set_brush (gimp_context_get_user (), GIMP_BRUSH (viewable));
}
static void
@ -77,12 +76,11 @@ pattern_preview_clicked (GtkWidget *widget,
}
static void
pattern_preview_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
pattern_preview_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
if (pattern)
gimp_context_set_pattern (gimp_context_get_user (), pattern);
gimp_context_set_pattern (gimp_context_get_user (), GIMP_PATTERN (viewable));
}
static void
@ -94,11 +92,10 @@ gradient_preview_clicked (GtkWidget *widget,
static void
gradient_preview_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
if (gradient)
gimp_context_set_gradient (gimp_context_get_user (), gradient);
gimp_context_set_gradient (gimp_context_get_user (), GIMP_GRADIENT (viewable));
}
GtkWidget *
@ -113,7 +110,6 @@ indicator_area_create (void)
gtk_table_set_row_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
gtk_table_set_col_spacing (GTK_TABLE (indicator_table), 0, CELL_PADDING);
/* brush preview */
brush_preview =

View File

@ -31,6 +31,7 @@
#include "dialog_handler.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpdnd.h"
#include "gimppalette.h"
@ -189,7 +190,7 @@ palette_clist_init (GtkWidget *clist,
GList *list;
gint pos;
for (list = GIMP_LIST (global_palette_list)->list, pos = 0;
for (list = GIMP_LIST (global_palette_factory->container)->list, pos = 0;
list;
list = g_list_next (list), pos++)
{
@ -237,7 +238,7 @@ palette_dialog_clist_insert (PaletteDialog *palette_dialog,
{
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_clist_freeze (GTK_CLIST (palette_dialog->clist));
@ -258,7 +259,7 @@ palette_dialog_clist_set_text (PaletteDialog *palette_dialog,
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
num_buf = g_strdup_printf ("%d", palette->n_colors);;
@ -281,7 +282,7 @@ palette_dialog_clist_refresh (PaletteDialog *palette_dialog)
gtk_clist_thaw (GTK_CLIST (palette_dialog->clist));
palette_dialog->palette = (GimpPalette *)
gimp_container_get_child_by_index (global_palette_list, 0);
gimp_container_get_child_by_index (global_palette_factory->container, 0);
}
static void
@ -292,7 +293,7 @@ palette_dialog_clist_scroll_to_current (PaletteDialog *palette_dialog)
if (! (palette_dialog && palette_dialog->palette))
return;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette_dialog->palette));
gtk_clist_unselect_all (GTK_CLIST (palette_dialog->clist));
@ -1261,7 +1262,7 @@ palette_dialog_add_entries_callback (GtkWidget *widget,
palette = gimp_palette_new (palette_name);
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
/* update all dialogs */
palette_insert_all (palette);
@ -1306,7 +1307,8 @@ palette_dialog_do_delete_callback (GtkWidget *widget,
if (GIMP_DATA (palette)->filename)
gimp_data_delete_from_disk (GIMP_DATA (palette));
gimp_container_remove (global_palette_list, GIMP_OBJECT (palette));
gimp_container_remove (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_refresh_all ();
}
@ -1390,7 +1392,8 @@ palette_dialog_merge_entries_callback (GtkWidget *widget,
sel_list = sel_list->next;
}
gimp_container_add (global_palette_list, GIMP_OBJECT (new_palette));
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (new_palette));
/* update all dialogs */
palette_insert_all (new_palette);

View File

@ -31,6 +31,7 @@
#include "gimage.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimppalette.h"
@ -570,7 +571,8 @@ palette_import_create_from_grad (gchar *name)
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container,
GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -755,7 +757,7 @@ palette_import_image_make_palette (GHashTable *h_array,
g_hash_table_destroy (h_array);
g_slist_free (sorted_list);
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}
@ -871,7 +873,7 @@ palette_import_create_from_indexed (GImage *gimage,
gimp_palette_add_entry (palette, NULL, &color);
}
gimp_container_add (global_palette_list, GIMP_OBJECT (palette));
gimp_container_add (global_palette_factory->container, GIMP_OBJECT (palette));
palette_insert_all (palette);
}

View File

@ -29,6 +29,7 @@
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpdatafactory.h"
#include "gimppalette.h"
#include "palette_select.h"
#include "palette.h"
@ -117,11 +118,11 @@ palette_select_new (const gchar *title,
gtk_widget_show (psp->clist);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_list,
gimp_container_get_child_by_name (global_palette_factory->container,
initial_palette);
if (palette)
select_pos = gimp_container_get_child_index (global_palette_list,
select_pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (palette));
gtk_widget_realize (psp->shell);
@ -156,7 +157,7 @@ palette_select_clist_insert_all (GimpPalette *entries)
GSList *list;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
for (list = active_dialogs; list; list = g_slist_next (list))
@ -177,7 +178,7 @@ palette_select_set_text_all (GimpPalette *entries)
gchar *num_buf;
gint pos;
pos = gimp_container_get_child_index (global_palette_list,
pos = gimp_container_get_child_index (global_palette_factory->container,
GIMP_OBJECT (entries));
num_buf = g_strdup_printf ("%d", entries->n_colors);

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimppalette.h"
#include "gimprc.h"
@ -39,7 +40,7 @@ palettes_init (gboolean no_data)
if (palette_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_palette_list),
gimp_data_list_load (GIMP_DATA_LIST (global_palette_factory->container),
palette_path,
(GimpDataObjectLoaderFunc) gimp_palette_load,
@ -53,25 +54,9 @@ palettes_init (gboolean no_data)
void
palettes_free (void)
{
if (gimp_container_num_children (global_palette_list) == 0)
if (gimp_container_num_children (global_palette_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_palette_list),
palette_path,
GIMP_PALETTE_FILE_EXTENSION);
}
GimpPalette *
palettes_get_standard_palette (void)
{
static GimpPalette *standard_palette = NULL;
if (! standard_palette)
{
standard_palette = GIMP_PALETTE (gtk_type_new (GIMP_TYPE_PALETTE));
gimp_object_set_name (GIMP_OBJECT (standard_palette), "Standard");
}
return standard_palette;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_palette_factory->container),
palette_path);
}

View File

@ -23,7 +23,5 @@
void palettes_init (gboolean no_data);
void palettes_free (void);
GimpPalette * palettes_get_standard_palette (void);
#endif /* __PALETTES_H__ */

View File

@ -32,6 +32,7 @@
#include "gimpcontainer.h"
#include "gimpcontainergridview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimppattern.h"
#include "patterns.h"
@ -161,7 +162,7 @@ pattern_select_new (gchar *title,
if (title && initial_pattern && strlen (initial_pattern))
{
active = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_list,
gimp_container_get_child_by_name (global_pattern_factory->container,
initial_pattern);
}
else
@ -199,7 +200,7 @@ pattern_select_new (gchar *title,
gtk_widget_show (psp->pattern_size);
/* The Brush Grid */
psp->view = gimp_container_grid_view_new (global_pattern_list,
psp->view = gimp_container_grid_view_new (global_pattern_factory->container,
psp->context,
MIN_CELL_SIZE,
STD_PATTERN_COLUMNS,
@ -220,8 +221,8 @@ pattern_select_new (gchar *title,
/* add callbacks to keep the display area current */
psp->name_changed_handler_id =
gimp_container_add_handler
(GIMP_CONTAINER (global_pattern_list), "name_changed",
gimp_container_add_handler
(global_pattern_factory->container, "name_changed",
GTK_SIGNAL_FUNC (pattern_select_pattern_dirty_callback),
psp);
@ -257,7 +258,7 @@ pattern_select_free (PatternSelect *psp)
gtk_object_unref (GTK_OBJECT (psp->context));
}
gimp_container_remove_handler (GIMP_CONTAINER (global_pattern_list),
gimp_container_remove_handler (global_pattern_factory->container,
psp->name_changed_handler_id);
g_free (psp);

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "context_manager.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimppattern.h"
#include "gimprc.h"
@ -39,7 +40,7 @@ patterns_init (gboolean no_data)
if (pattern_path != NULL && !no_data)
{
gimp_data_list_load (GIMP_DATA_LIST (global_pattern_list),
gimp_data_list_load (GIMP_DATA_LIST (global_pattern_factory->container),
pattern_path,
(GimpDataObjectLoaderFunc) gimp_pattern_load,
@ -52,44 +53,9 @@ patterns_init (gboolean no_data)
void
patterns_free (void)
{
if (gimp_container_num_children (global_pattern_list) == 0)
if (gimp_container_num_children (global_pattern_factory->container) == 0)
return;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_pattern_list),
pattern_path,
GIMP_PATTERN_FILE_EXTENSION);
}
GimpPattern *
patterns_get_standard_pattern (void)
{
static GimpPattern *standard_pattern = NULL;
if (! standard_pattern)
{
guchar *data;
gint row, col;
standard_pattern = GIMP_PATTERN (gtk_type_new (GIMP_TYPE_PATTERN));
gimp_object_set_name (GIMP_OBJECT (standard_pattern), "Standard");
standard_pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (standard_pattern->mask);
for (row = 0; row < standard_pattern->mask->height; row++)
for (col = 0; col < standard_pattern->mask->width; col++)
{
memset (data, (col % 2) && (row % 2) ? 255 : 0, 3);
data += 3;
}
/* set ref_count to 2 --> never swap the standard pattern */
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_ref (GTK_OBJECT (standard_pattern));
gtk_object_sink (GTK_OBJECT (standard_pattern));
}
return standard_pattern;
gimp_data_list_save_and_clear (GIMP_DATA_LIST (global_pattern_factory->container),
pattern_path);
}

View File

@ -23,7 +23,5 @@
void patterns_init (gboolean no_data);
void patterns_free (void);
GimpPattern * patterns_get_standard_pattern (void);
#endif /* __PATTERNS_H__ */

View File

@ -32,6 +32,7 @@
#include "context_manager.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimplist.h"
static ProcRecord brushes_popup_proc;
@ -257,7 +258,8 @@ brushes_set_popup_invoker (Argument *args)
(bsp = brush_get_brushselect (name)))
{
GimpObject *object =
gimp_container_get_child_by_name (global_brush_list, brush_name);
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (object)
{

View File

@ -31,6 +31,7 @@
#include "context_manager.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimplist.h"
#include "temp_buf.h"
@ -169,7 +170,8 @@ brushes_set_brush_invoker (Argument *args)
if (success)
{
object = gimp_container_get_child_by_name (global_brush_list, name);
object = gimp_container_get_child_by_name (global_brush_factory->container,
name);
if (object)
gimp_context_set_brush (NULL, GIMP_BRUSH (object));
@ -445,9 +447,9 @@ brushes_list_invoker (Argument *args)
GList *list = NULL;
int i = 0;
brushes = g_new (char *, global_brush_list->num_children);
brushes = g_new (char *, global_brush_factory->container->num_children);
success = (list = GIMP_LIST (global_brush_list)->list) != NULL;
success = (list = GIMP_LIST (global_brush_factory->container)->list) != NULL;
while (list)
{
@ -459,7 +461,7 @@ brushes_list_invoker (Argument *args)
if (success)
{
return_args[1].value.pdb_int = global_brush_list->num_children;
return_args[1].value.pdb_int = global_brush_factory->container->num_children;
return_args[2].value.pdb_pointer = brushes;
}
@ -518,7 +520,9 @@ brushes_get_brush_data_invoker (Argument *args)
success = FALSE;
for (list = GIMP_LIST (global_brush_list)->list; list; list = g_list_next (list))
for (list = GIMP_LIST (global_brush_factory->container)->list;
list;
list = g_list_next (list))
{
brush = (GimpBrush *) list->data;

View File

@ -30,6 +30,7 @@
#include "context_manager.h"
#include "convert.h"
#include "gimpcontainer.h"
#include "gimpdatafactory.h"
#include "gimpimage.h"
#include "gimppalette.h"
#include "palette.h"
@ -194,11 +195,11 @@ convert_indexed_invoker (Argument *args)
break;
case CUSTOM_PALETTE:
if (! global_palette_list)
if (! global_palette_factory->container->num_children)
palettes_init (FALSE);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_list,
gimp_container_get_child_by_name (global_palette_factory->container,
palette_name);
if (palette == NULL)

View File

@ -30,6 +30,7 @@
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gradient_select.h"
#include "gradients.h"
@ -234,7 +235,7 @@ gradients_set_popup_invoker (Argument *args)
GimpGradient *active = NULL;
active = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (active)
@ -307,7 +308,8 @@ gradients_get_gradient_data_invoker (Argument *args)
success = FALSE;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list, name);
gimp_container_get_child_by_name (global_gradient_factory->container,
name);
if (gradient)
success = TRUE;

View File

@ -29,6 +29,7 @@
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimplist.h"
#include "gradients.h"
@ -60,13 +61,14 @@ gradients_get_list_invoker (Argument *args)
GList *list = NULL;
int i = 0;
num_gradients = gimp_container_num_children (global_gradient_list);
num_gradients =
gimp_container_num_children (global_gradient_factory->container);
gradients = g_new (gchar *, num_gradients);
if (num_gradients)
{
list = GIMP_LIST (global_gradient_list)->list;
list = GIMP_LIST (global_gradient_factory->container)->list;
}
success = (list != NULL);
@ -174,7 +176,7 @@ gradients_set_active_invoker (Argument *args)
if (success)
{
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list, name);
gimp_container_get_child_by_name (global_gradient_factory->container, name);
success = FALSE;

View File

@ -29,6 +29,7 @@
#include "context_manager.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimplist.h"
#include "gimppattern.h"
#include "pattern_select.h"
@ -218,9 +219,9 @@ patterns_set_popup_invoker (Argument *args)
if ((prec = procedural_db_lookup (name)) &&
(psp = pattern_get_patternselect (name)))
{
GimpPattern *active =
(GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
pattern_name);
GimpPattern *active = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (active)
{

View File

@ -29,6 +29,7 @@
#include "context_manager.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimplist.h"
#include "gimppattern.h"
#include "patterns.h"
@ -120,7 +121,7 @@ patterns_set_pattern_invoker (Argument *args)
{
success = FALSE;
for (list = GIMP_LIST (global_pattern_list)->list;
for (list = GIMP_LIST (global_pattern_factory->container)->list;
list;
list = g_list_next (list))
{
@ -172,9 +173,9 @@ patterns_list_invoker (Argument *args)
GList *list = NULL;
gint i = 0;
patterns = g_new (gchar *, global_pattern_list->num_children);
patterns = g_new (gchar *, global_pattern_factory->container->num_children);
success = ((list = GIMP_LIST (global_pattern_list)->list) != NULL);
success = ((list = GIMP_LIST (global_pattern_factory->container)->list) != NULL);
while (list)
{
@ -186,7 +187,7 @@ patterns_list_invoker (Argument *args)
if (success)
{
return_args[1].value.pdb_int = global_pattern_list->num_children;
return_args[1].value.pdb_int = global_pattern_factory->container->num_children;
return_args[2].value.pdb_pointer = patterns;
}
@ -245,7 +246,7 @@ patterns_get_pattern_data_invoker (Argument *args)
success = FALSE;
for (list = GIMP_LIST (global_pattern_list)->list;
for (list = GIMP_LIST (global_pattern_factory->container)->list;
list;
list = g_list_next (list))
{

View File

@ -137,7 +137,6 @@ static gchar * old_swap_path;
static gchar * old_plug_in_path;
static gchar * old_module_path;
static gchar * old_brush_path;
static gchar * old_brush_vbr_path;
static gchar * old_pattern_path;
static gchar * old_palette_path;
static gchar * old_gradient_path;
@ -172,7 +171,6 @@ static gboolean edit_disable_tearoff_menus;
static gchar * edit_temp_path = NULL;
static gchar * edit_swap_path = NULL;
static gchar * edit_brush_path = NULL;
static gchar * edit_brush_vbr_path = NULL;
static gchar * edit_pattern_path = NULL;
static gchar * edit_palette_path = NULL;
static gchar * edit_gradient_path = NULL;
@ -350,7 +348,6 @@ prefs_check_settings (void)
prefs_strcmp (old_temp_path, edit_temp_path) ||
prefs_strcmp (old_swap_path, edit_swap_path) ||
prefs_strcmp (old_brush_path, edit_brush_path) ||
prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path) ||
prefs_strcmp (old_pattern_path, edit_pattern_path) ||
prefs_strcmp (old_palette_path, edit_palette_path) ||
prefs_strcmp (old_gradient_path, edit_gradient_path) ||
@ -482,7 +479,6 @@ prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
@ -530,7 +526,6 @@ prefs_save_callback (GtkWidget *widget,
save_temp_path = temp_path;
save_swap_path = swap_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
@ -778,11 +773,6 @@ prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
update = g_list_append (update, "brush-path");
}
if (prefs_strcmp (old_brush_vbr_path, edit_brush_vbr_path))
{
brush_vbr_path = edit_brush_vbr_path;
update = g_list_append (update, "brush-vbr-path");
}
if (prefs_strcmp (old_pattern_path, edit_pattern_path))
{
pattern_path = edit_pattern_path;
@ -836,7 +826,6 @@ prefs_save_callback (GtkWidget *widget,
temp_path = save_temp_path;
swap_path = save_swap_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
@ -937,7 +926,6 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_strset (&edit_temp_path, old_temp_path);
prefs_strset (&edit_swap_path, old_swap_path);
prefs_strset (&edit_brush_path, old_brush_path);
prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
prefs_strset (&edit_pattern_path, old_pattern_path);
prefs_strset (&edit_palette_path, old_palette_path);
prefs_strset (&edit_gradient_path, old_gradient_path);
@ -1416,7 +1404,6 @@ prefs_cmd_callback (GtkWidget *widget,
edit_plug_in_path = prefs_strdup (plug_in_path);
edit_module_path = prefs_strdup (module_path);
edit_brush_path = prefs_strdup (brush_path);
edit_brush_vbr_path = prefs_strdup (brush_vbr_path);
edit_pattern_path = prefs_strdup (pattern_path);
edit_palette_path = prefs_strdup (palette_path);
edit_gradient_path = prefs_strdup (gradient_path);
@ -1486,7 +1473,6 @@ prefs_cmd_callback (GtkWidget *widget,
prefs_strset (&old_plug_in_path, edit_plug_in_path);
prefs_strset (&old_module_path, edit_module_path);
prefs_strset (&old_brush_path, edit_brush_path);
prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
prefs_strset (&old_pattern_path, edit_pattern_path);
prefs_strset (&old_palette_path, edit_palette_path);
prefs_strset (&old_gradient_path, edit_gradient_path);
@ -2570,10 +2556,6 @@ prefs_cmd_callback (GtkWidget *widget,
"dialogs/preferences/directories.html#brushes",
N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"),
"dialogs/preferences/directories.html#generated_brushes",
N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"),
"dialogs/preferences/directories.html#patterns",
N_("Select Patterns Dir"),

View File

@ -0,0 +1,299 @@
/* 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 "apptypes.h"
#include "gimpcontainer.h"
#include "gimpcontainerview.h"
#include "gimpdatafactory.h"
#include "gimpdatafactoryview.h"
#include "gimpcontainergridview.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
#include "libgimp/gimpintl.h"
#include "pixmaps/delete.xpm"
#include "pixmaps/duplicate.xpm"
#include "pixmaps/new.xpm"
#include "pixmaps/pennorm.xpm"
#include "pixmaps/refresh.xpm"
static void gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass);
static void gimp_data_factory_view_init (GimpDataFactoryView *view);
static void gimp_data_factory_view_destroy (GtkObject *object);
static void gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static void gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view);
static GtkVBoxClass *parent_class = NULL;
GtkType
gimp_data_factory_view_get_type (void)
{
static guint view_type = 0;
if (! view_type)
{
GtkTypeInfo view_info =
{
"GimpDataFactoryView",
sizeof (GimpDataFactoryView),
sizeof (GimpDataFactoryViewClass),
(GtkClassInitFunc) gimp_data_factory_view_class_init,
(GtkObjectInitFunc) gimp_data_factory_view_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
view_type = gtk_type_unique (GTK_TYPE_VBOX, &view_info);
}
return view_type;
}
static void
gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *) klass;
parent_class = gtk_type_class (GTK_TYPE_VBOX);
object_class->destroy = gimp_data_factory_view_destroy;
}
static void
gimp_data_factory_view_init (GimpDataFactoryView *view)
{
GtkWidget *pixmap;
view->view = NULL;
gtk_box_set_spacing (GTK_BOX (view), 2);
view->button_box = gtk_hbox_new (TRUE, 2);
gtk_box_pack_end (GTK_BOX (view), view->button_box, FALSE, FALSE, 0);
gtk_widget_show (view->button_box);
/* new */
view->new_button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (view->button_box), view->new_button,
TRUE, TRUE, 0);
gtk_widget_show (view->new_button);
gimp_help_set_help_data (view->new_button, _("New"), NULL);
gtk_signal_connect (GTK_OBJECT (view->new_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_factory_view_new_clicked),
view);
pixmap = gimp_pixmap_new (new_xpm);
gtk_container_add (GTK_CONTAINER (view->new_button), pixmap);
gtk_widget_show (pixmap);
/* duplicate */
view->duplicate_button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (view->button_box), view->duplicate_button,
TRUE, TRUE, 0);
gtk_widget_show (view->duplicate_button);
gimp_help_set_help_data (view->duplicate_button, _("Duplicate"), NULL);
gtk_signal_connect (GTK_OBJECT (view->duplicate_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_factory_view_duplicate_clicked),
view);
pixmap = gimp_pixmap_new (duplicate_xpm);
gtk_container_add (GTK_CONTAINER (view->duplicate_button), pixmap);
gtk_widget_show (pixmap);
/* edit */
view->edit_button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (view->button_box), view->edit_button,
TRUE, TRUE, 0);
gtk_widget_show (view->edit_button);
gimp_help_set_help_data (view->edit_button, _("Edit"), NULL);
gtk_signal_connect (GTK_OBJECT (view->edit_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_factory_view_edit_clicked),
view);
pixmap = gimp_pixmap_new (pennorm_xpm);
gtk_container_add (GTK_CONTAINER (view->edit_button), pixmap);
gtk_widget_show (pixmap);
/* delete */
view->delete_button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (view->button_box), view->delete_button,
TRUE, TRUE, 0);
gtk_widget_show (view->delete_button);
gimp_help_set_help_data (view->delete_button, _("Delete"), NULL);
gtk_signal_connect (GTK_OBJECT (view->delete_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_factory_view_delete_clicked),
view);
pixmap = gimp_pixmap_new (delete_xpm);
gtk_container_add (GTK_CONTAINER (view->delete_button), pixmap);
gtk_widget_show (pixmap);
/* refresh */
view->refresh_button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (view->button_box), view->refresh_button,
TRUE, TRUE, 0);
gtk_widget_show (view->refresh_button);
gimp_help_set_help_data (view->refresh_button, _("Refresh"), NULL);
gtk_signal_connect (GTK_OBJECT (view->refresh_button), "clicked",
GTK_SIGNAL_FUNC (gimp_data_factory_view_refresh_clicked),
view);
pixmap = gimp_pixmap_new (refresh_xpm);
gtk_container_add (GTK_CONTAINER (view->refresh_button), pixmap);
gtk_widget_show (pixmap);
}
static void
gimp_data_factory_view_destroy (GtkObject *object)
{
GimpDataFactoryView *view;
view = GIMP_DATA_FACTORY_VIEW (object);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
GtkWidget *
gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y)
{
GimpDataFactoryView *factory_view;
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (preview_size > 0 && preview_size <= 64, NULL);
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, NULL);
g_return_val_if_fail (min_items_y > 0 && min_items_y <= 64, NULL);
factory_view = gtk_type_new (GIMP_TYPE_DATA_FACTORY_VIEW);
factory_view->factory = factory;
switch (view_type)
{
case GIMP_VIEW_TYPE_GRID:
factory_view->view =
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (factory->container,
context,
preview_size,
min_items_x,
min_items_y));
break;
case GIMP_VIEW_TYPE_LIST:
factory_view->view =
GIMP_CONTAINER_VIEW (gimp_container_list_view_new (factory->container,
context,
preview_size,
min_items_x,
min_items_y));
break;
default:
g_warning ("%s(): unknown GimpViewType passed", G_GNUC_FUNCTION);
gtk_object_unref (GTK_OBJECT (factory_view));
return NULL;
}
gtk_container_add (GTK_CONTAINER (factory_view),
GTK_WIDGET (factory_view->view));
gtk_widget_show (GTK_WIDGET (factory_view->view));
return GTK_WIDGET (factory_view);
}
static void
gimp_data_factory_view_new_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("new %s\n",
gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_factory_view_duplicate_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("duplicate %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_factory_view_edit_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("edit %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_factory_view_delete_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("delete %s\n", gimp_object_get_name (gimp_context_get_by_type (view->view->context, view->factory->container->children_type)));
}
static void
gimp_data_factory_view_refresh_clicked (GtkWidget *widget,
GimpDataFactoryView *view)
{
g_print ("refresh\n");
}

View File

@ -0,0 +1,75 @@
/* 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 __GIMP_DATA_FACTORY_VIEW_H__
#define __GIMP_DATA_FACTORY_VIEW_H__
#include <gtk/gtkvbox.h>
typedef enum
{
GIMP_VIEW_TYPE_GRID,
GIMP_VIEW_TYPE_LIST
} GimpViewType;
#define GIMP_TYPE_DATA_FACTORY_VIEW (gimp_data_factory_view_get_type ())
#define GIMP_DATA_FACTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_DATA_FACTORY_VIEW, GimpDataFactoryView))
#define GIMP_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA_FACTORY_VIEW, GimpDataFactoryViewClass))
#define GIMP_IS_DATA_FACTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_DATA_FACTORY_VIEW))
#define GIMP_IS_DATA_FACTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA_FACTORY_VIEW))
typedef struct _GimpDataFactoryView GimpDataFactoryView;
typedef struct _GimpDataFactoryViewClass GimpDataFactoryViewClass;
struct _GimpDataFactoryView
{
GtkVBox parent_instance;
GimpDataFactory *factory;
GimpContainerView *view;
GtkWidget *button_box;
GtkWidget *new_button;
GtkWidget *duplicate_button;
GtkWidget *edit_button;
GtkWidget *delete_button;
GtkWidget *refresh_button;
};
struct _GimpDataFactoryViewClass
{
GtkVBoxClass parent_class;
};
GtkType gimp_data_factory_view_get_type (void);
GtkWidget * gimp_data_factory_view_new (GimpViewType view_type,
GimpDataFactory *factory,
GimpContext *context,
gint preview_size,
gint min_items_x,
gint min_items_y);
#endif /* __GIMP_DATA_FACTORY_VIEW_H__ */

View File

@ -35,6 +35,7 @@
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimppattern.h"
@ -131,13 +132,13 @@ static void device_status_foreground_changed (GtkWidget *widget,
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data);
static void device_status_data_changed (GimpContext *context,
@ -470,7 +471,7 @@ devices_rc_update (gchar *name,
GimpBrush *brush;
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (brush)
@ -489,7 +490,7 @@ devices_rc_update (gchar *name,
GimpPattern *pattern;
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (pattern)
@ -508,7 +509,7 @@ devices_rc_update (gchar *name,
GimpGradient *gradient;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (gradient)
@ -1202,9 +1203,9 @@ device_status_background_changed (GtkWidget *widget,
}
static void
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
device_status_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1212,14 +1213,14 @@ device_status_drop_brush (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_brush (device_info->context, brush);
gimp_context_set_brush (device_info->context, GIMP_BRUSH (viewable));
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
device_status_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1227,13 +1228,13 @@ device_status_drop_pattern (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
gimp_context_set_pattern (device_info->context, GIMP_PATTERN (viewable));
}
}
static void
device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1242,7 +1243,7 @@ device_status_drop_gradient (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_gradient (device_info->context, gradient);
gimp_context_set_gradient (device_info->context, GIMP_GRADIENT (viewable));
}
}

View File

@ -35,6 +35,7 @@
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimppattern.h"
@ -131,13 +132,13 @@ static void device_status_foreground_changed (GtkWidget *widget,
static void device_status_background_changed (GtkWidget *widget,
gpointer data);
static void device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
GimpViewable *viewable,
gpointer data);
static void device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data);
static void device_status_data_changed (GimpContext *context,
@ -470,7 +471,7 @@ devices_rc_update (gchar *name,
GimpBrush *brush;
brush = (GimpBrush *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_brush_list),
gimp_container_get_child_by_name (global_brush_factory->container,
brush_name);
if (brush)
@ -489,7 +490,7 @@ devices_rc_update (gchar *name,
GimpPattern *pattern;
pattern = (GimpPattern *)
gimp_container_get_child_by_name (GIMP_CONTAINER (global_pattern_list),
gimp_container_get_child_by_name (global_pattern_factory->container,
pattern_name);
if (pattern)
@ -508,7 +509,7 @@ devices_rc_update (gchar *name,
GimpGradient *gradient;
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list,
gimp_container_get_child_by_name (global_gradient_factory->container,
gradient_name);
if (gradient)
@ -1202,9 +1203,9 @@ device_status_background_changed (GtkWidget *widget,
}
static void
device_status_drop_brush (GtkWidget *widget,
GimpBrush *brush,
gpointer data)
device_status_drop_brush (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1212,14 +1213,14 @@ device_status_drop_brush (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_brush (device_info->context, brush);
gimp_context_set_brush (device_info->context, GIMP_BRUSH (viewable));
}
}
static void
device_status_drop_pattern (GtkWidget *widget,
GimpPattern *pattern,
gpointer data)
device_status_drop_pattern (GtkWidget *widget,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1227,13 +1228,13 @@ device_status_drop_pattern (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_pattern (device_info->context, pattern);
gimp_context_set_pattern (device_info->context, GIMP_PATTERN (viewable));
}
}
static void
device_status_drop_gradient (GtkWidget *widget,
GimpGradient *gradient,
GimpViewable *viewable,
gpointer data)
{
DeviceInfo *device_info;
@ -1242,7 +1243,7 @@ device_status_drop_gradient (GtkWidget *widget,
if (device_info && device_info->is_present)
{
gimp_context_set_gradient (device_info->context, gradient);
gimp_context_set_gradient (device_info->context, GIMP_GRADIENT (viewable));
}
}

View File

@ -28,11 +28,11 @@
#include "apptypes.h"
#include "context_manager.h"
#include "brushes.h"
#include "fileops.h"
#include "gimpimage.h"
#include "gimpbrush.h"
#include "gimpcontainer.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpdrawable.h"
#include "gimpgradient.h"
@ -40,9 +40,6 @@
#include "gimppattern.h"
#include "gimppreview.h"
#include "gimprc.h"
#include "gradients.h"
#include "palettes.h"
#include "patterns.h"
#include "temp_buf.h"
#include "tools/tools.h"
@ -65,6 +62,7 @@ typedef enum
GIMP_DND_DATA_LAST = GIMP_DND_DATA_TOOL
} GimpDndDataType;
typedef GtkWidget * (* GimpDndGetIconFunc) (GtkWidget *widget,
GtkSignalFunc get_data_func,
gpointer get_data_data);
@ -80,6 +78,7 @@ typedef void (* GimpDndDropDataFunc) (GtkWidget *widget,
gint format,
gint length);
typedef struct _GimpDndDataDef GimpDndDataDef;
struct _GimpDndDataDef
@ -94,6 +93,7 @@ struct _GimpDndDataDef
GimpDndDropDataFunc set_data_func;
};
static GtkWidget * gimp_dnd_get_color_icon (GtkWidget *widget,
GtkSignalFunc get_color_func,
gpointer get_color_data);
@ -181,6 +181,7 @@ static void gimp_dnd_set_tool_data (GtkWidget *widget,
gint format,
gint length);
static GimpDndDataDef dnd_data_defs[] =
{
{
@ -261,6 +262,7 @@ static GimpDndDataDef dnd_data_defs[] =
}
};
/********************************/
/* general data dnd functions */
/********************************/
@ -511,6 +513,7 @@ gimp_dnd_data_dest_unset (GimpDndDataType data_type,
NULL);
}
/*************************/
/* color dnd functions */
/*************************/
@ -616,6 +619,7 @@ gimp_dnd_color_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_COLOR, widget);
}
/*********************************************/
/* GimpViewable (by GtkType) dnd functions */
/*********************************************/
@ -753,6 +757,7 @@ gimp_dnd_viewable_dest_unset (GtkWidget *widget,
}
}
/*************************/
/* brush dnd functions */
/*************************/
@ -821,10 +826,11 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
brush = gimp_brush_get_standard ();
else
brush = (GimpBrush *) gimp_container_get_child_by_name (global_brush_list,
name);
brush = (GimpBrush *)
gimp_container_get_child_by_name (global_brush_factory->container,
name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -856,6 +862,7 @@ gimp_dnd_brush_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_BRUSH, widget);
}
/***************************/
/* pattern dnd functions */
/***************************/
@ -923,10 +930,11 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
pattern = gimp_pattern_get_standard ();
else
pattern = (GimpPattern *) gimp_container_get_child_by_name (global_pattern_list,
name);
pattern = (GimpPattern *)
gimp_container_get_child_by_name (global_pattern_factory->container,
name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,
@ -959,6 +967,7 @@ gimp_dnd_pattern_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_PATTERN, widget);
}
/****************************/
/* gradient dnd functions */
/****************************/
@ -1029,10 +1038,11 @@ gimp_dnd_set_gradient_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
gradient = gradients_get_standard_gradient ();
gradient = gimp_gradient_get_standard ();
else
gradient = (GimpGradient *)
gimp_container_get_child_by_name (global_gradient_list, name);
gimp_container_get_child_by_name (global_gradient_factory->container,
name);
if (gradient)
(* (GimpDndDropGradientFunc) set_gradient_func) (widget, gradient,
@ -1065,6 +1075,7 @@ gimp_dnd_gradient_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_GRADIENT, widget);
}
/***************************/
/* palette dnd functions */
/***************************/
@ -1132,10 +1143,11 @@ gimp_dnd_set_palette_data (GtkWidget *widget,
name = (gchar *) vals;
if (strcmp (name, "Standard") == 0)
palette = palettes_get_standard_palette ();
palette = gimp_palette_get_standard ();
else
palette = (GimpPalette *) gimp_container_get_child_by_name (global_palette_list,
name);
palette = (GimpPalette *)
gimp_container_get_child_by_name (global_palette_factory->container,
name);
if (palette)
(* (GimpDndDropPaletteFunc) set_palette_func) (widget, palette,
@ -1168,6 +1180,7 @@ gimp_dnd_palette_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_PALETTE, widget);
}
/************************/
/* tool dnd functions */
/************************/
@ -1269,6 +1282,7 @@ gimp_dnd_tool_dest_unset (GtkWidget *widget)
gimp_dnd_data_dest_unset (GIMP_DND_DATA_TOOL, widget);
}
/****************************/
/* drawable dnd functions */
/****************************/
@ -1434,6 +1448,7 @@ gimp_dnd_set_drawable_preview_icon (GtkWidget *widget,
DRAG_ICON_OFFSET, DRAG_ICON_OFFSET);
}
/******************************/
/* file / url dnd functions */
/******************************/

View File

@ -71,6 +71,7 @@
#include "gimpcontainer.h"
#include "gimpcontainerlistview.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdnd.h"
#include "gimpgradient.h"
#include "gimplist.h"
@ -585,9 +586,10 @@ gradient_editor_create (void)
GTK_SIGNAL_FUNC (gradient_editor_gradient_changed),
g_editor);
g_editor->view = gimp_container_list_view_new (global_gradient_list,
g_editor->context,
16, 10, 6);
g_editor->view =
gimp_container_list_view_new (global_gradient_factory->container,
g_editor->context,
16, 10, 6);
gtk_box_pack_start (GTK_BOX (hbox), g_editor->view, TRUE, TRUE, 0);
gtk_widget_show (g_editor->view);
@ -835,10 +837,10 @@ gradient_editor_create (void)
ed_initialize_saved_colors ();
cpopup_create_main_menu ();
if (gimp_container_num_children (global_gradient_list))
if (gimp_container_num_children (global_gradient_factory->container))
{
gimp_context_set_gradient (g_editor->context,
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_list, 0)));
GIMP_GRADIENT (gimp_container_get_child_by_index (global_gradient_factory->container, 0)));
}
else
{
@ -846,7 +848,8 @@ gradient_editor_create (void)
gradient = gimp_gradient_new (_("Default"));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
gtk_widget_show (g_editor->shell);
@ -860,7 +863,8 @@ gradient_editor_free (void)
void
gradient_editor_set_gradient (GimpGradient *gradient)
{
if (gimp_container_have (global_gradient_list, GIMP_OBJECT (gradient)) &&
if (gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (gradient)) &&
g_editor)
{
gimp_context_set_gradient (g_editor->context, gradient);
@ -1049,7 +1053,8 @@ ed_do_new_gradient_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (grad));
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1128,7 +1133,7 @@ ed_do_copy_gradient_callback (GtkWidget *widget,
grad->segments = head;
gimp_container_add (global_gradient_list, GIMP_OBJECT (grad));
gimp_container_add (global_gradient_factory->container, GIMP_OBJECT (grad));
gimp_context_set_gradient (g_editor->context, grad);
@ -1188,7 +1193,8 @@ ed_delete_gradient_callback (GtkWidget *widget,
gradient = gimp_context_get_gradient (g_editor->context);
if (! (gimp_container_num_children (global_gradient_list) && gradient))
if (! (gimp_container_num_children (global_gradient_factory->container) &&
gradient))
return;
gtk_widget_set_sensitive (g_editor->shell, FALSE);
@ -1227,14 +1233,15 @@ ed_do_delete_gradient_callback (GtkWidget *widget,
delete_gradient = (GimpGradient *) data;
if (! gimp_container_have (global_gradient_list,
if (! gimp_container_have (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient)))
return;
if (GIMP_DATA (delete_gradient)->filename)
gimp_data_delete_from_disk (GIMP_DATA (delete_gradient));
gimp_container_remove (global_gradient_list, GIMP_OBJECT (delete_gradient));
gimp_container_remove (global_gradient_factory->container,
GIMP_OBJECT (delete_gradient));
}
/***** The "save as pov" dialog functions *****/
@ -1370,7 +1377,7 @@ ed_refresh_grads_callback (GtkWidget *widget,
{
gradients_init (FALSE);
if (! gimp_container_num_children (global_gradient_list))
if (! gimp_container_num_children (global_gradient_factory->container))
{
GimpGradient *gradient;
@ -1378,7 +1385,8 @@ ed_refresh_grads_callback (GtkWidget *widget,
gimp_data_dirty (GIMP_DATA (gradient));
gimp_container_add (global_gradient_list, GIMP_OBJECT (gradient));
gimp_container_add (global_gradient_factory->container,
GIMP_OBJECT (gradient));
}
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);

Some files were not shown because too many files have changed in this diff Show More