From dea2088bcb56d66e19c194ebb07e385d50c374b4 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Mon, 8 Mar 1999 22:46:33 +0000 Subject: [PATCH] Fixed editor classes to do autoregistration correctly and moved target directory to bin/components git-svn-id: svn://10.0.0.236/trunk@23216 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/makefile.win | 2 +- mozilla/editor/base/nsEditor.cpp | 33 +++++++++++++++++-- mozilla/editor/base/nsTextEditFactory.cpp | 7 ---- mozilla/editor/guimgr/src/makefile.win | 2 +- .../editor/guimgr/src/nsGuiManagerFactory.cpp | 12 +++++++ mozilla/editor/libeditor/base/nsEditor.cpp | 33 +++++++++++++++++-- mozilla/editor/txmgr/src/makefile.win | 2 +- 7 files changed, 75 insertions(+), 16 deletions(-) diff --git a/mozilla/editor/base/makefile.win b/mozilla/editor/base/makefile.win index 51576d5e0fd..29a9d54603f 100644 --- a/mozilla/editor/base/makefile.win +++ b/mozilla/editor/base/makefile.win @@ -122,7 +122,7 @@ LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib include <$(DEPTH)\config\rules.mak> libs:: $(DLL) - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib clobber:: diff --git a/mozilla/editor/base/nsEditor.cpp b/mozilla/editor/base/nsEditor.cpp index 473abf53054..b28deed9f8c 100644 --- a/mozilla/editor/base/nsEditor.cpp +++ b/mozilla/editor/base/nsEditor.cpp @@ -67,6 +67,8 @@ static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); static NS_DEFINE_IID(kIPresShellIID, NS_IPRESSHELL_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID); +static NS_DEFINE_IID(kITextEditFactoryIID, NS_ITEXTEDITORFACTORY_IID); +static NS_DEFINE_IID(kIHTMLEditFactoryIID, NS_IHTMLEDITORFACTORY_IID); static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID); static NS_DEFINE_IID(kIEditorSupportIID, NS_IEDITORSUPPORT_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -168,14 +170,39 @@ NSCanUnload(nsISupports* serviceMgr) extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path) { - return nsRepository::RegisterComponent(kIEditFactoryIID, NULL, NULL, path, - PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll. + nsresult result = NS_ERROR_UNEXPECTED; + //this will register the editor classes with the xpcom dll. + result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::RegisterComponent(kHTMLEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + } + } + return result; } extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path) { - return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll. + nsresult result = NS_ERROR_UNEXPECTED; + result = nsRepository::UnregisterFactory(kIEditFactoryIID, path); + + + if (NS_SUCCEEDED(result)) + { + result = nsRepository::UnregisterFactory(kITextEditFactoryIID, path); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::UnregisterFactory(kIHTMLEditFactoryIID, path); + } + } + return result; } //END EXPORTS diff --git a/mozilla/editor/base/nsTextEditFactory.cpp b/mozilla/editor/base/nsTextEditFactory.cpp index 2a9242d3011..725a1974706 100644 --- a/mozilla/editor/base/nsTextEditFactory.cpp +++ b/mozilla/editor/base/nsTextEditFactory.cpp @@ -125,10 +125,3 @@ nsTextEditFactory::~nsTextEditFactory() { //nsRepository::UnregisterFactory(mCID, (nsIFactory *)this); //we are out of ref counts anyway } - - - - - - - diff --git a/mozilla/editor/guimgr/src/makefile.win b/mozilla/editor/guimgr/src/makefile.win index 5b48bce8f76..b769e1d17cc 100644 --- a/mozilla/editor/guimgr/src/makefile.win +++ b/mozilla/editor/guimgr/src/makefile.win @@ -60,7 +60,7 @@ LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib include <$(DEPTH)\config\rules.mak> libs:: $(DLL) - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib clobber:: diff --git a/mozilla/editor/guimgr/src/nsGuiManagerFactory.cpp b/mozilla/editor/guimgr/src/nsGuiManagerFactory.cpp index 3187e9064ee..7018a05c01c 100644 --- a/mozilla/editor/guimgr/src/nsGuiManagerFactory.cpp +++ b/mozilla/editor/guimgr/src/nsGuiManagerFactory.cpp @@ -121,3 +121,15 @@ nsGuiManagerFactory::~nsGuiManagerFactory() { nsRepository::UnregisterFactory(kIGuiManagerFactoryIID, (nsIFactory *)this); //we are out of ref counts anyway } + +extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path) +{ + return nsRepository::RegisterComponent(kIGuiManagerFactoryIID, + NULL, NULL, path, + PR_TRUE, PR_TRUE); +} + +extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path) +{ + return nsRepository::UnregisterFactory(kIGuiManagerFactoryIID, path); +} diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index 473abf53054..b28deed9f8c 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -67,6 +67,8 @@ static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID); static NS_DEFINE_IID(kIPresShellIID, NS_IPRESSHELL_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kIEditFactoryIID, NS_IEDITORFACTORY_IID); +static NS_DEFINE_IID(kITextEditFactoryIID, NS_ITEXTEDITORFACTORY_IID); +static NS_DEFINE_IID(kIHTMLEditFactoryIID, NS_IHTMLEDITORFACTORY_IID); static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID); static NS_DEFINE_IID(kIEditorSupportIID, NS_IEDITORSUPPORT_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -168,14 +170,39 @@ NSCanUnload(nsISupports* serviceMgr) extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path) { - return nsRepository::RegisterComponent(kIEditFactoryIID, NULL, NULL, path, - PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll. + nsresult result = NS_ERROR_UNEXPECTED; + //this will register the editor classes with the xpcom dll. + result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::RegisterComponent(kHTMLEditorCID, NULL, NULL, path, + PR_TRUE, PR_TRUE); + } + } + return result; } extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path) { - return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll. + nsresult result = NS_ERROR_UNEXPECTED; + result = nsRepository::UnregisterFactory(kIEditFactoryIID, path); + + + if (NS_SUCCEEDED(result)) + { + result = nsRepository::UnregisterFactory(kITextEditFactoryIID, path); + if (NS_SUCCEEDED(result)) + { + result = nsRepository::UnregisterFactory(kIHTMLEditFactoryIID, path); + } + } + return result; } //END EXPORTS diff --git a/mozilla/editor/txmgr/src/makefile.win b/mozilla/editor/txmgr/src/makefile.win index 8d78c5f6d36..4cbba13fee9 100644 --- a/mozilla/editor/txmgr/src/makefile.win +++ b/mozilla/editor/txmgr/src/makefile.win @@ -69,7 +69,7 @@ LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib include <$(DEPTH)\config\rules.mak> libs:: $(DLL) - $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib clobber::