app: rename GIMP_INK_BLOB_TYPE_ELLIPSE to GIMP_INK_BLOB_TYPE_CIRCLE

- TYPE_SQUARE is also named SQUARE and not RECTANGLE
- serialization doesn't suffer from the changed name because it's the
  default value that never gets serialized
- a lot of messy code in the ink options can be replaced by a one-liner
  because the enum names now match their resp. stock items
This commit is contained in:
Michael Natterer
2010-11-14 16:29:42 +01:00
parent ae9f6d1b3f
commit c4cd420ef8
6 changed files with 16 additions and 67 deletions

View File

@ -438,7 +438,7 @@ ink_pen_ellipse (GimpInkOptions *options,
switch (options->blob_type) switch (options->blob_type)
{ {
case GIMP_INK_BLOB_TYPE_ELLIPSE: case GIMP_INK_BLOB_TYPE_CIRCLE:
blob_function = blob_ellipse; blob_function = blob_ellipse;
break; break;

View File

@ -93,7 +93,7 @@ gimp_ink_options_class_init (GimpInkOptionsClass *klass)
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BLOB_TYPE, GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BLOB_TYPE,
"blob-type", NULL, "blob-type", NULL,
GIMP_TYPE_INK_BLOB_TYPE, GIMP_TYPE_INK_BLOB_TYPE,
GIMP_INK_BLOB_TYPE_ELLIPSE, GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT, GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT,
"blob-aspect", _("Ink Blob Aspect Ratio"), "blob-aspect", _("Ink Blob Aspect Ratio"),

View File

@ -133,7 +133,7 @@ gimp_ink_blob_type_get_type (void)
{ {
static const GEnumValue values[] = static const GEnumValue values[] =
{ {
{ GIMP_INK_BLOB_TYPE_ELLIPSE, "GIMP_INK_BLOB_TYPE_ELLIPSE", "ellipse" }, { GIMP_INK_BLOB_TYPE_CIRCLE, "GIMP_INK_BLOB_TYPE_CIRCLE", "circle" },
{ GIMP_INK_BLOB_TYPE_SQUARE, "GIMP_INK_BLOB_TYPE_SQUARE", "square" }, { GIMP_INK_BLOB_TYPE_SQUARE, "GIMP_INK_BLOB_TYPE_SQUARE", "square" },
{ GIMP_INK_BLOB_TYPE_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", "diamond" }, { GIMP_INK_BLOB_TYPE_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", "diamond" },
{ 0, NULL, NULL } { 0, NULL, NULL }
@ -141,7 +141,7 @@ gimp_ink_blob_type_get_type (void)
static const GimpEnumDesc descs[] = static const GimpEnumDesc descs[] =
{ {
{ GIMP_INK_BLOB_TYPE_ELLIPSE, "GIMP_INK_BLOB_TYPE_ELLIPSE", NULL }, { GIMP_INK_BLOB_TYPE_CIRCLE, "GIMP_INK_BLOB_TYPE_CIRCLE", NULL },
{ GIMP_INK_BLOB_TYPE_SQUARE, "GIMP_INK_BLOB_TYPE_SQUARE", NULL }, { GIMP_INK_BLOB_TYPE_SQUARE, "GIMP_INK_BLOB_TYPE_SQUARE", NULL },
{ GIMP_INK_BLOB_TYPE_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", NULL }, { GIMP_INK_BLOB_TYPE_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", NULL },
{ 0, NULL, NULL } { 0, NULL, NULL }

View File

@ -88,7 +88,7 @@ GType gimp_ink_blob_type_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/ typedef enum /*< pdb-skip >*/
{ {
GIMP_INK_BLOB_TYPE_ELLIPSE, GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_INK_BLOB_TYPE_SQUARE, GIMP_INK_BLOB_TYPE_SQUARE,
GIMP_INK_BLOB_TYPE_DIAMOND GIMP_INK_BLOB_TYPE_DIAMOND
} GimpInkBlobType; } GimpInkBlobType;

View File

@ -36,9 +36,6 @@
#include "gimp-intl.h" #include "gimp-intl.h"
static GtkWidget * blob_image_new (GimpInkBlobType blob_type);
GtkWidget * GtkWidget *
gimp_ink_options_gui (GimpToolOptions *tool_options) gimp_ink_options_gui (GimpToolOptions *tool_options)
{ {
@ -48,7 +45,7 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
GtkWidget *frame; GtkWidget *frame;
GtkWidget *vbox2; GtkWidget *vbox2;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *blob_vbox; GtkWidget *blob_box;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *editor; GtkWidget *editor;
GtkSizeGroup *size_group; GtkSizeGroup *size_group;
@ -118,41 +115,16 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
/* Blob type radiobuttons */ /* Blob type radiobuttons */
blob_vbox = gimp_prop_enum_radio_box_new (config, "blob-type", blob_box = gimp_prop_enum_stock_box_new (config, "blob-type",
0, 0); "gimp-shape", 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), blob_vbox, FALSE, FALSE, 0); gtk_orientable_set_orientation (GTK_ORIENTABLE (blob_box),
gtk_widget_show (blob_vbox); GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (hbox), blob_box, FALSE, FALSE, 0);
gtk_widget_show (blob_box);
gtk_size_group_add_widget (size_group, blob_vbox); gtk_size_group_add_widget (size_group, blob_box);
{
GList *children;
GList *list;
GimpInkBlobType blob_type;
children = gtk_container_get_children (GTK_CONTAINER (blob_vbox));
for (list = children, blob_type = GIMP_INK_BLOB_TYPE_ELLIPSE;
list;
list = g_list_next (list), blob_type++)
{
GtkWidget *radio = GTK_WIDGET (list->data);
GtkWidget *blob;
gtk_button_set_relief (GTK_BUTTON (radio), GTK_RELIEF_NONE);
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (radio), FALSE);
gtk_container_remove (GTK_CONTAINER (radio),
gtk_bin_get_child (GTK_BIN (radio)));
blob = blob_image_new (blob_type);
gtk_container_add (GTK_CONTAINER (radio), blob);
gtk_widget_show (blob);
}
g_list_free (children);
}
/* Blob editor */
frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE); frame = gtk_aspect_frame_new (NULL, 0.0, 0.5, 1.0, FALSE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
@ -170,26 +142,3 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
return vbox; return vbox;
} }
static GtkWidget *
blob_image_new (GimpInkBlobType blob_type)
{
const gchar *stock_id = NULL;
switch (blob_type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
stock_id = GIMP_STOCK_SHAPE_CIRCLE;
break;
case GIMP_INK_BLOB_TYPE_SQUARE:
stock_id = GIMP_STOCK_SHAPE_SQUARE;
break;
case GIMP_INK_BLOB_TYPE_DIAMOND:
stock_id = GIMP_STOCK_SHAPE_DIAMOND;
break;
}
return gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
}

View File

@ -87,7 +87,7 @@ gimp_blob_editor_class_init (GimpBlobEditorClass *klass)
g_param_spec_enum ("blob-type", g_param_spec_enum ("blob-type",
NULL, NULL, NULL, NULL,
GIMP_TYPE_INK_BLOB_TYPE, GIMP_TYPE_INK_BLOB_TYPE,
GIMP_INK_BLOB_TYPE_ELLIPSE, GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT)); G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ASPECT, g_object_class_install_property (object_class, PROP_ASPECT,
@ -336,7 +336,7 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
switch (editor->type) switch (editor->type)
{ {
case GIMP_INK_BLOB_TYPE_ELLIPSE: case GIMP_INK_BLOB_TYPE_CIRCLE:
function = blob_ellipse; function = blob_ellipse;
break; break;