mirror of https://github.com/GNOME/gimp.git
registered GimpFillType enum and added translatable names to
2002-05-13 Sven Neumann <sven@gimp.org> * app/core/core-enums.[ch]: registered GimpFillType enum and added translatable names to GimpImageBaseType. * app/core/gimp.[ch] * app/core/gimpedit.c * app/core/gimpimage-new.[ch]: removed gimp_image_new_[init|exit]() where we used to create names for the enums mentioned above. Dropped gimp_image_new_set_have_current_cut_buffer() in favor of accessing the value directly. * app/gui/file-new-dialog.c (file_new_dialog_create) * app/gui/layers-commands.c (layers_new_layer_query): use GimpEnumMenus to choose the base_type and fill_type.
This commit is contained in:
parent
73057f7689
commit
16e8b1bec8
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2002-05-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/core-enums.[ch]: registered GimpFillType enum and added
|
||||||
|
translatable names to GimpImageBaseType.
|
||||||
|
|
||||||
|
* app/core/gimp.[ch]
|
||||||
|
* app/core/gimpedit.c
|
||||||
|
* app/core/gimpimage-new.[ch]: removed gimp_image_new_[init|exit]()
|
||||||
|
where we used to create names for the enums mentioned above. Dropped
|
||||||
|
gimp_image_new_set_have_current_cut_buffer() in favor of accessing
|
||||||
|
the value directly.
|
||||||
|
|
||||||
|
* app/gui/file-new-dialog.c (file_new_dialog_create)
|
||||||
|
* app/gui/layers-commands.c (layers_new_layer_query): use
|
||||||
|
GimpEnumMenus to choose the base_type and fill_type.
|
||||||
|
|
||||||
2002-05-13 Michael Natterer <mitch@gimp.org>
|
2002-05-13 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/paint-funcs/paint-funcs.c commented out a warning in
|
* app/paint-funcs/paint-funcs.c commented out a warning in
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "pdb/procedural_db.h"
|
#include "pdb/procedural_db.h"
|
||||||
|
|
||||||
|
#include "widgets/gimpenummenu.h"
|
||||||
#include "widgets/gimpitemfactory.h"
|
#include "widgets/gimpitemfactory.h"
|
||||||
#include "widgets/gimpwidgets-utils.h"
|
#include "widgets/gimpwidgets-utils.h"
|
||||||
|
|
||||||
|
@ -522,6 +523,7 @@ layers_new_layer_query (GimpImage *gimage,
|
||||||
GtkObject *adjustment;
|
GtkObject *adjustment;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||||
g_return_if_fail (! template || GIMP_IS_LAYER (template));
|
g_return_if_fail (! template || GIMP_IS_LAYER (template));
|
||||||
|
@ -678,18 +680,14 @@ layers_new_layer_query (GimpImage *gimage,
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
/* The radio frame */
|
/* The radio frame */
|
||||||
frame = gimp_radio_group_new2
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_FILL_TYPE,
|
||||||
(TRUE, _("Layer Fill Type"),
|
gtk_label_new (_("Layer Fill Type")),
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
2,
|
||||||
&options->fill_type,
|
G_CALLBACK (gimp_radio_button_update),
|
||||||
GINT_TO_POINTER (options->fill_type),
|
&options->fill_type,
|
||||||
|
&button);
|
||||||
_("Foreground"), GINT_TO_POINTER (GIMP_FOREGROUND_FILL), NULL,
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (button),
|
||||||
_("Background"), GINT_TO_POINTER (GIMP_BACKGROUND_FILL), NULL,
|
GINT_TO_POINTER (options->fill_type));
|
||||||
_("White"), GINT_TO_POINTER (GIMP_WHITE_FILL), NULL,
|
|
||||||
_("Transparent"), GINT_TO_POINTER (GIMP_TRANSPARENT_FILL), NULL,
|
|
||||||
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
|
@ -93,6 +93,27 @@ gimp_convert_dither_type_get_type (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const GEnumValue gimp_fill_type_enum_values[] =
|
||||||
|
{
|
||||||
|
{ GIMP_FOREGROUND_FILL, N_("Foreground"), "foreground-fill" },
|
||||||
|
{ GIMP_BACKGROUND_FILL, N_("Background"), "background-fill" },
|
||||||
|
{ GIMP_WHITE_FILL, N_("White"), "white-fill" },
|
||||||
|
{ GIMP_TRANSPARENT_FILL, N_("Transparent"), "transparent-fill" },
|
||||||
|
{ 0, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
GType
|
||||||
|
gimp_fill_type_get_type (void)
|
||||||
|
{
|
||||||
|
static GType enum_type = 0;
|
||||||
|
|
||||||
|
if (!enum_type)
|
||||||
|
enum_type = g_enum_register_static ("GimpFillType", gimp_fill_type_enum_values);
|
||||||
|
|
||||||
|
return enum_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const GEnumValue gimp_gradient_type_enum_values[] =
|
static const GEnumValue gimp_gradient_type_enum_values[] =
|
||||||
{
|
{
|
||||||
{ GIMP_LINEAR, N_("Linear"), "linear" },
|
{ GIMP_LINEAR, N_("Linear"), "linear" },
|
||||||
|
@ -123,9 +144,8 @@ gimp_gradient_type_get_type (void)
|
||||||
|
|
||||||
static const GEnumValue gimp_image_base_type_enum_values[] =
|
static const GEnumValue gimp_image_base_type_enum_values[] =
|
||||||
{
|
{
|
||||||
{ GIMP_RGB, "GIMP_RGB", "rgb" },
|
{ GIMP_RGB, N_("RGB"), "rgb" },
|
||||||
{ GIMP_GRAY, "GIMP_GRAY", "gray" },
|
{ GIMP_GRAY, N_("Grayscale"), "gray" },
|
||||||
{ GIMP_INDEXED, "GIMP_INDEXED", "indexed" },
|
|
||||||
{ 0, NULL, NULL }
|
{ 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -94,23 +94,37 @@ typedef enum
|
||||||
} GimpConvertDitherType;
|
} GimpConvertDitherType;
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_FILL_TYPE (gimp_fill_type_get_type ())
|
||||||
|
|
||||||
|
GType gimp_fill_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GIMP_FOREGROUND_FILL, /*< desc="Foreground" >*/
|
||||||
|
GIMP_BACKGROUND_FILL, /*< desc="Background" >*/
|
||||||
|
GIMP_WHITE_FILL, /*< desc="White" >*/
|
||||||
|
GIMP_TRANSPARENT_FILL, /*< desc="Transparent" >*/
|
||||||
|
GIMP_NO_FILL /*< skip >*/
|
||||||
|
} GimpFillType;
|
||||||
|
|
||||||
|
|
||||||
#define GIMP_TYPE_GRADIENT_TYPE (gimp_gradient_type_get_type ())
|
#define GIMP_TYPE_GRADIENT_TYPE (gimp_gradient_type_get_type ())
|
||||||
|
|
||||||
GType gimp_gradient_type_get_type (void) G_GNUC_CONST;
|
GType gimp_gradient_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GIMP_LINEAR, /*< desc="Linear" >*/
|
GIMP_LINEAR, /*< desc="Linear" >*/
|
||||||
GIMP_BILINEAR, /*< desc="Bi-Linear" >*/
|
GIMP_BILINEAR, /*< desc="Bi-Linear" >*/
|
||||||
GIMP_RADIAL, /*< desc="Radial" >*/
|
GIMP_RADIAL, /*< desc="Radial" >*/
|
||||||
GIMP_SQUARE, /*< desc="Square" >*/
|
GIMP_SQUARE, /*< desc="Square" >*/
|
||||||
GIMP_CONICAL_SYMMETRIC, /*< desc="Conical (symmetric)" >*/
|
GIMP_CONICAL_SYMMETRIC, /*< desc="Conical (symmetric)" >*/
|
||||||
GIMP_CONICAL_ASYMMETRIC, /*< desc="Conical (asymmetric)" >*/
|
GIMP_CONICAL_ASYMMETRIC, /*< desc="Conical (asymmetric)" >*/
|
||||||
GIMP_SHAPEBURST_ANGULAR, /*< desc="Shapeburst (angular)" >*/
|
GIMP_SHAPEBURST_ANGULAR, /*< desc="Shapeburst (angular)" >*/
|
||||||
GIMP_SHAPEBURST_SPHERICAL, /*< desc="Shapeburst (spherical)" >*/
|
GIMP_SHAPEBURST_SPHERICAL, /*< desc="Shapeburst (spherical)" >*/
|
||||||
GIMP_SHAPEBURST_DIMPLED, /*< desc="Shapeburst (dimpled)" >*/
|
GIMP_SHAPEBURST_DIMPLED, /*< desc="Shapeburst (dimpled)" >*/
|
||||||
GIMP_SPIRAL_CLOCKWISE, /*< desc="Spiral (clockwise)" >*/
|
GIMP_SPIRAL_CLOCKWISE, /*< desc="Spiral (clockwise)" >*/
|
||||||
GIMP_SPIRAL_ANTICLOCKWISE /*< desc="Spiral (anticlockwise)" >*/
|
GIMP_SPIRAL_ANTICLOCKWISE /*< desc="Spiral (anticlockwise)" >*/
|
||||||
} GimpGradientType;
|
} GimpGradientType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,9 +134,9 @@ GType gimp_image_base_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GIMP_RGB,
|
GIMP_RGB, /*< desc="RGB" >*/
|
||||||
GIMP_GRAY,
|
GIMP_GRAY, /*< desc="Grayscale" >*/
|
||||||
GIMP_INDEXED
|
GIMP_INDEXED /*< skip >*/
|
||||||
} GimpImageBaseType;
|
} GimpImageBaseType;
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,15 +256,6 @@ typedef enum /*< proxy-skip >*/ /*< skip >*/
|
||||||
GIMP_CUSTOM_PALETTE
|
GIMP_CUSTOM_PALETTE
|
||||||
} GimpConvertPaletteType;
|
} GimpConvertPaletteType;
|
||||||
|
|
||||||
typedef enum /*< skip >*/
|
|
||||||
{
|
|
||||||
GIMP_FOREGROUND_FILL,
|
|
||||||
GIMP_BACKGROUND_FILL,
|
|
||||||
GIMP_WHITE_FILL,
|
|
||||||
GIMP_TRANSPARENT_FILL,
|
|
||||||
GIMP_NO_FILL
|
|
||||||
} GimpFillType;
|
|
||||||
|
|
||||||
typedef enum /*< pdb-skip >*/ /*< skip >*/
|
typedef enum /*< pdb-skip >*/ /*< skip >*/
|
||||||
{
|
{
|
||||||
GIMP_GRAD_LINEAR = 0,
|
GIMP_GRAD_LINEAR = 0,
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "gimpedit.h"
|
#include "gimpedit.h"
|
||||||
#include "gimpimage.h"
|
#include "gimpimage.h"
|
||||||
#include "gimpimage-mask.h"
|
#include "gimpimage-mask.h"
|
||||||
#include "gimpimage-new.h"
|
|
||||||
#include "gimplayer.h"
|
#include "gimplayer.h"
|
||||||
#include "gimplayer-floating-sel.h"
|
#include "gimplayer-floating-sel.h"
|
||||||
#include "gimplist.h"
|
#include "gimplist.h"
|
||||||
|
@ -68,7 +67,7 @@ gimp_edit_cut (GimpImage *gimage,
|
||||||
cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
||||||
|
|
||||||
if (cut)
|
if (cut)
|
||||||
gimp_image_new_set_have_current_cut_buffer (gimage->gimp);
|
gimage->gimp->have_current_cut_buffer = TRUE;
|
||||||
|
|
||||||
/* Only crop if the gimage mask wasn't empty */
|
/* Only crop if the gimage mask wasn't empty */
|
||||||
if (cut && ! empty)
|
if (cut && ! empty)
|
||||||
|
@ -122,7 +121,7 @@ gimp_edit_copy (GimpImage *gimage,
|
||||||
copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
gimp_image_new_set_have_current_cut_buffer (gimage->gimp);
|
gimage->gimp->have_current_cut_buffer = TRUE;
|
||||||
|
|
||||||
/* Only crop if the gimage mask wasn't empty */
|
/* Only crop if the gimage mask wasn't empty */
|
||||||
if (copy && ! empty)
|
if (copy && ! empty)
|
||||||
|
|
|
@ -187,8 +187,6 @@ gimp_init (Gimp *gimp)
|
||||||
|
|
||||||
gimp_documents_init (gimp);
|
gimp_documents_init (gimp);
|
||||||
|
|
||||||
gimp->image_base_type_names = NULL;
|
|
||||||
gimp->fill_type_names = NULL;
|
|
||||||
gimp->have_current_cut_buffer = FALSE;
|
gimp->have_current_cut_buffer = FALSE;
|
||||||
|
|
||||||
gimp->context_list = NULL;
|
gimp->context_list = NULL;
|
||||||
|
@ -242,9 +240,6 @@ gimp_finalize (GObject *object)
|
||||||
gimp->standard_context = NULL;
|
gimp->standard_context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gimp->image_base_type_names)
|
|
||||||
gimp_image_new_exit (gimp);
|
|
||||||
|
|
||||||
if (gimp->documents)
|
if (gimp->documents)
|
||||||
gimp_documents_exit (gimp);
|
gimp_documents_exit (gimp);
|
||||||
|
|
||||||
|
@ -385,9 +380,6 @@ gimp_get_memsize (GimpObject *object)
|
||||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info)) +
|
gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info)) +
|
||||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->documents)));
|
gimp_object_get_memsize (GIMP_OBJECT (gimp->documents)));
|
||||||
|
|
||||||
memsize += g_list_length (gimp->image_base_type_names) * sizeof (GList); /* FIXME */
|
|
||||||
memsize += g_list_length (gimp->fill_type_names) * sizeof (GList); /* FIXME */
|
|
||||||
|
|
||||||
memsize += g_list_length (gimp->context_list) * sizeof (GList);
|
memsize += g_list_length (gimp->context_list) * sizeof (GList);
|
||||||
|
|
||||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_context)) +
|
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_context)) +
|
||||||
|
@ -485,7 +477,18 @@ gimp_initialize (Gimp *gimp,
|
||||||
gimp_palette_get_standard);
|
gimp_palette_get_standard);
|
||||||
gimp_object_set_name (GIMP_OBJECT (gimp->palette_factory), "palette factory");
|
gimp_object_set_name (GIMP_OBJECT (gimp->palette_factory), "palette factory");
|
||||||
|
|
||||||
gimp_image_new_init (gimp);
|
/* Set the last values used to default values. */
|
||||||
|
|
||||||
|
gimp->image_new_last_values.width = gimp->config->default_width;
|
||||||
|
gimp->image_new_last_values.height = gimp->config->default_height;
|
||||||
|
gimp->image_new_last_values.unit = gimp->config->default_units;
|
||||||
|
gimp->image_new_last_values.xresolution = gimp->config->default_xresolution;
|
||||||
|
gimp->image_new_last_values.yresolution = gimp->config->default_yresolution;
|
||||||
|
gimp->image_new_last_values.res_unit = gimp->config->default_resolution_units;
|
||||||
|
gimp->image_new_last_values.type = gimp->config->default_type;
|
||||||
|
gimp->image_new_last_values.fill_type = GIMP_BACKGROUND_FILL;
|
||||||
|
|
||||||
|
gimp->have_current_cut_buffer = FALSE;
|
||||||
|
|
||||||
gimp->standard_context = gimp_context_new (gimp, "Standard", NULL);
|
gimp->standard_context = gimp_context_new (gimp, "Standard", NULL);
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,6 @@ struct _Gimp
|
||||||
GimpContainer *documents;
|
GimpContainer *documents;
|
||||||
|
|
||||||
/* image_new values */
|
/* image_new values */
|
||||||
GList *image_base_type_names;
|
|
||||||
GList *fill_type_names;
|
|
||||||
GimpImageNewValues image_new_last_values;
|
GimpImageNewValues image_new_last_values;
|
||||||
gboolean have_current_cut_buffer;
|
gboolean have_current_cut_buffer;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "gimpedit.h"
|
#include "gimpedit.h"
|
||||||
#include "gimpimage.h"
|
#include "gimpimage.h"
|
||||||
#include "gimpimage-mask.h"
|
#include "gimpimage-mask.h"
|
||||||
#include "gimpimage-new.h"
|
|
||||||
#include "gimplayer.h"
|
#include "gimplayer.h"
|
||||||
#include "gimplayer-floating-sel.h"
|
#include "gimplayer-floating-sel.h"
|
||||||
#include "gimplist.h"
|
#include "gimplist.h"
|
||||||
|
@ -68,7 +67,7 @@ gimp_edit_cut (GimpImage *gimage,
|
||||||
cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
|
||||||
|
|
||||||
if (cut)
|
if (cut)
|
||||||
gimp_image_new_set_have_current_cut_buffer (gimage->gimp);
|
gimage->gimp->have_current_cut_buffer = TRUE;
|
||||||
|
|
||||||
/* Only crop if the gimage mask wasn't empty */
|
/* Only crop if the gimage mask wasn't empty */
|
||||||
if (cut && ! empty)
|
if (cut && ! empty)
|
||||||
|
@ -122,7 +121,7 @@ gimp_edit_copy (GimpImage *gimage,
|
||||||
copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE);
|
||||||
|
|
||||||
if (copy)
|
if (copy)
|
||||||
gimp_image_new_set_have_current_cut_buffer (gimage->gimp);
|
gimage->gimp->have_current_cut_buffer = TRUE;
|
||||||
|
|
||||||
/* Only crop if the gimage mask wasn't empty */
|
/* Only crop if the gimage mask wasn't empty */
|
||||||
if (copy && ! empty)
|
if (copy && ! empty)
|
||||||
|
|
|
@ -39,92 +39,6 @@
|
||||||
#include "libgimp/gimpintl.h"
|
#include "libgimp/gimpintl.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
gimp_image_new_init (Gimp *gimp)
|
|
||||||
{
|
|
||||||
GimpImageBaseTypeName *new_type;
|
|
||||||
GimpFillTypeName *new_fill_type;
|
|
||||||
|
|
||||||
/* Available Image Base Types */
|
|
||||||
|
|
||||||
new_type = g_new (GimpImageBaseTypeName, 1);
|
|
||||||
new_type->type = GIMP_RGB;
|
|
||||||
new_type->name = _("RGB");
|
|
||||||
|
|
||||||
gimp->image_base_type_names = g_list_append (gimp->image_base_type_names,
|
|
||||||
new_type);
|
|
||||||
|
|
||||||
new_type = g_new (GimpImageBaseTypeName, 1);
|
|
||||||
new_type->type = GIMP_GRAY;
|
|
||||||
new_type->name = _("Grayscale");
|
|
||||||
|
|
||||||
gimp->image_base_type_names = g_list_append (gimp->image_base_type_names,
|
|
||||||
new_type);
|
|
||||||
|
|
||||||
/* Available Fill Types */
|
|
||||||
|
|
||||||
new_fill_type = g_new (GimpFillTypeName, 1);
|
|
||||||
new_fill_type->type = GIMP_FOREGROUND_FILL;
|
|
||||||
new_fill_type->name = _("Foreground");
|
|
||||||
|
|
||||||
gimp->fill_type_names = g_list_append (gimp->fill_type_names, new_fill_type);
|
|
||||||
|
|
||||||
new_fill_type = g_new (GimpFillTypeName, 1);
|
|
||||||
new_fill_type->type = GIMP_BACKGROUND_FILL;
|
|
||||||
new_fill_type->name = _("Background");
|
|
||||||
|
|
||||||
gimp->fill_type_names = g_list_append (gimp->fill_type_names, new_fill_type);
|
|
||||||
|
|
||||||
new_fill_type = g_new (GimpFillTypeName, 1);
|
|
||||||
new_fill_type->type = GIMP_WHITE_FILL;
|
|
||||||
new_fill_type->name = _("White");
|
|
||||||
|
|
||||||
gimp->fill_type_names = g_list_append (gimp->fill_type_names, new_fill_type);
|
|
||||||
|
|
||||||
new_fill_type = g_new (GimpFillTypeName, 1);
|
|
||||||
new_fill_type->type = GIMP_TRANSPARENT_FILL;
|
|
||||||
new_fill_type->name = _("Transparent");
|
|
||||||
|
|
||||||
gimp->fill_type_names = g_list_append (gimp->fill_type_names, new_fill_type);
|
|
||||||
|
|
||||||
/* Set the last values used to default values. */
|
|
||||||
|
|
||||||
gimp->image_new_last_values.width = gimp->config->default_width;
|
|
||||||
gimp->image_new_last_values.height = gimp->config->default_height;
|
|
||||||
gimp->image_new_last_values.unit = gimp->config->default_units;
|
|
||||||
gimp->image_new_last_values.xresolution = gimp->config->default_xresolution;
|
|
||||||
gimp->image_new_last_values.yresolution = gimp->config->default_yresolution;
|
|
||||||
gimp->image_new_last_values.res_unit = gimp->config->default_resolution_units;
|
|
||||||
gimp->image_new_last_values.type = gimp->config->default_type;
|
|
||||||
gimp->image_new_last_values.fill_type = GIMP_BACKGROUND_FILL;
|
|
||||||
|
|
||||||
gimp->have_current_cut_buffer = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gimp_image_new_exit (Gimp *gimp)
|
|
||||||
{
|
|
||||||
g_list_foreach (gimp->image_base_type_names, (GFunc) g_free, NULL);
|
|
||||||
g_list_free (gimp->image_base_type_names);
|
|
||||||
gimp->image_base_type_names = NULL;
|
|
||||||
|
|
||||||
g_list_foreach (gimp->fill_type_names, (GFunc) g_free, NULL);
|
|
||||||
g_list_free (gimp->fill_type_names);
|
|
||||||
gimp->fill_type_names = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GList *
|
|
||||||
gimp_image_new_get_base_type_names (Gimp *gimp)
|
|
||||||
{
|
|
||||||
return gimp->image_base_type_names;
|
|
||||||
}
|
|
||||||
|
|
||||||
GList *
|
|
||||||
gimp_image_new_get_fill_type_names (Gimp *gimp)
|
|
||||||
{
|
|
||||||
return gimp->fill_type_names;
|
|
||||||
}
|
|
||||||
|
|
||||||
GimpImageNewValues *
|
GimpImageNewValues *
|
||||||
gimp_image_new_values_new (Gimp *gimp,
|
gimp_image_new_values_new (Gimp *gimp,
|
||||||
GimpImage *gimage)
|
GimpImage *gimage)
|
||||||
|
@ -223,12 +137,6 @@ gimp_image_new_get_memsize_string (gsize memsize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gimp_image_new_set_have_current_cut_buffer (Gimp *gimp)
|
|
||||||
{
|
|
||||||
gimp->have_current_cut_buffer = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GimpImage *
|
GimpImage *
|
||||||
gimp_image_new_create_image (Gimp *gimp,
|
gimp_image_new_create_image (Gimp *gimp,
|
||||||
GimpImageNewValues *values)
|
GimpImageNewValues *values)
|
||||||
|
|
|
@ -20,19 +20,6 @@
|
||||||
#define __GIMP_IMAGE_NEW_H__
|
#define __GIMP_IMAGE_NEW_H__
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GimpImageBaseType type;
|
|
||||||
gchar *name;
|
|
||||||
} GimpImageBaseTypeName;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GimpFillType type;
|
|
||||||
gchar *name;
|
|
||||||
} GimpFillTypeName;
|
|
||||||
|
|
||||||
|
|
||||||
struct _GimpImageNewValues
|
struct _GimpImageNewValues
|
||||||
{
|
{
|
||||||
gint width;
|
gint width;
|
||||||
|
@ -48,26 +35,18 @@ struct _GimpImageNewValues
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void gimp_image_new_init (Gimp *gimp);
|
GimpImageNewValues * gimp_image_new_values_new (Gimp *gimp,
|
||||||
void gimp_image_new_exit (Gimp *gimp);
|
GimpImage *gimage);
|
||||||
|
|
||||||
GList * gimp_image_new_get_base_type_names (Gimp *gimp);
|
void gimp_image_new_set_default_values (Gimp *gimp,
|
||||||
GList * gimp_image_new_get_fill_type_names (Gimp *gimp);
|
GimpImageNewValues *values);
|
||||||
|
void gimp_image_new_values_free (GimpImageNewValues *values);
|
||||||
|
|
||||||
GimpImageNewValues * gimp_image_new_values_new (Gimp *gimp,
|
gsize gimp_image_new_calculate_memsize (GimpImageNewValues *values);
|
||||||
GimpImage *gimage);
|
gchar * gimp_image_new_get_memsize_string (gsize memsize);
|
||||||
|
|
||||||
void gimp_image_new_set_default_values (Gimp *gimp,
|
GimpImage * gimp_image_new_create_image (Gimp *gimp,
|
||||||
GimpImageNewValues *values);
|
GimpImageNewValues *values);
|
||||||
void gimp_image_new_values_free (GimpImageNewValues *values);
|
|
||||||
|
|
||||||
gsize gimp_image_new_calculate_memsize (GimpImageNewValues *values);
|
|
||||||
gchar * gimp_image_new_get_memsize_string (gsize memsize);
|
|
||||||
|
|
||||||
void gimp_image_new_set_have_current_cut_buffer (Gimp *gimp);
|
|
||||||
|
|
||||||
GimpImage * gimp_image_new_create_image (Gimp *gimp,
|
|
||||||
GimpImageNewValues *values);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_IMAGE_NEW__ */
|
#endif /* __GIMP_IMAGE_NEW__ */
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
#include "core/gimpimage-new.h"
|
#include "core/gimpimage-new.h"
|
||||||
|
|
||||||
|
#include "widgets/gimpenummenu.h"
|
||||||
|
|
||||||
#include "file-new-dialog.h"
|
#include "file-new-dialog.h"
|
||||||
|
|
||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
|
@ -49,9 +51,8 @@ typedef struct
|
||||||
GtkWidget *resolution_se;
|
GtkWidget *resolution_se;
|
||||||
GtkWidget *couple_resolutions;
|
GtkWidget *couple_resolutions;
|
||||||
|
|
||||||
/* this should be a list */
|
GtkWidget *type_w;
|
||||||
GtkWidget *type_w[2];
|
GtkWidget *fill_type_w;
|
||||||
GtkWidget *fill_type_w[4];
|
|
||||||
|
|
||||||
GimpImageNewValues *values;
|
GimpImageNewValues *values;
|
||||||
gdouble size;
|
gdouble size;
|
||||||
|
@ -72,6 +73,10 @@ static void file_new_cancel_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void file_new_resolution_callback (GtkWidget *widget,
|
static void file_new_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
static void file_new_image_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void file_new_fill_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
static void file_new_image_size_callback (GtkWidget *widget,
|
static void file_new_image_size_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
@ -91,13 +96,9 @@ file_new_dialog_create (Gimp *gimp,
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkWidget *separator;
|
GtkWidget *separator;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *button;
|
|
||||||
GtkObject *adjustment;
|
GtkObject *adjustment;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *spinbutton2;
|
GtkWidget *spinbutton2;
|
||||||
GtkWidget *radio_box;
|
|
||||||
GSList *group;
|
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||||
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
||||||
|
@ -358,87 +359,31 @@ file_new_dialog_create (Gimp *gimp,
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
/* frame for Image Type */
|
/* frame for Image Type */
|
||||||
frame = gtk_frame_new (_("Image Type"));
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_IMAGE_BASE_TYPE,
|
||||||
|
gtk_label_new (_("Image Type")),
|
||||||
|
2,
|
||||||
|
G_CALLBACK (file_new_image_type_callback),
|
||||||
|
info,
|
||||||
|
&info->type_w);
|
||||||
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->type_w),
|
||||||
|
GINT_TO_POINTER (info->values->type));
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
/* radio buttons and box */
|
|
||||||
radio_box = gtk_vbox_new (FALSE, 1);
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
||||||
gtk_widget_show (radio_box);
|
|
||||||
|
|
||||||
group = NULL;
|
|
||||||
|
|
||||||
for (list = gimp_image_new_get_base_type_names (gimp);
|
|
||||||
list;
|
|
||||||
list = g_list_next (list))
|
|
||||||
{
|
|
||||||
GimpImageBaseTypeName *name_info;
|
|
||||||
|
|
||||||
name_info = (GimpImageBaseTypeName*) list->data;
|
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label (group, name_info->name);
|
|
||||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
||||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, TRUE, 0);
|
|
||||||
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
||||||
(gpointer) name_info->type);
|
|
||||||
gtk_widget_show (button);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
|
||||||
&info->values->type);
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (file_new_image_size_callback),
|
|
||||||
info);
|
|
||||||
|
|
||||||
if (info->values->type == name_info->type)
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
||||||
|
|
||||||
info->type_w[name_info->type] = button;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* frame for Fill Type */
|
/* frame for Fill Type */
|
||||||
frame = gtk_frame_new (_("Fill Type"));
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_FILL_TYPE,
|
||||||
|
gtk_label_new (_("Fill Type")),
|
||||||
|
2,
|
||||||
|
G_CALLBACK (file_new_fill_type_callback),
|
||||||
|
info,
|
||||||
|
&info->fill_type_w);
|
||||||
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w),
|
||||||
|
GINT_TO_POINTER (info->values->fill_type));
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
radio_box = gtk_vbox_new (FALSE, 1);
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
||||||
gtk_widget_show (radio_box);
|
|
||||||
|
|
||||||
group = NULL;
|
|
||||||
|
|
||||||
for (list = gimp_image_new_get_fill_type_names (gimp);
|
|
||||||
list;
|
|
||||||
list = g_list_next (list))
|
|
||||||
{
|
|
||||||
GimpFillTypeName *name_info;
|
|
||||||
|
|
||||||
name_info = (GimpFillTypeName*) list->data;
|
|
||||||
|
|
||||||
button =
|
|
||||||
gtk_radio_button_new_with_label (group, name_info->name);
|
|
||||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
||||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
|
||||||
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
||||||
(gpointer) name_info->type);
|
|
||||||
gtk_widget_show (button);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
|
||||||
&info->values->fill_type);
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (file_new_image_size_callback),
|
|
||||||
info);
|
|
||||||
|
|
||||||
if (info->values->fill_type == name_info->type)
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
||||||
|
|
||||||
info->fill_type_w[name_info->type] = button;
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));
|
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));
|
||||||
|
|
||||||
gtk_widget_show (info->dialog);
|
gtk_widget_show (info->dialog);
|
||||||
|
@ -492,46 +437,48 @@ static void
|
||||||
file_new_reset_callback (GtkWidget *widget,
|
file_new_reset_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
NewImageInfo *info;
|
NewImageInfo *info;
|
||||||
|
GimpCoreConfig *config;
|
||||||
|
|
||||||
info = (NewImageInfo *) data;
|
info = (NewImageInfo *) data;
|
||||||
|
|
||||||
|
config = info->gimp->config;
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (G_OBJECT (info->resolution_se),
|
g_signal_handlers_block_by_func (G_OBJECT (info->resolution_se),
|
||||||
file_new_resolution_callback,
|
file_new_resolution_callback,
|
||||||
info);
|
info);
|
||||||
|
|
||||||
gimp_chain_button_set_active
|
gimp_chain_button_set_active
|
||||||
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
|
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
|
||||||
ABS (info->gimp->config->default_xresolution -
|
ABS (config->default_xresolution -
|
||||||
info->gimp->config->default_yresolution) < GIMP_MIN_RESOLUTION);
|
config->default_yresolution) < GIMP_MIN_RESOLUTION);
|
||||||
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 0,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 0,
|
||||||
info->gimp->config->default_xresolution);
|
config->default_xresolution);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 1,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 1,
|
||||||
info->gimp->config->default_yresolution);
|
config->default_yresolution);
|
||||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
|
||||||
info->gimp->config->default_resolution_units);
|
config->default_resolution_units);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (G_OBJECT (info->resolution_se),
|
g_signal_handlers_unblock_by_func (G_OBJECT (info->resolution_se),
|
||||||
file_new_resolution_callback,
|
file_new_resolution_callback,
|
||||||
info);
|
info);
|
||||||
|
|
||||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
||||||
info->gimp->config->default_xresolution, TRUE);
|
config->default_xresolution, TRUE);
|
||||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
||||||
info->gimp->config->default_yresolution, TRUE);
|
config->default_yresolution, TRUE);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 0,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 0,
|
||||||
info->gimp->config->default_width);
|
config->default_width);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 1,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 1,
|
||||||
info->gimp->config->default_height);
|
config->default_height);
|
||||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
|
||||||
info->gimp->config->default_units);
|
config->default_units);
|
||||||
|
|
||||||
gimp_radio_group_set_active
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->type_w),
|
||||||
(GTK_RADIO_BUTTON (info->type_w[0]),
|
GINT_TO_POINTER (config->default_type));
|
||||||
GINT_TO_POINTER (info->gimp->config->default_type));
|
|
||||||
|
|
||||||
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w[0]),
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w),
|
||||||
GINT_TO_POINTER (GIMP_BACKGROUND_FILL));
|
GINT_TO_POINTER (GIMP_BACKGROUND_FILL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,6 +618,32 @@ file_new_resolution_callback (GtkWidget *widget,
|
||||||
file_new_image_size_callback (widget, data);
|
file_new_image_size_callback (widget, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_new_image_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
NewImageInfo *info;
|
||||||
|
|
||||||
|
info = (NewImageInfo*) data;
|
||||||
|
|
||||||
|
gimp_radio_button_update (widget, &info->values->type);
|
||||||
|
|
||||||
|
file_new_image_size_callback (widget, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_new_fill_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
NewImageInfo *info;
|
||||||
|
|
||||||
|
info = (NewImageInfo*) data;
|
||||||
|
|
||||||
|
gimp_radio_button_update (widget, &info->values->fill_type);
|
||||||
|
|
||||||
|
file_new_image_size_callback (widget, data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_new_image_size_callback (GtkWidget *widget,
|
file_new_image_size_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
#include "core/gimpimage-new.h"
|
#include "core/gimpimage-new.h"
|
||||||
|
|
||||||
|
#include "widgets/gimpenummenu.h"
|
||||||
|
|
||||||
#include "file-new-dialog.h"
|
#include "file-new-dialog.h"
|
||||||
|
|
||||||
#include "gimprc.h"
|
#include "gimprc.h"
|
||||||
|
@ -49,9 +51,8 @@ typedef struct
|
||||||
GtkWidget *resolution_se;
|
GtkWidget *resolution_se;
|
||||||
GtkWidget *couple_resolutions;
|
GtkWidget *couple_resolutions;
|
||||||
|
|
||||||
/* this should be a list */
|
GtkWidget *type_w;
|
||||||
GtkWidget *type_w[2];
|
GtkWidget *fill_type_w;
|
||||||
GtkWidget *fill_type_w[4];
|
|
||||||
|
|
||||||
GimpImageNewValues *values;
|
GimpImageNewValues *values;
|
||||||
gdouble size;
|
gdouble size;
|
||||||
|
@ -72,6 +73,10 @@ static void file_new_cancel_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void file_new_resolution_callback (GtkWidget *widget,
|
static void file_new_resolution_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
static void file_new_image_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
|
static void file_new_fill_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data);
|
||||||
static void file_new_image_size_callback (GtkWidget *widget,
|
static void file_new_image_size_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
|
@ -91,13 +96,9 @@ file_new_dialog_create (Gimp *gimp,
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkWidget *separator;
|
GtkWidget *separator;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *button;
|
|
||||||
GtkObject *adjustment;
|
GtkObject *adjustment;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *spinbutton2;
|
GtkWidget *spinbutton2;
|
||||||
GtkWidget *radio_box;
|
|
||||||
GSList *group;
|
|
||||||
GList *list;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||||
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
g_return_if_fail (! gimage || GIMP_IS_IMAGE (gimage));
|
||||||
|
@ -358,87 +359,31 @@ file_new_dialog_create (Gimp *gimp,
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
/* frame for Image Type */
|
/* frame for Image Type */
|
||||||
frame = gtk_frame_new (_("Image Type"));
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_IMAGE_BASE_TYPE,
|
||||||
|
gtk_label_new (_("Image Type")),
|
||||||
|
2,
|
||||||
|
G_CALLBACK (file_new_image_type_callback),
|
||||||
|
info,
|
||||||
|
&info->type_w);
|
||||||
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->type_w),
|
||||||
|
GINT_TO_POINTER (info->values->type));
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
/* radio buttons and box */
|
|
||||||
radio_box = gtk_vbox_new (FALSE, 1);
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
||||||
gtk_widget_show (radio_box);
|
|
||||||
|
|
||||||
group = NULL;
|
|
||||||
|
|
||||||
for (list = gimp_image_new_get_base_type_names (gimp);
|
|
||||||
list;
|
|
||||||
list = g_list_next (list))
|
|
||||||
{
|
|
||||||
GimpImageBaseTypeName *name_info;
|
|
||||||
|
|
||||||
name_info = (GimpImageBaseTypeName*) list->data;
|
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label (group, name_info->name);
|
|
||||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
||||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, TRUE, 0);
|
|
||||||
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
||||||
(gpointer) name_info->type);
|
|
||||||
gtk_widget_show (button);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
|
||||||
&info->values->type);
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (file_new_image_size_callback),
|
|
||||||
info);
|
|
||||||
|
|
||||||
if (info->values->type == name_info->type)
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
||||||
|
|
||||||
info->type_w[name_info->type] = button;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* frame for Fill Type */
|
/* frame for Fill Type */
|
||||||
frame = gtk_frame_new (_("Fill Type"));
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_FILL_TYPE,
|
||||||
|
gtk_label_new (_("Fill Type")),
|
||||||
|
2,
|
||||||
|
G_CALLBACK (file_new_fill_type_callback),
|
||||||
|
info,
|
||||||
|
&info->fill_type_w);
|
||||||
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w),
|
||||||
|
GINT_TO_POINTER (info->values->fill_type));
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
radio_box = gtk_vbox_new (FALSE, 1);
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 2);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), radio_box);
|
|
||||||
gtk_widget_show (radio_box);
|
|
||||||
|
|
||||||
group = NULL;
|
|
||||||
|
|
||||||
for (list = gimp_image_new_get_fill_type_names (gimp);
|
|
||||||
list;
|
|
||||||
list = g_list_next (list))
|
|
||||||
{
|
|
||||||
GimpFillTypeName *name_info;
|
|
||||||
|
|
||||||
name_info = (GimpFillTypeName*) list->data;
|
|
||||||
|
|
||||||
button =
|
|
||||||
gtk_radio_button_new_with_label (group, name_info->name);
|
|
||||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
||||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
|
||||||
g_object_set_data (G_OBJECT (button), "gimp-item-data",
|
|
||||||
(gpointer) name_info->type);
|
|
||||||
gtk_widget_show (button);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
|
||||||
&info->values->fill_type);
|
|
||||||
g_signal_connect (G_OBJECT (button), "toggled",
|
|
||||||
G_CALLBACK (file_new_image_size_callback),
|
|
||||||
info);
|
|
||||||
|
|
||||||
if (info->values->fill_type == name_info->type)
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
||||||
|
|
||||||
info->fill_type_w[name_info->type] = button;
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));
|
gimp_size_entry_grab_focus (GIMP_SIZE_ENTRY (info->size_se));
|
||||||
|
|
||||||
gtk_widget_show (info->dialog);
|
gtk_widget_show (info->dialog);
|
||||||
|
@ -492,46 +437,48 @@ static void
|
||||||
file_new_reset_callback (GtkWidget *widget,
|
file_new_reset_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
NewImageInfo *info;
|
NewImageInfo *info;
|
||||||
|
GimpCoreConfig *config;
|
||||||
|
|
||||||
info = (NewImageInfo *) data;
|
info = (NewImageInfo *) data;
|
||||||
|
|
||||||
|
config = info->gimp->config;
|
||||||
|
|
||||||
g_signal_handlers_block_by_func (G_OBJECT (info->resolution_se),
|
g_signal_handlers_block_by_func (G_OBJECT (info->resolution_se),
|
||||||
file_new_resolution_callback,
|
file_new_resolution_callback,
|
||||||
info);
|
info);
|
||||||
|
|
||||||
gimp_chain_button_set_active
|
gimp_chain_button_set_active
|
||||||
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
|
(GIMP_CHAIN_BUTTON (info->couple_resolutions),
|
||||||
ABS (info->gimp->config->default_xresolution -
|
ABS (config->default_xresolution -
|
||||||
info->gimp->config->default_yresolution) < GIMP_MIN_RESOLUTION);
|
config->default_yresolution) < GIMP_MIN_RESOLUTION);
|
||||||
|
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 0,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 0,
|
||||||
info->gimp->config->default_xresolution);
|
config->default_xresolution);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 1,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->resolution_se), 1,
|
||||||
info->gimp->config->default_yresolution);
|
config->default_yresolution);
|
||||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->resolution_se),
|
||||||
info->gimp->config->default_resolution_units);
|
config->default_resolution_units);
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func (G_OBJECT (info->resolution_se),
|
g_signal_handlers_unblock_by_func (G_OBJECT (info->resolution_se),
|
||||||
file_new_resolution_callback,
|
file_new_resolution_callback,
|
||||||
info);
|
info);
|
||||||
|
|
||||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 0,
|
||||||
info->gimp->config->default_xresolution, TRUE);
|
config->default_xresolution, TRUE);
|
||||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (info->size_se), 1,
|
||||||
info->gimp->config->default_yresolution, TRUE);
|
config->default_yresolution, TRUE);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 0,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 0,
|
||||||
info->gimp->config->default_width);
|
config->default_width);
|
||||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 1,
|
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (info->size_se), 1,
|
||||||
info->gimp->config->default_height);
|
config->default_height);
|
||||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
|
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (info->size_se),
|
||||||
info->gimp->config->default_units);
|
config->default_units);
|
||||||
|
|
||||||
gimp_radio_group_set_active
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->type_w),
|
||||||
(GTK_RADIO_BUTTON (info->type_w[0]),
|
GINT_TO_POINTER (config->default_type));
|
||||||
GINT_TO_POINTER (info->gimp->config->default_type));
|
|
||||||
|
|
||||||
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w[0]),
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (info->fill_type_w),
|
||||||
GINT_TO_POINTER (GIMP_BACKGROUND_FILL));
|
GINT_TO_POINTER (GIMP_BACKGROUND_FILL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,6 +618,32 @@ file_new_resolution_callback (GtkWidget *widget,
|
||||||
file_new_image_size_callback (widget, data);
|
file_new_image_size_callback (widget, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_new_image_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
NewImageInfo *info;
|
||||||
|
|
||||||
|
info = (NewImageInfo*) data;
|
||||||
|
|
||||||
|
gimp_radio_button_update (widget, &info->values->type);
|
||||||
|
|
||||||
|
file_new_image_size_callback (widget, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_new_fill_type_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
NewImageInfo *info;
|
||||||
|
|
||||||
|
info = (NewImageInfo*) data;
|
||||||
|
|
||||||
|
gimp_radio_button_update (widget, &info->values->fill_type);
|
||||||
|
|
||||||
|
file_new_image_size_callback (widget, data);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
file_new_image_size_callback (GtkWidget *widget,
|
file_new_image_size_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "pdb/procedural_db.h"
|
#include "pdb/procedural_db.h"
|
||||||
|
|
||||||
|
#include "widgets/gimpenummenu.h"
|
||||||
#include "widgets/gimpitemfactory.h"
|
#include "widgets/gimpitemfactory.h"
|
||||||
#include "widgets/gimpwidgets-utils.h"
|
#include "widgets/gimpwidgets-utils.h"
|
||||||
|
|
||||||
|
@ -522,6 +523,7 @@ layers_new_layer_query (GimpImage *gimage,
|
||||||
GtkObject *adjustment;
|
GtkObject *adjustment;
|
||||||
GtkWidget *spinbutton;
|
GtkWidget *spinbutton;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
g_return_if_fail (GIMP_IS_IMAGE (gimage));
|
||||||
g_return_if_fail (! template || GIMP_IS_LAYER (template));
|
g_return_if_fail (! template || GIMP_IS_LAYER (template));
|
||||||
|
@ -678,18 +680,14 @@ layers_new_layer_query (GimpImage *gimage,
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
/* The radio frame */
|
/* The radio frame */
|
||||||
frame = gimp_radio_group_new2
|
frame = gimp_enum_radio_frame_new (GIMP_TYPE_FILL_TYPE,
|
||||||
(TRUE, _("Layer Fill Type"),
|
gtk_label_new (_("Layer Fill Type")),
|
||||||
G_CALLBACK (gimp_radio_button_update),
|
2,
|
||||||
&options->fill_type,
|
G_CALLBACK (gimp_radio_button_update),
|
||||||
GINT_TO_POINTER (options->fill_type),
|
&options->fill_type,
|
||||||
|
&button);
|
||||||
_("Foreground"), GINT_TO_POINTER (GIMP_FOREGROUND_FILL), NULL,
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (button),
|
||||||
_("Background"), GINT_TO_POINTER (GIMP_BACKGROUND_FILL), NULL,
|
GINT_TO_POINTER (options->fill_type));
|
||||||
_("White"), GINT_TO_POINTER (GIMP_WHITE_FILL), NULL,
|
|
||||||
_("Transparent"), GINT_TO_POINTER (GIMP_TRANSPARENT_FILL), NULL,
|
|
||||||
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
Loading…
Reference in New Issue