diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-06-21 03:41:04 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-06-21 03:41:04 +0000 |
commit | 569bded2e2a331101eceabec804bb7a4420b8d94 (patch) | |
tree | 387fc8eaf09ea2ef7d568b5a72cff5c1f2e18030 /gtk/gtkiconview.c | |
parent | 9e6b81d8f131f153a4ec4b78149338d1c189b877 (diff) | |
download | gtk+-569bded2e2a331101eceabec804bb7a4420b8d94.tar.gz |
Let ctrl key combinations move the focus without influencing the
Sun Jun 20 23:39:51 2004 Matthias Clasen <maclas@gmx.de>
* libegg/iconlist/eggiconlist.c: Let ctrl key combinations
move the focus without influencing the selection.
Diffstat (limited to 'gtk/gtkiconview.c')
-rw-r--r-- | gtk/gtkiconview.c | 88 |
1 files changed, 59 insertions, 29 deletions
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 0febde87bc..6e650a053b 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -928,16 +928,17 @@ egg_icon_list_button_press (GtkWidget *widget, if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (icon_list->priv->selection_mode == GTK_SELECTION_NONE) - return TRUE; - item = egg_icon_list_get_item_at_pos (icon_list, event->x, event->y); if (item != NULL) { - if (icon_list->priv->selection_mode == GTK_SELECTION_MULTIPLE && - (event->state & GDK_SHIFT_MASK)) + if (icon_list->priv->selection_mode == GTK_SELECTION_NONE) + { + egg_icon_list_set_cursor_item (icon_list, item); + } + else if (icon_list->priv->selection_mode == GTK_SELECTION_MULTIPLE && + (event->state & GDK_SHIFT_MASK)) { egg_icon_list_unselect_all_internal (icon_list, FALSE); @@ -966,6 +967,7 @@ egg_icon_list_button_press (GtkWidget *widget, egg_icon_list_unselect_all_internal (icon_list, FALSE); item->selected = TRUE; + egg_icon_list_queue_draw_item (icon_list, item); dirty = TRUE; } } @@ -2898,16 +2900,23 @@ egg_icon_list_move_cursor_up_down (EggIconList *icon_list, if (!item) return; - if (!icon_list->priv->shift_pressed || + if (icon_list->priv->ctrl_pressed || + !icon_list->priv->shift_pressed || !icon_list->priv->anchor_item || icon_list->priv->selection_mode != GTK_SELECTION_MULTIPLE) icon_list->priv->anchor_item = item; - icon_list->priv->cursor_item = item; - egg_icon_list_unselect_all (icon_list); - egg_icon_list_select_all_between (icon_list, - icon_list->priv->anchor_item, - item, TRUE); + egg_icon_list_set_cursor_item (icon_list, item); + + if (!icon_list->priv->ctrl_pressed && + icon_list->priv->selection_mode != GTK_SELECTION_NONE) + { + egg_icon_list_unselect_all (icon_list); + egg_icon_list_select_all_between (icon_list, + icon_list->priv->anchor_item, + item, TRUE); + } + egg_icon_list_scroll_to_item (icon_list, item); } @@ -2939,16 +2948,23 @@ egg_icon_list_move_cursor_page_up_down (EggIconList *icon_list, if (!item) return; - if (!icon_list->priv->shift_pressed || + if (icon_list->priv->ctrl_pressed || + !icon_list->priv->shift_pressed || !icon_list->priv->anchor_item || icon_list->priv->selection_mode != GTK_SELECTION_MULTIPLE) icon_list->priv->anchor_item = item; - icon_list->priv->cursor_item = item; - egg_icon_list_unselect_all (icon_list); - egg_icon_list_select_all_between (icon_list, - icon_list->priv->anchor_item, - item, TRUE); + egg_icon_list_set_cursor_item (icon_list, item); + + if (!icon_list->priv->ctrl_pressed && + icon_list->priv->selection_mode != GTK_SELECTION_NONE) + { + egg_icon_list_unselect_all (icon_list); + egg_icon_list_select_all_between (icon_list, + icon_list->priv->anchor_item, + item, TRUE); + } + egg_icon_list_scroll_to_item (icon_list, item); } @@ -2980,16 +2996,23 @@ egg_icon_list_move_cursor_left_right (EggIconList *icon_list, if (!item) return; - if (!icon_list->priv->shift_pressed || + if (icon_list->priv->ctrl_pressed || + !icon_list->priv->shift_pressed || !icon_list->priv->anchor_item || icon_list->priv->selection_mode != GTK_SELECTION_MULTIPLE) icon_list->priv->anchor_item = item; - icon_list->priv->cursor_item = item; - egg_icon_list_unselect_all (icon_list); - egg_icon_list_select_all_between (icon_list, - icon_list->priv->anchor_item, - item, TRUE); + egg_icon_list_set_cursor_item (icon_list, item); + + if (!icon_list->priv->ctrl_pressed && + icon_list->priv->selection_mode != GTK_SELECTION_NONE) + { + egg_icon_list_unselect_all (icon_list); + egg_icon_list_select_all_between (icon_list, + icon_list->priv->anchor_item, + item, TRUE); + } + egg_icon_list_scroll_to_item (icon_list, item); } @@ -3013,16 +3036,23 @@ egg_icon_list_move_cursor_start_end (EggIconList *icon_list, if (!item) return; - if (!icon_list->priv->shift_pressed || + if (icon_list->priv->ctrl_pressed || + !icon_list->priv->shift_pressed || !icon_list->priv->anchor_item || icon_list->priv->selection_mode != GTK_SELECTION_MULTIPLE) icon_list->priv->anchor_item = item; - icon_list->priv->cursor_item = item; - egg_icon_list_unselect_all (icon_list); - egg_icon_list_select_all_between (icon_list, - icon_list->priv->anchor_item, - item, TRUE); + egg_icon_list_set_cursor_item (icon_list, item); + + if (!icon_list->priv->ctrl_pressed && + icon_list->priv->selection_mode != GTK_SELECTION_NONE) + { + egg_icon_list_unselect_all (icon_list); + egg_icon_list_select_all_between (icon_list, + icon_list->priv->anchor_item, + item, TRUE); + } + egg_icon_list_scroll_to_item (icon_list, item); } |