Commit c4cd420e authored by Michael Natterer's avatar Michael Natterer 😴

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
parent ae9f6d1b
......@@ -438,7 +438,7 @@ ink_pen_ellipse (GimpInkOptions *options,
switch (options->blob_type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
case GIMP_INK_BLOB_TYPE_CIRCLE:
blob_function = blob_ellipse;
break;
......
......@@ -93,7 +93,7 @@ gimp_ink_options_class_init (GimpInkOptionsClass *klass)
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BLOB_TYPE,
"blob-type", NULL,
GIMP_TYPE_INK_BLOB_TYPE,
GIMP_INK_BLOB_TYPE_ELLIPSE,
GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BLOB_ASPECT,
"blob-aspect", _("Ink Blob Aspect Ratio"),
......
......@@ -133,7 +133,7 @@ gimp_ink_blob_type_get_type (void)
{
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_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", "diamond" },
{ 0, NULL, NULL }
......@@ -141,7 +141,7 @@ gimp_ink_blob_type_get_type (void)
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_DIAMOND, "GIMP_INK_BLOB_TYPE_DIAMOND", NULL },
{ 0, NULL, NULL }
......
......@@ -88,7 +88,7 @@ GType gimp_ink_blob_type_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_INK_BLOB_TYPE_ELLIPSE,
GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_INK_BLOB_TYPE_SQUARE,
GIMP_INK_BLOB_TYPE_DIAMOND
} GimpInkBlobType;
......
......@@ -36,9 +36,6 @@
#include "gimp-intl.h"
static GtkWidget * blob_image_new (GimpInkBlobType blob_type);
GtkWidget *
gimp_ink_options_gui (GimpToolOptions *tool_options)
{
......@@ -48,7 +45,7 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
GtkWidget *frame;
GtkWidget *vbox2;
GtkWidget *scale;
GtkWidget *blob_vbox;
GtkWidget *blob_box;
GtkWidget *hbox;
GtkWidget *editor;
GtkSizeGroup *size_group;
......@@ -118,41 +115,16 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
/* Blob type radiobuttons */
blob_vbox = gimp_prop_enum_radio_box_new (config, "blob-type",
0, 0);
gtk_box_pack_start (GTK_BOX (hbox), blob_vbox, FALSE, FALSE, 0);
gtk_widget_show (blob_vbox);
gtk_size_group_add_widget (size_group, blob_vbox);
{
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_box = gimp_prop_enum_stock_box_new (config, "blob-type",
"gimp-shape", 0, 0);
gtk_orientable_set_orientation (GTK_ORIENTABLE (blob_box),
GTK_ORIENTATION_VERTICAL);
gtk_box_pack_start (GTK_BOX (hbox), blob_box, FALSE, FALSE, 0);
gtk_widget_show (blob_box);
blob = blob_image_new (blob_type);
gtk_container_add (GTK_CONTAINER (radio), blob);
gtk_widget_show (blob);
}
g_list_free (children);
}
gtk_size_group_add_widget (size_group, blob_box);
/* Blob editor */
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_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
......@@ -170,26 +142,3 @@ gimp_ink_options_gui (GimpToolOptions *tool_options)
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);
}
......@@ -87,7 +87,7 @@ gimp_blob_editor_class_init (GimpBlobEditorClass *klass)
g_param_spec_enum ("blob-type",
NULL, NULL,
GIMP_TYPE_INK_BLOB_TYPE,
GIMP_INK_BLOB_TYPE_ELLIPSE,
GIMP_INK_BLOB_TYPE_CIRCLE,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ASPECT,
......@@ -336,7 +336,7 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
switch (editor->type)
{
case GIMP_INK_BLOB_TYPE_ELLIPSE:
case GIMP_INK_BLOB_TYPE_CIRCLE:
function = blob_ellipse;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment