adding in nsEditorController to makesystem. adding in registration to allow someone to get an editorcontroller from the outside. also change editor shell to register a controller to handle keyboard navigation.

git-svn-id: svn://10.0.0.236/trunk@56025 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mjudge%netscape.com
1999-12-15 03:46:27 +00:00
parent 35eb4286a1
commit 212f24a709
9 changed files with 69 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ IS_COMPONENT = 1
CPPSRCS = \
nsEditor.cpp \
nsEditorController.cpp \
nsEditorUtils.cpp \
nsEditorRegistration.cpp \
nsTextEditRules.cpp \

View File

@@ -27,6 +27,7 @@ LIBRARY_NAME=ender
CPPSRCS = \
nsEditor.cpp \
nsEditorController.cpp \
nsEditorUtils.cpp \
nsEditorRegistration.cpp \
nsTextEditRules.cpp \
@@ -61,6 +62,7 @@ CPPSRCS = \
CPP_OBJS = \
.\$(OBJDIR)\nsEditor.obj \
.\$(OBJDIR)\nsEditorController.obj \
.\$(OBJDIR)\nsEditorUtils.obj \
.\$(OBJDIR)\nsEditorRegistration.obj \
.\$(OBJDIR)\nsTextEditRules.obj \

View File

@@ -25,6 +25,8 @@
#include "nsEditorCID.h"
#include "nsEditorShell.h" // for the CID
#include "nsEditor.h" // for gInstanceCount
#include "nsEditorController.h" //CID
////////////////////////////////////////////////////////////////////////
// Define the contructor function for the objects
@@ -33,6 +35,7 @@
//
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorShell)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorController)
#ifdef ENABLE_EDITOR_API_LOG
#include "nsHTMLEditorLog.h"
@@ -54,6 +57,8 @@ static nsModuleComponentInfo components[] = {
{ "HTML Editor", NS_HTMLEDITOR_CID,
"component://netscape/editor/htmleditor", nsHTMLEditorConstructor, },
#endif
{ "Editor Shell Controller", NS_EDITORCONTROLLER_CID,
"component://netscape/editor/editorcontroller", nsEditorControllerConstructor, },
{ "Editor Shell Component", NS_EDITORSHELL_CID,
"component://netscape/editor/editorshell", nsEditorShellConstructor, },
{ "Editor Shell Spell Checker", NS_EDITORSHELL_CID,

View File

@@ -75,6 +75,11 @@
#include "nsIPrompt.h"
#include "nsICommonDialogs.h"
#include "nsIEditorController.h"
#include "nsEditorController.h"
#include "nsIControllers.h"
///////////////////////////////////////
// Editor Includes
///////////////////////////////////////
@@ -117,6 +122,8 @@ static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kEditorControllerCID, NS_EDITORCONTROLLER_CID);
/* Define Interface IDs */
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@@ -328,6 +335,26 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
rv = editor->AddDocumentStateListener(mStateMaintainer);
if (NS_FAILED(rv)) return rv;
if (NS_SUCCEEDED(rv) && mContentWindow)
{
nsCOMPtr<nsIController> controller;
nsCOMPtr<nsIControllers> controllers;
rv = nsComponentManager::CreateInstance(kEditorControllerCID, nsnull, nsIController::GetIID(), getter_AddRefs(controller));
if (NS_SUCCEEDED(rv) && controller)
{
rv = mContentWindow->GetControllers(getter_AddRefs(controllers));
if (NS_SUCCEEDED(rv) && controllers)
{
nsCOMPtr<nsIEditorController> ieditcontroller = do_QueryInterface(controller);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
ieditcontroller->SetEditor(editor);//weak link
rv = controllers->InsertControllerAt(0,controller);
}
}
}
// now all the listeners are set up, we can call PostCreate
rv = editor->PostCreate();
if (NS_FAILED(rv)) return rv;
@@ -3585,7 +3612,6 @@ nsEditorShell::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel,
res = PrepareDocumentForEditing(aUrl);
SetChromeAttribute( mWebShell, "Editor:Throbber", "busy", "false" );
}
return res;
}

View File

@@ -75,6 +75,11 @@
#include "nsIPrompt.h"
#include "nsICommonDialogs.h"
#include "nsIEditorController.h"
#include "nsEditorController.h"
#include "nsIControllers.h"
///////////////////////////////////////
// Editor Includes
///////////////////////////////////////
@@ -117,6 +122,8 @@ static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
static NS_DEFINE_CID(kEditorControllerCID, NS_EDITORCONTROLLER_CID);
/* Define Interface IDs */
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@@ -328,6 +335,26 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
rv = editor->AddDocumentStateListener(mStateMaintainer);
if (NS_FAILED(rv)) return rv;
if (NS_SUCCEEDED(rv) && mContentWindow)
{
nsCOMPtr<nsIController> controller;
nsCOMPtr<nsIControllers> controllers;
rv = nsComponentManager::CreateInstance(kEditorControllerCID, nsnull, nsIController::GetIID(), getter_AddRefs(controller));
if (NS_SUCCEEDED(rv) && controller)
{
rv = mContentWindow->GetControllers(getter_AddRefs(controllers));
if (NS_SUCCEEDED(rv) && controllers)
{
nsCOMPtr<nsIEditorController> ieditcontroller = do_QueryInterface(controller);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
ieditcontroller->SetEditor(editor);//weak link
rv = controllers->InsertControllerAt(0,controller);
}
}
}
// now all the listeners are set up, we can call PostCreate
rv = editor->PostCreate();
if (NS_FAILED(rv)) return rv;
@@ -3585,7 +3612,6 @@ nsEditorShell::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel* channel,
res = PrepareDocumentForEditing(aUrl);
SetChromeAttribute( mWebShell, "Editor:Throbber", "busy", "false" );
}
return res;
}

View File

@@ -25,6 +25,8 @@
#include "nsEditorCID.h"
#include "nsEditorShell.h" // for the CID
#include "nsEditor.h" // for gInstanceCount
#include "nsEditorController.h" //CID
////////////////////////////////////////////////////////////////////////
// Define the contructor function for the objects
@@ -33,6 +35,7 @@
//
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorShell)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEditorController)
#ifdef ENABLE_EDITOR_API_LOG
#include "nsHTMLEditorLog.h"
@@ -54,6 +57,8 @@ static nsModuleComponentInfo components[] = {
{ "HTML Editor", NS_HTMLEDITOR_CID,
"component://netscape/editor/htmleditor", nsHTMLEditorConstructor, },
#endif
{ "Editor Shell Controller", NS_EDITORCONTROLLER_CID,
"component://netscape/editor/editorcontroller", nsEditorControllerConstructor, },
{ "Editor Shell Component", NS_EDITORSHELL_CID,
"component://netscape/editor/editorshell", nsEditorShellConstructor, },
{ "Editor Shell Spell Checker", NS_EDITORSHELL_CID,

Binary file not shown.

View File

@@ -32,6 +32,7 @@ EXPORTS = \
nsIEditActionListener.h \
nsIEditor.h \
nsEditorCID.h \
nsIEditorController.h \
nsICiter.h \
nsIEditorIMESupport.h \
nsIEditorLogging.h \

View File

@@ -25,6 +25,7 @@ DEPTH=..\..
EXPORTS = \
nsIEditActionListener.h \
nsIEditor.h \
nsIEditorController.h \
nsEditorCID.h \
nsICiter.h \
nsIEditorIMESupport.h \