From 2a72abfd9352f9254ffe03779b8e5e592389ca76 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 15 Jul 2003 00:29:34 +0000 Subject: [PATCH] include . 2003-07-15 Sven Neumann * libgimpcolor/gimpcolor.h: include . * modules/Makefile.am * modules/colorsel_cmyk.c: added a simple CMYK color selector. --- ChangeLog | 7 ++ libgimpcolor/gimpcolor.h | 1 + modules/Makefile.am | 5 + modules/colorsel_cmyk.c | 254 +++++++++++++++++++++++++++++++++++++++ po-libgimp/ChangeLog | 6 + po-libgimp/POTFILES.in | 1 + po-libgimp/de.po | 90 +++++++++----- 7 files changed, 336 insertions(+), 28 deletions(-) create mode 100644 modules/colorsel_cmyk.c diff --git a/ChangeLog b/ChangeLog index 18c822c499..9573b11c61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-07-15 Sven Neumann + + * libgimpcolor/gimpcolor.h: include . + + * modules/Makefile.am + * modules/colorsel_cmyk.c: added a simple CMYK color selector. + 2003-07-15 Michael Natterer * app/core/gimppattern.c (gimp_pattern_load): fixed pattern depth diff --git a/libgimpcolor/gimpcolor.h b/libgimpcolor/gimpcolor.h index 692b0771cf..f37a48e253 100644 --- a/libgimpcolor/gimpcolor.h +++ b/libgimpcolor/gimpcolor.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/modules/Makefile.am b/modules/Makefile.am index f85fbfb30c..24dd6d2fa7 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -19,12 +19,17 @@ EXTRA_DIST = \ makefile.msc lib_LTLIBRARIES = \ + libcolorsel_cmyk.la \ libcolorsel_triangle.la \ libcolorsel_water.la \ libcdisplay_colorblind.la \ libcdisplay_gamma.la \ libcdisplay_highcontrast.la +libcolorsel_cmyk_la_SOURCES = colorsel_cmyk.c +libcolorsel_cmyk_la_LDFLAGS = -avoid-version -module $(no_undefined) +libcolorsel_cmyk_la_LIBADD = $(libgimpcolor) $(libgimpwidgets) $(GTK_LIBS) + libcolorsel_triangle_la_SOURCES = colorsel_triangle.c libcolorsel_triangle_la_LDFLAGS = -avoid-version -module $(no_undefined) libcolorsel_triangle_la_LIBADD = $(libgimpcolor) $(libgimpwidgets) $(GTK_LIBS) diff --git a/modules/colorsel_cmyk.c b/modules/colorsel_cmyk.c new file mode 100644 index 0000000000..d9d582aebc --- /dev/null +++ b/modules/colorsel_cmyk.c @@ -0,0 +1,254 @@ +/* CMYK GimpColorSelector + * Copyright (C) 2003 Sven Neumann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include +#include + +#include + +#include "libgimpcolor/gimpcolor.h" +#include "libgimpmath/gimpmath.h" +#include "libgimpmodule/gimpmodule.h" +#include "libgimpwidgets/gimpwidgets.h" + +#include "libgimp/libgimp-intl.h" + + +/* definitions and variables */ + +#define COLORSEL_TYPE_CMYK (colorsel_cmyk_type) +#define COLORSEL_CMYK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLORSEL_TYPE_CMYK, ColorselCmyk)) +#define COLORSEL_CMYK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COLORSEL_TYPE_CMYK, ColorselCmykClass)) +#define COLORSEL_IS_CMYK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLORSEL_TYPE_CMYK)) +#define COLORSEL_IS_CMYK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COLORSEL_TYPE_CMYK)) + + +typedef struct _ColorselCmyk ColorselCmyk; +typedef struct _ColorselCmykClass ColorselCmykClass; + +struct _ColorselCmyk +{ + GimpColorSelector parent_instance; + + GimpCMYK cmyk; + GtkAdjustment *adj[4]; +}; + +struct _ColorselCmykClass +{ + GimpColorSelectorClass parent_class; +}; + + +static GType colorsel_cmyk_get_type (GTypeModule *module); +static void colorsel_cmyk_class_init (ColorselCmykClass *klass); +static void colorsel_cmyk_init (ColorselCmyk *cmyk); + +static void colorsel_cmyk_set_color (GimpColorSelector *selector, + const GimpRGB *rgb, + const GimpHSV *hsv); +static void colorsel_cmyk_adj_update (GtkAdjustment *adj, + ColorselCmyk *module); + + +static const GimpModuleInfo colorsel_cmyk_info = +{ + GIMP_MODULE_ABI_VERSION, + N_("CMYK color selector"), + "Sven Neumann ", + "v0.1", + "(c) 2003, released under the GPL", + "July 2003" +}; + +static GType colorsel_cmyk_type = 0; +static GimpColorSelectorClass *parent_class = NULL; + + +G_MODULE_EXPORT const GimpModuleInfo * +gimp_module_query (GTypeModule *module) +{ + return &colorsel_cmyk_info; +} + +G_MODULE_EXPORT gboolean +gimp_module_register (GTypeModule *module) +{ + colorsel_cmyk_get_type (module); + + return TRUE; +} + +static GType +colorsel_cmyk_get_type (GTypeModule *module) +{ + if (! colorsel_cmyk_type) + { + static const GTypeInfo select_info = + { + sizeof (ColorselCmykClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) colorsel_cmyk_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (ColorselCmyk), + 0, /* n_preallocs */ + (GInstanceInitFunc) colorsel_cmyk_init, + }; + + colorsel_cmyk_type = + g_type_module_register_type (module, + GIMP_TYPE_COLOR_SELECTOR, + "ColorselCmyk", + &select_info, 0); + } + + return colorsel_cmyk_type; +} + +static void +colorsel_cmyk_class_init (ColorselCmykClass *klass) +{ + GimpColorSelectorClass *selector_class; + + selector_class = GIMP_COLOR_SELECTOR_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + selector_class->name = _("_CMYK"); + selector_class->help_page = "cmyk.html"; + selector_class->stock_id = GTK_STOCK_PRINT; /* FIXME */ + selector_class->set_color = colorsel_cmyk_set_color; +} + +static void +colorsel_cmyk_init (ColorselCmyk *module) +{ + GtkWidget *table; + gint i; + + static const gchar *cmyk_labels[] = + { + N_("_C"), + N_("_M"), + N_("_Y"), + N_("_K") + }; + static const gchar *cmyk_tips[] = + { + N_("Cyan"), + N_("Magenta"), + N_("Yellow"), + N_("Black") + }; + + table = gtk_table_new (4, 4, FALSE); + + gtk_table_set_row_spacings (GTK_TABLE (table), 1); + gtk_table_set_row_spacing (GTK_TABLE (table), 2, 3); + gtk_table_set_col_spacings (GTK_TABLE (table), 2); + gtk_table_set_col_spacing (GTK_TABLE (table), 0, 0); + gtk_box_pack_start (GTK_BOX (module), table, TRUE, FALSE, 0); + + for (i = 0; i < 4; i++) + { + GtkObject *adj; + + adj = gimp_scale_entry_new (GTK_TABLE (table), 1, i, + gettext (cmyk_labels[i]), + 80, -1, + 0.0, + 0.0, 255.0, + 1.0, 16.0, + 0, + TRUE, 0.0, 0.0, + gettext (cmyk_tips[i]), + NULL); + + g_signal_connect (adj, "value_changed", + G_CALLBACK (colorsel_cmyk_adj_update), + module); + + module->adj[i] = GTK_ADJUSTMENT (adj); + } + + gtk_widget_show (table); +} + +static void +colorsel_cmyk_set_color (GimpColorSelector *selector, + const GimpRGB *rgb, + const GimpHSV *hsv) +{ + ColorselCmyk *module; + guchar c, m, y, k; + + module = COLORSEL_CMYK (selector); + + gimp_rgb_to_cmyk (rgb, &module->cmyk); + + gimp_cmyk_get_uchar (&module->cmyk, &c, &m, &y, &k); + + gtk_adjustment_set_value (module->adj[0], c); + gtk_adjustment_set_value (module->adj[1], m); + gtk_adjustment_set_value (module->adj[2], y); + gtk_adjustment_set_value (module->adj[3], k); +} + +static void +colorsel_cmyk_adj_update (GtkAdjustment *adj, + ColorselCmyk *module) +{ + GimpColorSelector *selector; + gdouble value; + gint i; + + value = adj->value / 255.0; + + for (i = 0; i < 4; i++) + if (module->adj[i] == adj) + break; + + switch (i) + { + case 0: + module->cmyk.c = value; + break; + case 1: + module->cmyk.m = value; + break; + case 2: + module->cmyk.y = value; + break; + case 3: + module->cmyk.k = value; + break; + default: + return; + } + + selector = GIMP_COLOR_SELECTOR (module); + + gimp_cmyk_to_rgb (&module->cmyk, &selector->rgb); + gimp_rgb_to_hsv (&selector->rgb, &selector->hsv); + + gimp_color_selector_color_changed (selector); +} diff --git a/po-libgimp/ChangeLog b/po-libgimp/ChangeLog index 72b4ad6f58..a7febf56f8 100644 --- a/po-libgimp/ChangeLog +++ b/po-libgimp/ChangeLog @@ -1,3 +1,9 @@ +2003-07-15 Sven Neumann + + * POTFILES.in: added modules/colorsel_cmyk.c. + + * de.po: updated german translation. + 2003-07-14 Danilo Šegan * sr.po, sr@Latn.po: Updated Serbian translation by Serbian team diff --git a/po-libgimp/POTFILES.in b/po-libgimp/POTFILES.in index 0848f6a476..58c2ffc3ab 100644 --- a/po-libgimp/POTFILES.in +++ b/po-libgimp/POTFILES.in @@ -28,5 +28,6 @@ libgimpwidgets/gimpwidgets.c modules/cdisplay_colorblind.c modules/cdisplay_gamma.c modules/cdisplay_highcontrast.c +modules/colorsel_cmyk.c modules/colorsel_triangle.c modules/colorsel_water.c diff --git a/po-libgimp/de.po b/po-libgimp/de.po index 96b85963ed..2da1338bbd 100644 --- a/po-libgimp/de.po +++ b/po-libgimp/de.po @@ -1,5 +1,5 @@ # This is the German catalog for the libgimp. -# Copyright (C) 1999,2000 Free Software Foundation, Inc. +# Copyright (C) 1999 - 2003 Free Software Foundation, Inc. # # Daniel Egger # Sven Neumann @@ -7,16 +7,16 @@ # msgid "" msgstr "" -"Project-Id-Version: GIMP 1.3.15\n" -"POT-Creation-Date: 2003-06-26 22:14+0200\n" -"PO-Revision-Date: 2003-06-16 22:42+0200\n" +"Project-Id-Version: GIMP 1.3.17\n" +"POT-Creation-Date: 2003-07-15 02:16+0200\n" +"PO-Revision-Date: 2003-07-15 02:18+0200\n" "Last-Translator: Sven Neumann \n" "Language-Team: German \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: libgimp/gimpbrushmenu.c:321 +#: libgimp/gimpbrushmenu.c:132 msgid "Brush Selection" msgstr "Pinselauswahl" @@ -148,7 +148,7 @@ msgstr "Das Bild sollte vor dem Abspeichern exportiert werden, denn:" msgid "The export conversion won't modify your original image." msgstr "Dieser Vorgang wird das Originalbild nicht verändern." -#: libgimp/gimpexport.c:610 +#: libgimp/gimpexport.c:611 #, c-format msgid "" "You are about to save a layer mask as %s.\n" @@ -157,7 +157,7 @@ msgstr "" "Sie sichern eine Ebenenmaske als %s.\n" "Die sichtbaren Ebenen werden dabei nicht gesichert." -#: libgimp/gimpexport.c:615 +#: libgimp/gimpexport.c:617 #, c-format msgid "" "You are about to save a channel (saved selection) as %s.\n" @@ -166,16 +166,16 @@ msgstr "" "Sie sichern einen Kanal (gesicherte Selektion) als %s.\n" "Die sichtbaren Ebenen werden dabei nicht gesichert." -#: libgimp/gimpfontmenu.c:80 +#: libgimp/gimpfontmenu.c:89 msgid "Font Selection" msgstr "Schriftenauswahl" -#: libgimp/gimpgradientmenu.c:172 +#: libgimp/gimpgradientmenu.c:102 msgid "Gradient Selection" msgstr "Gradientenauswahl" -#: libgimp/gimpmenu.c:176 libgimp/gimpmenu.c:296 libgimp/gimpmenu.c:411 -#: libgimp/gimpmenu.c:593 +#: libgimp/gimpmenu.c:93 libgimp/gimpmenu.c:217 libgimp/gimpmenu.c:334 +#: libgimp/gimpmenu.c:517 msgid "None" msgstr "Keine" @@ -183,7 +183,7 @@ msgstr "Keine" msgid "Preview" msgstr "Vorschau" -#: libgimp/gimpmiscui.c:529 +#: libgimp/gimpmiscui.c:537 #, c-format msgid "" "No %s in gimprc:\n" @@ -192,7 +192,7 @@ msgid "" "to your %s file." msgstr "" -#: libgimp/gimppatternmenu.c:321 +#: libgimp/gimppatternmenu.c:115 msgid "Pattern Selection" msgstr "Musterauswahl" @@ -235,9 +235,9 @@ msgstr "%1.f MB" msgid "Loading module: '%s'\n" msgstr "Lade Modul: '%s'\n" -#: libgimpmodule/gimpmodule.c:189 libgimpmodule/gimpmodule.c:206 -#: libgimpmodule/gimpmodule.c:312 libgimpmodule/gimpmodule.c:339 -#: libgimpmodule/gimpmodule.c:432 +#: libgimpmodule/gimpmodule.c:190 libgimpmodule/gimpmodule.c:207 +#: libgimpmodule/gimpmodule.c:314 libgimpmodule/gimpmodule.c:341 +#: libgimpmodule/gimpmodule.c:434 #, c-format msgid "" "Module '%s' load error:\n" @@ -246,24 +246,24 @@ msgstr "" "Fehler beim Laden von Modul '%s':\n" "%s" -#: libgimpmodule/gimpmodule.c:270 +#: libgimpmodule/gimpmodule.c:271 #, c-format msgid "Skipping module: '%s'\n" msgstr "Ignoriere Modul: '%s'\n" -#: libgimpmodule/gimpmodule.c:406 +#: libgimpmodule/gimpmodule.c:408 msgid "Module error" msgstr "Modul Fehler" -#: libgimpmodule/gimpmodule.c:407 +#: libgimpmodule/gimpmodule.c:409 msgid "Loaded" msgstr "Geladen" -#: libgimpmodule/gimpmodule.c:408 +#: libgimpmodule/gimpmodule.c:410 msgid "Load failed" msgstr "Laden fehlgeschlagen" -#: libgimpmodule/gimpmodule.c:409 +#: libgimpmodule/gimpmodule.c:411 msgid "Not loaded" msgstr "Nicht geladen" @@ -477,7 +477,7 @@ msgstr "Initialisiere den Zufallsgenerator mit einer Zufallszahl" #: modules/cdisplay_colorblind.c:122 msgid "Color deficit simulation filter (Brettel-Vienot-Mollon algorithm)" -msgstr "" +msgstr "Farbenblindheit Anzeigenfarbfilter (Algorithmus von Brettel-Vienot-Mollon)" #: modules/cdisplay_colorblind.c:188 msgid "Color Deficient Vision" @@ -527,6 +527,46 @@ msgstr "Kontrast" msgid "Contrast Cycles:" msgstr "Kontrastverstärkung:" +#: modules/colorsel_cmyk.c:74 +msgid "CMYK color selector" +msgstr "CMYK Farbmischer" + +#: modules/colorsel_cmyk.c:136 +msgid "_CMYK" +msgstr "_CMYK" + +#: modules/colorsel_cmyk.c:150 +msgid "_C" +msgstr "_C" + +#: modules/colorsel_cmyk.c:151 +msgid "_M" +msgstr "_M" + +#: modules/colorsel_cmyk.c:152 +msgid "_Y" +msgstr "_Y" + +#: modules/colorsel_cmyk.c:153 +msgid "_K" +msgstr "_K" + +#: modules/colorsel_cmyk.c:157 +msgid "Cyan" +msgstr "Cyan" + +#: modules/colorsel_cmyk.c:158 +msgid "Magenta" +msgstr "Magenta" + +#: modules/colorsel_cmyk.c:159 +msgid "Yellow" +msgstr "Gelb (Yellow)" + +#: modules/colorsel_cmyk.c:160 +msgid "Black" +msgstr "Schwarz (Key)" + #: modules/colorsel_triangle.c:110 msgid "Painter-style triangle color selector" msgstr "Dreiecks-Farbauswahl im Stil von Painter" @@ -546,9 +586,3 @@ msgstr "_Wasserfarbe" #: modules/colorsel_water.c:251 msgid "Pressure" msgstr "Druck" - -#~ msgid "Cancel" -#~ msgstr "Abbrechen" - -#~ msgid "Colorblind display filter" -#~ msgstr "Farbenblindheit Anzeigenfarbfilter"