mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 19:43:01 +00:00
changed gimpwidgetsenums.c rule to include the bits for "desc" and "help"
2005-05-22 Michael Natterer <mitch@gimp.org> * libgimpwidgets/Makefile.am: changed gimpwidgetsenums.c rule to include the bits for "desc" and "help" support. * libgimpwidgets/gimpwidgetsenums.h: added "desc" and "help" strings for the GimpColorSelectorChannel enum. * libgimpwidgets/gimpwidgetsenums.c: added to CVS because it contains translatable strings now. * libgimpwidgets/gimpcolorscales.c * libgimpwidgets/gimpcolorselect.c: removed duplicated arrays of strings here and get them from the type system.
This commit is contained in:
parent
d21f31d065
commit
bcc88a5281
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2005-05-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimpwidgets/Makefile.am: changed gimpwidgetsenums.c rule to
|
||||
include the bits for "desc" and "help" support.
|
||||
|
||||
* libgimpwidgets/gimpwidgetsenums.h: added "desc" and "help"
|
||||
strings for the GimpColorSelectorChannel enum.
|
||||
|
||||
* libgimpwidgets/gimpwidgetsenums.c: added to CVS because it
|
||||
contains translatable strings now.
|
||||
|
||||
* libgimpwidgets/gimpcolorscales.c
|
||||
* libgimpwidgets/gimpcolorselect.c: removed duplicated arrays of
|
||||
strings here and get them from the type system.
|
||||
|
||||
2005-05-22 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* tools/gimp-mkenums (parse_trigraph): use quotewords() from
|
||||
|
|
|
@ -6,7 +6,6 @@ _libs
|
|||
.libs
|
||||
.deps
|
||||
*.la
|
||||
gimpwidgetsenums.c
|
||||
gimpwidgetsmarshal.h
|
||||
gimpwidgetsmarshal.c
|
||||
test-preview-area
|
||||
|
|
|
@ -231,11 +231,14 @@ CLEANFILES = $(gen_sources)
|
|||
|
||||
$(srcdir)/gimpwidgetsenums.c: $(srcdir)/gimpwidgetsenums.h $(GIMP_MKENUMS)
|
||||
$(GIMP_MKENUMS) \
|
||||
--fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"gimpwidgetstypes.h\"\n" \
|
||||
--fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"libgimpbase/gimpbase.h\"\n#include \"gimpwidgetsenums.h\"\n#include \"libgimp/libgimp-intl.h\"" \
|
||||
--fprod "\n/* enumerations from \"@filename@\" */" \
|
||||
--vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
|
||||
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
|
||||
--vtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (! type)\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n }\n\n return type;\n}\n" \
|
||||
--vtail " { 0, NULL, NULL }\n };\n" \
|
||||
--dhead " static const Gimp@Type@Desc descs[] =\n {" \
|
||||
--dprod " { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
|
||||
--dtail " { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (! type)\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n gimp_@type@_set_value_descriptions (type, descs);\n }\n\n return type;\n}\n" \
|
||||
$(srcdir)/gimpwidgetsenums.h > xgen-wec \
|
||||
&& cp xgen-wec $(@F) \
|
||||
&& rm -f xgen-wec
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
|
@ -140,29 +141,10 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
{
|
||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
|
||||
GtkWidget *table;
|
||||
GEnumClass *enum_class;
|
||||
GSList *group;
|
||||
gint i;
|
||||
|
||||
static const gchar *toggle_titles[] =
|
||||
{
|
||||
N_("_H"),
|
||||
N_("_S"),
|
||||
N_("_V"),
|
||||
N_("_R"),
|
||||
N_("_G"),
|
||||
N_("_B"),
|
||||
N_("_A")
|
||||
};
|
||||
static const gchar *slider_tips[] =
|
||||
{
|
||||
N_("Hue"),
|
||||
N_("Saturation"),
|
||||
N_("Value"),
|
||||
N_("Red"),
|
||||
N_("Green"),
|
||||
N_("Blue"),
|
||||
N_("Alpha")
|
||||
};
|
||||
static gdouble slider_initial_vals[] = { 0, 0, 0, 0, 0, 0, 0 };
|
||||
static gdouble slider_max_vals[] = { 360, 100, 100, 255, 255, 255, 100 };
|
||||
static gdouble slider_incs[] = { 30, 10, 10, 16, 16, 16, 10 };
|
||||
|
@ -179,11 +161,17 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
gtk_box_pack_start (GTK_BOX (scales), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
enum_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
|
||||
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
for (i = GIMP_COLOR_SELECTOR_HUE; i <= GIMP_COLOR_SELECTOR_ALPHA; i++)
|
||||
{
|
||||
if (i == 6)
|
||||
GimpEnumDesc *enum_desc;
|
||||
|
||||
enum_desc = gimp_enum_get_desc (enum_class, i);
|
||||
|
||||
if (i == GIMP_COLOR_SELECTOR_ALPHA)
|
||||
{
|
||||
scales->toggles[i] = NULL;
|
||||
}
|
||||
|
@ -199,7 +187,7 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
gtk_widget_show (scales->toggles[i]);
|
||||
|
||||
gimp_help_set_help_data (scales->toggles[i],
|
||||
gettext (slider_tips[i]), NULL);
|
||||
gettext (enum_desc->value_help), NULL);
|
||||
|
||||
g_signal_connect (scales->toggles[i], "toggled",
|
||||
G_CALLBACK (gimp_color_scales_toggle_update),
|
||||
|
@ -208,13 +196,13 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
|
||||
scales->slider_data[i] =
|
||||
gimp_color_scale_entry_new (GTK_TABLE (table), 1, i,
|
||||
gettext (toggle_titles[i]),
|
||||
gettext (enum_desc->value_desc),
|
||||
-1, -1,
|
||||
slider_initial_vals[i],
|
||||
0.0, slider_max_vals[i],
|
||||
1.0, slider_incs[i],
|
||||
0,
|
||||
gettext (slider_tips[i]),
|
||||
gettext (enum_desc->value_help),
|
||||
NULL);
|
||||
|
||||
scales->sliders[i] = GIMP_SCALE_ENTRY_SCALE (scales->slider_data[i]);
|
||||
|
@ -225,6 +213,8 @@ gimp_color_scales_init (GimpColorScales *scales)
|
|||
G_CALLBACK (gimp_color_scales_scale_update),
|
||||
scales);
|
||||
}
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
|
@ -338,30 +339,22 @@ gimp_color_select_init (GimpColorSelect *select)
|
|||
/* channel toggles */
|
||||
{
|
||||
GimpColorSelectorChannel channel;
|
||||
GEnumClass *enum_class;
|
||||
GSList *group = NULL;
|
||||
|
||||
static const gchar *labels[] =
|
||||
{
|
||||
N_("_H"), N_("_S"), N_("_V"), N_("_R"), N_("_G"), N_("_B")
|
||||
};
|
||||
static const gchar *tips[] =
|
||||
{
|
||||
N_("Hue"),
|
||||
N_("Saturation"),
|
||||
N_("Value"),
|
||||
N_("Red"),
|
||||
N_("Green"),
|
||||
N_("Blue")
|
||||
};
|
||||
enum_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
|
||||
|
||||
for (channel = GIMP_COLOR_SELECTOR_HUE;
|
||||
channel < GIMP_COLOR_SELECTOR_ALPHA;
|
||||
channel++)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GimpEnumDesc *enum_desc;
|
||||
GtkWidget *button;
|
||||
|
||||
enum_desc = gimp_enum_get_desc (enum_class, channel);
|
||||
|
||||
button = gtk_radio_button_new_with_mnemonic (group,
|
||||
gettext (labels[channel]));
|
||||
gettext (enum_desc->value_desc));
|
||||
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (select->toggle_box), button,
|
||||
|
@ -374,12 +367,14 @@ gimp_color_select_init (GimpColorSelect *select)
|
|||
if (channel == GIMP_COLOR_SELECTOR_HUE)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
||||
gimp_help_set_help_data (button, gettext (tips[channel]), NULL);
|
||||
gimp_help_set_help_data (button, gettext (enum_desc->value_help), NULL);
|
||||
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (gimp_color_select_channel_toggled),
|
||||
select);
|
||||
}
|
||||
|
||||
g_type_class_unref (enum_class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
83
libgimpwidgets/gimpwidgetsenums.c
Normal file
83
libgimpwidgets/gimpwidgetsenums.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
|
||||
/* Generated data (by gimp-mkenums) */
|
||||
|
||||
#include "config.h"
|
||||
#include <glib-object.h>
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "gimpwidgetsenums.h"
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
/* enumerations from "./gimpwidgetsenums.h" */
|
||||
GType
|
||||
gimp_color_area_type_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_COLOR_AREA_FLAT, "GIMP_COLOR_AREA_FLAT", "flat" },
|
||||
{ GIMP_COLOR_AREA_SMALL_CHECKS, "GIMP_COLOR_AREA_SMALL_CHECKS", "small-checks" },
|
||||
{ GIMP_COLOR_AREA_LARGE_CHECKS, "GIMP_COLOR_AREA_LARGE_CHECKS", "large-checks" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_COLOR_AREA_FLAT, "GIMP_COLOR_AREA_FLAT", NULL },
|
||||
{ GIMP_COLOR_AREA_SMALL_CHECKS, "GIMP_COLOR_AREA_SMALL_CHECKS", NULL },
|
||||
{ GIMP_COLOR_AREA_LARGE_CHECKS, "GIMP_COLOR_AREA_LARGE_CHECKS", NULL },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
type = g_enum_register_static ("GimpColorAreaType", values);
|
||||
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_color_selector_channel_get_type (void)
|
||||
{
|
||||
static const GEnumValue values[] =
|
||||
{
|
||||
{ GIMP_COLOR_SELECTOR_HUE, "GIMP_COLOR_SELECTOR_HUE", "hue" },
|
||||
{ GIMP_COLOR_SELECTOR_SATURATION, "GIMP_COLOR_SELECTOR_SATURATION", "saturation" },
|
||||
{ GIMP_COLOR_SELECTOR_VALUE, "GIMP_COLOR_SELECTOR_VALUE", "value" },
|
||||
{ GIMP_COLOR_SELECTOR_RED, "GIMP_COLOR_SELECTOR_RED", "red" },
|
||||
{ GIMP_COLOR_SELECTOR_GREEN, "GIMP_COLOR_SELECTOR_GREEN", "green" },
|
||||
{ GIMP_COLOR_SELECTOR_BLUE, "GIMP_COLOR_SELECTOR_BLUE", "blue" },
|
||||
{ GIMP_COLOR_SELECTOR_ALPHA, "GIMP_COLOR_SELECTOR_ALPHA", "alpha" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static const GimpEnumDesc descs[] =
|
||||
{
|
||||
{ GIMP_COLOR_SELECTOR_HUE, N_("_H"), N_("Hue") },
|
||||
{ GIMP_COLOR_SELECTOR_SATURATION, N_("_S"), N_("Saturation") },
|
||||
{ GIMP_COLOR_SELECTOR_VALUE, N_("_V"), N_("Value") },
|
||||
{ GIMP_COLOR_SELECTOR_RED, N_("_R"), N_("Red") },
|
||||
{ GIMP_COLOR_SELECTOR_GREEN, N_("_G"), N_("Green") },
|
||||
{ GIMP_COLOR_SELECTOR_BLUE, N_("_B"), N_("Blue") },
|
||||
{ GIMP_COLOR_SELECTOR_ALPHA, N_("_A"), N_("Alpha") },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
type = g_enum_register_static ("GimpColorSelectorChannel", values);
|
||||
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
|
||||
gimp_enum_set_value_descriptions (type, descs);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/* Generated data ends here */
|
||||
|
|
@ -38,17 +38,23 @@ typedef enum
|
|||
} GimpColorAreaType;
|
||||
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
#define GIMP_TYPE_COLOR_SELECTOR_CHANNEL (gimp_color_selector_channel_get_type ())
|
||||
|
||||
GType gimp_color_selector_channel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_COLOR_SELECTOR_HUE,
|
||||
GIMP_COLOR_SELECTOR_SATURATION,
|
||||
GIMP_COLOR_SELECTOR_VALUE,
|
||||
GIMP_COLOR_SELECTOR_RED,
|
||||
GIMP_COLOR_SELECTOR_GREEN,
|
||||
GIMP_COLOR_SELECTOR_BLUE,
|
||||
GIMP_COLOR_SELECTOR_ALPHA
|
||||
GIMP_COLOR_SELECTOR_HUE, /*< desc="_H", help="Hue" >*/
|
||||
GIMP_COLOR_SELECTOR_SATURATION, /*< desc="_S", help="Saturation" >*/
|
||||
GIMP_COLOR_SELECTOR_VALUE, /*< desc="_V", help="Value" >*/
|
||||
GIMP_COLOR_SELECTOR_RED, /*< desc="_R", help="Red" >*/
|
||||
GIMP_COLOR_SELECTOR_GREEN, /*< desc="_G", help="Green" >*/
|
||||
GIMP_COLOR_SELECTOR_BLUE, /*< desc="_B", help="Blue" >*/
|
||||
GIMP_COLOR_SELECTOR_ALPHA /*< desc="_A", help="Alpha" >*/
|
||||
} GimpColorSelectorChannel;
|
||||
|
||||
|
||||
|
||||
typedef enum /*< skip >*/
|
||||
{
|
||||
GIMP_SIZE_ENTRY_UPDATE_NONE = 0,
|
||||
|
|
Loading…
Reference in a new issue