Commit 4ac8c825 authored by Henrik Brix Andersen's avatar Henrik Brix Andersen Committed by Henrik Brix Andersen

removed the grid parasite related functions from here ...

2003-10-10 Henrik Brix Andersen <brix@gimp.org>

* app/core/gimpimage-grid.[ch]: removed the grid parasite related
functions from here ...

* app/core/gimpgrid.[ch]: ... and added them here. While I was at
it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the
properties

* app/xcf/xcf-load.c
* app/display/gimpdisplayshell.c: changed accordingly

* app/widgets/Makefile.am
* po/POTFILES.in
* app/widgets/widgets-types.h
* app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor
widget - with a work-around for the fact that
gimp_prop_coordinated_new() doesn't accept boundaries

* app/gui/grid-dialog.h
* app/gui/grid-dialog.c (grid_dialog_new): use the new
GimpGridEditor widget, take a GimpImage as function parameter,
assume GimpImages always have a GimpGrid. This simplifies the grid
dialog.

* app/gui/image-commands.c
(image_configure_grid_cmd_callback): changed accordingly

* app/core/core-types.h: moved typedef GimpGrid from here ...

* app/config/config-types.h: ... to here to be able to use it in
GimpCoreConfig

* app/config/gimprc-blurbs.h
* app/config/gimpcoreconfig.[ch]: added default_grid member

* app/widgets/gimphelp-ids.h
* themes/Default/images/preferences/Makefile.am
* themes/Default/images/default-grid.png
* app/gui/preferences-dialog.c: added UI for specifying default
image grid

* app/core/gimpimage.c (gimp_image_new): create a GimpGrid from
core_config->default_grid

* app/gui/image-menu.c (image_menu_update): the grid/guide entries
in <Image>/View/ should always be sensitive ...

* app/display/gimpdisplayshell.c (gimp_display_shell_init):
... but the grid entries should be disabled by default
parent 4591aed0
2003-10-10 Henrik Brix Andersen <brix@gimp.org>
* app/core/gimpimage-grid.[ch]: removed the grid parasite related
functions from here ...
* app/core/gimpgrid.[ch]: ... and added them here. While I was at
it I also changed PROP_TYPE to PROP_STYLE and added blurbs to the
properties
* app/xcf/xcf-load.c
* app/display/gimpdisplayshell.c: changed accordingly
* app/widgets/Makefile.am
* po/POTFILES.in
* app/widgets/widgets-types.h
* app/widgets/gimpgrideditor.[ch]: added a new GimpGridEditor
widget - with a work-around for the fact that
gimp_prop_coordinated_new() doesn't accept boundaries
* app/gui/grid-dialog.h
* app/gui/grid-dialog.c (grid_dialog_new): use the new
GimpGridEditor widget, take a GimpImage as function parameter,
assume GimpImages always have a GimpGrid. This simplifies the grid
dialog.
* app/gui/image-commands.c
(image_configure_grid_cmd_callback): changed accordingly
* app/core/core-types.h: moved typedef GimpGrid from here ...
* app/config/config-types.h: ... to here to be able to use it in
GimpCoreConfig
* app/config/gimprc-blurbs.h
* app/config/gimpcoreconfig.[ch]: added default_grid member
* app/widgets/gimphelp-ids.h
* themes/Default/images/preferences/Makefile.am
* themes/Default/images/default-grid.png
* app/gui/preferences-dialog.c: added UI for specifying default
image grid
* app/core/gimpimage.c (gimp_image_new): create a GimpGrid from
core_config->default_grid
* app/gui/image-menu.c (image_menu_update): the grid/guide entries
in <Image>/View/ should always be sensitive ...
* app/display/gimpdisplayshell.c (gimp_display_shell_init):
... but the grid entries should be disabled by default
2003-10-10 Sven Neumann <sven@gimp.org>
* app/errors.c (gimp_eek)
......@@ -304,13 +304,15 @@ image_configure_grid_cmd_callback (GtkWidget *widget,
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
GimpImage *gimage;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gimage = GIMP_IMAGE (gdisp->gimage);
if (! shell->grid_dialog)
{
shell->grid_dialog = grid_dialog_new (GIMP_DISPLAY (gdisp));
shell->grid_dialog = grid_dialog_new (GIMP_IMAGE (gimage));
gtk_window_set_transient_for (GTK_WINDOW (shell->grid_dialog),
GTK_WINDOW (shell));
......
......@@ -33,5 +33,7 @@ typedef struct _GimpRc GimpRc;
typedef struct _GimpConfigWriter GimpConfigWriter;
typedef struct _GimpXmlParser GimpXmlParser;
typedef struct _GimpGrid GimpGrid;
#endif /* __CONFIG_TYPES_H__ */
......@@ -27,6 +27,12 @@
#include "config-types.h"
#ifdef __GNUC__
#warning FIXME #include "core/core-types.h"
#endif
#include "core/core-types.h"
#include "core/gimpgrid.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
......@@ -37,17 +43,20 @@
#include "gimp-intl.h"
static void gimp_core_config_class_init (GimpCoreConfigClass *klass);
static void gimp_core_config_finalize (GObject *object);
static void gimp_core_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_core_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_core_config_class_init (GimpCoreConfigClass *klass);
static void gimp_core_config_init (GObject *object);
static void gimp_core_config_finalize (GObject *object);
static void gimp_core_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_core_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_core_config_default_grid_changed (GObject *object,
GParamSpec *pspec,
gpointer data);
#define DEFAULT_BRUSH "Circle (11)"
#define DEFAULT_PATTERN "Pine"
......@@ -72,6 +81,7 @@ enum
PROP_DEFAULT_PATTERN,
PROP_DEFAULT_PALETTE,
PROP_DEFAULT_GRADIENT,
PROP_DEFAULT_GRID,
PROP_DEFAULT_FONT,
PROP_DEFAULT_COMMENT,
PROP_DEFAULT_IMAGE_TYPE,
......@@ -95,7 +105,7 @@ enum
static GObjectClass *parent_class = NULL;
GType
GType
gimp_core_config_get_type (void)
{
static GType config_type = 0;
......@@ -112,11 +122,11 @@ gimp_core_config_get_type (void)
NULL, /* class_data */
sizeof (GimpCoreConfig),
0, /* n_preallocs */
NULL /* instance_init */
(GInstanceInitFunc) gimp_core_config_init
};
config_type = g_type_register_static (GIMP_TYPE_BASE_CONFIG,
"GimpCoreConfig",
config_type = g_type_register_static (GIMP_TYPE_BASE_CONFIG,
"GimpCoreConfig",
&config_info, 0);
}
......@@ -139,7 +149,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_INTERPOLATION_TYPE,
"interpolation-type",
INTERPOLATION_TYPE_BLURB,
GIMP_TYPE_INTERPOLATION_TYPE,
GIMP_TYPE_INTERPOLATION_TYPE,
GIMP_INTERPOLATION_LINEAR,
0);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUG_IN_PATH,
......@@ -198,6 +208,10 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
"default-gradient", DEFAULT_GRADIENT_BLURB,
DEFAULT_GRADIENT,
0);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_DEFAULT_GRID,
"default-grid", DEFAULT_GRID_BLURB,
GIMP_TYPE_GRID,
GIMP_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DEFAULT_FONT,
"default-font", DEFAULT_FONT_BLURB,
DEFAULT_FONT,
......@@ -285,13 +299,26 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_RESTART);
}
static void
gimp_core_config_init (GObject *object)
{
GimpCoreConfig *core_config;
core_config = GIMP_CORE_CONFIG (object);
core_config->default_grid = g_object_new (GIMP_TYPE_GRID, NULL);
g_signal_connect (core_config->default_grid, "notify",
G_CALLBACK (gimp_core_config_default_grid_changed),
core_config);
}
static void
gimp_core_config_finalize (GObject *object)
{
GimpCoreConfig *core_config;
core_config = GIMP_CORE_CONFIG (object);
g_free (core_config->plug_in_path);
g_free (core_config->module_path);
g_free (core_config->environ_path);
......@@ -308,6 +335,12 @@ gimp_core_config_finalize (GObject *object)
g_free (core_config->default_comment);
g_free (core_config->plug_in_rc_path);
if (core_config->default_grid)
{
g_object_unref (core_config->default_grid);
core_config->default_grid = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -374,6 +407,10 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->default_gradient);
core_config->default_gradient = g_value_dup_string (value);
break;
case PROP_DEFAULT_GRID:
g_object_unref (core_config->default_grid);
core_config->default_grid = GIMP_GRID (g_value_dup_object (value));
break;
case PROP_DEFAULT_FONT:
g_free (core_config->default_font);
core_config->default_font = g_value_dup_string (value);
......@@ -489,6 +526,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_DEFAULT_GRADIENT:
g_value_set_string (value, core_config->default_gradient);
break;
case PROP_DEFAULT_GRID:
g_value_set_object (value, core_config->default_grid);
break;
case PROP_DEFAULT_FONT:
g_value_set_string (value, core_config->default_font);
break;
......@@ -549,3 +589,17 @@ gimp_core_config_get_property (GObject *object,
break;
}
}
static void
gimp_core_config_default_grid_changed (GObject *object,
GParamSpec *pspec,
gpointer data)
{
GimpCoreConfig *core_config;
g_return_if_fail (GIMP_IS_CORE_CONFIG (data));
core_config = GIMP_CORE_CONFIG (data);
g_object_notify (G_OBJECT (core_config), "default-grid");
}
......@@ -53,6 +53,7 @@ struct _GimpCoreConfig
gchar *default_pattern;
gchar *default_palette;
gchar *default_gradient;
GimpGrid *default_grid;
gchar *default_font;
gchar *default_comment;
GimpImageBaseType default_image_type;
......
......@@ -61,6 +61,9 @@ N_("When enabled, this will ensure that each pixel of an image gets " \
"Specify a default gradient. The gradient is searched for in the " \
"specified gradient path."
#define DEFAULT_GRID_BLURB \
"Specify a default image grid."
#define DEFAULT_IMAGE_WIDTH_BLURB \
"Sets the default image width in the \"File/New\" dialog."
......
......@@ -74,8 +74,6 @@ typedef struct _GimpDocumentList GimpDocumentList;
typedef struct _GimpTemplate GimpTemplate;
typedef struct _GimpGrid GimpGrid;
/* drawable objects */
typedef struct _GimpDrawable GimpDrawable;
......
......@@ -21,9 +21,13 @@
#include "config.h"
#include <string.h> /* strcmp */
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpbase/gimplimits.h"
#include "libgimpcolor/gimpcolor.h"
#include "core-types.h"
......@@ -47,7 +51,7 @@ enum
PROP_OFFSET_UNIT,
PROP_FGCOLOR,
PROP_BGCOLOR,
PROP_TYPE
PROP_STYLE
};
static void gimp_grid_class_init (GimpGridClass *klass);
......@@ -121,11 +125,13 @@ gimp_grid_class_init (GimpGridClass *klass)
gimp_rgba_set (&white, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XSPACING,
"xspacing", NULL,
"xspacing",
N_("Horizontal spacing of grid lines"),
1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YSPACING,
"yspacing", NULL,
"yspacing",
N_("Vertical spacing of grid lines"),
1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
0);
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_SPACING_UNIT,
......@@ -133,12 +139,16 @@ gimp_grid_class_init (GimpGridClass *klass)
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XOFFSET,
"xoffset", NULL,
"xoffset",
N_("Horizontal offset of the first grid line, "
"this may be a negative number"),
- GIMP_MAX_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE, 0.0,
0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YOFFSET,
"yoffset", NULL,
"yoffset",
N_("Vertical offset of the first grid line, "
"this may be a negative number"),
- GIMP_MAX_IMAGE_SIZE,
GIMP_MAX_IMAGE_SIZE, 0.0,
0);
......@@ -147,15 +157,19 @@ gimp_grid_class_init (GimpGridClass *klass)
FALSE, FALSE, GIMP_UNIT_INCH,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FGCOLOR,
"fgcolor", NULL,
"fgcolor",
N_("The foreground color of the grid"),
&black,
0);
GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_BGCOLOR,
"bgcolor", NULL,
"bgcolor",
N_("The background color of the grid, "
"only used in double dashed line style"),
&white,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TYPE,
"type", NULL,
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE,
"style",
N_("Line style used for the grid"),
GIMP_TYPE_GRID_STYLE,
GIMP_GRID_INTERSECTIONS,
0);
......@@ -202,8 +216,8 @@ gimp_grid_get_property (GObject *object,
case PROP_BGCOLOR:
g_value_set_boxed (value, &grid->bgcolor);
break;
case PROP_TYPE:
g_value_set_enum (value, grid->type);
case PROP_STYLE:
g_value_set_enum (value, grid->style);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -248,11 +262,65 @@ gimp_grid_set_property (GObject *object,
color = g_value_get_boxed (value);
grid->bgcolor = *color;
break;
case PROP_TYPE:
grid->type = g_value_get_enum (value);
case PROP_STYLE:
grid->style = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
const gchar *
gimp_grid_parasite_name (void)
{
return "gimp-image-grid";
}
GimpParasite *
gimp_grid_to_parasite (const GimpGrid *grid)
{
GimpParasite *parasite;
gchar *str;
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
str = gimp_config_serialize_to_string (G_OBJECT (grid), NULL);
g_return_val_if_fail (str != NULL, NULL);
parasite = gimp_parasite_new (gimp_grid_parasite_name (),
GIMP_PARASITE_PERSISTENT,
strlen (str) + 1, str);
g_free (str);
return parasite;
}
GimpGrid *
gimp_grid_from_parasite (const GimpParasite *parasite)
{
GimpGrid *grid;
const gchar *str;
GError *error = NULL;
g_return_val_if_fail (parasite != NULL, NULL);
g_return_val_if_fail (strcmp (gimp_parasite_name (parasite),
gimp_grid_parasite_name ()) == 0, NULL);
str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL);
grid = g_object_new (GIMP_TYPE_GRID, NULL);
if (! gimp_config_deserialize_string (G_OBJECT (grid),
str,
gimp_parasite_data_size (parasite),
NULL,
&error))
{
g_warning ("Failed to deserialize grid parasite: %s", error->message);
g_error_free (error);
}
return grid;
}
......@@ -48,7 +48,7 @@ struct _GimpGrid
GimpUnit offset_unit;
GimpRGB fgcolor;
GimpRGB bgcolor;
GimpGridStyle type;
GimpGridStyle style;
};
......@@ -58,7 +58,10 @@ struct _GimpGridClass
};
GType gimp_grid_get_type (void) G_GNUC_CONST;
GType gimp_grid_get_type (void) G_GNUC_CONST;
const gchar * gimp_grid_parasite_name (void) G_GNUC_CONST;
GimpParasite * gimp_grid_to_parasite (const GimpGrid *grid);
GimpGrid * gimp_grid_from_parasite (const GimpParasite *parasite);
#endif /* __GIMP_GRID_H__ */
......@@ -21,17 +21,10 @@
#include "config.h"
#include <string.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "core-types.h"
#include "config/gimpconfig.h"
#include "gimp.h"
#include "gimpgrid.h"
#include "gimpimage.h"
#include "gimpimage-grid.h"
......@@ -73,57 +66,3 @@ gimp_image_set_grid (GimpImage *gimage,
gimp_image_grid_changed (gimage);
}
const gchar *
gimp_grid_parasite_name (void)
{
return "gimp-image-grid";
}
GimpParasite *
gimp_grid_to_parasite (const GimpGrid *grid)
{
GimpParasite *parasite;
gchar *str;
g_return_val_if_fail (GIMP_IS_GRID (grid), NULL);
str = gimp_config_serialize_to_string (G_OBJECT (grid), NULL);
g_return_val_if_fail (str != NULL, NULL);
parasite = gimp_parasite_new (gimp_grid_parasite_name (),
GIMP_PARASITE_PERSISTENT,
strlen (str) + 1, str);
g_free (str);
return parasite;
}
GimpGrid *
gimp_grid_from_parasite (const GimpParasite *parasite)
{
GimpGrid *grid;
const gchar *str;
GError *error = NULL;
g_return_val_if_fail (parasite != NULL, NULL);
g_return_val_if_fail (strcmp (gimp_parasite_name (parasite),
gimp_grid_parasite_name ()) == 0, NULL);
str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL);
grid = g_object_new (GIMP_TYPE_GRID, NULL);
if (! gimp_config_deserialize_string (G_OBJECT (grid),
str,
gimp_parasite_data_size (parasite),
NULL,
&error))
{
g_warning ("Failed to deserialize grid parasite: %s", error->message);
g_error_free (error);
}
return grid;
}
......@@ -28,9 +28,5 @@ void gimp_image_set_grid (GimpImage *gimage,
GimpGrid *grid,
gboolean push_undo);
const gchar * gimp_grid_parasite_name (void) G_GNUC_CONST;
GimpParasite * gimp_grid_to_parasite (const GimpGrid *grid);
GimpGrid * gimp_grid_from_parasite (const GimpParasite *parasite);
#endif /* __GIMP_IMAGE_GRID_H__ */
......@@ -32,10 +32,12 @@
#include "base/tile-manager.h"
#include "config/gimpcoreconfig.h"
#include "config/gimpconfig-utils.h"
#include "gimp.h"
#include "gimp-parasites.h"
#include "gimpcontext.h"
#include "gimpgrid.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-colormap.h"
......@@ -946,6 +948,10 @@ gimp_image_new (Gimp *gimp,
gimage->yresolution = gimp->config->default_yresolution;
gimage->unit = gimp->config->default_unit;
gimage->grid = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (gimp->config->default_grid),
G_OBJECT (gimage->grid));
switch (base_type)
{
case GIMP_RGB:
......
......@@ -39,12 +39,9 @@
#include "core/gimpimage-undo-push.h"
#include "core/gimpgrid.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "widgets/gimpgrideditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimppropwidgets.h"
#include "grid-dialog.h"
......@@ -61,8 +58,6 @@ static void grid_changed_cb (GtkWidget *widget,
gpointer data);
static void reset_callback (GtkWidget *widget,
GtkWidget *dialog);
static void remove_callback (GtkWidget *widget,
GtkWidget *dialog);
static void cancel_callback (GtkWidget *widget,
GtkWidget *dialog);
static void ok_callback (GtkWidget *widget,
......@@ -73,44 +68,22 @@ static void ok_callback (GtkWidget *widget,
GtkWidget *
grid_dialog_new (GimpDisplay *gdisp)
grid_dialog_new (GimpImage *gimage)
{
GimpImage *gimage;
GimpDisplayShell *shell;
GimpGrid *grid;
GimpGrid *grid_backup = NULL;
GimpGrid *grid;
GimpGrid *grid_backup;
GtkWidget *dialog;
GtkWidget *remove_button;
GtkWidget *main_vbox;
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *table;
GtkWidget *type;
GtkWidget *color_button;
GtkWidget *sizeentry;
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), NULL);
gimage = GIMP_IMAGE (gdisp->gimage);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
grid = gimp_image_get_grid (GIMP_IMAGE (gimage));
if (grid)
{
grid_backup = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (grid),
G_OBJECT (grid_backup));
}
else
{
grid = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_image_set_grid (GIMP_IMAGE (gimage),
GIMP_GRID (grid),
FALSE);
}
/* the dialog */
GtkWidget *editor;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
grid = gimp_image_get_grid (GIMP_IMAGE (gimage));
grid_backup = g_object_new (GIMP_TYPE_GRID, NULL);
gimp_config_copy_properties (G_OBJECT (grid),
G_OBJECT (grid_backup));
/* dialog */
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("Configure Grid"), "configure_grid",
GIMP_STOCK_GRID, _("Configure Image Grid"),
......@@ -120,9 +93,6 @@ grid_dialog_new (GimpDisplay *gdisp)
GIMP_STOCK_RESET, reset_callback,
NULL, NULL, NULL, FALSE, FALSE,
GTK_STOCK_REMOVE, remove_callback,
NULL, NULL, &remove_button, FALSE, FALSE,
GTK_STOCK_CANCEL, cancel_callback,
NULL, NULL, NULL, FALSE, TRUE,
......@@ -131,180 +101,20 @@ grid_dialog_new (GimpDisplay *gdisp)
NULL);
if (! grid_backup)
gtk_widget_set_sensitive (GTK_WIDGET (remove_button), FALSE);
/* the main vbox */
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
editor = gimp_grid_editor_new (grid,
gimage->xresolution,
gimage->yresolution);
gtk_container_set_border_width (GTK_CONTAINER (editor), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
main_vbox);
/* the appearance frame */
frame = gtk_frame_new (_("Appearance"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
table = gtk_table_new (3, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_add (GTK_CONTAINER (frame), table);
type = gimp_prop_enum_option_menu_new (G_OBJECT (grid), "type",
GIMP_GRID_DOTS, GIMP_GRID_SOLID);
g_signal_connect (type, "changed",
G_CALLBACK (grid_changed_cb),
gimage);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Line _Style:"), 1.0, 0.5,
type, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "fgcolor",
_("Change Grid Foreground Color"),
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
g_signal_connect (color_button, "color-changed",
G_CALLBACK (grid_changed_cb),
gimage);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("_Foreground Color:"), 1.0, 0.5,
color_button, 1, TRUE);
color_button = gimp_prop_color_button_new (G_OBJECT (grid), "bgcolor",
_("Change Grid Background Color"),
GRID_COLOR_SIZE, GRID_COLOR_SIZE,
GIMP_COLOR_AREA_FLAT);
g_signal_connect (color_button, "color-changed",
G_CALLBACK (grid_changed_cb),
gimage);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("_Background Color:"), 1.0, 0.5,
color_button, 1, TRUE);
gtk_widget_show (table);
/* the spacing frame */
frame = gtk_frame_new (_("Spacing"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_container_add (GTK_CONTAINER (frame), hbox);
sizeentry = gimp_prop_coordinates_new (G_OBJECT (grid),
"xspacing",
"yspacing",
"spacing-unit",
"%a",
GIMP_SIZE_ENTRY_UPDATE_SIZE,
gimage->xresolution,
gimage->yresolution,
TRUE);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (sizeentry),