[gimp] app: add color index label to the palette editor.
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add color index label to the palette editor.
- Date: Mon, 9 Jul 2018 20:05:39 +0000 (UTC)
commit ea27fd912c347cf04c1e36f503fbef8e386262b5
Author: Sergio Jiménez Herena <sergio jimenez herena gmail com>
Date: Mon Jun 18 14:16:36 2018 +0200
app: add color index label to the palette editor.
app/widgets/gimppaletteeditor.c | 14 ++++++++++++++
app/widgets/gimppaletteeditor.h | 3 ++-
2 files changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c
index 67a834b048..68220efade 100644
--- a/app/widgets/gimppaletteeditor.c
+++ b/app/widgets/gimppaletteeditor.c
@@ -243,6 +243,13 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
+ /* The color index number */
+ editor->index_label = gtk_label_new ("####");
+ gtk_box_pack_start (GTK_BOX (hbox), editor->index_label, FALSE, FALSE, 0);
+ gimp_label_set_attributes (GTK_LABEL (editor->index_label),
+ PANGO_ATTR_FAMILY, "Monospace", -1);
+ gtk_widget_show (editor->index_label);
+
/* The color name entry */
editor->color_name = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), editor->color_name, TRUE, TRUE, 0);
@@ -764,11 +771,18 @@ palette_editor_entry_selected (GimpPaletteView *view,
GimpPaletteEditor *editor)
{
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
+ gchar *index = NULL;
if (editor->color != entry)
{
editor->color = entry;
+ if (entry)
+ index = g_strdup_printf("%04i", entry->position);
+ gtk_label_set_text (GTK_LABEL (editor->index_label),
+ entry ? index : "####");
+ g_free (index);
+
g_signal_handlers_block_by_func (editor->color_name,
palette_editor_color_name_changed,
editor);
diff --git a/app/widgets/gimppaletteeditor.h b/app/widgets/gimppaletteeditor.h
index 086dfb8b25..dfb999374a 100644
--- a/app/widgets/gimppaletteeditor.h
+++ b/app/widgets/gimppaletteeditor.h
@@ -38,6 +38,7 @@ struct _GimpPaletteEditor
GtkWidget *view;
+ GtkWidget *index_label;
GtkWidget *color_name;
GtkAdjustment *columns_adj;
@@ -45,7 +46,7 @@ struct _GimpPaletteEditor
GimpPaletteEntry *color;
- gfloat zoom_factor; /* range from 0.1 to 4.0 */
+ gdouble zoom_factor; /* range from 0.1 to 4.0 */
gint col_width;
gint last_width;
gint columns;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]