Re-Fix Home/End. Make Ctrl-space create a keyboar focus if none exists

2003-03-26  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-icon-container.c (handle_icon_button_press):
	Re-Fix Home/End.
	Make Ctrl-space create a keyboar focus if none exists instead of activating
	the selection.

	* docs/Makefile.am:
	* docs/key_mouse_navigation.txt:
	Add some key/mouse docs for views.
This commit is contained in:
Alexander Larsson 2003-03-26 16:54:11 +00:00 committed by Alexander Larsson
parent 3740db883c
commit 0dbceb89b2
4 changed files with 193 additions and 23 deletions

View file

@ -1,3 +1,14 @@
2003-03-26 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c (handle_icon_button_press):
Re-Fix Home/End.
Make Ctrl-space create a keyboar focus if none exists instead of activating
the selection.
* docs/Makefile.am:
* docs/key_mouse_navigation.txt:
Add some key/mouse docs for views.
2003-03-26 Dave Camp <dave@ximian.com>
* src/file-manager/fm-list-view.c: (activate_selected_items),

View file

@ -10,4 +10,5 @@ EXTRA_DIST = \
smoketests.html \
state-machines.txt \
style-guide.html \
key_mouse_navigation.txt \
$(NULL)

View file

@ -0,0 +1,118 @@
This document describes the keyboard and mouse navigation model used
in the default Nautilus views in detail. This is useful as a a guide
for people implementing a Nautilus view or something else that wants
to have a feel that is compatible with Nautilus.
Icon view:
----------
Keyboard:
=========
When the focus is on the icon view you can move the currently selected
icon by using:
arrow keys - moves one step in the direction
tab - moves to the "next" icon in order (i.e. at the end of one row,
go to the first icon the next row)
shift-tab - moves to the "previous" icon in order
home - moves to the first icon
end - moves to the last icon
In order to allow multiple selection the above navigation keys can be
combined with the Control key to move the keyboard focus without
affecting the current selection.
To select an icon position the keyboard focus on it and press
ctlr-space. ctrl-space with no keyboard focus produces a keyboard
focus at the first selected icon, or the first one if none are selected.
In addition the following keyboard shortcuts are availible:
Return, Keypad Return - Activate the selected objects
Space (without control) - Activate the selected objects
Escape - Undo icon stretching
alt left - go back
alt right - go forward
alt up - go up a directory
alt down - enter directory / activate selection
Other key presses are used for typeahead search
In rename mode:
Escape - Cancel rename
Return, Keypad Return - Finish rename
TODO:
Add text about which icon is used for selection/keyboard focus when
there is none and e.g. arrow keys are pressed.
BUGS:
I can't seem to get the context menu using the keyboard
escape cancel rename doesn't seem to work
escape to undo stretch doesn't seem to work
Mouse:
======
In double click mode:
Clicking on an icon selects it and deselects all others on
BUTTON_PRESS. Dragging does the default dnd file operation.
Clicking on blank space deselect all selected icons. Doesn't allow
dragging.
Double clicking (both clicks on the same icon) with no modifiers
activates the clicked file. (And deselects the others due to the first
click.)
Clicking when Control (Shift can also be used, which is not written
out below) is held down can be used to do multiple selections.
Control-click on empty space does nothing.
Control-click on unselected icon selects it on BUTTON_PRESS
Control-click on selected icon de-selects it on BUTTON_RELEASE
Control-double click does nothing
Control can be held down while starting a drag
While doing a drag modifers affect the operation the drag causes:
Control - Copy the files
Shift - Move the files
Alt - Open a menu with the availible alternatives
All the basic clicks are typically done with the left button, but can
be done with the other buttons to. [Do we want this?] However some of
the buttons also have special operations:
Right-click on a selected icon opens the context menu for the selected
icons.
Right-click on empty space opens the context menu for the directory.
Middle-button drag always opens the menu with possible operations on
drop.
In single click mode:
[TODO: Add stuff here]
BUGS:
middle button opens context menu! WTH?

View file

@ -1884,16 +1884,34 @@ compare_icons_horizontal_first (NautilusIconContainer *container,
NautilusIcon *icon_a,
NautilusIcon *icon_b)
{
if (icon_a->x < icon_b->x) {
ArtDRect world_rect;
int ax, ay, bx, by;
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_a->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
&ax,
&ay);
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_b->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
&bx,
&by);
if (ax < bx) {
return -1;
}
if (icon_a->x > icon_b->x) {
if (ax > bx) {
return +1;
}
if (icon_a->y < icon_b->y) {
if (ay < by) {
return -1;
}
if (icon_a->y > icon_b->y) {
if (ay > by) {
return +1;
}
return compare_icons_by_uri (container, icon_a, icon_b);
@ -1904,16 +1922,34 @@ compare_icons_vertical_first (NautilusIconContainer *container,
NautilusIcon *icon_a,
NautilusIcon *icon_b)
{
if (icon_a->y < icon_b->y) {
ArtDRect world_rect;
int ax, ay, bx, by;
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_a->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
&ax,
&ay);
world_rect = nautilus_icon_canvas_item_get_icon_rectangle (icon_b->item);
eel_canvas_w2c
(EEL_CANVAS (container),
(world_rect.x0 + world_rect.x1) / 2,
world_rect.y1,
&bx,
&by);
if (ay < by) {
return -1;
}
if (icon_a->y > icon_b->y) {
if (ay > by) {
return +1;
}
if (icon_a->x < icon_b->x) {
if (ax < bx) {
return -1;
}
if (icon_a->x > icon_b->x) {
if (ax > bx) {
return +1;
}
return compare_icons_by_uri (container, icon_a, icon_b);
@ -1926,10 +1962,6 @@ leftmost_in_top_row (NautilusIconContainer *container,
NautilusIcon *candidate,
void *data)
{
if (container->details->auto_layout) {
return (container->details->icons->data == candidate);
}
if (best_so_far == NULL) {
return TRUE;
}
@ -1943,13 +1975,6 @@ rightmost_in_bottom_row (NautilusIconContainer *container,
NautilusIcon *candidate,
void *data)
{
GList *last;
if (container->details->auto_layout) {
last = g_list_last (container->details->icons);
return (last->data == candidate);
}
if (best_so_far == NULL) {
return TRUE;
}
@ -2389,11 +2414,26 @@ static void
keyboard_space (NautilusIconContainer *container,
GdkEventKey *event)
{
NautilusIcon *icon;
/* Control-space toggles the selection state of the current icon. */
if (container->details->keyboard_focus != NULL &&
(event->state & GDK_CONTROL_MASK) != 0) {
icon_toggle_selected (container, container->details->keyboard_focus);
g_signal_emit (container, signals[SELECTION_CHANGED], 0);
if ((event->state & GDK_CONTROL_MASK) != 0) {
if (container->details->keyboard_focus != NULL) {
icon_toggle_selected (container, container->details->keyboard_focus);
g_signal_emit (container, signals[SELECTION_CHANGED], 0);
} else {
icon = find_best_selected_icon (container,
NULL,
leftmost_in_top_row,
NULL);
if (icon == NULL) {
icon = find_best_icon (container,
NULL,
leftmost_in_top_row,
NULL);
}
set_keyboard_focus (container, icon);
}
} else {
activate_selected_items (container);
}