added "name", "blurb", "stock_id" and "help_id" to struct

2004-09-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdialogfactory.[ch]: added "name", "blurb",
	"stock_id" and "help_id" to struct GimpDialogFactoryEntry and to
	gimp_dialog_factory_dialog_register(). Added typedef
	GimpDialogConstructor which takes a GimpDialogFactoryEntry in
	addition to the parameters GimpDialogNewFunc takes. Added a
	constructor function pointer to GimpDialogFactory which defaults
	to a function that just returns entry->new_func(). Use that
	constructor instead of entry->new_func() for creating
	dialogs. Added public API gimp_dialog_factory_set_constructor().

	* app/dialogs/dialogs.c: register name, blurb, stock_id and
	help_id for all dockables so all the dialog info lives in one huge
	ugly table now. For the global_toolbox_factory and the
	global_dock_factory, set a constructor which creates a dockable
	around the widget returned by entry->new_func().

	* app/dialogs/dialogs-constructors.[ch]: don't create the dockable
	in each dialog constructor. Removes tons of code and reduces most
	constructors to a "return gimp_foo_new(...)" one-liner. Got rid of
	all static variables, they were from a time when GimpDialogFactory
	was unable to manage singletons.

	* app/widgets/gimpbrusheditor.[ch]
	* app/widgets/gimpgradienteditor.[ch]
	* app/widgets/gimppaletteeditor.[ch]: return GtkWidget, not
	GimpDataEditor from gimp_foo_editor_new().

	* app/widgets/gimpdataeditor.c: minor cleanups.
This commit is contained in:
Michael Natterer
2004-09-26 18:41:29 +00:00
committed by Michael Natterer
parent f6a205f83f
commit 6a50c27047
13 changed files with 502 additions and 511 deletions

View File

@ -1,3 +1,34 @@
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdialogfactory.[ch]: added "name", "blurb",
"stock_id" and "help_id" to struct GimpDialogFactoryEntry and to
gimp_dialog_factory_dialog_register(). Added typedef
GimpDialogConstructor which takes a GimpDialogFactoryEntry in
addition to the parameters GimpDialogNewFunc takes. Added a
constructor function pointer to GimpDialogFactory which defaults
to a function that just returns entry->new_func(). Use that
constructor instead of entry->new_func() for creating
dialogs. Added public API gimp_dialog_factory_set_constructor().
* app/dialogs/dialogs.c: register name, blurb, stock_id and
help_id for all dockables so all the dialog info lives in one huge
ugly table now. For the global_toolbox_factory and the
global_dock_factory, set a constructor which creates a dockable
around the widget returned by entry->new_func().
* app/dialogs/dialogs-constructors.[ch]: don't create the dockable
in each dialog constructor. Removes tons of code and reduces most
constructors to a "return gimp_foo_new(...)" one-liner. Got rid of
all static variables, they were from a time when GimpDialogFactory
was unable to manage singletons.
* app/widgets/gimpbrusheditor.[ch]
* app/widgets/gimpgradienteditor.[ch]
* app/widgets/gimppaletteeditor.[ch]: return GtkWidget, not
GimpDataEditor from gimp_foo_editor_new().
* app/widgets/gimpdataeditor.c: minor cleanups.
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcolordialog.c: moved stuff from new() to init().
@ -6,7 +37,7 @@
Ported GimpNavigationView to use actions for its buttons:
* app/menus/menus.c (menus_init): register a <GimpNaviagaionEditor>
* app/menus/menus.c (menus_init): register a <GimpNavigationEditor>
UI manager containing the "view" action group.
* app/actions/actions.c (action_data_get_foo): handle "data" being

View File

@ -90,12 +90,6 @@
/* local function prototypes */
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
const gchar *blurb,
const gchar *stock_id,
const gchar *help_id);
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,
gpointer data);
@ -185,6 +179,7 @@ dialogs_quit_get (GimpDialogFactory *factory,
return quit_dialog_new (context->gimp);
}
/***********/
/* docks */
/***********/
@ -195,7 +190,7 @@ dialogs_toolbox_get (GimpDialogFactory *factory,
gint preview_size)
{
/* we pass "global_dock_factory", _not_ "global_toolbox_factory" to
* the toolbox constructor, because the toolbox_factory has no
* the toolbox constructor, because the global_toolbox_factory has no
* dockables registered
*/
return gimp_toolbox_new (global_dock_factory, context->gimp);
@ -216,24 +211,40 @@ dialogs_dock_new (GimpDialogFactory *factory,
/* dockables */
/***************/
/***** the dockable constructor *****/
GtkWidget *
dialogs_dockable_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size)
{
GtkWidget *dockable = NULL;
GtkWidget *widget;
widget = entry->new_func (factory, context, preview_size);
if (widget)
{
dockable = gimp_dockable_new (entry->name, entry->blurb,
entry->stock_id, entry->help_id);
gtk_container_add (GTK_CONTAINER (dockable), widget);
gtk_widget_show (widget);
}
return dockable;
}
/***** singleton dialogs *****/
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = gimp_tool_options_editor_new (context->gimp, factory->menu_factory);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer) &view);
return dialogs_dockable_new (view,
_("Tool Options"), NULL,
GIMP_STOCK_TOOL_OPTIONS,
GIMP_HELP_TOOL_OPTIONS_DIALOG);
return gimp_tool_options_editor_new (context->gimp,
factory->menu_factory);
}
GtkWidget *
@ -241,19 +252,7 @@ dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = gimp_device_status_new (context->gimp);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer) &view);
return dialogs_dockable_new (view,
_("Devices"), _("Device Status"),
GIMP_STOCK_DEVICE_STATUS,
GIMP_HELP_DEVICE_STATUS_DIALOG);
return gimp_device_status_new (context->gimp);
}
GtkWidget *
@ -261,19 +260,8 @@ dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
static GtkWidget *view = NULL;
if (view)
return NULL;
view = gimp_error_console_new (context->gimp, factory->menu_factory);
g_object_add_weak_pointer (G_OBJECT (view), (gpointer) &view);
return dialogs_dockable_new (view,
_("Errors"), _("Error Console"),
GIMP_STOCK_WARNING,
GIMP_HELP_ERRORS_DIALOG);
return gimp_error_console_new (context->gimp,
factory->menu_factory);
}
@ -284,18 +272,11 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_image_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_image_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->images,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Images"), NULL,
GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG);
}
GtkWidget *
@ -303,20 +284,13 @@ dialogs_brush_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_brush_factory_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_brush_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->brush_factory,
dialogs_edit_brush_func,
context,
TRUE,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Brushes"), NULL,
GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG);
}
GtkWidget *
@ -324,19 +298,12 @@ dialogs_pattern_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG);
}
GtkWidget *
@ -344,9 +311,7 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->gradient_factory,
dialogs_edit_gradient_func,
context,
@ -354,11 +319,6 @@ dialogs_gradient_list_view_new (GimpDialogFactory *factory,
factory->menu_factory, "<Gradients>",
"/gradients-popup",
"gradients");
return dialogs_dockable_new (view,
_("Gradients"), NULL,
GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG);
}
GtkWidget *
@ -366,9 +326,7 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->palette_factory,
dialogs_edit_palette_func,
context,
@ -376,11 +334,6 @@ dialogs_palette_list_view_new (GimpDialogFactory *factory,
factory->menu_factory, "<Palettes>",
"/palettes-popup",
"palettes");
return dialogs_dockable_new (view,
_("Palettes"), NULL,
GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG);
}
GtkWidget *
@ -388,18 +341,11 @@ dialogs_font_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_font_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_font_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->fonts,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Fonts"), NULL,
GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG);
}
GtkWidget *
@ -407,18 +353,11 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_tool_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_tool_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->tool_info_list,
context,
preview_size, 0,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Tools"), NULL,
GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG);
}
GtkWidget *
@ -426,18 +365,11 @@ dialogs_buffer_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_buffer_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->named_buffers,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Buffers"), NULL,
GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG);
}
GtkWidget *
@ -445,18 +377,11 @@ dialogs_document_list_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("History"), _("Document History"),
GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG);
}
GtkWidget *
@ -464,18 +389,11 @@ dialogs_template_list_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
return gimp_template_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->templates,
context,
preview_size, 0,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Templates"), _("Image Templates"),
GIMP_STOCK_TEMPLATE,
GIMP_HELP_TEMPLATE_DIALOG);
}
@ -486,18 +404,11 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_image_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_image_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->images,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Images"), NULL,
GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG);
}
GtkWidget *
@ -505,20 +416,13 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_brush_factory_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_brush_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->brush_factory,
dialogs_edit_brush_func,
context,
TRUE,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Brushes"), NULL,
GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG);
}
GtkWidget *
@ -526,19 +430,12 @@ dialogs_pattern_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_pattern_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->pattern_factory,
NULL,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Patterns"), NULL,
GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG);
}
GtkWidget *
@ -546,9 +443,7 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->gradient_factory,
dialogs_edit_gradient_func,
context,
@ -556,11 +451,6 @@ dialogs_gradient_grid_view_new (GimpDialogFactory *factory,
factory->menu_factory, "<Gradients>",
"/gradients-popup",
"gradients");
return dialogs_dockable_new (view,
_("Gradients"), NULL,
GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG);
}
GtkWidget *
@ -568,9 +458,7 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->palette_factory,
dialogs_edit_palette_func,
context,
@ -578,11 +466,6 @@ dialogs_palette_grid_view_new (GimpDialogFactory *factory,
factory->menu_factory, "<Palettes>",
"/palettes-popup",
"palettes");
return dialogs_dockable_new (view,
_("Palettes"), NULL,
GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG);
}
GtkWidget *
@ -590,18 +473,11 @@ dialogs_font_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_font_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_font_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->fonts,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Fonts"), NULL,
GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG);
}
GtkWidget *
@ -609,18 +485,11 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_tool_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_tool_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->tool_info_list,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Tools"), NULL,
GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG);
}
GtkWidget *
@ -628,18 +497,11 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_buffer_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_buffer_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->named_buffers,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("Buffers"), NULL,
GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG);
}
GtkWidget *
@ -647,18 +509,11 @@ dialogs_document_grid_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
return gimp_document_view_new (GIMP_VIEW_TYPE_GRID,
context->gimp->documents,
context,
preview_size, 1,
factory->menu_factory);
return dialogs_dockable_new (view,
_("History"), _("Document History"),
GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG);
}
@ -669,12 +524,10 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
if (preview_size < 1)
preview_size = context->gimp->config->layer_preview_size;
view =
return
gimp_item_tree_view_new (preview_size, 2,
gimp_context_get_image (context),
GIMP_TYPE_LAYER,
@ -684,11 +537,6 @@ dialogs_layer_list_view_new (GimpDialogFactory *factory,
(GimpActivateItemFunc) layers_text_tool,
factory->menu_factory, "<Layers>",
"/layers-popup");
return dialogs_dockable_new (view,
_("Layers"), NULL,
GIMP_STOCK_LAYERS,
GIMP_HELP_LAYER_DIALOG);
}
GtkWidget *
@ -696,12 +544,10 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
if (preview_size < 1)
preview_size = context->gimp->config->layer_preview_size;
view =
return
gimp_item_tree_view_new (preview_size, 1,
gimp_context_get_image (context),
GIMP_TYPE_CHANNEL,
@ -711,11 +557,6 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
(GimpActivateItemFunc) channels_edit_channel_query,
factory->menu_factory, "<Channels>",
"/channels-popup");
return dialogs_dockable_new (view,
_("Channels"), NULL,
GIMP_STOCK_CHANNELS,
GIMP_HELP_CHANNEL_DIALOG);
}
GtkWidget *
@ -723,12 +564,10 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
if (preview_size < 1)
preview_size = context->gimp->config->layer_preview_size;
view =
return
gimp_item_tree_view_new (preview_size, 1,
gimp_context_get_image (context),
GIMP_TYPE_VECTORS,
@ -738,15 +577,10 @@ dialogs_vectors_list_view_new (GimpDialogFactory *factory,
(GimpActivateItemFunc) vectors_vectors_tool,
factory->menu_factory, "<Vectors>",
"/vectors-popup");
return dialogs_dockable_new (view,
_("Paths"), NULL,
GIMP_STOCK_PATHS,
GIMP_HELP_PATH_DIALOG);
}
GtkWidget *
dialogs_indexed_palette_new (GimpDialogFactory *factory,
dialogs_colormap_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
@ -758,10 +592,7 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
G_CALLBACK (dialogs_indexed_palette_selected),
NULL);
return dialogs_dockable_new (view,
_("Colormap"), _("Indexed Palette"),
GIMP_STOCK_INDEXED_PALETTE,
GIMP_HELP_INDEXED_PALETTE_DIALOG);
return view;
}
GtkWidget *
@ -769,14 +600,7 @@ dialogs_histogram_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_histogram_editor_new ();
return dialogs_dockable_new (view,
_("Histogram"), NULL,
GIMP_STOCK_HISTOGRAM,
GIMP_HELP_HISTOGRAM_DIALOG);
return gimp_histogram_editor_new ();
}
GtkWidget *
@ -784,48 +608,27 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_selection_editor_new (factory->menu_factory);
return dialogs_dockable_new (view,
_("Selection"), _("Selection Editor"),
GIMP_STOCK_TOOL_RECT_SELECT,
GIMP_HELP_SELECTION_DIALOG);
return gimp_selection_editor_new (factory->menu_factory);
}
GtkWidget *
dialogs_undo_history_new (GimpDialogFactory *factory,
dialogs_undo_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *editor;
editor = gimp_undo_editor_new (context->gimp->config,
return gimp_undo_editor_new (context->gimp->config,
factory->menu_factory);
return dialogs_dockable_new (editor,
_("Undo"), _("Undo History"),
GIMP_STOCK_UNDO_HISTORY,
GIMP_HELP_UNDO_DIALOG);
}
/***** display related dialogs *****/
GtkWidget *
dialogs_navigation_view_new (GimpDialogFactory *factory,
dialogs_navigation_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_navigation_editor_new (factory->menu_factory);
return dialogs_dockable_new (view,
_("Navigation"), _("Display Navigation"),
GIMP_STOCK_NAVIGATION,
GIMP_HELP_NAVIGATION_DIALOG);
return gimp_navigation_editor_new (factory->menu_factory);
}
@ -836,129 +639,96 @@ dialogs_color_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GtkWidget *view;
view = gimp_color_editor_new (context);
return dialogs_dockable_new (view,
_("FG/BG"), _("FG/BG Color"),
GIMP_STOCK_DEFAULT_COLORS,
GIMP_HELP_COLOR_DIALOG);
return gimp_color_editor_new (context);
}
/*********************/
/***** editors *****/
/*********************/
/* the brush editor */
static GimpDataEditor *brush_editor = NULL;
GtkWidget *
dialogs_brush_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
brush_editor = gimp_brush_editor_new (context->gimp);
return dialogs_dockable_new (GTK_WIDGET (brush_editor),
_("Brush Editor"), NULL,
GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_EDITOR_DIALOG);
return gimp_brush_editor_new (context->gimp);
}
void
dialogs_edit_brush_func (GimpData *data,
GtkWidget *parent)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
GtkWidget *dockable;
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (parent),
"gimp-brush-editor",
-1);
gimp_data_editor_set_data (brush_editor, data);
gimp_data_editor_set_data (GIMP_DATA_EDITOR (GTK_BIN (dockable)->child),
data);
}
/* the gradient editor */
static GimpDataEditor *gradient_editor = NULL;
GtkWidget *
dialogs_gradient_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
gradient_editor = gimp_gradient_editor_new (context->gimp,
return gimp_gradient_editor_new (context->gimp,
factory->menu_factory);
return dialogs_dockable_new (GTK_WIDGET (gradient_editor),
_("Gradient Editor"), NULL,
GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_EDITOR_DIALOG);
}
void
dialogs_edit_gradient_func (GimpData *data,
GtkWidget *parent)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
GtkWidget *dockable;
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (parent),
"gimp-gradient-editor",
-1);
gimp_data_editor_set_data (gradient_editor, data);
gimp_data_editor_set_data (GIMP_DATA_EDITOR (GTK_BIN (dockable)->child),
data);
}
/* the palette editor */
static GimpDataEditor *palette_editor = NULL;
GtkWidget *
dialogs_palette_editor_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
palette_editor = gimp_palette_editor_new (context->gimp,
return gimp_palette_editor_new (context->gimp,
factory->menu_factory);
return dialogs_dockable_new (GTK_WIDGET (palette_editor),
_("Palette Editor"), NULL,
GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_EDITOR_DIALOG);
}
void
dialogs_edit_palette_func (GimpData *data,
GtkWidget *parent)
{
gimp_dialog_factory_dialog_raise (global_dock_factory,
GtkWidget *dockable;
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
gtk_widget_get_screen (parent),
"gimp-palette-editor",
-1);
gimp_data_editor_set_data (palette_editor, data);
gimp_data_editor_set_data (GIMP_DATA_EDITOR (GTK_BIN (dockable)->child),
data);
}
/* private functions */
static GtkWidget *
dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
const gchar *blurb,
const gchar *stock_id,
const gchar *help_id)
{
GtkWidget *dockable;
dockable = gimp_dockable_new (name, blurb, stock_id, help_id);
gtk_container_add (GTK_CONTAINER (dockable), widget);
gtk_widget_show (widget);
return dockable;
}
static void
dialogs_indexed_palette_selected (GimpColormapEditor *editor,
GdkModifierType state,

View File

@ -66,6 +66,11 @@ GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
/* dockables */
GtkWidget * dialogs_dockable_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
@ -147,7 +152,7 @@ GtkWidget * dialogs_vectors_list_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_indexed_palette_new (GimpDialogFactory *factory,
GtkWidget * dialogs_colormap_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
@ -156,11 +161,11 @@ GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
GtkWidget * dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_undo_history_new (GimpDialogFactory *factory,
GtkWidget * dialogs_undo_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_navigation_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_navigation_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);

View File

@ -20,17 +20,22 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "dialogs-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmenufactory.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "gimp-intl.h"
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_dock_factory = NULL;
@ -40,157 +45,269 @@ GimpDialogFactory *global_toolbox_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
/* foreign toplevels without constructor */
{ "gimp-brightness-contrast-tool-dialog",
{ "gimp-brightness-contrast-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-color-picker-tool-dialog",
{ "gimp-color-picker-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-colorize-tool-dialog",
{ "gimp-colorize-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-crop-tool-dialog",
{ "gimp-crop-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-curves-tool-dialog",
{ "gimp-curves-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-color-balance-tool-dialog",
{ "gimp-color-balance-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-hue-saturation-tool-dialog",
{ "gimp-hue-saturation-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-levels-tool-dialog",
{ "gimp-levels-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-measure-tool-dialog",
{ "gimp-measure-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-posterize-tool-dialog",
{ "gimp-posterize-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-rotate-tool-dialog",
{ "gimp-rotate-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-scale-tool-dialog",
{ "gimp-scale-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-shear-tool-dialog",
{ "gimp-shear-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-text-tool-dialog",
{ "gimp-text-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-threshold-tool-dialog",
{ "gimp-threshold-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-perspective-tool-dialog",
{ "gimp-perspective-tool-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-toolbox-color-dialog",
{ "gimp-toolbox-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-gradient-editor-color-dialog",
{ "gimp-gradient-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-palette-editor-color-dialog",
{ "gimp-palette-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-colormap-editor-color-dialog",
{ "gimp-colormap-editor-color-dialog", NULL, NULL, NULL, NULL,
NULL, 0, FALSE, TRUE, FALSE, FALSE },
/* ordinary toplevels */
{ "gimp-image-new-dialog", dialogs_image_new_new,
0, FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-open-dialog", dialogs_file_open_new,
0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-file-open-location-dialog", dialogs_file_open_location_new,
0, FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-save-dialog", dialogs_file_save_new,
0, FALSE, TRUE, TRUE, FALSE },
{ "gimp-image-new-dialog", NULL, NULL, NULL, NULL,
dialogs_image_new_new, 0,
FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-open-dialog", NULL, NULL, NULL, NULL,
dialogs_file_open_new, 0,
TRUE, TRUE, TRUE, FALSE },
{ "gimp-file-open-location-dialog", NULL, NULL, NULL, NULL,
dialogs_file_open_location_new, 0,
FALSE, TRUE, FALSE, FALSE },
{ "gimp-file-save-dialog", NULL, NULL, NULL, NULL,
dialogs_file_save_new, 0,
FALSE, TRUE, TRUE, FALSE },
/* singleton toplevels */
{ "gimp-preferences-dialog", dialogs_preferences_get,
0, TRUE, TRUE, FALSE, FALSE },
{ "gimp-module-dialog", dialogs_module_get,
0, TRUE, TRUE, TRUE, FALSE },
{ "gimp-tips-dialog", dialogs_tips_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-about-dialog", dialogs_about_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-error-dialog", dialogs_error_get,
0, TRUE, FALSE, FALSE, FALSE },
{ "gimp-quit-dialog", dialogs_quit_get,
0, TRUE, FALSE, FALSE, FALSE }
{ "gimp-preferences-dialog", NULL, NULL, NULL, NULL,
dialogs_preferences_get, 0,
TRUE, TRUE, FALSE, FALSE },
{ "gimp-module-dialog", NULL, NULL, NULL, NULL,
dialogs_module_get, 0,
TRUE, TRUE, TRUE, FALSE },
{ "gimp-tips-dialog", NULL, NULL, NULL, NULL,
dialogs_tips_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-about-dialog", NULL, NULL, NULL, NULL,
dialogs_about_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-error-dialog", NULL, NULL, NULL, NULL,
dialogs_error_get, 0,
TRUE, FALSE, FALSE, FALSE },
{ "gimp-quit-dialog", NULL, NULL, NULL, NULL,
dialogs_quit_get, 0,
TRUE, FALSE, FALSE, FALSE }
};
static const GimpDialogFactoryEntry dock_entries[] =
{
/* singleton dockables */
{ "gimp-tool-options", dialogs_tool_options_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-device-status", dialogs_device_status_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-error-console", dialogs_error_console_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-tool-options",
N_("Tool Options"), NULL, GIMP_STOCK_TOOL_OPTIONS,
GIMP_HELP_TOOL_OPTIONS_DIALOG,
dialogs_tool_options_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-device-status",
N_("Devices"), N_("Device Status"), GIMP_STOCK_DEVICE_STATUS,
GIMP_HELP_DEVICE_STATUS_DIALOG,
dialogs_device_status_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-error-console",
N_("Errors"), N_("Error Console"), GIMP_STOCK_WARNING,
GIMP_HELP_ERRORS_DIALOG,
dialogs_error_console_get, 0,
TRUE, FALSE, FALSE, TRUE },
/* list views */
{ "gimp-image-list", dialogs_image_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-list", dialogs_brush_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-list", dialogs_pattern_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-list", dialogs_gradient_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-list", dialogs_palette_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-list", dialogs_font_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-list", dialogs_tool_list_view_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-list", dialogs_buffer_list_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-list", dialogs_document_list_new,
GIMP_VIEW_SIZE_LARGE, FALSE, FALSE, FALSE, TRUE },
{ "gimp-template-list", dialogs_template_list_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-image-list",
N_("Images"), NULL, GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG,
dialogs_image_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-list",
N_("Brushes"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG,
dialogs_brush_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-list",
N_("Patterns"), NULL, GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG,
dialogs_pattern_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-list",
N_("Gradients"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG,
dialogs_gradient_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-list",
N_("Palettes"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG,
dialogs_palette_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-list",
N_("Fonts"), NULL, GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG,
dialogs_font_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-list",
N_("Tools"), NULL, GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG,
dialogs_tool_list_view_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-list",
N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG,
dialogs_buffer_list_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-list",
N_("History"), N_("Document History"), GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG,
dialogs_document_list_new, GIMP_VIEW_SIZE_LARGE,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-template-list",
N_("Templates"), N_("Image Templates"), GIMP_STOCK_TEMPLATE,
GIMP_HELP_TEMPLATE_DIALOG,
dialogs_template_list_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
/* grid views */
{ "gimp-image-grid", dialogs_image_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-grid", dialogs_brush_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-grid", dialogs_pattern_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-grid", dialogs_gradient_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-grid", dialogs_palette_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-grid", dialogs_font_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-grid", dialogs_tool_grid_view_new,
GIMP_VIEW_SIZE_SMALL, FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-grid", dialogs_buffer_grid_view_new,
GIMP_VIEW_SIZE_MEDIUM, FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-grid", dialogs_document_grid_new,
GIMP_VIEW_SIZE_LARGE, FALSE, FALSE, FALSE, TRUE },
{ "gimp-image-grid",
N_("Images"), NULL, GIMP_STOCK_IMAGES,
GIMP_HELP_IMAGE_DIALOG,
dialogs_image_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-brush-grid",
N_("Brushes"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_DIALOG,
dialogs_brush_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-pattern-grid",
N_("Patterns"), NULL, GIMP_STOCK_PATTERN,
GIMP_HELP_PATTERN_DIALOG,
dialogs_pattern_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-gradient-grid",
N_("Gradients"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_DIALOG,
dialogs_gradient_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-palette-grid",
N_("Palettes"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_DIALOG,
dialogs_palette_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-font-grid",
N_("Fonts"), NULL, GIMP_STOCK_FONT,
GIMP_HELP_FONT_DIALOG,
dialogs_font_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-tool-grid",
N_("Tools"), NULL, GIMP_STOCK_TOOLS,
GIMP_HELP_TOOLS_DIALOG,
dialogs_tool_grid_view_new, GIMP_VIEW_SIZE_SMALL,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-buffer-grid",
N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
GIMP_HELP_BUFFER_DIALOG,
dialogs_buffer_grid_view_new, GIMP_VIEW_SIZE_MEDIUM,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-document-grid",
N_("History"), N_("Document History"), GTK_STOCK_OPEN,
GIMP_HELP_DOCUMENT_DIALOG,
dialogs_document_grid_new, GIMP_VIEW_SIZE_LARGE,
FALSE, FALSE, FALSE, TRUE },
/* image related */
{ "gimp-layer-list", dialogs_layer_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-channel-list", dialogs_channel_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-vectors-list", dialogs_vectors_list_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor", dialogs_histogram_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor", dialogs_selection_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history", dialogs_undo_history_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-layer-list",
N_("Layers"), NULL, GIMP_STOCK_LAYERS,
GIMP_HELP_LAYER_DIALOG,
dialogs_layer_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-channel-list",
N_("Channels"), NULL, GIMP_STOCK_CHANNELS,
GIMP_HELP_CHANNEL_DIALOG,
dialogs_channel_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-vectors-list",
N_("Paths"), NULL, GIMP_STOCK_PATHS,
GIMP_HELP_PATH_DIALOG,
dialogs_vectors_list_view_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette",
N_("Colormap"), N_("Indexed Palette"), GIMP_STOCK_INDEXED_PALETTE,
GIMP_HELP_INDEXED_PALETTE_DIALOG,
dialogs_colormap_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor",
N_("Histogram"), NULL, GIMP_STOCK_HISTOGRAM,
GIMP_HELP_HISTOGRAM_DIALOG,
dialogs_histogram_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor",
N_("Selection"), N_("Selection Editor"), GIMP_STOCK_TOOL_RECT_SELECT,
GIMP_HELP_SELECTION_DIALOG,
dialogs_selection_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history",
N_("Undo"), N_("Undo History"), GIMP_STOCK_UNDO_HISTORY,
GIMP_HELP_UNDO_DIALOG,
dialogs_undo_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* display related */
{ "gimp-navigation-view", dialogs_navigation_view_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-navigation-view",
N_("Navigation"), N_("Display Navigation"), GIMP_STOCK_NAVIGATION,
GIMP_HELP_NAVIGATION_DIALOG,
dialogs_navigation_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* editors */
{ "gimp-color-editor", dialogs_color_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-color-editor",
N_("FG/BG"), N_("FG/BG Color"), GIMP_STOCK_DEFAULT_COLORS,
GIMP_HELP_COLOR_DIALOG,
dialogs_color_editor_new, 0,
FALSE, FALSE, FALSE, TRUE },
/* singleton editors */
{ "gimp-brush-editor", dialogs_brush_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-gradient-editor", dialogs_gradient_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-palette-editor", dialogs_palette_editor_get,
0, TRUE, FALSE, FALSE, TRUE },
{ "gimp-brush-editor",
N_("Brush Editor"), NULL, GIMP_STOCK_BRUSH,
GIMP_HELP_BRUSH_EDITOR_DIALOG,
dialogs_brush_editor_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-gradient-editor",
N_("Gradient Editor"), NULL, GIMP_STOCK_GRADIENT,
GIMP_HELP_GRADIENT_EDITOR_DIALOG,
dialogs_gradient_editor_get, 0,
TRUE, FALSE, FALSE, TRUE },
{ "gimp-palette-editor",
N_("Palette Editor"), NULL, GIMP_STOCK_PALETTE,
GIMP_HELP_PALETTE_EDITOR_DIALOG,
dialogs_palette_editor_get, 0,
TRUE, FALSE, FALSE, TRUE }
};
@ -214,15 +331,23 @@ dialogs_init (Gimp *gimp,
gimp_get_user_context (gimp),
menu_factory,
dialogs_toolbox_get);
gimp_dialog_factory_set_constructor (global_toolbox_factory,
dialogs_dockable_constructor);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
menu_factory,
dialogs_dock_new);
gimp_dialog_factory_set_constructor (global_dock_factory,
dialogs_dockable_constructor);
for (i = 0; i < G_N_ELEMENTS (toplevel_entries); i++)
gimp_dialog_factory_register_entry (global_dialog_factory,
toplevel_entries[i].identifier,
gettext (toplevel_entries[i].name),
gettext (toplevel_entries[i].blurb),
toplevel_entries[i].stock_id,
toplevel_entries[i].help_id,
toplevel_entries[i].new_func,
toplevel_entries[i].preview_size,
toplevel_entries[i].singleton,
@ -233,6 +358,10 @@ dialogs_init (Gimp *gimp,
for (i = 0; i < G_N_ELEMENTS (dock_entries); i++)
gimp_dialog_factory_register_entry (global_dock_factory,
dock_entries[i].identifier,
gettext (dock_entries[i].name),
gettext (dock_entries[i].blurb),
dock_entries[i].stock_id,
dock_entries[i].help_id,
dock_entries[i].new_func,
dock_entries[i].preview_size,
dock_entries[i].singleton,

View File

@ -286,22 +286,22 @@ gimp_brush_editor_set_data (GimpDataEditor *editor,
/* public functions */
GimpDataEditor *
GtkWidget *
gimp_brush_editor_new (Gimp *gimp)
{
GimpBrushEditor *brush_editor;
GimpBrushEditor *editor;
brush_editor = g_object_new (GIMP_TYPE_BRUSH_EDITOR, NULL);
editor = g_object_new (GIMP_TYPE_BRUSH_EDITOR, NULL);
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (brush_editor),
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
gimp->brush_factory,
NULL, NULL, NULL))
{
g_object_unref (brush_editor);
g_object_unref (editor);
return NULL;
}
return GIMP_DATA_EDITOR (brush_editor);
return GTK_WIDGET (editor);
}

View File

@ -60,7 +60,7 @@ struct _GimpBrushEditorClass
GType gimp_brush_editor_get_type (void) G_GNUC_CONST;
GimpDataEditor * gimp_brush_editor_new (Gimp *gimp);
GtkWidget * gimp_brush_editor_new (Gimp *gimp);
#endif /* __GIMP_BRUSH_EDITOR_H__ */

View File

@ -47,12 +47,13 @@ static void gimp_data_editor_class_init (GimpDataEditorClass *klass);
static void gimp_data_editor_init (GimpDataEditor *view);
static void gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface);
static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
static GList * gimp_data_editor_get_aux_info (GimpDocked *docked);
static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data);
@ -115,9 +116,7 @@ gimp_data_editor_get_type (void)
static void
gimp_data_editor_class_init (GimpDataEditorClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@ -169,6 +168,21 @@ gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface)
docked_iface->get_aux_info = gimp_data_editor_get_aux_info;
}
static void
gimp_data_editor_dispose (GObject *object)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
if (editor->data)
{
/* Save dirty data before we clear out */
gimp_data_editor_save_dirty (editor);
gimp_data_editor_set_data (editor, NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
#define AUX_INFO_CURRENT_DATA "current-data"
static void
@ -216,21 +230,6 @@ gimp_data_editor_get_aux_info (GimpDocked *docked)
return aux_info;
}
static void
gimp_data_editor_dispose (GObject *object)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
if (editor->data)
{
/* Save dirty data before we clear out */
gimp_data_editor_save_dirty (editor);
gimp_data_editor_set_data (editor, NULL);
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data)

View File

@ -64,6 +64,11 @@ static void gimp_dialog_factory_init (GimpDialogFactory *factory);
static void gimp_dialog_factory_dispose (GObject *object);
static void gimp_dialog_factory_finalize (GObject *object);
static GtkWidget *
gimp_dialog_factory_default_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size);
static void gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry);
@ -147,6 +152,7 @@ gimp_dialog_factory_init (GimpDialogFactory *factory)
{
factory->menu_factory = NULL;
factory->new_dock_func = NULL;
factory->constructor = gimp_dialog_factory_default_constructor;
factory->registered_dialogs = NULL;
factory->session_infos = NULL;
factory->open_dialogs = NULL;
@ -207,6 +213,10 @@ gimp_dialog_factory_finalize (GObject *object)
entry = (GimpDialogFactoryEntry *) list->data;
g_free (entry->identifier);
g_free (entry->name);
g_free (entry->blurb);
g_free (entry->stock_id);
g_free (entry->help_id);
g_free (entry);
}
@ -287,9 +297,25 @@ gimp_dialog_factory_from_name (const gchar *name)
return factory;
}
void
gimp_dialog_factory_set_constructor (GimpDialogFactory *factory,
GimpDialogConstructor constructor)
{
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
if (! constructor)
constructor = gimp_dialog_factory_default_constructor;
factory->constructor = constructor;
}
void
gimp_dialog_factory_register_entry (GimpDialogFactory *factory,
const gchar *identifier,
const gchar *name,
const gchar *blurb,
const gchar *stock_id,
const gchar *help_id,
GimpDialogNewFunc new_func,
gint preview_size,
gboolean singleton,
@ -305,6 +331,10 @@ gimp_dialog_factory_register_entry (GimpDialogFactory *factory,
entry = g_new0 (GimpDialogFactoryEntry, 1);
entry->identifier = g_strdup (identifier);
entry->name = g_strdup (name);
entry->blurb = g_strdup (blurb);
entry->stock_id = g_strdup (stock_id);
entry->help_id = g_strdup (help_id);
entry->new_func = new_func;
entry->preview_size = preview_size;
entry->singleton = singleton ? TRUE : FALSE;
@ -440,15 +470,15 @@ gimp_dialog_factory_dialog_new_internal (GimpDialogFactory *factory,
preview_size = entry->preview_size;
if (context)
dialog = entry->new_func (factory,
dialog = factory->constructor (factory, entry,
context,
preview_size);
else if (dock)
dialog = entry->new_func (factory,
dialog = factory->constructor (factory, entry,
GIMP_DOCK (dock)->context,
preview_size);
else
dialog = entry->new_func (factory,
dialog = factory->constructor (factory, entry,
factory->context,
preview_size);
@ -1146,7 +1176,16 @@ gimp_dialog_factory_from_widget (GtkWidget *dialog,
/* private functions */
void
static GtkWidget *
gimp_dialog_factory_default_constructor (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size)
{
return entry->new_func (factory, context, preview_size);
}
static void
gimp_dialog_factory_set_widget_data (GtkWidget *dialog,
GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry)

View File

@ -39,13 +39,23 @@ typedef enum
typedef GtkWidget * (* GimpDialogNewFunc) (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
typedef GtkWidget * (* GimpDialogConstructor) (GimpDialogFactory *factory,
GimpDialogFactoryEntry *entry,
GimpContext *context,
gint preview_size);
struct _GimpDialogFactoryEntry
{
gchar *identifier;
gchar *name;
gchar *blurb;
gchar *stock_id;
gchar *help_id;
GimpDialogNewFunc new_func;
gint preview_size;
gboolean singleton;
gboolean session_managed;
gboolean remember_size;
@ -72,6 +82,7 @@ struct _GimpDialogFactory
/*< private >*/
GimpDialogNewFunc new_dock_func;
GimpDialogConstructor constructor;
GList *registered_dialogs;
GList *session_infos;
@ -96,8 +107,15 @@ GimpDialogFactory * gimp_dialog_factory_new (const gchar *name,
GimpDialogFactory * gimp_dialog_factory_from_name (const gchar *name);
void gimp_dialog_factory_set_constructor (GimpDialogFactory *factory,
GimpDialogConstructor constructor);
void gimp_dialog_factory_register_entry (GimpDialogFactory *factory,
const gchar *identifier,
const gchar *name,
const gchar *blurb,
const gchar *stock_id,
const gchar *help_id,
GimpDialogNewFunc new_func,
gint preview_size,
gboolean singleton,

View File

@ -503,7 +503,7 @@ gimp_gradient_editor_gradient_dirty (GimpGradientEditor *editor,
/* public functions */
GimpDataEditor *
GtkWidget *
gimp_gradient_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory)
{
@ -520,7 +520,7 @@ gimp_gradient_editor_new (Gimp *gimp,
return NULL;
}
return GIMP_DATA_EDITOR (editor);
return GTK_WIDGET (editor);
}
void

View File

@ -111,7 +111,7 @@ struct _GimpGradientEditorClass
GType gimp_gradient_editor_get_type (void) G_GNUC_CONST;
GimpDataEditor * gimp_gradient_editor_new (Gimp *gimp,
GtkWidget * gimp_gradient_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
void gimp_gradient_editor_update (GimpGradientEditor *editor);

View File

@ -496,24 +496,24 @@ gimp_palette_editor_set_data (GimpDataEditor *editor,
/* public functions */
GimpDataEditor *
GtkWidget *
gimp_palette_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory)
{
GimpPaletteEditor *palette_editor;
GimpPaletteEditor *editor;
palette_editor = g_object_new (GIMP_TYPE_PALETTE_EDITOR, NULL);
editor = g_object_new (GIMP_TYPE_PALETTE_EDITOR, NULL);
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (palette_editor),
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
gimp->palette_factory,
menu_factory, "<PaletteEditor>",
"/palette-editor-popup"))
{
g_object_unref (palette_editor);
g_object_unref (editor);
return NULL;
}
return GIMP_DATA_EDITOR (palette_editor);
return GTK_WIDGET (editor);
}
void

View File

@ -70,7 +70,7 @@ struct _GimpPaletteEditorClass
GType gimp_palette_editor_get_type (void) G_GNUC_CONST;
GimpDataEditor * gimp_palette_editor_new (Gimp *gimp,
GtkWidget * gimp_palette_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
void gimp_palette_editor_pick_color (GimpPaletteEditor *editor,