app: add color index label to the palette editor.

This commit is contained in:
Sergio Jiménez Herena
2018-09-14 20:41:50 +02:00
committed by Jehan
parent 2dd2ba1bfb
commit cc6e21e05b
2 changed files with 18 additions and 1 deletions

View File

@ -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);

View File

@ -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;