in case of GTK_SELECTION_BROWSE select first inserted row.

Tue Feb  2 00:28:44 1999  Lars Hamann  <lars@gtk.org>

	* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
	GTK_SELECTION_BROWSE select first inserted row.
	(resync_selection): select rows in correct order.

	* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
 	select first inserted row.
	(resync_selection): select rows in correct order.

	* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
This commit is contained in:
Lars Hamann 1999-02-02 01:57:11 +00:00 committed by Lars Hamann
parent fb00e9bbb8
commit a19e373baa
10 changed files with 247 additions and 53 deletions

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -1,3 +1,15 @@
Tue Feb 2 00:28:44 1999 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_insert_node): in case of
GTK_SELECTION_BROWSE select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtkclist.c (real_insert_row): in case of GTK_SELECTION_BROWSE
select first inserted row.
(resync_selection): select rows in correct order.
* gtk/gtklist.c (gtk_list_end_selection): select rows in correct order.
Mon Feb 1 16:47:55 1999 Owen Taylor <otaylor@redhat.com>
* gtk.m4: Pass gthread on to gtk-config.

View File

@ -2782,8 +2782,8 @@ real_insert_row (GtkCList *clist,
clist_row))->next;
else
clist->row_list = g_list_insert (clist->row_list, clist_row, row);
}
clist->rows++;
if (row < ROW_FROM_YPIXEL (clist, 0))
@ -2792,6 +2792,13 @@ real_insert_row (GtkCList *clist,
/* syncronize the selection list */
sync_selection (clist, row, SYNC_INSERT);
if (clist->rows == 1)
{
clist->focus_row = 0;
if (clist->selection_mode == GTK_SELECTION_BROWSE)
gtk_clist_select_row (clist, 0, -1);
}
/* redraw the list if it isn't frozen */
if (CLIST_UNFROZEN (clist))
{
@ -3989,29 +3996,65 @@ resync_selection (GtkCList *clist,
}
}
for (list = g_list_nth (clist->row_list, i); i <= e; i++, list = list->next)
if (GTK_CLIST_ROW (list)->selectable)
{
if (g_list_find (clist->selection, GINT_TO_POINTER(i)))
if (clist->anchor < clist->drag_pos)
{
for (list = g_list_nth (clist->row_list, i); i <= e;
i++, list = list->next)
if (GTK_CLIST_ROW (list)->selectable)
{
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
if (g_list_find (clist->selection, GINT_TO_POINTER(i)))
{
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[UNSELECT_ROW], i, -1, event);
clist->undo_selection = g_list_prepend (clist->undo_selection,
GINT_TO_POINTER (i));
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
{
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[UNSELECT_ROW],
i, -1, event);
clist->undo_selection =
g_list_prepend (clist->undo_selection,
GINT_TO_POINTER (i));
}
}
else if (GTK_CLIST_ROW (list)->state == GTK_STATE_SELECTED)
{
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
clist->undo_unselection =
g_list_prepend (clist->undo_unselection,
GINT_TO_POINTER (i));
}
}
else if (GTK_CLIST_ROW (list)->state == GTK_STATE_SELECTED)
}
else
{
for (list = g_list_nth (clist->row_list, e); i <= e;
e--, list = list->prev)
if (GTK_CLIST_ROW (list)->selectable)
{
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
GINT_TO_POINTER (i));
if (g_list_find (clist->selection, GINT_TO_POINTER(e)))
{
if (GTK_CLIST_ROW (list)->state == GTK_STATE_NORMAL)
{
GTK_CLIST_ROW (list)->state = GTK_STATE_SELECTED;
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[UNSELECT_ROW],
e, -1, event);
clist->undo_selection =
g_list_prepend (clist->undo_selection,
GINT_TO_POINTER (e));
}
}
else if (GTK_CLIST_ROW (list)->state == GTK_STATE_SELECTED)
{
GTK_CLIST_ROW (list)->state = GTK_STATE_NORMAL;
clist->undo_unselection =
g_list_prepend (clist->undo_unselection,
GINT_TO_POINTER (e));
}
}
}
}
for (list = clist->undo_unselection; list; list = list->next)
for (list = g_list_reverse (clist->undo_unselection); list;
list = list->next)
gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
GPOINTER_TO_INT (list->data), -1, event);

View File

@ -3684,6 +3684,14 @@ gtk_ctree_insert_node (GtkCTree *ctree,
column_auto_resize (clist, &(new_row->row), i, 0);
}
if (clist->rows == 1)
{
clist->focus_row = 0;
if (clist->selection_mode == GTK_SELECTION_BROWSE)
gtk_ctree_select (ctree, node);
}
CLIST_REFRESH (clist);
return node;
@ -5664,30 +5672,57 @@ resync_selection (GtkCList *clist, GdkEvent *event)
}
}
for (node = GTK_CTREE_NODE (g_list_nth (clist->row_list, i)); i <= e;
i++, node = GTK_CTREE_NODE_NEXT (node))
if (GTK_CTREE_ROW (node)->row.selectable)
{
if (g_list_find (clist->selection, node))
if (clist->anchor < clist->drag_pos)
{
for (node = GTK_CTREE_NODE (g_list_nth (clist->row_list, i)); i <= e;
i++, node = GTK_CTREE_NODE_NEXT (node))
if (GTK_CTREE_ROW (node)->row.selectable)
{
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
if (g_list_find (clist->selection, node))
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
gtk_ctree_unselect (ctree, node);
clist->undo_selection = g_list_prepend (clist->undo_selection,
node);
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
gtk_ctree_unselect (ctree, node);
clist->undo_selection =
g_list_prepend (clist->undo_selection, node);
}
}
else if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_NORMAL;
clist->undo_unselection =
g_list_prepend (clist->undo_unselection, node);
}
}
else if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
}
else
{
for (node = GTK_CTREE_NODE (g_list_nth (clist->row_list, e)); i <= e;
e--, node = GTK_CTREE_NODE_PREV (node))
if (GTK_CTREE_ROW (node)->row.selectable)
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_NORMAL;
clist->undo_unselection = g_list_prepend (clist->undo_unselection,
node);
if (g_list_find (clist->selection, node))
{
if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_NORMAL)
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_SELECTED;
gtk_ctree_unselect (ctree, node);
clist->undo_selection =
g_list_prepend (clist->undo_selection, node);
}
}
else if (GTK_CTREE_ROW (node)->row.state == GTK_STATE_SELECTED)
{
GTK_CTREE_ROW (node)->row.state = GTK_STATE_NORMAL;
clist->undo_unselection =
g_list_prepend (clist->undo_unselection, node);
}
}
}
}
for (list = clist->undo_unselection; list; list = list->next)
for (list = g_list_reverse (clist->undo_unselection); list;
list = list->next)
gtk_ctree_select (ctree, list->data);
clist->anchor = -1;

View File

@ -1690,6 +1690,7 @@ gtk_list_end_selection (GtkList *list)
{
gint i;
gint e;
gboolean top_down;
GList *work;
GtkWidget *item;
gint item_index;
@ -1703,10 +1704,12 @@ gtk_list_end_selection (GtkList *list)
i = MIN (list->anchor, list->drag_pos);
e = MAX (list->anchor, list->drag_pos);
top_down = (list->anchor < list->drag_pos);
list->anchor = -1;
list->drag_pos = -1;
if (list->undo_selection)
{
work = list->selection;
@ -1728,30 +1731,59 @@ gtk_list_end_selection (GtkList *list)
}
}
for (work = g_list_nth (list->children, i); i <= e; i++, work = work->next)
if (top_down)
{
item = work->data;
if (g_list_find (list->selection, item))
{
if (item->state == GTK_STATE_NORMAL)
{
gtk_widget_set_state (item, GTK_STATE_SELECTED);
gtk_list_unselect_child (list, item);
list->undo_selection = g_list_prepend (list->undo_selection,
item);
}
}
else if (item->state == GTK_STATE_SELECTED)
for (work = g_list_nth (list->children, i); i <= e;
i++, work = work->next)
{
gtk_widget_set_state (item, GTK_STATE_NORMAL);
list->undo_unselection = g_list_prepend (list->undo_unselection,
item);
item = work->data;
if (g_list_find (list->selection, item))
{
if (item->state == GTK_STATE_NORMAL)
{
gtk_widget_set_state (item, GTK_STATE_SELECTED);
gtk_list_unselect_child (list, item);
list->undo_selection = g_list_prepend (list->undo_selection,
item);
}
}
else if (item->state == GTK_STATE_SELECTED)
{
gtk_widget_set_state (item, GTK_STATE_NORMAL);
list->undo_unselection = g_list_prepend (list->undo_unselection,
item);
}
}
}
else
{
for (work = g_list_nth (list->children, e); i <= e;
e--, work = work->prev)
{
item = work->data;
if (g_list_find (list->selection, item))
{
if (item->state == GTK_STATE_NORMAL)
{
gtk_widget_set_state (item, GTK_STATE_SELECTED);
gtk_list_unselect_child (list, item);
list->undo_selection = g_list_prepend (list->undo_selection,
item);
}
}
else if (item->state == GTK_STATE_SELECTED)
{
gtk_widget_set_state (item, GTK_STATE_NORMAL);
list->undo_unselection = g_list_prepend (list->undo_unselection,
item);
}
}
}
for (work = list->undo_unselection; work; work = work->next)
for (work = g_list_reverse (list->undo_unselection); work; work = work->next)
gtk_list_select_child (list, GTK_WIDGET (work->data));
}
void