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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,17 +493,24 @@ 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;
|
||||||
|
GimpData *data;
|
||||||
gint index = -1;
|
gint index = -1;
|
||||||
|
|
||||||
|
data = gimp_data_editor_get_data (GIMP_DATA_EDITOR (editor));
|
||||||
|
|
||||||
switch (pick_state)
|
switch (pick_state)
|
||||||
{
|
{
|
||||||
case GIMP_COLOR_PICK_STATE_NEW:
|
case GIMP_COLOR_PICK_STATE_NEW:
|
||||||
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:
|
||||||
@ -1089,8 +1096,13 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,6 +1118,7 @@ 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);
|
||||||
|
GimpPaletteEntry *entry;
|
||||||
gint entry_width;
|
gint entry_width;
|
||||||
gint entry_height;
|
gint entry_height;
|
||||||
gint row, col;
|
gint row, col;
|
||||||
@ -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