android/experimental/DocumentLoader/Makefile | 4 - android/experimental/LibreOffice4Android/Makefile | 4 - android/experimental/desktop/Makefile | 4 - android/experimental/desktop/native-code.cxx | 2 android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java | 26 +----- android/sdremote/Makefile | 4 - vcl/inc/salwtype.hxx | 4 - vcl/source/app/svapp.cxx | 39 +++++++++- vcl/source/window/winproc.cxx | 31 +++++++ 9 files changed, 91 insertions(+), 27 deletions(-)
New commits: commit 06b58a702f7751bbe997f33603af18767b9773f0 Author: Tor Lillqvist <t...@iki.fi> Date: Sun Mar 3 01:12:10 2013 +0200 Do "real" zooming also while the scale gesture is in progress Would work nicely if only it wasn't so compute intensive. Or is it the (temporary hack) constant redrawing that is killing performance? Change-Id: I0b152411a413a818fba7a0f41a3462e423c6ab54 diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java index 786bcad..6e5627b 100644 --- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java +++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java @@ -171,16 +171,12 @@ public class Desktop super(Desktop.this); setFocusableInTouchMode(true); - // While a scale gesture (two-finger pinch / spread to - // zoom out / in) is in progress we just scale the bitmap - // view (UI elements too, which of course is a bit silly). - // When the scale gesture has finished, we ask LO to zoom - // the document (and reset the view scale, it will be - // replaced by one where the document (not UI elements) is - // displayed at a different zoom level). + // Is this sane? It is rather slow to ask LO to zoom + // continuously while the scaling gesture is in progress. - // Is that sane? Would it be too slow to ask LO to zoom - // continuously while the gesture is in progress? + // What we used to do was while a scale gesture was in + // progress to just scale the bitmap view (UI elements + // too, which of course was a bit silly). gestureDetector = new ScaleGestureDetector(Desktop.this, @@ -188,8 +184,6 @@ public class Desktop @Override public boolean onScaleBegin(ScaleGestureDetector detector) { Log.i(TAG, "onScaleBegin: pivot=(" + detector.getFocusX() + ", " + detector.getFocusY() + ")"); - setPivotX(detector.getFocusX()); - setPivotY(detector.getFocusY()); scalingInProgress = true; return true; } @@ -201,8 +195,7 @@ public class Desktop return false; scale *= s; Log.i(TAG, "onScale: " + s + " => " + scale); - setScaleX(scale); - setScaleY(scale); + Desktop.zoom(scale, (int) detector.getFocusX(), (int) detector.getFocusY()); return true; } @@ -211,8 +204,6 @@ public class Desktop Log.i(TAG, "onScaleEnd: " + scale); Desktop.zoom(scale, (int) detector.getFocusX(), (int) detector.getFocusY()); scale = 1; - setScaleX(scale); - setScaleY(scale); scalingInProgress = false; } }); @@ -220,8 +211,6 @@ public class Desktop @Override protected void onDraw(Canvas canvas) { -// canvas.drawColor(0xFF1ABCDD); - if (mBitmap == null) { Log.i(TAG, "calling Bitmap.createBitmap(" + getWidth() + ", " + getHeight() + ", Bitmap.Config.ARGB_8888)"); mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); @@ -232,8 +221,7 @@ public class Desktop renderedOnce = true; // re-call ourselves a bit later ... - if (!scalingInProgress) - invalidate(); + invalidate(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) commit 5930a963aeb8947f9d23326c98da7cbc4cd35a08 Author: Tor Lillqvist <t...@iki.fi> Date: Sun Mar 3 01:06:17 2013 +0200 Implement the VCLEVENT_WINDOW_ZOOM by turning it into a wheel mouse event For now just use an ad-hoc factor that works close enough on my device to turn the zoom scale factor into a value for the somewhat undocumented mnDelta field in SalWheelMouseEvent. Ideally we should of course calculate it so that the end result actually is the document content view being scaled by the requested scale factor. Change-Id: I21215d38c8ce4a35591d92d305ad1aeeca379f0a diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 98651c2..589baa6 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -98,7 +98,9 @@ class FontSelectPattern; #define SALEVENT_SURROUNDINGTEXTREQUEST ((sal_uInt16)43) #define SALEVENT_SURROUNDINGTEXTSELECTIONCHANGE ((sal_uInt16)44) #define SALEVENT_STARTRECONVERSION ((sal_uInt16)45) -#define SALEVENT_COUNT ((sal_uInt16)45) +#define SALEVENT_EXTERNALZOOM ((sal_uInt16)46) +#define SALEVENT_EXTERNALSCROLL ((sal_uInt16)47) +#define SALEVENT_COUNT ((sal_uInt16)47) // MOUSELEAVE must send, when the pointer leave the client area and // the mouse is not captured diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index dcd88ef..fe34011 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -177,12 +177,17 @@ struct ImplPostEventData sal_uLong mnEventId; KeyEvent maKeyEvent; MouseEvent maMouseEvent; - + ZoomEvent maZoomEvent; + ScrollEvent maScrollEvent; ImplPostEventData( sal_uLong nEvent, const Window* pWin, const KeyEvent& rKeyEvent ) : mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maKeyEvent( rKeyEvent ) {} ImplPostEventData( sal_uLong nEvent, const Window* pWin, const MouseEvent& rMouseEvent ) : mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maMouseEvent( rMouseEvent ) {} + ImplPostEventData( sal_uLong nEvent, const Window* pWin, const ZoomEvent& rZoomEvent ) : + mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maZoomEvent( rZoomEvent ) {} + ImplPostEventData( sal_uLong nEvent, const Window* pWin, const ScrollEvent& rScrollEvent ) : + mnEvent( nEvent ), mpWin( pWin ), mnEventId( 0 ), maScrollEvent( rScrollEvent ) {} ~ImplPostEventData() {} }; @@ -894,8 +899,26 @@ sal_uLong Application::PostZoomEvent( sal_uLong nEvent, Window *pWin, ZoomEvent* if( pWin && pZoomEvent ) { - // Implement... - (void) nEvent; + Point aTransformedPos( pZoomEvent->GetCenter() ); + + aTransformedPos.X() += pWin->mnOutOffX; + aTransformedPos.Y() += pWin->mnOutOffY; + + const ZoomEvent aTransformedEvent( aTransformedPos, pZoomEvent->GetScale() ); + + ImplPostEventData* pPostEventData = new ImplPostEventData( nEvent, pWin, aTransformedEvent ); + + PostUserEvent( nEventId, + STATIC_LINK( NULL, Application, PostEventHandler ), + pPostEventData ); + + if( nEventId ) + { + pPostEventData->mnEventId = nEventId; + aPostedEventList.push_back( ImplPostEventPair( pWin, pPostEventData ) ); + } + else + delete pPostEventData; } return nEventId; @@ -938,6 +961,16 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData ) pEventData = &pData->maKeyEvent; break; + case VCLEVENT_WINDOW_ZOOM: + nEvent = SALEVENT_EXTERNALZOOM; + pEventData = &pData->maZoomEvent; + break; + + case VCLEVENT_WINDOW_SCROLL: + nEvent = SALEVENT_EXTERNALSCROLL; + pEventData = &pData->maScrollEvent; + break; + default: nEvent = 0; pEventData = NULL; diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index e04597f..0ec4f83 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2592,6 +2592,37 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, case SALEVENT_STARTRECONVERSION: ImplHandleStartReconversion( pWindow ); break; + case SALEVENT_EXTERNALZOOM: + { + // Manually tuned to get a pleasing effect at least on my + // device... Would be better to actually achieve the + // requested scale factor of course. + const int ZOOM_FACTOR = 300; + + ZoomEvent* pZoomEvent = (ZoomEvent*) pEvent; + SalWheelMouseEvent aSalWheelMouseEvent; + + aSalWheelMouseEvent.mnTime = Time::GetSystemTicks(); + aSalWheelMouseEvent.mnX = pZoomEvent->GetCenter().getX(); + aSalWheelMouseEvent.mnY = pZoomEvent->GetCenter().getY(); + + if ( pZoomEvent->GetScale() < 1 ) { + aSalWheelMouseEvent.mnDelta = - (long) ((1 - pZoomEvent->GetScale()) * ZOOM_FACTOR); + aSalWheelMouseEvent.mnNotchDelta = -1; + } else { + aSalWheelMouseEvent.mnDelta = (long) ((pZoomEvent->GetScale() - 1) * ZOOM_FACTOR); + aSalWheelMouseEvent.mnNotchDelta = 1; + } + + aSalWheelMouseEvent.mnScrollLines = 1; // ??? + aSalWheelMouseEvent.mnCode = KEY_MOD1; + aSalWheelMouseEvent.mbDeltaIsPixel = 0; // ??? + + nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent ); + } + break; + case SALEVENT_EXTERNALSCROLL: + break; #ifdef DBG_UTIL default: OSL_TRACE( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent ); commit 92c033df8f4e279196397a06bb5fd4da80f51111 Author: Tor Lillqvist <t...@iki.fi> Date: Sun Mar 3 00:50:58 2013 +0200 libucppkg1 is needed, for auto-save I think Change-Id: Ie4ec4e2518c9e0621b75afe21f22862e3e8bf726 diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx index 7c1d102..f93c8ad 100644 --- a/android/experimental/desktop/native-code.cxx +++ b/android/experimental/desktop/native-code.cxx @@ -46,6 +46,7 @@ extern "C" extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); + extern void * ucppkg1_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey ); @@ -98,6 +99,7 @@ lo_get_libmap(void) { "libswlo.a", sw_component_getFactory }, { "libt602filterlo.a", t602filter_component_getFactory }, { "libtextfdlo.a", textfd_component_getFactory }, + { "libucppkg1.a", ucppkg1_component_getFactory }, { "libunordflo.a", unordf_component_getFactory }, { "libunoxmllo.a", unoxml_component_getFactory }, { "libuuilo.a", uui_component_getFactory }, commit bd36b992cf2bf2c395ce6f6f0e89d517cc02d1dc Author: Tor Lillqvist <t...@iki.fi> Date: Sat Mar 2 22:15:23 2013 +0200 Support an ad-hoc (non-gbuild) Makefile workflow for the Android apps For now, we want to keep being able to just say for instance "make run" in the android app directories. Change-Id: I1898d5466c0df6007fa32b202888bed644fa9489 diff --git a/android/experimental/DocumentLoader/Makefile b/android/experimental/DocumentLoader/Makefile index 4f738c2..40fd6dc 100644 --- a/android/experimental/DocumentLoader/Makefile +++ b/android/experimental/DocumentLoader/Makefile @@ -1,4 +1,6 @@ -include $(BUILDDIR)/config_host.mk +ifeq ($(BUILDDIR),) +include ../../../config_host.mk +endif # The default target just builds. all: build-ant diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile index f932235..7984be4 100644 --- a/android/experimental/LibreOffice4Android/Makefile +++ b/android/experimental/LibreOffice4Android/Makefile @@ -1,4 +1,6 @@ -include $(BUILDDIR)/config_host.mk +ifeq ($(BUILDDIR),) +include ../../../config_host.mk +endif # The default target just builds. diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile index eb4b029..273aca6 100644 --- a/android/experimental/desktop/Makefile +++ b/android/experimental/desktop/Makefile @@ -1,4 +1,6 @@ -include $(BUILDDIR)/config_host.mk +ifeq ($(BUILDDIR),) +include ../../../config_host.mk +endif # The default target just builds. all: build-ant diff --git a/android/sdremote/Makefile b/android/sdremote/Makefile index eb78e0d..b8ea1e9 100644 --- a/android/sdremote/Makefile +++ b/android/sdremote/Makefile @@ -6,7 +6,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -include $(BUILDDIR)/config_host.mk +ifeq ($(BUILDDIR),) +include ../../config_host.mk +endif all: properties translations.done mkdir -p ../abs-lib/libs _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits