зеркало из https://github.com/mozilla/pjs.git
UIEvent button property is incorrect according to the DOM2 spec. Changing values to 0, 1, 2 (left, middle, right mouse buttons respectively) from 1, 2, 3. |event.which| continues to use the old values for backwards compatibility. This affects future xbl, js, and c++ event button checks so please see the newsgroups for more info (60703). r=timeless sr=jst
This commit is contained in:
Родитель
cac3d39705
Коммит
686e5a8010
|
@ -698,7 +698,8 @@ NS_METHOD nsDOMEvent::GetKeyCode(PRUint32* aKeyCode)
|
|||
NS_METHOD nsDOMEvent::GetButton(PRUint16* aButton)
|
||||
{
|
||||
if (!mEvent || mEvent->eventStructType != NS_MOUSE_EVENT) {
|
||||
*aButton = 0;
|
||||
NS_WARNING("Tried to get mouse button for null or non-mouse event!");
|
||||
*aButton = (PRUint16)-1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -707,19 +708,19 @@ NS_METHOD nsDOMEvent::GetButton(PRUint16* aButton)
|
|||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
case NS_MOUSE_LEFT_CLICK:
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
*aButton = 1;
|
||||
*aButton = 0;
|
||||
break;
|
||||
case NS_MOUSE_MIDDLE_BUTTON_UP:
|
||||
case NS_MOUSE_MIDDLE_BUTTON_DOWN:
|
||||
case NS_MOUSE_MIDDLE_CLICK:
|
||||
case NS_MOUSE_MIDDLE_DOUBLECLICK:
|
||||
*aButton = 2;
|
||||
*aButton = 1;
|
||||
break;
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_CLICK:
|
||||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
*aButton = 3;
|
||||
*aButton = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -860,7 +861,7 @@ NS_METHOD nsDOMEvent::GetWhich(PRUint32* aWhich)
|
|||
{
|
||||
PRUint16 button;
|
||||
(void) GetButton(&button);
|
||||
*aWhich = button;
|
||||
*aWhich = button + 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -331,7 +331,7 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
case eXULPopupType_popup:
|
||||
// Check for left mouse button down
|
||||
mouseEvent->GetButton(&button);
|
||||
if (button == 1) {
|
||||
if (button == 0) {
|
||||
// Time to launch a popup menu.
|
||||
LaunchPopup(aMouseEvent);
|
||||
aMouseEvent->PreventBubble();
|
||||
|
@ -341,7 +341,7 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
case eXULPopupType_context:
|
||||
// Check for right mouse button down
|
||||
mouseEvent->GetButton(&button);
|
||||
if (button == 3) {
|
||||
if (button == 2) {
|
||||
// Time to launch a context menu
|
||||
|
||||
// If the context menu launches on mousedown,
|
||||
|
|
|
@ -376,10 +376,10 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsCOMPtr<nsIEditor> editor (do_QueryInterface(mEditor));
|
||||
if (!editor) { return NS_OK; }
|
||||
|
||||
PRUint16 button = 0;
|
||||
PRUint16 button = (PRUint16)-1;
|
||||
mouseEvent->GetButton(&button);
|
||||
// middle-mouse click (paste);
|
||||
if (button == 2)
|
||||
if (button == 1)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefService, kPrefServiceCID, &rv);
|
||||
|
|
|
@ -193,7 +193,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
res = mouseEvent->GetCtrlKey(&isContextClick);
|
||||
#else
|
||||
// Right mouse button for Windows, UNIX
|
||||
isContextClick = buttonNumber == 3;
|
||||
isContextClick = buttonNumber == 2;
|
||||
res = mouseEvent->GetCtrlKey(&tableMode);
|
||||
#endif
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -253,7 +253,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
}
|
||||
}
|
||||
|
||||
if (isContextClick || (buttonNumber == 1 && clickCount == 2))
|
||||
if (isContextClick || (buttonNumber == 0 && clickCount == 2))
|
||||
{
|
||||
// Context menu or double click
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(target);
|
||||
|
@ -281,7 +281,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
mEditorShell->SelectElement(element);
|
||||
}
|
||||
}
|
||||
else if (buttonNumber == 1)
|
||||
else if (buttonNumber == 0)
|
||||
{
|
||||
if (tableMode && clickCount == 2)
|
||||
{
|
||||
|
|
|
@ -193,7 +193,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
res = mouseEvent->GetCtrlKey(&isContextClick);
|
||||
#else
|
||||
// Right mouse button for Windows, UNIX
|
||||
isContextClick = buttonNumber == 3;
|
||||
isContextClick = buttonNumber == 2;
|
||||
res = mouseEvent->GetCtrlKey(&tableMode);
|
||||
#endif
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -253,7 +253,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
}
|
||||
}
|
||||
|
||||
if (isContextClick || (buttonNumber == 1 && clickCount == 2))
|
||||
if (isContextClick || (buttonNumber == 0 && clickCount == 2))
|
||||
{
|
||||
// Context menu or double click
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(target);
|
||||
|
@ -281,7 +281,7 @@ nsEditorShellMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
mEditorShell->SelectElement(element);
|
||||
}
|
||||
}
|
||||
else if (buttonNumber == 1)
|
||||
else if (buttonNumber == 0)
|
||||
{
|
||||
if (tableMode && clickCount == 2)
|
||||
{
|
||||
|
|
|
@ -376,10 +376,10 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
nsCOMPtr<nsIEditor> editor (do_QueryInterface(mEditor));
|
||||
if (!editor) { return NS_OK; }
|
||||
|
||||
PRUint16 button = 0;
|
||||
PRUint16 button = (PRUint16)-1;
|
||||
mouseEvent->GetButton(&button);
|
||||
// middle-mouse click (paste);
|
||||
if (button == 2)
|
||||
if (button == 1)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefService, kPrefServiceCID, &rv);
|
||||
|
|
|
@ -515,7 +515,7 @@ function moveMouse(event){
|
|||
|
||||
function downMouse(event){
|
||||
dump(event.target.parentNode.id+"\n");
|
||||
if (event.button == 1){
|
||||
if (event.button == 0){
|
||||
if (currentTool != "poly"){
|
||||
startX = event.clientX+window.frames[0].pageXOffset;
|
||||
startY = event.clientY+window.frames[0].pageYOffset;
|
||||
|
@ -630,7 +630,7 @@ function downMouse(event){
|
|||
}
|
||||
|
||||
function clickMouse(event){
|
||||
if (event.button == 1){
|
||||
if (event.button == 0){
|
||||
dump("body clicked\n");
|
||||
//alert(frameDoc.+'\n');
|
||||
startX = event.clientX+window.frames[0].pageXOffset;
|
||||
|
|
|
@ -988,7 +988,7 @@ ChromeListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
nsresult res = mouseEvent->GetButton(&buttonNumber);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
if (buttonNumber != 3) // 3 is the magic number
|
||||
if (buttonNumber != 2) // 2 is the magic number
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> targetNode;
|
||||
|
|
|
@ -151,8 +151,8 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="mousedown"><![CDATA[
|
||||
if (this.parentItem.getAttribute("selected") == "true" && event.button == 1)
|
||||
<handler event="mousedown" button="0"><![CDATA[
|
||||
if (this.parentItem.getAttribute("selected") == "true")
|
||||
this.startEdit();
|
||||
]]></handler>
|
||||
</handlers>
|
||||
|
|
|
@ -64,7 +64,7 @@ function lbox_chandler (e)
|
|||
|
||||
/* Check for the button number first */
|
||||
/* FIXME: are there constants for this stuff? */
|
||||
if (e.event.which == 3)
|
||||
if (e.event.button == 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -575,13 +575,13 @@ mozXMLTermMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint16 buttonCode = 0;
|
||||
PRUint16 buttonCode = (PRUint16)-1;
|
||||
mouseEvent->GetButton(&buttonCode);
|
||||
|
||||
XMLT_LOG(mozXMLTermMouseListener::MouseDown,50,("buttonCode=%d\n",
|
||||
buttonCode));
|
||||
|
||||
if (buttonCode == 2) {
|
||||
if (buttonCode == 1) {
|
||||
// Middle-mouse button pressed; initiate paste
|
||||
mXMLTerminal->Paste();
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ mozXMLTermMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRUint16 buttonCode = 0;
|
||||
PRUint16 buttonCode = (PRUint16)-1;
|
||||
mouseEvent->GetButton(&buttonCode);
|
||||
|
||||
PRInt32 screenX, screenY;
|
||||
|
|
|
@ -838,13 +838,13 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
PRUint16 button = 0;
|
||||
mouseEvent->GetButton(&button);
|
||||
if((mMiddlePref && button != 1 && button != 2) ||
|
||||
(!mMiddlePref && button != 1))
|
||||
if((mMiddlePref && button != 0 && button != 1) ||
|
||||
(!mMiddlePref && button != 0))
|
||||
return NS_OK;
|
||||
|
||||
// If middle button, first place the middle of the slider thumb
|
||||
// under the click
|
||||
if (button == 2) {
|
||||
if (button == 1) {
|
||||
|
||||
nscoord pos;
|
||||
nscoord pospx;
|
||||
|
|
|
@ -813,7 +813,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
mouseEvent->GetButton(&button);
|
||||
|
||||
// only if left button
|
||||
if (button != 1)
|
||||
if (button != 0)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
|
|
|
@ -273,7 +273,7 @@ function HandleKeyEvent( aEvent )
|
|||
|
||||
function HandleClickEvent( aEvent )
|
||||
{
|
||||
if( aEvent.detail == 2 && aEvent.which == 1 ) {
|
||||
if( aEvent.detail == 2 && aEvent.button == 0 ) {
|
||||
if( aEvent.target.nodeName.toLowerCase() == "treecell" &&
|
||||
aEvent.target.parentNode.parentNode.nodeName.toLowerCase() != "treehead" )
|
||||
return onStart();
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<handler event="click">
|
||||
<![CDATA[
|
||||
if (event.originalTarget.getAttribute("emattr") == "field")
|
||||
if (event.button == 1) this.doFocus();
|
||||
if (event.button == 0) this.doFocus();
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="blur">
|
||||
|
|
|
@ -153,7 +153,7 @@ Contributor(s): ______________________________________. -->
|
|||
<image id="page-proxy-button" ondraggesture="nsDragAndDrop.startDrag(event, proxyIconDNDObserver);"/>
|
||||
<textfield autocomplete="true" timeout="300" class="plain"
|
||||
searchSessionType="urlbar" id="urlbar" tooltip="aTooltip" tooltiptext="&locationBar.tooltip;"
|
||||
onclick="if (event.button==1) URLBarLeftClickHandler(event);"
|
||||
onclick="if (event.button == 0) URLBarLeftClickHandler(event);"
|
||||
onblur="URLBarBlurHandler(event);"
|
||||
onkeypress="if( event.keyCode == 13 ) { addToUrlbarHistory(); BrowserLoadURL(); }" flex="1"/>
|
||||
</box>
|
||||
|
|
|
@ -111,8 +111,8 @@
|
|||
break;
|
||||
case "input":
|
||||
if ((event.target.type.toLowerCase() == "text" || event.target.type == "") // text field
|
||||
&& event.detail == "2" // double click
|
||||
&& event.button == "1" // left mouse button
|
||||
&& event.detail == 2 // double click
|
||||
&& event.button == 0 // left mouse button
|
||||
&& event.target.value.length == 0) { // no text has been entered
|
||||
prefillTextField(target); // prefill the empty text field if possible
|
||||
}
|
||||
|
@ -138,7 +138,7 @@
|
|||
function handleLinkClick(event, href)
|
||||
{
|
||||
switch (event.button) {
|
||||
case 1: // if left button clicked
|
||||
case 0: // if left button clicked
|
||||
if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down
|
||||
openNewWindowWith(href); // open link in new window
|
||||
event.preventBubble();
|
||||
|
@ -151,7 +151,7 @@
|
|||
if (event.altKey) // if alt is down
|
||||
return true; // do nothing
|
||||
return false;
|
||||
case 2: // if middle button clicked
|
||||
case 1: // if middle button clicked
|
||||
if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) { // and the pref is on
|
||||
openNewWindowWith(href); // open link in new window
|
||||
event.preventBubble();
|
||||
|
|
|
@ -169,7 +169,7 @@ function doEnabling()
|
|||
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
if (event.button != 1 ||
|
||||
if (event.button != 0 ||
|
||||
event.detail != 2 ||
|
||||
node.nodeName != "treeitem" ||
|
||||
node.getAttribute("container") == "true") {
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stephen Lamm <slamm@netscape.com>
|
||||
* Robert John Churchill <rjc@netscape.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
Code for the Bookmarks Sidebar Panel
|
||||
*/
|
||||
|
||||
function clicked(event, target)
|
||||
{
|
||||
if ((event.button != 1) || (event.detail != 2) || (target.nodeName != "treeitem"))
|
||||
return false;
|
||||
|
||||
if (event.altKey)
|
||||
{
|
||||
// if altKey is down then just open the Bookmark Properties dialog
|
||||
BookmarkProperties();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target.getAttribute("container") == "true")
|
||||
return false;
|
||||
|
||||
sidebarOpenURL(event, target, document.getElementById('bookmarksTree').database);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function sidebarOpenURL(event, treeitem, root)
|
||||
{
|
||||
|
||||
if (treeitem.getAttribute("container") == "true")
|
||||
return false;
|
||||
|
||||
if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
|
||||
return false;
|
||||
|
||||
var id = treeitem.getAttribute("id");
|
||||
if (!id)
|
||||
return false;
|
||||
|
||||
// rjc: add support for anonymous resources; if the node has
|
||||
// a "#URL" property, use it, otherwise default to using the id
|
||||
try
|
||||
{
|
||||
|
||||
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
|
||||
if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
if (rdf && root)
|
||||
{
|
||||
var src = rdf.GetResource(id, true);
|
||||
var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
|
||||
var target = root.GetTarget(src, prop, true);
|
||||
if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
|
||||
if (target) target = target.Value;
|
||||
if (target) id = target;
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
}
|
||||
// Ignore "NC:" urls.
|
||||
if (id.substring(0, 3) == "NC:")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (event.metaKey)
|
||||
{
|
||||
// if metaKey is down, open in a new browser window
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", id );
|
||||
}
|
||||
else
|
||||
{
|
||||
openTopWin(id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -572,7 +572,7 @@ function getAbsoluteID(root, node)
|
|||
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.detail != 2)
|
||||
if ((event.button != 0) || (event.detail != 2)
|
||||
|| (node.nodeName != "treeitem"))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ BookmarksTree.prototype = {
|
|||
isValidOpenEvent: function (aEvent)
|
||||
{
|
||||
return !(aEvent.type == "click" &&
|
||||
(aEvent.button != 1 || aEvent.detail != this.openClickCount))
|
||||
(aEvent.button != 0 || aEvent.detail != this.openClickCount))
|
||||
},
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -397,7 +397,7 @@ BookmarksTree.prototype = {
|
|||
// editable cells.
|
||||
treeClicked: function (aEvent)
|
||||
{
|
||||
if (this.tree.selectedItems.length > 1 || aEvent.detail > 1 || aEvent.button != 1)
|
||||
if (this.tree.selectedItems.length > 1 || aEvent.detail > 1 || aEvent.button != 0)
|
||||
return;
|
||||
if (gSelectionTracker.currentItem == this.tree.currentItem &&
|
||||
gSelectionTracker.currentCell == aEvent.target)
|
||||
|
@ -441,8 +441,12 @@ BookmarksTree.prototype = {
|
|||
else if (aEvent.keyCode == 113)
|
||||
goDoCommand("cmd_rename");
|
||||
else if (aEvent.keyCode == 13 &&
|
||||
this.tree.currentItem.firstChild.getAttribute("inline-edit") != "true")
|
||||
goDoCommand("cmd_open");
|
||||
this.tree.currentItem.firstChild.getAttribute("inline-edit") != "true") {
|
||||
if (aEvent.altKey)
|
||||
goDoCommand("cmd_properties");
|
||||
else
|
||||
goDoCommand("cmd_open");
|
||||
}
|
||||
},
|
||||
|
||||
selectFolderItem: function (aFolderURI, aItemURI, aAdditiveFlag)
|
||||
|
|
|
@ -226,7 +226,7 @@ function DoUnload()
|
|||
function OnClick(event, node)
|
||||
{
|
||||
if( event.type == "click" &&
|
||||
( event.button != 1 || event.detail != 2 || node.nodeName != "treeitem") )
|
||||
( event.button != 0 || event.detail != 2 || node.nodeName != "treeitem") )
|
||||
return(false);
|
||||
if( event.type == "keypress" && event.keyCode != 13 )
|
||||
return(false);
|
||||
|
|
|
@ -183,7 +183,7 @@ var historyDNDObserver = {
|
|||
|
||||
function OpenURL(event, node, root)
|
||||
{
|
||||
if ((event.button != 1) || (event.detail != 2)
|
||||
if ((event.button != 0) || (event.detail != 2)
|
||||
|| (node.nodeName != "treeitem"))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ function treeSelect(event)
|
|||
|
||||
function treeClick(event)
|
||||
{
|
||||
if (event.detail == 2 && event.which == 1)
|
||||
if (event.detail == 2 && event.button == 0)
|
||||
searchResultsOpenURL(event);
|
||||
else
|
||||
treeSelect(event);
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
resource2="http://home.netscape.com/NC-rdf#Name"
|
||||
sortDirection="ascending" sortActive="true"
|
||||
flex="1" datasources="rdf:internetsearch"
|
||||
onclick="if (event.button == 1 && event.target.localName == 'treecell')
|
||||
onclick="if (event.button == 0 && event.target.localName == 'treecell')
|
||||
sidebarOpenURL(event.target.parentNode.parentNode);"
|
||||
style="-moz-user-focus:ignore !important;">
|
||||
|
||||
|
|
|
@ -52,33 +52,31 @@
|
|||
|
||||
<!-- On a click (up+down on the same item), deselect everything
|
||||
except this item. -->
|
||||
<handler event="click">
|
||||
<![CDATA[
|
||||
// XXX Check for cycler.
|
||||
if (event.button != 1) return;
|
||||
var row = {};
|
||||
var col = {};
|
||||
var b = this.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col);
|
||||
var augment = event.ctrlKey || event.metaKey;
|
||||
if (event.shiftKey) {
|
||||
b.selection.rangedSelect(-1, row.value, augment);
|
||||
b.currentIndex = row.value;
|
||||
}
|
||||
else if (augment) {
|
||||
b.selection.toggleSelect(row.value);
|
||||
b.selection.currentIndex = row.value;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
// XXX Check for cycler.
|
||||
var row = {};
|
||||
var col = {};
|
||||
var b = this.parentNode.outlinerBoxObject;
|
||||
b.getCellAt(event.clientX, event.clientY, row, col);
|
||||
var augment = event.ctrlKey || event.metaKey;
|
||||
if (event.shiftKey) {
|
||||
b.selection.rangedSelect(-1, row.value, augment);
|
||||
b.currentIndex = row.value;
|
||||
}
|
||||
else if (augment) {
|
||||
b.selection.toggleSelect(row.value);
|
||||
b.selection.currentIndex = row.value;
|
||||
}
|
||||
else {
|
||||
/* We want to deselect all the selected items except what was
|
||||
clicked, UNLESS it was a right-click. We have to do this
|
||||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
|
||||
if (event.button == 1)
|
||||
b.selection.select(row.value);
|
||||
}
|
||||
]]>
|
||||
b.selection.select(row.value);
|
||||
}
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<!-- double-click -->
|
||||
|
|
|
@ -129,14 +129,14 @@
|
|||
</method>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click" button="1">
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
if (event.target.localName == "radio" && !event.target.disabled)
|
||||
this.selectedItem = event.target;
|
||||
|
||||
]]>
|
||||
</handler>
|
||||
<handler event="mousedown" button="1">
|
||||
<handler event="mousedown" button="0">
|
||||
<![CDATA[
|
||||
if (event.target.localName == "radio" && !event.target.disabled)
|
||||
this.focusedItem = event.target;
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
</property>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click" button="1">
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
var tabbox = this.parentNode;
|
||||
do {
|
||||
|
|
|
@ -536,9 +536,8 @@
|
|||
|
||||
<!-- On a click (up+down on the same item), deselect everything
|
||||
except this item. -->
|
||||
<handler event="click">
|
||||
<handler event="click" button="0">
|
||||
<![CDATA[
|
||||
if (event.button != 1) return;
|
||||
var t = event.originalTarget;
|
||||
if (t.localName == 'treecell') {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
|
@ -555,24 +554,22 @@
|
|||
in click rather than mousedown so that you can drag a
|
||||
selected group of items */
|
||||
|
||||
if (event.button == 1) {
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != t.parentNode.parentNode) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode.suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
var selectedItems = parentNode.selectedItems;
|
||||
var didSuppressSelect = false;
|
||||
var i = 0;
|
||||
while (i < selectedItems.length) {
|
||||
if (selectedItems[i] != t.parentNode.parentNode) {
|
||||
if (!didSuppressSelect) {
|
||||
parentNode.suppressOnSelect = true;
|
||||
didSuppressSelect = true;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
parentNode.removeItemFromSelection(selectedItems[i]);
|
||||
}
|
||||
if (didSuppressSelect)
|
||||
parentNode.suppressOnSelect = false;
|
||||
else
|
||||
i++;
|
||||
}
|
||||
if (didSuppressSelect)
|
||||
parentNode.suppressOnSelect = false;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
|
|
@ -156,7 +156,7 @@
|
|||
if (v == 'true') return true; return false;"/>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click" button="1" action="if (!this.disabled) this.checked = !this.checked;"/>
|
||||
<handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/>
|
||||
<handler event="keypress" key=" " action="if (!this.disabled) this.checked = !this.checked;"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
|
Загрузка…
Ссылка в новой задаче