diff --git a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h
index 6f0bee08a58..d49d6753318 100644
--- a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h
+++ b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLContentSink.h
@@ -49,6 +49,7 @@ public:
NS_IMETHOD Init();
NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer);
+ NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas);
// nsIContentSink
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
diff --git a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h
index d711bc249ad..55c4b05a2e2 100644
--- a/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h
+++ b/mozilla/calendar/modules/parser/calxml/inc/nsCalXMLDTD.h
@@ -41,6 +41,7 @@ enum eCalXMLTags
eCalXMLTag_htmlcanvas,
eCalXMLTag_leaf,
eCalXMLTag_mcc,
+ eCalXMLTag_monthviewcanvas,
eCalXMLTag_multidayviewcanvas,
eCalXMLTag_object,
eCalXMLTag_panel,
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian.cal b/mozilla/calendar/modules/parser/calxml/res/julian.cal
index 1415d92f16a..43d6c21cde0 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julian.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julian.cal
@@ -4,15 +4,15 @@
-
+
-
+
-
+
@@ -26,7 +26,7 @@
-
+
@@ -41,17 +41,15 @@
-
+
-
--->
@@ -59,21 +57,20 @@
+
-
-
+
-
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_cal_html.cal b/mozilla/calendar/modules/parser/calxml/res/julian_cal_html.cal
index ee335256718..b94f72054d7 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julian_cal_html.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_cal_html.cal
@@ -4,7 +4,7 @@
-
+
@@ -68,10 +68,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_day.cal b/mozilla/calendar/modules/parser/calxml/res/julian_day.cal
index 7f84c8277d9..17c3a0ddadc 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julian_day.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_day.cal
@@ -4,16 +4,16 @@
-
+
-
+
-
+
@@ -45,10 +45,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_folders.cal b/mozilla/calendar/modules/parser/calxml/res/julian_folders.cal
index b939db8043d..613e04d1098 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julian_folders.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_folders.cal
@@ -68,10 +68,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_html.cal b/mozilla/calendar/modules/parser/calxml/res/julian_html.cal
index ffb43670e87..b8fac1351d3 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julian_html.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_html.cal
@@ -6,11 +6,5 @@
-
-
-
-
-
-
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_html_blank.cal b/mozilla/calendar/modules/parser/calxml/res/julian_html_blank.cal
new file mode 100644
index 00000000000..ec1db1b90c0
--- /dev/null
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_html_blank.cal
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_month.cal b/mozilla/calendar/modules/parser/calxml/res/julian_month.cal
new file mode 100644
index 00000000000..b4dd6821633
--- /dev/null
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_month.cal
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_month_sum.cal b/mozilla/calendar/modules/parser/calxml/res/julian_month_sum.cal
new file mode 100644
index 00000000000..1e9f692c7de
--- /dev/null
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_month_sum.cal
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julian_week.cal b/mozilla/calendar/modules/parser/calxml/res/julian_week.cal
new file mode 100644
index 00000000000..8e4702e9aad
--- /dev/null
+++ b/mozilla/calendar/modules/parser/calxml/res/julian_week.cal
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/julianht.cal b/mozilla/calendar/modules/parser/calxml/res/julianht.cal
index d3fd753bf83..5bed0d19174 100644
--- a/mozilla/calendar/modules/parser/calxml/res/julianht.cal
+++ b/mozilla/calendar/modules/parser/calxml/res/julianht.cal
@@ -4,7 +4,7 @@
-
+
@@ -73,10 +73,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/parser/calxml/res/manifest.mn b/mozilla/calendar/modules/parser/calxml/res/manifest.mn
index 0d8d18fc18c..7d458ffb3c7 100644
--- a/mozilla/calendar/modules/parser/calxml/res/manifest.mn
+++ b/mozilla/calendar/modules/parser/calxml/res/manifest.mn
@@ -18,4 +18,8 @@ libs::
$(INSTALL) julian_folders.cal $(DIST)/bin/res/ui
$(INSTALL) julianht.cal $(DIST)/bin/res/ui
$(INSTALL) julian_day.cal $(DIST)/bin/res/ui
+ $(INSTALL) julian_week.cal $(DIST)/bin/res/ui
+ $(INSTALL) julian_month.cal $(DIST)/bin/res/ui
+ $(INSTALL) julian_month_sum.cal $(DIST)/bin/res/ui
$(INSTALL) julian_html.cal $(DIST)/bin/res/ui
+ $(INSTALL) julian_html_blank.cal $(DIST)/bin/res/ui
diff --git a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp
index 450331f96f9..020bdb84ffd 100644
--- a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp
+++ b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLContentSink.cpp
@@ -47,6 +47,7 @@ static NS_DEFINE_IID(kCCalTimebarContextControllerCID, NS_CAL_TIMEBAR_CONTEXT_CO
static NS_DEFINE_IID(kCCalMonthContextControllerCID, NS_CAL_MONTH_CONTEXT_CONTROLLER_CID);
static NS_DEFINE_IID(kCCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID);
static NS_DEFINE_IID(kCCalMultiDayViewCanvasCID, NS_CAL_MULTIDAYVIEWCANVAS_CID);
+static NS_DEFINE_IID(kCalMonthViewCanvasCID, NS_CAL_MONTHVIEWCANVAS_CID);
static NS_DEFINE_IID(kCCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID);
static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID);
static NS_DEFINE_IID(kCalTimebarScaleCID, NS_CAL_TIMEBARSCALE_CID);
@@ -311,7 +312,9 @@ NS_IMETHODIMP nsCalXMLContentSink::CloseContainer(const nsIParserNode& aNode)
{
nsIXPFCCanvas * canvas = (nsIXPFCCanvas *)mCanvasStack->Pop();
+#if 0
NS_IF_RELEASE(canvas);
+#endif
return NS_OK;
}
@@ -389,6 +392,10 @@ NS_IMETHODIMP nsCalXMLContentSink::CIDFromTag(eCalXMLTags tag, nsCID &aClass)
aClass = kCalMultiDayViewCanvasCID;
break;
+ case eCalXMLTag_monthviewcanvas:
+ aClass = kCalMonthViewCanvasCID;
+ break;
+
case eCalXMLTag_panel:
case eCalXMLTag_rootpanel:
aClass = kCXPFCCanvasCID;
@@ -981,3 +988,8 @@ nsIXPFCCanvas * nsCalXMLContentSink::CanvasFromName(nsString& aName)
return nsnull;
}
+nsresult nsCalXMLContentSink::SetRootCanvas(nsIXPFCCanvas * aCanvas)
+{
+ mCanvasStack->Push(aCanvas);
+ return NS_OK;
+}
diff --git a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp
index cf0ae7f328c..6f65b5e72ef 100644
--- a/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp
+++ b/mozilla/calendar/modules/parser/calxml/src/nsCalXMLDTD.cpp
@@ -60,6 +60,7 @@ nsCalXMLTagEntry gCalXMLTagTable[] =
{"htmlcanvas", eCalXMLTag_htmlcanvas},
{"leaf", eCalXMLTag_leaf},
{"mcc", eCalXMLTag_mcc},
+ {"monthviewcanvas", eCalXMLTag_monthviewcanvas},
{"multidayviewcanvas", eCalXMLTag_multidayviewcanvas},
{"object", eCalXMLTag_object},
{"panel", eCalXMLTag_panel},
@@ -268,6 +269,7 @@ nsresult nsCalXMLDTD::HandleStartToken(CToken* aToken)
case eCalXMLTag_tcc:
case eCalXMLTag_ctx:
case eCalXMLTag_commandcanvas:
+ case eCalXMLTag_monthviewcanvas:
case eCalXMLTag_multidayviewcanvas:
case eCalXMLTag_timebarscale:
case eCalXMLTag_timebaruserheading:
@@ -341,6 +343,7 @@ nsresult nsCalXMLDTD::HandleEndToken(CToken* aToken)
case eCalXMLTag_mcc:
case eCalXMLTag_ctx:
case eCalXMLTag_commandcanvas:
+ case eCalXMLTag_monthviewcanvas:
case eCalXMLTag_multidayviewcanvas:
case eCalXMLTag_timebarscale:
case eCalXMLTag_timebaruserheading:
diff --git a/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h b/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h
index 03c2ecffc4d..043727c8c92 100644
--- a/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h
+++ b/mozilla/calendar/modules/shell/inc/nsCalendarContainer.h
@@ -44,6 +44,7 @@ public:
nsICalendarShell * aCalendarShell);
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas = 0,
nsIPostData* aPostData = 0);
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
diff --git a/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h b/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h
index 70a085a990e..6f6e42c30f8 100644
--- a/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h
+++ b/mozilla/calendar/modules/shell/inc/nsCalendarWidget.h
@@ -68,6 +68,7 @@ public:
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas = 0,
nsIPostData* aPostData = 0);
virtual nsIWidget* GetWWWindow();
diff --git a/mozilla/calendar/modules/shell/inc/nscalcids.h b/mozilla/calendar/modules/shell/inc/nscalcids.h
index c20a63566f5..d658d275af1 100644
--- a/mozilla/calendar/modules/shell/inc/nscalcids.h
+++ b/mozilla/calendar/modules/shell/inc/nscalcids.h
@@ -48,6 +48,7 @@ static NS_DEFINE_IID(kCstackCID, NS_STACK_CID);
static NS_DEFINE_IID(kCDurationCID, NS_DURATION_CID);
static NS_DEFINE_IID(kCCalDurationCommandCID, NS_CAL_DURATION_COMMAND_CID);
static NS_DEFINE_IID(kCCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID);
+static NS_DEFINE_IID(kCCalNewModelCommandCID, NS_CAL_NEWMODEL_COMMAND_CID);
static NS_DEFINE_IID(kCXPFCMethodInvokerCommandCID, NS_XPFC_METHODINVOKER_COMMAND_CID);
static NS_DEFINE_IID(kCCalStatusCanvasCID, NS_CAL_STATUSCANVAS_CID);
static NS_DEFINE_IID(kCCalCommandCanvasCID, NS_CAL_COMMANDCANVAS_CID);
@@ -56,6 +57,7 @@ static NS_DEFINE_IID(kCalTimebarHeadingCID, NS_CAL_TIMEBARHEADING_CID);
static NS_DEFINE_IID(kCalTimebarUserHeadingCID, NS_CAL_TIMEBARUSERHEADING_CID);
static NS_DEFINE_IID(kCalTimebarTimeHeadingCID, NS_CAL_TIMEBARTIMEHEADING_CID);
static NS_DEFINE_IID(kCCalDayViewCID, NS_CAL_DAYVIEWCANVAS_CID);
+static NS_DEFINE_IID(kCCalMonthViewCID, NS_CAL_MONTHVIEWCANVAS_CID);
static NS_DEFINE_IID(kCCalTodoComponentCanvasCID, NS_CAL_TODOCOMPONENTCANVAS_CID);
static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID);
static NS_DEFINE_IID(kCCalXMLContentSink, NS_CALXMLCONTENTSINK_IID);
diff --git a/mozilla/calendar/modules/shell/public/nsICalendarWidget.h b/mozilla/calendar/modules/shell/public/nsICalendarWidget.h
index 3fe8bfd6d27..cbf2dbd5cf6 100644
--- a/mozilla/calendar/modules/shell/public/nsICalendarWidget.h
+++ b/mozilla/calendar/modules/shell/public/nsICalendarWidget.h
@@ -62,6 +62,7 @@ public:
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas = 0,
nsIPostData* aPostData = 0) = 0;
};
diff --git a/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp b/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp
index 83064174941..5b5f9839f08 100644
--- a/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp
+++ b/mozilla/calendar/modules/shell/src/nsCalendarContainer.cpp
@@ -41,6 +41,10 @@
#include "nscal.h"
#include "nsCalMultiDayViewCanvas.h"
#include "nsLayer.h"
+#include "nsCalTimebarCanvas.h"
+#include "nsCalUICIID.h"
+#include "nsCalNewModelCommand.h"
+#include "nsIXPFCCommand.h"
// XXX: This code should use XML for defining the Root UI. We need to
// implement the stream manager first to do this, then lots of
@@ -466,7 +470,10 @@ nsresult nsCalendarContainer::GetApplicationShell(nsIApplicationShell*& aResult)
}
-nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, nsIStreamObserver* aListener, nsIPostData * aPostData)
+nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec,
+ nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas,
+ nsIPostData * aPostData)
{
/*
* this is temp hack code til get capi url's in the stream manager....sorry!
@@ -479,7 +486,7 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, nsIStreamObserve
* This is a normal url, go thru the stream manager
*/
- return(mCalendarWidget->LoadURL(aURLSpec, aListener, aPostData));
+ return(mCalendarWidget->LoadURL(aURLSpec, aListener, aParentCanvas, aPostData));
}
/*
@@ -558,12 +565,6 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, nsIStreamObserve
sHandle.Prepend(":");
}
-#if 0
- s = shell->mSessionMgr.GetAt(0L)->mCapi->CAPI_GetHandle(shell->mCAPISession,
- sHandle.GetBuffer(),
- 0,
- &(shell->mCAPIHandle));
-#endif
nsCalSession* pCalSession;
/*
* Get the session from the session manager...
@@ -585,7 +586,7 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, nsIStreamObserve
/*
- * Whatever ....
+ * Create the Model interfaces to the view system ....
*/
nsILayer* pLayer;
@@ -663,31 +664,42 @@ nsresult nsCalendarContainer::LoadURL(const nsString& aURLSpec, nsIStreamObserve
* find a multi canvas and add one here and then set it's model ... yeehaaa
*/
+ // XXX: This should probably be done via searching for class type. We also probably
+ // Want the XML for the menubar command to specify specifically the target
+ // canvas for these types of operations.
nsString mcstring("MultiCalendarEventWeekView");
nsCalMultiDayViewCanvas * mc = (nsCalMultiDayViewCanvas *) mRootCanvas->CanvasFromName(mcstring);
if (nsnull != mc)
{
- nsIXPFCCanvas * canvas = mc->AddDayViewCanvas();
/*
- * Get the last sibling and set it's model....
+ * Send an NewModelCommand to all canvas's....
+ *
+ * This event basically specifies that a new model
+ * needs to be viewed somewhere. Currently, only
+ * the multi canvas handles this
*/
- if (canvas != nsnull)
- {
- mc->SetTimeContext(mc->GetTimeContext());
+ static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
- canvas->SetModel(model);
+ nsCalNewModelCommand * command = nsnull;
- mc->Layout();
+ res = nsRepository::CreateInstance(kCCalNewModelCommandCID,
+ nsnull,
+ kXPFCCommandIID,
+ (void **)&command);
+ if (NS_OK != res)
+ return res;
- nsRect bounds;
- mc->GetView()->GetBounds(bounds);
- gXPFCToolkit->GetViewManager()->UpdateView(mc->GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
+ command->Init();
- }
+ command->mModel = model;
+
+ mRootCanvas->BroadcastCommand(*command);
+
+ NS_RELEASE(command);
}
@@ -760,10 +772,12 @@ nsresult nsCalendarContainer::RegisterFactories()
nsRepository::RegisterFactory(kCDurationCID, UTIL_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalDurationCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalDayListCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE);
+ nsRepository::RegisterFactory(kCCalNewModelCommandCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalStatusCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalCommandCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalTodoComponentCanvasCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalDayViewCID, CALUI_DLL, PR_FALSE, PR_FALSE);
+ nsRepository::RegisterFactory(kCCalMonthViewCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCCalMultiDayViewCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCalTimebarHeadingCID, CALUI_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCalTimebarUserHeadingCID, CALUI_DLL, PR_FALSE, PR_FALSE);
diff --git a/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp b/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp
index c09d2e27d65..0e4d83d3300 100644
--- a/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp
+++ b/mozilla/calendar/modules/shell/src/nsCalendarShell.cpp
@@ -625,15 +625,9 @@ nsresult nsCalendarShell::LoadUI()
/*
* Now Load the Canvas UI
*/
-#ifdef XP_UNIX
+
mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR,pUI,&i);
res = mDocumentContainer->LoadURL(pUI,nsnull);
-#else
- mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_MENUBAR,pUI,&i);
- res = mDocumentContainer->LoadURL(pUI,nsnull);
- mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR,pUI,&i);
- res = mDocumentContainer->LoadURL(pUI,nsnull);
-#endif
mShellInstance->ShowApplicationWindow(PR_TRUE) ;
diff --git a/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp b/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp
index 7f1c51d331b..3425b2e9d48 100644
--- a/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp
+++ b/mozilla/calendar/modules/shell/src/nsCalendarWidget.cpp
@@ -64,6 +64,7 @@ class nsICalendarShell;
#include "nsFont.h"
#include "nsCalDayViewCanvas.h"
+#include "nsCalMonthViewCanvas.h"
#include "nsCalMultiDayViewCanvas.h"
#include "nsCalTodoComponentCanvas.h"
#include "nsCalTimebarHeading.h"
@@ -132,42 +133,14 @@ nsresult nsCalendarWidget::Init(nsIView * aParent,
nsICalendarShell * aCalendarShell)
{
- nsresult res ;
-
mCalendarShell = aCalendarShell;
- nsIXPFCCanvas * root;
-
NS_ADDREF(((nsIApplicationShell *)mCalendarShell));
gXPFCToolkit->SetObserverManager(mCalendarShell->GetObserverManager());
- /*
- * Create the Root Canvas
- */
+ return NS_OK;
- static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
-
-
- res = nsRepository::CreateInstance(kCXPFCCanvasCID,
- nsnull,
- kCXPFCCanvasCID,
- (void **)&root);
-
- if (NS_OK != res)
- return res ;
-
- root->Init();
-
- nsIXPFCCanvas * root_canvas ;
-
- gXPFCToolkit->GetRootCanvas(&root_canvas);
-
- root_canvas->AddChildCanvas(root);
-
- NS_RELEASE(root_canvas);
-
- return res ;
}
nsRect nsCalendarWidget::GetBounds()
@@ -217,11 +190,18 @@ nsresult nsCalendarWidget::GetContainer(nsIContentViewerContainer*& aContainerRe
return NS_OK;
}
-nsresult nsCalendarWidget::LoadURL(const nsString& aURLSpec, nsIStreamObserver* aListener, nsIPostData * aPostData)
+nsresult nsCalendarWidget::LoadURL(const nsString& aURLSpec,
+ nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas,
+ nsIPostData * aPostData)
{
nsresult res ;
+ nsString aURLToLoad = aURLSpec;
+
+ nsIXPFCCanvas * target_canvas = aParentCanvas;
+
nsIStreamManager * stream_manager = ((nsCalendarShell *)mCalendarShell)->mShellInstance->GetStreamManager();
if (stream_manager == nsnull)
@@ -230,6 +210,68 @@ nsresult nsCalendarWidget::LoadURL(const nsString& aURLSpec, nsIStreamObserver*
nsIID * iid_dtd = nsnull;
nsIID * iid_sink = nsnull ;
+ /*
+ * Let's see if there is a target on this URL and delete that tree.
+ *
+ * Note we need some way of maintaining the model hookup here .... I think
+ */
+
+ if (aURLSpec.Find("?") != -1)
+ {
+ /*
+ * We have options, let's see if one of them in target=
+ */
+
+ PRInt32 offset = aURLSpec.Find("target=");
+
+ if (offset != -1)
+ {
+
+ /*
+ * Ok, find the container with the specified name,
+ * destroy all its contents, and use it as the target
+ * base parent for the new XML!
+ */
+
+ nsString target ;
+ nsString temp = aURLSpec ;
+
+ offset += 7;
+
+ temp.Mid(target, offset, aURLSpec.Length() - offset);
+
+ offset = target.Find("?");
+
+ if (offset != -1)
+ {
+ target.Cut(offset, target.Length() - offset);
+ }
+
+ /*
+ * find the target canvas
+ */
+
+ nsIXPFCCanvas * root = nsnull ;
+
+ gXPFCToolkit->GetRootCanvas(&root);
+
+ target_canvas = root->CanvasFromName(target);
+
+ if (target_canvas)
+ {
+ target_canvas->DeleteChildren();
+ }
+
+ NS_RELEASE(root);
+
+ }
+
+ }
+
+ /*
+ * change the DTD and Sink if this is a Calendar XML
+ */
+
if (aURLSpec.Find(".cal") != -1)
{
static NS_DEFINE_IID(kCCalXMLDTD, NS_ICALXML_DTD_IID);
@@ -238,19 +280,39 @@ nsresult nsCalendarWidget::LoadURL(const nsString& aURLSpec, nsIStreamObserver*
iid_dtd = (nsIID *) &kCCalXMLDTD;
iid_sink = (nsIID *) &kCCalXMLContentSinkCID;
- nsIXPFCCanvas * root = nsnull ;
-
- gXPFCToolkit->GetRootCanvas(&root);
-
- root->DeleteChildren();
-
- NS_RELEASE(root);
-
}
+ /*
+ * XXX: Get rid of this code!
+ *
+ * If we do not understand this url, lets create a canvas that embeds
+ * raptor.
+ *
+ * Ideally, we'd all be using netlib and some sort of mime registration,
+ * but til then....
+ */
+
+ if (aURLSpec.Find(".cal") == -1 && aURLSpec.Find(".ui") == -1)
+ {
+ aURLToLoad = "resource://res/ui/julian_html_blank.cal?target=content" ;
+
+ /*
+ * Register ourselves as a StreamListener, and then load the actual
+ * URL when the ui framework is done
+ */
+ }
+
+
+ /*
+ * Load the URL
+ */
+
res = stream_manager->LoadURL(((nsCalendarShell*)mCalendarShell)->mDocumentContainer,
- aURLSpec,
- aPostData,iid_dtd,iid_sink);
+ target_canvas,
+ aURLToLoad,
+ aPostData,
+ iid_dtd,
+ iid_sink);
return res;
diff --git a/mozilla/calendar/modules/ui/canvas/inc/manifest.mn b/mozilla/calendar/modules/ui/canvas/inc/manifest.mn
index f05fd14b3c2..5c68a1dd7f8 100644
--- a/mozilla/calendar/modules/ui/canvas/inc/manifest.mn
+++ b/mozilla/calendar/modules/ui/canvas/inc/manifest.mn
@@ -25,6 +25,7 @@ PRIVATE_EXPORTS = \
nsCalMultiDayViewCanvas.h \
nsCalCanvas.h \
nsCalDayViewCanvas.h \
+ nsCalMonthViewCanvas.h \
events.h \
$(NULL)
diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h
new file mode 100644
index 00000000000..969723f6e4b
--- /dev/null
+++ b/mozilla/calendar/modules/ui/canvas/inc/nsCalMonthViewCanvas.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+#ifndef nsCalMonthViewCanvas_h___
+#define nsCalMonthViewCanvas_h___
+
+#include "nsCalTimebarComponentCanvas.h"
+
+class nsCalMonthViewCanvas : public nsCalTimebarComponentCanvas
+{
+
+public:
+ nsCalMonthViewCanvas(nsISupports* outer);
+
+ NS_DECL_ISUPPORTS
+
+ NS_IMETHOD Init();
+
+ NS_IMETHOD_(nsEventStatus) PaintBackground(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect);
+ NS_IMETHOD_(nsEventStatus) PaintForeground(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect);
+ NS_IMETHOD_(nsEventStatus) PaintBorder(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect);
+
+
+protected:
+ ~nsCalMonthViewCanvas();
+
+private:
+ NS_IMETHOD_(nsEventStatus) PaintCellBackground( PRUint32& aCellRow, PRUint32& aCellColumn,
+ PRUint32& aCellDate,
+ nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect);
+
+private:
+ PRUint32 mNumColumns;
+ PRUint32 mNumRows;
+
+
+};
+
+#endif /* nsCalMonthViewCanvas_h___ */
diff --git a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h b/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h
index 89a52ca2e87..a766b7910b1 100644
--- a/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h
+++ b/mozilla/calendar/modules/ui/canvas/inc/nsCalMultiDayViewCanvas.h
@@ -51,7 +51,6 @@ public:
NS_IMETHOD Action(nsIXPFCCommand * aCommand);
-private:
NS_IMETHOD SetChildTimeContext(nsCalTimebarCanvas * aCanvas,
nsICalTimeContext * aContext,
PRUint32 increment);
diff --git a/mozilla/calendar/modules/ui/canvas/src/manifest.mn b/mozilla/calendar/modules/ui/canvas/src/manifest.mn
index 4bcc8db5d9d..4f575ddb385 100644
--- a/mozilla/calendar/modules/ui/canvas/src/manifest.mn
+++ b/mozilla/calendar/modules/ui/canvas/src/manifest.mn
@@ -29,6 +29,7 @@ CPPSRCS = \
nsCalTimebarScale.cpp \
nsCalMultiDayViewCanvas.cpp \
nsCalDayViewCanvas.cpp \
+ nsCalMonthViewCanvas.cpp \
nsCalCanvas.cpp \
events.cpp \
$(NULL)
diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp
new file mode 100644
index 00000000000..9e9502986ac
--- /dev/null
+++ b/mozilla/calendar/modules/ui/canvas/src/nsCalMonthViewCanvas.cpp
@@ -0,0 +1,440 @@
+/* -*- 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 "nsCalMonthViewCanvas.h"
+#include "nsCalUICIID.h"
+#include "nsDateTime.h"
+#include "nsCalToolkit.h"
+#include "nsCRT.h"
+#include "nsIRenderingContext.h"
+#include "nsIFontMetrics.h"
+#include "nsIDeviceContext.h"
+#include "nsICalendarUser.h"
+#include "nsICalendarModel.h"
+#include "nsDateTime.h"
+#include "nsIFontMetrics.h"
+#include "nsIDeviceContext.h"
+#include "prprf.h"
+#include "nsString.h"
+
+#include "datetime.h"
+#include "ptrarray.h"
+#include "vevent.h"
+
+#include "capi.h"
+
+static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
+static NS_DEFINE_IID(kCalMonthViewCanvasCID, NS_CAL_MONTHVIEWCANVAS_CID);
+static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
+static NS_DEFINE_IID(kICalendarUserIID, NS_ICALENDAR_USER_IID);
+static NS_DEFINE_IID(kICalendarModelIID, NS_ICALENDAR_MODEL_IID);
+
+nsCalMonthViewCanvas :: nsCalMonthViewCanvas(nsISupports* outer) : nsCalTimebarComponentCanvas(outer)
+{
+ NS_INIT_REFCNT();
+ mNumRows = 0;
+ mNumColumns = 0;
+}
+
+nsCalMonthViewCanvas :: ~nsCalMonthViewCanvas()
+{
+}
+
+nsresult nsCalMonthViewCanvas::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, kCalMonthViewCanvasCID);
+ 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(nsCalMonthViewCanvas)
+NS_IMPL_RELEASE(nsCalMonthViewCanvas)
+
+nsresult nsCalMonthViewCanvas :: Init()
+{
+ return (nsCalTimebarComponentCanvas::Init());
+}
+
+
+nsEventStatus nsCalMonthViewCanvas :: PaintBorder(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect)
+{
+ return (nsCalTimebarComponentCanvas::PaintBorder(aRenderingContext,aDirtyRect));
+}
+
+nsEventStatus nsCalMonthViewCanvas :: PaintForeground(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect)
+{
+#if 0
+ JulianPtrArray * evtVctr = 0;
+ VEvent *pEvent = 0;
+ 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();
+
+ nsIModel * model = GetModel();
+ nsICalendarModel * calmodel = nsnull;
+
+ if (nsnull == model)
+ return nsEventStatus_eConsumeNoDefault;
+
+ nsICalendarUser * user = nsnull;
+
+ nsresult res = model->QueryInterface(kICalendarModelIID, (void**)&calmodel);
+ if (NS_OK != res)
+ return nsEventStatus_eConsumeNoDefault;
+
+ calmodel->GetCalendarUser(user);
+
+ if (NS_OK != res)
+ return nsEventStatus_eConsumeNoDefault;
+
+ nsILayer * layer;
+
+ user->GetLayer(layer);
+
+ NSCalendar * nscal;
+
+ layer->GetCal(nscal);
+
+ nscal->getEventsByRange(evtVctr, *dStart, *dEnd);
+
+ 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));
+
+ aRenderingContext.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;
+
+ aRenderingContext.FillRect(rect);
+
+ /*
+ * Render the highlights
+ */
+ aRenderingContext.SetColor(nsLighter(mComponentColor));
+ aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y);
+ aRenderingContext.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height);
+ aRenderingContext.SetColor(nsDarker(mComponentColor));
+ aRenderingContext.DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height);
+ aRenderingContext.DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height);
+
+ aRenderingContext.GetFontMetrics()->GetHeight(fm_height);
+
+ if (rect.height > fm_height)
+ {
+ // rndctx->SetColor(GetForegroundColor());
+ aRenderingContext.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("");
+ aRenderingContext.DrawString(psBuf,nsCRT::strlen(psBuf),rect.x+1,rect.y,0);
+ delete psBuf;
+
+ if (rect.height > (2 * fm_height))
+ {
+ psBuf = pEvent->getSummary().toCString("");
+ aRenderingContext.DrawString(psBuf,nsCRT::strlen(psBuf),rect.x+1,rect.y+fm_height,0);
+ delete psBuf;
+ }
+ }
+ }
+ }
+
+ delete evtVctr;
+
+ NS_RELEASE(calmodel);
+
+ return nsEventStatus_eConsumeNoDefault;
+
+#endif
+
+ return nsEventStatus_eConsumeNoDefault;
+}
+
+nsEventStatus nsCalMonthViewCanvas :: PaintBackground(nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect)
+{
+ /*
+ * First, we need to find out how many rows/columns we want/need.
+ */
+
+ nsICalTimeContext * tc = GetTimeContext();
+ nsIDateTime * dts = nsnull;
+ nsIDateTime * dtmonth = nsnull;
+ nsresult res = NS_OK;
+ DateTime * datetime = nsnull ;
+ PRUint32 i,j;
+ PRInt32 iDate = 1;
+ PRInt32 iLastDate ;
+
+ if (nsnull == tc)
+ return nsEventStatus_eConsumeNoDefault;
+
+ dts = tc->GetDTStart(); // XXX: Deal with TimeContext correctly here
+ dtmonth = dts->Copy();
+ datetime = ((nsDateTime *)dtmonth)->GetDateTime();
+
+ PRInt32 ii = datetime->get(Calendar::MONTH);
+
+ /*
+ * Compute number of weeks
+ */
+
+ datetime->setDayOfMonth(1);
+ i = datetime->get(Calendar::WEEK_OF_YEAR);
+ datetime->findLastDayOfMonth();
+ j = datetime->get(Calendar::WEEK_OF_YEAR);
+ datetime->setDayOfMonth(1);
+ mNumRows = j-i+1;
+ mNumColumns = 7; // XXX: Need a query for max number days in a week
+
+ /*
+ * compute last day of month ...
+ */
+
+ iLastDate = datetime->getMonthLength(datetime->getMonth(),datetime->getYear());
+
+ /*
+ * compute what the day of week the first cell is on. This may be
+ * negative, up to -7
+ */
+
+ iDate -= (datetime->get(Calendar::DAY_OF_WEEK) -1);
+
+ /*
+ * Now, let's render the background
+ *
+ * XXX: As an optimization we may want to combine cell back/fore painting
+ */
+
+ nsCalCanvas::PaintBackground(aRenderingContext, aDirtyRect);
+
+ for (i=0; i<=mNumRows; i++)
+ {
+ for (j=0; j 0 && iDate <= iLastDate)
+ thisDate = iDate;
+ else
+ thisDate = 0;
+
+ PaintCellBackground(i,j,thisDate,aRenderingContext,aDirtyRect);
+ iDate++;
+ }
+ }
+
+
+ NS_RELEASE(dtmonth);
+
+ return nsEventStatus_eConsumeNoDefault;
+}
+
+nsEventStatus nsCalMonthViewCanvas :: PaintCellBackground( PRUint32& aCellRow, PRUint32& aCellColumn,
+ PRUint32& aCellDate,
+ nsIRenderingContext& aRenderingContext,
+ const nsRect& aDirtyRect)
+{
+ /*
+ * Draw a box using the foreground color
+ */
+
+ nscoord x,y,w,h;
+ nscoord cell_width;
+ nscoord cell_height;
+ nsRect bounds;
+ PRUint32 cell_width_remainder,cell_height_remainder;
+
+ GetBounds(bounds);
+
+ cell_width = bounds.width / mNumColumns;
+ cell_height = bounds.height / mNumRows;
+
+ x = cell_width * aCellColumn + bounds.x;
+ y = cell_height * aCellRow + bounds.y;
+ w = cell_width;
+ h = cell_height;
+
+ /*
+ * If there is a modulus, disperse that across the cells
+ * beginning from front.
+ */
+
+ cell_width_remainder = bounds.width % mNumColumns;
+ cell_height_remainder = bounds.height % mNumRows;
+
+ if (aCellColumn >= cell_width_remainder)
+ x += cell_width_remainder;
+ else
+ x += aCellColumn;
+
+ if (cell_width_remainder > aCellColumn)
+ w++;
+
+ if (aCellRow >= cell_height_remainder)
+ y += cell_height_remainder;
+ else
+ y += aCellRow;
+
+ if (cell_height_remainder > aCellRow)
+ h++;
+
+ /*
+ * Now paint the cell outline (with shadows)
+ */
+
+ nsRect rect;
+
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+
+ rect.width--; rect.height--;
+
+ aRenderingContext.SetColor(GetForegroundColor());
+ aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y);
+ aRenderingContext.DrawLine(rect.x,rect.y,rect.x,rect.y+rect.height);
+
+ aRenderingContext.DrawLine(rect.x+rect.width,rect.y,rect.x+rect.width,rect.y+rect.height);
+ aRenderingContext.DrawLine(rect.x,rect.y+rect.height,rect.x+rect.width,rect.y+rect.height);
+
+ /*
+ * Now render intervals
+ *
+ * XXX: Hardcoded til fix TimeContext
+ */
+
+ aRenderingContext.SetColor(Dim(GetBorderColor()));
+
+ rect.x++;
+ rect.width--;
+
+ nscoord interval = rect.height / 5;
+
+ PRInt32 i ;
+
+ for (i=0; i<4; i++)
+ {
+ rect.y += interval;
+ aRenderingContext.DrawLine(rect.x,rect.y,rect.x+rect.width,rect.y);
+ }
+
+ /*
+ * Now put the number of the day in lower right hand corner
+ */
+
+ nsString strDate;
+
+ if (aCellDate > 0)
+ {
+ char buf[5];
+
+ PR_snprintf(buf, 5, "%d", aCellDate);
+
+ strDate = buf;
+
+
+ nscoord text_height ;
+ nscoord text_width ;
+
+ aRenderingContext.GetFontMetrics()->GetHeight(text_height);
+ aRenderingContext.GetFontMetrics()->GetWidth(strDate, text_width);
+
+ x = x + w - text_width;
+ y = y + h - text_height;
+
+ aRenderingContext.SetColor(GetForegroundColor());
+ aRenderingContext.DrawString(strDate,nsCRT::strlen(strDate),x,y,0);
+ }
+
+ return nsEventStatus_eConsumeNoDefault;
+}
+
diff --git a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp b/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp
index 43989a736aa..2cdf22793e7 100644
--- a/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp
+++ b/mozilla/calendar/modules/ui/canvas/src/nsCalMultiDayViewCanvas.cpp
@@ -27,6 +27,7 @@
#include "nsCalToolkit.h"
#include "nsCalDayListCommand.h"
+#include "nsCalNewModelCommand.h"
#include "nscalstrings.h"
@@ -516,110 +517,179 @@ nsresult nsCalMultiDayViewCanvas::Action(nsIXPFCCommand * aCommand)
nsresult res;
PRUint32 count = 0;
- nsCalDayListCommand * daylist_command = nsnull;
+ nsCalDayListCommand * daylist_command = nsnull;
+ nsCalNewModelCommand * newmodel_command = nsnull;
static NS_DEFINE_IID(kCalDayListCommandCID, NS_CAL_DAYLIST_COMMAND_CID);
+ static NS_DEFINE_IID(kCalNewModelCommandCID, NS_CAL_NEWMODEL_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()) {
-
+ if (NS_OK == res)
+ {
+
/*
- * The number of new days is different from current. If the number is
- * less, delete the difference. If it is more, add new canvas.
- *
+ * It's a day list command ... set the date
*/
- if (count < GetChildCount()) {
+ 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()) {
/*
- * Delete the difference
+ * The number of new days is different from current. If the number is
+ * less, delete the difference. If it is more, add new canvas.
+ *
*/
- PRUint32 delta = GetChildCount() - count;
+ if (count < GetChildCount()) {
- DeleteChildren(delta);
+ /*
+ * Delete the difference
+ */
- } else if (count > GetChildCount()) {
+ PRUint32 delta = GetChildCount() - count;
- /*
- * Add new children
- */
+ DeleteChildren(delta);
- PRUint32 delta = count - GetChildCount();
+ } else if (count > GetChildCount()) {
- PRUint32 i;
+ /*
+ * Add new children
+ */
+
+ PRUint32 delta = count - GetChildCount();
+
+ PRUint32 i;
+
+ for (i=0; iIsDone()))
+ {
+
+ if (index > count)
+ break;
+
+ nsDateTime * datetime = (nsDateTime *) iterator->CurrentItem();
+
+ if (datetime != nsnull) {
+
+ ChangeChildDateTime(index,datetime);
+
+ }
+
+ index++;
+
+ iterator->Next();
+ }
+
+
+ Layout();
+ }
+
+ res = aCommand->QueryInterface(kCalNewModelCommandCID,(void**)&newmodel_command);
+
+ if (NS_OK == res)
+ {
+ nsIXPFCCanvas * canvas = AddDayViewCanvas();
+
+ /*
+ * Get the last sibling and set it's model....
+ */
+
+ if (canvas != nsnull)
+ {
+
+ nsDateTime * nsdatetime;
+ static NS_DEFINE_IID(kCalDateTimeCID, NS_DATETIME_CID);
+ static NS_DEFINE_IID(kCalDateTimeIID, NS_IDATETIME_IID);
+ nsresult res = nsRepository::CreateInstance(kCalDateTimeCID,nsnull, kCalDateTimeCID, (void **)&nsdatetime);
/*
- * Set the time context to be based off multi-day
+ * Apply to all children ....
*/
+ nsIIterator * iterator ;
+ nsCalTimebarCanvas * tbc ;
- SetTimeContext(GetTimeContext());
+ res = canvas->CreateIterator(&iterator);
+
+ if (NS_OK == res)
+ {
+ iterator->Init();
+
+ while(!(iterator->IsDone()))
+ {
+
+ tbc = (nsCalTimebarCanvas *) iterator->CurrentItem();
+
+ nsCalTimebarCanvas * canvas_iface = nsnull;;
+
+ tbc->QueryInterface(kCalTimebarCanvasCID, (void**) &canvas_iface);
+
+ if (canvas_iface)
+ {
+
+ SetChildTimeContext(canvas_iface, GetTimeContext(), 0);
+ ChangeChildDateTime(canvas_iface, nsdatetime);
+ canvas_iface->SetModel(newmodel_command->mModel);
+
+ NS_RELEASE(canvas_iface);
+ }
+
+ iterator->Next();
+
+ }
+
+ iterator->Next();
+ }
+
+ Layout();
+
+ nsRect bounds;
+ GetView()->GetBounds(bounds);
+ gXPFCToolkit->GetViewManager()->UpdateView(GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
+
+ NS_RELEASE(tbc);
}
-
}
-
- /*
- * 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));
}
diff --git a/mozilla/calendar/modules/ui/command/inc/manifest.mn b/mozilla/calendar/modules/ui/command/inc/manifest.mn
index 9607662215b..f4b0ceb3eed 100644
--- a/mozilla/calendar/modules/ui/command/inc/manifest.mn
+++ b/mozilla/calendar/modules/ui/command/inc/manifest.mn
@@ -15,6 +15,7 @@ EXPORTS = \
PRIVATE_EXPORTS = \
nsCalDurationCommand.h \
nsCalDayListCommand.h \
+ nsCalNewModelCommand.h \
$(NULL)
MODULE = trex
diff --git a/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h b/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h
new file mode 100644
index 00000000000..9c15b86fd24
--- /dev/null
+++ b/mozilla/calendar/modules/ui/command/inc/nsCalNewModelCommand.h
@@ -0,0 +1,45 @@
+/* -*- 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 nsCalNewModelCommand_h___
+#define nsCalNewModelCommand_h___
+
+#include "nsXPFCCommand.h"
+#include "nsCalUtilCIID.h"
+#include "nsIModel.h"
+
+
+class nsCalNewModelCommand : public nsXPFCCommand
+{
+public:
+ nsCalNewModelCommand();
+
+ NS_DECL_ISUPPORTS
+
+ NS_IMETHOD Init() ;
+
+protected:
+ ~nsCalNewModelCommand();
+
+public:
+ nsIModel * mModel;
+
+
+};
+
+#endif /* nsCalNewModelCommand_h___ */
diff --git a/mozilla/calendar/modules/ui/command/src/manifest.mn b/mozilla/calendar/modules/ui/command/src/manifest.mn
index aeb299eb22d..6974421ef79 100644
--- a/mozilla/calendar/modules/ui/command/src/manifest.mn
+++ b/mozilla/calendar/modules/ui/command/src/manifest.mn
@@ -20,6 +20,7 @@ MODULE = trex
CPPSRCS = \
nsCalDurationCommand.cpp \
nsCalDayListCommand.cpp \
+ nsCalNewModelCommand.cpp \
$(NULL)
REQUIRES = xpcom raptor trex julian nls xpfc
diff --git a/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp b/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp
new file mode 100644
index 00000000000..eb38e4b8cf9
--- /dev/null
+++ b/mozilla/calendar/modules/ui/command/src/nsCalNewModelCommand.cpp
@@ -0,0 +1,75 @@
+/* -*- 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 "nsCalNewModelCommand.h"
+#include "nsCalUICIID.h"
+#include "nsCalUtilCIID.h"
+#include "nsxpfcCIID.h"
+
+static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
+static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
+
+nsCalNewModelCommand :: nsCalNewModelCommand()
+{
+ NS_INIT_REFCNT();
+ mModel = nsnull;
+}
+
+nsCalNewModelCommand :: ~nsCalNewModelCommand()
+{
+}
+
+NS_IMPL_ADDREF(nsCalNewModelCommand)
+NS_IMPL_RELEASE(nsCalNewModelCommand)
+
+nsresult nsCalNewModelCommand::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(kCalNewModelCommandCID, NS_CAL_NEWMODEL_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(kCalNewModelCommandCID)) {
+ *aInstancePtr = (void*)(nsCalNewModelCommand *) (this);
+ AddRef();
+ return NS_OK;
+ }
+
+ return (NS_NOINTERFACE);
+
+}
+
+nsresult nsCalNewModelCommand::Init()
+{
+ return NS_OK ;
+}
+
diff --git a/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h b/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h
index f6eb0e233c7..ec109e77ed0 100644
--- a/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h
+++ b/mozilla/calendar/modules/ui/core/inc/nsCalUICIID.h
@@ -63,6 +63,11 @@
{ 0x489a6750, 0x224d, 0x11d2, \
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
+//fd9f9c80-56ed-11d2-bee6-00805f8a8dbd
+#define NS_CAL_NEWMODEL_COMMAND_CID \
+{ 0xfd9f9c80, 0x56ed, 0x11d2, \
+{ 0xbe, 0xe6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
+
//6e645390-edba-11d1-bec6-00805f8a8dbd
#define NS_CAL_TIMEBARCANVAS_CID \
{ 0x6e645390, 0xedba, 0x11d1, \
@@ -113,6 +118,11 @@
{ 0x879f3230, 0x1da4, 0x11d2, \
{ 0xbe, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
+//9a9e2030-57dc-11d2-bee6-00805f8a8dbd
+#define NS_CAL_MONTHVIEWCANVAS_CID \
+{ 0x9a9e2030, 0x57dc, 0x11d2, \
+{ 0xbe, 0xe6, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd } }
+
//f5b41150-218e-11d2-9246-00805f8a7ab6
#define NS_CAL_STATUSCANVAS_CID \
{ 0xf5b41150, 0x218e, 0x11d2, \
diff --git a/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp b/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp
index 4605d161b11..99c1e84ab72 100644
--- a/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp
+++ b/mozilla/calendar/modules/ui/core/src/nsCalFactory.cpp
@@ -25,6 +25,7 @@
#include "nsCalComponent.h"
#include "nsCalDurationCommand.h"
#include "nsCalDayListCommand.h"
+#include "nsCalNewModelCommand.h"
#include "nsCalContextController.h"
#include "nsCalTimebarContextController.h"
#include "nsCalMonthContextController.h"
@@ -39,6 +40,7 @@
#include "nsCalTimebarScale.h"
#include "nsCalMultiDayViewCanvas.h"
#include "nsCalDayViewCanvas.h"
+#include "nsCalMonthViewCanvas.h"
#include "nsCalTodoComponentCanvas.h"
#include "nsCalToolkit.h"
@@ -47,6 +49,7 @@ 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(kCCalNewModelCommand, NS_CAL_NEWMODEL_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);
@@ -61,6 +64,7 @@ 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(kCCalMonthViewCanvas, NS_CAL_MONTHVIEWCANVAS_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);
@@ -170,6 +174,9 @@ nsresult nsCalFactory::CreateInstance(nsISupports *aOuter,
else if (mClassID.Equals(kCCalDayListCommand)) {
inst = (nsISupports *)new nsCalDayListCommand();
}
+ else if (mClassID.Equals(kCCalNewModelCommand)) {
+ inst = (nsISupports *)new nsCalNewModelCommand();
+ }
else if (mClassID.Equals(kCCalContextController)) {
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalContextController(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
@@ -230,6 +237,10 @@ nsresult nsCalFactory::CreateInstance(nsISupports *aOuter,
nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalDayViewCanvas(aOuter);
canvas->QueryInterface(kISupportsIID,(void **)&inst);
}
+ else if (mClassID.Equals(kCCalMonthViewCanvas)) {
+ nsXPFCCanvas * canvas = (nsXPFCCanvas *)new nsCalMonthViewCanvas(aOuter);
+ canvas->QueryInterface(kISupportsIID,(void **)&inst);
+ }
else if (mClassID.Equals(kCCalToolkit)) {
inst = (nsISupports *)(nsICalToolkit *)new nsCalToolkit();
}
diff --git a/mozilla/calendar/modules/ui/res/demo/julian1.cal b/mozilla/calendar/modules/ui/res/demo/julian1.cal
index 6006a4d4250..75f891d2755 100644
--- a/mozilla/calendar/modules/ui/res/demo/julian1.cal
+++ b/mozilla/calendar/modules/ui/res/demo/julian1.cal
@@ -48,11 +48,10 @@
-
+
-
-
+
diff --git a/mozilla/calendar/modules/ui/res/demo/julian2.cal b/mozilla/calendar/modules/ui/res/demo/julian2.cal
index 31df5476bd0..d161f679c4f 100644
--- a/mozilla/calendar/modules/ui/res/demo/julian2.cal
+++ b/mozilla/calendar/modules/ui/res/demo/julian2.cal
@@ -4,7 +4,7 @@
-
+
@@ -52,10 +52,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/ui/res/demo/julian3.cal b/mozilla/calendar/modules/ui/res/demo/julian3.cal
index 1415d92f16a..43d6c21cde0 100644
--- a/mozilla/calendar/modules/ui/res/demo/julian3.cal
+++ b/mozilla/calendar/modules/ui/res/demo/julian3.cal
@@ -4,15 +4,15 @@
-
+
-
+
-
+
@@ -26,7 +26,7 @@
-
+
@@ -41,17 +41,15 @@
-
+
-
--->
@@ -59,21 +57,20 @@
+
-
-
+
-
+
diff --git a/mozilla/calendar/modules/ui/res/demo/julian4.cal b/mozilla/calendar/modules/ui/res/demo/julian4.cal
index 268d4886a75..58ce767699a 100644
--- a/mozilla/calendar/modules/ui/res/demo/julian4.cal
+++ b/mozilla/calendar/modules/ui/res/demo/julian4.cal
@@ -6,10 +6,10 @@
-
+
-
+
diff --git a/mozilla/calendar/modules/ui/res/demo/trex1.ui b/mozilla/calendar/modules/ui/res/demo/trex1.ui
index 2d56f22774e..98884e3b677 100644
--- a/mozilla/calendar/modules/ui/res/demo/trex1.ui
+++ b/mozilla/calendar/modules/ui/res/demo/trex1.ui
@@ -15,7 +15,8 @@
-
+
+
diff --git a/mozilla/calendar/modules/ui/res/demo/trex2.ui b/mozilla/calendar/modules/ui/res/demo/trex2.ui
index b8b140e1132..517bc6a23b3 100644
--- a/mozilla/calendar/modules/ui/res/demo/trex2.ui
+++ b/mozilla/calendar/modules/ui/res/demo/trex2.ui
@@ -15,8 +15,8 @@
-
-
+
+
diff --git a/mozilla/calendar/modules/ui/res/demo/trex3.ui b/mozilla/calendar/modules/ui/res/demo/trex3.ui
index 9c741d0918e..954aea75f9f 100644
--- a/mozilla/calendar/modules/ui/res/demo/trex3.ui
+++ b/mozilla/calendar/modules/ui/res/demo/trex3.ui
@@ -15,7 +15,8 @@
-
+
+
diff --git a/mozilla/calendar/modules/ui/res/manifest.mn b/mozilla/calendar/modules/ui/res/manifest.mn
index 986c6aee638..8cebcec1d74 100644
--- a/mozilla/calendar/modules/ui/res/manifest.mn
+++ b/mozilla/calendar/modules/ui/res/manifest.mn
@@ -19,4 +19,5 @@ libs::
$(INSTALL) menubar.ui $(DIST)/bin/res/ui
$(INSTALL) toolbar.ui $(DIST)/bin/res/ui
$(INSTALL) test.ui $(DIST)/bin/res/ui
+ $(INSTALL) trex.ui $(DIST)/bin/res/ui
$(INSTALL) compose_event.ui $(DIST)/bin/res/ui
diff --git a/mozilla/calendar/modules/ui/res/menubar.ui b/mozilla/calendar/modules/ui/res/menubar.ui
index bac05eb20c4..49aa20c38a8 100644
--- a/mozilla/calendar/modules/ui/res/menubar.ui
+++ b/mozilla/calendar/modules/ui/res/menubar.ui
@@ -76,9 +76,9 @@
-
-
-
+
+
+
diff --git a/mozilla/calendar/modules/ui/res/toolbar.ui b/mozilla/calendar/modules/ui/res/toolbar.ui
index 959156edc03..d181d054bad 100644
--- a/mozilla/calendar/modules/ui/res/toolbar.ui
+++ b/mozilla/calendar/modules/ui/res/toolbar.ui
@@ -50,9 +50,9 @@
-
-
-
+
+
+
diff --git a/mozilla/calendar/modules/ui/res/trex.ui b/mozilla/calendar/modules/ui/res/trex.ui
index e178eee76a0..ab484e70620 100644
--- a/mozilla/calendar/modules/ui/res/trex.ui
+++ b/mozilla/calendar/modules/ui/res/trex.ui
@@ -15,8 +15,9 @@
-
-
+
+
+
diff --git a/mozilla/xpfc/canvas/inc/nsXPFCCanvas.h b/mozilla/xpfc/canvas/inc/nsXPFCCanvas.h
index 43fca05a312..78e6d522c4e 100644
--- a/mozilla/xpfc/canvas/inc/nsXPFCCanvas.h
+++ b/mozilla/xpfc/canvas/inc/nsXPFCCanvas.h
@@ -42,6 +42,7 @@
#include "nsIImageRequest.h"
#include "nsIView.h"
#include "nsIModel.h"
+#include "nsIXPFCCommand.h"
CLASS_EXPORT_XPFC nsXPFCCanvas : public nsIXPFCCanvas,
public nsIXPFCObserver,
@@ -240,6 +241,8 @@ public:
NS_IMETHOD_(void) SetCursor(nsCursor aCursor) ;
NS_IMETHOD_(nsCursor) GetDefaultCursor(nsPoint& aPoint) ;
NS_IMETHOD_(nsSplittableOrientation) GetSplittableOrientation(nsPoint& aPoint) ;
+ NS_IMETHOD BroadcastCommand(nsIXPFCCommand& aCommand);
+ NS_IMETHOD SendCommand();
// nsIImageRequestObserver
virtual void Notify(nsIImageRequest *aImageRequest,
diff --git a/mozilla/xpfc/canvas/public/nsIXPFCCanvas.h b/mozilla/xpfc/canvas/public/nsIXPFCCanvas.h
index 86d7b3c3f59..bfba90f8173 100644
--- a/mozilla/xpfc/canvas/public/nsIXPFCCanvas.h
+++ b/mozilla/xpfc/canvas/public/nsIXPFCCanvas.h
@@ -31,6 +31,7 @@
#include "nsIFontMetrics.h"
#include "nsIRenderingContext.h"
+class nsIXPFCCommand;
class nsIModel;
class nsIXPFCCommand;
class nsIView;
@@ -644,6 +645,9 @@ public:
NS_IMETHOD_(void) SetCursor(nsCursor aCursor) = 0;
NS_IMETHOD_(nsSplittableOrientation) GetSplittableOrientation(nsPoint& aPoint) = 0;
+ NS_IMETHOD BroadcastCommand(nsIXPFCCommand& aCommand) = 0;
+ NS_IMETHOD SendCommand() = 0;
+
/**
* Dump the canvas hierarchy to a file
* @param f, the FILE to dump to
diff --git a/mozilla/xpfc/canvas/src/nsXPFCCanvas.cpp b/mozilla/xpfc/canvas/src/nsXPFCCanvas.cpp
index 8b7b0b141cf..2007fdfb13a 100644
--- a/mozilla/xpfc/canvas/src/nsXPFCCanvas.cpp
+++ b/mozilla/xpfc/canvas/src/nsXPFCCanvas.cpp
@@ -606,6 +606,8 @@ nsresult nsXPFCCanvas :: LoadView(const nsCID &aViewClassIID,
else if (GetParent() != nsnull)
view = GetParent()->GetView();
+ nsViewClip clip ;
+
mView->Init(gXPFCToolkit->GetViewManager(),
bounds,
view,
@@ -1017,8 +1019,8 @@ void nsXPFCCanvas :: AddChildCanvas(nsIXPFCCanvas * aChildCanvas,PRInt32 aPositi
void nsXPFCCanvas :: RemoveChildCanvas(nsIXPFCCanvas * aChildCanvas)
{
mChildWidgets->Remove(aChildCanvas);
- NS_IF_RELEASE(aChildCanvas);
aChildCanvas->SetParent(nsnull);
+ NS_IF_RELEASE(aChildCanvas);
return ;
}
@@ -1284,7 +1286,7 @@ nsEventStatus nsXPFCCanvas :: PaintChildWidgets(nsIRenderingContext& aRenderingC
canvas->GetBounds(rect);
- if (rect.width != 0 && rect.height != 0)
+ if ((rect.width != 0) && (rect.height != 0) /*&& (rect.Contains(aDirtyRect) == PR_TRUE)*/)
canvas->OnPaint(aRenderingContext,aDirtyRect);
iterator->Next();
@@ -1846,6 +1848,9 @@ nsresult nsXPFCCanvas :: DeleteChildren(PRUint32 aCount)
{
widget = (nsIXPFCCanvas *) iterator->CurrentItem();
+ if (widget != nsnull)
+ widget->DeleteChildren();
+
if (mChildWidgets != nsnull)
mChildWidgets->Remove(widget);
@@ -2322,3 +2327,58 @@ nsSplittableOrientation nsXPFCCanvas :: GetSplittableOrientation(nsPoint& aPoint
return (orientation);
}
+
+nsresult nsXPFCCanvas :: SendCommand()
+{
+ if (mCommand.Length() > 0)
+ {
+ nsIWebViewerContainer * webViewerContainer = nsnull;
+ gXPFCToolkit->GetApplicationShell()->GetWebViewerContainer(&webViewerContainer);
+
+ if (webViewerContainer != nsnull)
+ {
+ webViewerContainer->LoadURL(mCommand,nsnull);
+ NS_RELEASE(webViewerContainer);
+ }
+ }
+ return NS_OK;
+}
+
+nsresult nsXPFCCanvas :: BroadcastCommand(nsIXPFCCommand& aCommand)
+{
+ nsresult res ;
+ nsIIterator * iterator ;
+ nsIXPFCCanvas * canvas;
+
+ /*
+ * Call this container's Action Method. We should change the action
+ * method to return something about ignoring and consuming commands
+ */
+
+ Action(&aCommand);
+
+ /*
+ * Iterate through the children and pass it on
+ */
+
+ res = CreateIterator(&iterator);
+
+ if (NS_OK != res)
+ return NS_OK;
+
+ iterator->Init();
+
+ while(!(iterator->IsDone()))
+ {
+ canvas = (nsIXPFCCanvas *) iterator->CurrentItem();
+
+ canvas->BroadcastCommand(aCommand);
+
+ iterator->Next();
+ }
+
+ NS_RELEASE(iterator);
+
+ return NS_OK;
+}
+
diff --git a/mozilla/xpfc/chrome/src/nsMenuContainer.cpp b/mozilla/xpfc/chrome/src/nsMenuContainer.cpp
index dbbd13b105a..f1394ac369e 100644
--- a/mozilla/xpfc/chrome/src/nsMenuContainer.cpp
+++ b/mozilla/xpfc/chrome/src/nsMenuContainer.cpp
@@ -315,6 +315,15 @@ nsresult nsMenuContainer::ProcessActionCommand(nsString& aAction)
if (mWebViewerContainer)
mWebViewerContainer->LoadURL("resource://res/ui/compose_event.ui",nsnull);
+ } else {
+
+ /*
+ * It ain't builtin ... pass it off as a url to be processed
+ */
+
+ if (mWebViewerContainer)
+ mWebViewerContainer->LoadURL(aAction,nsnull);
+
}
diff --git a/mozilla/xpfc/chrome/src/nsMenuItem.cpp b/mozilla/xpfc/chrome/src/nsMenuItem.cpp
index 251e27c45ab..0688fa9cb65 100644
--- a/mozilla/xpfc/chrome/src/nsMenuItem.cpp
+++ b/mozilla/xpfc/chrome/src/nsMenuItem.cpp
@@ -111,12 +111,24 @@ nsresult nsMenuItem :: SetParameter(nsString& aKey, nsString& aValue)
SetLabel(aValue);
- } else if (aKey == "command") {
-
- SetCommand(aValue);
+ } else if (aKey.EqualsIgnoreCase("command")) {
+ if (aValue.Find("LoadUrl?") != -1)
+ {
+ nsString command;
+
+ aValue.Mid(command,8,aValue.Length()-8);
+
+ SetCommand(command);
+
+ } else {
+
+ SetCommand(aValue);
+
+ }
+
}
-
+
return NS_OK;
}
diff --git a/mozilla/xpfc/parser/inc/nsXPFCXMLContentSink.h b/mozilla/xpfc/parser/inc/nsXPFCXMLContentSink.h
index 756eb1ecf8c..6a2b33c9e25 100644
--- a/mozilla/xpfc/parser/inc/nsXPFCXMLContentSink.h
+++ b/mozilla/xpfc/parser/inc/nsXPFCXMLContentSink.h
@@ -46,6 +46,7 @@ public:
NS_IMETHOD Init();
NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer);
+ NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas);
// nsIContentSink
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
diff --git a/mozilla/xpfc/parser/public/nsIXPFCXMLContentSink.h b/mozilla/xpfc/parser/public/nsIXPFCXMLContentSink.h
index d520a4635f5..ee1efbe0b88 100644
--- a/mozilla/xpfc/parser/public/nsIXPFCXMLContentSink.h
+++ b/mozilla/xpfc/parser/public/nsIXPFCXMLContentSink.h
@@ -21,6 +21,7 @@
#include "nsISupports.h"
#include "nsIWebViewerContainer.h"
+#include "nsIXPFCCanvas.h"
//c47f83e0-4910-11d2-924a-00805f8a7ab6
#define NS_IXPFC_XML_CONTENT_SINK_IID \
@@ -34,6 +35,7 @@ public:
NS_IMETHOD Init() = 0 ;
NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer) = 0;
+ NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas) = 0;
};
diff --git a/mozilla/xpfc/parser/src/nsXPFCXMLContentSink.cpp b/mozilla/xpfc/parser/src/nsXPFCXMLContentSink.cpp
index 4870ee7b701..a2fb5790cd0 100644
--- a/mozilla/xpfc/parser/src/nsXPFCXMLContentSink.cpp
+++ b/mozilla/xpfc/parser/src/nsXPFCXMLContentSink.cpp
@@ -29,6 +29,7 @@
#include "nsITextWidget.h"
#include "nsITabWidget.h"
#include "nsWidgetsCID.h"
+#include "nsXPFCToolkit.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
@@ -189,6 +190,7 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode)
eXPFCXMLTags tag = (eXPFCXMLTags) aNode.GetNodeType();
nsresult res;
nsCID aclass;
+ nsString toLoadUrl;
if (eXPFCXMLTag_menubar == tag)
mState = XPFC_PARSING_STATE_MENUBAR;
@@ -218,14 +220,14 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode)
if (key.EqualsIgnoreCase("src"))
{
// Load the url!
- mViewerContainer->LoadURL(value,nsnull);
+ toLoadUrl = value;
break;
}
}
}
- return NS_OK;
+ //return NS_OK;
}
nsString text = aNode.GetText();
@@ -243,14 +245,14 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode)
if (NS_OK != res)
return res ;
- object->Init();
/*
* ConsumeAttributes
*/
- ConsumeAttributes(aNode,*object);
AddToHierarchy(*object, PR_TRUE);
+ object->Init();
+ ConsumeAttributes(aNode,*object);
/*
* If this is a menu bar, tell the widget.
@@ -303,6 +305,39 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode)
}
+ /*
+ * If this was a root panel, add it to the widget
+ */
+
+ if (eXPFCXMLTag_application == tag)
+ {
+ nsIXPFCCanvas * child = (nsIXPFCCanvas *) mXPFCStack->Top();
+
+ if (child != nsnull)
+ {
+ nsIXPFCCanvas * root ;
+
+ gXPFCToolkit->GetRootCanvas(&root);
+
+ root->DeleteChildren();
+
+ root->AddChildCanvas(child);
+
+ NS_RELEASE(root);
+ }
+ }
+
+ if (toLoadUrl.Length() > 0)
+ {
+ nsIXPFCCanvas * canvas = nsnull;
+
+ if (toLoadUrl.Find(".cal") != -1)
+ object->QueryInterface(kIXPFCCanvasIID,(void**)&canvas);
+
+ mViewerContainer->LoadURL(toLoadUrl,nsnull,canvas);
+
+ NS_IF_RELEASE(canvas);
+ }
return NS_OK;
}
@@ -329,7 +364,9 @@ NS_IMETHODIMP nsXPFCXMLContentSink::CloseContainer(const nsIParserNode& aNode)
}
}
+#if 0
NS_IF_RELEASE(container);
+#endif
return NS_OK;
}
@@ -373,10 +410,11 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddLeaf(const nsIParserNode& aNode)
if (NS_OK != res)
return res ;
+ AddToHierarchy(*object, PR_FALSE);
+
object->Init();
ConsumeAttributes(aNode,*object);
- AddToHierarchy(*object, PR_FALSE);
// XXX: Need a way to identify that native widgets are
// involved!
@@ -715,6 +753,9 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject,
nsIXPFCToolbar * container = nsnull;
nsIXPFCToolbar * parent = nsnull;
+ nsIXPFCCanvas * child_canvas = nsnull;
+
+ aObject.QueryInterface(kIXPFCCanvasIID,(void**)&child_canvas);
nsresult res = aObject.QueryInterface(kCIXPFCToolbarIID,(void**)&container);
@@ -723,14 +764,12 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject,
if (parent == nsnull)
{
mViewerContainer->GetToolbarManager()->AddToolbar(container);
+
} else {
nsIXPFCCanvas * parent_canvas = nsnull;
- nsIXPFCCanvas * child_canvas = nsnull;
- res = aObject.QueryInterface(kIXPFCCanvasIID,(void**)&child_canvas);
-
- if (NS_OK == res)
+ if (child_canvas != nsnull)
{
res = parent->QueryInterface(kIXPFCCanvasIID,(void**)&parent_canvas);
@@ -741,14 +780,15 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject,
NS_RELEASE(parent_canvas);
}
- NS_RELEASE(child_canvas);
}
}
if (aPush == PR_TRUE)
- mXPFCStack->Push(container);
+ mXPFCStack->Push(child_canvas);
+
+ NS_IF_RELEASE(child_canvas);
return NS_OK;
@@ -864,12 +904,42 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject,
return NS_OK;
- }
-
- else {
+ } else if (mState == XPFC_PARSING_STATE_APPLICATION)
+ {
+
+ nsIXPFCCanvas * container = nsnull;
+ nsIXPFCCanvas * parent = nsnull;
+
+ nsresult res = aObject.QueryInterface(kIXPFCCanvasIID,(void**)&container);
+
+ parent = (nsIXPFCCanvas *) mXPFCStack->Top();
+
+ if (parent == nsnull)
+ {
+ if (aPush == PR_TRUE)
+ mXPFCStack->Push(container);
+
+ } else {
+
+ parent->AddChildCanvas(container);
+
+ if (aPush == PR_TRUE)
+ mXPFCStack->Push(container);
+ }
+
+ return NS_OK;
+
+ } else {
+
return NS_OK;
}
return NS_OK;
}
+
+nsresult nsXPFCXMLContentSink::SetRootCanvas(nsIXPFCCanvas * aCanvas)
+{
+ mXPFCStack->Push(aCanvas);
+ return NS_OK;
+}
diff --git a/mozilla/xpfc/parser/src/nsXPFCXMLDTD.cpp b/mozilla/xpfc/parser/src/nsXPFCXMLDTD.cpp
index ecf7368c385..c476a538290 100644
--- a/mozilla/xpfc/parser/src/nsXPFCXMLDTD.cpp
+++ b/mozilla/xpfc/parser/src/nsXPFCXMLDTD.cpp
@@ -67,6 +67,7 @@ nsXPFCXMLTagEntry gXPFCXMLTagTable[] =
{"tabwidget", eXPFCXMLTag_tabwidget},
{"toolbar", eXPFCXMLTag_toolbar},
{"ui", eXPFCXMLTag_ui},
+ {"userdefined", eXPFCXMLTag_userdefined},
{"xpbutton", eXPFCXMLTag_xpbutton},
};
diff --git a/mozilla/xpfc/shell/inc/nsStreamManager.h b/mozilla/xpfc/shell/inc/nsStreamManager.h
index de57369c3d5..4048bf1164f 100644
--- a/mozilla/xpfc/shell/inc/nsStreamManager.h
+++ b/mozilla/xpfc/shell/inc/nsStreamManager.h
@@ -21,6 +21,7 @@
#include "nsIVector.h"
#include "nsIIterator.h"
#include "nsIStreamManager.h"
+#include "nsIXPFCCanvas.h"
class nsStreamManager : public nsIStreamManager
{
@@ -45,6 +46,7 @@ public:
NS_IMETHOD Init();
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
+ nsIXPFCCanvas * aParentCanvas,
const nsString& aURLSpec,
nsIPostData * aPostData,
nsIID *aDTDIID = nsnull,
diff --git a/mozilla/xpfc/shell/inc/nsStreamObject.h b/mozilla/xpfc/shell/inc/nsStreamObject.h
index 6c2a17cd935..2d8c98736d5 100644
--- a/mozilla/xpfc/shell/inc/nsStreamObject.h
+++ b/mozilla/xpfc/shell/inc/nsStreamObject.h
@@ -20,6 +20,7 @@
#include "nsIFactory.h"
#include "nsIStreamObject.h"
#include "nsIStreamListener.h"
+#include "nsIXPFCCanvas.h"
class nsStreamObject : public nsIStreamObject,
public nsIStreamListener
@@ -62,6 +63,7 @@ public:
nsIDTD * mDTD;
nsIContentSink * mSink;
nsIStreamListener * mStreamListener;
+ nsIXPFCCanvas * mParentCanvas;
};
diff --git a/mozilla/xpfc/shell/public/nsIStreamManager.h b/mozilla/xpfc/shell/public/nsIStreamManager.h
index 0c194349501..6d14e4f83e9 100644
--- a/mozilla/xpfc/shell/public/nsIStreamManager.h
+++ b/mozilla/xpfc/shell/public/nsIStreamManager.h
@@ -26,6 +26,8 @@
#include "nsIURL.h"
#include "nsIStreamListener.h"
+class nsIXPFCCanvas;
+
// 5f680140-360f-11d2-9248-00805f8a7ab6
#define NS_ISTREAM_MANAGER_IID \
{ 0x5f680140, 0x360f, 0x11d2, \
@@ -43,6 +45,7 @@ public:
NS_IMETHOD Init() = 0;
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
+ nsIXPFCCanvas * aParentCanvas,
const nsString& aURLSpec,
nsIPostData * aPostData,
nsIID *aDTDIID = nsnull,
diff --git a/mozilla/xpfc/shell/public/nsIWebViewerContainer.h b/mozilla/xpfc/shell/public/nsIWebViewerContainer.h
index f19106dc6de..831047bbc1f 100644
--- a/mozilla/xpfc/shell/public/nsIWebViewerContainer.h
+++ b/mozilla/xpfc/shell/public/nsIWebViewerContainer.h
@@ -28,6 +28,7 @@
#include "nsIXPFCDialog.h"
#include "nsIApplicationShell.h"
#include "nsIXPFCCommand.h"
+#include "nsIXPFCCanvas.h"
//06245670-306a-11d2-9247-00805f8a7ab6
#define NS_IWEB_VIEWER_CONTAINER_IID \
@@ -62,6 +63,7 @@ public:
NS_IMETHOD LoadURL(const nsString& aURLSpec,
nsIStreamObserver* aListener,
+ nsIXPFCCanvas * aParentCanvas = 0,
nsIPostData* aPostData = 0) = 0;
};
diff --git a/mozilla/xpfc/shell/src/nsStreamManager.cpp b/mozilla/xpfc/shell/src/nsStreamManager.cpp
index a76a4761afe..3c97e79ff99 100644
--- a/mozilla/xpfc/shell/src/nsStreamManager.cpp
+++ b/mozilla/xpfc/shell/src/nsStreamManager.cpp
@@ -85,6 +85,7 @@ nsresult nsStreamManager::Init()
}
nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
+ nsIXPFCCanvas * aParentCanvas,
const nsString& aURLSpec,
nsIPostData * aPostData,
nsIID *aDTDIID,
@@ -134,21 +135,6 @@ nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
res = NS_NewURL(&(stream_object->mUrl), pUI);
}
-
-
- if (urlParser.IsLocalFile() == PR_TRUE)
- {
- PRStatus status = PR_Access(pUI,PR_ACCESS_EXISTS);
-
- } else {
-
- char * file = urlParser.ToLocalFile();
-
- PRStatus status = PR_Access(file,PR_ACCESS_EXISTS);
-
- }
-
-
/*
* Create the Parser
*/
@@ -199,6 +185,17 @@ nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
if (NS_OK == res)
{
sink->SetViewerContainer(aWebViewerContainer);
+
+ /*
+ * Push Top of stack
+ */
+
+ if (nsnull != aParentCanvas)
+ {
+ sink->SetRootCanvas(aParentCanvas);
+
+ }
+
NS_RELEASE(sink);
}
@@ -219,7 +216,6 @@ nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
stream_object->mDTD->SetContentSink(stream_object->mSink);
stream_object->mDTD->SetParser(stream_object->mParser);
-
/*
* Open the URL
*/
diff --git a/mozilla/xpfc/shell/src/nsStreamObject.cpp b/mozilla/xpfc/shell/src/nsStreamObject.cpp
index d1d4e5657f7..163d5a6963c 100644
--- a/mozilla/xpfc/shell/src/nsStreamObject.cpp
+++ b/mozilla/xpfc/shell/src/nsStreamObject.cpp
@@ -41,6 +41,7 @@ nsStreamObject::nsStreamObject()
mDTD = nsnull;
mSink = nsnull;
mStreamListener = nsnull;
+ mParentCanvas = nsnull;
}
nsStreamObject::~nsStreamObject()
diff --git a/mozilla/xpfc/shell/src/windows/winmain.cpp b/mozilla/xpfc/shell/src/windows/winmain.cpp
index cf089e0700f..71351f144fb 100644
--- a/mozilla/xpfc/shell/src/windows/winmain.cpp
+++ b/mozilla/xpfc/shell/src/windows/winmain.cpp
@@ -150,7 +150,7 @@ int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCm
NS_RELEASE(pShellInstance);
NS_ShutdownINetService();
- PR_Cleanup();
+ //PR_Cleanup();
// book out of here
return result;
diff --git a/mozilla/xpfc/widget/src/nsXPButton.cpp b/mozilla/xpfc/widget/src/nsXPButton.cpp
index 19346a5841a..7374eac73c7 100644
--- a/mozilla/xpfc/widget/src/nsXPButton.cpp
+++ b/mozilla/xpfc/widget/src/nsXPButton.cpp
@@ -45,8 +45,6 @@ static NS_DEFINE_IID(kViewCID, NS_VIEW_CID);
#define DEFAULT_WIDTH 50
#define DEFAULT_HEIGHT 50
-nsString gCommandString;
-
nsXPButton :: nsXPButton(nsISupports* outer) : nsXPItem(outer)
{
NS_INIT_REFCNT();
@@ -129,17 +127,24 @@ nsresult nsXPButton :: SetParameter(nsString& aKey, nsString& aValue)
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_COMMAND)) {
- // XXX: Total hack here for demo purposes ... sorry
-
- aValue.Mid(gCommandString,8,aValue.Length()-8);
-
+ // XXX: Hardcoded to LoadUrl?
+ nsString command;
- } else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) {
+ aValue.Mid(command,8,aValue.Length()-8);
+ SetCommand(command);
+
+ //} else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) {
+
+
+ } else {
+
+ return (nsXPItem::SetParameter(aKey, aValue));
}
- return (nsXPItem::SetParameter(aKey, aValue));
+ return NS_OK;
+
}
nsresult nsXPButton :: GetClassPreferredSize(nsSize& aSize)
@@ -371,19 +376,7 @@ nsEventStatus nsXPButton :: OnLeftButtonUp(nsGUIEvent *aEvent)
bounds.y = 0;
gXPFCToolkit->GetViewManager()->UpdateView(GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
-#if 0
- if (gCommandString.Length() > 0)
- {
- nsIWebViewerContainer * webViewerContainer = nsnull;
- gXPFCToolkit->GetApplicationShell()->GetWebViewerContainer(&webViewerContainer);
-
- if (webViewerContainer != nsnull)
- {
- webViewerContainer->LoadURL(gCommandString,nsnull);
- NS_RELEASE(webViewerContainer);
- }
- }
-#endif
+ SendCommand();
return (nsXPItem::OnLeftButtonUp(aEvent));
}