[Libreoffice-commits] core.git: 2 commits - sd/source slideshow/Library_slideshow.mk slideshow/source
Siqi LIU
me at siqi.fr
Sun Aug 4 05:18:34 PDT 2013
sd/source/ui/remotecontrol/Receiver.cxx | 88 ++++++++++++++++++++++++++++--
slideshow/Library_slideshow.mk | 1
slideshow/source/engine/pointersymbol.cxx | 37 +++++++++---
slideshow/source/engine/pointersymbol.hxx | 11 ++-
slideshow/source/engine/slideshowimpl.cxx | 36 ++++++++++++
slideshow/source/engine/waitsymbol.cxx | 2
6 files changed, 158 insertions(+), 17 deletions(-)
New commits:
commit 731f3d986eb13468681ae9a7ef491897a078f675
Author: Siqi LIU <me at siqi.fr>
Date: Sun Aug 4 14:17:55 2013 +0200
request immdiateupdate for pointerSymbol, but bad performance
Change-Id: I943019f6f6c6aaddeb40bf7f56bd0ffefff8a6b3
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx
index f7a3f8c..593ff99 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -132,11 +132,32 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
}
else if (aCommand[0].equals( "pointer_started" ))
{
- std::cerr << "pointer_started" << std::endl;
+ // std::cerr << "pointer_started" << std::endl;
+ float x = aCommand[1].toFloat();
+ float y = aCommand[2].toFloat();
SolarMutexGuard aSolarGuard;
+
+ const ::com::sun::star::geometry::RealPoint2D pos(x,y);
+ // std::cerr << "Pointer at ("<<pos.X<<","<<pos.Y<<")" << std::endl;
+
+ if (xSlideShow.is()) try
+ {
+ // std::cerr << "pointer_coordination in the is" << std::endl;
+ xSlideShow->setProperty(
+ beans::PropertyValue( "PointerPosition" ,
+ -1,
+ makeAny( pos ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerPosition(), "
+ "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
+ }
+
if (xSlideShow.is()) try
{
- std::cerr << "pointer_started in the is" << std::endl;
+ // std::cerr << "pointer_started in the is" << std::endl;
xSlideShow->setProperty(
beans::PropertyValue( "PointerVisible" ,
-1,
@@ -148,15 +169,16 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerMode(), "
"exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
}
+
SAL_INFO( "sdremote", "Pointer started, we display the pointer on screen" );
}
else if (aCommand[0].equals( "pointer_dismissed" ))
{
- std::cerr << "pointer_dismissed" << std::endl;
+ // std::cerr << "pointer_dismissed" << std::endl;
SolarMutexGuard aSolarGuard;
if (xSlideShow.is()) try
{
- std::cerr << "pointer_dismissed in the is" << std::endl;
+ // std::cerr << "pointer_dismissed in the is" << std::endl;
xSlideShow->setProperty(
beans::PropertyValue( "PointerVisible" ,
-1,
@@ -178,12 +200,12 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
SAL_INFO( "sdremote", "Pointer at ("<<x<<","<<y<<")" );
const ::com::sun::star::geometry::RealPoint2D pos(x,y);
- std::cerr << "Pointer at ("<<pos.X<<","<<pos.Y<<")" << std::endl;
+ // std::cerr << "Pointer at ("<<pos.X<<","<<pos.Y<<")" << std::endl;
SolarMutexGuard aSolarGuard;
if (xSlideShow.is()) try
{
- std::cerr << "pointer_coordination in the is" << std::endl;
+ // std::cerr << "pointer_coordination in the is" << std::endl;
xSlideShow->setProperty(
beans::PropertyValue( "PointerPosition" ,
-1,
diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx
index 8629ea7..d0e7fce 100644
--- a/slideshow/source/engine/pointersymbol.cxx
+++ b/slideshow/source/engine/pointersymbol.cxx
@@ -119,11 +119,15 @@ basegfx::B2DPoint PointerSymbol::calcSpritePos(
const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(),
uno::UNO_QUERY_THROW );
const geometry::IntegerSize2D realSize( xBitmap->getSize() );
- return basegfx::B2DPoint(
+
+ basegfx::B2DPoint newPos(
// pos.X pos.Y are given in 0..1, beginning from the upper left corner of the currentSlide.
- std::min<sal_Int32>( realSize.Width * pos.X, LEFT_BORDER_SPACE ),
- std::max<sal_Int32>( 0, realSize.Height * (1-pos.Y) - mxBitmap->getSize().Height
- - LOWER_BORDER_SPACE ) );
+ realSize.Width * pos.X,
+ realSize.Height * pos.Y);
+
+ // std::cerr << "calcSpritePos : (" << newPos.getX() << ","<<newPos.getY() << ")" << std::endl;
+
+ return newPos;
}
void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView )
@@ -215,9 +219,11 @@ void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D p
ViewsVecT::const_iterator const aEnd ( maViews.end() );
while( aIter != aEnd )
{
- if( aIter->second )
+ if( aIter->second ) {
aIter->second->movePixel(
calcSpritePos( aIter->first, pos ));
+ mrScreenUpdater.requestImmediateUpdate();
+ }
++aIter;
}
}
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index db207a8..ded62b4 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -1809,7 +1809,7 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
if (! (rProperty.Value >>= pos))
return false;
- std::cerr<<"Received pos at :(" << pos.X << ","<<pos.Y << ")" << std::endl;
+ // std::cerr<<"Received pos at :(" << pos.X << ","<<pos.Y << ")" << std::endl;
mpPointerSymbol->viewsChanged(pos);
}
commit dffc87dd13daf9a2f2f629cd50558995aadc4d19
Author: Siqi LIU <me at siqi.fr>
Date: Sun Aug 4 13:10:55 2013 +0200
pointer display on the screen
Change-Id: I43c91bdf6c364da282d354e5a07f871a9247f2d6
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx
index 5ea11e40..f7a3f8c 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -16,14 +16,23 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/anytostring.hxx>
+#include "cppuhelper/exc_hlp.hxx"
#include <osl/file.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/presentation/SlideShow.hpp>
using namespace sd;
using namespace ::com::sun::star;
using namespace ::osl;
using namespace std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::presentation;
+using namespace ::com::sun::star::beans;
Receiver::Receiver( Transmitter *aTransmitter )
{
@@ -61,6 +70,7 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
{
uno::Reference<presentation::XSlideShowController> xSlideShowController;
uno::Reference<presentation::XPresentation2> xPresentation;
+ uno::Reference<presentation::XSlideShow> xSlideShow;
try {
uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW );
@@ -70,6 +80,8 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
// Throws an exception if now slideshow running
xSlideShowController = uno::Reference<presentation::XSlideShowController>(
xPresentation->getController(), uno::UNO_QUERY_THROW );
+ xSlideShow = uno::Reference<presentation::XSlideShow>(
+ xSlideShowController->getSlideShow(), uno::UNO_QUERY_THROW );
}
catch (uno::RuntimeException &)
{
@@ -120,12 +132,43 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
}
else if (aCommand[0].equals( "pointer_started" ))
{
- // xSlideShowController->setPointerMode(true);
+ std::cerr << "pointer_started" << std::endl;
+ SolarMutexGuard aSolarGuard;
+ if (xSlideShow.is()) try
+ {
+ std::cerr << "pointer_started in the is" << std::endl;
+ xSlideShow->setProperty(
+ beans::PropertyValue( "PointerVisible" ,
+ -1,
+ makeAny( true ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerMode(), "
+ "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
+ }
SAL_INFO( "sdremote", "Pointer started, we display the pointer on screen" );
}
else if (aCommand[0].equals( "pointer_dismissed" ))
{
- // xSlideShowController->setPointerMode(false);
+ std::cerr << "pointer_dismissed" << std::endl;
+ SolarMutexGuard aSolarGuard;
+ if (xSlideShow.is()) try
+ {
+ std::cerr << "pointer_dismissed in the is" << std::endl;
+ xSlideShow->setProperty(
+ beans::PropertyValue( "PointerVisible" ,
+ -1,
+ makeAny( false ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerMode(), "
+ "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
+ }
+
SAL_INFO( "sdremote", "Pointer dismissed, we hide the pointer on screen" );
}
else if (aCommand[0].equals( "pointer_coordination" ))
@@ -135,8 +178,23 @@ void Receiver::executeCommand( const std::vector<OString> &aCommand )
SAL_INFO( "sdremote", "Pointer at ("<<x<<","<<y<<")" );
const ::com::sun::star::geometry::RealPoint2D pos(x,y);
- // Same problem here...
- // xSlideShowController->setPointerPosition(pos);
+ std::cerr << "Pointer at ("<<pos.X<<","<<pos.Y<<")" << std::endl;
+
+ SolarMutexGuard aSolarGuard;
+ if (xSlideShow.is()) try
+ {
+ std::cerr << "pointer_coordination in the is" << std::endl;
+ xSlideShow->setProperty(
+ beans::PropertyValue( "PointerPosition" ,
+ -1,
+ makeAny( pos ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ }
+ catch ( Exception& )
+ {
+ SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerPosition(), "
+ "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
+ }
}
else if ( aCommand[0].equals( "presentation_resume" ) )
{
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
index 3e79255..e8485ef 100644
--- a/slideshow/Library_slideshow.mk
+++ b/slideshow/Library_slideshow.mk
@@ -142,6 +142,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\
slideshow/source/engine/unoviewcontainer \
slideshow/source/engine/usereventqueue \
slideshow/source/engine/waitsymbol \
+ slideshow/source/engine/pointersymbol \
slideshow/source/engine/wakeupevent \
))
diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx
index 48ad0e5..8629ea7 100644
--- a/slideshow/source/engine/pointersymbol.cxx
+++ b/slideshow/source/engine/pointersymbol.cxx
@@ -28,6 +28,7 @@
#include <basegfx/vector/b2dvector.hxx>
#include <com/sun/star/rendering/XCanvas.hpp>
+#include "com/sun/star/uno/Reference.hxx"
#include "pointersymbol.hxx"
#include "eventmultiplexer.hxx"
@@ -51,8 +52,8 @@ PointerSymbolSharedPtr PointerSymbol::create( const uno::Reference<rendering::XB
{
PointerSymbolSharedPtr pRet(
new PointerSymbol( xBitmap,
- rScreenUpdater,
- rViewContainer ));
+ rScreenUpdater,
+ rViewContainer ));
rEventMultiplexer.addViewHandler( pRet );
@@ -100,8 +101,20 @@ void PointerSymbol::setVisible( const bool bVisible )
}
}
+basegfx::B2DPoint PointerSymbol::calcSpritePos( UnoViewSharedPtr const & rView ) const
+{
+ const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(),
+ uno::UNO_QUERY_THROW );
+ const geometry::IntegerSize2D realSize( xBitmap->getSize() );
+ return basegfx::B2DPoint(
+ // pos.X pos.Y are given in 0..1, beginning from the upper left corner of the currentSlide.
+ std::min<sal_Int32>( 0, LEFT_BORDER_SPACE ),
+ std::max<sal_Int32>( 0, realSize.Height * 1 - mxBitmap->getSize().Height
+ - LOWER_BORDER_SPACE ) );
+}
+
basegfx::B2DPoint PointerSymbol::calcSpritePos(
- UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D& pos) const
+ UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D pos) const
{
const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(),
uno::UNO_QUERY_THROW );
@@ -195,7 +208,7 @@ void PointerSymbol::viewsChanged()
}
}
-void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D& pos)
+void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos)
{
// reposition sprites on all views
ViewsVecT::const_iterator aIter( maViews.begin() );
@@ -210,6 +223,6 @@ void PointerSymbol::viewsChanged(const ::com::sun::star::geometry::RealPoint2D&
}
} // namespace internal
-} // namespace presentation
+} // namespace slideshow
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/pointersymbol.hxx b/slideshow/source/engine/pointersymbol.hxx
index 9dc2818..77309e7 100644
--- a/slideshow/source/engine/pointersymbol.hxx
+++ b/slideshow/source/engine/pointersymbol.hxx
@@ -14,6 +14,8 @@
#include <com/sun/star/rendering/XBitmap.hpp>
#include <cppcanvas/customsprite.hxx>
+#include "com/sun/star/uno/Reference.hxx"
+
#include "vieweventhandler.hxx"
#include "screenupdater.hxx"
#include "eventmultiplexer.hxx"
@@ -24,6 +26,8 @@
#include <boost/utility.hpp> // for noncopyable
#include <vector>
+using namespace com::sun::star;
+
namespace slideshow {
namespace internal {
@@ -49,7 +53,8 @@ public:
void hide() { setVisible(false); }
/** Use this method to update the pointer's position
*/
- virtual void viewsChanged(const ::com::sun::star::geometry::RealPoint2D& pos);
+ void setVisible( const bool bVisible );
+ virtual void viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos);
private:
PointerSymbol( const ::com::sun::star::uno::Reference<
@@ -63,9 +68,9 @@ private:
virtual void viewChanged( const UnoViewSharedPtr& rView );
virtual void viewsChanged();
- void setVisible( const bool bVisible );
- basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D& pos = ::com::sun::star::geometry::RealPoint2D(0, 0) ) const;
+ ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView, const ::com::sun::star::geometry::RealPoint2D pos ) const;
+ ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView ) const;
template <typename func_type>
void for_each_sprite( func_type const & func ) const
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index f9e8ed8..db207a8 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -95,6 +95,7 @@
#include "waitsymbol.hxx"
#include "effectrewinder.hxx"
#include "framerate.hxx"
+#include "pointersymbol.hxx"
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
@@ -459,6 +460,8 @@ private:
boost::shared_ptr<RehearseTimingsActivity> mpRehearseTimingsActivity;
boost::shared_ptr<WaitSymbol> mpWaitSymbol;
+ boost::shared_ptr<PointerSymbol> mpPointerSymbol;
+
/// the current slide transition sound object:
SoundPlayerSharedPtr mpCurrentSlideTransitionSound;
@@ -579,6 +582,7 @@ SlideShowImpl::SlideShowImpl(
mpListener(),
mpRehearseTimingsActivity(),
mpWaitSymbol(),
+ mpPointerSymbol(),
mpCurrentSlideTransitionSound(),
mxComponentContext( xContext ),
mxOptionalTransitionFactory(),
@@ -653,6 +657,7 @@ void SlideShowImpl::disposing()
}
mpWaitSymbol.reset();
+ mpPointerSymbol.reset();
if( mpRehearseTimingsActivity )
{
@@ -1777,6 +1782,37 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
return true;
}
+ if ( rProperty.Name == "PointerSymbolBitmap" )
+ {
+ uno::Reference<rendering::XBitmap> xBitmap;
+ if (! (rProperty.Value >>= xBitmap))
+ return false;
+
+ mpPointerSymbol = PointerSymbol::create( xBitmap,
+ maScreenUpdater,
+ maEventMultiplexer,
+ maViewContainer );
+
+ return true;
+ }
+
+ if ( rProperty.Name == "PointerVisible" )
+ {
+ bool visible;
+ rProperty.Value >>= visible;
+ mpPointerSymbol->setVisible(visible);
+ }
+
+ if ( rProperty.Name == "PointerPosition")
+ {
+ ::com::sun::star::geometry::RealPoint2D pos;
+ if (! (rProperty.Value >>= pos))
+ return false;
+
+ std::cerr<<"Received pos at :(" << pos.X << ","<<pos.Y << ")" << std::endl;
+ mpPointerSymbol->viewsChanged(pos);
+ }
+
if (rProperty.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("NoSlideTransitions") ))
{
diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx
index 01ce9db..6c56ac7 100644
--- a/slideshow/source/engine/waitsymbol.cxx
+++ b/slideshow/source/engine/waitsymbol.cxx
@@ -195,6 +195,6 @@ void WaitSymbol::viewsChanged()
}
} // namespace internal
-} // namespace presentation
+} // namespace slideshow
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list