This commit is contained in:
sfraser%netscape.com 1999-07-14 22:18:29 +00:00
Родитель 354fb225c9
Коммит 815c2ea4f3
15 изменённых файлов: 46 добавлений и 57 удалений

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsIComponentManager.h"
#include "nsIFrameSelection.h"
#include "nsIFrame.h"
#include "nsIDOMNode.h"
@ -35,21 +36,23 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsIPresContext.h"
#include "nsCaretProperties.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h" // for NS_LOOKANDFEEL_CID
#include "nsCaret.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kICaretID, NS_ICARET_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
//-----------------------------------------------------------------------------
nsCaret::nsCaret()
: mPresShell(nsnull)
, mBlinkTimer(nsnull)
, mBlinkRate(500)
, mCaretWidth(20)
, mVisible(PR_FALSE)
, mReadOnly(PR_TRUE)
, mDrawn(PR_FALSE)
@ -68,19 +71,26 @@ nsCaret::~nsCaret()
}
//-----------------------------------------------------------------------------
NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties)
NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell)
{
if (!inPresShell)
return NS_ERROR_NULL_POINTER;
if (!inCaretProperties)
return NS_ERROR_NULL_POINTER;
mPresShell = inPresShell; // the presshell owns us, so no addref
mBlinkRate = inCaretProperties->GetCaretBlinkRate();
mCaretWidth = inCaretProperties->GetCaretWidth();
nsILookAndFeel* touchyFeely;
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, nsILookAndFeel::GetIID(), (void**)&touchyFeely)))
{
PRInt32 tempInt;
if (NS_SUCCEEDED(touchyFeely->GetMetric(nsILookAndFeel::eMetric_CaretWidthTwips, tempInt)))
mCaretWidth = (nscoord)tempInt;
if (NS_SUCCEEDED(touchyFeely->GetMetric(nsILookAndFeel::eMetric_CaretBlinkTime, tempInt)))
mBlinkRate = (PRUint32)tempInt;
NS_RELEASE(touchyFeely);
}
// get the selection from the pres shell, and set ourselves up as a selection
// listener

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsICaret.h"
class nsITimer;
class nsCaretProperties;
class nsIView;
class nsIRenderingContext;
@ -46,7 +45,7 @@ class nsCaret : public nsICaret,
public:
// nsICaret interface
NS_IMETHOD Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties);
NS_IMETHOD Init(nsIPresShell *inPresShell);
NS_IMETHOD SetCaretVisible(PRBool inMakeVisible);
NS_IMETHOD SetCaretReadOnly(PRBool inMakeReadonly);

Просмотреть файл

@ -22,14 +22,12 @@
#define NS_ICARET_IID \
{ 0xa6cf90e1, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
class nsCaretProperties;
class nsICaret: public nsISupports
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ICARET_IID; return iid; }
NS_IMETHOD Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties) = 0;
NS_IMETHOD Init(nsIPresShell *inPresShell) = 0;
/** SetCaretVisible will set the visibility of the caret
* @param inMakeVisible PR_TRUE to show the caret, PR_FALSE to hide it

Просмотреть файл

@ -51,7 +51,6 @@
#include "nsIEventQueueService.h"
#include "nsIServiceManager.h"
#include "nsICaret.h"
#include "nsCaretProperties.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIXMLDocument.h"
#include "nsIScrollableView.h"
@ -650,19 +649,13 @@ PresShell::Init(nsIDocument* aDocument,
return result;
// Important: this has to happen after the selection has been set up
#ifdef SHOW_CARET
nsCaretProperties *caretProperties = NewCaretProperties();
// make the caret
nsresult err = NS_NewCaret(getter_AddRefs(mCaret));
if (NS_SUCCEEDED(err))
{
mCaret->Init(this, caretProperties);
mCaret->Init(this);
}
delete caretProperties;
caretProperties = nsnull;
// do this when we have a way of figuring out how to tell chrome
// from content
//SetCaretEnabled(PR_TRUE); // make it show in browser windows
#endif
//set up selection to be displayed in document

Просмотреть файл

@ -27,7 +27,6 @@ MODULE=layout
EXPORTS = \
nslayout.h \
nsICaret.h \
nsCaretProperties.h \
nsIContent.h \
nsIContentIterator.h \
nsIDiskDocument.h \

Просмотреть файл

@ -20,7 +20,6 @@ DEPTH=..\..\..
EXPORTS = \
nslayout.h \
nsICaret.h \
nsCaretProperties.h \
nsIContent.h \
nsIContentIterator.h \
nsIDiskDocument.h \

Просмотреть файл

@ -22,14 +22,12 @@
#define NS_ICARET_IID \
{ 0xa6cf90e1, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
class nsCaretProperties;
class nsICaret: public nsISupports
{
public:
static const nsIID& GetIID() { static nsIID iid = NS_ICARET_IID; return iid; }
NS_IMETHOD Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties) = 0;
NS_IMETHOD Init(nsIPresShell *inPresShell) = 0;
/** SetCaretVisible will set the visibility of the caret
* @param inMakeVisible PR_TRUE to show the caret, PR_FALSE to hide it

Просмотреть файл

@ -29,7 +29,6 @@ MODULE=layout
# Alphabetical list of source files
CPPSRCS = \
nsCaret.cpp \
nsCaretProperties_$(MOZ_WIDGET_TOOLKIT).cpp \
nsCommentNode.cpp \
nsContentIterator.cpp \
nsContentList.cpp \

Просмотреть файл

@ -57,7 +57,6 @@ CPPSRCS = \
nsLayoutAtoms.cpp \
nsLayoutDebugger.cpp \
nsCaret.cpp \
nsCaretProperties_windows.cpp \
nsRange.cpp \
nsTextNode.cpp \
$(NULL)
@ -100,7 +99,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsLayoutAtoms.obj \
.\$(OBJDIR)\nsLayoutDebugger.obj \
.\$(OBJDIR)\nsCaret.obj \
.\$(OBJDIR)\nsCaretProperties_windows.obj \
.\$(OBJDIR)\nsRange.obj \
.\$(OBJDIR)\nsTextNode.obj \
$(NULL)

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsITimer.h"
#include "nsITimerCallback.h"
#include "nsIComponentManager.h"
#include "nsIFrameSelection.h"
#include "nsIFrame.h"
#include "nsIDOMNode.h"
@ -35,21 +36,23 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsIPresContext.h"
#include "nsCaretProperties.h"
#include "nsILookAndFeel.h"
#include "nsWidgetsCID.h" // for NS_LOOKANDFEEL_CID
#include "nsCaret.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDOMSelectionIID, NS_IDOMSELECTION_IID);
static NS_DEFINE_IID(kICaretID, NS_ICARET_IID);
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
//-----------------------------------------------------------------------------
nsCaret::nsCaret()
: mPresShell(nsnull)
, mBlinkTimer(nsnull)
, mBlinkRate(500)
, mCaretWidth(20)
, mVisible(PR_FALSE)
, mReadOnly(PR_TRUE)
, mDrawn(PR_FALSE)
@ -68,19 +71,26 @@ nsCaret::~nsCaret()
}
//-----------------------------------------------------------------------------
NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties)
NS_IMETHODIMP nsCaret::Init(nsIPresShell *inPresShell)
{
if (!inPresShell)
return NS_ERROR_NULL_POINTER;
if (!inCaretProperties)
return NS_ERROR_NULL_POINTER;
mPresShell = inPresShell; // the presshell owns us, so no addref
mBlinkRate = inCaretProperties->GetCaretBlinkRate();
mCaretWidth = inCaretProperties->GetCaretWidth();
nsILookAndFeel* touchyFeely;
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, nsILookAndFeel::GetIID(), (void**)&touchyFeely)))
{
PRInt32 tempInt;
if (NS_SUCCEEDED(touchyFeely->GetMetric(nsILookAndFeel::eMetric_CaretWidthTwips, tempInt)))
mCaretWidth = (nscoord)tempInt;
if (NS_SUCCEEDED(touchyFeely->GetMetric(nsILookAndFeel::eMetric_CaretBlinkTime, tempInt)))
mBlinkRate = (PRUint32)tempInt;
NS_RELEASE(touchyFeely);
}
// get the selection from the pres shell, and set ourselves up as a selection
// listener

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsICaret.h"
class nsITimer;
class nsCaretProperties;
class nsIView;
class nsIRenderingContext;
@ -46,7 +45,7 @@ class nsCaret : public nsICaret,
public:
// nsICaret interface
NS_IMETHOD Init(nsIPresShell *inPresShell, nsCaretProperties *inCaretProperties);
NS_IMETHOD Init(nsIPresShell *inPresShell);
NS_IMETHOD SetCaretVisible(PRBool inMakeVisible);
NS_IMETHOD SetCaretReadOnly(PRBool inMakeReadonly);

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsIDocument.h"
#include "nsHTMLParts.h"
#include "nsINameSpaceManager.h"
#include "nsCaretProperties.h"
void XXXNeverCalled()
{
@ -53,5 +52,4 @@ void XXXNeverCalled()
nsINameSpaceManager* nsm;
NS_NewNameSpaceManager(&nsm);
NS_CreateHTMLElement(nsnull, "");
NewCaretProperties();
}

Просмотреть файл

@ -51,7 +51,6 @@
#include "nsIEventQueueService.h"
#include "nsIServiceManager.h"
#include "nsICaret.h"
#include "nsCaretProperties.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIXMLDocument.h"
#include "nsIScrollableView.h"
@ -650,19 +649,13 @@ PresShell::Init(nsIDocument* aDocument,
return result;
// Important: this has to happen after the selection has been set up
#ifdef SHOW_CARET
nsCaretProperties *caretProperties = NewCaretProperties();
// make the caret
nsresult err = NS_NewCaret(getter_AddRefs(mCaret));
if (NS_SUCCEEDED(err))
{
mCaret->Init(this, caretProperties);
mCaret->Init(this);
}
delete caretProperties;
caretProperties = nsnull;
// do this when we have a way of figuring out how to tell chrome
// from content
//SetCaretEnabled(PR_TRUE); // make it show in browser windows
#endif
//set up selection to be displayed in document

Двоичные данные
layout/macbuild/layout.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -918,10 +918,6 @@ SOURCE=..\..\..\dist\include\nsCardDataSource.h
# End Source File
# Begin Source File
SOURCE=..\..\..\dist\include\nsCaretProperties.h
# End Source File
# Begin Source File
SOURCE=..\..\..\dist\include\nsCCapsManager.h
# End Source File
# Begin Source File