set correct focus_row after a remove_row call.

Wed Nov  4 02:02:07 1998  Lars Hamann  <lars@gtk.org>

	* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
	focus_row after a remove_row call.
This commit is contained in:
Lars Hamann 1998-11-04 01:28:07 +00:00 committed by Lars Hamann
parent b9a51f3530
commit 268dd6deb7
8 changed files with 55 additions and 25 deletions

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -1,3 +1,8 @@
Wed Nov 4 02:02:07 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkclist.c (real_remove_row) (sync_selection): set correct
focus_row after a remove_row call.
Sun Nov 1 21:00:06 GMT 1998 Austin Donnelly <austin@greenend.org.uk>
* gtk/gtkoptionmenu.c

View File

@ -2430,39 +2430,30 @@ real_remove_row (GtkCList *clist,
* list to reflect the deincrimented indexies of rows after the
* removal */
if (clist_row->state == GTK_STATE_SELECTED)
{
switch (clist->selection_mode)
{
case GTK_SELECTION_SINGLE:
case GTK_SELECTION_MULTIPLE:
case GTK_SELECTION_EXTENDED:
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
row, -1, NULL);
break;
case GTK_SELECTION_BROWSE:
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
row - 1, -1, NULL);
break;
default:
break;
}
}
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
row, -1, NULL);
/* reset the row end pointer if we're removing at the
* end of the list */
if (row == clist->rows - 1)
clist->row_list_end = list->prev;
if (row >= clist->focus_row && clist->focus_row >=0)
clist->focus_row--;
clist->row_list = g_list_remove (clist->row_list, clist_row);
clist->rows--;
clist->row_list = g_list_remove (clist->row_list, clist_row);
if (row == clist->rows)
clist->row_list_end = list->prev;
/*if (clist->focus_row >=0 &&
(row <= clist->focus_row || clist->focus_row >= clist->rows))
clist->focus_row--;*/
if (row < ROW_FROM_YPIXEL (clist, 0))
clist->voffset += clist->row_height + CELL_SPACING;
sync_selection (clist, row, SYNC_REMOVE);
if ((clist->selection_mode == GTK_SELECTION_BROWSE ||
clist->selection_mode == GTK_SELECTION_EXTENDED) && !clist->selection)
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
clist->focus_row, -1, NULL);
/* toast the row */
row_delete (clist, clist_row);
@ -3809,9 +3800,12 @@ sync_selection (GtkCList *clist,
if (clist->focus_row >= row)
{
clist->focus_row += d;
if (d > 0 || clist->focus_row > row)
clist->focus_row += d;
if (clist->focus_row == -1 && clist->rows >= 1)
clist->focus_row = 0;
else if (clist->focus_row >= clist->rows)
clist->focus_row = clist->rows - 1;
}
if (clist->selection_mode == GTK_SELECTION_BROWSE && clist->anchor != -1)
@ -3827,6 +3821,7 @@ sync_selection (GtkCList *clist,
clist->undo_anchor = clist->focus_row;
list = clist->selection;
while (list)
{
if (GPOINTER_TO_INT (list->data) >= row)