mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-12 02:50:13 +00:00
massive changes a=jar.hoffman, r=akkana
This commit is contained in:
parent
14a871afc2
commit
b51f84b3de
@ -74,6 +74,21 @@ interface nsISelectionController : nsISupports
|
|||||||
*/
|
*/
|
||||||
void pageMove(in boolean aForward, in boolean aExtend);
|
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.
|
/** ScrollPage will scroll the page without affecting the selection.
|
||||||
* @param aForward scroll forward or backwards in selection
|
* @param aForward scroll forward or backwards in selection
|
||||||
*/
|
*/
|
||||||
|
@ -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(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
|
||||||
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_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;
|
nsIFrame * gCurrentlyFocusedTargetFrame = 0;
|
||||||
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
|
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
|
||||||
|
|
||||||
@ -714,6 +717,9 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||||||
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
|
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
|
||||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
break;
|
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_DOWN:
|
||||||
case NS_VK_PAGE_UP:
|
case NS_VK_PAGE_UP:
|
||||||
if (!mCurrentFocus) {
|
if (!mCurrentFocus) {
|
||||||
@ -775,6 +781,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif //NON_KEYBINDING
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
|
|
||||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||||
<!-- scroll document/page/line and move caret -->
|
<!-- scroll document/page/line and move caret -->
|
||||||
|
<!--
|
||||||
<key id="homekb" keycode="VK_HOME" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
<key id="homekb" keycode="VK_HOME" onkeypress="EditorMoveToTopOfWindow( true, false )" />
|
||||||
<key id="endkb" keycode="VK_END" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
<key id="endkb" keycode="VK_END" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||||
<key id="pageupkb" keycode="VK_PAGE_UP" onkeypress="EditorMoveUpPage( 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="endoflinekb" keycode="VK_RIGHT" xulkey="true" onkeypress="EditorEndOfLine( false )" />
|
||||||
<key id="uphomekb" keycode="VK_UP" xulkey="true" onkeypress="EditorMoveToTopOfWindow( true, 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 )" />
|
<key id="downendkb" keycode="VK_DOWN" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||||
|
-->
|
||||||
<!-- scroll document/page/line and extend selection -->
|
<!-- scroll document/page/line and extend selection -->
|
||||||
|
<!--
|
||||||
<key id="homeextendkb" keycode="VK_HOME" shift="true" onkeypress="EditorMoveToTopOfWindow( true, true )" />
|
<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="endextendkb" keycode="VK_END" shift="true" onkeypress="EditorMoveToBottomOfWindow( true, true )" />
|
||||||
<key id="pageupextendkb" keycode="VK_PAGE_UP" shift="true" onkeypress="EditorMoveUpPage( 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="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="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 )" />
|
<key id="downendextendkb" keycode="VK_DOWN" shift="true" xulkey="true" onkeypress="EditorMoveToBottomOfWindow( true, false )" />
|
||||||
|
-->
|
||||||
<!-- move caret by one character -->
|
<!-- move caret by one character -->
|
||||||
|
<!--
|
||||||
<key id="leftkb" keycode="VK_LEFT" onkeypress="EditorPreviousCharacter( false )" />
|
<key id="leftkb" keycode="VK_LEFT" onkeypress="EditorPreviousCharacter( false )" />
|
||||||
<key id="rightkb" keycode="VK_RIGHT" onkeypress="EditorNextCharacter( false )" />
|
<key id="rightkb" keycode="VK_RIGHT" onkeypress="EditorNextCharacter( false )" />
|
||||||
<key id="upkb" keycode="VK_UP" onkeypress="EditorPreviousRow( false )" />
|
<key id="upkb" keycode="VK_UP" onkeypress="EditorPreviousRow( false )" />
|
||||||
<key id="downkb" keycode="VK_DOWN" onkeypress="EditorNextRow( false )" />
|
<key id="downkb" keycode="VK_DOWN" onkeypress="EditorNextRow( false )" />
|
||||||
|
-->
|
||||||
<!-- move caret by one character/row and extend selection -->
|
<!-- move caret by one character/row and extend selection -->
|
||||||
|
<!--
|
||||||
<key id="prevcharextendkb" keycode="VK_LEFT" shift="true" onkeypress="EditorPreviousCharacter( true )" />
|
<key id="prevcharextendkb" keycode="VK_LEFT" shift="true" onkeypress="EditorPreviousCharacter( true )" />
|
||||||
<key id="nextcharextendkb" keycode="VK_RIGHT" shift="true" onkeypress="EditorNextCharacter( 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="prevrowextendkb" keycode="VK_UP" shift="true" onkeypress="EditorPreviousRow( true )" />
|
||||||
<key id="nextrowextendkb" keycode="VK_DOWN" shift="true" onkeypress="EditorNextRow( true )" />
|
<key id="nextrowextendkb" keycode="VK_DOWN" shift="true" onkeypress="EditorNextRow( true )" />
|
||||||
|
-->
|
||||||
<!-- move caret by one word/paragraph -->
|
<!-- move caret by one word/paragraph -->
|
||||||
|
<!--
|
||||||
<key id="prevwordkb" keycode="VK_LEFT" alt="true" onkeypress="EditorPreviousWord( false )" />
|
<key id="prevwordkb" keycode="VK_LEFT" alt="true" onkeypress="EditorPreviousWord( false )" />
|
||||||
<key id="nextwordkb" keycode="VK_RIGHT" alt="true" onkeypress="EditorNextWord( 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="prevparakb" keycode="VK_UP" alt="true" onkeypress="EditorBeginningOfParagraph( false )" />
|
||||||
<key id="nextparakb" keycode="VK_DOWN" alt="true" onkeypress="EditorEndOfParagraph( false )" />
|
<key id="nextparakb" keycode="VK_DOWN" alt="true" onkeypress="EditorEndOfParagraph( false )" />
|
||||||
|
-->
|
||||||
<!-- move caret by one word and extend selection -->
|
<!-- move caret by one word and extend selection -->
|
||||||
|
<!--
|
||||||
<key id="prevwordextendkb" keycode="VK_LEFT" shift="true" alt="true" onkeypress="EditorPreviousWord( true )" />
|
<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="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="prevparaextendkb" keycode="VK_UP" shift="true" alt="true" onkeypress="EditorBeginningOfParagraph( true )" />
|
||||||
<key id="nextparaextendkb" keycode="VK_DOWN" shift="true" alt="true" onkeypress="EditorEndOfParagraph( true )" />
|
<key id="nextparaextendkb" keycode="VK_DOWN" shift="true" alt="true" onkeypress="EditorEndOfParagraph( true )" />
|
||||||
|
-->
|
||||||
</keyset>
|
</keyset>
|
||||||
|
|
||||||
<broadcasterset id="broadcasterset">
|
<broadcasterset id="broadcasterset">
|
||||||
|
@ -224,6 +224,38 @@ public:
|
|||||||
*/
|
*/
|
||||||
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame)=0;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,6 +378,8 @@ public:
|
|||||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
|
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD ScrollPage(PRBool aForward);
|
NS_IMETHOD ScrollPage(PRBool aForward);
|
||||||
|
NS_IMETHOD CompleteScroll(PRBool aForward);
|
||||||
|
NS_IMETHOD CompleteMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD SelectAll();
|
NS_IMETHOD SelectAll();
|
||||||
|
|
||||||
// nsIDocumentObserver
|
// nsIDocumentObserver
|
||||||
@ -1321,35 +1323,69 @@ NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
|
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->CharacterMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::WordMove(PRBool aForward, PRBool aExtend)
|
PresShell::WordMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->WordMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::LineMove(PRBool aForward, PRBool aExtend)
|
PresShell::LineMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->LineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
|
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->IntraLineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::PageMove(PRBool aForward, PRBool aExtend)
|
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
|
NS_IMETHODIMP
|
||||||
PresShell::ScrollPage(PRBool aForward)
|
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;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -1357,7 +1393,7 @@ PresShell::ScrollPage(PRBool aForward)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::SelectAll()
|
PresShell::SelectAll()
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
//end implementations nsISelectionController
|
//end implementations nsISelectionController
|
||||||
@ -2510,14 +2546,14 @@ PresShell::HandleEvent(nsIView *aView,
|
|||||||
aView->GetClientData(clientData);
|
aView->GetClientData(clientData);
|
||||||
frame = (nsIFrame *)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
|
{//KEY HANDLERS WILL GET RID OF THIS
|
||||||
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
|
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (nsnull != frame) {
|
if (nsnull != frame) {
|
||||||
PushCurrentEventFrame();
|
PushCurrentEventFrame();
|
||||||
|
|
||||||
|
@ -224,6 +224,38 @@ public:
|
|||||||
*/
|
*/
|
||||||
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame)=0;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +74,21 @@ interface nsISelectionController : nsISupports
|
|||||||
*/
|
*/
|
||||||
void pageMove(in boolean aForward, in boolean aExtend);
|
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.
|
/** ScrollPage will scroll the page without affecting the selection.
|
||||||
* @param aForward scroll forward or backwards in selection
|
* @param aForward scroll forward or backwards in selection
|
||||||
*/
|
*/
|
||||||
|
@ -226,7 +226,12 @@ public:
|
|||||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
|
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
|
||||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
|
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
|
||||||
NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame);
|
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 */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
void ResizeBuffer(PRUint32 aNewBufSize);
|
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
|
nscoord FetchDesiredX(); //the x position requested by the Key Handling for up down
|
||||||
void InvalidateDesiredX(); //do not listen to mDesiredX you must get another.
|
void InvalidateDesiredX(); //do not listen to mDesiredX you must get another.
|
||||||
@ -1111,46 +1118,16 @@ nsRangeList::HandleTextEvent(nsGUIEvent *aGUIEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
nsresult
|
||||||
/** This raises a question, if this method is called and the aFrame does not reflect the current
|
nsRangeList::MoveCaret(PRUint32 aKeycode, PRBool aContinue, nsSelectionAmount aAmount)
|
||||||
* focus DomNode, it is invalid? The answer now is yes.
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
|
|
||||||
{
|
{
|
||||||
if (!aGuiEvent)
|
nsCOMPtr<nsIPresContext> context;
|
||||||
return NS_ERROR_NULL_POINTER;
|
nsresult result = mTracker->GetPresContext(getter_AddRefs(context));
|
||||||
STATUS_CHECK_RETURN_MACRO();
|
if (NS_FAILED(result) || !context)
|
||||||
|
return result?result:NS_ERROR_FAILURE;
|
||||||
nsresult result = NS_ERROR_FAILURE;
|
|
||||||
if (NS_KEY_PRESS == aGuiEvent->message) {
|
|
||||||
nsKeyEvent *keyEvent = (nsKeyEvent *)aGuiEvent; //this is ok. It really is a keyevent
|
|
||||||
switch (keyEvent->keyCode)
|
|
||||||
{
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_LEFT :
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_UP :
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_DOWN :
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_RIGHT :
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_HOME :
|
|
||||||
case nsIDOMKeyEvent::DOM_VK_END :
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//XXX Need xp way get platfrom specific behavior into key navigation.
|
|
||||||
//XXX This really shouldn't have to use an ifdef
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (keyEvent->isAlt) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> weakNodeUsed;
|
nsCOMPtr<nsIDOMNode> weakNodeUsed;
|
||||||
PRInt32 offsetused = 0;
|
PRInt32 offsetused = 0;
|
||||||
nsSelectionAmount amount = eSelectCharacter;
|
|
||||||
if (keyEvent->isControl)
|
|
||||||
amount = eSelectWord;
|
|
||||||
|
|
||||||
PRBool isCollapsed;
|
PRBool isCollapsed;
|
||||||
nscoord desiredX; //we must keep this around and revalidate it when its just UP/DOWN
|
nscoord desiredX; //we must keep this around and revalidate it when its just UP/DOWN
|
||||||
@ -1158,14 +1135,14 @@ nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
|
|||||||
result = mDomSelections[SELECTION_NORMAL]->GetIsCollapsed(&isCollapsed);
|
result = mDomSelections[SELECTION_NORMAL]->GetIsCollapsed(&isCollapsed);
|
||||||
if (NS_FAILED(result))
|
if (NS_FAILED(result))
|
||||||
return result;
|
return result;
|
||||||
if (keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_UP || keyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_DOWN)
|
if (aKeycode == nsIDOMKeyEvent::DOM_VK_UP || aKeycode == nsIDOMKeyEvent::DOM_VK_DOWN)
|
||||||
{
|
{
|
||||||
desiredX= FetchDesiredX();
|
desiredX= FetchDesiredX();
|
||||||
SetDesiredX(desiredX);
|
SetDesiredX(desiredX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCollapsed && !keyEvent->isShift) {
|
if (!isCollapsed && !aContinue) {
|
||||||
switch (keyEvent->keyCode){
|
switch (aKeycode){
|
||||||
case nsIDOMKeyEvent::DOM_VK_LEFT :
|
case nsIDOMKeyEvent::DOM_VK_LEFT :
|
||||||
case nsIDOMKeyEvent::DOM_VK_UP : {
|
case nsIDOMKeyEvent::DOM_VK_UP : {
|
||||||
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
|
if ((mDomSelections[SELECTION_NORMAL]->GetDirection() == eDirPrevious)) { //f,a
|
||||||
@ -1206,8 +1183,8 @@ nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
|
|||||||
if (NS_FAILED(result))
|
if (NS_FAILED(result))
|
||||||
return result;
|
return result;
|
||||||
nsPeekOffsetStruct pos;
|
nsPeekOffsetStruct pos;
|
||||||
pos.SetData(mTracker, desiredX, amount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
pos.SetData(mTracker, desiredX, aAmount, eDirPrevious, offsetused, PR_FALSE,PR_TRUE, PR_TRUE);
|
||||||
switch (keyEvent->keyCode){
|
switch (aKeycode){
|
||||||
case nsIDOMKeyEvent::DOM_VK_RIGHT :
|
case nsIDOMKeyEvent::DOM_VK_RIGHT :
|
||||||
InvalidateDesiredX();
|
InvalidateDesiredX();
|
||||||
pos.mDirection = eDirNext;
|
pos.mDirection = eDirNext;
|
||||||
@ -1239,14 +1216,56 @@ nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
|
|||||||
default :return NS_ERROR_FAILURE;
|
default :return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
pos.mPreferLeft = mHint;
|
pos.mPreferLeft = mHint;
|
||||||
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(aPresContext, &pos)) && pos.mResultContent)
|
if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(context, &pos)) && pos.mResultContent)
|
||||||
{
|
{
|
||||||
mHint = (HINT)pos.mPreferLeft;
|
mHint = (HINT)pos.mPreferLeft;
|
||||||
result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, keyEvent->isShift, PR_FALSE);
|
result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, aContinue, PR_FALSE);
|
||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(result))
|
if (NS_SUCCEEDED(result))
|
||||||
result = mDomSelections[SELECTION_NORMAL]->ScrollIntoView();
|
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.
|
||||||
|
*/
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent)
|
||||||
|
{
|
||||||
|
if (!aGuiEvent)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
STATUS_CHECK_RETURN_MACRO();
|
||||||
|
|
||||||
|
nsresult result = NS_ERROR_FAILURE;
|
||||||
|
if (NS_KEY_PRESS == aGuiEvent->message) {
|
||||||
|
nsKeyEvent *keyEvent = (nsKeyEvent *)aGuiEvent; //this is ok. It really is a keyevent
|
||||||
|
switch (keyEvent->keyCode)
|
||||||
|
{
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_LEFT :
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_UP :
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_DOWN :
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_RIGHT :
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_HOME :
|
||||||
|
case nsIDOMKeyEvent::DOM_VK_END :
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//XXX Need xp way get platfrom specific behavior into key navigation.
|
||||||
|
//XXX This really shouldn't have to use an ifdef
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (keyEvent->isAlt) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
nsSelectionAmount amount = eSelectCharacter;
|
||||||
|
if (keyEvent->isControl)
|
||||||
|
amount = eSelectWord;
|
||||||
|
return MoveCaret(keyEvent->keyCode, keyEvent->isShift, amount);
|
||||||
}
|
}
|
||||||
return result;
|
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
|
//////////END FRAMESELECTION
|
||||||
NS_METHOD
|
NS_METHOD
|
||||||
|
@ -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(kIFocusableContentIID, NS_IFOCUSABLECONTENT_IID);
|
||||||
static NS_DEFINE_IID(kIScrollableViewIID, NS_ISCROLLABLEVIEW_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;
|
nsIFrame * gCurrentlyFocusedTargetFrame = 0;
|
||||||
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
|
nsIContent * gCurrentlyFocusedContent = 0; // Weak because it mirrors the strong mCurrentFocus
|
||||||
|
|
||||||
@ -714,6 +717,9 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||||||
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
|
ShiftFocus(!((nsInputEvent*)aEvent)->isShift);
|
||||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
break;
|
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_DOWN:
|
||||||
case NS_VK_PAGE_UP:
|
case NS_VK_PAGE_UP:
|
||||||
if (!mCurrentFocus) {
|
if (!mCurrentFocus) {
|
||||||
@ -775,6 +781,7 @@ nsEventStateManager::PostHandleEvent(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif //NON_KEYBINDING
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,6 +378,8 @@ public:
|
|||||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
|
NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD ScrollPage(PRBool aForward);
|
NS_IMETHOD ScrollPage(PRBool aForward);
|
||||||
|
NS_IMETHOD CompleteScroll(PRBool aForward);
|
||||||
|
NS_IMETHOD CompleteMove(PRBool aForward, PRBool aExtend);
|
||||||
NS_IMETHOD SelectAll();
|
NS_IMETHOD SelectAll();
|
||||||
|
|
||||||
// nsIDocumentObserver
|
// nsIDocumentObserver
|
||||||
@ -1321,35 +1323,69 @@ NS_IMETHODIMP PresShell::GetDisplayNonTextSelection(PRBool *aOutEnable)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
|
PresShell::CharacterMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->CharacterMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::WordMove(PRBool aForward, PRBool aExtend)
|
PresShell::WordMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->WordMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::LineMove(PRBool aForward, PRBool aExtend)
|
PresShell::LineMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->LineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
|
PresShell::IntraLineMove(PRBool aForward, PRBool aExtend)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->IntraLineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::PageMove(PRBool aForward, PRBool aExtend)
|
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
|
NS_IMETHODIMP
|
||||||
PresShell::ScrollPage(PRBool aForward)
|
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;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -1357,7 +1393,7 @@ PresShell::ScrollPage(PRBool aForward)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::SelectAll()
|
PresShell::SelectAll()
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return mSelection->SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
//end implementations nsISelectionController
|
//end implementations nsISelectionController
|
||||||
@ -2510,14 +2546,14 @@ PresShell::HandleEvent(nsIView *aView,
|
|||||||
aView->GetClientData(clientData);
|
aView->GetClientData(clientData);
|
||||||
frame = (nsIFrame *)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
|
{//KEY HANDLERS WILL GET RID OF THIS
|
||||||
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
|
if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent)))
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (nsnull != frame) {
|
if (nsnull != frame) {
|
||||||
PushCurrentEventFrame();
|
PushCurrentEventFrame();
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsIDOMSelection.h"
|
#include "nsIDOMSelection.h"
|
||||||
|
|
||||||
|
#include "nsISelectionController.h"
|
||||||
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIHTMLContent.h"
|
||||||
|
#include "nsIPresShell.h"
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsEditorController)
|
NS_IMPL_ADDREF(nsEditorController)
|
||||||
NS_IMPL_RELEASE(nsEditorController)
|
NS_IMPL_RELEASE(nsEditorController)
|
||||||
|
|
||||||
@ -43,6 +48,43 @@ nsEditorController::nsEditorController()
|
|||||||
mPasteString = "cmd_paste";
|
mPasteString = "cmd_paste";
|
||||||
mDeleteString = "cmd_delete";
|
mDeleteString = "cmd_delete";
|
||||||
mSelectAllString = "cmd_selectAll";
|
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()
|
nsEditorController::~nsEditorController()
|
||||||
@ -151,7 +193,35 @@ NS_IMETHODIMP nsEditorController::SupportsCommand(const PRUnichar *aCommand, PRB
|
|||||||
(PR_TRUE==mCopyString.Equals(aCommand)) ||
|
(PR_TRUE==mCopyString.Equals(aCommand)) ||
|
||||||
(PR_TRUE==mPasteString.Equals(aCommand)) ||
|
(PR_TRUE==mPasteString.Equals(aCommand)) ||
|
||||||
(PR_TRUE==mDeleteString.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;
|
*aResult = PR_TRUE;
|
||||||
@ -164,6 +234,7 @@ NS_IMETHODIMP nsEditorController::DoCommand(const PRUnichar *aCommand)
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCommand);
|
NS_ENSURE_ARG_POINTER(aCommand);
|
||||||
nsCOMPtr<nsIEditor> editor;
|
nsCOMPtr<nsIEditor> editor;
|
||||||
|
nsCOMPtr<nsISelectionController> selCont;
|
||||||
NS_ENSURE_SUCCESS(GetEditor(getter_AddRefs(editor)), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetEditor(getter_AddRefs(editor)), NS_ERROR_FAILURE);
|
||||||
if (!editor)
|
if (!editor)
|
||||||
{ // Q: What does it mean if there is no 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);
|
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);
|
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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,6 +436,51 @@ NS_IMETHODIMP nsEditorController::GetEditor(nsIEditor ** aEditor)
|
|||||||
return NS_OK;
|
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_IMETHODIMP nsEditorController::GetFrame(nsIGfxTextControlFrame **aFrame)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aFrame);
|
NS_ENSURE_ARG_POINTER(aFrame);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
class nsIHTMLContent;
|
class nsIHTMLContent;
|
||||||
class nsIGfxTextControlFrame;
|
class nsIGfxTextControlFrame;
|
||||||
class nsIEditor;
|
class nsIEditor;
|
||||||
|
class nsISelectionController;
|
||||||
|
|
||||||
class nsEditorController : public nsIController
|
class nsEditorController : public nsIController
|
||||||
{
|
{
|
||||||
@ -55,6 +56,7 @@ protected:
|
|||||||
/** fetch the editor associated with mContent */
|
/** fetch the editor associated with mContent */
|
||||||
NS_IMETHOD GetEditor(nsIEditor ** aEditor);
|
NS_IMETHOD GetEditor(nsIEditor ** aEditor);
|
||||||
|
|
||||||
|
NS_IMETHOD GetSelectionController(nsISelectionController ** aSelCon);
|
||||||
/** return PR_TRUE if the editor associated with mContent is enabled */
|
/** return PR_TRUE if the editor associated with mContent is enabled */
|
||||||
PRBool IsEnabled();
|
PRBool IsEnabled();
|
||||||
|
|
||||||
@ -67,6 +69,42 @@ protected:
|
|||||||
nsString mDeleteString;
|
nsString mDeleteString;
|
||||||
nsString mSelectAllString;
|
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:
|
protected:
|
||||||
nsIHTMLContent* mContent; // weak reference, the content object owns this object
|
nsIHTMLContent* mContent; // weak reference, the content object owns this object
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
editorBindings.xul
|
||||||
inputBindings.xul
|
inputBindings.xul
|
||||||
hiddenWindow.xul
|
hiddenWindow.xul
|
||||||
globalOverlay.xul
|
globalOverlay.xul
|
||||||
|
@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||||||
DIRS = unix
|
DIRS = unix
|
||||||
|
|
||||||
EXPORT_RESOURCE_CONTENT = \
|
EXPORT_RESOURCE_CONTENT = \
|
||||||
|
$(srcdir)/editorBindings.xul \
|
||||||
$(srcdir)/inputBindings.xul \
|
$(srcdir)/inputBindings.xul \
|
||||||
$(srcdir)/hiddenWindow.xul \
|
$(srcdir)/hiddenWindow.xul \
|
||||||
$(srcdir)/globalOverlay.xul \
|
$(srcdir)/globalOverlay.xul \
|
||||||
|
60
xpfe/global/resources/content/editorBindings.xul
Normal file
60
xpfe/global/resources/content/editorBindings.xul
Normal 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>
|
@ -3,7 +3,77 @@
|
|||||||
<window id="inputBindings"
|
<window id="inputBindings"
|
||||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
|
||||||
<keyset>
|
<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>
|
</keyset>
|
||||||
</window>
|
</window>
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ include <$(DEPTH)\config\rules.mak>
|
|||||||
DISTBROWSER=$(DIST)\bin\chrome\global\content\default
|
DISTBROWSER=$(DIST)\bin\chrome\global\content\default
|
||||||
|
|
||||||
install::
|
install::
|
||||||
|
$(MAKE_INSTALL) editorBindings.xul $(DISTBROWSER)
|
||||||
$(MAKE_INSTALL) inputBindings.xul $(DISTBROWSER)
|
$(MAKE_INSTALL) inputBindings.xul $(DISTBROWSER)
|
||||||
$(MAKE_INSTALL) hiddenWindow.xul $(DISTBROWSER)
|
$(MAKE_INSTALL) hiddenWindow.xul $(DISTBROWSER)
|
||||||
$(MAKE_INSTALL) globalOverlay.xul $(DISTBROWSER)
|
$(MAKE_INSTALL) globalOverlay.xul $(DISTBROWSER)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user