First pass migrating Free Source Calendar client to mozilla repo

This commit is contained in:
spider%netscape.com 1998-09-03 18:23:17 +00:00
parent 81f0952e9a
commit 6855b73fa7
118 changed files with 11035 additions and 0 deletions

View File

@ -0,0 +1,56 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,60 @@
#ifndef _CMINICAL_EVENTS
#define _CMINICAL_EVENTS
class CMouseEvent
{
public:
enum Type { MOUSEMOVE, MOUSEDOWN, MOUSEUP, MOUSECLICK, MOUSEDRAG };
enum Modifiers { SHIFT, CTRL, ALT, META };
protected:
int m_iX;
int m_iY;
int m_iModifiers; // a logical or of all applicable Modifiers
Type m_eType;
int m_iButton; // 0 = n/a, 1 = left, 2 = middle, 3 = right, ...
public:
CMouseEvent( int iX, int iY, Type t, int iBtn, int iMod );
virtual ~CMouseEvent();
inline int GetX() { return m_iX; }
inline int GetY() { return m_iY; }
inline void SetButton(int i) { m_iButton = i; }
inline void SetModifiers(int i) { m_iModifiers = i; }
inline int GetButton() { return m_iButton; }
inline int GetModifiers() { return m_iModifiers; }
inline Type GetType() { return m_eType; }
inline void SetShift() { m_iModifiers |= (1 << (int)SHIFT); }
inline int GetShift() { return m_iModifiers & (1 << (int)SHIFT); }
inline void SetCtrl() { m_iModifiers |= (1 << (int)CTRL); }
inline int GetCtrl() { return m_iModifiers & (1 << (int)CTRL); }
};
#include <datetime.h>
class CMiniCalEvent : public CMouseEvent
{
public:
enum Action { MNOTHING, MDATE, MDOW, MWEEK, MLEFTARROW, MRIGHTARROW };
CMiniCalEvent(int iX, int iY, Type t, int iBtn, int iMod);
virtual ~CMiniCalEvent();
inline CMiniCalEvent::Action GetAction() {return m_eAction;}
inline void SetAction(CMiniCalEvent::Action e) {m_eAction = e;}
inline int GetDOW() {return m_iDOW;}
inline void SetDOW(int i) {m_iDOW = i;}
inline DateTime GetDate() {return m_DT;}
inline void SetDate(DateTime d) {m_DT = d;}
inline int GetWeekOffset() {return m_iWeekOffset;}
inline void SetWeekOffset(int i) {m_iWeekOffset = i;}
protected:
Action m_eAction;
int m_iDOW; // valid when eAction is MDOW
int m_iWeekOffset; // valid when eAction is MWEEK
DateTime m_DT; // valid when eAction is DATE
};
#endif /* _CMINICAL_EVENTS */

View File

@ -0,0 +1,32 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
nsCalTimebarCanvas.h \
nsCalStatusCanvas.h \
nsCalCommandCanvas.h \
nsCalTimebarComponentCanvas.h \
nsCalTodoComponentCanvas.h \
nsCalTimebarHeading.h \
nsCalTimebarUserHeading.h \
nsCalTimebarTimeHeading.h \
nsCalTimebarScale.h \
nsCalMultiDayViewCanvas.h \
nsCalDayViewCanvas.h \
events.h \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,65 @@
/* -*- 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.
*/
#ifndef nsCalCommandCanvas_h___
#define nsCalCommandCanvas_h___
#include "nsXPFCCanvas.h"
#include "nsIWidget.h"
#include "nsITextWidget.h"
#include "nsIXPFCSubject.h"
class nsCalCommandCanvas : public nsXPFCCanvas,
public nsIXPFCSubject
{
public:
nsCalCommandCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
// nsIXPFCSubject methods
NS_IMETHOD Attach(nsIXPFCObserver * aObserver);
NS_IMETHOD Detach(nsIXPFCObserver * aObserver);
NS_IMETHOD Notify(nsIXPFCCommand * aCommand);
protected:
~nsCalCommandCanvas();
public:
NS_IMETHOD SendCommand(nsString& aCommand, nsString& aReply);
private:
nsITextWidget * mTextField;
nsITextWidget * mStaticTextField;
};
#endif /* nsCalCommandCanvas_h___ */

View File

@ -0,0 +1,51 @@
/* -*- 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.
*/
#ifndef nsCalDayViewCanvas_h___
#define nsCalDayViewCanvas_h___
#include "nsCalTimebarComponentCanvas.h"
class nsCalDayViewCanvas : public nsCalTimebarComponentCanvas
{
public:
nsCalDayViewCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintForeground(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) PaintBorder(nsGUIEvent *aEvent);
protected:
~nsCalDayViewCanvas();
NS_IMETHOD PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval);
private:
nscolor mComponentColor;
};
#endif /* nsCalDayViewCanvas_h___ */

View File

@ -0,0 +1,76 @@
/* -*- 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.
*/
#ifndef nsCalMultiDayViewCanvas_h___
#define nsCalMultiDayViewCanvas_h___
#include "nsCalTimebarComponentCanvas.h"
#include "nsCalTimebarCanvas.h"
#include "nsDateTime.h"
class nsCalMultiDayViewCanvas : public nsCalTimebarComponentCanvas
{
public:
nsCalMultiDayViewCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintBackground(nsGUIEvent *aEvent);
NS_IMETHOD AddDayViewCanvas();
NS_IMETHOD_(PRUint32) GetNumberViewableDays();
NS_IMETHOD SetNumberViewableDays(PRUint32 aNumberViewableDays);
NS_IMETHOD SetShowHeaders(PRBool aShowHeaders);
NS_IMETHOD SetShowStatus(PRBool aShowHeaders);
NS_IMETHOD_(PRBool) GetShowHeaders();
NS_IMETHOD_(PRBool) GetShowStatus();
NS_IMETHOD SetTimeContext(nsICalTimeContext * aContext);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
// nsIXPFCCommandReceiver methods
NS_IMETHOD Action(nsIXPFCCommand * aCommand);
private:
NS_IMETHOD SetChildTimeContext(nsCalTimebarCanvas * aCanvas,
nsICalTimeContext * aContext,
PRUint32 increment);
NS_IMETHOD ChangeChildDateTime(nsCalTimebarCanvas * aCanvas,
nsDateTime * aDateTime);
NS_IMETHOD ChangeChildDateTime(PRUint32 aIndex, nsDateTime * aDateTime);
protected:
~nsCalMultiDayViewCanvas();
private:
PRUint32 mNumberViewableDays;
PRBool mShowHeaders;
PRBool mShowStatus;
PRUint32 mMaxRepeat;
PRUint32 mMinRepeat;
};
#endif /* nsCalMultiDayViewCanvas_h___ */

View File

@ -0,0 +1,39 @@
/* -*- 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.
*/
#ifndef nsCalStatusCanvas_h___
#define nsCalStatusCanvas_h___
#include "nsXPFCCanvas.h"
class nsCalStatusCanvas : public nsXPFCCanvas
{
public:
nsCalStatusCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
protected:
~nsCalStatusCanvas();
};
#endif /* nsCalStatusCanvas_h___ */

View 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://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.
*/
#ifndef nsCalTimebarCanvas_h___
#define nsCalTimebarCanvas_h___
#define INSET 2
#include "nsXPFCCanvas.h"
#include "nsICalTimeContext.h"
class nsCalTimebarCanvas : public nsXPFCCanvas
{
public:
nsCalTimebarCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsICalTimeContext *) GetTimeContext();
NS_IMETHOD SetTimeContext(nsICalTimeContext * aContext);
NS_IMETHOD_(PRUint32) GetVisibleMajorIntervals();
NS_IMETHOD_(PRUint32) GetVisibleMinorIntervals();
NS_IMETHOD_(nsEventStatus) PaintBackground(nsGUIEvent *aEvent);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
protected:
NS_IMETHOD PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval);
protected:
~nsCalTimebarCanvas();
// XXX: This needs to be multiply aggregated, I think.
private:
nsICalTimeContext * mTimeContext;
};
#endif /* nsCalTimebarCanvas_h___ */

View File

@ -0,0 +1,39 @@
/* -*- 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.
*/
#ifndef nsCalTimebarComponentCanvas_h___
#define nsCalTimebarComponentCanvas_h___
#include "nsCalTimebarCanvas.h"
class nsCalTimebarComponentCanvas : public nsCalTimebarCanvas
{
public:
nsCalTimebarComponentCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
protected:
~nsCalTimebarComponentCanvas();
};
#endif /* nsCalTimebarComponentCanvas_h___ */

View File

@ -0,0 +1,42 @@
/* -*- 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.
*/
#ifndef nsCalTimebarHeading_h___
#define nsCalTimebarHeading_h___
#include "nsCalTimebarCanvas.h"
class nsCalTimebarHeading : public nsCalTimebarCanvas
{
public:
nsCalTimebarHeading(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintBackground(nsGUIEvent *aEvent);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:
~nsCalTimebarHeading();
};
#endif /* nsCalTimebarHeading_h___ */

View File

@ -0,0 +1,55 @@
/* -*- 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.
*/
#ifndef nsCalTimebarScale_h___
#define nsCalTimebarScale_h___
#include "nsCalTimebarCanvas.h"
class nsCalTimebarScale : public nsCalTimebarCanvas
{
public:
nsCalTimebarScale(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintBorder(nsGUIEvent *aEvent);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:
NS_IMETHOD PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval);
NS_IMETHOD DrawTime(nsIRenderingContext * aContext,
nsRect& aRect,
PRUint32 aIndex);
protected:
~nsCalTimebarScale();
};
#endif /* nsCalTimebarScale_h___ */

View File

@ -0,0 +1,42 @@
/* -*- 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.
*/
#ifndef nsCalTimebarTimeHeading_h___
#define nsCalTimebarTimeHeading_h___
#include "nsCalTimebarHeading.h"
class nsCalTimebarTimeHeading : public nsCalTimebarHeading
{
public:
nsCalTimebarTimeHeading(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintForeground(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) PaintBackground(nsGUIEvent *aEvent);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
protected:
~nsCalTimebarTimeHeading();
};
#endif /* nsCalTimebarTimeHeading_h___ */

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://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.
*/
#ifndef nsCalTimebarUserHeading_h___
#define nsCalTimebarUserHeading_h___
#include "nsCalTimebarHeading.h"
#include "nsString.h"
class nsCalTimebarUserHeading : public nsCalTimebarHeading
{
public:
nsCalTimebarUserHeading(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD_(nsEventStatus) PaintForeground(nsGUIEvent *aEvent);
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
NS_IMETHOD_(nsString&) GetUserName();
NS_IMETHOD SetUserName(nsString& aString);
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:
~nsCalTimebarUserHeading();
private:
nsString mUserName;
};
#endif /* nsCalTimebarUserHeading_h___ */

View File

@ -0,0 +1,44 @@
/* -*- 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.
*/
#ifndef nsCalTodoComponentCanvas_h___
#define nsCalTodoComponentCanvas_h___
#include "nsCalTimebarComponentCanvas.h"
#include "nsIWidget.h"
#include "nsIListWidget.h"
class nsCalTodoComponentCanvas : public nsCalTimebarComponentCanvas
{
public:
nsCalTodoComponentCanvas(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD SetBounds(const nsRect& aBounds);
NS_IMETHOD_(void) SetBackgroundColor(const nscolor &aColor) ;
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent);
protected:
~nsCalTodoComponentCanvas();
};
#endif /* nsCalTodoComponentCanvas_h___ */

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = inc
DIRS_LIBS = src

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,24 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR -DLIBJULIAN -DNSPR20
INCLUDES += -I../inc -I$(GDEPTH)/include
LIBRARY_NAME = canvas
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,31 @@
#include "jdefines.h"
#include "events.h"
/*
* TODO: Get rid of this class! Use the standars nsGUIEvent for GUI events
* and create a separate event class for calendaring and controllers
*/
CMouseEvent::CMouseEvent( int iX, int iY, CMouseEvent::Type t, int iBtn, int iMod )
{
m_iX = iX;
m_iY = iY;
m_iModifiers = iMod;
m_iButton = iBtn;
m_eType = t;
}
CMouseEvent::~CMouseEvent()
{
}
CMiniCalEvent::CMiniCalEvent( int iX, int iY, CMouseEvent::Type t, int iBtn, int iMod ) : CMouseEvent( iX,iY,t, iBtn, iMod )
{
m_eAction = MNOTHING;
m_iDOW = 0;
m_iWeekOffset = 0;
}
CMiniCalEvent::~CMiniCalEvent()
{
}

View File

@ -0,0 +1,36 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalTimebarCanvas.cpp \
nsCalStatusCanvas.cpp \
nsCalCommandCanvas.cpp \
nsCalTimebarComponentCanvas.cpp \
nsCalTodoComponentCanvas.cpp \
nsCalTimebarHeading.cpp \
nsCalTimebarUserHeading.cpp \
nsCalTimebarTimeHeading.cpp \
nsCalTimebarScale.cpp \
nsCalMultiDayViewCanvas.cpp \
nsCalDayViewCanvas.cpp \
events.cpp \
$(NULL)
REQUIRES = xpcom raptor trex julian nls shell xpfc

View File

@ -0,0 +1,404 @@
/* -*- 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 "nsCalCommandCanvas.h"
#include "nsCalUICIID.h"
#include "nsITextWidget.h"
#include "nsWidgetsCID.h"
#include "nsCalToolkit.h"
#include "nsXPFCMethodInvokerCommand.h"
#include "nsIXPFCObserver.h"
#include "nsIDeviceContext.h"
#include "nsFont.h"
#include "nsIFontMetrics.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID);
static NS_DEFINE_IID(kITextWidgetIID, NS_ITEXTWIDGET_IID);
static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID);
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
#define kNotFound -1
#define DEFAULT_WIDTH 25
#define DEFAULT_HEIGHT 25
nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent);
nsCalCommandCanvas :: nsCalCommandCanvas(nsISupports* outer) : nsXPFCCanvas(outer)
{
NS_INIT_REFCNT();
mStaticTextField = nsnull;
mTextField = nsnull;
}
nsCalCommandCanvas :: ~nsCalCommandCanvas()
{
gXPFCToolkit->GetCanvasManager()->Unregister(this);
NS_IF_RELEASE(mStaticTextField);
NS_IF_RELEASE(mTextField);
}
nsresult nsCalCommandCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
static NS_DEFINE_IID(kClassIID, kCalCommandCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) (nsCalCommandCanvas *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kXPFCSubjectIID)) {
*aInstancePtr = (void*) (nsIXPFCSubject *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalCommandCanvas)
NS_IMPL_RELEASE(nsCalCommandCanvas)
nsresult nsCalCommandCanvas :: Init()
{
nsRect rect;
GetBounds(rect);
/*
* Static Field with read-only string
*/
nsString text("COMMAND: ");
nsRepository::CreateInstance(kCTextFieldCID,
nsnull,
kITextWidgetIID,
(void **)&mStaticTextField);
nsFont font("Times", NS_FONT_STYLE_NORMAL,
NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_BOLD,
0,
8);
nsIFontMetrics * fm ;
GetWidget()->GetDeviceContext()->GetMetricsFor(font, fm);
nscoord width ;
fm->GetWidth(text,width);
rect.width = width;
mStaticTextField->SetReadOnly(PR_TRUE);
nsIWidget * widget = nsnull;
nsresult res = mStaticTextField->QueryInterface(kIWidgetIID,(void**)&widget);
gXPFCToolkit->GetCanvasManager()->Register(this, widget);
NS_RELEASE(widget);
mStaticTextField->Create(GetWidget(),
rect,
HandleEventTextField,
nsnull, nsnull, nsnull);
mStaticTextField->SetText(text);
mStaticTextField->Show(PR_TRUE);
/*
* Writeable Command field
*/
GetBounds(rect);
rect.x += width;
rect.width -= width;
nsRepository::CreateInstance(kCTextFieldCID,
nsnull,
kITextWidgetIID,
(void **)&mTextField);
widget = nsnull;
res = mTextField->QueryInterface(kIWidgetIID,(void**)&widget);
gXPFCToolkit->GetCanvasManager()->Register(this, widget);
NS_RELEASE(widget);
mTextField->Create(GetWidget(),
rect,
HandleEventTextField,
NULL);
text = "TimebarScale setbackgroundcolor #FF0000";
mTextField->SetText(text);
mTextField->Show(PR_TRUE);
return NS_OK;
}
// XXX: todo: we should be passing commands off rather than calling
// directly, and we need to put this code in the topmost event
// loop and call a method of the canvas containing the widget.
// ........
nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent)
{
if (gXPFCToolkit == nsnull)
return nsEventStatus_eIgnore;
nsIXPFCCanvas * canvas = gXPFCToolkit->GetCanvasManager()->CanvasFromWidget(aEvent->widget);
if (canvas)
return (canvas->HandleEvent(aEvent));
return nsEventStatus_eIgnore;
}
nsEventStatus nsCalCommandCanvas :: OnResize(nsGUIEvent *aEvent)
{
SetBounds(*((nsSizeEvent*)aEvent)->windowSize);
return (nsXPFCCanvas::OnResize(aEvent));
}
nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
{
nsXPFCCanvas::SetBounds(aBounds);
nsRect rect = aBounds;
nscoord width = 0;
if (mStaticTextField) {
nsString text("COMMAND: ");
nsFont font("Times", NS_FONT_STYLE_NORMAL,
NS_FONT_VARIANT_NORMAL,
NS_FONT_WEIGHT_BOLD,
0,
8);
nsIFontMetrics * fm ;
mStaticTextField->GetDeviceContext()->GetMetricsFor(font,fm);
fm->GetWidth(text,width);
rect.width = width;
mStaticTextField->Invalidate(PR_FALSE);
mStaticTextField->Resize(rect.x, rect.y, rect.width, rect.height, PR_FALSE);
}
if (mTextField) {
rect = aBounds;
rect.x += width;
rect.width -= width;
mTextField->Invalidate(PR_FALSE);
mTextField->Resize(rect.x, rect.y, rect.width, rect.height, PR_FALSE);
}
return NS_OK;
}
nsEventStatus nsCalCommandCanvas :: OnPaint(nsGUIEvent *aEvent)
{
mTextField->Invalidate(PR_FALSE);
mStaticTextField->Invalidate(PR_FALSE);
return nsEventStatus_eConsumeNoDefault;
}
nsEventStatus nsCalCommandCanvas :: HandleEvent(nsGUIEvent *aEvent)
{
switch (aEvent->message)
{
case NS_KEY_UP:
if (NS_VK_RETURN == ((nsKeyEvent*)aEvent)->keyCode)
{
nsString text,reply;
nsITextWidget * text_widget = nsnull;
nsresult res = aEvent->widget->QueryInterface(kITextWidgetIID,(void**)&text_widget);
if (res != NS_OK)
return nsEventStatus_eIgnore;
text_widget->GetText(text, 1000);
SendCommand(text,reply);
NS_RELEASE(text_widget);
}
break;
}
return (nsEventStatus_eIgnore);
}
/*
* The format of the string is:
*
* "CanvasName MethodName [Parameter1 Parameter2 .... ParameterN]"
*/
nsresult nsCalCommandCanvas :: SendCommand(nsString& aCommand, nsString& aReply)
{
/*
* Extract the CanvasName, method and params out
*/
nsString name, method, param;
aCommand.Trim(" \r\n\t");
PRInt32 offset = aCommand.Find(' ');
if (offset == kNotFound)
return NS_OK;
aCommand.Left(name,offset);
aCommand.Cut(0,offset);
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
offset = aCommand.Find(' ');
if (offset == kNotFound)
{
method = aCommand;
param = "";
} else
{
aCommand.Left(method,offset);
aCommand.Cut(0,offset);
aCommand.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
param = aCommand;
}
/*
* Fint the canvas by this name
*/
nsIXPFCCanvas * root = nsnull;
nsIXPFCCanvas * canvas = nsnull;
gXPFCToolkit->GetRootCanvas(&root);
canvas = root->CanvasFromName(name);
NS_RELEASE(root);
if (canvas == nsnull)
return NS_OK;
/*
* Send this command directly to the the canvas.
*/
static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
static NS_DEFINE_IID(kCXPFCObserverIID, NS_IXPFC_OBSERVER_IID);
static NS_DEFINE_IID(kCXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
nsXPFCMethodInvokerCommand * command;
nsresult res = nsRepository::CreateInstance(kCXPFCMethodInvokerCommandCID,
nsnull,
kXPFCCommandIID,
(void **)&command);
if (NS_OK != res)
return res ;
command->Init();
command->mMethod = method;
command->mParams = param;
/*
* Pass this Command onto the Observer interface of the target canvas directly.
* There is no need to go through the ObserverManager since we have the
* necessary info
*/
nsIXPFCObserver * observer = nsnull;
nsIXPFCSubject * subject = nsnull;
res = canvas->QueryInterface(kCXPFCObserverIID, (void **)&observer);
if (res == NS_OK)
res = QueryInterface(kCXPFCSubjectIID, (void **)&subject);
if (res == NS_OK)
observer->Update(subject,command);
aReply = command->mReply;
NS_IF_RELEASE(command);
NS_IF_RELEASE(observer);
NS_IF_RELEASE(subject);
return NS_OK;
}
nsresult nsCalCommandCanvas::Attach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalCommandCanvas::Detach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalCommandCanvas::Notify(nsIXPFCCommand * aCommand)
{
return NS_OK;
}
nsresult nsCalCommandCanvas :: GetClassPreferredSize(nsSize& aSize)
{
aSize.width = DEFAULT_WIDTH;
aSize.height = DEFAULT_HEIGHT;
return (NS_OK);
}

View File

@ -0,0 +1,317 @@
/* -*- 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 "nscore.h"
#include "nsCalDayViewCanvas.h"
#include "nsCalUICIID.h"
#include "nsDateTime.h"
#include "nsCalToolkit.h"
#include "nsCRT.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
#include "datetime.h"
#include "ptrarray.h"
#include "vevent.h"
typedef struct
{
char *p;
size_t iSize;
nsIXPFCCanvas * canvas;
} CAPICTX;
#include "capi.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalDayViewCanvasCID, NS_CAL_DAYVIEWCANVAS_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
nsCalDayViewCanvas :: nsCalDayViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer)
{
NS_INIT_REFCNT();
mComponentColor = NS_RGB(68,141,192);
}
nsCalDayViewCanvas :: ~nsCalDayViewCanvas()
{
}
nsresult nsCalDayViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalDayViewCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarComponentCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalDayViewCanvas)
NS_IMPL_RELEASE(nsCalDayViewCanvas)
nsresult nsCalDayViewCanvas :: Init()
{
return (nsCalTimebarComponentCanvas::Init());
}
static nscolor nsLighter(nscolor c)
{
PRUint8 r = NS_GET_R(c);
PRUint8 g = NS_GET_G(c);
PRUint8 b = NS_GET_B(c);
return NS_RGB( r + ((255-r)>>1), g + ((255-g)>>1), b + ((255-b)>>1) );
}
static nscolor nsDarker(nscolor c)
{
PRUint8 r = NS_GET_R(c);
PRUint8 g = NS_GET_G(c);
PRUint8 b = NS_GET_B(c);
return NS_RGB( r - (r>>1), g - (g>>1), b - (b>>1) );
}
/**
* Paint some light gray lines behind the events...
* @param aIndex
* @param aStart
* @param aSpace
* @param aMinorInterval how many minor ticks
* @return NX_OK on success
*/
nsresult nsCalDayViewCanvas::PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval)
{
PRUint32 i;
/*
* Paint this interval in it's entirety
*/
nsCalTimebarCanvas::PaintInterval(aEvent, aIndex, aStart, aSpace, aMinorInterval);
nsRect rect;
GetBounds(rect);
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
rndctx->SetColor(nsLighter(nsLighter(nsDarker(GetBackgroundColor()))));
aMinorInterval = 4; // XXX: this is a hack, we should specify this in the XML -sman
if (GetTimeContext()->GetHorizontal() == PR_TRUE)
{
rect.x = aStart;
rect.width = aSpace;
/*
* draw the minor ticks...
*/
PRUint32 iYStart = rect.y + INSET;
PRUint32 iYStop = rect.y + rect.height - INSET;
PRUint32 iXSpace = rect.height / aMinorInterval;
PRUint32 iX = rect.x + iXSpace;
for (i = 1; i < (PRUint32) aMinorInterval; i++)
{
rndctx->DrawLine(iX,iYStart, iX,iYStop);
iX += iXSpace;
}
}
else
{
/*
* Vertical version
*/
rect.y = aStart;
rect.height = aSpace;
/*
* draw the minor ticks...
*/
PRUint32 iXStart = rect.x + INSET;
PRUint32 iXStop = rect.x + rect.width - INSET;
PRUint32 iYSpace = rect.height/ aMinorInterval;
PRUint32 iY = rect.y + INSET + iYSpace;
for (i = 1; i < (PRUint32) aMinorInterval; i++)
{
rndctx->DrawLine(iXStart,iY, iXStop,iY);
iY += iYSpace;
}
}
//DrawTime(rndctx, rect, aIndex);
return NS_OK ;
}
nsEventStatus nsCalDayViewCanvas :: PaintBorder(nsGUIEvent *aEvent)
{
nsRect rect;
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
GetBounds(rect);
rect.x++; rect.y++; rect.width-=2; rect.height-=2;
rndctx->SetColor(GetForegroundColor());
rndctx->DrawRect(rect);
return nsEventStatus_eConsumeNoDefault;
}
/**
* Paint the foreground of the canvas and the events that overlap it.
*
* XXX the logic here is not really correct. It should probably be
* a more generic canvas capable of displaying any time-based
* event. There should probably be a separate mechanism that
* connects it to VEVENTS.
*/
nsEventStatus nsCalDayViewCanvas :: PaintForeground(nsGUIEvent *aEvent)
{
JulianPtrArray * evtVctr = 0;
VEvent *pEvent = 0;
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
nsRect rect;
char *psBuf;
char sBuf[256];
nscoord fm_height ;
UnicodeString usFmt("%(hh:mma)B-%(hh:mma)e"); // XXX this needs to be put in a resource, then a variable that can be switched
UnicodeString usTemp;
evtVctr = new JulianPtrArray();
DateTime * dStart = ((nsDateTime *)GetTimeContext()->GetDTStart())->GetDateTime();
DateTime * dEnd = ((nsDateTime *)GetTimeContext()->GetDTEnd())->GetDateTime();
/*
* XXX. This looks wrong. I think we need to store some sort of
* pointer to an associated calendar with this canvas. It
* appears to always get the logged in user's canvas.
*/
gCalToolkit->GetNSCalendar()->getEventsByRange(evtVctr, *dStart, *dEnd);
PRUint32 vis_start_min = GetTimeContext()->GetFirstVisibleTime(nsCalPeriodFormat_kHour) * 60 + GetTimeContext()->GetFirstVisibleTime(nsCalPeriodFormat_kMinute);
PRUint32 vis_end_min = GetTimeContext()->GetLastVisibleTime(nsCalPeriodFormat_kHour) * 60 + GetTimeContext()->GetLastVisibleTime(nsCalPeriodFormat_kMinute);
PRFloat64 div_ratio = ((PRFloat64)(1)) / (PRFloat64)(vis_end_min - vis_start_min) ;
/*
* XXX. This whole algorithm must be changed. We need to grab all
* the events first, determine how many overlap. Then determine
* how big we can make each box, then render...
*/
for (int j = 0; j < evtVctr->GetSize(); j++)
{
pEvent = (VEvent *) evtVctr->GetAt(j);
DateTime dstart = pEvent->getDTStart();
DateTime dsend = pEvent->getDTEnd();
if ( (PRUint32) dstart.getHour() < (PRUint32) GetTimeContext()->GetLastVisibleTime()
&& (PRUint32) dsend.getHour() > (PRUint32) GetTimeContext()->GetFirstVisibleTime())
{
/*
* compute rect for this event
*
* x,width are ok. y and height must be computed
*/
nsRect bounds;
GetBounds(rect);
GetBounds(bounds);
/*
* XXX: Subtract off the modulus of the area. This should not be so hardcoded!
*/
rect.height = rect.height - ((rect.height-2)%GetVisibleMajorIntervals());
PRUint32 vis_event_start_min = dstart.getHour() * 60 + dstart.getMinute();
PRUint32 vis_event_end_min = dsend.getHour() * 60 + dsend.getMinute();
PRFloat64 sratio = ((PRFloat64)(vis_event_start_min - vis_start_min)) * (div_ratio);
PRFloat64 eratio = ((PRFloat64)(vis_event_end_min - vis_start_min)) * (div_ratio);
rect.y += (int)(rect.height * sratio);
rect.height = (int)((rect.height * eratio) - (rect.y - bounds.y));
rndctx->SetColor(mComponentColor);
rect.x = rect.x + 2 * INSET ;
rect.width = rect.width - 4*INSET ;
rect.y = rect.y + INSET ;
rect.height = rect.height - 2 * INSET;
if (rect.y < bounds.y)
rect.y = bounds.y+1;
if ((rect.y+rect.height) > (bounds.y+bounds.height))
rect.height = (bounds.y+bounds.height)-1;
rndctx->FillRect(rect);
/*
* Render the highlights
*/
rndctx->SetColor(nsLighter(mComponentColor));
rndctx->DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y);
rndctx->DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height);
rndctx->SetColor(nsDarker(mComponentColor));
rndctx->DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height);
rndctx->DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height);
rndctx->GetFontMetrics()->GetHeight(fm_height);
if (rect.height > fm_height)
{
// rndctx->SetColor(GetForegroundColor());
rndctx->SetColor(NS_RGB(255,255,255)); /* XXX: This color should come from someplace else... */
/*
* XXX. we need to handle '\n' in a format string...
* This should not require two separate coding calls
* we need to generalize this.
*/
psBuf = pEvent->toStringFmt(usFmt).toCString("");
rndctx->DrawString(psBuf,nsCRT::strlen(psBuf),rect.x+1,rect.y,0);
delete psBuf;
if (rect.height > (2 * fm_height))
{
psBuf = pEvent->getSummary().toCString("");
rndctx->DrawString(psBuf,nsCRT::strlen(psBuf),rect.x+1,rect.y+fm_height,0);
delete psBuf;
}
}
}
}
delete evtVctr;
return nsEventStatus_eConsumeNoDefault;
}

View File

@ -0,0 +1,645 @@
/* -*- 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 "nsCalMultiDayViewCanvas.h"
#include "nsCalDayViewCanvas.h"
#include "nsCalTimebarTimeHeading.h"
#include "nsBoxLayout.h"
#include "nsCalUICIID.h"
#include "nsIVector.h"
#include "nsIIterator.h"
#include "nsCalToolkit.h"
#include "nsCalDayListCommand.h"
#include "nscalstrings.h"
#define DEFAULT_NUMBER_VIEWABLE_DAYS 5
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID);
nsCalMultiDayViewCanvas :: nsCalMultiDayViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer)
{
NS_INIT_REFCNT();
mNumberViewableDays = 0;
mShowHeaders = PR_TRUE;
mShowStatus = PR_FALSE;
mMinRepeat = 1;
mMaxRepeat = 1000;
}
nsCalMultiDayViewCanvas :: ~nsCalMultiDayViewCanvas()
{
}
nsresult nsCalMultiDayViewCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalMultiDayViewCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarComponentCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalMultiDayViewCanvas)
NS_IMPL_RELEASE(nsCalMultiDayViewCanvas)
/*
*
*/
nsresult nsCalMultiDayViewCanvas :: Init()
{
/*
* Call the Init method of the standard canvas, since
* we'll be dealing with child canvas's
*/
nsXPFCCanvas::Init();
/*
* We also need a context. Maybe this should be specifically
* done rather than a part of Init.
*/
nsCalTimebarComponentCanvas::Init();
/*
* Create the default number of viewable day canvas's as children
*/
SetNumberViewableDays(DEFAULT_NUMBER_VIEWABLE_DAYS);
return NS_OK;
}
/*
* Since our Day View's will do the painting, just ignore
*/
nsEventStatus nsCalMultiDayViewCanvas :: PaintBackground(nsGUIEvent *aEvent)
{
return (nsXPFCCanvas :: PaintBackground(aEvent));
}
nsresult nsCalMultiDayViewCanvas :: SetNumberViewableDays(PRUint32 aNumberViewableDays)
{
if (aNumberViewableDays < mMinRepeat)
aNumberViewableDays = mMinRepeat;
if (aNumberViewableDays > mMaxRepeat)
aNumberViewableDays = mMaxRepeat;
if (mNumberViewableDays != aNumberViewableDays) {
PRUint32 i;
mNumberViewableDays = aNumberViewableDays;
/*
* Do the creation/deleteion process here
*/
DeleteChildren();
for (i=0; i<mNumberViewableDays; i++)
{
AddDayViewCanvas();
}
}
return NS_OK;
}
PRBool nsCalMultiDayViewCanvas :: GetShowHeaders()
{
return (mShowHeaders);
}
PRBool nsCalMultiDayViewCanvas :: GetShowStatus()
{
return (mShowStatus);
}
nsresult nsCalMultiDayViewCanvas :: SetShowHeaders(PRBool aShowHeaders)
{
mShowHeaders = aShowHeaders;
return (NS_OK);
}
nsresult nsCalMultiDayViewCanvas :: SetShowStatus(PRBool aShowStatus)
{
mShowStatus = aShowStatus;
return (NS_OK);
}
PRUint32 nsCalMultiDayViewCanvas :: GetNumberViewableDays()
{
return (mNumberViewableDays);
}
nsresult nsCalMultiDayViewCanvas :: AddDayViewCanvas()
{
static NS_DEFINE_IID(kCCalDayViewCID, NS_CAL_DAYVIEWCANVAS_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
nsCalDayViewCanvas * canvas;
nsIXPFCCanvas * parent;
nsresult res;
/*
* Add a canvas to hold the rest
*/
static NS_DEFINE_IID(kCXPFCCanvasCID, NS_XPFC_CANVAS_CID);
res = nsRepository::CreateInstance(kCXPFCCanvasCID,
nsnull,
kIXPFCCanvasIID,
(void **)&canvas);
if (NS_OK != res)
return res ;
canvas->Init();
AddChildCanvas(canvas);
canvas->SetBackgroundColor(GetBackgroundColor());
((nsBoxLayout *)(canvas->GetLayout()))->SetLayoutAlignment(eLayoutAlignment_vertical);
parent = canvas;
/*
* Add the Header Time Canvas
*/
if (mShowHeaders) {
static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARTIMEHEADING_CID);
res = nsRepository::CreateInstance(kCalTimebarTimeHeadingCID,
nsnull,
kIXPFCCanvasIID,
(void **)&canvas);
if (NS_OK != res)
return res ;
canvas->Init();
parent->AddChildCanvas(canvas);
//canvas->SetBackgroundColor(GetBackgroundColor());
canvas->SetPreferredSize(nsSize(25,25));
canvas->SetMinimumSize(nsSize(25,25));
canvas->SetMaximumSize(nsSize(25,25));
}
/*
* Add the Day View Canvas
*/
res = nsRepository::CreateInstance(kCCalDayViewCID,
nsnull,
kIXPFCCanvasIID,
(void **)&canvas);
if (NS_OK != res)
return res ;
canvas->Init();
parent->AddChildCanvas(canvas);
canvas->SetBackgroundColor(GetBackgroundColor());
canvas->SetMinimumSize(nsSize(100,100));
/*
* Add the status View Canvas
*/
if (mShowStatus) {
res = nsRepository::CreateInstance(kCXPFCCanvasCID,
nsnull,
kIXPFCCanvasIID,
(void **)&canvas);
if (NS_OK != res)
return res ;
canvas->Init();
parent->AddChildCanvas(canvas);
canvas->SetBackgroundColor(GetBackgroundColor());
canvas->SetPreferredSize(nsSize(25,25));
canvas->SetMinimumSize(nsSize(25,25));
canvas->SetMaximumSize(nsSize(25,25));
}
return (NS_OK);
}
nsresult nsCalMultiDayViewCanvas :: ChangeChildDateTime(PRUint32 aIndex, nsDateTime * aDateTime)
{
nsresult res = NS_OK;
nsIIterator * iterator ;
nsCalTimebarCanvas * canvas ;
PRUint32 index = 0;
res = CreateIterator(&iterator);
if (NS_OK != res)
return res;
iterator->Init();
while((!(iterator->IsDone())))
{
if ((index == aIndex)) {
/*
* Iterate through these children til we find the right one
*/
canvas = (nsCalTimebarCanvas *) iterator->CurrentItem();
nsresult res2 = NS_OK;
nsIIterator * iterator2 ;
nsCalTimebarCanvas * canvas2 ;
res2 = canvas->CreateIterator(&iterator2);
if (NS_OK != res2)
return res2;
iterator2->Init();
while(!(iterator2->IsDone()))
{
canvas2 = (nsCalTimebarCanvas *) iterator2->CurrentItem();
nsCalTimebarCanvas * canvas_iface = nsnull;;
canvas2->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface);
if ((canvas_iface != nsnull)) {
ChangeChildDateTime(canvas_iface, aDateTime);
NS_RELEASE(canvas_iface);
}
iterator2->Next();
}
}
index++;
iterator->Next();
}
return res;
}
/*
* Call SetContext on all child canvas that support the
* nsCalTimebarCanvas interface. This routine is recursive.
*
* We need to store this TimeContext for ourselves also in case
* we get asked to add new DayView Canvas's, we'll ask the DayView
* to copy our context to start with.
*/
nsresult nsCalMultiDayViewCanvas :: SetTimeContext(nsICalTimeContext * aContext)
{
nsresult res = NS_OK;
nsIIterator * iterator ;
nsCalTimebarCanvas * canvas ;
PRUint32 index = 0;
res = CreateIterator(&iterator);
if (NS_OK != res)
return res;
iterator->Init();
while(!(iterator->IsDone()))
{
/*
* Iterate through these children til we find the right one
*/
canvas = (nsCalTimebarCanvas *) iterator->CurrentItem();
nsresult res2 = NS_OK;
nsIIterator * iterator2 ;
nsCalTimebarCanvas * canvas2 ;
res2 = canvas->CreateIterator(&iterator2);
if (NS_OK != res2)
return res2;
iterator2->Init();
while(!(iterator2->IsDone()))
{
canvas2 = (nsCalTimebarCanvas *) iterator2->CurrentItem();
nsCalTimebarCanvas * canvas_iface = nsnull;;
canvas2->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface);
if (canvas_iface) {
SetChildTimeContext(canvas_iface, aContext, index);
NS_RELEASE(canvas_iface);
}
iterator2->Next();
}
index++;
iterator->Next();
}
return (nsCalTimebarComponentCanvas::SetTimeContext(aContext));
}
nsresult nsCalMultiDayViewCanvas :: ChangeChildDateTime(nsCalTimebarCanvas * aCanvas,
nsDateTime * aDateTime)
{
nsIDateTime * datetime;
nsICalTimeContext * context = aCanvas->GetTimeContext();
if (context == nsnull)
return NS_OK;
context->SetDate(aDateTime);
datetime = context->GetDTStart() ;
datetime->SetYear(aDateTime->GetYear());
datetime->SetMonth(aDateTime->GetMonth());
datetime->SetDay(aDateTime->GetDay());
datetime = context->GetDTEnd() ;
datetime->SetYear(aDateTime->GetYear());
datetime->SetMonth(aDateTime->GetMonth());
datetime->SetDay(aDateTime->GetDay()+1);
datetime = context->GetDTFirstVisible() ;
datetime->SetYear(aDateTime->GetYear());
datetime->SetMonth(aDateTime->GetMonth());
datetime->SetDay(aDateTime->GetDay());
datetime = context->GetDTLastVisible() ;
datetime->SetYear(aDateTime->GetYear());
datetime->SetMonth(aDateTime->GetMonth());
datetime->SetDay(aDateTime->GetDay());
return NS_OK;
}
nsresult nsCalMultiDayViewCanvas :: SetChildTimeContext(nsCalTimebarCanvas * aCanvas,
nsICalTimeContext * aContext,
PRUint32 increment)
{
nsICalTimeContext * context;
static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID);
static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID);
nsresult res = nsRepository::CreateInstance(kCCalTimeContextCID,
nsnull,
kCCalTimeContextIID,
(void **)&context);
if (NS_OK != res)
return res ;
context->Init();
context->Copy(aContext);
/*
* Register this context to observe the copied context. We'll
* need to deal with context mgmt if these things get frivolously
* destroyed/created.
*/
static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID);
static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
nsIXPFCSubject * context_subject;
nsIXPFCObserver * context_observer;
aContext->QueryInterface(kXPFCSubjectIID, (void **)&context_subject);
context->QueryInterface(kXPFCObserverIID, (void **)&context_observer);
gXPFCToolkit->GetObserverManager()->Register(context_subject, context_observer);
/*
* TODO: Add the increment here for the appropriate period
*/
aCanvas->SetTimeContext(context);
context->AddPeriod(nsCalPeriodFormat_kDay,increment);
return NS_OK;
}
nsresult nsCalMultiDayViewCanvas::Action(nsIXPFCCommand * aCommand)
{
/*
* If this is a DayList Command, modify our children as necessary
*/
nsresult res;
PRUint32 count = 0;
nsCalDayListCommand * daylist_command = nsnull;
static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID);
res = aCommand->QueryInterface(kCalDayListCommandCID,(void**)&daylist_command);
if (NS_OK != res)
return (nsXPFCCanvas::Action(aCommand));
/*
* It's a day list command ... set the date
*/
nsIIterator * iterator;
res = daylist_command->CreateIterator(&iterator);
if (NS_OK != res)
return res;
iterator->Init();
count = iterator->Count();
if (iterator->Count() < mMinRepeat)
count = mMinRepeat;
if (iterator->Count() > mMaxRepeat)
count = mMaxRepeat;
if (count != GetChildCount()) {
/*
* The number of new days is different from current. If the number is
* less, delete the difference. If it is more, add new canvas.
*
*/
if (count < GetChildCount()) {
/*
* Delete the difference
*/
PRUint32 delta = GetChildCount() - count;
DeleteChildren(delta);
} else if (count > GetChildCount()) {
/*
* Add new children
*/
PRUint32 delta = count - GetChildCount();
PRUint32 i;
for (i=0; i<delta; i++)
{
AddDayViewCanvas();
}
mNumberViewableDays += delta;
/*
* Set the time context to be based off multi-day
*/
SetTimeContext(GetTimeContext());
}
}
/*
* Now we have the right number of days, lets update the context
*/
PRUint32 index = 0;
while(!(iterator->IsDone()))
{
if (index > count)
break;
nsDateTime * datetime = (nsDateTime *) iterator->CurrentItem();
if (datetime != nsnull) {
ChangeChildDateTime(index,datetime);
}
index++;
iterator->Next();
}
Layout();
return (nsXPFCCanvas::Action(aCommand));
}
nsresult nsCalMultiDayViewCanvas :: SetParameter(nsString& aKey, nsString& aValue)
{
PRInt32 i ;
if (aKey.EqualsIgnoreCase(CAL_STRING_MINREPEAT)) {
mMinRepeat = (PRUint32) aValue.ToInteger(&i);
} else if (aKey.EqualsIgnoreCase(CAL_STRING_MAXREPEAT)) {
mMaxRepeat = (PRUint32) aValue.ToInteger(&i);
} else if (aKey.EqualsIgnoreCase(CAL_STRING_COUNT)) {
SetNumberViewableDays((PRUint32)aValue.ToInteger(&i));
}
return (nsCalTimebarComponentCanvas::SetParameter(aKey, aValue));
}

View File

@ -0,0 +1,61 @@
/* -*- 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 "nsCalStatusCanvas.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalStatusCanvasCID, NS_CAL_STATUSCANVAS_CID);
nsCalStatusCanvas :: nsCalStatusCanvas(nsISupports* outer) : nsXPFCCanvas(outer)
{
NS_INIT_REFCNT();
}
nsCalStatusCanvas :: ~nsCalStatusCanvas()
{
}
nsresult nsCalStatusCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalStatusCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) (nsCalStatusCanvas *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalStatusCanvas)
NS_IMPL_RELEASE(nsCalStatusCanvas)
nsresult nsCalStatusCanvas :: Init()
{
return NS_OK;
}

View File

@ -0,0 +1,235 @@
/* -*- 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 "nsCalTimebarCanvas.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarCanvasCID, NS_CAL_TIMEBARCANVAS_CID);
#define INSET 1
nsCalTimebarCanvas :: nsCalTimebarCanvas(nsISupports* outer) : nsXPFCCanvas(outer)
{
NS_INIT_REFCNT();
mTimeContext = nsnull;
}
nsCalTimebarCanvas :: ~nsCalTimebarCanvas()
{
NS_IF_RELEASE(mTimeContext);
}
nsresult nsCalTimebarCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) (nsCalTimebarCanvas *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarCanvas)
NS_IMPL_RELEASE(nsCalTimebarCanvas)
nsresult nsCalTimebarCanvas :: Init()
{
static NS_DEFINE_IID(kCCalTimeContextCID, NS_CAL_TIME_CONTEXT_CID);
static NS_DEFINE_IID(kCCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID);
nsresult res = nsRepository::CreateInstance(kCCalTimeContextCID,
nsnull,
kCCalTimeContextIID,
(void **)&mTimeContext);
if (NS_OK != res)
return res ;
mTimeContext->Init();
return res;
}
PRUint32 nsCalTimebarCanvas::GetVisibleMajorIntervals()
{
PRUint32 inc = mTimeContext->GetMajorIncrementInterval() ;
PRUint32 delta = mTimeContext->GetVisibleTimeDifference();
if ((delta/inc) > 1000) {
PRUint32 inc2 = mTimeContext->GetMajorIncrementInterval() ;
PRUint32 delta2 = mTimeContext->GetVisibleTimeDifference();
}
return (delta / inc) ;
}
PRUint32 nsCalTimebarCanvas::GetVisibleMinorIntervals()
{
return (mTimeContext->GetMinorIncrementInterval()) ;
}
nsresult nsCalTimebarCanvas :: SetTimeContext(nsICalTimeContext * aContext)
{
NS_IF_RELEASE(mTimeContext);
mTimeContext = aContext;
NS_ADDREF(mTimeContext);
return NS_OK;
}
nsICalTimeContext * nsCalTimebarCanvas :: GetTimeContext()
{
/*
* If we have one, just return it
*/
if (mTimeContext != nsnull)
return (mTimeContext);
/*
* If we do not have one, look up the hierarchy. We need to be
* careful here. We must look for the first parent that implements
* our interface
*/
nsIXPFCCanvas * parent = GetParent();
nsCalTimebarCanvas * time_canvas = nsnull;
nsresult res ;
while (parent != nsnull)
{
res = parent->QueryInterface(kCalTimebarCanvasCID,(void**)time_canvas);
if (res == NS_OK)
{
/*
* Check this parent
*/
nsICalTimeContext * context = time_canvas->GetTimeContext();
NS_RELEASE(time_canvas);
return context;
}
parent = parent->GetParent();
}
return nsnull;
}
nsEventStatus nsCalTimebarCanvas :: PaintBackground(nsGUIEvent *aEvent)
{
/*
* Let the Base Canvas paint it's default background
*/
nsRect rect;
nsXPFCCanvas::PaintBackground(aEvent);
/*
* Now paint the TimeContext over the base canvas background
*
* We need to find the amount of time between first and last
* visible divied by the major increment. This is the number
* of time intervals. Then divide majorincrement by minor
* increment to get number intervals between those
*/
if (!mTimeContext)
return nsEventStatus_eConsumeNoDefault;
PRUint32 major_intervals = GetVisibleMajorIntervals();
PRUint32 minor_intervals = GetVisibleMinorIntervals();
GetBounds(rect);
PRUint32 space_per_interval, start;
if (GetTimeContext()->GetHorizontal() == PR_TRUE) {
space_per_interval = (rect.width) / major_intervals;
start = rect.x;
} else {
space_per_interval = ((rect.height-(2*INSET)) - ((rect.height-(2*INSET)) % major_intervals)) / major_intervals;
start = rect.y+INSET;
}
PRUint32 i = 0;
for (i=0; i<=major_intervals; i++) {
PaintInterval(aEvent, i,start,space_per_interval, minor_intervals);
start += space_per_interval;
}
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarCanvas::PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval)
{
/*
* Paint this interval in it's entirety
*/
nsRect rect;
GetBounds(rect);
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
rndctx->SetColor(GetForegroundColor());
if (GetTimeContext()->GetHorizontal() == PR_TRUE) {
rect.x = aStart;
rect.width = aSpace;
} else {
rect.y = aStart;
rect.height = aSpace;
}
rndctx->DrawLine(rect.x+INSET, rect.y, rect.x+rect.width-INSET, rect.y);
return NS_OK ;
}
nsresult nsCalTimebarCanvas :: SetParameter(nsString& aKey, nsString& aValue)
{
return (nsXPFCCanvas::SetParameter(aKey, aValue));
}

View File

@ -0,0 +1,61 @@
/* -*- 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 "nsCalTimebarComponentCanvas.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarComponentCanvasCID, NS_CAL_TIMEBARCOMPONENTCANVAS_CID);
nsCalTimebarComponentCanvas :: nsCalTimebarComponentCanvas(nsISupports* outer) : nsCalTimebarCanvas(outer)
{
NS_INIT_REFCNT();
}
nsCalTimebarComponentCanvas :: ~nsCalTimebarComponentCanvas()
{
}
nsresult nsCalTimebarComponentCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarComponentCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarComponentCanvas)
NS_IMPL_RELEASE(nsCalTimebarComponentCanvas)
nsresult nsCalTimebarComponentCanvas :: Init()
{
SetBackgroundColor(NS_RGB(255,255,255));
return (nsCalTimebarCanvas::Init()) ;
}

View File

@ -0,0 +1,99 @@
/* -*- 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 "nsCalTimebarHeading.h"
#include "nsCalUICIID.h"
#include "nspr.h"
#include "nsCRT.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
#define USER_HEADER "Rickety Cricket's Agenda"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarHeadingCID, NS_CAL_TIMEBARHEADING_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
#define DEFAULT_WIDTH 25
#define DEFAULT_HEIGHT 25
nsCalTimebarHeading :: nsCalTimebarHeading(nsISupports* outer) : nsCalTimebarCanvas(outer)
{
NS_INIT_REFCNT();
}
nsCalTimebarHeading :: ~nsCalTimebarHeading()
{
}
nsresult nsCalTimebarHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarHeadingCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarHeading)
NS_IMPL_RELEASE(nsCalTimebarHeading)
nsresult nsCalTimebarHeading :: Init()
{
return NS_OK ;
}
nsEventStatus nsCalTimebarHeading :: PaintBackground(nsGUIEvent *aEvent)
{
/*
* Let the Base Canvas paint it's default background
*/
nsXPFCCanvas::PaintBackground(aEvent);
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarHeading :: SetParameter(nsString& aKey, nsString& aValue)
{
return (nsCalTimebarCanvas::SetParameter(aKey, aValue));
}
nsresult nsCalTimebarHeading :: GetClassPreferredSize(nsSize& aSize)
{
aSize.width = DEFAULT_WIDTH;
aSize.height = DEFAULT_HEIGHT;
return (NS_OK);
}

View File

@ -0,0 +1,240 @@
/* -*- 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 "nsCalTimebarScale.h"
#include "nsCalUICIID.h"
#include "nspr.h"
#include "nsCRT.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarScaleCID, NS_CAL_TIMEBARSCALE_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
#define DEFAULT_WIDTH 39
#define DEFAULT_HEIGHT 50
#define INSET 2
nsCalTimebarScale :: nsCalTimebarScale(nsISupports* outer) : nsCalTimebarCanvas(outer)
{
NS_INIT_REFCNT();
SetNameID(nsString("TimebarScale"));
/*
* This is a bit of a hack until we figure out where
* this preference should go. We want to set the background
* and foreground colors of certain classes of widgets...
*/
SetBackgroundColor(NS_RGB(68,141,192));
SetForegroundColor(NS_RGB(255,255,255));
}
nsCalTimebarScale :: ~nsCalTimebarScale()
{
}
nsresult nsCalTimebarScale::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarScaleCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarScale)
NS_IMPL_RELEASE(nsCalTimebarScale)
/*
* Create a TimeContext with default values for now.
*/
nsresult nsCalTimebarScale :: Init()
{
return (nsCalTimebarCanvas::Init());
}
/*
* The TimeContext contains the data we use for figuring out how to draw
* ourselves. Get the data from it
*/
nsresult nsCalTimebarScale::PaintInterval(nsGUIEvent *aEvent,
PRUint32 aIndex,
PRUint32 aStart,
PRUint32 aSpace,
PRUint32 aMinorInterval)
{
int i;
/*
* Paint this interval in it's entirety
*/
nsCalTimebarCanvas::PaintInterval(aEvent, aIndex, aStart, aSpace, aMinorInterval);
nsRect rect;
GetBounds(rect);
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
rndctx->SetColor(GetForegroundColor());
aMinorInterval = 4; // XXX: this is a hack, we should specify this in the XML -sman
if (GetTimeContext()->GetHorizontal() == PR_TRUE)
{
rect.x = aStart;
rect.width = aSpace;
/*
* draw the minor ticks...
*/
PRUint32 iYStart = rect.y + (aSpace * 3 / 4);
PRUint32 iYStop = rect.y + rect.height - INSET;
PRUint32 iXSpace = rect.height / aMinorInterval;
PRUint32 iX = rect.x + iXSpace;
for (i = 0; i < (PRUint32) aMinorInterval; i++)
{
rndctx->DrawLine(iX,iYStart, iX,iYStop);
iX += iXSpace;
}
}
else
{
/*
* Vertical version
*/
rect.y = aStart;
rect.height = aSpace;
/*
* draw the minor ticks...
*/
PRUint32 iXStart = rect.x + rect.width * 3 / 4;
PRUint32 iXStop = rect.x + rect.width - INSET;
PRUint32 iYSpace = rect.height/ aMinorInterval;
PRUint32 iY = rect.y + INSET + iYSpace;
for (i = 1; i < (PRUint32) aMinorInterval; i++)
{
rndctx->DrawLine(iXStart,iY, iXStop,iY);
iY += iYSpace;
}
}
DrawTime(rndctx, rect, aIndex);
return NS_OK ;
}
nsresult nsCalTimebarScale :: DrawTime(nsIRenderingContext * aContext,
nsRect& aRect,
PRUint32 aIndex)
{
/*
* XXX: Create the String we will draw. We need to make this Unicode
* and support the various formats and time periods....
*/
char text[20];
PRUint32 hour;
nscoord width, height, x, y;
PRBool bAmPmFlag = PR_TRUE;
PRBool bPM;
hour = aIndex + GetTimeContext()->GetFirstVisibleTime();
if ( bAmPmFlag )
{
bPM = (hour >= 12);
if (hour == 0)
hour = 12;
else if (hour > 12)
hour -= 12;
PR_snprintf(text, 6, "%2d %s\0", hour, bPM ? "PM" : "AM" );
}
else
{
PR_snprintf(text, 6, "%2d:00\0", hour);
}
/*
* compute the Metrics for the string
*/
aContext->GetFontMetrics()->GetHeight(height);
aContext->GetFontMetrics()->GetWidth(text,width);
/*
* center the text in our rect and draw it
*/
/*
x = ((aRect.width - width)>>1)+aRect.x;
y = ((aRect.height - height)>>1)+aRect.y;
*/
x = aRect.x + (INSET << 1);
y = aRect.y + (INSET << 1);
aContext->DrawString(text,nsCRT::strlen(text),x,y,0);
return (NS_OK);
}
nsEventStatus nsCalTimebarScale :: PaintBorder(nsGUIEvent *aEvent)
{
nsRect rect;
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
GetBounds(rect);
rect.x++; rect.y++; rect.width-=2; rect.height-=2;
rndctx->SetColor(GetForegroundColor());
rndctx->DrawRect(rect);
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarScale :: SetParameter(nsString& aKey, nsString& aValue)
{
return (nsCalTimebarCanvas::SetParameter(aKey, aValue));
}
nsresult nsCalTimebarScale :: GetClassPreferredSize(nsSize& aSize)
{
aSize.width = DEFAULT_WIDTH;
aSize.height = DEFAULT_HEIGHT;
return (NS_OK);
}

View File

@ -0,0 +1,137 @@
/* -*- 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 "nsCalTimebarTimeHeading.h"
#include "nsCalUICIID.h"
#include "nspr.h"
#include "nsCRT.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
nsCalTimebarTimeHeading :: nsCalTimebarTimeHeading(nsISupports* outer) : nsCalTimebarHeading(outer)
{
NS_INIT_REFCNT();
}
nsCalTimebarTimeHeading :: ~nsCalTimebarTimeHeading()
{
}
nsresult nsCalTimebarTimeHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarTimeHeadingCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarHeading::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarTimeHeading)
NS_IMPL_RELEASE(nsCalTimebarTimeHeading)
nsresult nsCalTimebarTimeHeading :: Init()
{
return NS_OK ;
}
nsEventStatus nsCalTimebarTimeHeading :: PaintForeground(nsGUIEvent *aEvent)
{
if (GetTimeContext() == nsnull)
return nsEventStatus_eConsumeNoDefault;
nscoord width, height, x, y;
nsRect rect;
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
GetBounds(rect);
nsString * string;
nsString pattern("EEE MMM-dd\n");
GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string);
/*
* compute the Metrics for the string
*/
rndctx->GetFontMetrics()->GetHeight(height);
rndctx->GetFontMetrics()->GetWidth(*string,width);
/*
* XXX: If we are too big, remove the Day of the week. Need a better algorithm
* to use string who fits to begin with
*/
if (width > rect.width)
{
pattern = "MMM dd\n";
GetTimeContext()->GetDTFirstVisible()->strftime(pattern, &string);
rndctx->GetFontMetrics()->GetWidth(*string,width);
}
/*
* center the text in our rect and draw it
*/
x = ((rect.width - width)>>1)+rect.x;
y = ((rect.height - height)>>1)+rect.y;
rndctx->SetColor(GetForegroundColor());
rndctx->DrawString(*string,nsCRT::strlen(*string),x,y,0);
return nsEventStatus_eConsumeNoDefault;
}
nsEventStatus nsCalTimebarTimeHeading :: PaintBackground(nsGUIEvent *aEvent)
{
/*
* Let the Base Canvas paint it's default background
*/
nsXPFCCanvas::PaintBackground(aEvent);
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarTimeHeading :: SetParameter(nsString& aKey, nsString& aValue)
{
return (nsCalTimebarCanvas::SetParameter(aKey, aValue));
}

View File

@ -0,0 +1,131 @@
/* -*- 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 "nsCalTimebarUserHeading.h"
#include "nsCalUICIID.h"
#include "nspr.h"
#include "nsCRT.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
#include "nscalstrings.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
#define DEFAULT_WIDTH 25
#define DEFAULT_HEIGHT 25
nsCalTimebarUserHeading :: nsCalTimebarUserHeading(nsISupports* outer) : nsCalTimebarHeading(outer)
{
NS_INIT_REFCNT();
mUserName = CAL_STRING_DEFAULTUSERNAME;
}
nsCalTimebarUserHeading :: ~nsCalTimebarUserHeading()
{
}
nsresult nsCalTimebarUserHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimebarUserHeadingCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarHeading::QueryInterface(aIID,aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarUserHeading)
NS_IMPL_RELEASE(nsCalTimebarUserHeading)
nsresult nsCalTimebarUserHeading :: Init()
{
return NS_OK ;
}
nsEventStatus nsCalTimebarUserHeading :: PaintForeground(nsGUIEvent *aEvent)
{
nscoord width, height, x, y;
nsRect rect;
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
GetBounds(rect);
/*
* compute the Metrics for the string
*/
rndctx->GetFontMetrics()->GetHeight(height);
rndctx->GetFontMetrics()->GetWidth(mUserName,width);
/*
* center the text in our rect and draw it
*/
x = ((rect.width - width)>>1)+rect.x;
y = ((rect.height - height)>>1)+rect.y;
rndctx->SetColor(GetForegroundColor());
rndctx->DrawString(mUserName,mUserName.Length(),x,y,0);
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarUserHeading :: SetParameter(nsString& aKey, nsString& aValue)
{
if (aKey.EqualsIgnoreCase(CAL_STRING_TITLE))
SetUserName(aValue);
return (nsCalTimebarCanvas::SetParameter(aKey, aValue));
}
nsresult nsCalTimebarUserHeading :: SetUserName(nsString& aString)
{
mUserName = aString;
return NS_OK;
}
nsString& nsCalTimebarUserHeading :: GetUserName()
{
return mUserName;
}
nsresult nsCalTimebarUserHeading :: GetClassPreferredSize(nsSize& aSize)
{
aSize.width = DEFAULT_WIDTH;
aSize.height = DEFAULT_HEIGHT;
return (NS_OK);
}

View File

@ -0,0 +1,152 @@
/* -*- 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 "nsCalTodoComponentCanvas.h"
#include "nsCalUICIID.h"
#include "nsIListWidget.h"
#include "nsWidgetsCID.h"
#include "nsIDeviceContext.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID);
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
static NS_DEFINE_IID(kIListWidgetIID, NS_ILISTWIDGET_IID);
static NS_DEFINE_IID(kCListWidgetCID, NS_LISTBOX_CID);
nsEventStatus PR_CALLBACK HandleEventListWidget(nsGUIEvent *aEvent);
nsCalTodoComponentCanvas :: nsCalTodoComponentCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer)
{
NS_INIT_REFCNT();
mWidget = nsnull;
}
nsCalTodoComponentCanvas :: ~nsCalTodoComponentCanvas()
{
}
nsresult nsCalTodoComponentCanvas::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTodoComponentCanvasCID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kIXPFCCanvasIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalTimebarComponentCanvas::QueryInterface(aIID,aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTodoComponentCanvas)
NS_IMPL_RELEASE(nsCalTodoComponentCanvas)
nsresult nsCalTodoComponentCanvas :: Init()
{
nsRect rect;
GetBounds(rect);
nsIWidget * parent = GetWidget();
nsIListWidget * listWidget = nsnull;
nsresult res = nsRepository::CreateInstance(kCListWidgetCID,
nsnull,
kIListWidgetIID,
(void **)&mWidget);
if (NS_OK != res)
return res;
res = mWidget->QueryInterface(kIListWidgetIID, (void**)&listWidget);
if (NS_OK != res)
return res;
nsIDeviceContext * context = nsnull;
if (parent)
context = parent->GetDeviceContext();
mWidget->Create(parent,
rect,
HandleEventListWidget,
context,
nsnull, nsnull);
NS_IF_RELEASE(context);
listWidget->AddItemAt(nsString("TODO LIST"),-1);
listWidget->AddItemAt(nsString("---------"),-1);
listWidget->AddItemAt(nsString("Todo: Item #1"),-1);
listWidget->AddItemAt(nsString("Todo: Item #2"),-1);
listWidget->AddItemAt(nsString("Todo: Item #3"),-1);
listWidget->AddItemAt(nsString("Todo: Item #4"),-1);
listWidget->AddItemAt(nsString("Todo: Item #5"),-1);
listWidget->AddItemAt(nsString("Todo: Item #6"),-1);
listWidget->AddItemAt(nsString("Todo: Item #7"),-1);
listWidget->AddItemAt(nsString("Todo: Item #8"),-1);
listWidget->AddItemAt(nsString("Todo: Item #9"),-1);
listWidget->AddItemAt(nsString("Todo: Item #10"),-1);
NS_RELEASE(listWidget);
SetBackgroundColor(NS_RGB(255,255,192));
mWidget->Show(PR_TRUE);
return NS_OK;
}
nsEventStatus PR_CALLBACK HandleEventListWidget(nsGUIEvent *aEvent)
{
return nsEventStatus_eIgnore;
}
nsresult nsCalTodoComponentCanvas :: SetBounds(const nsRect &aBounds)
{
return (nsXPFCCanvas::SetBounds(aBounds));
//return NS_OK;
}
void nsCalTodoComponentCanvas :: SetBackgroundColor(const nscolor &aColor)
{
// if (mWidget)
// mWidget->SetBackgroundColor(aColor);
nsXPFCCanvas::SetBackgroundColor(aColor);
}
nsEventStatus nsCalTodoComponentCanvas :: OnPaint(nsGUIEvent *aEvent)
{
mWidget->Invalidate(PR_FALSE);
return (nsEventStatus_eConsumeNoDefault);
}

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,22 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
nsCalDurationCommand.h \
nsCalDayListCommand.h \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,51 @@
/* -*- 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.
*/
#ifndef nsCalDayListCommand_h___
#define nsCalDayListCommand_h___
#include "nsXPFCCommand.h"
#include "nsCalUtilCIID.h"
#include "nsIVector.h"
#include "nsIIterator.h"
#include "nsIDateTime.h"
class nsCalDayListCommand : public nsXPFCCommand
{
public:
nsCalDayListCommand();
NS_DECL_ISUPPORTS
NS_IMETHOD Init() ;
NS_IMETHOD CreateIterator(nsIIterator ** aIterator) ;
NS_IMETHOD AddDateTime(nsIDateTime * aDateTime);
NS_IMETHOD AddDateVector(nsIVector * aDateVector);
protected:
~nsCalDayListCommand();
private:
nsIVector * mDateTimes ;
};
#endif /* nsCalDayListCommand_h___ */

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://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.
*/
#ifndef nsCalDurationCommand_h___
#define nsCalDurationCommand_h___
#include "nsXPFCCommand.h"
#include "nsDuration.h"
#include "nsCalPeriodFormat.h"
class nsCalDurationCommand : public nsXPFCCommand
{
public:
nsCalDurationCommand();
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsDuration * aDuration) ;
NS_IMETHOD_(nsDuration *) GetDuration();
NS_IMETHOD SetDuration(nsDuration * aDuration);
NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat();
NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat);
private:
nsCalPeriodFormat mPeriodFormat;
nsDuration * mDuration;
protected:
~nsCalDurationCommand();
};
#endif /* nsCalDurationCommand_h___ */

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = inc
DIRS_LIBS = src

View File

@ -0,0 +1,54 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR -DLIBJULIAN -DNSPR20
INCLUDES +=-I../inc -I$(GDEPTH)/include
LIBRARY_NAME = command
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,26 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalDurationCommand.cpp \
nsCalDayListCommand.cpp \
$(NULL)
REQUIRES = xpcom raptor trex julian nls xpfc

View File

@ -0,0 +1,120 @@
/* -*- 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 "nscore.h"
#include "nsCalDayListCommand.h"
#include "nsCalUICIID.h"
#include "nsCalUtilCIID.h"
#include "nsIVector.h"
#include "nsIIterator.h"
#include "nsxpfcCIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID);
static NS_DEFINE_IID(kCVectorIteratorCID, NS_VECTOR_ITERATOR_CID);
nsCalDayListCommand :: nsCalDayListCommand()
{
NS_INIT_REFCNT();
mDateTimes = nsnull;
}
nsCalDayListCommand :: ~nsCalDayListCommand()
{
NS_IF_RELEASE(mDateTimes);
}
NS_IMPL_ADDREF(nsCalDayListCommand)
NS_IMPL_RELEASE(nsCalDayListCommand)
nsresult nsCalDayListCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kXPFCCommandIID);
static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kCalDayListCommandCID)) {
*aInstancePtr = (void*)(nsCalDayListCommand *) (this);
AddRef();
return NS_OK;
}
return (NS_NOINTERFACE);
}
nsresult nsCalDayListCommand::Init()
{
nsresult res ;
res = nsRepository::CreateInstance(kCVectorCID,
nsnull,
kCVectorCID,
(void **)&mDateTimes);
if (NS_OK != res)
return res ;
mDateTimes->Init();
return res ;
}
nsresult nsCalDayListCommand :: CreateIterator(nsIIterator ** aIterator)
{
if (mDateTimes) {
mDateTimes->CreateIterator(aIterator);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
nsresult nsCalDayListCommand :: AddDateTime(nsIDateTime * aDateTime)
{
mDateTimes->Append(aDateTime);
return NS_OK;
}
nsresult nsCalDayListCommand :: AddDateVector(nsIVector * aDateVector)
{
NS_IF_RELEASE(mDateTimes);
mDateTimes = aDateVector;
mDateTimes->AddRef();
return NS_OK;
}

View File

@ -0,0 +1,97 @@
/* -*- 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 "nscore.h"
#include "nsCalDurationCommand.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
nsCalDurationCommand :: nsCalDurationCommand()
{
NS_INIT_REFCNT();
mDuration = nsnull;
mPeriodFormat = nsCalPeriodFormat_kHour;
}
nsCalDurationCommand :: ~nsCalDurationCommand()
{
mDuration = nsnull;
}
NS_IMPL_ADDREF(nsCalDurationCommand)
NS_IMPL_RELEASE(nsCalDurationCommand)
nsresult nsCalDurationCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kXPFCCommandIID);
static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
if (aIID.Equals(kCalDurationCommandCID)) {
*aInstancePtr = (void*)(nsCalDurationCommand *) (this);
AddRef();
return NS_OK;
}
return (NS_NOINTERFACE);
}
nsresult nsCalDurationCommand::Init(nsDuration * aDuration)
{
mDuration = aDuration;
return NS_OK;
}
nsresult nsCalDurationCommand::SetDuration(nsDuration * aDuration)
{
mDuration = aDuration;
return NS_OK;
}
nsDuration * nsCalDurationCommand::GetDuration()
{
return (mDuration);
}
nsresult nsCalDurationCommand::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat)
{
mPeriodFormat = aPeriodFormat;
return NS_OK;
}
nsCalPeriodFormat nsCalDurationCommand::GetPeriodFormat()
{
return (mPeriodFormat);
}

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,21 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
nsCalComponent.h \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,38 @@
/* -*- 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.
*/
#ifndef nsCalComponent_h___
#define nsCalComponent_h___
#include "nsICalComponent.h"
class nsCalComponent : public nsICalComponent
{
public:
nsCalComponent();
NS_DECL_ISUPPORTS
NS_IMETHOD Init() ;
protected:
~nsCalComponent();
};
#endif /* nsCalComponent_h___ */

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = public inc
DIRS_LIBS = src

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,22 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
DEPTH = ../../../../..
EXPORTS = \
nsICalComponent.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,38 @@
/* -*- 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.
*/
#ifndef nsICalComponent_h___
#define nsICalComponent_h___
#include "nsISupports.h"
//e7bba9c0-1f38-11d2-bed9-00805f8a8dbd
#define NS_ICAL_COMPONENT_IID \
{ 0xe7bba9c0, 0x1f38, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
class nsICalComponent : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
};
#endif /* nsICalComponent_h___ */

View File

@ -0,0 +1,54 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR
INCLUDES +=-I../inc
LIBRARY_NAME = component
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalComponent.cpp \
$(NULL)
REQUIRES = xpcom raptor trex

View File

@ -0,0 +1,42 @@
/* -*- 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 "nsCalComponent.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalComponentIID, NS_ICAL_COMPONENT_IID);
nsCalComponent :: nsCalComponent()
{
NS_INIT_REFCNT();
}
nsCalComponent :: ~nsCalComponent()
{
}
NS_IMPL_ADDREF(nsCalComponent)
NS_IMPL_RELEASE(nsCalComponent)
NS_IMPL_QUERY_INTERFACE(nsCalComponent, kCalComponentIID)
nsresult nsCalComponent::Init()
{
return NS_OK;
}

View File

@ -0,0 +1,47 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR
LD_LIBS += \
raptorbase \
$(NATIVE_RAPTOR_GFX) \
$(NATIVE_RAPTOR_WIDGET) \
$(NATIVE_JULIAN_DLL) \
xpcom$(MOZ_BITS) \
nsfmt$(MOZ_BITS)30 \
nsuni$(MOZ_BITS)30 \
nscck$(MOZ_BITS)30 \
nsjpn$(MOZ_BITS)30 \
nscnv$(MOZ_BITS)30 \
nssb$(MOZ_BITS)30 \
calnetwork10 \
xpfc10 \
$(XP_REG_LIB)
AR_LIBS += \
canvas \
core \
context \
component \
controller \
command \
toolkit \
$(NULL)
OS_LIBS += $(GUI_LIBS) $(MATH_LIB)
EXTRA_LIBS += $(NSPR_LIBS)

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,21 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
nsCalTimeContext.h \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,160 @@
/* -*- 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.
*/
#ifndef nsCalTimeContext_h___
#define nsCalTimeContext_h___
#include "nsICalTimeContext.h"
#include "nsXPFCCanvas.h"
#include "nsIDateTime.h"
#include "nsIXPFCObserver.h"
#include "nsIXPFCCommandReceiver.h"
#include "nsIXPFCSubject.h"
#include "nsIXPFCCommand.h"
#include "nsCalDurationCommand.h"
#include "nsCalDayListCommand.h"
#include "nsIXMLParserObject.h"
class nsCalTimeContext : public nsICalTimeContext,
public nsIXPFCObserver,
public nsIXPFCSubject,
public nsIXPFCCommandReceiver,
public nsIXMLParserObject
{
public:
nsCalTimeContext();
NS_DECL_ISUPPORTS
NS_IMETHOD Init() ;
NS_IMETHOD SetDefaultDateTime();
NS_IMETHOD SetStartTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD SetEndTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD SetFirstVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD SetLastVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD SetMajorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD SetMinorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
);
NS_IMETHOD_(PRBool) GetHorizontal();
NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat);
NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat();
NS_IMETHOD_(PRUint32) GetVisibleTimeDifference() ;
NS_IMETHOD_(PRUint32) GetFirstVisibleTime() ;
NS_IMETHOD_(PRUint32) GetLastVisibleTime() ;
NS_IMETHOD_(PRUint32) GetVisibleTimeDifference(nsCalPeriodFormat aFormat) ;
NS_IMETHOD_(PRUint32) GetFirstVisibleTime(nsCalPeriodFormat aFormat) ;
NS_IMETHOD_(PRUint32) GetLastVisibleTime(nsCalPeriodFormat aFormat) ;
NS_IMETHOD_(nsIDateTime *) GetDTStart() ;
NS_IMETHOD_(nsIDateTime *) GetDTEnd() ;
NS_IMETHOD_(nsIDateTime *) GetDTFirstVisible();
NS_IMETHOD_(nsIDateTime *) GetDTLastVisible();
NS_IMETHOD_(nsIDateTime *) GetDTMajorIncrement();
NS_IMETHOD_(nsIDateTime *) GetDTMinorIncrement();
NS_IMETHOD_(PRUint32) GetMinorIncrementInterval() ;
NS_IMETHOD_(PRUint32) GetMajorIncrementInterval() ;
NS_IMETHOD_(nsIDateTime *) GetDate() ;
NS_IMETHOD SetDate(nsIDateTime * aDateTime) ;
// nsIXPFCObserver methods
NS_IMETHOD Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand);
// nsIXPFCCommandReceiver methods
NS_IMETHOD Action(nsIXPFCCommand * aCommand);
// nsIXPFCSubject methods
NS_IMETHOD Attach(nsIXPFCObserver * aObserver);
NS_IMETHOD Detach(nsIXPFCObserver * aObserver);
NS_IMETHOD Notify(nsIXPFCCommand * aCommand);
NS_IMETHOD AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod) ;
NS_IMETHOD Copy(nsICalTimeContext * aContext);
// nsIXMLParserObject methods
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
protected:
~nsCalTimeContext();
private:
NS_IMETHOD HandleDurationCommand(nsCalDurationCommand * aDurationCommand);
NS_IMETHOD HandleDayListCommand(nsCalDayListCommand * aDayListCommand);
private:
nsIDateTime * mStartTime;
nsIDateTime * mEndTime;
nsIDateTime * mFirstVisibleTime;
nsIDateTime * mLastVisibleTime;
nsIDateTime * mMajorIncrement;
nsIDateTime * mMinorIncrement;
nsCalPeriodFormat mPeriodFormat;
PRBool mHorizontal;
nsIDateTime * mDate;
};
#endif /* nsCalTimeContext_h___ */

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = public inc
DIRS_LIBS = src

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,22 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
DEPTH = ../../../../..
EXPORTS = \
nsICalTimeContext.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,120 @@
/* -*- 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.
*/
#ifndef nsICalTimeContext_h___
#define nsICalTimeContext_h___
#include "nsISupports.h"
#include "nsIDateTime.h"
//91649a00-e9e6-11d1-9244-00805f8a7ab6
#define NS_ICAL_TIME_CONTEXT_IID \
{ 0x91649a00, 0xe9e6, 0x11d1, \
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
#include "nsCalPeriodFormat.h"
class nsICalTimeContext : public nsISupports
{
public:
NS_IMETHOD Init() = 0;
NS_IMETHOD SetDefaultDateTime() = 0;
NS_IMETHOD SetStartTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD SetEndTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD SetFirstVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD SetLastVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD SetMajorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD SetMinorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
) = 0;
NS_IMETHOD_(PRBool) GetHorizontal() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTStart() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTEnd() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTFirstVisible() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTLastVisible() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTMajorIncrement() = 0;
NS_IMETHOD_(nsIDateTime *) GetDTMinorIncrement() = 0;
NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) = 0;
NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat() = 0;
NS_IMETHOD_(PRUint32) GetVisibleTimeDifference() = 0;
NS_IMETHOD_(PRUint32) GetFirstVisibleTime() = 0;
NS_IMETHOD_(PRUint32) GetLastVisibleTime() = 0;
NS_IMETHOD_(PRUint32) GetVisibleTimeDifference(nsCalPeriodFormat aFormat) = 0;
NS_IMETHOD_(PRUint32) GetFirstVisibleTime(nsCalPeriodFormat aFormat) = 0;
NS_IMETHOD_(PRUint32) GetLastVisibleTime(nsCalPeriodFormat aFormat) = 0;
NS_IMETHOD_(PRUint32) GetMinorIncrementInterval() = 0;
NS_IMETHOD_(PRUint32) GetMajorIncrementInterval() = 0;
NS_IMETHOD_(nsIDateTime *) GetDate() = 0;
NS_IMETHOD SetDate(nsIDateTime * aDateTime) = 0;
NS_IMETHOD AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod) = 0;
NS_IMETHOD Copy(nsICalTimeContext * aContext) = 0;
};
#endif /* nsICalTimeContext_h___ */

View File

@ -0,0 +1,54 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR -DLIBJULIAN -DNSPR20
INCLUDES +=-I../inc -I$(GDEPTH)/include
LIBRARY_NAME = context
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalTimeContext.cpp \
$(NULL)
REQUIRES = shell xpcom raptor trex julian nls xpfc

View File

@ -0,0 +1,871 @@
/* -*- 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 "nsCalTimeContext.h"
#include "nsCalUICIID.h"
#include "nsCalUtilCIID.h"
#include "nsIXPFCCommand.h"
#include "nsCalDurationCommand.h"
#include "nsCalToolkit.h"
#include "nsDateTime.h"
#include "math.h"
#include "nscalstrings.h"
#include "nsIXMLParserObject.h"
static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
static NS_DEFINE_IID(kXPFCCommandCID, NS_XPFC_COMMAND_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalTimeContextIID, NS_ICAL_TIME_CONTEXT_IID);
static NS_DEFINE_IID(kCalDateTimeCID, NS_DATETIME_CID);
static NS_DEFINE_IID(kCalDateTimeIID, NS_IDATETIME_IID);
// XXX: TODO: Simplify this code!
// XXX: TODO: Much of this code should be in a nsCalTimebarContext
// XXX: TODO: DO NOT USE DateTime objects for all the private data
// elements. The overhead is not needed
nsCalTimeContext :: nsCalTimeContext()
{
NS_INIT_REFCNT();
mStartTime = nsnull;
mEndTime = nsnull;
mFirstVisibleTime = nsnull;
mLastVisibleTime = nsnull;
mMajorIncrement = nsnull;
mMinorIncrement = nsnull;
mHorizontal = PR_FALSE;
mPeriodFormat = nsCalPeriodFormat_kHour;
mDate = nsnull;
}
nsCalTimeContext :: ~nsCalTimeContext()
{
gXPFCToolkit->GetObserverManager()->Unregister((nsISupports*)(nsICalTimeContext*)this);
NS_IF_RELEASE(mStartTime);
NS_IF_RELEASE(mEndTime);
NS_IF_RELEASE(mFirstVisibleTime);
NS_IF_RELEASE(mLastVisibleTime);
NS_IF_RELEASE(mMajorIncrement);
NS_IF_RELEASE(mMinorIncrement);
NS_IF_RELEASE(mDate);
}
NS_IMPL_ADDREF(nsCalTimeContext)
NS_IMPL_RELEASE(nsCalTimeContext)
nsresult nsCalTimeContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalTimeContextIID);
static NS_DEFINE_IID(kXPFCObserverIID, NS_IXPFC_OBSERVER_IID);
static NS_DEFINE_IID(kXPFCCommandReceiverIID, NS_IXPFC_COMMANDRECEIVER_IID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kXPFCObserverIID)) {
*aInstancePtr = (void*)(nsIXPFCObserver *) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kXPFCSubjectIID)) {
*aInstancePtr = (void*) (nsIXPFCSubject *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kXPFCCommandReceiverIID)) {
*aInstancePtr = (void*)(nsIXPFCCommandReceiver *) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (NS_OK);
}
nsresult nsCalTimeContext::Copy(nsICalTimeContext * aContext)
{
mStartTime = aContext->GetDTStart()->Copy();
mEndTime = aContext->GetDTEnd()->Copy();
mFirstVisibleTime = aContext->GetDTFirstVisible()->Copy();
mLastVisibleTime = aContext->GetDTLastVisible()->Copy();
mMajorIncrement = aContext->GetDTMajorIncrement()->Copy();
mMinorIncrement = aContext->GetDTMinorIncrement()->Copy();
mDate = aContext->GetDate()->Copy();
mHorizontal = aContext->GetHorizontal();
return NS_OK;
}
nsresult nsCalTimeContext::Init()
{
/*
* Set the default to be today from 9am to 5pm
*/
SetDefaultDateTime();
return NS_OK;
}
PRBool nsCalTimeContext::GetHorizontal()
{
return mHorizontal;
}
nsIDateTime * nsCalTimeContext::GetDate()
{
return (mDate);
}
nsresult nsCalTimeContext::SetDate(nsIDateTime * aDateTime)
{
mDate = aDateTime;
return (NS_OK);
}
nsIDateTime * nsCalTimeContext::GetDTStart()
{
return (mStartTime);
}
nsIDateTime * nsCalTimeContext::GetDTEnd()
{
return (mEndTime);
}
nsIDateTime * nsCalTimeContext::GetDTFirstVisible()
{
return (mFirstVisibleTime);
}
nsIDateTime * nsCalTimeContext::GetDTLastVisible()
{
return (mLastVisibleTime);
}
nsIDateTime * nsCalTimeContext::GetDTMajorIncrement()
{
return (mMajorIncrement);
}
nsIDateTime * nsCalTimeContext::GetDTMinorIncrement()
{
return (mMinorIncrement);
}
nsresult nsCalTimeContext::SetDefaultDateTime()
{
nsresult res;
PRUint32 y,d,mo,h,mi,s;
NS_IF_RELEASE(mDate);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mDate);
if (NS_OK != res)
return res;
y = mDate->GetYear();
mo = mDate->GetMonth();
d = mDate->GetDay();
h = mDate->GetHour();
mi = mDate->GetMinute();
s = mDate->GetSecond();
SetStartTime(y,mo,d,0,0,0);
SetEndTime(y,mo,d+1,0,0,0);
SetFirstVisibleTime(y,mo,d,9,0,0);
SetLastVisibleTime(y,mo,d,17,0,0);
SetMajorIncrement(0,0,0,1,0,0);
SetMinorIncrement(0,0,0,0,15,0);
mHorizontal = PR_FALSE;
mPeriodFormat = nsCalPeriodFormat_kHour;
return res;
}
nsresult nsCalTimeContext::SetStartTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mStartTime)
{
nsresult res;
NS_IF_RELEASE(mStartTime);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mStartTime);
if (NS_OK != res)
return res;
}
mStartTime->SetYear(aYear);
mStartTime->SetMonth(aMonth);
mStartTime->SetDay(aDay);
mStartTime->SetHour(aHour);
mStartTime->SetMinute(aMinute);
mStartTime->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetEndTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mEndTime)
{
nsresult res;
NS_IF_RELEASE(mEndTime);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mEndTime);
if (NS_OK != res)
return res;
}
mEndTime->SetYear(aYear);
mEndTime->SetMonth(aMonth);
mEndTime->SetDay(aDay);
mEndTime->SetHour(aHour);
mEndTime->SetMinute(aMinute);
mEndTime->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetFirstVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mFirstVisibleTime)
{
nsresult res;
NS_IF_RELEASE(mFirstVisibleTime);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mFirstVisibleTime);
if (NS_OK != res)
return res;
}
mFirstVisibleTime->SetYear(aYear);
mFirstVisibleTime->SetMonth(aMonth);
mFirstVisibleTime->SetDay(aDay);
mFirstVisibleTime->SetHour(aHour);
mFirstVisibleTime->SetMinute(aMinute);
mFirstVisibleTime->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetLastVisibleTime(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mLastVisibleTime)
{
nsresult res;
NS_IF_RELEASE(mLastVisibleTime);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mLastVisibleTime);
if (NS_OK != res)
return res;
}
mLastVisibleTime->SetYear(aYear);
mLastVisibleTime->SetMonth(aMonth);
mLastVisibleTime->SetDay(aDay);
mLastVisibleTime->SetHour(aHour);
mLastVisibleTime->SetMinute(aMinute);
mLastVisibleTime->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetMajorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mMajorIncrement)
{
nsresult res;
NS_IF_RELEASE(mMajorIncrement);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mMajorIncrement);
if (NS_OK != res)
return res;
}
mMajorIncrement->SetYear(aYear);
mMajorIncrement->SetMonth(aMonth);
mMajorIncrement->SetDay(aDay);
mMajorIncrement->SetHour(aHour);
mMajorIncrement->SetMinute(aMinute);
mMajorIncrement->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetMinorIncrement(PRUint32 aYear,
PRUint32 aMonth,
PRUint32 aDay,
PRUint32 aHour,
PRUint32 aMinute,
PRUint32 aSecond
)
{
if (nsnull == mMinorIncrement)
{
nsresult res;
NS_IF_RELEASE(mMinorIncrement);
res = nsRepository::CreateInstance(kCalDateTimeCID,
nsnull,
kCalDateTimeCID,
(void **)&mMinorIncrement);
if (NS_OK != res)
return res;
}
mMinorIncrement->SetYear(aYear);
mMinorIncrement->SetMonth(aMonth);
mMinorIncrement->SetDay(aDay);
mMinorIncrement->SetHour(aHour);
mMinorIncrement->SetMinute(aMinute);
mMinorIncrement->SetSecond(aSecond);
return NS_OK;
}
nsresult nsCalTimeContext::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat)
{
mPeriodFormat = aPeriodFormat;
return NS_OK;
}
nsCalPeriodFormat nsCalTimeContext::GetPeriodFormat()
{
return (mPeriodFormat);
}
/*
* compute the visible time difference in units of mPeriodFormat
*/
PRUint32 nsCalTimeContext::GetVisibleTimeDifference()
{
return(GetVisibleTimeDifference(mPeriodFormat));
}
/*
* compute the visible time difference in units of mPeriodFormat
*/
PRUint32 nsCalTimeContext::GetVisibleTimeDifference(nsCalPeriodFormat aFormat)
{
PRUint32 difference = 0 ;
switch (aFormat)
{
case nsCalPeriodFormat_kYear:
difference = abs((int)(mLastVisibleTime->GetYear() - mFirstVisibleTime->GetYear()));
break;
case nsCalPeriodFormat_kMonth:
difference = abs((int)(mLastVisibleTime->GetMonth() - mFirstVisibleTime->GetMonth()));
break;
case nsCalPeriodFormat_kDay:
difference = abs((int)(mLastVisibleTime->GetDay() - mFirstVisibleTime->GetDay()));
break;
case nsCalPeriodFormat_kHour:
difference = abs((int)(mLastVisibleTime->GetHour() - mFirstVisibleTime->GetHour()));
break;
case nsCalPeriodFormat_kMinute:
difference = abs((int)(mLastVisibleTime->GetMinute() - mFirstVisibleTime->GetMinute()));
break;
case nsCalPeriodFormat_kSecond:
difference = abs((int)(mLastVisibleTime->GetSecond() - mFirstVisibleTime->GetSecond()));
break;
}
return (difference);
}
PRUint32 nsCalTimeContext::GetMajorIncrementInterval()
{
PRUint32 interval = 0 ;
switch (mPeriodFormat)
{
case nsCalPeriodFormat_kYear:
interval = mMajorIncrement->GetYear();
break;
case nsCalPeriodFormat_kMonth:
interval = mMajorIncrement->GetMonth();
break;
case nsCalPeriodFormat_kDay:
interval = mMajorIncrement->GetDay();
break;
case nsCalPeriodFormat_kHour:
interval = mMajorIncrement->GetHour();
break;
case nsCalPeriodFormat_kMinute:
interval = mMajorIncrement->GetMinute();
break;
case nsCalPeriodFormat_kSecond:
interval = mMajorIncrement->GetSecond();
break;
}
return (interval);
}
PRUint32 nsCalTimeContext::GetMinorIncrementInterval()
{
PRUint32 interval = 0 ;
switch (mPeriodFormat)
{
case nsCalPeriodFormat_kYear:
interval = mMinorIncrement->GetYear();
break;
case nsCalPeriodFormat_kMonth:
interval = mMinorIncrement->GetMonth();
break;
case nsCalPeriodFormat_kDay:
interval = mMinorIncrement->GetDay();
break;
case nsCalPeriodFormat_kHour:
interval = mMinorIncrement->GetHour();
break;
case nsCalPeriodFormat_kMinute:
interval = mMinorIncrement->GetMinute();
break;
case nsCalPeriodFormat_kSecond:
interval = mMinorIncrement->GetSecond();
break;
}
return (interval);
}
PRUint32 nsCalTimeContext::GetFirstVisibleTime()
{
return (GetFirstVisibleTime(mPeriodFormat));
}
PRUint32 nsCalTimeContext::GetFirstVisibleTime(nsCalPeriodFormat aFormat)
{
PRUint32 interval = 0 ;
switch (aFormat)
{
case nsCalPeriodFormat_kYear:
interval = mFirstVisibleTime->GetYear();
break;
case nsCalPeriodFormat_kMonth:
interval = mFirstVisibleTime->GetMonth();
break;
case nsCalPeriodFormat_kDay:
interval = mFirstVisibleTime->GetDay();
break;
case nsCalPeriodFormat_kHour:
interval = mFirstVisibleTime->GetHour();
break;
case nsCalPeriodFormat_kMinute:
interval = mFirstVisibleTime->GetMinute();
break;
case nsCalPeriodFormat_kSecond:
interval = mFirstVisibleTime->GetSecond();
break;
}
return (interval);
}
PRUint32 nsCalTimeContext::GetLastVisibleTime()
{
return (GetLastVisibleTime(mPeriodFormat));
}
PRUint32 nsCalTimeContext::GetLastVisibleTime(nsCalPeriodFormat aFormat)
{
PRUint32 interval = 0 ;
switch (aFormat)
{
case nsCalPeriodFormat_kYear:
interval = mLastVisibleTime->GetYear();
break;
case nsCalPeriodFormat_kMonth:
interval = mLastVisibleTime->GetMonth();
break;
case nsCalPeriodFormat_kDay:
interval = mLastVisibleTime->GetDay();
break;
case nsCalPeriodFormat_kHour:
interval = mLastVisibleTime->GetHour();
break;
case nsCalPeriodFormat_kMinute:
interval = mLastVisibleTime->GetMinute();
break;
case nsCalPeriodFormat_kSecond:
interval = mLastVisibleTime->GetSecond();
break;
}
return (interval);
}
/*
* We've just received a notification that someone somewhere wants our
* context to be updated. The source of the change is in aSubject
* and the target operation is in aCommand.
*
* We use QueryInterface to decide the actual types of objects.
*
* Once we've updated our internal streucture, we need to send a
* visual notification to all observers of us ...
*/
nsresult nsCalTimeContext::Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand)
{
/*
* Update our internal structure based on this update
*/
Action(aCommand);
/*
* Tell others we are updated
*/
Notify(aCommand);
return NS_OK;
}
nsresult nsCalTimeContext::Action(nsIXPFCCommand * aCommand)
{
nsCalDurationCommand * duration_command = nsnull;
nsCalDayListCommand * daylist_command = nsnull;
nsresult res;
static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID);
res = aCommand->QueryInterface(kCalDurationCommandCID,(void**)&duration_command);
if (NS_OK == res)
return (HandleDurationCommand(duration_command));
/*
* Check for DayList
*/
static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID);
res = aCommand->QueryInterface(kCalDayListCommandCID,(void**)&daylist_command);
if (NS_OK == res)
return (HandleDayListCommand(daylist_command));
return res;
}
nsresult nsCalTimeContext::HandleDayListCommand(nsCalDayListCommand * aDayListCommand)
{
/*
* Handle the DayList here...
*/
// Change our date to the first in the list
nsIIterator * iterator;
nsDateTime * datetime;
nsresult res;
// Iterate through the children
res = aDayListCommand->CreateIterator(&iterator);
if (NS_OK != res)
return res;
iterator->Init();
if(!(iterator->IsDone()))
{
datetime = (nsDateTime *) iterator->CurrentItem();
SetDate(datetime);
}
NS_IF_RELEASE(iterator);
NS_IF_RELEASE(aDayListCommand);
return NS_OK;
}
nsresult nsCalTimeContext::HandleDurationCommand(nsCalDurationCommand * aDurationCommand)
{
nsDuration * dtDuration;
dtDuration = aDurationCommand->GetDuration();
if (nsnull == dtDuration)
return NS_OK;
switch (aDurationCommand->GetPeriodFormat())
{
case nsCalPeriodFormat_kYear:
mLastVisibleTime->SetYear(mLastVisibleTime->GetYear() + dtDuration->GetYear());
mFirstVisibleTime->SetYear(mFirstVisibleTime->GetYear() + dtDuration->GetYear());
break;
case nsCalPeriodFormat_kMonth:
mLastVisibleTime->IncrementYear(dtDuration->GetYear());
mLastVisibleTime->IncrementMonth(dtDuration->GetMonth());
mLastVisibleTime->IncrementDay(dtDuration->GetDay());
mFirstVisibleTime->IncrementYear(dtDuration->GetYear());
mFirstVisibleTime->IncrementMonth(dtDuration->GetMonth());
mFirstVisibleTime->IncrementDay(dtDuration->GetDay());
mStartTime->IncrementYear(dtDuration->GetYear());
mStartTime->IncrementMonth(dtDuration->GetMonth());
mStartTime->IncrementDay(dtDuration->GetDay());
mEndTime->IncrementYear(dtDuration->GetYear());
mEndTime->IncrementMonth(dtDuration->GetMonth());
mEndTime->IncrementDay(dtDuration->GetDay());
break;
case nsCalPeriodFormat_kDay:
mLastVisibleTime->IncrementDay(dtDuration->GetDay());
mFirstVisibleTime->IncrementDay(dtDuration->GetDay());
mStartTime->IncrementDay(dtDuration->GetDay());
mEndTime->IncrementDay(dtDuration->GetDay());
break;
case nsCalPeriodFormat_kHour:
if (mLastVisibleTime->GetHour() != 23) {
mLastVisibleTime->SetHour(mLastVisibleTime->GetHour() + dtDuration->GetHour());
mFirstVisibleTime->SetHour(mFirstVisibleTime->GetHour() + dtDuration->GetHour());
}
break;
case nsCalPeriodFormat_kMinute:
mLastVisibleTime->SetMinute(mLastVisibleTime->GetMinute() + dtDuration->GetMinute());
mFirstVisibleTime->SetMinute(mFirstVisibleTime->GetMinute() + dtDuration->GetMinute());
break;
case nsCalPeriodFormat_kSecond:
mLastVisibleTime->SetSecond(mLastVisibleTime->GetSecond() + dtDuration->GetSecond());
mFirstVisibleTime->SetSecond(mFirstVisibleTime->GetSecond() + dtDuration->GetSecond());
break;
}
NS_IF_RELEASE(aDurationCommand);
return NS_OK;
}
nsresult nsCalTimeContext :: Attach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalTimeContext :: Detach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalTimeContext :: Notify(nsIXPFCCommand * aCommand)
{
nsIXPFCSubject * subject;
nsresult res = QueryInterface(kXPFCSubjectIID,(void **)&subject);
if (res != NS_OK)
return res;
return(gXPFCToolkit->GetObserverManager()->Notify(subject,aCommand));
}
nsresult nsCalTimeContext::AddPeriod(nsCalPeriodFormat aFormat, PRUint32 aPeriod)
{
switch (aFormat)
{
case nsCalPeriodFormat_kYear:
mDate->IncrementYear(aPeriod);
mLastVisibleTime->IncrementYear(aPeriod);
mFirstVisibleTime->IncrementYear(aPeriod);
mStartTime->IncrementYear(aPeriod);
mEndTime->IncrementYear(aPeriod);
break;
case nsCalPeriodFormat_kMonth:
mDate->IncrementMonth(aPeriod);
mLastVisibleTime->IncrementMonth(aPeriod);
mFirstVisibleTime->IncrementMonth(aPeriod);
mStartTime->IncrementMonth(aPeriod);
mEndTime->IncrementMonth(aPeriod);
break;
case nsCalPeriodFormat_kDay:
mDate->IncrementDay(aPeriod);
mLastVisibleTime->IncrementDay(aPeriod);
mFirstVisibleTime->IncrementDay(aPeriod);
mStartTime->IncrementDay(aPeriod);
mEndTime->IncrementDay(aPeriod);
break;
case nsCalPeriodFormat_kHour:
mDate->IncrementHour(aPeriod);
mLastVisibleTime->IncrementHour(aPeriod);
mFirstVisibleTime->IncrementHour(aPeriod);
mStartTime->IncrementHour(aPeriod);
mEndTime->IncrementHour(aPeriod);
break;
case nsCalPeriodFormat_kMinute:
mDate->IncrementMinute(aPeriod);
mLastVisibleTime->IncrementMinute(aPeriod);
mFirstVisibleTime->IncrementMinute(aPeriod);
mStartTime->IncrementMinute(aPeriod);
mEndTime->IncrementMinute(aPeriod);
break;
case nsCalPeriodFormat_kSecond:
mDate->IncrementSecond(aPeriod);
mLastVisibleTime->IncrementSecond(aPeriod);
mFirstVisibleTime->IncrementSecond(aPeriod);
mStartTime->IncrementSecond(aPeriod);
mEndTime->IncrementSecond(aPeriod);
break;
}
return NS_OK;
}
nsresult nsCalTimeContext :: SetParameter(nsString& aKey, nsString& aValue)
{
return NS_OK;
}

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,23 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
nsCalContextController.h \
nsCalTimebarContextController.h \
nsCalMonthContextController.h \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,70 @@
/* -*- 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.
*/
#ifndef nsCalContextController_h___
#define nsCalContextController_h___
#include "nsICalContextController.h"
#include "nsXPFCCanvas.h"
#include "nsIXPFCSubject.h"
#include "nsIXPFCCommand.h"
#include "nsCalPeriodFormat.h"
#include "nsDuration.h"
class nsCalContextController : public nsICalContextController,
public nsIXPFCSubject,
public nsXPFCCanvas
{
public:
nsCalContextController(nsISupports * aOuter);
NS_DECL_ISUPPORTS
// ContextController Methods
NS_IMETHOD_(void) SetOrientation(nsContextControllerOrientation eOrientation);
NS_IMETHOD_(nsContextControllerOrientation) GetOrientation();
NS_IMETHOD_(nsDuration *) GetDuration();
NS_IMETHOD SetDuration(nsDuration * aDuration);
// nsIXPFCSubject methods
NS_IMETHOD Init();
NS_IMETHOD Attach(nsIXPFCObserver * aObserver);
NS_IMETHOD Detach(nsIXPFCObserver * aObserver);
NS_IMETHOD Notify(nsIXPFCCommand * aCommand);
NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat();
NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat);
// nsIXMLParserObject methods
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
private:
nsCalPeriodFormat mPeriodFormat;
protected:
~nsCalContextController();
private:
nsContextControllerOrientation mOrientation;
nsDuration * mDuration;
};
#endif /* nsCalContextController_h___ */

View File

@ -0,0 +1,279 @@
/* -*- 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.
*/
#ifndef nsCalMonthContextController_h___
#define nsCalMonthContextController_h___
#include "nsCalContextController.h"
#include "jdefines.h"
#include "datetime.h"
#include <locid.h>
#include "nsIWidget.h"
#include "nsIFontMetrics.h"
#include "nsString.h"
class DateTime;
class CMouseEvent;
class CMiniCalEvent;
class JulianPtrArray;
class nsCalMonthContextController : public nsCalContextController
{
public:
nsCalMonthContextController(nsISupports* outer);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:
~nsCalMonthContextController();
public:
enum EALIGNMENT {LEFT, RIGHT, CENTER};
protected:
/*
* Data members defining state and "non-ui" aspects of the the MiniCal
*/
PRBool m_bGrid; // show the grid?
PRBool m_bSep; // show separator below day of week column headings
PRBool m_bWeeks; // show weeks?
PRBool m_bColumnSelectMode; // select by rows or columns?
PRBool m_bArrows; // are arrows enabled
DateTime m_ULDate; // represents the month that is shown in the upper left corner
DateTime m_Date; // the currently selected date
nscolor m_MCBGColor; // background color for minicals
nscolor m_DIMFGColor; // background color for the dates before and after current month
nscolor m_CurDayFGColor; // foreground for current date
nscolor m_CurDayBGColor; // background for current date
nscolor m_HighlightFGColor; // foreground for current date
nscolor m_HighlightBGColor; // background for current date
int m_iFDOW; // what day do we show as first-day-of-the-week
public:
inline PRBool GetArrows() { return m_bArrows; }
inline void SetArrows(PRBool b) { m_bArrows = b; }
inline PRBool GetGrid() { return m_bGrid; }
inline void SetGrid(PRBool b) { m_bGrid = b; }
inline PRBool GetSeparator() { return m_bSep; }
inline void SetSeparator(PRBool b) { m_bSep = b; }
inline PRBool GetWeeks() { return m_bWeeks; }
inline void SetWeeks(PRBool b) { m_bWeeks = b; }
inline int GetFDOW() { return m_iFDOW; }
void SetFDOW(int i);
DateTime& GetDate() { return m_ULDate; }
inline void SetDate(DateTime d) { m_ULDate = d; }
inline void SetMCBGColor(int r, int g, int b) { m_MCBGColor = NS_RGB(r,g,b); }
inline nscolor GetMCBGColor() { return m_MCBGColor; }
inline void SetDIMFGColor(int r, int g, int b) { m_DIMFGColor = NS_RGB(r,g,b); }
inline nscolor GetDIMFGColor() { return m_DIMFGColor; }
inline void SetCurrentDayFGColor(int r, int g, int b) { m_CurDayFGColor = NS_RGB(r,g,b); }
inline nscolor GetCurrentDayFGColor() { return m_CurDayFGColor; }
inline void SetCurrentDayBGColor(int r, int g, int b) { m_CurDayBGColor = NS_RGB(r,g,b); }
inline nscolor GetCurrentDayBGColor() { return m_CurDayBGColor; }
inline void SetHighlightFGColor(int r, int g, int b) { m_HighlightFGColor = NS_RGB(r,g,b); }
inline nscolor GetHighlightFGColor() { return m_HighlightFGColor; }
inline void SetHighlightBGColor(int r, int g, int b) { m_HighlightBGColor = NS_RGB(r,g,b); }
inline nscolor GetHighlightBGColor() { return m_HighlightBGColor; }
nsString ToString();
protected:
EALIGNMENT m_eTitleAlign; // how the is title aligned
Locale m_Locale; // in what local are we working
int m_iFontSize; // point size of font
int m_iDOWChars; // number of chars to show in the day of the week col hdr
int m_iDigitWidth; // width of a digit 0 - 9
int m_iMaxDOWColHdrWidth; // max width of dow col hdr string
int m_iDigitHeight; // height of a digit
int m_iNumRows; // number of cell rows per minical
int m_iNumCols; // number of cell cols per minical
int m_iCellWidth; // total width of a minical cell
int m_iCellHeight; // total height of a minical cell
int m_iCellHorzSpacing; // horizontal space in addition to the character width in a cell
int m_iCellVertSpacing; // vertical space in addition to the character height
int m_iMCWidth; // total width of a single minical
int m_iMCHeight; // total height of a single minical
int m_iMCVertSpacing; // vertical spacing between minicals
int m_iMCHorzSpacing; // horizontal spacing between minicals
int m_iMCRows; // number of rows of minicals for current window height
int m_iMCCols; // number of columns of minicals for current window width
int m_iWidth; // combined width of all minicals
int m_iHeight; // combined height of all minicals
int m_iTMCW; // total minical width
int m_iTMCH; // total minical height;
int m_iPikMCCol; // which column of minicals
int m_iPikMCRow; // which row of minicals
int m_iMCX; // x coord relative to upper left of m_iPikMC
int m_iMCY; // y coord relative to upper left of m_iPikMC
int m_iCellCol; // which cell column of m_iPikMC
int m_iCellRow; // which cell row of m_iPikMC
int m_iAnchorMCCol; // column in which the drag was anchored
int m_iAnchorMCRow; // row in which the drag was anchored
int m_iYOffset;
int m_iXOffset; // this far from the right edge of the cell.
int m_iCmdArmed; // mouse down started on this command
char* m_asDOW[7]; // array holding the days of the week names
char* m_asMonths[12]; // names for the months of the year
int m_iMatrixSize; // the buffers below are valid for m_iMCRows*m_iMCCols is less that the value of this number
Date* m_pStartTimeMap; // buffer for a matrix of start times corresponding to the first day in each minical
int* m_pValidPosMap; // buffer for a matrix of start/stop valid cell positions
JulianPtrArray *m_pDates; // Selected dates
/*
* Internal methods
*/
int ResizeMapBuffers();
void SetFDOW(DateTime &d);
public:
/*
* General requests for the Bridge...
*/
void DrawMiniCal(void* p);
void RemoveSelectedDate(DateTime d);
void UnhighlightDate(DateTime d);
void SetDateCoords(DateTime d, int& iCellX, int& m_iCellY);
void HandleEvent(CMiniCalEvent* pe);
void SetMousePickInfo(CMiniCalEvent* e);
nsresult HandleColSelect(CMiniCalEvent* pe);
nsresult HandleWeekSelect(CMiniCalEvent* pe);
nsresult HandleDaySelect(CMiniCalEvent* pe);
NS_IMETHOD GetDOWList(int iDOW);
int FindDate(CMiniCalEvent* e);
void FindDOW(CMiniCalEvent* e);
int SetPaintValues();
inline int GetFontSize() { return m_iFontSize; }
inline void SetFontSize(int i) { m_iFontSize = i; }
inline nsString GetFontName() { return m_sFontName; }
inline void SetFontName(nsString s) { m_sFontName = s; }
inline int GetMCVertSpacing() { return m_iMCVertSpacing; }
inline void SetMCVertSpacing(int i) { m_iMCVertSpacing = i; }
inline int GetMCHorzSpacing() { return m_iMCHorzSpacing; }
inline void SetMCHorzSpacing(int i) { m_iMCHorzSpacing = i; }
inline int GetCellVertSpacing() { return m_iCellVertSpacing;}
inline void SetCellVertSpacing(int i) { m_iCellVertSpacing = i; }
inline int GetCellHorzSpacing() { return m_iCellHorzSpacing;}
inline void SetCellHorzSpacing(int i) { m_iCellHorzSpacing = i; }
inline int GetDOWColHdrChars() { return m_iDOWChars; }
inline void SetDOWColHdrChars(int i) { m_iDOWChars = i; }
inline int GetWidth() { return m_iWidth; }
inline int GetHeight() { return m_iHeight; }
inline int GetCellWidth() { return m_iCellWidth; }
inline int GetCellHeight() { return m_iCellHeight; }
inline int GetMCWidth() { return m_iMCWidth; }
inline int GetMCHeight() { return m_iMCHeight; }
inline int GetMCRows() { return m_iMCRows; }
inline int GetMCCols() { return m_iMCCols; }
inline int GetCellRows() { return m_iNumRows; }
inline int GetCellCols() { return m_iNumCols; }
inline int GetTMCW() { return m_iTMCW; }
inline int GetTMCH() { return m_iTMCH; }
inline int GetPikMCCol() { return m_iPikMCCol; }
inline int GetPikMCRow() { return m_iPikMCRow; }
inline int GetMCX() { return m_iMCX; }
inline int GetMCY() { return m_iMCY; }
inline int GetCellCol() { return m_iCellCol; }
inline int GetCellRow() { return m_iCellRow; }
inline int GetAnchorMCCol() { return m_iAnchorMCCol; }
inline int GetAnchorMCRow() { return m_iAnchorMCRow; }
inline void SetLocale(const Locale l) { m_Locale = l; SetDOWNameArray(1); SetMonthsArray(); }
Locale& GetLocale() { return m_Locale; }
inline char** GetDOWArray() { return m_asDOW; }
inline char** GetMonthArray() { return m_asMonths; }
inline JulianPtrArray* GetDateList() { return m_pDates; }
void SetSelectedDates(JulianPtrArray* pV);
void ClearDateList();
inline Date GetStartTimeMap(int iRow, int iCol) { return m_pStartTimeMap[iRow * m_iMCCols + iCol ]; }
inline void SetStartTimeMap(int iRow, int iCol, Date dVal) { m_pStartTimeMap[iRow * m_iMCCols + iCol] = dVal; }
void GetValidPos(int iRow, int iCol, int* piPosStart, int* piPosStop);
void SetValidPos(int iRow, int iCol, int iPosStart, int iPosStop);
inline void SetValidPos(int iRow, int iCol, int iVal) {m_pValidPosMap[iRow * m_iMCCols + iCol] = iVal;}
inline void SetTitleAlignment(EALIGNMENT e) { m_eTitleAlign = e; }
inline EALIGNMENT GetTitleAlignment() { return m_eTitleAlign; }
void SetDOWNameArray(PRBool bLocaleChange);
void SetMonthsArray();
void PaintMiniCalElement(void* p, int iRow,int iCol, int iTotRows, int iTotCols, int iXLeft, int iYTop, DateTime& baseDate, PRBool bLeading );
void HighlightCell(DateTime d, nscolor fg, nscolor bg, int iX, int iY);
void HighlightCell(DateTime d, nscolor fg, nscolor bg);
protected:
nsString m_sFontName; // the name of the font face
public:
NS_IMETHOD_(nsEventStatus) OnPaint(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);
// Operations
public:
// Implementation
public:
void InitRedraw(void* p);
void PostRedraw(void* p);
void GetTextExtent(char* p, int iChars, int& iWidth,int& iHeight);
void GetFontInfo(nsString s, int iFontSize, int iStyle,int& riDigitWidth, int& riDigitOutput, int& iMaxWidth );
void GetWindowSize(int& riWidth, int& riHeight);
// nsIXPFCObserver methods
NS_IMETHOD Update(nsIXPFCSubject * aSubject, nsIXPFCCommand * aCommand);
// nsIXPFCCommandReceiver methods
NS_IMETHOD Action(nsIXPFCCommand * aCommand);
void SetDefaults();
protected:
nsresult GetWeekDateList(int iWeekOffset);
nsresult HighlightActionList();
void ClearActionDateList();
nsresult AddToActionList(DateTime d);
void CommitArrow(int iDayVal, int iMonthVal);
void CommitDateList();
nsIVector * m_ActionDateList; // Interactive DateList as we move the mouse
};
#endif /* nsCalMonthContextController_h___ */

View File

@ -0,0 +1,56 @@
/* -*- 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.
*/
#ifndef nsCalTimebarContextController_h___
#define nsCalTimebarContextController_h___
#include "nsCalContextController.h"
class nsCalTimebarContextController : public nsCalContextController
{
public:
nsCalTimebarContextController(nsISupports * aOuter);
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
// Subclass Canvas functions
NS_IMETHOD_(nsEventStatus) PaintForeground(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent);
// nsIXMLParserObject methods
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:
~nsCalTimebarContextController();
private:
NS_METHOD GetTrianglePoints(nsPoint * pts);
NS_METHOD_(PRBool) IsPointInTriangle(nsPoint aPoint, nsPoint * aTriangle);
NS_METHOD RenderController(nsIRenderingContext * aCtx,
nsPoint* aPoints,
PRUint32 aNumPoints);
};
#endif /* nsCalTimebarContextController_h___ */

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = public inc
DIRS_LIBS = src

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,22 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
DEPTH = ../../../../..
EXPORTS = \
nsICalContextController.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,60 @@
/* -*- 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.
*/
#ifndef nsICalContextController_h___
#define nsICalContextController_h___
#include "nsISupports.h"
#include "nsDateTime.h"
#include "nsDuration.h"
#include "nsCalPeriodFormat.h"
//aefb24f0-e9e5-11d1-9244-00805f8a7ab6
#define NS_ICAL_CONTEXT_CONTROLLER_IID \
{ 0xaefb24f0, 0xe9e5, 0x11d1, \
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
// ContextController Orientation
enum nsContextControllerOrientation
{
nsContextControllerOrientation_north,
nsContextControllerOrientation_south,
nsContextControllerOrientation_east,
nsContextControllerOrientation_west,
nsContextControllerOrientation_default
};
class nsICalContextController : public nsISupports
{
public:
NS_IMETHOD_(void) SetOrientation(nsContextControllerOrientation eOrientation) = 0;
NS_IMETHOD_(nsContextControllerOrientation) GetOrientation() = 0;
NS_IMETHOD_(nsDuration *) GetDuration() = 0 ;
NS_IMETHOD SetDuration(nsDuration * aDuration) = 0;
NS_IMETHOD_(nsCalPeriodFormat) GetPeriodFormat() = 0;
NS_IMETHOD SetPeriodFormat(nsCalPeriodFormat aPeriodFormat) = 0;
};
#endif /* nsICalContextController_h___ */

View File

@ -0,0 +1,54 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,24 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR -DLIBJULIAN -DNSPR20
INCLUDES +=-I../inc -I$(GDEPTH)/include
LIBRARY_NAME = controller
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,27 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalContextController.cpp \
nsCalTimebarContextController.cpp \
nsCalMonthContextController.cpp \
$(NULL)
REQUIRES = shell xpcom raptor trex julian nls xpfc

View File

@ -0,0 +1,222 @@
/* -*- 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 "nsCalContextController.h"
#include "nsIXPFCSubject.h"
#include "nsCalUICIID.h"
#include "nsCalUtilCIID.h"
#include "nsCalToolkit.h"
#include "nsIXPFCCommand.h"
#include "nscalstrings.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalContextControllerIID, NS_ICAL_CONTEXT_CONTROLLER_IID);
static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
static NS_DEFINE_IID(kXPFCCommandCID, NS_XPFC_COMMAND_CID);
#define kNotFound -1
nsCalContextController :: nsCalContextController(nsISupports * aOuter) : nsXPFCCanvas(aOuter)
{
NS_INIT_REFCNT();
mOrientation = nsContextControllerOrientation_west;
mDuration = nsnull;
mPeriodFormat = nsCalPeriodFormat_kHour;
}
nsCalContextController :: ~nsCalContextController()
{
NS_IF_RELEASE(mDuration);
}
nsresult nsCalContextController::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalContextControllerIID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kXPFCSubjectIID)) {
*aInstancePtr = (void*) (nsIXPFCSubject *)this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsXPFCCanvas::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalContextController)
NS_IMPL_RELEASE(nsCalContextController)
void nsCalContextController :: SetOrientation(nsContextControllerOrientation eOrientation)
{
mOrientation = eOrientation;
}
nsContextControllerOrientation nsCalContextController :: GetOrientation()
{
return (mOrientation);
}
nsresult nsCalContextController :: Init()
{
static NS_DEFINE_IID(kCalDurationCID, NS_DURATION_CID);
static NS_DEFINE_IID(kCalDurationIID, NS_IDURATION_IID);
nsresult res = nsRepository::CreateInstance(kCalDurationCID,
nsnull,
kCalDurationCID,
(void **)&mDuration);
if (NS_OK != res)
return res;
mDuration->SetYear(0);
mDuration->SetMonth(0);
mDuration->SetDay(0);
mDuration->SetHour(0);
mDuration->SetMinute(0);
mDuration->SetSecond(0);
return (nsXPFCCanvas::Init());
}
nsresult nsCalContextController :: Attach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalContextController :: Detach(nsIXPFCObserver * aObserver)
{
return NS_OK;
}
nsresult nsCalContextController :: Notify(nsIXPFCCommand * aCommand)
{
nsIXPFCSubject * subject;
nsresult res = QueryInterface(kXPFCSubjectIID,(void **)&subject);
if (res != NS_OK)
return res;
return(gXPFCToolkit->GetObserverManager()->Notify(subject,aCommand));
}
nsresult nsCalContextController :: SetDuration(nsDuration * aDuration)
{
mDuration = aDuration;
return NS_OK;
}
nsDuration * nsCalContextController :: GetDuration()
{
return (mDuration);
}
nsresult nsCalContextController::SetPeriodFormat(nsCalPeriodFormat aPeriodFormat)
{
mPeriodFormat = aPeriodFormat;
return NS_OK;
}
nsCalPeriodFormat nsCalContextController::GetPeriodFormat()
{
return (mPeriodFormat);
}
nsresult nsCalContextController :: SetParameter(nsString& aKey, nsString& aValue)
{
/*
* Orientation
*/
if (aKey.EqualsIgnoreCase(CAL_STRING_ORIENTATION)) {
if (aValue.EqualsIgnoreCase(CAL_STRING_EAST))
SetOrientation(nsContextControllerOrientation_east);
else if (aValue.EqualsIgnoreCase(CAL_STRING_WEST))
SetOrientation(nsContextControllerOrientation_west);
else if (aValue.EqualsIgnoreCase(CAL_STRING_NORTH))
SetOrientation(nsContextControllerOrientation_north);
else if (aValue.EqualsIgnoreCase(CAL_STRING_SOUTH))
SetOrientation(nsContextControllerOrientation_south);
// XXX: TODO the actual orientation in this case depends on
// the layout objects orientation!
else if (aValue.EqualsIgnoreCase(CAL_STRING_NORTHWEST))
SetOrientation(nsContextControllerOrientation_north);
else if (aValue.EqualsIgnoreCase(CAL_STRING_SOUTHEAST))
SetOrientation(nsContextControllerOrientation_south);
}
/*
* Context Rule
*/
else if (aKey.EqualsIgnoreCase(CAL_STRING_USECTXRULE)) {
// XXX: Look at value "Day+1" to determine how to assign our
// datetime object and whether it is positive or negative
PRInt32 i ;
if (aValue.Find(CAL_STRING_SECOND) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kSecond);
nsString string = aValue.Cut(0,6);
mDuration->SetSecond(string.ToInteger(&i));
} else if (aValue.Find(CAL_STRING_MINUTE) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kMinute);
nsString string = aValue.Cut(0,6);
mDuration->SetMinute(string.ToInteger(&i));
} else if (aValue.Find(CAL_STRING_HOUR) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kHour);
nsString string = aValue.Cut(0,4);
mDuration->SetHour(string.ToInteger(&i));
} else if (aValue.Find(CAL_STRING_DAY) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kDay);
nsString string = aValue.Cut(0,3);
mDuration->SetDay(string.ToInteger(&i));
} else if (aValue.Find(CAL_STRING_MONTH) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kMonth);
nsString string = aValue.Cut(0,5);
mDuration->SetMonth(string.ToInteger(&i));
} else if (aValue.Find(CAL_STRING_YEAR) != kNotFound) {
SetPeriodFormat(nsCalPeriodFormat_kMonth);
nsString string = aValue.Cut(0,4);
mDuration->SetYear(string.ToInteger(&i));
}
}
return (nsXPFCCanvas::SetParameter(aKey, aValue));
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,286 @@
/* -*- 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 "nsCalTimebarContextController.h"
#include "nsCalUICIID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCalContextControllerIID, NS_ICAL_CONTEXT_CONTROLLER_IID);
static NS_DEFINE_IID(kXPFCSubjectIID, NS_IXPFC_SUBJECT_IID);
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
static NS_DEFINE_IID(kCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID);
#define DEFAULT_WIDTH 25
#define DEFAULT_HEIGHT 25
#include "nsCalDurationCommand.h"
nsCalTimebarContextController :: nsCalTimebarContextController(nsISupports * aOuter) : nsCalContextController(aOuter)
{
NS_INIT_REFCNT();
}
nsCalTimebarContextController :: ~nsCalTimebarContextController()
{
}
nsresult nsCalTimebarContextController::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kCalContextControllerIID);
if (aIID.Equals(kClassIID)) {
*aInstancePtr = (void*) this;
AddRef();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) (this);
AddRef();
return NS_OK;
}
return (nsCalContextController::QueryInterface(aIID, aInstancePtr));
}
NS_IMPL_ADDREF(nsCalTimebarContextController)
NS_IMPL_RELEASE(nsCalTimebarContextController)
nsEventStatus nsCalTimebarContextController :: PaintForeground(nsGUIEvent *aEvent)
{
nsPoint pts[3];
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
rndctx->SetColor(GetForegroundColor());
GetTrianglePoints(pts);
RenderController(rndctx, pts,3);
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarContextController :: RenderController(nsIRenderingContext * aCtx,
nsPoint * aPoints,
PRUint32 aNumPoints)
{
aCtx->FillPolygon(aPoints,aNumPoints);
switch(GetOrientation())
{
case nsContextControllerOrientation_east:
aCtx->SetColor(Highlight(GetForegroundColor()));
aCtx->DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y);
aCtx->DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y);
aCtx->SetColor(Dim(GetForegroundColor()));
aCtx->DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y);
break;
case nsContextControllerOrientation_west:
aCtx->SetColor(Highlight(Highlight(GetForegroundColor())));
aCtx->DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y);
aCtx->SetColor(Dim(GetForegroundColor()));
aCtx->DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y);
aCtx->DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y);
break;
case nsContextControllerOrientation_north:
aCtx->SetColor(Highlight(Highlight(GetForegroundColor())));
aCtx->DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y);
aCtx->SetColor(Highlight(GetForegroundColor()));
aCtx->DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y);
aCtx->SetColor(Dim(GetForegroundColor()));
aCtx->DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y);
break;
case nsContextControllerOrientation_south:
aCtx->SetColor(Dim(GetForegroundColor()));
aCtx->DrawLine(aPoints[0].x,aPoints[0].y,aPoints[1].x,aPoints[1].y);
aCtx->DrawLine(aPoints[1].x,aPoints[1].y,aPoints[2].x,aPoints[2].y);
aCtx->SetColor(Highlight(GetForegroundColor()));
aCtx->DrawLine(aPoints[2].x,aPoints[2].y,aPoints[0].x,aPoints[0].y);
break;
}
return (NS_OK);
}
nsresult nsCalTimebarContextController :: Init()
{
return (nsCalContextController::Init());
}
nsresult nsCalTimebarContextController :: GetTrianglePoints(nsPoint * pts)
{
nsRect rect;
PRUint32 widthPart, widthHalf;
PRUint32 heightPart, heightHalf;
GetBounds(rect);
widthPart = (PRUint32)(((float)rect.width) * 0.2f);
heightPart = (PRUint32)(((float)rect.height) * 0.2f);
widthHalf = (PRUint32)(((float)rect.width) * 0.5f);
heightHalf = (PRUint32)(((float)rect.height) * 0.5f);
switch(GetOrientation())
{
case nsContextControllerOrientation_east:
pts[0].x = rect.x + widthPart;
pts[0].y = rect.y + heightPart;
pts[1].x = rect.x + rect.width - widthPart;
pts[1].y = rect.y + heightHalf;
pts[2].x = rect.x + widthPart;
pts[2].y = rect.y + rect.height - heightPart;
break;
case nsContextControllerOrientation_west:
pts[0].x = rect.x + rect.width - widthPart;
pts[0].y = rect.y + heightPart;
pts[1].x = rect.x + widthPart;
pts[1].y = rect.y + heightHalf;
pts[2].x = rect.x + rect.width - widthPart;
pts[2].y = rect.y + rect.height - heightPart;
break;
case nsContextControllerOrientation_north:
pts[0].x = rect.x + widthPart;
pts[0].y = rect.y + rect.height - heightPart;
pts[1].x = rect.x + widthHalf;
pts[1].y = rect.y + heightPart;
pts[2].x = rect.x + rect.width - widthPart;
pts[2].y = rect.y + rect.height - heightPart;
break;
case nsContextControllerOrientation_south:
pts[0].x = rect.x + widthPart;
pts[0].y = rect.y + heightPart;
pts[1].x = rect.x + widthHalf;
pts[1].y = rect.y + rect.height - heightPart;
pts[2].x = rect.x + rect.width - widthPart;
pts[2].y = rect.y + heightPart;
break;
}
return NS_OK;
}
/*
* Need to implement point in triangle intersection
*/
PRBool nsCalTimebarContextController::IsPointInTriangle(nsPoint aPoint, nsPoint * aTrinagle)
{
return PR_TRUE;
}
/*
* If the user clicked on the foreground drawing area for the context controller,
* notify the relevant context[s]
*/
nsEventStatus nsCalTimebarContextController::OnLeftButtonDown(nsGUIEvent *aEvent)
{
nsPoint pts[3];
nsRect rect;
GetBounds(rect);
GetTrianglePoints(pts);
if (IsPointInTriangle(aEvent->point, pts) == PR_TRUE) {
/*
* Notify the Observers of the appropriate Command
*
*/
nsCalDurationCommand * command;
nsresult res = nsRepository::CreateInstance(kCalDurationCommandCID,
nsnull,
kXPFCCommandIID,
(void **)&command);
if (NS_OK != res)
return nsEventStatus_eConsumeNoDefault ;
command->Init(GetDuration());
command->SetPeriodFormat(GetPeriodFormat());
Notify(command);
NS_IF_RELEASE(command);
}
return nsEventStatus_eConsumeNoDefault;
}
nsresult nsCalTimebarContextController :: SetParameter(nsString& aKey, nsString& aValue)
{
return (nsCalContextController::SetParameter(aKey, aValue));
}
nsresult nsCalTimebarContextController :: GetClassPreferredSize(nsSize& aSize)
{
aSize.width = DEFAULT_WIDTH;
aSize.height = DEFAULT_HEIGHT;
return (NS_OK);
}

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,23 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
nsCalUICIID.h \
nsCalPeriodFormat.h \
nscalstrings.h \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,35 @@
/* -*- 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.
*/
#ifndef nsCalPeriodFormat_h___
#define nsCalPeriodFormat_h___
typedef enum {
nsCalPeriodFormat_kYear,
nsCalPeriodFormat_kMonth,
nsCalPeriodFormat_kDay,
nsCalPeriodFormat_kHour,
nsCalPeriodFormat_kMinute,
nsCalPeriodFormat_kSecond,
nsCalPeriodFormat_kMinutesInDay
} nsCalPeriodFormat;
#endif

View File

@ -0,0 +1,121 @@
/* -*- 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.
*/
#ifndef nsCalUICIID_h__
#define nsCalUICIID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsRepository.h"
//29bd8f10-e9e6-11d1-9244-00805f8a7ab6
#define NS_CAL_CONTEXT_CONTROLLER_CID \
{ 0x29bd8f10, 0xe9e6, 0x11d1, \
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//36658790-2032-11d2-9246-00805f8a7ab6
#define NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID \
{ 0x36658790, 0x2032, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//07fdbd10-21bb-11d2-9246-00805f8a7ab6
#define NS_CAL_MONTH_CONTEXT_CONTROLLER_CID \
{ 0x07fdbd10, 0x21bb, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//b0d4fa90-e9e6-11d1-9244-00805f8a7ab6
#define NS_CAL_TIME_CONTEXT_CID \
{ 0xb0d4fa90, 0xe9e6, 0x11d1, \
{ 0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//7013faa0-1f39-11d2-bed9-00805f8a8dbd
#define NS_CAL_COMPONENT_CID \
{ 0x7013faa0, 0x1f39, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//8bf4b740-200d-11d2-9246-00805f8a7ab6
#define NS_CAL_TOOLKIT_CID \
{ 0x8bf4b740, 0x200d, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//757fbd20-2039-11d2-9246-00805f8a7ab6
#define NS_CAL_DURATION_COMMAND_CID \
{ 0x757fbd20, 0x2039, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//489a6750-224d-11d2-9246-00805f8a7ab6
#define NS_CAL_DAYLIST_COMMAND_CID \
{ 0x489a6750, 0x224d, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//6e645390-edba-11d1-bec6-00805f8a8dbd
#define NS_CAL_TIMEBARCANVAS_CID \
{ 0x6e645390, 0xedba, 0x11d1, \
{ 0xbe, 0xc6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//025d7730-edbc-11d1-bec6-00805f8a8dbd
#define NS_CAL_TIMEBARCOMPONENTCANVAS_CID \
{ 0x025d7730, 0xedbc, 0x11d1, \
{ 0xbe, 0xc6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//65620940-1b64-11d2-9246-00805f8a7ab6
#define NS_CAL_TODOCOMPONENTCANVAS_CID \
{ 0x65620940, 0x1b64, 0x11d2, \
{ 0x92, 0x64, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//d6da5f20-1b61-11d2-9246-00805f8a7ab6
#define NS_CAL_TIMEBARHEADING_CID \
{ 0xd6da5f20, 0x1b61, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//994b4280-1db7-11d2-bed9-00805f8a8dbd
#define NS_CAL_TIMEBARUSERHEADING_CID \
{ 0x994b4280, 0x1db7, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//560bd2a0-1db6-11d2-bed9-00805f8a8dbd
#define NS_CAL_TIMEBARTIMEHEADING_CID \
{ 0x560bd2a0, 0x1db6, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//940fda80-1b66-11d2-9246-00805f8a7ab6
#define NS_CAL_TIMEBARSCALE_CID \
{ 0x940fda80, 0x1b66, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//5b6775e0-1c39-11d2-9246-00805f8a7ab6
#define NS_CAL_MULTIDAYVIEWCANVAS_CID \
{ 0x5b6775e0, 0x1c39, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//879f3230-1da4-11d2-bed9-00805f8a8dbd
#define NS_CAL_DAYVIEWCANVAS_CID \
{ 0x879f3230, 0x1da4, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
//f5b41150-218e-11d2-9246-00805f8a7ab6
#define NS_CAL_STATUSCANVAS_CID \
{ 0xf5b41150, 0x218e, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
//107f9a00-218f-11d2-9246-00805f8a7ab6
#define NS_CAL_COMMANDCANVAS_CID \
{ 0x107f9a00, 0x218f, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
#endif

View File

@ -0,0 +1,81 @@
/* -*- 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.
*/
#ifndef NS_CALSTRINGS__
#define NS_CALSTRINGS__
#define CAL_STRING_BACKGROUNDCOLOR "backgroundcolor"
#define CAL_STRING_CLASS "class"
#define CAL_STRING_CONTROL "control"
#define CAL_STRING_DAY "day"
#define CAL_STRING_DEFAULTUSERNAME "A Default UserName"
#define CAL_STRING_CONTAINER "container"
#define CAL_STRING_COUNT "count"
#define CAL_STRING_CTX "ctx"
#define CAL_STRING_DAY "day"
#define CAL_STRING_EAST "east"
#define CAL_STRING_DEFAULT "default"
#define CAL_STRING_FOREGROUNDCOLOR "foregroundcolor"
#define CAL_STRING_HEIGHT "height"
#define CAL_STRING_HOUR "hour"
#define CAL_STRING_PREF_JULIAN_UI_XML_MENUBAR "julian.ui.xml.menubar"
#define CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR "julian.ui.xml.calendar"
#define CAL_STRING_ID "id"
#define CAL_STRING_LABEL "label"
#define CAL_STRING_LAYOUT "layout"
#define CAL_STRING_MAXREPEAT "maxrepeat"
#define CAL_STRING_MINREPEAT "minrepeat"
#define CAL_STRING_MINUTE "minute"
#define CAL_STRING_MONTH "month"
#define CAL_STRING_NAME "name"
#define CAL_STRING_NORTH "north"
#define CAL_STRING_NORTHWEST "northwest"
#define CAL_STRING_ORIENTATION "orientation"
#define CAL_STRING_PANEL "panel"
#define CAL_STRING_RESOURCE_UI_MENUBAR "resource://res/ui/menubar.ui"
#define CAL_STRING_RESOURCE_UI_CALENDAR "resource://res/ui/julian.cal"
#define CAL_STRING_RULE "rule"
#define CAL_STRING_SECOND "second"
#define CAL_STRING_SETBACKGROUNDCOLOR "setbackgroundcolor"
#define CAL_STRING_SOUTH "south"
#define CAL_STRING_SOUTHEAST "southeast"
#define CAL_STRING_TIMEBAR_USER_HEADING "timebaruserheading"
#define CAL_STRING_TITLE "title"
#define CAL_STRING_TYPE "type"
#define CAL_STRING_USECTXRULE "usectxrule"
#define CAL_STRING_USEPREFERREDSIZE "usepreferredsize"
#define CAL_STRING_WEIGHTMAJOR "weightmajor"
#define CAL_STRING_WEIGHTMINOR "weightminor"
#define CAL_STRING_WEST "west"
#define CAL_STRING_WIDTH "width"
#define CAL_STRING_XBOX "xbox"
#define CAL_STRING_YBOX "ybox"
#define CAL_STRING_YEAR "year"
#define CAL_STRING_PREF_LOCAL_ADDRESS "cal.localCalAddress"
#define CAL_STRING_PREF_LOCAL_ADDRESS_DEFAULT "file://localhost/$USERPROFILE/cal/$USERNAME"
#define CAL_STRING_PREF_PREFERRED_ADDR "cal.preferredCalAddress"
#define CAL_STRING_PREF_PREFERRED_ADDR_DEFAULT CAL_STRING_PREF_LOCAL_ADDRESS_DEFAULT
#define CAL_STRING_PREF_USERNAME "cal.username"
#define CAL_STRING_PREF_USERNAME_DEFAULT "$USERNAME"
#define CAL_STRING_PREF_USER_DISPLAY_NAME "cal.userDisplayName"
#define CAL_STRING_PREF_USER_DISPLAY_NAME_DEFAULT "$USERNAME"
#endif

View File

@ -0,0 +1,15 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../..
DEPTH = ../../../..
DIRS_EXPORT = public inc
DIRS_LIBS = src

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,21 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
DEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = raptor

View File

@ -0,0 +1,54 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/ruleset.mk
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
CFLAGS +=-D_IMPL_NS_CALENDAR -DNSPR20
INCLUDES += -I../inc -I$(GDEPTH)/include
LIBRARY_NAME = core
LIBRARY_VERSION = 10
ARCHIVE_ONLY = 1
TARGETS = $(LIBRARY)

View File

@ -0,0 +1,25 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../../../..
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
CPPSRCS = \
nsCalFactory.cpp \
$(NULL)
REQUIRES = shell xpcom raptor trex julian nls xpfc

View File

@ -0,0 +1,275 @@
/* -*- 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 "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsCalUICIID.h"
#include "nsCalTimeContext.h"
#include "nsCalComponent.h"
#include "nsCalDurationCommand.h"
#include "nsCalDayListCommand.h"
#include "nsCalContextController.h"
#include "nsCalTimebarContextController.h"
#include "nsCalMonthContextController.h"
#include "nsCalTimebarCanvas.h"
#include "nsCalStatusCanvas.h"
#include "nsCalCommandCanvas.h"
#include "nsCalTimebarComponentCanvas.h"
#include "nsCalTimebarHeading.h"
#include "nsCalTimebarUserHeading.h"
#include "nsCalTimebarTimeHeading.h"
#include "nsCalTimebarScale.h"
#include "nsCalMultiDayViewCanvas.h"
#include "nsCalDayViewCanvas.h"
#include "nsCalTodoComponentCanvas.h"
#include "nsCalToolkit.h"
static NS_DEFINE_IID(kCCalTimeContext, NS_CAL_TIME_CONTEXT_CID);
static NS_DEFINE_IID(kCCalComponent, NS_CAL_COMPONENT_CID);
static NS_DEFINE_IID(kCCalDurationCommand, NS_CAL_DURATION_COMMAND_CID);
static NS_DEFINE_IID(kCCalDayListCommand, NS_CAL_DAYLIST_COMMAND_CID);
static NS_DEFINE_IID(kCCalContextController, NS_CAL_CONTEXT_CONTROLLER_CID);
static NS_DEFINE_IID(kCCalTimebarContextController, NS_CAL_TIMEBAR_CONTEXT_CONTROLLER_CID);
static NS_DEFINE_IID(kCCalMonthContextController, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID);
static NS_DEFINE_IID(kICalTimeContext, NS_ICAL_TIME_CONTEXT_IID);
static NS_DEFINE_IID(kICalContextController, NS_ICAL_CONTEXT_CONTROLLER_IID);
static NS_DEFINE_IID(kCCalTimebarCanvas, NS_CAL_TIMEBARCANVAS_CID);
static NS_DEFINE_IID(kCCalStatusCanvas, NS_CAL_STATUSCANVAS_CID);
static NS_DEFINE_IID(kCCalCommandCanvas, NS_CAL_COMMANDCANVAS_CID);
static NS_DEFINE_IID(kCCalTimebarComponentCanvas, NS_CAL_TIMEBARCOMPONENTCANVAS_CID);
static NS_DEFINE_IID(kCCalMultiDayViewCanvas, NS_CAL_MULTIDAYVIEWCANVAS_CID);
static NS_DEFINE_IID(kCCalDayViewCanvas, NS_CAL_DAYVIEWCANVAS_CID);
static NS_DEFINE_IID(kCCalTodoComponentCanvas, NS_CAL_TODOCOMPONENTCANVAS_CID);
static NS_DEFINE_IID(kCCalTimebarHeading, NS_CAL_TIMEBARHEADING_CID);
static NS_DEFINE_IID(kCCalTimebarUserHeading, NS_CAL_TIMEBARUSERHEADING_CID);
static NS_DEFINE_IID(kCCalTimebarTimeHeading, NS_CAL_TIMEBARTIMEHEADING_CID);
static NS_DEFINE_IID(kCCalTimebarScale, NS_CAL_TIMEBARSCALE_CID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kCCalToolkit, NS_CAL_TOOLKIT_CID);
class nsCalFactory : public nsIFactory
{
public:
// nsISupports methods
NS_IMETHOD QueryInterface(const nsIID &aIID,
void **aResult);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
// nsIFactory methods
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
nsCalFactory(const nsCID &aClass);
~nsCalFactory();
private:
nsrefcnt mRefCnt;
nsCID mClassID;
};
nsCalFactory::nsCalFactory(const nsCID &aClass)
{
mRefCnt = 0;
mClassID = aClass;
}
nsCalFactory::~nsCalFactory()
{
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
}
nsresult nsCalFactory::QueryInterface(const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
// Always NULL result, in case of failure
*aResult = NULL;
if (aIID.Equals(kISupportsIID)) {
*aResult = (void *)(nsISupports*)this;
} else if (aIID.Equals(kIFactoryIID)) {
*aResult = (void *)(nsIFactory*)this;
}
if (*aResult == NULL) {
return NS_NOINTERFACE;
}
AddRef(); // Increase reference count for caller
return NS_OK;
}
nsrefcnt nsCalFactory::AddRef()
{
return ++mRefCnt;
}
nsrefcnt nsCalFactory::Release()
{
if (--mRefCnt == 0) {
delete this;
return 0; // Don't access mRefCnt after deleting!
}
return mRefCnt;
}
nsresult nsCalFactory::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (aResult == NULL) {
return NS_ERROR_NULL_POINTER;
}
*aResult = NULL;
nsISupports *inst = nsnull;
if (mClassID.Equals(kCCalTimeContext)) {
nsICalTimeContext * cc = (nsICalTimeContext *)new nsCalTimeContext();
cc->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalComponent)) {
inst = (nsISupports *)new nsCalComponent();
}
else if (mClassID.Equals(kCCalDurationCommand)) {
inst = (nsISupports *)new nsCalDurationCommand();
}
else if (mClassID.Equals(kCCalDayListCommand)) {
inst = (nsISupports *)new nsCalDayListCommand();
}
else if (mClassID.Equals(kCCalContextController)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalContextController(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarContextController)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarContextController(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalMonthContextController)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalMonthContextController(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalStatusCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalStatusCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalCommandCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalCommandCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarComponentCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarComponentCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTodoComponentCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTodoComponentCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarHeading)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarHeading(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarUserHeading)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarUserHeading(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarTimeHeading)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarTimeHeading(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalTimebarScale)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalTimebarScale(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalMultiDayViewCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalMultiDayViewCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalDayViewCanvas)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalDayViewCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
else if (mClassID.Equals(kCCalToolkit)) {
inst = (nsISupports *)(nsICalToolkit *)new nsCalToolkit();
}
if (inst == NULL) {
return NS_ERROR_OUT_OF_MEMORY;
}
/* For Agg in Canvas?
if (nsnull != aOuter) {
result = &it->fAggregated;
} else {
result = (nsIProtocolConnection *)it;
}
*/
nsresult res = inst->QueryInterface(aIID, aResult);
if (res != NS_OK) {
// We didn't get the right interface, so clean up
delete inst;
}
return res;
}
nsresult nsCalFactory::LockFactory(PRBool aLock)
{
// Not implemented in simplest case.
return NS_OK;
}
// return the proper factory to the caller
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
{
if (nsnull == aFactory) {
return NS_ERROR_NULL_POINTER;
}
*aFactory = new nsCalFactory(aClass);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;
}
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
}

View File

@ -0,0 +1,26 @@
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
GDEPTH = ../../..
DEPTH = ../../..
DIRS = core canvas context controller component command toolkit
DIRS_LIBS = res
LIBRARY_NAME = calui
EXPORTS = \
$(NULL)
PRIVATE_EXPORTS = \
$(NULL)
MODULE = trex
REQUIRES = xpcom raptor shell trex

View File

@ -0,0 +1,53 @@
#! gmake
#
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
# NETSCAPE COMMUNICATIONS CORPORATION
# Copyright © 1996, 1997 Netscape Communications Corporation. All Rights
# Reserved. Use of this Source Code is subject to the terms of the
# applicable license agreement from Netscape Communications Corporation.
# The copyright notice(s) in this Source Code does not indicate actual or
# intended publication of this Source Code.
#
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
include $(GDEPTH)/gconfig/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################

View File

@ -0,0 +1,88 @@
<?xml version="1.0" standalone="no" encoding="UTF-8"?>
<!DOCTYPE dialog SYSTEM "http://kirkwood.mcom.com/ui.dtd">
<UI>
<!-- This is the Dialog XML
Objects
dialog (type of container, generally a widget subclass)
button (type of widget)
editfield (type of widget)
Tags
dialog (all container properties apply)
name - specifies the id it is known by
layout - specifies the type of layout to use for children in the container
button/editfield/separator (all widget properties apply)
name - specifies the id it is known by
container - An associated container when clicked on, can be drop down list of sorts
align - How is this item aligned (left, right,etc...)
type - The type of widget to use (buttons, separators, text, etc...)
shortcut - shortcut that applies
rule - rule that gets applied, can modify appearance (or lack thereof)
(widget properties that typically are used)
enable - TRUE is is enabled by default
check - TRUE if checked. Must be a button type for this to apply
(problematic areas)
onaction - What to do on an action event. currently the name of the control is sent.
We need to map this to something simpler.
<tabwidget tab1="Tab1" tab2="Tab2" tab3="Tab3" weightmajor="0" weightminor="0"/>
-->
<!-- This is the Dialog Definition -->
<dialog name="ComposeEventDialog" layout="ybox">
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="HeaderBar" label="Event Composer" height="22" weightmajor="0" weightminor="0"/>
<!-- This is the Dialog User Selection -->
<canvas name="UserSelection" layout="xbox" height="66">
<canvas layout="ybox" name="StaticUserFields" width="50">
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqiStaticUserFields" label="From:" height="22" weightmajor="0" weightminor="0"/>
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqsStaticUserFields" label="Req:" height="22" weightmajor="0" weightminor="0" />
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="OptStaticUserFields" label="Opt:" height="22" weightmajor="0" weightminor="0" />
</canvas>
<canvas layout="ybox" backgroundcolor="#FFFFFF" name="EditableUserFields">
<editfield keyboardfocus="true" tabid="1" backgroundcolor="#FFFFFF" name="ReqiEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
<editfield tabid="2" backgroundcolor="#FFFFFF" name="ReqsEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
<editfield tabid="3" backgroundcolor="#FFFFFF" name="OptEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
</canvas>
</canvas>
<!-- This is the Time Selection-->
<canvas name="TimeSelection" layout="xbox" height="22">
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="DateStaticTimeFields" label="When?" weightmajor="0"/>
<editfield tabid="4" backgroundcolor="#FFFFFF" name="DateEditableTimeFields" label="" weightmajor="1"/>
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="StartStaticTimeFields" label="Start:" weightmajor="0"/>
<editfield tabid="5" backgroundcolor="#FFFFFF" name="StartEditableTimeFields" label="" weightmajor="1"/>
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="EndStaticTimeFields" label="End:" weightmajor="0"/>
<editfield tabid="6" backgroundcolor="#FFFFFF" name="EndEditableTimeFields" label="" weightmajor="1"/>
</canvas>
<!-- This is the Subject Selection-->
<canvas name="SubjectSelection" layout="xbox" height="22">
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="SubjectStaticTimeFields" label="Subject:" width="70" weightmajor="0"/>
<editfield tabid="7" backgroundcolor="#FFFFFF" name="SubjectEditableTimeFields" label="" weightmajor="1"/>
</canvas>
<editfield tabid="8" backgroundcolor="#FFFFFF" name="ComposeArea" label="" />
</dialog>
</UI>

Some files were not shown because too many files have changed in this diff Show More