зеркало из https://github.com/mozilla/pjs.git
11818: Rename the special XUL key from "command" to "xulkey" so it won't
confuse people into thinking it has something to do with the Mac command key. This means changing all the XUL keybinding files from command= to xulkey=. r=brade.
This commit is contained in:
Родитель
cc0ae3387f
Коммит
63a098fcc6
|
@ -30,45 +30,47 @@
|
|||
<html:script language="JavaScript" src="chrome://editor/content/editorOverlay.js"/>
|
||||
|
||||
<keyset id="defaultKeySet">
|
||||
|
||||
<!-- defined in globalOverlay -->
|
||||
<key id="key_newNavigator"/>
|
||||
<key id="key_newMessage"/>
|
||||
<key id="key_newBlankPage"/>
|
||||
|
||||
<key id="openeditorkb" disabled="false" command="true" key="o" observes="Editor:Open" />
|
||||
<key id="savekb" disabled="false" command="true" key="s" observes="Editor:Save"/>
|
||||
<key id="closekb" disabled="false" command="true" key="w" observes="Editor:Close" />
|
||||
<key id="printkb" disabled="false" command="true" key="p" observes="Editor:Print" />
|
||||
<key id="exitkb" disabled="false" command="true" key="q" observes="Editor:Exit" />
|
||||
<key id="openeditorkb" disabled="false" xulkey="true" key="o" observes="Editor:Open" />
|
||||
<key id="savekb" disabled="false" xulkey="true" key="s" observes="Editor:Save"/>
|
||||
<key id="closekb" disabled="false" xulkey="true" key="w" observes="Editor:Close" />
|
||||
<key id="printkb" disabled="false" xulkey="true" key="p" observes="Editor:Print" />
|
||||
<key id="exitkb" disabled="false" xulkey="true" key="q" observes="Editor:Exit" />
|
||||
|
||||
<key id="undokb" disabled="false" command="true" key="z" observes="Editor:Undo" />
|
||||
<key id="redokb" disabled="false" command="true" key="y" observes="Editor:Redo" />
|
||||
<key id="cutkb" disabled="false" command="true" key="x" observes="Editor:Cut" />
|
||||
<key id="copykb" disabled="false" command="true" key="c" observes="Editor:Copy" />
|
||||
<key id="pastekb" disabled="false" command="true" key="v" observes="Editor:Paste" />
|
||||
<key id="pastequotationkb" disabled="false" command="true" alt="true" key="v" observes="Editor:PasteQuote" />
|
||||
<key id="selectallkb" disabled="false" command="true" key="a" observes="Editor:SelectAll" />
|
||||
<key id="findkb" disabled="false" command="true" key="f" observes="Editor:Find" />
|
||||
<key id="findnextkb" disabled="false" command="true" key="g" observes="Editor:FindNext" />
|
||||
<key id="checkspellingkb" disabled="false" command="true" key="k" observes="Editor:CheckSpelling" />
|
||||
<key id="undokb" disabled="false" xulkey="true" key="z" observes="Editor:Undo" />
|
||||
<key id="redokb" disabled="false" xulkey="true" key="y" observes="Editor:Redo" />
|
||||
<key id="cutkb" disabled="false" xulkey="true" key="x" observes="Editor:Cut" />
|
||||
<key id="copykb" disabled="false" xulkey="true" key="c" observes="Editor:Copy" />
|
||||
<key id="pastekb" disabled="false" xulkey="true" key="v" observes="Editor:Paste" />
|
||||
<key id="pastequotationkb" disabled="false" xulkey="true" alt="true" key="v" observes="Editor:PasteQuote" />
|
||||
<key id="selectallkb" disabled="false" xulkey="true" key="a" observes="Editor:SelectAll" />
|
||||
<key id="findkb" disabled="false" xulkey="true" key="f" observes="Editor:Find" />
|
||||
<key id="findnextkb" disabled="false" xulkey="true" key="g" observes="Editor:FindNext" />
|
||||
<key id="checkspellingkb" disabled="false" xulkey="true" key="k" observes="Editor:CheckSpelling" />
|
||||
|
||||
<key id="inserthtmlkb" disabled="false" command="true" alt="true" key="i" observes="Editor:InsertHTML"/>
|
||||
<key id="inserthtmlkb" disabled="false" xulkey="true" alt="true" key="i" observes="Editor:InsertHTML"/>
|
||||
|
||||
<key id="boldkb" disabled="false" command="true" key="b" observes="Editor:Bold"/>
|
||||
<key id="italickb" disabled="false" command="true" key="i" observes="Editor:Italic"/>
|
||||
<key id="boldkb" disabled="false" xulkey="true" key="b" observes="Editor:Bold"/>
|
||||
<key id="italickb" disabled="false" xulkey="true" key="i" observes="Editor:Italic"/>
|
||||
|
||||
|
||||
<key id="underlinekb" disabled="false" command="true" key="u" onkeypress="EditorToggleStyle('underline')"/>
|
||||
<key id="navigatorkb" disabled="false" command="true" key="1" onkeypress="Navigator()" />
|
||||
<key id="messengerkb" disabled="false" command="true" key="2" onkeypress="Messenger()" />
|
||||
<key id="composerkb" disabled="false" command="true" key="3" onkeypress="Composer()" />
|
||||
<key id="calendarkb" disabled="false" command="true" key="4" onkeypress="Calendar()" />
|
||||
<key id="indentkb" disabled="false" command="true" key="=" onkeypress="EditorIndent('indent')" />
|
||||
<key id="outdentkb" disabled="false" command="true" key="-" onkeypress="EditorIndent('outdent')" />
|
||||
<key id="underlinekb" disabled="false" xulkey="true" key="u" onkeypress="EditorToggleStyle('underline')"/>
|
||||
<key id="navigatorkb" disabled="false" xulkey="true" shift="true" key="n" onkeypress="Navigator()" />
|
||||
<key id="navvigatorkb" disabled="false" xulkey="true" key="1" onkeypress="Navigator()" />
|
||||
<key id="messengerkb" disabled="false" xulkey="true" key="2" onkeypress="Messenger()" />
|
||||
<key id="composerkb" disabled="false" xulkey="true" key="3" onkeypress="Composer()" />
|
||||
<key id="calendarkb" disabled="false" xulkey="true" key="4" onkeypress="Calendar()" />
|
||||
<key id="indentkb" disabled="false" xulkey="true" key="=" onkeypress="EditorIndent('indent')" />
|
||||
<key id="outdentkb" disabled="false" xulkey="true" key="-" onkeypress="EditorIndent('outdent')" />
|
||||
|
||||
<key id="removestyleskb" disabled="false" shift="true" command="true" key="k" onkeypress="EditorRemoveStyle('all')" />
|
||||
<key id="decreasefontsizekb" disabled="false" shift="true" command="true" key="[" onkeypress="DecreaseFontSize()" />
|
||||
<key id="increasefontsizekb" disabled="false" shift="true" command="true" key="]" onkeypress="IncreaseFontSize()" />
|
||||
<key id="removestyleskb" disabled="false" shift="true" xulkey="true" key="k" onkeypress="EditorRemoveStyle('all')" />
|
||||
<key id="decreasefontsizekb" disabled="false" shift="true" xulkey="true" key="[" onkeypress="DecreaseFontSize()" />
|
||||
<key id="increasefontsizekb" disabled="false" shift="true" xulkey="true" key="]" onkeypress="IncreaseFontSize()" />
|
||||
|
||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||
<!-- scroll document/page/line and move caret -->
|
||||
|
@ -76,19 +78,19 @@
|
|||
<key id="endkb" disabled="false" keycode="VK_END" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||
<key id="pageupkb" disabled="false" keycode="VK_PAGE_UP" onkeypress="EditorMoveUpPage( true, false )" />
|
||||
<key id="pagedownkb" disabled="false" keycode="VK_PAGE_DOWN" onkeypress="EditorMoveDownPage( true, false )" />
|
||||
<key id="beginoflinekb" disabled="false" keycode="VK_LEFT" command="true" onkeypress="EditorBeginningOfLine( false )" />
|
||||
<key id="endoflinekb" disabled="false" keycode="VK_RIGHT" command="true" onkeypress="EditorEndOfLine( false )" />
|
||||
<key id="uphomekb" disabled="false" keycode="VK_UP" command="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
||||
<key id="downendkb" disabled="false" keycode="VK_DOWN" command="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||
<key id="beginoflinekb" disabled="false" keycode="VK_LEFT" xulkey="true" onkeypress="EditorBeginningOfLine( false )" />
|
||||
<key id="endoflinekb" disabled="false" keycode="VK_RIGHT" xulkey="true" onkeypress="EditorEndOfLine( false )" />
|
||||
<key id="uphomekb" disabled="false" keycode="VK_UP" xulkey="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
||||
<key id="downendkb" disabled="false" keycode="VK_DOWN" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||
<!-- scroll document/page/line and extend selection -->
|
||||
<key id="homeextendkb" disabled="false" keycode="VK_HOME" shift="true" onkeypress="EditorMoveToTopOfWindow( true, true )" />
|
||||
<key id="endextendkb" disabled="false" keycode="VK_END" shift="true" onkeypress="EditorMoveToBottomOfWindow( true, true )" />
|
||||
<key id="pageupextendkb" disabled="false" keycode="VK_PAGE_UP" shift="true" onkeypress="EditorMoveUpPage( true, true )" />
|
||||
<key id="pagedownextendkb" disabled="false" keycode="VK_PAGE_DOWN" shift="true" onkeypress="EditorMoveDownPage( true, true )" />
|
||||
<key id="beginoflineextendkb" disabled="false" keycode="VK_LEFT" shift="true" command="true" onkeypress="EditorBeginningOfLine( false )" />
|
||||
<key id="endoflineextendkb" disabled="false" keycode="VK_RIGHT" shift="true" command="true" onkeypress="EditorEndOfLine( false )" />
|
||||
<key id="uphomeextendkb" disabled="false" keycode="VK_UP" shift="true" command="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
||||
<key id="downendextendkb" disabled="false" keycode="VK_DOWN" shift="true" command="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||
<key id="beginoflineextendkb" disabled="false" keycode="VK_LEFT" shift="true" xulkey="true" onkeypress="EditorBeginningOfLine( false )" />
|
||||
<key id="endoflineextendkb" disabled="false" keycode="VK_RIGHT" shift="true" xulkey="true" onkeypress="EditorEndOfLine( false )" />
|
||||
<key id="uphomeextendkb" disabled="false" keycode="VK_UP" shift="true" xulkey="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
||||
<key id="downendextendkb" disabled="false" keycode="VK_DOWN" shift="true" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||
<!-- move caret by one character -->
|
||||
<key id="leftkb" disabled="false" keycode="VK_LEFT" onkeypress="EditorPreviousCharacter( false )" />
|
||||
<key id="rightkb" disabled="false" keycode="VK_RIGHT" onkeypress="EditorNextCharacter( false )" />
|
||||
|
|
|
@ -51,14 +51,7 @@
|
|||
|
||||
<xul:broadcaster id="args" value=""/>
|
||||
|
||||
<xul:keyset id="defaultKeySet">
|
||||
|
||||
<xul:key id="removestyleskb" disabled="false" shift="true" command="true" alt="false" key="k" onkeypress="EditorRemoveStyle('all')" />
|
||||
<xul:key id="decreasefontsizekb" disabled="false" shift="true" command="true" alt="false" key="[" onkeypress="DecreaseFontSize()" />
|
||||
<xul:key id="increasefontsizekb" disabled="false" shift="true" command="true" alt="false" key="]" onkeypress="IncreaseFontSize()" />
|
||||
|
||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||
</xul:keyset>
|
||||
<xul:keyset id="defaultKeySet/>
|
||||
|
||||
<xul:broadcaster id="args" value="chrome://editor/content/EditorInitPage.html"/>
|
||||
<xul:broadcaster id="canPrint"/>
|
||||
|
|
|
@ -79,7 +79,7 @@ Rights Reserved.
|
|||
<!-- File Menu -->
|
||||
<key id="key_newNavigator"/>
|
||||
<key id="key_newMessage"/>
|
||||
<key id="key_PrintCard" command="true" key="&printCardViewCmd.key;" observes="cmd_PrintCard" />
|
||||
<key id="key_PrintCard" xulkey="true" key="&printCardViewCmd.key;" observes="cmd_PrintCard" />
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
|
|
|
@ -90,18 +90,18 @@ Rights Reserved.
|
|||
ACTUALLY, EVERY TIME YOU TYPE ANY OF THE KEY DEFINED HERE AFTER WITHOUT ANY OF THE MODIFIERS PRESSED, THE COMMAND IS EXECUTED.
|
||||
|
||||
<keyset id="defaultKeySet">
|
||||
<key id="acmdkey" disabled="false" shift="false" command="true" alt="false" key="a" onkeypress="EditorSelectAll()" />
|
||||
<key id="bcmdkey" disabled="false" shift="false" command="true" alt="false" key="b" onkeypress="EditorApplyStyle('b')"/>
|
||||
<key id="ccmdkey" disabled="false" shift="false" command="true" alt="false" key="c" onkeypress="EditorCopy()" />
|
||||
<key id="fcmdkey" disabled="false" shift="false" command="true" alt="false" key="f" onkeypress="EditorFind()" />
|
||||
<key id="gcmdkey" disabled="false" shift="false" command="true" alt="false" key="g" onkeypress="EditorFindNext()" />
|
||||
<key id="icmdkey" disabled="false" shift="false" command="true" alt="false" key="i" onkeypress="EditorApplyStyle('i')"/>
|
||||
<key id="kcmdkey" disabled="false" shift="false" command="true" alt="false" key="k" onkeypress="CheckSpelling()" />
|
||||
<key id="ucmdkey" disabled="false" shift="false" command="true" alt="false" key="u" onkeypress="EditorApplyStyle('u')"/>
|
||||
<key id="vcmdkey" disabled="false" shift="false" command="true" alt="false" key="v" onkeypress="EditorPaste()" />
|
||||
<key id="xcmdkey" disabled="false" shift="false" command="true" alt="false" key="x" onkeypress="EditorCut()" />
|
||||
<key id="ycmdkey" disabled="false" shift="false" command="true" alt="false" key="y" onkeypress="EditorRedo()" />
|
||||
<key id="zcmdkey" disabled="false" shift="false" command="true" alt="false" key="z" onkeypress="EditorUndo()" />
|
||||
<key id="acmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="a" onkeypress="EditorSelectAll()" />
|
||||
<key id="bcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="b" onkeypress="EditorApplyStyle('b')"/>
|
||||
<key id="ccmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="c" onkeypress="EditorCopy()" />
|
||||
<key id="fcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="f" onkeypress="EditorFind()" />
|
||||
<key id="gcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="g" onkeypress="EditorFindNext()" />
|
||||
<key id="icmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="i" onkeypress="EditorApplyStyle('i')"/>
|
||||
<key id="kcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="k" onkeypress="CheckSpelling()" />
|
||||
<key id="ucmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="u" onkeypress="EditorApplyStyle('u')"/>
|
||||
<key id="vcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="v" onkeypress="EditorPaste()" />
|
||||
<key id="xcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="x" onkeypress="EditorCut()" />
|
||||
<key id="ycmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="y" onkeypress="EditorRedo()" />
|
||||
<key id="zcmdkey" disabled="false" shift="false" xulkey="true" alt="false" key="z" onkeypress="EditorUndo()" />
|
||||
</keyset>
|
||||
|
||||
-->
|
||||
|
|
|
@ -106,6 +106,6 @@
|
|||
</box>
|
||||
|
||||
<keyset>
|
||||
<key id="fooKey" key="s" command="true" shift="true" onkeydown="foo()"/>
|
||||
<key id="fooKey" key="s" xulkey="true" shift="true" onkeydown="foo()"/>
|
||||
</keyset>
|
||||
</window>
|
||||
|
|
|
@ -226,6 +226,11 @@ private:
|
|||
|
||||
nsIDOMElement* element; // Weak reference. The element will go away first.
|
||||
nsIDOMDocument* mDOMDocument; // Weak reference.
|
||||
|
||||
// The "xul key" modifier can be any of the known modifiers:
|
||||
enum {
|
||||
xulKeyNone, xulKeyShift, xulKeyControl, xulKeyAlt, xulKeyMeta
|
||||
} mXULKeyModifier;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -279,8 +284,10 @@ nsXULKeyListenerImpl::Init(
|
|||
nsIDOMElement * aElement,
|
||||
nsIDOMDocument * aDocument)
|
||||
{
|
||||
printf("nsXULKeyListenerImpl::Init()\n");
|
||||
element = aElement; // Weak reference. Don't addref it.
|
||||
mDOMDocument = aDocument; // Weak reference.
|
||||
mXULKeyModifier = xulKeyControl;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -369,6 +376,28 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
|
|||
|
||||
nsCOMPtr<nsIDOMNode> keysetNode;
|
||||
rootNode->GetFirstChild(getter_AddRefs(keysetNode));
|
||||
|
||||
#undef DEBUG_XUL_KEYS
|
||||
#ifdef DEBUG_XUL_KEYS
|
||||
if (aEventType == eKeyPress)
|
||||
{
|
||||
PRUint32 charcode, keycode;
|
||||
keyEvent->GetCharCode(&charcode);
|
||||
keyEvent->GetKeyCode(&keycode);
|
||||
printf("DoKey [%s]: key code 0x%d, char code '%c', ",
|
||||
(aEventType == eKeyPress ? "KeyPress" : ""), keycode, charcode);
|
||||
PRBool ismod;
|
||||
keyEvent->GetShiftKey(&ismod);
|
||||
if (ismod) printf("[Shift] ");
|
||||
keyEvent->GetCtrlKey(&ismod);
|
||||
if (ismod) printf("[Ctrl] ");
|
||||
keyEvent->GetAltKey(&ismod);
|
||||
if (ismod) printf("[Alt] ");
|
||||
keyEvent->GetMetaKey(&ismod);
|
||||
if (ismod) printf("[Meta] ");
|
||||
printf("\n");
|
||||
}
|
||||
#endif /* DEBUG_XUL_KEYS */
|
||||
|
||||
while (keysetNode) {
|
||||
nsAutoString keysetNodeType;
|
||||
|
@ -384,6 +413,7 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
|
|||
oldkeysetNode->GetNextSibling(getter_AddRefs(keysetNode));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Given the DOM node and Key Event
|
||||
// Walk the node's children looking for 'key' types
|
||||
|
||||
|
@ -391,9 +421,9 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
|
|||
// Compares the received key code to found 'key' types
|
||||
// Executes command if found
|
||||
// Marks event as consumed
|
||||
nsCOMPtr<nsIDOMNode> keyNode;
|
||||
keysetNode->GetFirstChild(getter_AddRefs(keyNode));
|
||||
while (keyNode) {
|
||||
nsCOMPtr<nsIDOMNode> keyNode;
|
||||
keysetNode->GetFirstChild(getter_AddRefs(keyNode));
|
||||
while (keyNode) {
|
||||
nsCOMPtr<nsIDOMElement> keyElement(do_QueryInterface(keyNode));
|
||||
if (!keyElement) {
|
||||
continue;
|
||||
|
@ -402,7 +432,29 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
|
|||
nsAutoString property;
|
||||
keyElement->GetNodeName(property);
|
||||
//printf("keyNodeType [%s] \n", keyNodeType.ToNewCString()); // this leaks
|
||||
if (property.Equals("key")) {
|
||||
|
||||
// See if we're redefining the special XUL modifier key
|
||||
if (property.Equals("xulkey")) {
|
||||
keyElement->GetAttribute(nsAutoString("key"), property);
|
||||
if (property.Equals("shift"))
|
||||
mXULKeyModifier = xulKeyShift;
|
||||
else if (property.Equals("control"))
|
||||
mXULKeyModifier = xulKeyControl;
|
||||
else if (property.Equals("alt"))
|
||||
mXULKeyModifier = xulKeyAlt;
|
||||
else if (property.Equals("meta"))
|
||||
mXULKeyModifier = xulKeyMeta;
|
||||
else if (property.Equals("none"))
|
||||
mXULKeyModifier = xulKeyNone;
|
||||
#ifdef DEBUG_XUL_KEYS
|
||||
else printf("Property didn't match: %s\n",
|
||||
property.ToNewCString());
|
||||
char* propstr = property.ToNewCString();
|
||||
printf("Set xul key to %s(%d)\n", propstr, mXULKeyModifier);
|
||||
Recycle(propstr);
|
||||
#endif
|
||||
}
|
||||
if (property.Equals("key")) {
|
||||
//printf("onkeypress [%s] \n", cmdToExecute.ToNewCString()); // this leaks
|
||||
do {
|
||||
property = falseString;
|
||||
|
@ -464,93 +516,90 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
|
|||
if (!isMatching) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Make these tri-state --
|
||||
// true(1), false(0), and unspecified (3)
|
||||
int modCommand = 3;
|
||||
int modControl = 3;
|
||||
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("command"), property);
|
||||
if(property == trueString)
|
||||
modCommand = 1;
|
||||
else if(property == falseString)
|
||||
modCommand = 0;
|
||||
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("control"), property);
|
||||
if(property == trueString)
|
||||
modControl = 1;
|
||||
else if(property == falseString)
|
||||
modControl = 0;
|
||||
|
||||
// Test Command attribute
|
||||
PRBool isCommand = PR_FALSE;
|
||||
PRBool isControl = PR_FALSE;
|
||||
keyEvent->GetMetaKey(&isCommand);
|
||||
keyEvent->GetCtrlKey(&isControl);
|
||||
if (((isCommand && (modCommand==0)) ||
|
||||
(!isCommand && (modCommand==1))) ||
|
||||
((isControl && (modControl==0)) ||
|
||||
(!isControl && (modControl==1))))
|
||||
{
|
||||
#ifndef XP_MAC
|
||||
// Temp hack. we should remove this
|
||||
// after XUL can spec which key for keybinding
|
||||
if((isControl && (modCommand==0)) ||
|
||||
(!isControl && (modCommand==1)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
//printf("Passed command/ctrl test \n"); // this leaks
|
||||
|
||||
// Test Shift attribute
|
||||
int modShift = 3;
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("shift"), property);
|
||||
if(property == trueString)
|
||||
modShift = 1;
|
||||
else if(property == falseString)
|
||||
modShift = 0;
|
||||
|
||||
PRBool isShift = PR_FALSE;
|
||||
keyEvent->GetShiftKey(&isShift);
|
||||
if ((isShift && (modShift==0)) ||
|
||||
(!isShift && (modShift==1)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Test Alt attribute
|
||||
int modAlt = 3;
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("alt"), property);
|
||||
if(property == trueString)
|
||||
modAlt = 1;
|
||||
else if(property == falseString)
|
||||
modAlt = 0;
|
||||
|
||||
PRBool isAlt = PR_FALSE;
|
||||
keyEvent->GetAltKey(&isAlt);
|
||||
if ((isAlt && (modAlt==0)) ||
|
||||
(!isAlt && (modAlt==1)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
// This is gross -- we're doing string compares
|
||||
// every time we loop over this list!
|
||||
|
||||
// Modifiers in XUL files are tri-state --
|
||||
// true, false, and unspecified.
|
||||
// If a modifier is unspecified, we don't check
|
||||
// the status of that modifier (always match).
|
||||
|
||||
// Get the attribute for the "xulkey" modifier.
|
||||
nsAutoString xproperty = "";
|
||||
keyElement->GetAttribute(nsAutoString("xulkey"),
|
||||
xproperty);
|
||||
|
||||
// Is the modifier key set in the event?
|
||||
PRBool isModKey = PR_FALSE;
|
||||
|
||||
// Check whether the shift key fails to match:
|
||||
keyEvent->GetShiftKey(&isModKey);
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("shift"), property);
|
||||
if ((property == trueString && !isModKey)
|
||||
|| (property == falseString && isModKey))
|
||||
break;
|
||||
// and also the xul key, if it's specified to be shift:
|
||||
if (xulKeyShift == mXULKeyModifier &&
|
||||
((xproperty == trueString && !isModKey)
|
||||
|| (xproperty == falseString && isModKey)))
|
||||
break;
|
||||
|
||||
// and the control key:
|
||||
keyEvent->GetCtrlKey(&isModKey);
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("control"), property);
|
||||
if ((property == trueString && !isModKey)
|
||||
|| (property == falseString && isModKey))
|
||||
break;
|
||||
// and if xul is control:
|
||||
if (xulKeyControl == mXULKeyModifier &&
|
||||
((xproperty == trueString && !isModKey)
|
||||
|| (xproperty == falseString && isModKey)))
|
||||
break;
|
||||
|
||||
// and the alt key
|
||||
keyEvent->GetAltKey(&isModKey);
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("alt"), property);
|
||||
if ((property == trueString && !isModKey)
|
||||
|| (property == falseString && isModKey))
|
||||
break;
|
||||
// and if xul is alt:
|
||||
if (xulKeyAlt == mXULKeyModifier &&
|
||||
((xproperty == trueString && !isModKey)
|
||||
|| (xproperty == falseString && isModKey)))
|
||||
break;
|
||||
|
||||
// and the meta key
|
||||
keyEvent->GetMetaKey(&isModKey);
|
||||
property = "";
|
||||
keyElement->GetAttribute(nsAutoString("meta"), property);
|
||||
if ((property == trueString && !isModKey)
|
||||
|| (property == falseString && isModKey))
|
||||
break;
|
||||
// and if xul is meta:
|
||||
if (xulKeyMeta == mXULKeyModifier &&
|
||||
((xproperty == trueString && !isModKey)
|
||||
|| (xproperty == falseString && isModKey)))
|
||||
break;
|
||||
|
||||
// Modifier tests passed so execute onclick command
|
||||
nsAutoString cmdToExecute;
|
||||
nsAutoString oncommand;
|
||||
switch(aEventType) {
|
||||
case eKeyPress:
|
||||
keyElement->GetAttribute(nsAutoString("onkeypress"), cmdToExecute);
|
||||
printf("onkeypress = %s\n", cmdToExecute.ToNewCString());
|
||||
|
||||
#if defined(DEBUG_saari) || defined(DEBUG_akkana)
|
||||
printf("onkeypress = %s\n",
|
||||
cmdToExecute.ToNewCString());
|
||||
#endif
|
||||
|
||||
keyElement->GetAttribute(nsAutoString("oncommand"), oncommand);
|
||||
#if defined(DEBUG_saari) || defined(DEBUG_akkana)
|
||||
printf("oncommand = %s\n", oncommand.ToNewCString());
|
||||
#endif
|
||||
break;
|
||||
case eKeyDown:
|
||||
keyElement->GetAttribute(nsAutoString("onkeydown"), cmdToExecute);
|
||||
|
|
|
@ -37,9 +37,9 @@ Contributor(s): ______________________________________. -->
|
|||
<key id="key_newNavigator"/>
|
||||
<key id="key_newMessage"/>
|
||||
<key id="key_newBlankPage"/>
|
||||
<key id="openBrowserKb" disabled="false" command="true" key="&openCmd.commandkey;" observes="Browser:OpenUrl" />
|
||||
<key id="openFileKb" disabled="false" command="true" key="&openFileCmd.commandkey;" observes="Browser:OpenFile" />
|
||||
<key id="printKb" disabled="false" command="true" key="&printCmd.commandkey;" observes="Browser:Print" />
|
||||
<key id="openBrowserKb" disabled="false" xulkey="true" key="&openCmd.commandkey;" observes="Browser:OpenUrl" />
|
||||
<key id="openFileKb" disabled="false" xulkey="true" key="&openFileCmd.commandkey;" observes="Browser:OpenFile" />
|
||||
<key id="printKb" disabled="false" xulkey="true" key="&printCmd.commandkey;" observes="Browser:Print" />
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
|
||||
|
@ -53,12 +53,12 @@ Contributor(s): ______________________________________. -->
|
|||
<key id="key_selectAll"/>
|
||||
<key id="key_preferences"/>
|
||||
|
||||
<key id="goForwardKb" disabled="false" command="true" key="&goBackCmd.commandkey;" observes="Browser:GoForward" />
|
||||
<key id="goBackwardKb" disabled="false" command="true" key="&goForwardCmd.commandkey;" observes="Browser:GoBackwards" />
|
||||
<key id="goHomeKb" disabled="false" command="true" key="&goHomeCmd.commandkey;" observes="Browser:GoHome" />
|
||||
<key id="goForwardKb" disabled="false" xulkey="true" key="&goBackCmd.commandkey;" observes="Browser:GoForward" />
|
||||
<key id="goBackwardKb" disabled="false" xulkey="true" key="&goForwardCmd.commandkey;" observes="Browser:GoBackwards" />
|
||||
<key id="goHomeKb" disabled="false" xulkey="true" key="&goHomeCmd.commandkey;" observes="Browser:GoHome" />
|
||||
|
||||
<key id="addBookmarkKb" disabled="false" command="true" key="&addCurPageCmd.commandkey;" observes="Browser:AddBookmark" />
|
||||
<key id="manBookmarkKb" disabled="false" command="true" key="&manBookmarksCmd.commandkey;" observes="Browser:ManageBookmark" />
|
||||
<key id="addBookmarkKb" disabled="false" xulkey="true" key="&addCurPageCmd.commandkey;" observes="Browser:AddBookmark" />
|
||||
<key id="manBookmarkKb" disabled="false" xulkey="true" key="&manBookmarksCmd.commandkey;" observes="Browser:ManageBookmark" />
|
||||
|
||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||
</keyset>
|
||||
|
|
|
@ -37,9 +37,9 @@ Contributor(s): ______________________________________. -->
|
|||
<key id="key_newNavigator"/>
|
||||
<key id="key_newMessage"/>
|
||||
<key id="key_newBlankPage"/>
|
||||
<key id="openBrowserKb" disabled="false" command="true" key="&openCmd.commandkey;" observes="Browser:OpenUrl" />
|
||||
<key id="openFileKb" disabled="false" command="true" key="&openFileCmd.commandkey;" observes="Browser:OpenFile" />
|
||||
<key id="printKb" disabled="false" command="true" key="&printCmd.commandkey;" observes="Browser:Print" />
|
||||
<key id="openBrowserKb" disabled="false" xulkey="true" key="&openCmd.commandkey;" observes="Browser:OpenUrl" />
|
||||
<key id="openFileKb" disabled="false" xulkey="true" key="&openFileCmd.commandkey;" observes="Browser:OpenFile" />
|
||||
<key id="printKb" disabled="false" xulkey="true" key="&printCmd.commandkey;" observes="Browser:Print" />
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
|
||||
|
@ -53,12 +53,12 @@ Contributor(s): ______________________________________. -->
|
|||
<key id="key_selectAll"/>
|
||||
<key id="key_preferences"/>
|
||||
|
||||
<key id="goForwardKb" disabled="false" command="true" key="&goBackCmd.commandkey;" observes="Browser:GoForward" />
|
||||
<key id="goBackwardKb" disabled="false" command="true" key="&goForwardCmd.commandkey;" observes="Browser:GoBackwards" />
|
||||
<key id="goHomeKb" disabled="false" command="true" key="&goHomeCmd.commandkey;" observes="Browser:GoHome" />
|
||||
<key id="goForwardKb" disabled="false" xulkey="true" key="&goBackCmd.commandkey;" observes="Browser:GoForward" />
|
||||
<key id="goBackwardKb" disabled="false" xulkey="true" key="&goForwardCmd.commandkey;" observes="Browser:GoBackwards" />
|
||||
<key id="goHomeKb" disabled="false" xulkey="true" key="&goHomeCmd.commandkey;" observes="Browser:GoHome" />
|
||||
|
||||
<key id="addBookmarkKb" disabled="false" command="true" key="&addCurPageCmd.commandkey;" observes="Browser:AddBookmark" />
|
||||
<key id="manBookmarkKb" disabled="false" command="true" key="&manBookmarksCmd.commandkey;" observes="Browser:ManageBookmark" />
|
||||
<key id="addBookmarkKb" disabled="false" xulkey="true" key="&addCurPageCmd.commandkey;" observes="Browser:AddBookmark" />
|
||||
<key id="manBookmarkKb" disabled="false" xulkey="true" key="&manBookmarksCmd.commandkey;" observes="Browser:ManageBookmark" />
|
||||
|
||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||
</keyset>
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
<menuitem id="menu_newMessage" value="&newMessageCmd.label;" accesskey="&newMessageCmd.accesskey;" key="key_newMessage" observes="cmd_newMessage"/>
|
||||
<menuitem id="menu_newCard" value="&newCardCmd.label;" accesskey="&newCardCmd.accesskey;" key="key_newCard" observes="cmd_newCard"/>
|
||||
|
||||
<key id="key_newBlankPage" command="true" shift="true" key="&newBlankPageCmd.key;" observes="cmd_newEditor"/>
|
||||
<key id="key_newNavigator" command="true" key="&newNavigatorCmd.key;" observes="cmd_newNavigator"/>
|
||||
<key id="key_newMessage" command="true" key="&newMessageCmd.key;" observes="cmd_newMessage"/>
|
||||
<key id="key_newBlankPage" xulkey="true" shift="true" key="&newBlankPageCmd.key;" observes="cmd_newEditor"/>
|
||||
<key id="key_newNavigator" xulkey="true" key="&newNavigatorCmd.key;" observes="cmd_newNavigator"/>
|
||||
<key id="key_newMessage" xulkey="true" key="&newMessageCmd.key;" observes="cmd_newMessage"/>
|
||||
|
||||
<!-- Page Setup menu item -->
|
||||
<menuitem id="menu_pageSetup" value="&pageSetupCmd.label;" oncommand="goPageSetup()"/>
|
||||
|
@ -47,13 +47,13 @@
|
|||
<menuitem id="menu_delete" value="&deleteCmd.label;" key="key_delete" accesskey="&deleteCmd.accesskey;" observes="cmd_delete"/>
|
||||
<menuitem id="menu_selectAll" value="&selectAllCmd.label;" key="key_selectAll" accesskey="&selectAllCmd.accesskey;" observes="cmd_selectAll"/>
|
||||
|
||||
<key id="key_undo" command="true" key="&undoCmd.key;" observes="cmd_undo"/>
|
||||
<key id="key_cut" command="true" key="&cutCmd.key;" observes="cmd_cut"/>
|
||||
<key id="key_copy" command="true" key="©Cmd.key;" observes="cmd_copy"/>
|
||||
<key id="key_paste" command="true" key="&pasteCmd.key;" observes="cmd_paste"/>
|
||||
<key id="key_delete" command="true" key="&deleteCmd.key;" observes="cmd_delete"/>
|
||||
<key id="key_selectAll" command="true" key="&selectAllCmd.key;" observes="cmd_selectAll"/>
|
||||
<key id="key_preferences" command="true" key="&preferencesCmd.key;" observes="cmd_preferences"/>
|
||||
<key id="key_undo" xulkey="true" key="&undoCmd.key;" observes="cmd_undo"/>
|
||||
<key id="key_cut" xulkey="true" key="&cutCmd.key;" observes="cmd_cut"/>
|
||||
<key id="key_copy" xulkey="true" key="©Cmd.key;" observes="cmd_copy"/>
|
||||
<key id="key_paste" xulkey="true" key="&pasteCmd.key;" observes="cmd_paste"/>
|
||||
<key id="key_delete" xulkey="true" key="&deleteCmd.key;" observes="cmd_delete"/>
|
||||
<key id="key_selectAll" xulkey="true" key="&selectAllCmd.key;" observes="cmd_selectAll"/>
|
||||
<key id="key_preferences" xulkey="true" key="&preferencesCmd.key;" observes="cmd_preferences"/>
|
||||
|
||||
<commandset id="globalEditMenuItems"
|
||||
commandupdater="true"
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<key keycode="VK_ENTER" oncommand="doOKButton()"/>
|
||||
<key keycode="VK_RETURN" oncommand="doOKButton()"/>
|
||||
<key keycode="VK_ESCAPE" oncommand="doCancelButton()"/>
|
||||
<!-- key command="true" charcode="." oncommand="doCancelButton()"/ -->
|
||||
<!-- key xulkey="true" charcode="." oncommand="doCancelButton()"/ -->
|
||||
</keyset>
|
||||
|
||||
</overlay>
|
||||
|
|
|
@ -8,19 +8,25 @@
|
|||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- change the xul key for Unix -->
|
||||
<keyset id="unixoverlaykeyset">
|
||||
<xulkey key="alt" />
|
||||
<key keycode="VK_ENTER" oncommand="doOKButton()"/>
|
||||
</keyset>
|
||||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" value="&closeCmd.label;" key="key_close" observes="cmd_close"/>
|
||||
<key id="key_close" command="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
<key id="key_close" xulkey="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem value="&quitApplicationCmd.label;" key="key_quit" observes="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" command="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<key id="key_quit" xulkey="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<broadcaster id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" value="&redoCmd.label;" key="key_redo" observes="cmd_redo"/>
|
||||
<key id="key_redo" shift="true" command="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
<key id="key_redo" shift="true" xulkey="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
|
||||
</overlay>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<spring flex="100%"/>
|
||||
</box>
|
||||
|
||||
<keyset id="keyset">
|
||||
<keyset id="unixdialogkeyset">
|
||||
<key keycode="VK_ENTER" oncommand="doOKButton()"/>
|
||||
<key keycode="VK_RETURN" oncommand="doOKButton()"/>
|
||||
<key keycode="VK_ESCAPE" oncommand="doCancelButton()"/>
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" value="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" observes="cmd_close"/>
|
||||
<key id="key_close" command="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
<key id="key_close" xulkey="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem value="&quitApplicationCmd.label;" key="key_quit" accesskey="&quitApplicationCmd.accesskey;" observes="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" command="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<key id="key_quit" xulkey="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<broadcaster id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" value="&redoCmd.label;" key="key_redo" accesskey="&redoCmd.accesskey;" observes="cmd_redo"/>
|
||||
<key id="key_redo" command="true" shift="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
<key id="key_redo" xulkey="true" shift="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
|
||||
</overlay>
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
|
||||
<!-- close -->
|
||||
<menuitem id="menu_close" value="&closeCmd.label;" key="key_close" accesskey="&closeCmd.accesskey;" observes="cmd_close"/>
|
||||
<key id="key_close" command="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
<key id="key_close" xulkey="true" key="&closeCmd.key;" observes="cmd_close"/>
|
||||
|
||||
<!-- quit -->
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem value="&quitApplicationCmd.label;" key="key_quit" accesskey="&quitApplicationCmd.accesskey;" observes="cmd_quit"/>
|
||||
</menupopup>
|
||||
<key id="key_quit" command="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<key id="key_quit" xulkey="true" key="&quitApplicationCmd.key;" observes="cmd_quit"/>
|
||||
<broadcaster id="cmd_quit" oncommand="goQuitApplication()"/>
|
||||
|
||||
<!-- Edit Menu -->
|
||||
<menuitem id="menu_redo" value="&redoCmd.label;" key="key_redo" accesskey="&redoCmd.accesskey;" observes="cmd_redo"/>
|
||||
<key id="key_redo" command="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
<key id="key_redo" xulkey="true" key="&redoCmd.key;" observes="cmd_redo"/>
|
||||
|
||||
</overlay>
|
||||
|
|
Загрузка…
Ссылка в новой задаче