actually return the added entry, and not always the palette's last entry
2005-07-13 Michael Natterer <mitch@gimp.org> * app/core/gimppalette.c (gimp_palette_add_entry): actually return the added entry, and not always the palette's last entry (argh!). * app/widgets/gimppaletteeditor.c: make sure the cursor is always on the newly added color. Really fixes #15060 this time.
This commit is contained in:

committed by
Michael Natterer

parent
fbd53c511b
commit
8938834a72
@ -1,3 +1,11 @@
|
|||||||
|
2005-07-13 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimppalette.c (gimp_palette_add_entry): actually return
|
||||||
|
the added entry, and not always the palette's last entry (argh!).
|
||||||
|
|
||||||
|
* app/widgets/gimppaletteeditor.c: make sure the cursor is always
|
||||||
|
on the newly added color. Really fixes #15060 this time.
|
||||||
|
|
||||||
2005-07-13 Sven Neumann <sven@gimp.org>
|
2005-07-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/paint-funcs/paint-funcs.[ch]: added smooth_region(), a
|
* app/paint-funcs/paint-funcs.[ch]: added smooth_region(), a
|
||||||
|
@ -611,10 +611,10 @@ gimp_palette_duplicate (GimpData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpPaletteEntry *
|
GimpPaletteEntry *
|
||||||
gimp_palette_add_entry (GimpPalette *palette,
|
gimp_palette_add_entry (GimpPalette *palette,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const GimpRGB *color)
|
const GimpRGB *color)
|
||||||
{
|
{
|
||||||
GimpPaletteEntry *entry;
|
GimpPaletteEntry *entry;
|
||||||
|
|
||||||
@ -623,8 +623,8 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
|
|
||||||
entry = g_new0 (GimpPaletteEntry, 1);
|
entry = g_new0 (GimpPaletteEntry, 1);
|
||||||
|
|
||||||
entry->color = *color;
|
entry->color = *color;
|
||||||
entry->name = g_strdup (name ? name : _("Untitled"));
|
entry->name = g_strdup (name ? name : _("Untitled"));
|
||||||
|
|
||||||
if (position < 0 || position >= palette->n_colors)
|
if (position < 0 || position >= palette->n_colors)
|
||||||
{
|
{
|
||||||
@ -643,8 +643,9 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
list;
|
list;
|
||||||
list = g_list_next (list))
|
list = g_list_next (list))
|
||||||
{
|
{
|
||||||
entry = (GimpPaletteEntry *) list->data;
|
GimpPaletteEntry *entry2 = list->data;
|
||||||
entry->position += 1;
|
|
||||||
|
entry2->position += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,10 +611,10 @@ gimp_palette_duplicate (GimpData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpPaletteEntry *
|
GimpPaletteEntry *
|
||||||
gimp_palette_add_entry (GimpPalette *palette,
|
gimp_palette_add_entry (GimpPalette *palette,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const GimpRGB *color)
|
const GimpRGB *color)
|
||||||
{
|
{
|
||||||
GimpPaletteEntry *entry;
|
GimpPaletteEntry *entry;
|
||||||
|
|
||||||
@ -623,8 +623,8 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
|
|
||||||
entry = g_new0 (GimpPaletteEntry, 1);
|
entry = g_new0 (GimpPaletteEntry, 1);
|
||||||
|
|
||||||
entry->color = *color;
|
entry->color = *color;
|
||||||
entry->name = g_strdup (name ? name : _("Untitled"));
|
entry->name = g_strdup (name ? name : _("Untitled"));
|
||||||
|
|
||||||
if (position < 0 || position >= palette->n_colors)
|
if (position < 0 || position >= palette->n_colors)
|
||||||
{
|
{
|
||||||
@ -643,8 +643,9 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
list;
|
list;
|
||||||
list = g_list_next (list))
|
list = g_list_next (list))
|
||||||
{
|
{
|
||||||
entry = (GimpPaletteEntry *) list->data;
|
GimpPaletteEntry *entry2 = list->data;
|
||||||
entry->position += 1;
|
|
||||||
|
entry2->position += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,10 +611,10 @@ gimp_palette_duplicate (GimpData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GimpPaletteEntry *
|
GimpPaletteEntry *
|
||||||
gimp_palette_add_entry (GimpPalette *palette,
|
gimp_palette_add_entry (GimpPalette *palette,
|
||||||
gint position,
|
gint position,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
const GimpRGB *color)
|
const GimpRGB *color)
|
||||||
{
|
{
|
||||||
GimpPaletteEntry *entry;
|
GimpPaletteEntry *entry;
|
||||||
|
|
||||||
@ -623,8 +623,8 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
|
|
||||||
entry = g_new0 (GimpPaletteEntry, 1);
|
entry = g_new0 (GimpPaletteEntry, 1);
|
||||||
|
|
||||||
entry->color = *color;
|
entry->color = *color;
|
||||||
entry->name = g_strdup (name ? name : _("Untitled"));
|
entry->name = g_strdup (name ? name : _("Untitled"));
|
||||||
|
|
||||||
if (position < 0 || position >= palette->n_colors)
|
if (position < 0 || position >= palette->n_colors)
|
||||||
{
|
{
|
||||||
@ -643,8 +643,9 @@ gimp_palette_add_entry (GimpPalette *palette,
|
|||||||
list;
|
list;
|
||||||
list = g_list_next (list))
|
list = g_list_next (list))
|
||||||
{
|
{
|
||||||
entry = (GimpPaletteEntry *) list->data;
|
GimpPaletteEntry *entry2 = list->data;
|
||||||
entry->position += 1;
|
|
||||||
|
entry2->position += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,8 +493,11 @@ gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
|
|||||||
|
|
||||||
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
||||||
{
|
{
|
||||||
GimpData *data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (editor));
|
GimpPaletteEntry *entry;
|
||||||
gint index = -1;
|
GimpData *data;
|
||||||
|
gint index = -1;
|
||||||
|
|
||||||
|
data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (editor));
|
||||||
|
|
||||||
switch (pick_state)
|
switch (pick_state)
|
||||||
{
|
{
|
||||||
@ -502,8 +505,12 @@ gimp_palette_editor_pick_color (GimpPaletteEditor *editor,
|
|||||||
if (editor->color)
|
if (editor->color)
|
||||||
index = editor->color->position + 1;
|
index = editor->color->position + 1;
|
||||||
|
|
||||||
editor->color = gimp_palette_add_entry (GIMP_PALETTE (data), index,
|
entry = gimp_palette_add_entry (GIMP_PALETTE (data), index,
|
||||||
NULL, color);
|
NULL, color);
|
||||||
|
palette_editor_select_entry (editor, entry);
|
||||||
|
palette_editor_draw_entries (editor,
|
||||||
|
entry->position / editor->columns,
|
||||||
|
entry->position % editor->columns);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_COLOR_PICK_STATE_UPDATE:
|
case GIMP_COLOR_PICK_STATE_UPDATE:
|
||||||
@ -1088,9 +1095,14 @@ palette_editor_drop_color (GtkWidget *widget,
|
|||||||
|
|
||||||
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
||||||
{
|
{
|
||||||
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
||||||
|
GimpPaletteEntry *entry;
|
||||||
|
|
||||||
editor->color = gimp_palette_add_entry (palette, -1, NULL, color);
|
entry = gimp_palette_add_entry (palette, -1, NULL, color);
|
||||||
|
palette_editor_select_entry (editor, entry);
|
||||||
|
palette_editor_draw_entries (editor,
|
||||||
|
entry->position / editor->columns,
|
||||||
|
entry->position % editor->columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,11 +1117,12 @@ palette_editor_color_area_drop_color (GtkWidget *widget,
|
|||||||
|
|
||||||
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
if (GIMP_DATA_EDITOR (editor)->data_editable)
|
||||||
{
|
{
|
||||||
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
GimpPalette *palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
|
||||||
gint entry_width;
|
GimpPaletteEntry *entry;
|
||||||
gint entry_height;
|
gint entry_width;
|
||||||
gint row, col;
|
gint entry_height;
|
||||||
gint pos;
|
gint row, col;
|
||||||
|
gint pos;
|
||||||
|
|
||||||
/* calc drop pos */
|
/* calc drop pos */
|
||||||
entry_width = editor->col_width + SPACING;
|
entry_width = editor->col_width + SPACING;
|
||||||
@ -1119,7 +1132,11 @@ palette_editor_color_area_drop_color (GtkWidget *widget,
|
|||||||
pos = row * editor->columns + col;
|
pos = row * editor->columns + col;
|
||||||
|
|
||||||
/* adding at a negative or non-existing pos will automatically append */
|
/* adding at a negative or non-existing pos will automatically append */
|
||||||
editor->color = gimp_palette_add_entry (palette, pos, NULL, color);
|
entry = gimp_palette_add_entry (palette, pos, NULL, color);
|
||||||
|
palette_editor_select_entry (editor, entry);
|
||||||
|
palette_editor_draw_entries (editor,
|
||||||
|
entry->position / editor->columns,
|
||||||
|
entry->position % editor->columns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user