app: make the LayerOptionsDialog private

and provide a custom callback instead. Also attach the "New Layer"
and "Edit Layer Attributes" to their image/layer.
This commit is contained in:
Michael Natterer 2016-09-24 21:10:07 +02:00
parent 3d28113ec9
commit c2f264f5ca
3 changed files with 330 additions and 249 deletions

View File

@ -112,41 +112,55 @@ static const GimpLayerModeEffects layer_modes[] =
/* local function prototypes */
static void layers_new_layer_response (GtkWidget *widget,
gint response_id,
LayerOptionsDialog *dialog);
static void layers_edit_layer_response (GtkWidget *widget,
gint response_id,
LayerOptionsDialog *dialog);
static void layers_add_mask_callback (GtkWidget *dialog,
GimpLayer *layer,
GimpAddMaskType add_mask_type,
GimpChannel *channel,
gboolean invert,
gpointer user_data);
static void layers_scale_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer user_data);
static void layers_resize_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
GimpItemSet unused,
gboolean unused2,
gpointer data);
static void layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gboolean rename_text_layer,
gpointer user_data);
static void layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gboolean rename_text_layer,
gpointer user_data);
static void layers_add_mask_callback (GtkWidget *dialog,
GimpLayer *layer,
GimpAddMaskType add_mask_type,
GimpChannel *channel,
gboolean invert,
gpointer user_data);
static void layers_scale_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer user_data);
static void layers_resize_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
GimpItemSet unused,
gboolean unused2,
gpointer data);
static gint layers_mode_index (GimpLayerModeEffects layer_mode);
static gint layers_mode_index (GimpLayerModeEffects layer_mode);
/* private variables */
@ -197,49 +211,50 @@ void
layers_edit_attributes_cmd_callback (GtkAction *action,
gpointer data)
{
LayerOptionsDialog *dialog;
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GimpDialogConfig *config;
GimpImage *image;
GimpLayer *layer;
GtkWidget *widget;
GtkWidget *dialog;
return_if_no_layer (image, layer, data);
return_if_no_widget (widget, data);
config = GIMP_DIALOG_CONFIG (image->gimp->config);
#define EDIT_DIALOG_KEY "gimp-layer-edit-attributes-dialog"
dialog = layer_options_dialog_new (gimp_item_get_image (GIMP_ITEM (layer)),
layer,
action_data_get_context (data),
widget,
_("Layer Attributes"),
"gimp-layer-edit",
"gtk-edit",
_("Edit Layer Attributes"),
GIMP_HELP_LAYER_EDIT,
gimp_object_get_name (layer),
config->layer_new_fill_type);
dialog = dialogs_get_dialog (G_OBJECT (layer), EDIT_DIALOG_KEY);
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (layers_edit_layer_response),
dialog);
if (! dialog)
{
dialog = layer_options_dialog_new (gimp_item_get_image (GIMP_ITEM (layer)),
layer,
action_data_get_context (data),
widget,
_("Layer Attributes"),
"gimp-layer-edit",
"gtk-edit",
_("Edit Layer Attributes"),
GIMP_HELP_LAYER_EDIT,
gimp_object_get_name (layer),
0 /* unused */,
layers_edit_attributes_callback,
NULL);
gtk_widget_show (dialog->dialog);
dialogs_attach_dialog (G_OBJECT (layer), EDIT_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
layers_new_cmd_callback (GtkAction *action,
gpointer data)
{
LayerOptionsDialog *dialog;
GimpImage *image;
GtkWidget *widget;
GimpLayer *floating_sel;
GimpDialogConfig *config;
GimpImage *image;
GtkWidget *widget;
GimpLayer *floating_sel;
GtkWidget *dialog;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
config = GIMP_DIALOG_CONFIG (image->gimp->config);
/* If there is a floating selection, the new command transforms
* the current fs into a new layer
*/
@ -260,22 +275,31 @@ layers_new_cmd_callback (GtkAction *action,
return;
}
dialog = layer_options_dialog_new (image, NULL,
action_data_get_context (data),
widget,
_("New Layer"),
"gimp-layer-new",
GIMP_STOCK_LAYER,
_("Create a New Layer"),
GIMP_HELP_LAYER_NEW,
config->layer_new_name,
config->layer_new_fill_type);
#define NEW_DIALOG_KEY "gimp-layer-new-dialog"
g_signal_connect (dialog->dialog, "response",
G_CALLBACK (layers_new_layer_response),
dialog);
dialog = dialogs_get_dialog (G_OBJECT (image), NEW_DIALOG_KEY);
gtk_widget_show (dialog->dialog);
if (! dialog)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
dialog = layer_options_dialog_new (image, NULL,
action_data_get_context (data),
widget,
_("New Layer"),
"gimp-layer-new",
GIMP_STOCK_LAYER,
_("Create a New Layer"),
GIMP_HELP_LAYER_NEW,
config->layer_new_name,
config->layer_new_fill_type,
layers_new_callback,
NULL);
dialogs_attach_dialog (G_OBJECT (image), NEW_DIALOG_KEY, dialog);
}
gtk_window_present (GTK_WINDOW (dialog));
}
void
@ -1097,99 +1121,84 @@ layers_lock_alpha_cmd_callback (GtkAction *action,
/* private functions */
static void
layers_new_layer_response (GtkWidget *widget,
gint response_id,
LayerOptionsDialog *dialog)
layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gboolean rename_text_layer, /* unused */
gpointer user_data)
{
if (response_id == GTK_RESPONSE_OK)
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
g_object_set (config,
"layer-new-name", layer_name,
"layer-new-fill-type", layer_fill_type,
NULL);
layer = gimp_layer_new (image, layer_width, layer_height,
gimp_image_get_layer_format (image, TRUE),
config->layer_new_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (layer)
{
GimpDialogConfig *config;
GimpLayer *layer;
config = GIMP_DIALOG_CONFIG (dialog->image->gimp->config);
g_object_set (config,
"layer-new-fill-type", dialog->fill_type,
"layer-new-name",
gtk_entry_get_text (GTK_ENTRY (dialog->name_entry)),
NULL);
dialog->xsize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->size_se),
0));
dialog->ysize =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (dialog->size_se),
1));
layer = gimp_layer_new (dialog->image,
dialog->xsize,
dialog->ysize,
gimp_image_get_layer_format (dialog->image, TRUE),
config->layer_new_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (layer)
{
gimp_drawable_fill (GIMP_DRAWABLE (layer),
dialog->context,
config->layer_new_fill_type);
gimp_image_add_layer (dialog->image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (dialog->image);
}
else
{
g_warning ("%s: could not allocate new layer", G_STRFUNC);
}
gimp_drawable_fill (GIMP_DRAWABLE (layer), context,
config->layer_new_fill_type);
gimp_image_add_layer (image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
else
{
g_warning ("%s: could not allocate new layer", G_STRFUNC);
}
gtk_widget_destroy (dialog->dialog);
gtk_widget_destroy (dialog);
}
static void
layers_edit_layer_response (GtkWidget *widget,
gint response_id,
LayerOptionsDialog *dialog)
layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpFillType layer_fill_type, /* unused */
gint layer_width, /* unused */
gint layer_height, /* unused */
gboolean rename_text_layer,
gpointer user_data)
{
if (response_id == GTK_RESPONSE_OK)
if (strcmp (layer_name, gimp_object_get_name (layer)))
{
GimpLayer *layer = dialog->layer;
const gchar *new_name;
GError *error = NULL;
new_name = gtk_entry_get_text (GTK_ENTRY (dialog->name_entry));
if (strcmp (new_name, gimp_object_get_name (layer)))
if (gimp_item_rename (GIMP_ITEM (layer), layer_name, &error))
{
GError *error = NULL;
if (gimp_item_rename (GIMP_ITEM (layer), new_name, &error))
{
gimp_image_flush (dialog->image);
}
else
{
gimp_message_literal (dialog->image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
return;
}
gimp_image_flush (image);
}
if (dialog->rename_toggle &&
gimp_item_is_text_layer (GIMP_ITEM (layer)))
else
{
g_object_set (layer,
"auto-rename",
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->rename_toggle)),
NULL);
gimp_message_literal (image->gimp,
G_OBJECT (dialog), GIMP_MESSAGE_WARNING,
error->message);
g_clear_error (&error);
return;
}
}
gtk_widget_destroy (dialog->dialog);
if (gimp_item_is_text_layer (GIMP_ITEM (layer)))
{
g_object_set (layer,
"auto-rename", rename_text_layer,
NULL);
}
gtk_widget_destroy (dialog);
}
static void

View File

@ -21,6 +21,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "dialogs-types.h"
@ -41,29 +42,52 @@
#include "gimp-intl.h"
typedef struct _LayerOptionsDialog LayerOptionsDialog;
struct _LayerOptionsDialog
{
GimpImage *image;
GimpLayer *layer;
GimpContext *context;
GimpFillType fill_type;
GimpLayerOptionsCallback callback;
gpointer user_data;
GtkWidget *name_entry;
GtkWidget *size_se;
GtkWidget *rename_toggle;
};
/* local function prototypes */
static void layer_options_dialog_response (GtkWidget *dialog,
gint response_id,
LayerOptionsDialog *private);
static void layer_options_dialog_toggle_rename (GtkWidget *widget,
LayerOptionsDialog *options);
static void layer_options_dialog_free (LayerOptionsDialog *options);
LayerOptionsDialog *private);
static void layer_options_dialog_free (LayerOptionsDialog *private);
/* public functions */
LayerOptionsDialog *
layer_options_dialog_new (GimpImage *image,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent,
const gchar *title,
const gchar *role,
const gchar *icon_name,
const gchar *desc,
const gchar *help_id,
const gchar *layer_name,
GimpFillType layer_fill_type)
GtkWidget *
layer_options_dialog_new (GimpImage *image,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent,
const gchar *title,
const gchar *role,
const gchar *icon_name,
const gchar *desc,
const gchar *help_id,
const gchar *layer_name,
GimpFillType layer_fill_type,
GimpLayerOptionsCallback callback,
gpointer user_data)
{
LayerOptionsDialog *options;
LayerOptionsDialog *private;
GtkWidget *dialog;
GimpViewable *viewable;
GtkWidget *vbox;
GtkWidget *table;
@ -78,41 +102,46 @@ layer_options_dialog_new (GimpImage *image,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
options = g_slice_new0 (LayerOptionsDialog);
private = g_slice_new0 (LayerOptionsDialog);
options->image = image;
options->context = context;
options->layer = layer;
options->fill_type = layer_fill_type;
private->image = image;
private->layer = layer;
private->context = context;
private->fill_type = layer_fill_type;
private->callback = callback;
private->user_data = user_data;
if (layer)
viewable = GIMP_VIEWABLE (layer);
else
viewable = GIMP_VIEWABLE (image);
options->dialog =
gimp_viewable_dialog_new (viewable, context,
title, role, icon_name, desc,
parent,
gimp_standard_help_func, help_id,
dialog = gimp_viewable_dialog_new (viewable, context,
title, role, icon_name, desc,
parent,
gimp_standard_help_func, help_id,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->dialog),
(GWeakNotify) layer_options_dialog_free, options);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (options->dialog),
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_signal_connect (dialog, "response",
G_CALLBACK (layer_options_dialog_response),
private);
g_object_weak_ref (G_OBJECT (dialog),
(GWeakNotify) layer_options_dialog_free, private);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_box_set_spacing (GTK_BOX (vbox), 12);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (options->dialog))),
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
@ -123,13 +152,13 @@ layer_options_dialog_new (GimpImage *image,
gtk_widget_show (table);
/* The name label and entry */
options->name_entry = gtk_entry_new ();
private->name_entry = gtk_entry_new ();
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Layer _name:"), 0.0, 0.5,
options->name_entry, 1, FALSE);
private->name_entry, 1, FALSE);
gtk_entry_set_activates_default (GTK_ENTRY (options->name_entry), TRUE);
gtk_entry_set_text (GTK_ENTRY (options->name_entry), layer_name);
gtk_entry_set_activates_default (GTK_ENTRY (private->name_entry), TRUE);
gtk_entry_set_text (GTK_ENTRY (private->name_entry), layer_name);
if (! layer)
{
@ -158,45 +187,45 @@ layer_options_dialog_new (GimpImage *image,
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
options->size_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
private->size_se = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a",
TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (options->size_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (options->size_se), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (private->size_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (private->size_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (private->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (options->size_se), spinbutton,
gtk_table_attach_defaults (GTK_TABLE (private->size_se), spinbutton,
1, 2, 0, 1);
gtk_widget_show (spinbutton);
gtk_table_attach (GTK_TABLE (table), options->size_se, 1, 2, 1, 3,
gtk_table_attach (GTK_TABLE (table), private->size_se, 1, 2, 1, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (options->size_se);
gtk_widget_show (private->size_se);
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (options->size_se),
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (private->size_se),
GIMP_UNIT_PIXEL);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 0,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 0,
xres, FALSE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (options->size_se), 1,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (private->size_se), 1,
yres, FALSE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (options->size_se), 0,
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (private->size_se), 0,
GIMP_MIN_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (options->size_se), 1,
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (private->size_se), 1,
GIMP_MIN_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 0,
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (private->size_se), 0,
0, gimp_image_get_width (image));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (options->size_se), 1,
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (private->size_se), 1,
0, gimp_image_get_height (image));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 0,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 0,
gimp_image_get_width (image));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (options->size_se), 1,
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (private->size_se), 1,
gimp_image_get_height (image));
/* The radio frame */
@ -205,10 +234,10 @@ layer_options_dialog_new (GimpImage *image,
GIMP_FILL_TRANSPARENT,
gtk_label_new (_("Layer Fill Type")),
G_CALLBACK (gimp_radio_button_update),
&options->fill_type,
&private->fill_type,
&button);
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button),
options->fill_type);
private->fill_type);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
}
@ -221,19 +250,19 @@ layer_options_dialog_new (GimpImage *image,
/* For text layers add a toggle to control "auto-rename" */
if (gimp_item_is_text_layer (GIMP_ITEM (layer)))
{
options->rename_toggle =
private->rename_toggle =
gtk_check_button_new_with_mnemonic (_("Set name from _text"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->rename_toggle),
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (private->rename_toggle),
GIMP_TEXT_LAYER (layer)->auto_rename);
gtk_table_attach (GTK_TABLE (table), options->rename_toggle, 1, 2, 1, 2,
gtk_table_attach (GTK_TABLE (table), private->rename_toggle, 1, 2, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (options->rename_toggle);
gtk_widget_show (private->rename_toggle);
g_signal_connect (options->rename_toggle, "toggled",
g_signal_connect (private->rename_toggle, "toggled",
G_CALLBACK (layer_options_dialog_toggle_rename),
options);
private);
}
frame = gimp_frame_new ("Active Filters");
@ -248,27 +277,75 @@ layer_options_dialog_new (GimpImage *image,
gtk_widget_show (view);
}
return options;
return dialog;
}
/* private functions */
static void
layer_options_dialog_response (GtkWidget *dialog,
gint response_id,
LayerOptionsDialog *private)
{
if (response_id == GTK_RESPONSE_OK)
{
const gchar *name;
gint width = 0;
gint height = 0;
gboolean rename_text_layer = FALSE;
name = gtk_entry_get_text (GTK_ENTRY (private->name_entry));
if (! private->layer)
{
width =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->size_se),
0));
height =
RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (private->size_se),
1));
}
if (private->layer &&
gimp_item_is_text_layer (GIMP_ITEM (private->layer)))
{
rename_text_layer =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (private->rename_toggle));
}
private->callback (dialog,
private->image,
private->layer,
private->context,
name,
private->fill_type,
width,
height,
rename_text_layer,
private->user_data);
}
else
{
gtk_widget_destroy (dialog);
}
}
static void
layer_options_dialog_toggle_rename (GtkWidget *widget,
LayerOptionsDialog *options)
LayerOptionsDialog *private)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
gimp_item_is_text_layer (GIMP_ITEM (options->layer)))
gimp_item_is_text_layer (GIMP_ITEM (private->layer)))
{
GimpTextLayer *text_layer = GIMP_TEXT_LAYER (options->layer);
GimpTextLayer *text_layer = GIMP_TEXT_LAYER (private->layer);
GimpText *text = gimp_text_layer_get_text (text_layer);
if (text && text->text)
{
gchar *name = gimp_utf8_strtrim (text->text, 30);
gtk_entry_set_text (GTK_ENTRY (options->name_entry), name);
gtk_entry_set_text (GTK_ENTRY (private->name_entry), name);
g_free (name);
}
@ -276,7 +353,7 @@ layer_options_dialog_toggle_rename (GtkWidget *widget,
}
static void
layer_options_dialog_free (LayerOptionsDialog *options)
layer_options_dialog_free (LayerOptionsDialog *private)
{
g_slice_free (LayerOptionsDialog, options);
g_slice_free (LayerOptionsDialog, private);
}

View File

@ -19,36 +19,31 @@
#define __LAYER_OPTIONS_DIALOG_H__
typedef struct _LayerOptionsDialog LayerOptionsDialog;
struct _LayerOptionsDialog
{
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *size_se;
GtkWidget *rename_toggle;
GimpFillType fill_type;
gint xsize;
gint ysize;
GimpImage *image;
GimpContext *context;
GimpLayer *layer;
};
typedef void (* GimpLayerOptionsCallback) (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gboolean rename_text_layer,
gpointer user_data);
LayerOptionsDialog * layer_options_dialog_new (GimpImage *image,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent,
const gchar *title,
const gchar *role,
const gchar *icon_name,
const gchar *desc,
const gchar *help_id,
const gchar *layer_name,
GimpFillType layer_fill_type);
GtkWidget * layer_options_dialog_new (GimpImage *image,
GimpLayer *layer,
GimpContext *context,
GtkWidget *parent,
const gchar *title,
const gchar *role,
const gchar *icon_name,
const gchar *desc,
const gchar *help_id,
const gchar *layer_name,
GimpFillType layer_fill_type,
GimpLayerOptionsCallback callback,
gpointer user_data);
#endif /* __LAYER_OPTIONS_DIALOG_H__ */