diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 12:41:42 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 12:41:42 +0000 |
commit | d542850b6cc5b783cd984c81ae4193723d835173 (patch) | |
tree | 4ac39f98290c557734735da9f9b722ece90c62ca /slideshow/source/engine/eventmultiplexer.cxx | |
parent | 0e4aa9bc510d47272ed0eab8fdf5002fdb3a90b0 (diff) |
INTEGRATION: CWS presfixes01 (1.2.6); FILE MERGED
2005/03/03 14:17:25 thb 1.2.6.3: #i43927# Slightly changed the way updateScreen() is handled: since just lately, there were several places introduced which had to call View::updateScreen() manually (RehearsetimtinActivity, WaitSymbol, etc.). Together with the recent change regarding #i42499#, this resulted in the unfortunate situation that LayerManager::update() was not called before updateScreen(). Now, the view update is centrally handled by the EventMultiplexer (which also knows the LayerManager), I've therefore changed all direct calls to View::updateScreen() to EventMultiplexer::updateScreenContent()
2005/02/16 11:17:42 fs 1.2.6.2: #i42558# drafts.com.sun.star.drawing/rendering/geometry moved to com.sun.star.*
2005/02/15 12:45:08 thb 1.2.6.1: #i42440# Moved sprite-growing code to slideshow, we already handle the case there for update areas of antialiased shapes; Improved/reformatted documentation; (Hopefully) fixed the problem that sometimes, the first effect preview did not work. The reason there was presumably the clearing of the EventQueue before every slide, and the fact that EventMultiplexer only generated new tick events when it thought ticking was switched off.
Diffstat (limited to 'slideshow/source/engine/eventmultiplexer.cxx')
-rw-r--r-- | slideshow/source/engine/eventmultiplexer.cxx | 76 |
1 files changed, 66 insertions, 10 deletions
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index ede34ce52145..6710bead9ae1 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -2,9 +2,9 @@ * * $RCSfile: eventmultiplexer.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: rt $ $Date: 2004-11-26 18:52:49 $ + * last change: $Author: vg $ $Date: 2005-03-10 13:41:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,7 +90,7 @@ #include <algorithm> -using namespace ::drafts::com::sun::star; +using namespace ::com::sun::star; using namespace ::com::sun::star; /* Implementation of EventMultiplexer class */ @@ -171,10 +171,10 @@ namespace presentation if( !bEmptyContainer ) { // precond: rHandlerContainer.size() is now at least 2, - // which is ensures by the rHandlerContainer.empty() + // which is ensured by the rHandlerContainer.empty() // check above. - // element was insert, but now we have to keep the + // element was inserted, but now we have to keep the // entries sorted ::std::inplace_merge( rHandlerContainer.begin(), rHandlerContainer.end()-1, @@ -195,19 +195,26 @@ namespace presentation if( !maNextEffectHandlers.empty() ) { - // still handlers left, schedule next timeout event + // still handlers left, schedule next timeout + // event. Will also set mbIsTickEventOn back to true scheduleTick(); } } void EventMultiplexer::Listener::scheduleTick() { + EventSharedPtr pEvent( makeDelay( ::boost::bind( &EventMultiplexer::Listener::tick, + ::boost::ref( *this ) ), + mnTimeout ) ); + + // store weak reference to generated event, to notice when + // the event queue gets cleansed (we then have to + // regenerate the tick event!) + mpTickEvent = pEvent; + // enabled auto mode: simply schedule a timeout event, // which will eventually call our tick() method - mrEventQueue.addEvent( - makeDelay( ::boost::bind( &EventMultiplexer::Listener::tick, - ::boost::ref( *this ) ), - mnTimeout ) ); + mrEventQueue.addEvent( pEvent ); } void EventMultiplexer::Listener::handleTicks() @@ -215,6 +222,11 @@ namespace presentation if( !mbIsAutoMode ) return; // nothing to do, don't need no ticks + EventSharedPtr pTickEvent( mpTickEvent.lock() ); + if( pTickEvent ) + return; // nothing to do, there's already a tick + // pending + // schedule initial tick (which reschedules itself // after that, all by itself) scheduleTick(); @@ -274,6 +286,16 @@ namespace presentation mpListener->setVolatileMouseCursor( nCursor ); } + void EventMultiplexer::setLayerManager( const LayerManagerSharedPtr& rMgr ) + { + mpListener->setLayerManager( rMgr ); + } + + void EventMultiplexer::updateScreenContent( bool bForceUpdate ) + { + mpListener->updateScreenContent( bForceUpdate ); + } + void EventMultiplexer::setAutomaticMode( bool bIsAuto ) { mpListener->setAutomaticMode( bIsAuto ); @@ -471,6 +493,7 @@ namespace presentation maMouseDoubleClickHandlers(), maMouseMoveHandlers(), mnTimeout( 0.0 ), + mpTickEvent(), mnMouseCursor( awt::SystemPointer::ARROW ), mnVolatileMouseCursor( -1 ), mnLastVolatileMouseCursor( mnMouseCursor ), @@ -577,6 +600,7 @@ namespace presentation maMouseClickHandlers.clear(); maMouseDoubleClickHandlers.clear(); maMouseMoveHandlers.clear(); + mpLayerManager.reset(); } void EventMultiplexer::Listener::setMouseCursor( sal_Int16 nCursor ) @@ -601,6 +625,35 @@ namespace presentation mnVolatileMouseCursor = nCursor; } + void EventMultiplexer::Listener::setLayerManager( const LayerManagerSharedPtr& rMgr ) + { + mpLayerManager = rMgr; + } + + void EventMultiplexer::Listener::updateScreenContent( bool bForceUpdate ) + { + // perform screen update (either if we're forced to do it, + // or if the layer manager signals that it needs one). + if( bForceUpdate || + (mpLayerManager.get() && + mpLayerManager->isUpdatePending() ) ) + { + // call update() on the registered + // LayerManager. This will only update the + // backbuffer, not flush anything to screen + if( mpLayerManager.get() ) + mpLayerManager->update(); + + // call updateScreen() on all registered views (which + // will copy the backbuffers to the front). Do NOT use + // LayerManager::updateScreen(), we might need screen + // updates independent from a valid LayerManager! + ::std::for_each( maViews.begin(), + maViews.end(), + ::boost::mem_fn( &View::updateScreen ) ); + } + } + void EventMultiplexer::Listener::setAutomaticMode( bool bIsAuto ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -639,6 +692,9 @@ namespace presentation { addHandler( maNextEffectHandlers, rHandler ); + + // Enable tick events, if not done already + handleTicks(); } void EventMultiplexer::Listener::removeNextEffectHandler( const EventHandlerSharedPtr& rHandler ) |