mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
moving editor core to "core"
This commit is contained in:
parent
3fd1579f0f
commit
091a6a14b8
39
editor/base/Makefile
Normal file
39
editor/base/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
#!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=../..
|
||||
|
||||
|
||||
LIBRARY_NAME = ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
REQUIRES = xpcom raptor
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
test:
|
||||
@echo OS_ARCH = $(OS_ARCH)
|
86
editor/base/Makefile.in
Normal file
86
editor/base/Makefile.in
Normal file
@ -0,0 +1,86 @@
|
||||
#!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
|
||||
|
||||
DEFINES =-D_IMPL_NS_BASE
|
||||
|
||||
ifeq ($(OS_TARGET),Rhapsody)
|
||||
DIRS = rhapsody
|
||||
else
|
||||
DIRS = unix
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = raptorbase
|
||||
|
||||
CPPSRCS = \
|
||||
nsArena.cpp \
|
||||
nsAtomTable.cpp \
|
||||
nsBTree.cpp \
|
||||
nsByteBuffer.cpp \
|
||||
nsCRT.cpp \
|
||||
nsDeque.cpp \
|
||||
nsRBTree.cpp \
|
||||
nsSizeOfHandler.cpp \
|
||||
nsString.cpp \
|
||||
nsUnicharBuffer.cpp \
|
||||
nsUnicharInputStream.cpp \
|
||||
nsVoidArray.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nscore.h \
|
||||
nsBTree.h \
|
||||
nsCRT.h \
|
||||
nsDeque.h \
|
||||
nsIArena.h \
|
||||
nsIAtom.h \
|
||||
nsIByteBuffer.h \
|
||||
nsIBaseStream.h \
|
||||
nsIInputStream.h \
|
||||
nsIOutputStream.h \
|
||||
nsITimer.h \
|
||||
nsITimerCallback.h \
|
||||
nsIUnicharBuffer.h \
|
||||
nsIUnicharInputStream.h \
|
||||
nsInt64.h \
|
||||
nsRBTree.h \
|
||||
nsString.h \
|
||||
nsTime.h \
|
||||
nsVoidArray.h \
|
||||
nsUnitConversion.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
REQUIRES = xpcom netlib raptor
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
test:
|
||||
@echo OS_ARCH = $(OS_ARCH)
|
20
editor/base/editor.cpp
Normal file
20
editor/base/editor.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- 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 "editor.h"
|
64
editor/base/editor.h
Normal file
64
editor/base/editor.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- 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 "nsIEditor.h"
|
||||
#include "COM_auto_ptr.h"
|
||||
|
||||
|
||||
/*implementation of an editor object. it ALSO supplies an nsIEditor Interface*/
|
||||
|
||||
class Editor : public nsIEditor
|
||||
{
|
||||
private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
public:
|
||||
/*nsIEditorInterfaces*/
|
||||
virtual nsresult Init();
|
||||
virtual nsresult Init() = 0;
|
||||
|
||||
/*BEGIN interface manipulators and accessors*/
|
||||
|
||||
/*SetDomInterface accepts an interface to a nsIDOMDocument and it will add a reference to it
|
||||
since it will keep it for some time*/
|
||||
virtual nsresult SetDomInterface(nsIDOMDocument *aDomInterface){mDomInterfaceP = aDomInterface}
|
||||
|
||||
/*GetDomInterface returns a "look" at the dom interface. it will NOT ADD A REFERENCE!!!!!.*/
|
||||
virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP;}
|
||||
/*END interface manipulators*/
|
||||
|
||||
virtual nsresult SetProperties(PROPERTIES aProperty){}
|
||||
virtual nsresult GetProperties(PROPERTIES &){}
|
||||
|
||||
/*EditorInterfaces*/
|
||||
Editor();
|
||||
~Editor();
|
||||
|
||||
/*KeyListener Methods*/
|
||||
|
||||
/*KeyDown :accepts a keycode
|
||||
:returns False if ignored*/
|
||||
PR_Bool KeyDown(int keycode);
|
||||
|
||||
/*MouseListener Methods*/
|
||||
|
||||
/* Mouse Click accepts an x and
|
||||
a y for location in the webshell*/
|
||||
PR_Bool MouseClick(int x,int y); //it should also tell us the dom element that was selected.
|
||||
};
|
||||
|
||||
|
65
editor/base/makefile.win
Normal file
65
editor/base/makefile.win
Normal file
@ -0,0 +1,65 @@
|
||||
#!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=ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\editor.obj \
|
||||
$(NULL)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
REQUIRES=xpcom raptor
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\raptor
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = ender
|
||||
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\libplc21.lib \
|
||||
$(LIBNSPR)
|
||||
!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
|
240
editor/base/nsEditorInterfaces.cpp
Normal file
240
editor/base/nsEditorInterfaces.cpp
Normal file
@ -0,0 +1,240 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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 "nsEditorInterfaces.h"
|
||||
#include "nsEditorMode.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/*
|
||||
* nsEditorKeyListener implementation
|
||||
*/
|
||||
|
||||
nsEditorKeyListener::nsEditorKeyListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsEditorKeyListener::~nsEditorKeyListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMKeyListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMKeyListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditorKeyListener)
|
||||
|
||||
NS_IMPL_RELEASE(nsEditorKeyListener)
|
||||
|
||||
nsresult nsEditorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
||||
{
|
||||
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
||||
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
||||
if (aIsShift) {
|
||||
*aChar = (char)aKeyCode;
|
||||
}
|
||||
else {
|
||||
*aChar = (char)(aKeyCode + 0x20);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
else if ((aKeyCode >= 0x30 && aKeyCode <= 0x39) || aKeyCode == 0x20) {
|
||||
*aChar = (char)aKeyCode;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
PRUint32 mKeyCode;
|
||||
PRBool mIsShift;
|
||||
char mChar;
|
||||
|
||||
if (NS_OK == aKeyEvent->GetKeyCode(&mKeyCode) &&
|
||||
NS_OK == aKeyEvent->GetShiftKey(&mIsShift)) {
|
||||
switch(mKeyCode) {
|
||||
case nsIDOMEvent::VK_BACK:
|
||||
nsDeleteLast();
|
||||
break;
|
||||
case nsIDOMEvent::VK_RETURN:
|
||||
// Need to implement creation of either <P> or <BR> nodes.
|
||||
break;
|
||||
default:
|
||||
// XXX Replace with x-platform NS-virtkeycode transform.
|
||||
if (NS_OK == GetCharFromKeyCode(mKeyCode, mIsShift, &mChar)) {
|
||||
nsString* key = new nsString();
|
||||
*key += mChar;
|
||||
if (!mIsShift) {
|
||||
key->ToLowerCase();
|
||||
}
|
||||
nsAppendText(key);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_BASE;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsEditorMouseListener implementation
|
||||
*/
|
||||
|
||||
nsEditorMouseListener::nsEditorMouseListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsEditorMouseListener::~nsEditorMouseListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMMouseListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMMouseListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditorMouseListener)
|
||||
|
||||
NS_IMPL_RELEASE(nsEditorMouseListener)
|
||||
|
||||
nsresult nsEditorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
nsIDOMNode *aTarget;
|
||||
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
||||
nsSetCurrentNode(aTarget);
|
||||
NS_RELEASE(aTarget);
|
||||
}
|
||||
//Should not be error. Need a new way to do return values
|
||||
return NS_ERROR_BASE;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Factory functions
|
||||
*/
|
||||
|
||||
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||
{
|
||||
nsEditorKeyListener* it = new nsEditorKeyListener();
|
||||
if (NULL == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
return it->QueryInterface(kIDOMEventListenerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||
{
|
||||
nsEditorMouseListener* it = new nsEditorMouseListener();
|
||||
if (NULL == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
return it->QueryInterface(kIDOMEventListenerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
39
editor/core/Makefile
Normal file
39
editor/core/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
#!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=../..
|
||||
|
||||
|
||||
LIBRARY_NAME = ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
REQUIRES = xpcom raptor
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
test:
|
||||
@echo OS_ARCH = $(OS_ARCH)
|
86
editor/core/Makefile.in
Normal file
86
editor/core/Makefile.in
Normal file
@ -0,0 +1,86 @@
|
||||
#!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
|
||||
|
||||
DEFINES =-D_IMPL_NS_BASE
|
||||
|
||||
ifeq ($(OS_TARGET),Rhapsody)
|
||||
DIRS = rhapsody
|
||||
else
|
||||
DIRS = unix
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = raptorbase
|
||||
|
||||
CPPSRCS = \
|
||||
nsArena.cpp \
|
||||
nsAtomTable.cpp \
|
||||
nsBTree.cpp \
|
||||
nsByteBuffer.cpp \
|
||||
nsCRT.cpp \
|
||||
nsDeque.cpp \
|
||||
nsRBTree.cpp \
|
||||
nsSizeOfHandler.cpp \
|
||||
nsString.cpp \
|
||||
nsUnicharBuffer.cpp \
|
||||
nsUnicharInputStream.cpp \
|
||||
nsVoidArray.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nscore.h \
|
||||
nsBTree.h \
|
||||
nsCRT.h \
|
||||
nsDeque.h \
|
||||
nsIArena.h \
|
||||
nsIAtom.h \
|
||||
nsIByteBuffer.h \
|
||||
nsIBaseStream.h \
|
||||
nsIInputStream.h \
|
||||
nsIOutputStream.h \
|
||||
nsITimer.h \
|
||||
nsITimerCallback.h \
|
||||
nsIUnicharBuffer.h \
|
||||
nsIUnicharInputStream.h \
|
||||
nsInt64.h \
|
||||
nsRBTree.h \
|
||||
nsString.h \
|
||||
nsTime.h \
|
||||
nsVoidArray.h \
|
||||
nsUnitConversion.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
MODULE = raptor
|
||||
|
||||
REQUIRES = xpcom netlib raptor
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
TARGET = $(LIBARY)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
test:
|
||||
@echo OS_ARCH = $(OS_ARCH)
|
20
editor/core/editor.cpp
Normal file
20
editor/core/editor.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* -*- 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 "editor.h"
|
64
editor/core/editor.h
Normal file
64
editor/core/editor.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- 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 "nsIEditor.h"
|
||||
#include "COM_auto_ptr.h"
|
||||
|
||||
|
||||
/*implementation of an editor object. it ALSO supplies an nsIEditor Interface*/
|
||||
|
||||
class Editor : public nsIEditor
|
||||
{
|
||||
private:
|
||||
COM_auto_ptr<nsIDOMDocument> mDomInterfaceP;
|
||||
public:
|
||||
/*nsIEditorInterfaces*/
|
||||
virtual nsresult Init();
|
||||
virtual nsresult Init() = 0;
|
||||
|
||||
/*BEGIN interface manipulators and accessors*/
|
||||
|
||||
/*SetDomInterface accepts an interface to a nsIDOMDocument and it will add a reference to it
|
||||
since it will keep it for some time*/
|
||||
virtual nsresult SetDomInterface(nsIDOMDocument *aDomInterface){mDomInterfaceP = aDomInterface}
|
||||
|
||||
/*GetDomInterface returns a "look" at the dom interface. it will NOT ADD A REFERENCE!!!!!.*/
|
||||
virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP;}
|
||||
/*END interface manipulators*/
|
||||
|
||||
virtual nsresult SetProperties(PROPERTIES aProperty){}
|
||||
virtual nsresult GetProperties(PROPERTIES &){}
|
||||
|
||||
/*EditorInterfaces*/
|
||||
Editor();
|
||||
~Editor();
|
||||
|
||||
/*KeyListener Methods*/
|
||||
|
||||
/*KeyDown :accepts a keycode
|
||||
:returns False if ignored*/
|
||||
PR_Bool KeyDown(int keycode);
|
||||
|
||||
/*MouseListener Methods*/
|
||||
|
||||
/* Mouse Click accepts an x and
|
||||
a y for location in the webshell*/
|
||||
PR_Bool MouseClick(int x,int y); //it should also tell us the dom element that was selected.
|
||||
};
|
||||
|
||||
|
65
editor/core/makefile.win
Normal file
65
editor/core/makefile.win
Normal file
@ -0,0 +1,65 @@
|
||||
#!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=ender
|
||||
|
||||
CPPSRCS = \
|
||||
editor.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
.\$(OBJDIR)\editor.obj \
|
||||
$(NULL)
|
||||
|
||||
MODULE=raptor
|
||||
|
||||
REQUIRES=xpcom raptor
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\raptor
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = ender
|
||||
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\libplc21.lib \
|
||||
$(LIBNSPR)
|
||||
!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
|
240
editor/core/nsEditorInterfaces.cpp
Normal file
240
editor/core/nsEditorInterfaces.cpp
Normal file
@ -0,0 +1,240 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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 "nsEditorInterfaces.h"
|
||||
#include "nsEditorMode.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/*
|
||||
* nsEditorKeyListener implementation
|
||||
*/
|
||||
|
||||
nsEditorKeyListener::nsEditorKeyListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsEditorKeyListener::~nsEditorKeyListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMKeyListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMKeyListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditorKeyListener)
|
||||
|
||||
NS_IMPL_RELEASE(nsEditorKeyListener)
|
||||
|
||||
nsresult nsEditorKeyListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::GetCharFromKeyCode(PRUint32 aKeyCode, PRBool aIsShift, char *aChar)
|
||||
{
|
||||
/* This is completely temporary to get this working while I check out Unicode conversion code. */
|
||||
if (aKeyCode >= 0x41 && aKeyCode <= 0x5A) {
|
||||
if (aIsShift) {
|
||||
*aChar = (char)aKeyCode;
|
||||
}
|
||||
else {
|
||||
*aChar = (char)(aKeyCode + 0x20);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
else if ((aKeyCode >= 0x30 && aKeyCode <= 0x39) || aKeyCode == 0x20) {
|
||||
*aChar = (char)aKeyCode;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
PRUint32 mKeyCode;
|
||||
PRBool mIsShift;
|
||||
char mChar;
|
||||
|
||||
if (NS_OK == aKeyEvent->GetKeyCode(&mKeyCode) &&
|
||||
NS_OK == aKeyEvent->GetShiftKey(&mIsShift)) {
|
||||
switch(mKeyCode) {
|
||||
case nsIDOMEvent::VK_BACK:
|
||||
nsDeleteLast();
|
||||
break;
|
||||
case nsIDOMEvent::VK_RETURN:
|
||||
// Need to implement creation of either <P> or <BR> nodes.
|
||||
break;
|
||||
default:
|
||||
// XXX Replace with x-platform NS-virtkeycode transform.
|
||||
if (NS_OK == GetCharFromKeyCode(mKeyCode, mIsShift, &mChar)) {
|
||||
nsString* key = new nsString();
|
||||
*key += mChar;
|
||||
if (!mIsShift) {
|
||||
key->ToLowerCase();
|
||||
}
|
||||
nsAppendText(key);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_BASE;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsEditorMouseListener implementation
|
||||
*/
|
||||
|
||||
nsEditorMouseListener::nsEditorMouseListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsEditorMouseListener::~nsEditorMouseListener()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMEventListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMEventListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDOMMouseListenerIID)) {
|
||||
*aInstancePtr = (void*)(nsIDOMMouseListener*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsEditorMouseListener)
|
||||
|
||||
NS_IMPL_RELEASE(nsEditorMouseListener)
|
||||
|
||||
nsresult nsEditorMouseListener::ProcessEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
nsIDOMNode *aTarget;
|
||||
if (NS_OK == aMouseEvent->GetTarget(&aTarget)) {
|
||||
nsSetCurrentNode(aTarget);
|
||||
NS_RELEASE(aTarget);
|
||||
}
|
||||
//Should not be error. Need a new way to do return values
|
||||
return NS_ERROR_BASE;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseOver(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Factory functions
|
||||
*/
|
||||
|
||||
nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||
{
|
||||
nsEditorKeyListener* it = new nsEditorKeyListener();
|
||||
if (NULL == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
return it->QueryInterface(kIDOMEventListenerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
||||
nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult)
|
||||
{
|
||||
nsEditorMouseListener* it = new nsEditorMouseListener();
|
||||
if (NULL == it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID);
|
||||
|
||||
return it->QueryInterface(kIDOMEventListenerIID, (void **) aInstancePtrResult);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user