diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 0d89867770..4cbf7aceed 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); @@ -771,8 +778,17 @@ palette_editor_entry_selected (GimpPaletteView *view, if (editor->color != entry) { + gchar index[8]; + editor->color = entry; + if (entry) + g_snprintf (index, sizeof (index), "%04i", entry->position); + else + g_snprintf (index, sizeof (index), "####"); + + gtk_label_set_text (GTK_LABEL (editor->index_label), 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 8058d87cd9..4c5febc38c 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;