massive changes a=jar.hoffman, r=akkana

This commit is contained in:
mjudge%netscape.com 1999-12-11 00:02:08 +00:00
parent 14a871afc2
commit b51f84b3de
17 changed files with 802 additions and 125 deletions

View File

@ -74,6 +74,21 @@ interface nsISelectionController : nsISupports
*/
void pageMove(in boolean aForward, in boolean aExtend);
/** CompleteScroll will move page view to the top or bottom of the document
* @param aForward forward or backward if PR_FALSE
*/
void completeScroll(in boolean aForward);
/** CompleteMove will move page view to the top or bottom of the document
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
* the "point" of selection that is extended is considered the "focus" point.
* or the last point adjusted by the selection.
* @param aForward forward or backward if PR_FALSE
* @param aExtend should it collapse the selection of extend it?
*/
void completeMove(in boolean aForward, in boolean aExtend);
/** ScrollPage will scroll the page without affecting the selection.
* @param aForward scroll forward or backwards in selection
*/

View File

@ -63,6 +63,9 @@ static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
//we will use key binding by default now. this wil lbreak viewer for now
#define NON_KEYBINDING 0
nsIFrame * gCurrentlyFocusedTargetFrame = 0;
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
@ -714,6 +717,9 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
*aStatus = nsEventStatus_eConsumeNoDefault;
break;
//the problem is that viewer does not have xul so we cannot completely eliminate these
#if NON_KEYBINDING
case NS_VK_PAGE_DOWN:
case NS_VK_PAGE_UP:
if (!mCurrentFocus) {
@ -775,6 +781,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
}
}
break;
#endif //NON_KEYBINDING
}
}
}

View File

@ -76,6 +76,7 @@
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
<!-- scroll document/page/line and move caret -->
<!--
<key id="homekb" keycode="VK_HOME" onkeypress="EditorMoveToTopOfWindow( true, false )" />
<key id="endkb" keycode="VK_END" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
<key id="pageupkb" keycode="VK_PAGE_UP" onkeypress="EditorMoveUpPage( true, false )" />
@ -84,7 +85,9 @@
<key id="endoflinekb" keycode="VK_RIGHT" xulkey="true" onkeypress="EditorEndOfLine( false )" />
<key id="uphomekb" keycode="VK_UP" xulkey="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
<key id="downendkb" keycode="VK_DOWN" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
-->
<!-- scroll document/page/line and extend selection -->
<!--
<key id="homeextendkb" keycode="VK_HOME" shift="true" onkeypress="EditorMoveToTopOfWindow( true, true )" />
<key id="endextendkb" keycode="VK_END" shift="true" onkeypress="EditorMoveToBottomOfWindow( true, true )" />
<key id="pageupextendkb" keycode="VK_PAGE_UP" shift="true" onkeypress="EditorMoveUpPage( true, true )" />
@ -93,26 +96,35 @@
<key id="endoflineextendkb" keycode="VK_RIGHT" shift="true" xulkey="true" onkeypress="EditorEndOfLine( false )" />
<key id="uphomeextendkb" keycode="VK_UP" shift="true" xulkey="true" onkeypress="EditorMoveToTopOfWindow( true, false )" />
<key id="downendextendkb" keycode="VK_DOWN" shift="true" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
-->
<!-- move caret by one character -->
<!--
<key id="leftkb" keycode="VK_LEFT" onkeypress="EditorPreviousCharacter( false )" />
<key id="rightkb" keycode="VK_RIGHT" onkeypress="EditorNextCharacter( false )" />
<key id="upkb" keycode="VK_UP" onkeypress="EditorPreviousRow( false )" />
<key id="downkb" keycode="VK_DOWN" onkeypress="EditorNextRow( false )" />
-->
<!-- move caret by one character/row and extend selection -->
<!--
<key id="prevcharextendkb" keycode="VK_LEFT" shift="true" onkeypress="EditorPreviousCharacter( true )" />
<key id="nextcharextendkb" keycode="VK_RIGHT" shift="true" onkeypress="EditorNextCharacter( true )" />
<key id="prevrowextendkb" keycode="VK_UP" shift="true" onkeypress="EditorPreviousRow( true )" />
<key id="nextrowextendkb" keycode="VK_DOWN" shift="true" onkeypress="EditorNextRow( true )" />
-->
<!-- move caret by one word/paragraph -->
<!--
<key id="prevwordkb" keycode="VK_LEFT" alt="true" onkeypress="EditorPreviousWord( false )" />
<key id="nextwordkb" keycode="VK_RIGHT" alt="true" onkeypress="EditorNextWord( false )" />
<key id="prevparakb" keycode="VK_UP" alt="true" onkeypress="EditorBeginningOfParagraph( false )" />
<key id="nextparakb" keycode="VK_DOWN" alt="true" onkeypress="EditorEndOfParagraph( false )" />
-->
<!-- move caret by one word and extend selection -->
<!--
<key id="prevwordextendkb" keycode="VK_LEFT" shift="true" alt="true" onkeypress="EditorPreviousWord( true )" />
<key id="nextwordextendkb" keycode="VK_RIGHT" shift="true" alt="true" onkeypress="EditorNextWord( true )" />
<key id="prevparaextendkb" keycode="VK_UP" shift="true" alt="true" onkeypress="EditorBeginningOfParagraph( true )" />
<key id="nextparaextendkb" keycode="VK_DOWN" shift="true" alt="true" onkeypress="EditorEndOfParagraph( true )" />
-->
</keyset>
<broadcasterset id="broadcasterset">

View File

@ -224,6 +224,38 @@ public:
*/
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame)=0;
/** CharacterMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one character left or right.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend)=0;
/** WordMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one word left or right.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend)=0;
/** LineMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one line up or down.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend)=0;
/** IntraLineMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move to beginning or end of line
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend)=0;
/** Select All will generally be called from the nsiselectioncontroller implementations.
* it will select the whole doc
*/
NS_IMETHOD SelectAll()=0;
};

View File

@ -378,6 +378,8 @@ public:
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD ScrollPage(PRBool aForward);
NS_IMETHOD CompleteScroll(PRBool aForward);
NS_IMETHOD CompleteMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD SelectAll();
// nsIDocumentObserver
@ -1321,35 +1323,69 @@ NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable)
NS_IMETHODIMP
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->CharacterMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::WordMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->WordMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::LineMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->LineMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->IntraLineMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::PageMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
{
nsCOMPtr<nsIScrollableView> scrollView;
result = viewManager->GetRootScrollableView(getter_AddRefs(scrollView));
if (NS_SUCCEEDED(result) && scrollView)
{
}
}
return result;
}
NS_IMETHODIMP
PresShell::ScrollPage(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
{
nsCOMPtr<nsIScrollableView> scrollView;
result = viewManager->GetRootScrollableView(getter_AddRefs(scrollView));
if (NS_SUCCEEDED(result) && scrollView)
{
scrollView->ScrollByPages(aForward ? 1 : -1);
}
}
return result;
}
NS_IMETHODIMP
PresShell::CompleteScroll(PRBool aForward)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1357,7 +1393,7 @@ PresShell::ScrollPage(PRBool aForward)
NS_IMETHODIMP
PresShell::SelectAll()
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->SelectAll();
}
//end implementations nsISelectionController
@ -2510,14 +2546,14 @@ PresShell::HandleEvent(nsIView *aView,
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
/* if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
{//KEY HANDLERS WILL GET RID OF THIS
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
{
return NS_OK;
}
}
*/
if (nsnull != frame) {
PushCurrentEventFrame();

View File

@ -224,6 +224,38 @@ public:
*/
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame)=0;
/** CharacterMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one character left or right.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend)=0;
/** WordMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one word left or right.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend)=0;
/** LineMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move one line up or down.
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend)=0;
/** IntraLineMove will generally be called from the nsiselectioncontroller implementations.
* the effect being the selection will move to beginning or end of line
* @param aForward move forward in document.
* @param aExtend continue selection
*/
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend)=0;
/** Select All will generally be called from the nsiselectioncontroller implementations.
* it will select the whole doc
*/
NS_IMETHOD SelectAll()=0;
};

View File

@ -74,6 +74,21 @@ interface nsISelectionController : nsISupports
*/
void pageMove(in boolean aForward, in boolean aExtend);
/** CompleteScroll will move page view to the top or bottom of the document
* @param aForward forward or backward if PR_FALSE
*/
void completeScroll(in boolean aForward);
/** CompleteMove will move page view to the top or bottom of the document
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
* the "point" of selection that is extended is considered the "focus" point.
* or the last point adjusted by the selection.
* @param aForward forward or backward if PR_FALSE
* @param aExtend should it collapse the selection of extend it?
*/
void completeMove(in boolean aForward, in boolean aExtend);
/** ScrollPage will scroll the page without affecting the selection.
* @param aForward scroll forward or backwards in selection
*/

View File

@ -226,7 +226,12 @@ public:
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame);
/*END nsIFrameSelection interfacse*/
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD SelectAll();
/*END nsIFrameSelection interfacse*/
@ -250,6 +255,8 @@ private:
#endif /* DEBUG */
void ResizeBuffer(PRUint32 aNewBufSize);
/*HELPER METHODS*/
nsresult MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aAmount);
nscoord FetchDesiredX(); //the x position requested by the Key Handling for up down
void InvalidateDesiredX(); //do not listen to mDesiredX you must get another.
@ -1111,6 +1118,116 @@ nsRangeList::HandleTextEvent(nsGUIEvent *aGUIEvent)
}
nsresult
nsRangeList::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aAmount)
{
nsCOMPtr<nsIPresContext> context;
nsresult result = mTracker->GetPresContext(getter_AddRefs(context));
if (NS_FAILED(result) || !context)
return result?result:NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> weakNodeUsed;
PRInt32 offsetused = 0;
PRBool isCollapsed;
nscoord desiredX; //we must keep this around and revalidate it when its just UP/DOWN
result = mDomSelections[SELECTION_NORMAL]->GetIsCollapsed(&isCollapsed);
if (NS_FAILED(result))
return result;
if (aKeycode == nsIDOMKeyEvent::DOM_VK_UP || aKeycode == nsIDOMKeyEvent::DOM_VK_DOWN)
{
desiredX= FetchDesiredX();
SetDesiredX(desiredX);
}
if (!isCollapsed && !aContinue) {
switch (aKeycode){
case nsIDOMKeyEvent::DOM_VK_LEFT :
case nsIDOMKeyEvent::DOM_VK_UP : {
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
}
else {
offsetused = mDomSelections[SELECTION_NORMAL]->FetchAnchorOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchAnchorNode();
}
result = mDomSelections[SELECTION_NORMAL]->Collapse(weakNodeUsed,offsetused);
return NS_OK;
} break;
case nsIDOMKeyEvent::DOM_VK_RIGHT :
case nsIDOMKeyEvent::DOM_VK_DOWN : {
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
offsetused = mDomSelections[SELECTION_NORMAL]->FetchAnchorOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchAnchorNode();
}
else {
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
}
result = mDomSelections[SELECTION_NORMAL]->Collapse(weakNodeUsed,offsetused);
return NS_OK;
} break;
}
// if (keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_UP || keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_DOWN)
// SetDesiredX(desiredX);
}
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
nsIFrame *frame;
result = mDomSelections[SELECTION_NORMAL]->GetPrimaryFrameForFocusNode(&frame);
if (NS_FAILED(result))
return result;
nsPeekOffsetStruct pos;
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
switch (aKeycode){
case nsIDOMKeyEvent::DOM_VK_RIGHT :
InvalidateDesiredX();
pos.mDirection = eDirNext;
mHint = HINTLEFT;//stick to this line
break;
case nsIDOMKeyEvent::DOM_VK_LEFT : //no break
InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break;
case nsIDOMKeyEvent::DOM_VK_DOWN :
pos.mAmount = eSelectLine;
pos.mDirection = eDirNext;//no break here
break;
case nsIDOMKeyEvent::DOM_VK_UP :
pos.mAmount = eSelectLine;
break;
case nsIDOMKeyEvent::DOM_VK_HOME :
InvalidateDesiredX();
pos.mAmount = eSelectBeginLine;
InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break;
case nsIDOMKeyEvent::DOM_VK_END :
InvalidateDesiredX();
pos.mAmount = eSelectEndLine;
InvalidateDesiredX();
mHint = HINTLEFT;//stick to this line
break;
default :return NS_ERROR_FAILURE;
}
pos.mPreferLeft = mHint;
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(context, &pos)) && pos.mResultContent)
{
mHint = (HINT)pos.mPreferLeft;
result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, aContinue, PR_FALSE);
}
if (NS_SUCCEEDED(result))
result = mDomSelections[SELECTION_NORMAL]->ScrollIntoView();
return result;
}
/** This raises a question, if this method is called and the aFrame does not reflect the current
* focus DomNode, it is invalid? The answer now is yes.
@ -1145,108 +1262,10 @@ nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
return NS_ERROR_FAILURE;
}
#endif
nsCOMPtr<nsIDOMNode> weakNodeUsed;
PRInt32 offsetused = 0;
nsSelectionAmount amount = eSelectCharacter;
if (keyEvent->isControl)
amount = eSelectWord;
PRBool isCollapsed;
nscoord desiredX; //we must keep this around and revalidate it when its just UP/DOWN
result = mDomSelections[SELECTION_NORMAL]->GetIsCollapsed(&isCollapsed);
if (NS_FAILED(result))
return result;
if (keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_UP || keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_DOWN)
{
desiredX= FetchDesiredX();
SetDesiredX(desiredX);
}
if (!isCollapsed && !keyEvent->isShift) {
switch (keyEvent->keyCode){
case nsIDOMKeyEvent::DOM_VK_LEFT :
case nsIDOMKeyEvent::DOM_VK_UP : {
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
}
else {
offsetused = mDomSelections[SELECTION_NORMAL]->FetchAnchorOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchAnchorNode();
}
result = mDomSelections[SELECTION_NORMAL]->Collapse(weakNodeUsed,offsetused);
return NS_OK;
} break;
case nsIDOMKeyEvent::DOM_VK_RIGHT :
case nsIDOMKeyEvent::DOM_VK_DOWN : {
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
offsetused = mDomSelections[SELECTION_NORMAL]->FetchAnchorOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchAnchorNode();
}
else {
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
}
result = mDomSelections[SELECTION_NORMAL]->Collapse(weakNodeUsed,offsetused);
return NS_OK;
} break;
}
// if (keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_UP || keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_DOWN)
// SetDesiredX(desiredX);
}
offsetused = mDomSelections[SELECTION_NORMAL]->FetchFocusOffset();
weakNodeUsed = mDomSelections[SELECTION_NORMAL]->FetchFocusNode();
nsIFrame *frame;
result = mDomSelections[SELECTION_NORMAL]->GetPrimaryFrameForFocusNode(&frame);
if (NS_FAILED(result))
return result;
nsPeekOffsetStruct pos;
pos.SetData(mTracker, desiredX, amount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
switch (keyEvent->keyCode){
case nsIDOMKeyEvent::DOM_VK_RIGHT :
InvalidateDesiredX();
pos.mDirection = eDirNext;
mHint = HINTLEFT;//stick to this line
break;
case nsIDOMKeyEvent::DOM_VK_LEFT : //no break
InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break;
case nsIDOMKeyEvent::DOM_VK_DOWN :
pos.mAmount = eSelectLine;
pos.mDirection = eDirNext;//no break here
break;
case nsIDOMKeyEvent::DOM_VK_UP :
pos.mAmount = eSelectLine;
break;
case nsIDOMKeyEvent::DOM_VK_HOME :
InvalidateDesiredX();
pos.mAmount = eSelectBeginLine;
InvalidateDesiredX();
mHint = HINTRIGHT;//stick to opposite of movement
break;
case nsIDOMKeyEvent::DOM_VK_END :
InvalidateDesiredX();
pos.mAmount = eSelectEndLine;
InvalidateDesiredX();
mHint = HINTLEFT;//stick to this line
break;
default :return NS_ERROR_FAILURE;
}
pos.mPreferLeft = mHint;
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(aPresContext, &pos)) && pos.mResultContent)
{
mHint = (HINT)pos.mPreferLeft;
result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, keyEvent->isShift, PR_FALSE);
}
if (NS_SUCCEEDED(result))
result = mDomSelections[SELECTION_NORMAL]->ScrollIntoView();
return MoveCaret(keyEvent->keyCode, keyEvent->isShift, amount);
}
return result;
}
@ -1558,6 +1577,46 @@ nsRangeList::GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame
}
NS_IMETHODIMP
nsRangeList::CharacterMove(PRBool aForward, PRBool aExtend)
{
if (aForward)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_RIGHT,aExtend,eSelectCharacter);
else
return MoveCaret(nsIDOMKeyEvent::DOM_VK_LEFT,aExtend,eSelectCharacter);
}
NS_IMETHODIMP
nsRangeList::WordMove(PRBool aForward, PRBool aExtend)
{
if (aForward)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_RIGHT,aExtend,eSelectWord);
else
return MoveCaret(nsIDOMKeyEvent::DOM_VK_LEFT,aExtend,eSelectWord);
}
NS_IMETHODIMP
nsRangeList::LineMove(PRBool aForward, PRBool aExtend)
{
if (aForward)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_DOWN,aExtend,eSelectLine);
else
return MoveCaret(nsIDOMKeyEvent::DOM_VK_UP,aExtend,eSelectLine);
}
NS_IMETHODIMP
nsRangeList::IntraLineMove(PRBool aForward, PRBool aExtend)
{
if (aForward)
return MoveCaret(nsIDOMKeyEvent::DOM_VK_END,aExtend,eSelectLine);
else
return MoveCaret(nsIDOMKeyEvent::DOM_VK_HOME,aExtend,eSelectLine);
}
NS_IMETHODIMP nsRangeList::SelectAll()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//////////END FRAMESELECTION
NS_METHOD

View File

@ -63,6 +63,9 @@ static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_IID);
//we will use key binding by default now. this wil lbreak viewer for now
#define NON_KEYBINDING 0
nsIFrame * gCurrentlyFocusedTargetFrame = 0;
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
@ -714,6 +717,9 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
*aStatus = nsEventStatus_eConsumeNoDefault;
break;
//the problem is that viewer does not have xul so we cannot completely eliminate these
#if NON_KEYBINDING
case NS_VK_PAGE_DOWN:
case NS_VK_PAGE_UP:
if (!mCurrentFocus) {
@ -775,6 +781,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
}
}
break;
#endif //NON_KEYBINDING
}
}
}

View File

@ -378,6 +378,8 @@ public:
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD ScrollPage(PRBool aForward);
NS_IMETHOD CompleteScroll(PRBool aForward);
NS_IMETHOD CompleteMove(PRBool aForward, PRBool aExtend);
NS_IMETHOD SelectAll();
// nsIDocumentObserver
@ -1321,35 +1323,69 @@ NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable)
NS_IMETHODIMP
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->CharacterMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::WordMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->WordMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::LineMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->LineMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->IntraLineMove(aForward, aExtend);
}
NS_IMETHODIMP
PresShell::PageMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
{
nsCOMPtr<nsIScrollableView> scrollView;
result = viewManager->GetRootScrollableView(getter_AddRefs(scrollView));
if (NS_SUCCEEDED(result) && scrollView)
{
}
}
return result;
}
NS_IMETHODIMP
PresShell::ScrollPage(PRBool aForward)
{
nsCOMPtr<nsIViewManager> viewManager;
nsresult result = GetViewManager(getter_AddRefs(viewManager));
if (NS_SUCCEEDED(result) && viewManager)
{
nsCOMPtr<nsIScrollableView> scrollView;
result = viewManager->GetRootScrollableView(getter_AddRefs(scrollView));
if (NS_SUCCEEDED(result) && scrollView)
{
scrollView->ScrollByPages(aForward ? 1 : -1);
}
}
return result;
}
NS_IMETHODIMP
PresShell::CompleteScroll(PRBool aForward)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -1357,7 +1393,7 @@ PresShell::ScrollPage(PRBool aForward)
NS_IMETHODIMP
PresShell::SelectAll()
{
return NS_ERROR_NOT_IMPLEMENTED;
return mSelection->SelectAll();
}
//end implementations nsISelectionController
@ -2510,14 +2546,14 @@ PresShell::HandleEvent(nsIView *aView,
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
/* if (mSelection && aEvent->eventStructType == NS_KEY_EVENT)
{//KEY HANDLERS WILL GET RID OF THIS
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
{
return NS_OK;
}
}
*/
if (nsnull != frame) {
PushCurrentEventFrame();

View File

@ -27,6 +27,11 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMSelection.h"
#include "nsISelectionController.h"
#include "nsIDocument.h"
#include "nsIHTMLContent.h"
#include "nsIPresShell.h"
NS_IMPL_ADDREF(nsEditorController)
NS_IMPL_RELEASE(nsEditorController)
@ -43,6 +48,43 @@ nsEditorController::nsEditorController()
mPasteString = "cmd_paste";
mDeleteString = "cmd_delete";
mSelectAllString = "cmd_selectAll";
mBeginLineString = "cmd_beginLine";
mEndLineString = "cmd_endLine";
mSelectBeginLineString = "cmd_selectBeginLine";
mSelectEndLineString = "cmd_selectEndLine";
mScrollTopString = "cmd_scrollTop";
mScrollBottomString = "cmd_scrollBottom";
mMoveTopString = "cmd_moveTop";
mMoveBottomString= "cmd_moveBottom";
mSelectMoveTopString = "cmd_selectTop";
mSelectMoveBottomString= "cmd_selectBottom";
mDownString = "cmd_linedown";
mUpString = "cmd_lineup";
mSelectDownString = "cmd_selectLineDown";
mSelectUpString = "cmd_selectLineUp";
mLeftString = "cmd_charPrevious";
mRightString = "cmd_charNext";
mSelectLeftString = "cmd_selectCharPrevious";
mSelectRightString= "cmd_selectCharNext";
mWordLeftString = "cmd_wordPrevious";
mWordRightString = "cmd_wordNext";
mSelectWordLeftString = "cmd_selectWordPrevious";
mSelectWordRightString= "cmd_selectWordNext";
mScrollPageUp = "cmd_scrollPageUp";
mScrollPageDown = "cmd_scrollPageDown";
mMovePageUp = "cmd_scrollPageUp";
mMovePageDown = "cmd_scrollPageDown";
mSelectMovePageUp = "cmd_selectPageUp";
mSelectMovePageDown = "cmd_selectPageDown";
}
nsEditorController::~nsEditorController()
@ -151,7 +193,35 @@ NS_IMETHODIMP nsEditorController::SupportsCommand(const PRUnichar *aCommand, PRB
(PR_TRUE==mCopyString.Equals(aCommand)) ||
(PR_TRUE==mPasteString.Equals(aCommand)) ||
(PR_TRUE==mDeleteString.Equals(aCommand)) ||
(PR_TRUE==mSelectAllString.Equals(aCommand))
(PR_TRUE==mSelectAllString.Equals(aCommand)) ||
(PR_TRUE==mBeginLineString.Equals(aCommand)) ||
(PR_TRUE==mEndLineString.Equals(aCommand)) ||
(PR_TRUE==mSelectBeginLineString.Equals(aCommand)) ||
(PR_TRUE==mSelectEndLineString.Equals(aCommand)) ||
(PR_TRUE==mScrollTopString.Equals(aCommand)) ||
(PR_TRUE==mScrollBottomString.Equals(aCommand)) ||
(PR_TRUE==mMoveTopString.Equals(aCommand)) ||
(PR_TRUE==mMoveBottomString.Equals(aCommand)) ||
(PR_TRUE==mSelectMoveTopString.Equals(aCommand)) ||
(PR_TRUE==mSelectMoveBottomString.Equals(aCommand)) ||
(PR_TRUE==mDownString.Equals(aCommand)) ||
(PR_TRUE==mUpString.Equals(aCommand)) ||
(PR_TRUE==mLeftString.Equals(aCommand)) ||
(PR_TRUE==mRightString.Equals(aCommand)) ||
(PR_TRUE==mSelectDownString.Equals(aCommand)) ||
(PR_TRUE==mSelectUpString.Equals(aCommand)) ||
(PR_TRUE==mSelectLeftString.Equals(aCommand)) ||
(PR_TRUE==mSelectRightString.Equals(aCommand)) ||
(PR_TRUE==mWordLeftString.Equals(aCommand)) ||
(PR_TRUE==mWordRightString.Equals(aCommand)) ||
(PR_TRUE==mSelectWordLeftString.Equals(aCommand)) ||
(PR_TRUE==mSelectWordRightString.Equals(aCommand)) ||
(PR_TRUE==mScrollPageUp.Equals(aCommand)) ||
(PR_TRUE==mScrollPageDown.Equals(aCommand)) ||
(PR_TRUE==mMovePageUp.Equals(aCommand)) ||
(PR_TRUE==mMovePageDown.Equals(aCommand)) ||
(PR_TRUE==mSelectMovePageUp.Equals(aCommand)) ||
(PR_TRUE==mSelectMovePageDown.Equals(aCommand))
)
{
*aResult = PR_TRUE;
@ -164,6 +234,7 @@ NS_IMETHODIMP nsEditorController::DoCommand(const PRUnichar *aCommand)
{
NS_ENSURE_ARG_POINTER(aCommand);
nsCOMPtr<nsIEditor> editor;
nsCOMPtr<nsISelectionController> selCont;
NS_ENSURE_SUCCESS(GetEditor(getter_AddRefs(editor)), NS_ERROR_FAILURE);
if (!editor)
{ // Q: What does it mean if there is no editor?
@ -195,11 +266,150 @@ NS_IMETHODIMP nsEditorController::DoCommand(const PRUnichar *aCommand)
{
NS_ENSURE_SUCCESS(editor->DeleteSelection(nsIEditor::eNext), NS_ERROR_FAILURE);
}
else if (PR_TRUE==mSelectAllString.Equals(aCommand))
else if (PR_TRUE==mSelectAllString.Equals(aCommand)) //SelectALL
{
NS_ENSURE_SUCCESS(editor->SelectAll(), NS_ERROR_FAILURE);
}
else if (PR_TRUE==mScrollTopString.Equals(aCommand)) //ScrollTOP
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteScroll(PR_FALSE);
}
else if (PR_TRUE==mScrollBottomString.Equals(aCommand)) //ScrollBOTTOM
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteScroll(PR_TRUE);
}
else if (PR_TRUE==mMoveTopString.Equals(aCommand)) //MoveTop
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mMoveBottomString.Equals(aCommand)) //MoveBottom
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mSelectMoveTopString.Equals(aCommand)) // SelectMoveTop
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mSelectMoveBottomString.Equals(aCommand)) //SelectMoveBottom
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CompleteMove(PR_TRUE,PR_TRUE);
}
else if (PR_TRUE==mDownString.Equals(aCommand)) //DOWN
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->LineMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mUpString.Equals(aCommand)) //UP
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->LineMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mSelectDownString.Equals(aCommand)) //SelectDown
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->LineMove(PR_TRUE,PR_TRUE);
}
else if (PR_TRUE==mSelectUpString.Equals(aCommand)) //SelectUp
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->LineMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mLeftString.Equals(aCommand)) //LeftChar
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CharacterMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mRightString.Equals(aCommand)) //Right char
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CharacterMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mSelectLeftString.Equals(aCommand)) //SelectLeftChar
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CharacterMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mSelectRightString.Equals(aCommand)) //SelectRightChar
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->CharacterMove(PR_TRUE,PR_TRUE);
}
else if (PR_TRUE==mBeginLineString.Equals(aCommand)) //BeginLine
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->IntraLineMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mEndLineString.Equals(aCommand)) //EndLine
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->IntraLineMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mSelectBeginLineString.Equals(aCommand)) //SelectBeginLine
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->IntraLineMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mSelectEndLineString.Equals(aCommand)) //SelectEndLine
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->IntraLineMove(PR_TRUE,PR_TRUE);
}
else if (PR_TRUE==mWordLeftString.Equals(aCommand)) //LeftWord
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->WordMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mWordRightString.Equals(aCommand)) //RightWord
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->WordMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mSelectWordLeftString.Equals(aCommand)) //SelectLeftWord
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->WordMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mSelectWordRightString.Equals(aCommand)) //SelectRightWord
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->WordMove(PR_TRUE,PR_TRUE);
}
else if (PR_TRUE==mScrollPageUp.Equals(aCommand)) //ScrollPageUp
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->ScrollPage(PR_FALSE);
}
else if (PR_TRUE==mScrollPageDown.Equals(aCommand)) //ScrollPageDown
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->ScrollPage(PR_TRUE);
}
else if (PR_TRUE==mMovePageUp.Equals(aCommand)) //MovePageUp
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->PageMove(PR_FALSE,PR_FALSE);
}
else if (PR_TRUE==mMovePageDown.Equals(aCommand)) //MovePageDown
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->PageMove(PR_TRUE,PR_FALSE);
}
else if (PR_TRUE==mSelectMovePageUp.Equals(aCommand)) //SelectMovePageUp
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->PageMove(PR_FALSE,PR_TRUE);
}
else if (PR_TRUE==mSelectMovePageDown.Equals(aCommand)) //SelectMovePageDown
{
NS_ENSURE_SUCCESS(GetSelectionController(getter_AddRefs(selCont)),NS_ERROR_FAILURE);
return selCont->PageMove(PR_TRUE,PR_TRUE);
}
return NS_OK;
}
@ -226,6 +436,51 @@ NS_IMETHODIMP nsEditorController::GetEditor(nsIEditor ** aEditor)
return NS_OK;
}
NS_IMETHODIMP nsEditorController::GetSelectionController(nsISelectionController ** aSelCon)
{
nsCOMPtr<nsIEditor>editor;
nsresult result = GetEditor(getter_AddRefs(editor));
if (NS_FAILED(result) || !editor)
return result ? result : NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> presShell;
result = editor->GetPresShell(getter_AddRefs(presShell));
if (NS_FAILED(result) || !presShell)
return result ? result : NS_ERROR_FAILURE;
nsCOMPtr<nsISelectionController> selController = do_QueryInterface(presShell);
if (selController)
{
*aSelCon = selController;
NS_ADDREF(*aSelCon);
return NS_OK;
}
return NS_ERROR_FAILURE;
/*
NS_ENSURE_ARG_POINTER(aSelCon);
nsCOMPtr<nsIDocument> doc;
mContent->GetDocument(*getter_AddRefs(doc));
*aSelCon = nsnull;
if (doc)
{
PRInt32 i = doc->GetNumberOfShells();
if (i == 0)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPresShell> presShell = getter_AddRefs(doc->GetShellAt(0));
nsCOMPtr<nsISelectionController> selController = do_QueryInterface(presShell);
if (selController)
{
*aSelCon = selController;
(*aSelCon)->AddRef();
return NS_OK;
}
}
return NS_ERROR_FAILURE;
*/
}
NS_IMETHODIMP nsEditorController::GetFrame(nsIGfxTextControlFrame **aFrame)
{
NS_ENSURE_ARG_POINTER(aFrame);

View File

@ -31,6 +31,7 @@
class nsIHTMLContent;
class nsIGfxTextControlFrame;
class nsIEditor;
class nsISelectionController;
class nsEditorController : public nsIController
{
@ -55,6 +56,7 @@ protected:
/** fetch the editor associated with mContent */
NS_IMETHOD GetEditor(nsIEditor ** aEditor);
NS_IMETHOD GetSelectionController(nsISelectionController ** aSelCon);
/** return PR_TRUE if the editor associated with mContent is enabled */
PRBool IsEnabled();
@ -67,6 +69,42 @@ protected:
nsString mDeleteString;
nsString mSelectAllString;
nsString mBeginLineString;
nsString mEndLineString ;
nsString mSelectBeginLineString;
nsString mSelectEndLineString ;
nsString mScrollTopString;
nsString mScrollBottomString;
nsString mMoveTopString ;
nsString mMoveBottomString;
nsString mSelectMoveTopString;
nsString mSelectMoveBottomString;
nsString mDownString;
nsString mUpString;
nsString mSelectDownString;
nsString mSelectUpString;
nsString mLeftString;
nsString mRightString;
nsString mSelectLeftString;
nsString mSelectRightString;
nsString mWordLeftString;
nsString mWordRightString;
nsString mSelectWordLeftString;
nsString mSelectWordRightString;
nsString mScrollPageUp;
nsString mScrollPageDown;
nsString mMovePageUp;
nsString mMovePageDown;
nsString mSelectMovePageUp;
nsString mSelectMovePageDown;
protected:
nsIHTMLContent* mContent; // weak reference, the content object owns this object
};

View File

@ -1,3 +1,4 @@
editorBindings.xul
inputBindings.xul
hiddenWindow.xul
globalOverlay.xul

View File

@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
DIRS = unix
EXPORT_RESOURCE_CONTENT = \
$(srcdir)/editorBindings.xul \
$(srcdir)/inputBindings.xul \
$(srcdir)/hiddenWindow.xul \
$(srcdir)/globalOverlay.xul \

View File

@ -0,0 +1,60 @@
<?xml version="1.0"?>
<window id="editorBindings"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
<key id="key_home" keycode="VK_HOME" shift="false"
onkeypress="
dump('trash1\n');
var controller =
document.commandDispatcher.getControllerForCommand('cmd_beginLine');
controller.doCommand('cmd_beginLine');"/>
<key id="key_home" keycode="VK_END" shift="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_endLine');
controller.doCommand('cmd_endLine');"/>
<key id="key_home" keycode="VK_LEFT" shift="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_charPrevious');
controller.doCommand('cmd_charPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_charNext');
controller.doCommand('cmd_charNext');"/>
<key id="key_home" keycode="VK_HOME" shift="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectBeginLine');
controller.doCommand('cmd_selectBeginLine');"/>
<key id="key_home" keycode="VK_END" shift="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectEndLine');
controller.doCommand('cmd_selectEndLine');"/>
<key id="key_home" keycode="VK_LEFT" shift="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectCharPrevious');
controller.doCommand('cmd_selectCharPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectCharNext');
controller.doCommand('cmd_selectCharNext');"/>
<key id="key_home" keycode="VK_PAGEUP" shift="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_scrollPageUp');
controller.doCommand('cmd_scrollPageUp');"/>
<key id="key_home" keycode="VK_PAGEDOWN" shift="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
controller.doCommand('cmd_scrollPageDown');"/>
</keyset>
</window>

View File

@ -1,9 +1,79 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<window id="inputBindings"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
</keyset>
</window>
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<keyset>
<key id="key_home" keycode="VK_HOME" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_beginLine');
controller.doCommand('cmd_beginLine');"/>
<key id="key_home" keycode="VK_END" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_endLine');
controller.doCommand('cmd_endLine');"/>
<key id="key_home" keycode="VK_LEFT" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_charPrevious');
controller.doCommand('cmd_charPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_charNext');
controller.doCommand('cmd_charNext');"/>
<key id="key_home" keycode="VK_HOME" shift="true" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectBeginLine');
controller.doCommand('cmd_selectBeginLine');"/>
<key id="key_home" keycode="VK_END" shift="true" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectEndLine');
controller.doCommand('cmd_selectEndLine');"/>
<key id="key_home" keycode="VK_LEFT" shift="true" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectCharPrevious');
controller.doCommand('cmd_selectCharPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="true" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectCharNext');
controller.doCommand('cmd_selectCharNext');"/>
<key id="key_home" keycode="VK_LEFT" shift="false" control="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_wordPrevious');
controller.doCommand('cmd_wordPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="false" control="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_wordNext');
controller.doCommand('cmd_wordNext');"/>
<key id="key_home" keycode="VK_LEFT" shift="true" control="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectWordPrevious');
controller.doCommand('cmd_wordPrevious');"/>
<key id="key_home" keycode="VK_RIGHT" shift="true" control="true"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_selectWordNext');
controller.doCommand('cmd_wordNext');"/>
<key id="key_home" keycode="VK_PAGEUP" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_scrollPageUp');
controller.doCommand('cmd_scrollPageUp');"/>
<key id="key_home" keycode="VK_PAGEDOWN" shift="false" control="false"
onkeypress="
var controller =
document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
controller.doCommand('cmd_scrollPageDown');"/>
</keyset>
</window>

View File

@ -28,6 +28,7 @@ include <$(DEPTH)\config\rules.mak>
DISTBROWSER=$(DIST)\bin\chrome\global\content\default
install::
$(MAKE_INSTALL) editorBindings.xul $(DISTBROWSER)
$(MAKE_INSTALL) inputBindings.xul $(DISTBROWSER)
$(MAKE_INSTALL) hiddenWindow.xul $(DISTBROWSER)
$(MAKE_INSTALL) globalOverlay.xul $(DISTBROWSER)