Bug 97434 (port to toolkit) Some Windows keyboard behaviours missing from trees r=mconnor

This commit is contained in:
cbiesinger%web.de 2004-10-03 16:31:15 +00:00
Родитель 6ac02e52ed
Коммит 2e3390880b
1 изменённых файлов: 55 добавлений и 97 удалений

Просмотреть файл

@ -259,7 +259,7 @@
<handler event="keypress" keycode="vk_return" action="this.changeOpenState(this.currentIndex);"/>
<handler event="keypress" keycode="vk_left">
<![CDATA[
if (!changeOpenState(this.currentIndex, false)) {
if (!this.changeOpenState(this.currentIndex, false)) {
var parentIndex = this.view.getParentIndex(this.currentIndex);
if (parentIndex >= 0) {
this.view.selection.select(parentIndex);
@ -284,27 +284,42 @@
}
]]>
</handler>
<handler event="keypress" keycode="vk_up">
<handler event="keypress" keycode="vk_up" modifiers="control any">
<![CDATA[
if (event.ctrlKey && this.view.selection.single) {
this.treeBoxObject.scrollByLines(-1);
return;
}
var c = this.currentIndex;
if (c == -1 || c == 0)
return;
this.view.selection.timedSelect(c-1, this._selectDelay);
if (!event.ctrlKey)
this.view.selection.timedSelect(c - 1, this._selectDelay);
else // Ctrl+Up moves the anchor without selecting
this.currentIndex = c - 1;
this.treeBoxObject.ensureRowIsVisible(c-1);
]]>
</handler>
<handler event="keypress" keycode="vk_down">
<handler event="keypress" keycode="vk_down" modifiers="control any">
<![CDATA[
if (event.ctrlKey && this.view.selection.single) {
this.treeBoxObject.scrollByLines(1);
return;
}
var c = this.currentIndex;
try {
if (c+1 == this.view.rowCount)
return;
} catch (e) {}
if (!event.ctrlKey)
this.view.selection.timedSelect(c+1, this._selectDelay);
else // Ctrl+Down moves the anchor without selecting
this.currentIndex = c + 1;
this.treeBoxObject.ensureRowIsVisible(c+1);
]]>
</handler>
<handler event="keypress" keycode="vk_up" modifiers="shift">
<handler event="keypress" keycode="vk_up" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
@ -312,11 +327,11 @@
if (c == -1 || c == 0)
return;
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, c - 1, false);
this.view.selection.rangedSelect(-1, c - 1, event.ctrlKey);
this.treeBoxObject.ensureRowIsVisible(c - 1);
]]>
</handler>
<handler event="keypress" keycode="vk_down" modifiers="shift">
<handler event="keypress" keycode="vk_down" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
@ -326,33 +341,13 @@
return;
} catch (e) {}
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, c + 1, false);
this.view.selection.rangedSelect(-1, c + 1, event.ctrlKey);
this.treeBoxObject.ensureRowIsVisible(c + 1);
]]>
</handler>
<handler event="keypress" keycode="vk_up" modifiers="control">
<handler event="keypress" keycode="vk_page_up" modifiers="control any">
<![CDATA[
var c = this.currentIndex;
if (c == -1 || c == 0)
return;
this.currentIndex = c-1;
this.treeBoxObject.ensureRowIsVisible(c-1);
]]>
</handler>
<handler event="keypress" keycode="vk_down" modifiers="control">
<![CDATA[
var c = this.currentIndex;
try {
if (c+1 == this.view.rowCount)
return;
} catch (e) {}
this.currentIndex = c+1;
this.treeBoxObject.ensureRowIsVisible(c+1);
]]>
</handler>
<handler event="keypress" keycode="vk_page_up">
<![CDATA[
if (! this.pageUpOrDownMovesSelection) {
if (this.pageUpOrDownMovesSelection == event.ctrlKey) {
this.treeBoxObject.scrollByPages(-1);
return;
}
@ -372,9 +367,9 @@
this.view.selection.timedSelect(i, this._selectDelay);
]]>
</handler>
<handler event="keypress" keycode="vk_page_down">
<handler event="keypress" keycode="vk_page_down" modifiers="control any">
<![CDATA[
if (! this.pageUpOrDownMovesSelection) {
if (this.pageUpOrDownMovesSelection == event.ctrlKey) {
this.treeBoxObject.scrollByPages(1);
return;
}
@ -396,7 +391,7 @@
this.view.selection.timedSelect(i, this._selectDelay);
]]>
</handler>
<handler event="keypress" keycode="vk_page_up" modifiers="shift">
<handler event="keypress" keycode="vk_page_up" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
@ -414,10 +409,10 @@
this.treeBoxObject.scrollByPages(-1);
}
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, i, false);
this.view.selection.rangedSelect(-1, i, event.ctrlKey);
]]>
</handler>
<handler event="keypress" keycode="vk_page_down" modifiers="shift">
<handler event="keypress" keycode="vk_page_down" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
@ -437,92 +432,55 @@
this.treeBoxObject.scrollByPages(1);
}
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, i, false);
this.view.selection.rangedSelect(-1, i, event.ctrlKey);
]]>
</handler>
<handler event="keypress" keycode="vk_page_up" modifiers="control">
<handler event="keypress" keycode="vk_home" modifiers="control any">
<![CDATA[
var c = this.currentIndex;
if (c == 0)
if (this.view.rowCount == 0)
return;
var f = this.treeBoxObject.getFirstVisibleRow();
var i = 0;
if (f > 0) {
var p = this.treeBoxObject.getPageLength();
if (f - p >= 0)
i = c - p;
else
i = c - f;
this.treeBoxObject.scrollByPages(-1);
}
this.currentIndex = i;
]]>
</handler>
<handler event="keypress" keycode="vk_page_down" modifiers="control">
<![CDATA[
var c = this.currentIndex;
var l = this.view.rowCount - 1;
if (c == l)
return;
var f = this.treeBoxObject.getFirstVisibleRow();
var p = this.treeBoxObject.getPageLength();
var i = l;
var lastTopRowIndex = l - p;
if (f <= lastTopRowIndex) {
if (f + p <= lastTopRowIndex)
i = c + p;
else
i = lastTopRowIndex + c - f + 1;
this.treeBoxObject.scrollByPages(1);
}
this.currentIndex = i;
]]>
</handler>
<handler event="keypress" keycode="vk_home">
<![CDATA[
// Normal behaviour is to select the first row
if (!event.ctrlKey)
this.view.selection.timedSelect(0, this._selectDelay);
this.treeBoxObject.ensureRowIsVisible(0);
]]>
</handler>
<handler event="keypress" keycode="vk_end">
<![CDATA[
var l = this.view.rowCount - 1;
this.view.selection.timedSelect(l, this._selectDelay);
this.treeBoxObject.ensureRowIsVisible(l);
]]>
</handler>
<handler event="keypress" keycode="vk_home" modifiers="shift">
<![CDATA[
if (this.view.selection.single)
return;
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, 0, false);
this.treeBoxObject.ensureRowIsVisible(0);
]]>
</handler>
<handler event="keypress" keycode="vk_end" modifiers="shift">
<![CDATA[
if (this.view.selection.single)
return;
var l = this.view.rowCount - 1;
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, l, false);
this.treeBoxObject.ensureRowIsVisible(l);
]]>
</handler>
<handler event="keypress" keycode="vk_home" modifiers="control">
<![CDATA[
// In a multiselect tree Ctrl+Home moves the anchor
else if (!this.view.selection.single)
this.currentIndex = 0;
this.treeBoxObject.ensureRowIsVisible(0);
]]>
</handler>
<handler event="keypress" keycode="vk_end" modifiers="control">
<handler event="keypress" keycode="vk_end" modifiers="control any">
<![CDATA[
var l = this.view.rowCount - 1;
if (l < 0)
return;
// Normal behaviour is to select the last row
if (!event.ctrlKey)
this.view.selection.timedSelect(l, this._selectDelay);
// In a multiselect tree Ctrl+End moves the anchor
else if (!this.view.selection.single)
this.currentIndex = l;
this.treeBoxObject.ensureRowIsVisible(l);
]]>
</handler>
<handler event="keypress" keycode="vk_home" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, 0, event.ctrlKey);
this.treeBoxObject.ensureRowIsVisible(0);
]]>
</handler>
<handler event="keypress" keycode="vk_end" modifiers="control any, shift">
<![CDATA[
if (this.view.selection.single)
return;
var l = this.view.rowCount - 1;
// Extend the selection from the existing pivot, if any
this.view.selection.rangedSelect(-1, l, event.ctrlKey);
this.treeBoxObject.ensureRowIsVisible(l);
]]>
</handler>
<handler event="keypress">
<![CDATA[
var c = this.currentIndex;