summaryrefslogtreecommitdiff
path: root/slideshow/source
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2009-04-27 11:42:05 +0000
committerAndre Fischer <af@openoffice.org>2009-04-27 11:42:05 +0000
commit69a4a545a556bd189736b3e510d4b4b07ae8cb6e (patch)
tree33696e0153c26ca3c8cf32b988cc6422688cccee /slideshow/source
parentaa02f1da390cb9b1225de978f8e2965c34e3a45f (diff)
#i48179# Debug: added descriptive strings to events.
Diffstat (limited to 'slideshow/source')
-rw-r--r--slideshow/source/engine/animationnodes/animationaudionode.cxx9
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx3
-rw-r--r--slideshow/source/engine/animationnodes/animationcommandnode.cxx3
-rw-r--r--slideshow/source/engine/animationnodes/animationsetnode.cxx3
-rw-r--r--slideshow/source/engine/animationnodes/basenode.cxx9
-rw-r--r--slideshow/source/engine/animationnodes/generateevent.cxx36
-rw-r--r--slideshow/source/engine/animationnodes/paralleltimecontainer.cxx3
-rw-r--r--slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx12
-rw-r--r--slideshow/source/engine/debug.cxx328
-rw-r--r--slideshow/source/engine/effectrewinder.cxx12
-rw-r--r--slideshow/source/engine/eventmultiplexer.cxx15
-rw-r--r--slideshow/source/engine/eventqueue.cxx28
-rw-r--r--slideshow/source/engine/makefile.mk3
-rw-r--r--slideshow/source/engine/rehearsetimingsactivity.cxx3
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx19
-rw-r--r--slideshow/source/engine/slideview.cxx6
-rw-r--r--slideshow/source/engine/usereventqueue.cxx9
-rw-r--r--slideshow/source/engine/wakeupevent.cxx3
-rw-r--r--slideshow/source/inc/debug.hxx87
-rw-r--r--slideshow/source/inc/delayevent.hxx69
-rw-r--r--slideshow/source/inc/event.hxx14
-rw-r--r--slideshow/source/inc/interruptabledelayevent.hxx5
22 files changed, 616 insertions, 63 deletions
diff --git a/slideshow/source/engine/animationnodes/animationaudionode.cxx b/slideshow/source/engine/animationnodes/animationaudionode.cxx
index 634dc0342515..24c3a95382bf 100644
--- a/slideshow/source/engine/animationnodes/animationaudionode.cxx
+++ b/slideshow/source/engine/animationnodes/animationaudionode.cxx
@@ -94,14 +94,16 @@ void AnimationAudioNode::activate_st()
// no node duration. Take inherent media time, then
scheduleDeactivationEvent(
makeDelay( boost::bind( &AnimationNode::deactivate, getSelf() ),
- mpPlayer->getDuration() ) );
+ mpPlayer->getDuration(),
+ "AnimationAudioNode::deactivate with delay") );
}
}
else
{
// deactivate ASAP:
scheduleDeactivationEvent(
- makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ) ) );
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "AnimationAudioNode::deactivate without delay") );
}
}
@@ -127,7 +129,8 @@ void AnimationAudioNode::deactivate_st( NodeState /*eDestState*/ )
getContext().mrEventQueue.addEvent(
makeEvent( boost::bind( &EventMultiplexer::notifyAudioStopped,
boost::ref(getContext().mrEventMultiplexer),
- getSelf() ) ) );
+ getSelf() ),
+ "AnimationAudioNode::notifyAudioStopped") );
}
bool AnimationAudioNode::hasPendingAnimation() const
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
index 82868063fefa..19a6df2a8244 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -456,7 +456,8 @@ AnimationBaseNode::fillCommonParameters() const
EventSharedPtr pEndEvent;
if (pSelf) {
pEndEvent = makeEvent(
- boost::bind( &AnimationNode::deactivate, pSelf ) );
+ boost::bind( &AnimationNode::deactivate, pSelf ),
+ "AnimationBaseNode::deactivate");
}
// Calculate the minimum frame count that depends on the duration and
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
index f9104f37a45a..2adbe2b9b75a 100644
--- a/slideshow/source/engine/animationnodes/animationcommandnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -124,7 +124,8 @@ void AnimationCommandNode::activate_st()
// deactivate ASAP:
scheduleDeactivationEvent(
- makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ) ) );
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "AnimationCommandNode::deactivate" ) );
}
bool AnimationCommandNode::hasPendingAnimation() const
diff --git a/slideshow/source/engine/animationnodes/animationsetnode.cxx b/slideshow/source/engine/animationnodes/animationsetnode.cxx
index f7669b7214d3..ba1f015cd4fe 100644
--- a/slideshow/source/engine/animationnodes/animationsetnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationsetnode.cxx
@@ -80,7 +80,8 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pSelf, "cannot cast getSelf() to my type!" );
aParms.mpEndEvent = makeEvent(
boost::bind( &AnimationSetNode::implScheduleDeactivationEvent,
- pSelf ) );
+ pSelf ),
+ "AnimationSetNode::implScheduleDeactivationEvent");
}
switch (AnimationFactory::classifyAttributeName( attrName )) {
diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx
index 9f74a75fd571..6ad15e43462f 100644
--- a/slideshow/source/engine/animationnodes/basenode.cxx
+++ b/slideshow/source/engine/animationnodes/basenode.cxx
@@ -50,6 +50,7 @@
#include "tools.hxx"
#include "nodetools.hxx"
#include "generateevent.hxx"
+#include "debug.hxx"
#include <boost/bind.hpp>
#include <vector>
@@ -312,6 +313,10 @@ public:
mpNode->meCurrState = meToState;
clear();
}
+
+ // Uncomment the following line to write the node tree to file on
+ // every state change of one of its nodes.
+ // Debug_ShowNodeTree(mpNode->mpSelf);
}
void clear() {
@@ -488,7 +493,9 @@ bool BaseNode::resolve()
// schedule delayed activation event. Take iterate node
// timeout into account
mpCurrentEvent = makeDelay(
- boost::bind( &AnimationNode::activate, mpSelf ), mnStartDelay );
+ boost::bind( &AnimationNode::activate, mpSelf ),
+ mnStartDelay,
+ "AnimationNode::activate with delay");
maContext.mrEventQueue.addEvent( mpCurrentEvent );
}
diff --git a/slideshow/source/engine/animationnodes/generateevent.cxx b/slideshow/source/engine/animationnodes/generateevent.cxx
index 0983019dafef..015db5586834 100644
--- a/slideshow/source/engine/animationnodes/generateevent.cxx
+++ b/slideshow/source/engine/animationnodes/generateevent.cxx
@@ -111,7 +111,9 @@ EventSharedPtr generateEvent(
case animations::EventTrigger::BEGIN_EVENT:
// try to extract XAnimationNode event source
if (aEvent.Source >>= xNode) {
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, BEGIN_EVENT");
rContext.mrUserEventQueue.registerAnimationStartEvent(
pEvent, xNode );
}
@@ -123,7 +125,9 @@ EventSharedPtr generateEvent(
case animations::EventTrigger::END_EVENT:
// try to extract XAnimationNode event source
if (aEvent.Source >>= xNode) {
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, END_EVENT");
rContext.mrUserEventQueue.registerAnimationEndEvent(
pEvent, xNode );
}
@@ -137,7 +141,9 @@ EventSharedPtr generateEvent(
if ((aEvent.Source >>= xShape) &&
(pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
{
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_CLICK");
rContext.mrUserEventQueue.registerShapeClickEvent(
pEvent, pShape );
}
@@ -151,7 +157,9 @@ EventSharedPtr generateEvent(
if ((aEvent.Source >>= xShape) &&
(pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
{
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_DBL_CLICK");
rContext.mrUserEventQueue.registerShapeDoubleClickEvent(
pEvent, pShape );
}
@@ -165,7 +173,9 @@ EventSharedPtr generateEvent(
if ((aEvent.Source >>= xShape) &&
(pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
{
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_MOUSE_ENTER");
rContext.mrUserEventQueue.registerMouseEnterEvent(
pEvent, pShape );
}
@@ -179,7 +189,9 @@ EventSharedPtr generateEvent(
if ((aEvent.Source >>= xShape) &&
(pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
{
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_MOUSE_LEAVE");
rContext.mrUserEventQueue.registerMouseLeaveEvent(
pEvent, pShape );
}
@@ -193,13 +205,17 @@ EventSharedPtr generateEvent(
"mapped to ON_NEXT!" );
// FALLTHROUGH intended
case animations::EventTrigger::ON_NEXT:
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_NEXT");
rContext.mrUserEventQueue.registerNextEffectEvent( pEvent );
break;
case animations::EventTrigger::ON_STOP_AUDIO:
// try to extract XAnimationNode event source
if (aEvent.Source >>= xNode) {
- pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_STOP_AUDIO");
rContext.mrUserEventQueue.registerAudioStoppedEvent(
pEvent, xNode );
}
@@ -218,7 +234,9 @@ EventSharedPtr generateEvent(
"not yet implemented!" );
}
else if (rEventDescription >>= nDelay1) {
- pEvent = makeDelay( rFunctor, nDelay1 + nAdditionalDelay );
+ pEvent = makeDelay( rFunctor,
+ nDelay1 + nAdditionalDelay,
+ "generateEvent with delay");
// schedule delay event
rContext.mrEventQueue.addEvent( pEvent );
}
diff --git a/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx b/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx
index 0bd4c524586e..0581c78e9c47 100644
--- a/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx
+++ b/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx
@@ -53,7 +53,8 @@ void ParallelTimeContainer::activate_st()
if (isDurationIndefinite() && maChildren.empty()) {
// deactivate ASAP:
scheduleDeactivationEvent(
- makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ) ) );
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "ParallelTimeContainer::deactivate") );
}
else { // use default
scheduleDeactivationEvent();
diff --git a/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx b/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx
index e841c8e667de..bf0cba0cfe64 100644
--- a/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx
+++ b/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx
@@ -63,7 +63,8 @@ void SequentialTimeContainer::activate_st()
{
// deactivate ASAP:
scheduleDeactivationEvent(
- makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ) ) );
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "SequentialTimeContainer::deactivate") );
}
else // use default
scheduleDeactivationEvent();
@@ -89,7 +90,8 @@ void SequentialTimeContainer::skipEffect(
// empty all events ignoring timings => until next effect
getContext().mrEventQueue.forceEmpty();
getContext().mrEventQueue.addEvent(
- makeEvent( boost::bind(&AnimationNode::deactivate, pChildNode) ) );
+ makeEvent( boost::bind(&AnimationNode::deactivate, pChildNode),
+ "SequentialTimeContainer::deactivate, skipEffect with delay") );
}
else
OSL_ENSURE( false, "unknown notifier!" );
@@ -116,12 +118,14 @@ bool SequentialTimeContainer::resolveChild(
mpCurrentSkipEvent = makeEvent(
boost::bind( &SequentialTimeContainer::skipEffect,
boost::dynamic_pointer_cast<SequentialTimeContainer>( getSelf() ),
- pChildNode ) );
+ pChildNode ),
+ "SequentialTimeContainer::skipEffect, resolveChild");
// event that will reresolve the resolved/activated child:
mpCurrentRewindEvent = makeEvent(
boost::bind( &SequentialTimeContainer::rewindEffect,
boost::dynamic_pointer_cast<SequentialTimeContainer>( getSelf() ),
- pChildNode ) );
+ pChildNode ),
+ "SequentialTimeContainer::rewindEffect, resolveChild");
// deactivate child node when skip event occurs:
getContext().mrUserEventQueue.registerSkipEffectEvent(
diff --git a/slideshow/source/engine/debug.cxx b/slideshow/source/engine/debug.cxx
new file mode 100644
index 000000000000..36bb8c9e106b
--- /dev/null
+++ b/slideshow/source/engine/debug.cxx
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: layer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_slideshow.hxx"
+
+#include "debug.hxx"
+#include "animationnodes/basecontainernode.hxx"
+#include "animationnodes/paralleltimecontainer.hxx"
+#include "animationnodes/sequentialtimecontainer.hxx"
+#include "animationnodes/animationtransitionfilternode.hxx"
+#include "animationnodes/animationaudionode.hxx"
+#include "animationnodes/animationcolornode.hxx"
+#include "animationnodes/animationcommandnode.hxx"
+#include "animationnodes/animationpathmotionnode.hxx"
+#include "animationnodes/animationsetnode.hxx"
+#include "animationnodes/animationtransformnode.hxx"
+#include "animationnodes/propertyanimationnode.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/Event.hpp>
+
+#include <cstdio>
+#include <cstdarg>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+namespace slideshow { namespace internal {
+
+#if OSL_DEBUG_LEVEL > 1
+
+namespace {
+
+class NodeContainer : public BaseContainerNode
+{
+public:
+ void ShowChildrenState (void) const;
+};
+
+
+
+
+OUString DebugGetDescription (const AnimationNodeSharedPtr& rpNode)
+{
+ if (::boost::dynamic_pointer_cast<BaseContainerNode>(rpNode))
+ {
+ // Node is a container.
+ if (::boost::dynamic_pointer_cast<ParallelTimeContainer>(rpNode))
+ return OUString::createFromAscii("ParallelTimeContainer");
+ else if (::boost::dynamic_pointer_cast<SequentialTimeContainer>(rpNode))
+ return OUString::createFromAscii("SequentialTimeContainer");
+ else
+ return OUString::createFromAscii("<unknown container>");
+ }
+ else if (::boost::dynamic_pointer_cast<AnimationTransitionFilterNode>(rpNode))
+ return OUString::createFromAscii("AnimationTransitionFilterNode");
+ else if (::boost::dynamic_pointer_cast<AnimationAudioNode>(rpNode))
+ return OUString::createFromAscii("AnimationAudioNode");
+ else if (::boost::dynamic_pointer_cast<AnimationColorNode>(rpNode))
+ return OUString::createFromAscii("AnimationColorNode");
+ else if (::boost::dynamic_pointer_cast<AnimationCommandNode>(rpNode))
+ return OUString::createFromAscii("AnimationCommandNode");
+ else if (::boost::dynamic_pointer_cast<AnimationPathMotionNode>(rpNode))
+ return OUString::createFromAscii("AnimationPathMotionNode");
+ else if (::boost::dynamic_pointer_cast<AnimationSetNode>(rpNode))
+ return OUString::createFromAscii("AnimationSetNode");
+ else if (::boost::dynamic_pointer_cast<AnimationTransformNode>(rpNode))
+ return OUString::createFromAscii("AnimationTransformNode");
+ else if (::boost::dynamic_pointer_cast<PropertyAnimationNode>(rpNode))
+ return OUString::createFromAscii("PropertyAnimationNode");
+ else
+ return OUString::createFromAscii("<unknown node type>");
+}
+
+
+
+
+void DebugShowState (const AnimationNodeSharedPtr& rpNode)
+{
+ if ( ! rpNode)
+ return;
+
+ OUString sState;
+ OUString sStateColor;
+ switch (rpNode->getState())
+ {
+ default:
+ case AnimationNode::INVALID:
+ sState = OUString::createFromAscii("Invalid");
+ sStateColor = OUString::createFromAscii("firebrick1");
+ break;
+ case AnimationNode::UNRESOLVED:
+ sState = OUString::createFromAscii("Unresolved");
+ sStateColor = OUString::createFromAscii("dodgerblue4");
+ break;
+ case AnimationNode::RESOLVED:
+ sState = OUString::createFromAscii("Resolved");
+ sStateColor = OUString::createFromAscii("dodgerblue");
+ break;
+ case AnimationNode::ACTIVE:
+ sState = OUString::createFromAscii("Active");
+ sStateColor = OUString::createFromAscii("seagreen1");
+ break;
+ case AnimationNode::FROZEN:
+ sState = OUString::createFromAscii("Frozen");
+ sStateColor = OUString::createFromAscii("lightskyblue1");
+ break;
+ case AnimationNode::ENDED:
+ sState = OUString::createFromAscii("Ended");
+ sStateColor = OUString::createFromAscii("slategray3");
+ break;
+ }
+
+ const uno::Any aBegin (rpNode->getXAnimationNode()->getBegin());
+ OUString sTrigger;
+ if (aBegin.hasValue())
+ {
+ animations::Event aEvent;
+ double nTimeOffset;
+ const static char* sEventTriggers[] = {
+ "NONE", "ON_BEGIN", "ON_END", "BEGIN_EVENT", "END_EVENT", "ON_CLICK",
+ "ON_DBL_CLICK", "ON_MOUSE_ENTER", "ON_MOUSE_LEAVE", "ON_NEXT", "ON_PREV",
+ "ON_STOP_AUDIO", "REPEAT"};
+ if (aBegin >>= aEvent)
+ {
+ sTrigger = OUString::createFromAscii(sEventTriggers[aEvent.Trigger]);
+ }
+ else if (aBegin >>= nTimeOffset)
+ {
+ sTrigger = OUString::valueOf(nTimeOffset);
+ }
+ else
+ {
+ sTrigger = OUString::createFromAscii("other");
+ }
+ }
+ else
+ sTrigger = ::rtl::OUString::createFromAscii("void");
+
+ TRACE("Node state: n%x [label=\"%x / %x / %s\\n%s\\n%s\",style=filled,fillcolor=\"%s\"]\r",
+ rpNode.get(),
+ rpNode.get(),
+ rpNode->getXAnimationNode().get(),
+ ::rtl::OUStringToOString(sState, RTL_TEXTENCODING_ASCII_US).getStr(),
+ ::rtl::OUStringToOString(DebugGetDescription(rpNode), RTL_TEXTENCODING_ASCII_US).getStr(),
+ ::rtl::OUStringToOString(sTrigger, RTL_TEXTENCODING_ASCII_US).getStr(),
+ ::rtl::OUStringToOString(sStateColor, RTL_TEXTENCODING_ASCII_US).getStr());
+
+ BaseContainerNodeSharedPtr pContainer (
+ ::boost::dynamic_pointer_cast<BaseContainerNode>(rpNode));
+ if (pContainer)
+ ::boost::static_pointer_cast<NodeContainer>(rpNode)->ShowChildrenState();
+}
+
+
+
+
+void NodeContainer::ShowChildrenState (void) const
+{
+ for (std::size_t nIndex=0; nIndex<maChildren.size(); ++nIndex)
+ {
+ TRACE("Node connection: n%x -> n%x", this, maChildren[nIndex].get());
+ DebugShowState(maChildren[nIndex]);
+ }
+}
+
+
+
+
+AnimationNodeSharedPtr DebugGetTreeRoot (const BaseNodeSharedPtr& rpNode)
+{
+ BaseNodeSharedPtr pNode (rpNode);
+ if (pNode)
+ {
+ BaseNodeSharedPtr pParent (pNode->getParentNode());
+ while (pParent)
+ {
+ pNode = pParent;
+ pParent = pNode->getParentNode();
+ }
+ }
+ return pNode;
+}
+
+} // end of anonymous namespace
+
+
+
+
+void Debug_ShowNodeTree (const AnimationNodeSharedPtr& rpNode)
+{
+ DebugTraceScope aTraceScope ("NodeTree");
+
+ DebugShowState(DebugGetTreeRoot(::boost::dynamic_pointer_cast<BaseNode>(rpNode)));
+}
+
+#endif // OSL_DEBUG_LEVEL > 1
+
+
+
+
+//----- Tracing ---------------------------------------------------------------
+
+#if OSL_DEBUG_LEVEL > 1
+
+extern "C" {
+
+ namespace {
+
+ class TraceData
+ {
+ public:
+ TraceData (void)
+ : mnIndentation(0),
+ mpFile(fopen(TRACE_LOG_FILE_NAME, "w")),
+ maTime()
+ {
+ }
+
+ int mnIndentation;
+ FILE* mpFile;
+ ::canvas::tools::ElapsedTime maTime;
+ };
+ static TraceData gTraceData;
+
+ inline void SAL_CALL DebugTrace (
+ const int nIndentationOffset,
+ const sal_Char* sFormat,
+ va_list args)
+ {
+ if (gTraceData.mpFile != NULL)
+ {
+ // Write line head with current time and indentation.
+ // Adapt indentation.
+ if (nIndentationOffset < 0)
+ gTraceData.mnIndentation += nIndentationOffset;
+ fprintf(gTraceData.mpFile, "%10.8f ", gTraceData.maTime.getElapsedTime());
+ for (int nIndentation=0; nIndentation<gTraceData.mnIndentation; ++nIndentation)
+ fprintf(gTraceData.mpFile, " ");
+ if (nIndentationOffset > 0)
+ gTraceData.mnIndentation += nIndentationOffset;
+
+ // Write message.
+ vfprintf(gTraceData.mpFile, sFormat, args);
+ fprintf(gTraceData.mpFile, "\n");
+ fflush(gTraceData.mpFile);
+ }
+ }
+
+} // end of anonymous namespace
+
+
+} // end of extern "C"
+
+void SAL_CALL DebugTraceBegin (const sal_Char* sFormat, ...)
+{
+ va_list args;
+ va_start(args, sFormat);
+ DebugTrace(+1,sFormat, args);
+ va_end(args);
+}
+
+void SAL_CALL DebugTraceEnd (const sal_Char* sFormat, ...)
+{
+ va_list args;
+ va_start(args, sFormat);
+ DebugTrace(-1,sFormat, args);
+ va_end(args);
+}
+
+void SAL_CALL DebugTraceMessage (const sal_Char* sFormat, ...)
+{
+ va_list args;
+ va_start(args, sFormat);
+ DebugTrace(0,sFormat, args);
+ va_end(args);
+}
+
+
+
+DebugTraceScope::DebugTraceScope (const sal_Char* sFormat, ...)
+ : msMessage(new sal_Char[mnBufferSize])
+{
+ va_list args;
+ va_start(args, sFormat);
+
+ msMessage[mnBufferSize-1] = 0;
+ _vsnprintf(msMessage, mnBufferSize-1, sFormat, args);
+ TRACE_BEGIN("[ %s", msMessage);
+ va_end(args);
+}
+
+DebugTraceScope::~DebugTraceScope (void)
+{
+ TRACE_END("] %s", msMessage);
+ delete [] msMessage;
+}
+
+#endif // OSL_DEBUG_LEVEL > 1
+
+} }
diff --git a/slideshow/source/engine/effectrewinder.cxx b/slideshow/source/engine/effectrewinder.cxx
index 59db7ba50615..3f6ceb54bb8e 100644
--- a/slideshow/source/engine/effectrewinder.cxx
+++ b/slideshow/source/engine/effectrewinder.cxx
@@ -213,7 +213,8 @@ bool EffectRewinder::rewind (
::boost::bind(
&EffectRewinder::asynchronousRewindToPreviousSlide,
this,
- rPreviousSlideFunctor));
+ rPreviousSlideFunctor),
+ "EffectRewinder::asynchronousRewindToPreviousSlide");
}
else
{
@@ -225,7 +226,8 @@ bool EffectRewinder::rewind (
this,
nSkipCount,
true,
- rSlideRewindFunctor));
+ rSlideRewindFunctor),
+ "EffectRewinder::asynchronousRewind");
}
if (mpAsynchronousRewindEvent)
@@ -253,7 +255,8 @@ void EffectRewinder::skipAllMainSequenceEffects (void)
this,
nTotalMainSequenceEffectCount,
false,
- ::boost::function<void(void)>()));
+ ::boost::function<void(void)>()),
+ "EffectRewinder::asynchronousRewind");
mrEventQueue.addEvent(mpAsynchronousRewindEvent);
}
@@ -391,7 +394,8 @@ void EffectRewinder::asynchronousRewind (
this,
nEffectCount,
false,
- rSlideRewindFunctor));
+ rSlideRewindFunctor),
+ "EffectRewinder::asynchronousRewind");
mrEventQueue.addEvent(mpAsynchronousRewindEvent);
}
else
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index a75d9c017987..d62a7946d3c7 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -369,7 +369,8 @@ void SAL_CALL EventMultiplexerListener::mousePressed(
mpEventQueue->addEvent(
makeEvent( boost::bind( &EventMultiplexerImpl::mousePressed,
mpEventMultiplexer,
- e ) ) );
+ e ),
+ "EventMultiplexerImpl::mousePressed") );
}
void SAL_CALL EventMultiplexerListener::mouseReleased(
@@ -383,7 +384,8 @@ void SAL_CALL EventMultiplexerListener::mouseReleased(
mpEventQueue->addEvent(
makeEvent( boost::bind( &EventMultiplexerImpl::mouseReleased,
mpEventMultiplexer,
- e ) ) );
+ e ),
+ "EventMultiplexerImpl::mouseReleased") );
}
void SAL_CALL EventMultiplexerListener::mouseEntered(
@@ -410,7 +412,8 @@ void SAL_CALL EventMultiplexerListener::mouseDragged(
mpEventQueue->addEvent(
makeEvent( boost::bind( &EventMultiplexerImpl::mouseDragged,
mpEventMultiplexer,
- e )) );
+ e ),
+ "EventMultiplexerImpl::mouseDragged") );
}
void SAL_CALL EventMultiplexerListener::mouseMoved(
@@ -424,7 +427,8 @@ void SAL_CALL EventMultiplexerListener::mouseMoved(
mpEventQueue->addEvent(
makeEvent( boost::bind( &EventMultiplexerImpl::mouseMoved,
mpEventMultiplexer,
- e )) );
+ e ),
+ "EventMultiplexerImpl::mouseMoved") );
}
@@ -528,7 +532,8 @@ void EventMultiplexerImpl::scheduleTick()
EventSharedPtr pEvent(
makeDelay( boost::bind( &EventMultiplexerImpl::tick,
this ),
- mnTimeout ));
+ mnTimeout,
+ "EventMultiplexerImpl::tick with delay"));
// store weak reference to generated event, to notice when
// the event queue gets cleansed (we then have to
diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx
index cda03ff0c150..ee92e5df27d6 100644
--- a/slideshow/source/engine/eventqueue.cxx
+++ b/slideshow/source/engine/eventqueue.cxx
@@ -35,6 +35,7 @@
#include <canvas/debug.hxx>
#include <tools/diagnose_ex.h>
#include <canvas/verbosetrace.hxx>
+#include "debug.hxx"
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -104,6 +105,12 @@ namespace slideshow
{
::osl::MutexGuard aGuard( maMutex );
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ OSL_TRACE("adding event at %x [%s] with delay %f\r",
+ rEvent.get(),
+ OUStringToOString(rEvent->GetDescription(), RTL_TEXTENCODING_UTF8).getStr(),
+ rEvent->getActivationTime(0.0));
+#endif
ENSURE_OR_RETURN( rEvent,
"EventQueue::addEvent: event ptr NULL" );
@@ -125,6 +132,13 @@ namespace slideshow
{
::osl::MutexGuard aGuard( maMutex );
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ OSL_TRACE("adding event at %x [%s] for next round with delay %f\r",
+ rEvent.get(),
+ OUStringToOString(rEvent->GetDescription(), RTL_TEXTENCODING_UTF8).getStr(),
+ rEvent->getActivationTime(0.0));
+#endif
+
ENSURE_OR_RETURN( rEvent.get() != NULL,
"EventQueue::addEvent: event ptr NULL" );
maNextEvents.push_back(
@@ -137,6 +151,13 @@ namespace slideshow
{
::osl::MutexGuard aGuard( maMutex );
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ OSL_TRACE("adding event at %x [%s] for execution when queue is empty with delay %f\r",
+ rpEvent.get(),
+ OUStringToOString(rpEvent->GetDescription(), RTL_TEXTENCODING_UTF8).getStr(),
+ rpEvent->getActivationTime(0.0));
+#endif
+
ENSURE_OR_RETURN(
rpEvent.get() != NULL,
"EventQueue::addEvent: event ptr NULL");
@@ -217,6 +238,13 @@ namespace slideshow
event.pEvent.get(),
event.pEvent->getActivationTime(0.0) );
#endif
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ OSL_TRACE("firing event at %x [%s] with delay %f\r",
+ event.pEvent.get(),
+ OUStringToOString(event.pEvent->GetDescription(),
+ RTL_TEXTENCODING_UTF8).getStr(),
+ event.pEvent->getActivationTime(0.0));
+#endif
event.pEvent->fire();
}
diff --git a/slideshow/source/engine/makefile.mk b/slideshow/source/engine/makefile.mk
index 8316355c68a4..1165ba93467e 100644
--- a/slideshow/source/engine/makefile.mk
+++ b/slideshow/source/engine/makefile.mk
@@ -88,7 +88,8 @@ SLOFILES = $(SLO)$/activitiesqueue.obj \
$(SLO)$/unoviewcontainer.obj \
$(SLO)$/usereventqueue.obj \
$(SLO)$/waitsymbol.obj \
- $(SLO)$/wakeupevent.obj
+ $(SLO)$/wakeupevent.obj \
+ $(SLO)$/debug.obj
.IF "$(debug)"!="" || "$(DEBUG)"!=""
SLOFILES += $(SLO)$/sp_debug.obj
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index f8e9cf2f8e6c..c17dadc3ac5b 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -72,6 +72,9 @@ public:
WakeupEvent( boost::shared_ptr< ::canvas::tools::ElapsedTime > const& pTimeBase,
ActivitySharedPtr const& rActivity,
ActivitiesQueue & rActivityQueue ) :
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ Event(::rtl::OUString::createFromAscii("WakeupEvent")),
+#endif
maTimer(pTimeBase),
mnNextTime(0.0),
mpActivity(rActivity),
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index 5ace44acda65..1ab20f7f294e 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -504,7 +504,8 @@ struct SlideShowImpl::SeparateListenerImpl : public EventHandler,
// in recursion.
mrEventQueue.addEvent(
makeEvent( boost::bind( &SlideShowImpl::notifySlideAnimationsEnded,
- boost::ref(mrShow) )));
+ boost::ref(mrShow) ),
+ "SlideShowImpl::notifySlideAnimationsEnded"));
return true;
}
@@ -831,7 +832,8 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition(
&::slideshow::internal::Animation::prefetch,
pTransition,
AnimatableShapeSharedPtr(),
- ShapeAttributeLayerSharedPtr())));
+ ShapeAttributeLayerSharedPtr()),
+ "Animation::prefetch"));
return ActivitySharedPtr(
ActivitiesFactory::createSimpleActivity(
@@ -1096,7 +1098,8 @@ void SlideShowImpl::displaySlide(
boost::bind(
&SlideShowImpl::notifySlideTransitionEnded,
this,
- false ))));
+ false ),
+ "SlideShowImpl::notifySlideTransitionEnded")));
if (bSkipSlideTransition)
{
@@ -1121,7 +1124,8 @@ void SlideShowImpl::displaySlide(
boost::bind(
&SlideShowImpl::notifySlideTransitionEnded,
this,
- true )));
+ true ),
+ "SlideShowImpl::notifySlideTransitionEnded"));
}
}
} // finally
@@ -1159,7 +1163,8 @@ void SlideShowImpl::redisplayCurrentSlide (void)
boost::bind(
&SlideShowImpl::notifySlideTransitionEnded,
this,
- true )));
+ true ),
+ "SlideShowImpl::notifySlideTransitionEnded"));
maEventMultiplexer.notifySlideTransitionStarted();
maListenerContainer.forEach<presentation::XSlideShowListener>(
@@ -1777,6 +1782,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
maActivitiesQueue.processDequeued();
// commit frame to screen
+ maFrameSynchronization.Synchronize();
maScreenUpdater.commitUpdates();
}
// Time held until here
@@ -1979,7 +1985,8 @@ void SlideShowImpl::notifySlideAnimationsEnded()
// timeout involved.
aNotificationEvents.mpImmediateEvent =
makeEvent( boost::bind(
- &SlideShowImpl::notifySlideEnded, this, false ) );
+ &SlideShowImpl::notifySlideEnded, this, false ),
+ "SlideShowImpl::notifySlideEnded");
}
}
diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx
index 29ff302a7a77..dcca4a51b4d7 100644
--- a/slideshow/source/engine/slideview.cxx
+++ b/slideshow/source/engine/slideview.cxx
@@ -1085,7 +1085,8 @@ void SlideView::modified( const lang::EventObject& /*aEvent*/ )
makeEvent( boost::bind( (bool (EventMultiplexer::*)(
const uno::Reference<presentation::XSlideShowView>&))
&EventMultiplexer::notifyViewChanged,
- boost::ref(mrEventMultiplexer), mxView )));
+ boost::ref(mrEventMultiplexer), mxView ),
+ "EventMultiplexer::notifyViewChanged"));
}
// XPaintListener
@@ -1100,7 +1101,8 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ )
// this might not be the main thread!
mrEventQueue.addEvent(
makeEvent( boost::bind( &EventMultiplexer::notifyViewClobbered,
- boost::ref(mrEventMultiplexer), mxView ) ) );
+ boost::ref(mrEventMultiplexer), mxView ),
+ "EventMultiplexer::notifyViewClobbered") );
}
void SlideView::updateCanvas()
diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx
index 2e6a8dbeb79e..95ff86ab200b 100644
--- a/slideshow/source/engine/usereventqueue.cxx
+++ b/slideshow/source/engine/usereventqueue.cxx
@@ -330,7 +330,8 @@ private:
// next effect listeners:
if(fireAllEvents( maEvents, mrEventQueue ))
{
- makeEvent(::boost::bind(&EventQueue::forceEmpty, ::boost::ref(mrEventQueue)));
+ makeEvent(::boost::bind(&EventQueue::forceEmpty, ::boost::ref(mrEventQueue)),
+ "EventQueue::forceEmpty");
if (mbSkipTriggersNextEffect && bNotifyNextEffect)
{
// then simulate a next effect event: this skip effect
@@ -340,9 +341,9 @@ private:
// someone has registerered above for next effects
// (multiplexer prio=0) at the user event queue.
return mrEventQueue.addEventWhenQueueIsEmpty(
- makeEvent( boost::bind(
- &EventMultiplexer::notifyNextEffect,
- boost::ref(mrEventMultiplexer) ) ) );
+ makeEvent( boost::bind( &EventMultiplexer::notifyNextEffect,
+ boost::ref(mrEventMultiplexer) ),
+ "EventMultiplexer::notifyNextEffect") );
}
else
return true;
diff --git a/slideshow/source/engine/wakeupevent.cxx b/slideshow/source/engine/wakeupevent.cxx
index 0b30510f9cb3..31ea8956c17b 100644
--- a/slideshow/source/engine/wakeupevent.cxx
+++ b/slideshow/source/engine/wakeupevent.cxx
@@ -45,6 +45,9 @@ namespace slideshow
WakeupEvent::WakeupEvent(
boost::shared_ptr<canvas::tools::ElapsedTime> const & pTimeBase,
ActivitiesQueue& rActivityQueue ) :
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ Event(::rtl::OUString::createFromAscii("WakeupEvent")),
+#endif
maTimer(pTimeBase),
mnNextTime(0.0),
mpActivity(),
diff --git a/slideshow/source/inc/debug.hxx b/slideshow/source/inc/debug.hxx
new file mode 100644
index 000000000000..e9c501ca58aa
--- /dev/null
+++ b/slideshow/source/inc/debug.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: layer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_DEBUG_HXX
+#define INCLUDED_SLIDESHOW_DEBUG_HXX
+
+#include "animationnode.hxx"
+
+namespace slideshow { namespace internal {
+
+#if OSL_DEBUG_LEVEL > 1
+void Debug_ShowNodeTree (const AnimationNodeSharedPtr& rpNode);
+#endif
+
+// Uncomment the following line to define
+// SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS
+// in order to add descriptions to Event objects that help debugging event
+// base problems.
+#define SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS
+
+
+#if OSL_DEBUG_LEVEL > 1
+
+// Change this to a valid filename. The file is created anew with every
+// office start (and execution of at least one TRACE... command.)
+#define TRACE_LOG_FILE_NAME "d:\\tmp\\log.txt"
+
+class DebugTraceScope
+{
+public:
+ DebugTraceScope (const sal_Char* sFormat, ...);
+ ~DebugTraceScope (void);
+private:
+ static const sal_Int32 mnBufferSize = 512;
+ sal_Char* msMessage;
+};
+
+void SAL_CALL DebugTraceBegin (const sal_Char* sFormat, ...);
+void SAL_CALL DebugTraceEnd (const sal_Char* sFormat, ...);
+void SAL_CALL DebugTraceMessage (const sal_Char* sFormat, ...);
+
+#define TRACE_BEGIN DebugTraceBegin
+#define TRACE_END DebugTraceEnd
+#define TRACE DebugTraceMessage
+#define TRACE_SCOPE DebugTraceScope aTraceScope
+
+#else // OSL_DEBUG_LEVEL > 1
+
+#define TRACE_BEGIN 1 ? ((void)0) : DebugTraceBegin
+#define TRACE_END 1 ? ((void)0) : DebugTraceEnd
+#define TRACE 1 ? ((void)0) : DebugTraceMessage
+#define TRACE_SCOPE
+
+#endif // OSL_DEBUG_LEVEL > 1
+
+
+} }
+
+
+#endif
diff --git a/slideshow/source/inc/delayevent.hxx b/slideshow/source/inc/delayevent.hxx
index 29ef713f6550..458d5f9c0a0e 100644
--- a/slideshow/source/inc/delayevent.hxx
+++ b/slideshow/source/inc/delayevent.hxx
@@ -31,6 +31,7 @@
#define INCLUDED_SLIDESHOW_DELAYEVENT_HXX
#include "event.hxx"
+#include "debug.hxx"
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
#if defined(VERBOSE) && defined(DBG_UTIL)
@@ -48,16 +49,23 @@ public:
typedef ::boost::function0<void> FunctorT;
template <typename FuncT>
- Delay( FuncT const& func, double nTimeout )
- : mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {}
+ Delay( FuncT const& func,
+ double nTimeout
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ , const ::rtl::OUString& rsDescription
+ ) : Event(rsDescription),
+#else
+ ) :
+#endif
+ mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {}
-#if defined(VERBOSE) && defined(DBG_UTIL)
Delay( const boost::function0<void>& func,
- double nTimeout,
- char const* const ) :
+ double nTimeout
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ , const ::rtl::OUString& rsDescription
+ ) : Event(rsDescription),
#else
- Delay( const boost::function0<void>& func,
- double nTimeout ) :
+ ) :
#endif
mnTimeout(nTimeout),
maFunc(func),
@@ -76,7 +84,7 @@ private:
bool mbWasFired;
};
-#if OSL_DEBUG_LEVEL < 1
+#if OSL_DEBUG_LEVEL <= 1
/** Generate delay event
@@ -89,7 +97,7 @@ private:
@return generated delay event
*/
template <typename FuncT>
-inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout )
+inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout )
{
return EventSharedPtr( new Delay( func, nTimeout ) );
}
@@ -102,19 +110,29 @@ inline EventSharedPtr makeDelay( FuncT const& func, double nTimeout )
@return generated immediate event.
*/
template <typename FuncT>
-inline EventSharedPtr makeEvent( FuncT const& func )
+inline EventSharedPtr makeEvent_( FuncT const& func )
{
return EventSharedPtr( new Delay( func, 0.0 ) );
}
+
+// Strip away description.
+#define makeDelay(f, t, d) makeDelay_(f, t)
+#define makeEvent(f, d) makeEvent_(f)
+
#else // OSL_DEBUG_LEVEL > 1
class Delay_ : public Delay {
public:
template <typename FuncT>
Delay_( FuncT const& func, double nTimeout,
- char const* from_function, char const* from_file, int from_line )
- : Delay(func, nTimeout),
+ char const* from_function, char const* from_file, int from_line,
+ const ::rtl::OUString& rsDescription )
+ : Delay(func, nTimeout
+#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ , rsDescription
+#endif
+ ),
FROM_FUNCTION(from_function),
FROM_FILE(from_file), FROM_LINE(from_line) {}
@@ -126,16 +144,31 @@ public:
template <typename FuncT>
inline EventSharedPtr makeDelay_(
FuncT const& func, double nTimeout,
- char const* from_function, char const* from_file, int from_line )
+ char const* from_function, char const* from_file, int from_line,
+ const ::rtl::OUString& rsDescription )
{
return EventSharedPtr( new Delay_( func, nTimeout,
- from_function, from_file, from_line ) );
+ from_function, from_file, from_line, rsDescription ) );
}
-#define makeDelay(f, t) makeDelay_(f, t, \
-BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
-#define makeEvent(f) makeDelay_(f, 0.0, \
-BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
+#if defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+
+#define makeDelay(f, t, d) makeDelay_(f, t, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d)))
+#define makeEvent(f, d) makeDelay_(f, 0.0, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d)))
+
+#else
+
+#define makeDelay(f, t, d) makeDelay_(f, t, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
+#define makeEvent(f, d) makeDelay_(f, 0.0, \
+ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)
+
+#endif
+
#endif // OSL_DEBUG_LEVEL < 1
diff --git a/slideshow/source/inc/event.hxx b/slideshow/source/inc/event.hxx
index 80e825cc8049..c609c3e814a5 100644
--- a/slideshow/source/inc/event.hxx
+++ b/slideshow/source/inc/event.hxx
@@ -31,7 +31,8 @@
#define INCLUDED_SLIDESHOW_EVENT_HXX
#include "disposable.hxx"
-
+#include "debug.hxx"
+#include <rtl/ustring.hxx>
#include <boost/shared_ptr.hpp>
#include <vector>
@@ -43,6 +44,10 @@ namespace internal {
class Event : public Disposable
{
public:
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ Event (const ::rtl::OUString& rsDescription) : msDescription(rsDescription) {};
+#endif
+
/** Execute the event.
@return true, if event was successfully executed.
@@ -72,6 +77,13 @@ public:
event is to be fired.
*/
virtual double getActivationTime( double nCurrentTime ) const = 0;
+
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ ::rtl::OUString GetDescription (void) const { return msDescription; }
+
+private:
+ const ::rtl::OUString msDescription;
+#endif
};
typedef ::boost::shared_ptr< Event > EventSharedPtr;
diff --git a/slideshow/source/inc/interruptabledelayevent.hxx b/slideshow/source/inc/interruptabledelayevent.hxx
index 96795dfa51d4..d983d3ba6cff 100644
--- a/slideshow/source/inc/interruptabledelayevent.hxx
+++ b/slideshow/source/inc/interruptabledelayevent.hxx
@@ -49,6 +49,9 @@ namespace slideshow
public:
DelayFacade( const EventSharedPtr& rEvent,
double nTimeout ) :
+#if OSL_DEBUG_LEVEL > 1 && defined (SLIDESHOW_ADD_DESCRIPTIONS_TO_EVENTS)
+ Event(::rtl::OUString::createFromAscii("DelayFacade")),
+#endif
mpEvent( rEvent ),
mnTimeout( nTimeout )
{
@@ -138,7 +141,7 @@ namespace slideshow
{
InterruptableEventPair aRes;
- aRes.mpImmediateEvent = makeEvent( rFunctor );
+ aRes.mpImmediateEvent = makeEvent( rFunctor, "makeInterruptableDelay");
aRes.mpTimeoutEvent.reset( new DelayFacade( aRes.mpImmediateEvent,
nTimeout ) );