Added Editor GuiManager source files

This commit is contained in:
cmanske%netscape.com 1998-12-09 19:00:35 +00:00
parent 4f98e2bdeb
commit 5a7b94ca6b
6 changed files with 405 additions and 0 deletions

View File

@ -0,0 +1,44 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = editguimgr
CPPSRCS = \
nsEditGuiManager.cpp \
nsEditGuiMgrFactory.cpp \
$(NULL)
MODULE = editguimgr
REQUIRES = xpcom
include $(topsrcdir)/config/config.mk
TARGET = $(LIBARY)
include $(topsrcdir)/config/rules.mk
test:
@echo OS_ARCH = $(OS_ARCH)

View File

@ -0,0 +1,67 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
DEPTH=..\..\..
IGNORE_MANIFEST=1
LIBRARY_NAME=editguimgr
CPPSRCS = \
nsEditGuiManager.cpp \
nsGuiMgrFactory.cpp \
$(NULL)
CPP_OBJS = \
.\$(OBJDIR)\nsEditGuiManager.obj \
$(NULL)
MODULE=editguimgr
REQUIRES=xpcom base raptor
LINCS=-I$(PUBLIC)\editor \
-I$(PUBLIC)\xpcom \
-I$(PUBLIC)\guimgr \
-I$(PUBLIC)\base \
-I$(PUBLIC)\raptor
MAKE_OBJ_TYPE = DLL
DLLNAME = editguimgr
DLL=.\$(OBJDIR)\$(DLLNAME).dll
LCFLAGS = \
$(LCFLAGS) \
$(DEFINES) \
$(NULL)
# These are the libraries we need to link with to create the dll
LLIBS=$(DIST)\lib\xpcom32.lib $(DIST)\lib\raptorbase.lib
!if "$(MOZ_BITS)"=="32" && defined(MOZ_DEBUG) && defined(GLOWCODE)
LLIBS=$(LLIBS) $(GLOWDIR)\glowcode.lib
!endif
include <$(DEPTH)\config\rules.mak>
libs:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
clobber::
rm -f $(DIST)\bin\$(DLLNAME).dll
rm -f $(DIST)\lib\$(DLLNAME).lib

View File

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsEditGuiManager.h"
#include "COM_auto_ptr.h"
#define LOCK_GUI_MANAGER(mgr)
#define UNLOCK_GUI_MANAGER(mgr)
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIEditGuiManagerIID, NS_IEDITGUIMANAGER_IID);
nsEditGuiManager::nsEditGuiManager()
{
}
nsEditGuiManager::~nsEditGuiManager()
{
}
NS_IMPL_ADDREF(nsEditGuiManager)
NS_IMPL_RELEASE(nsEditGuiManager)
nsresult
nsEditGuiManager::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*)(nsISupports*)this;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIEditGuiManagerIID)) {
*aInstancePtr = (void*)(nsIEditGuiManager*)this;
NS_ADDREF_THIS();
return NS_OK;
}
*aInstancePtr = 0;
return NS_NOINTERFACE;
}

View File

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://wwwt.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsEditGuiManager_h__
#define nsEditGuiManager_h__
#include "nsIEditGuiManager.h"
/** implementation of an Editor GUI Manager object.
*
*/
class nsEditGuiManager : public nsIEditGuiManager
{
private:
public:
/** The default constructor.
*/
nsEditGuiManager();
/** The default destructor.
*/
virtual ~nsEditGuiManager();
/* Macro for AddRef(), Release(), and QueryInterface() */
NS_DECL_ISUPPORTS
/* nsEditGuiManager method implementations. */
/* nsEditGuiManager specific methods. */
};
#endif // nsTransactionManager_h__

View File

@ -0,0 +1,123 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://wwwt.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsGuiMgrFactory.h"
#include "nsIEditor.h"
#include "editor.h"
#include "nsRepository.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kIEditGuiManagerIID, NS_IEDITGUIMANAGER_IID);
static NS_DEFINE_IID(kIGuiManagerFactoryIID, NS_IGUIMANAGERFACTORY_IID);
nsresult
getGuiManagerFactory(nsIFactory **aFactory)
{
static COM_auto_ptr<nsIFactory> g_pNSIFactory;
PR_EnterMonitor(getEditorMonitor());
nsresult result = NS_ERROR_FAILURE;
if (!g_pNSIFactory)
{
nsGuiManagerFactory *factory = new nsGuiManagerFactory(getter_AddRefs(g_pNSIFactory));
*aFactory = g_pNSIFactory;
NS_IF_ADDREF(*aFactory);
if (factory)
result = NS_OK;
}
else
result = g_pNSIFactory->QueryInterface(kIFactoryIID, (void **)aFactory);
PR_ExitMonitor(getEditorMonitor());
return result;
}
////////////////////////////////////////////////////////////////////////////
// from nsISupports
NS_METHOD
nsGuiManagerFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
NS_NOTREACHED("!nsEditGuiManager");
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(kIFactoryIID) ||
aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(nsGuiManagerFactory)
NS_IMPL_RELEASE(nsGuiManagerFactory)
////////////////////////////////////////////////////////////////////////////
// from nsIFactory:
NS_METHOD
nsGuiManagerFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsEditGuiManager *guimgr = NULL;
*aResult = NULL;
if (aOuter && !aIID.Equals(kISupportsIID))
return NS_NOINTERFACE; // XXX right error?
guimgr = new nsEditGuiManager();
if (NS_FAILED(guimgr->QueryInterface(aIID,(void**)aResult))) {
// then we're trying get a interface other than nsISupports and nsIEditGuiManager
delete guimgr;
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_METHOD
nsGuiManagerFactory::LockFactory(PRBool aLock)
{
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////
// from nsFactory:
nsGuiManagerFactory::nsGuiManagerFactory(nsIFactory **aFactory)
{
NS_INIT_REFCNT();
nsresult err = NS_OK;
if (aFactory)
{
err = this->QueryInterface(kIFactoryIID, (void**)aFactory);
}
}
nsGuiManagerFactory::~nsGuiManagerFactory()
{
nsRepository::UnregisterFactory(kIGuiManagerFactoryIID, (nsIFactory *)this); //we are out of ref counts anyway
}

View File

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://wwwt.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIGuiMgrFactory_h___
#define nsIGuiMgrFactory_h___
#include "nsISupports.h"
#include "nsIFactory.h"
class nsEditGuiManager;
/*
GuiManagerFactory that can make an editor GUI manager
*/
/**
* This supplies the neccessary entrance to the edit module. it will return any
* instantiations that we need.
*/
class nsGuiManagerFactory;
nsresult getGuiManagerFactory(nsIFactory **);
class nsGuiManagerFactory : public nsIFactory {
public:
////////////////////////////////////////////////////////////////////////////
// from nsISupports and AggregatedQueryInterface:
NS_DECL_ISUPPORTS
////////////////////////////////////////////////////////////////////////////
// from nsIFactory:
NS_IMETHOD
CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
NS_IMETHOD
LockFactory(PRBool aLock);
////////////////////////////////////////////////////////////////////////////
// from nsFactory:
virtual ~nsGuiManagerFactory(void);
private:
nsGuiManagerFactory(nsIFactory **aFactory); //will fill the aFactory with the result from queryinterface
friend nsresult getGuiManagerFactory(nsIFactory **);
};
#endif //nsIGuiMgrFactory_h___