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:

committed by
Michael Natterer

parent
f6a205f83f
commit
6a50c27047
@ -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,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
dialogs_undo_editor_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
{
|
||||
GtkWidget *editor;
|
||||
|
||||
editor = 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);
|
||||
return gimp_undo_editor_new (context->gimp->config,
|
||||
factory->menu_factory);
|
||||
}
|
||||
|
||||
|
||||
/***** display related dialogs *****/
|
||||
|
||||
GtkWidget *
|
||||
dialogs_navigation_view_new (GimpDialogFactory *factory,
|
||||
GimpContext *context,
|
||||
gint preview_size)
|
||||
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,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-brush-editor",
|
||||
-1);
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimp_data_editor_set_data (brush_editor, data);
|
||||
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-brush-editor",
|
||||
-1);
|
||||
|
||||
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,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (gradient_editor),
|
||||
_("Gradient Editor"), NULL,
|
||||
GIMP_STOCK_GRADIENT,
|
||||
GIMP_HELP_GRADIENT_EDITOR_DIALOG);
|
||||
return gimp_gradient_editor_new (context->gimp,
|
||||
factory->menu_factory);
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_edit_gradient_func (GimpData *data,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-gradient-editor",
|
||||
-1);
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimp_data_editor_set_data (gradient_editor, data);
|
||||
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-gradient-editor",
|
||||
-1);
|
||||
|
||||
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,
|
||||
factory->menu_factory);
|
||||
|
||||
return dialogs_dockable_new (GTK_WIDGET (palette_editor),
|
||||
_("Palette Editor"), NULL,
|
||||
GIMP_STOCK_PALETTE,
|
||||
GIMP_HELP_PALETTE_EDITOR_DIALOG);
|
||||
return gimp_palette_editor_new (context->gimp,
|
||||
factory->menu_factory);
|
||||
}
|
||||
|
||||
void
|
||||
dialogs_edit_palette_func (GimpData *data,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-palette-editor",
|
||||
-1);
|
||||
GtkWidget *dockable;
|
||||
|
||||
gimp_data_editor_set_data (palette_editor, data);
|
||||
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
gtk_widget_get_screen (parent),
|
||||
"gimp-palette-editor",
|
||||
-1);
|
||||
|
||||
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,
|
||||
|
Reference in New Issue
Block a user