From 02427845c85bf7d9c6141e9f673b2c687109f0d5 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 4 Mar 2003 14:35:56 +0000 Subject: [PATCH] set the active color from GimpColormapEditor::selected so you can pick 2003-03-04 Sven Neumann * app/widgets/gimpcolormapeditor.[ch]: set the active color from GimpColormapEditor::selected so you can pick colors from an indexed palette again. --- ChangeLog | 6 ++++++ app/widgets/gimpcolormapeditor.c | 36 +++++++++++++++++++++++++++++++- app/widgets/gimpcolormapeditor.h | 2 +- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48f3771279..d148f13cd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-03-04 Sven Neumann + + * app/widgets/gimpcolormapeditor.[ch]: set the active color from + GimpColormapEditor::selected so you can pick colors from an + indexed palette again. + 2003-03-04 Michael Natterer * app/file/file-save.[ch]: added new function file_save_as() which diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index 476010db87..a3de0c94be 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -41,7 +41,9 @@ #endif #include "display/display-types.h" +#include "core/gimp.h" #include "core/gimpcontainer.h" +#include "core/gimpcontext.h" #include "core/gimpimage.h" #include "core/gimpmarshal.h" @@ -51,6 +53,7 @@ #include "gimpdnd.h" #include "gimpitemfactory.h" #include "gimpmenufactory.h" +#include "gimptoolbox-color-area.h" #include "gui/color-notebook.h" @@ -82,6 +85,7 @@ static void gimp_colormap_editor_unmap (GtkWidget *widget); static void gimp_colormap_editor_set_image (GimpImageEditor *editor, GimpImage *gimage); +static void gimp_colormap_editor_real_selected (GimpColormapEditor *editor); static void gimp_colormap_editor_draw (GimpColormapEditor *editor); static void gimp_colormap_editor_draw_cell (GimpColormapEditor *editor, gint col); @@ -186,7 +190,7 @@ gimp_colormap_editor_class_init (GimpColormapEditorClass* klass) image_editor_class->set_image = gimp_colormap_editor_set_image; - klass->selected = NULL; + klass->selected = gimp_colormap_editor_real_selected; } static void @@ -407,6 +411,36 @@ gimp_colormap_editor_col_index (GimpColormapEditor *editor) /* private functions */ +static void +gimp_colormap_editor_real_selected (GimpColormapEditor *editor) +{ + GimpContext *user_context; + GimpImage *gimage; + GimpRGB color; + gint index; + + gimage = GIMP_IMAGE_EDITOR (editor)->gimage; + + if (!gimage) + return; + + user_context = gimp_get_user_context (gimage->gimp); + + index = editor->col_index; + + gimp_rgba_set_uchar (&color, + gimage->cmap[index * 3 + 0], + gimage->cmap[index * 3 + 1], + gimage->cmap[index * 3 + 2], + OPAQUE_OPACITY); + + if (active_color == FOREGROUND) + gimp_context_set_foreground (user_context, &color); + else if (active_color == BACKGROUND) + gimp_context_set_background (user_context, &color); +} + + #define MIN_CELL_SIZE 4 static void diff --git a/app/widgets/gimpcolormapeditor.h b/app/widgets/gimpcolormapeditor.h index ad69cbaaef..ffbfc103a6 100644 --- a/app/widgets/gimpcolormapeditor.h +++ b/app/widgets/gimpcolormapeditor.h @@ -57,7 +57,7 @@ struct _GimpColormapEditorClass { GimpImageEditorClass parent_class; - void (* selected) (GimpColormapEditor *gcd); + void (* selected) (GimpColormapEditor *editor); };