[Libreoffice-commits] core.git: 2 commits - vcl/ios vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Mar 14 13:38:14 UTC 2019


 vcl/ios/iosinst.cxx          |    4 ++--
 vcl/source/window/dialog.cxx |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit e21979195fc08d2ca1a0736deb986429e12c49aa
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Mar 14 13:40:43 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Mar 14 15:23:56 2019 +0200

    Further tweaks that affect the "tunnelled" dialogs in the iOS app
    
    The bestmaxFrameSizeForScreenSize() function is full of magic numbers.
    (There originally, in OOo times, was a comment in there that said
    "fill in holy default values brought to us by product management"
    which says it all, really.) Those numbers have little or no relevance
    on iOS. Instead, make this function return the largest square that
    will fit on the display (square so that it will fit in either
    orientation, in case the device is rotated while a tunnelled dialog is
    displayed).
    
    And as a consequence the defaut font size on iOS can be bumped up a
    bit, to 10. Now the problematic dialogs look even better.
    
    Note that this is a cherry-pick from our vendor branch (cp-6.0). It
    hasn't actually been tested as the iOS app doesn't work at the moment
    if built from the master branches of online and core.
    
    Change-Id: I043d8f9947520adb04bd952ee49f9c7844a1fa8c

diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx
index b53bb30b9271..19cc75e5057b 100644
--- a/vcl/ios/iosinst.cxx
+++ b/vcl/ios/iosinst.cxx
@@ -28,7 +28,7 @@
 #include <vcl/layout.hxx>
 #include <vcl/settings.hxx>
 
-// Horrible hack
+// Totally wrong of course but doesn't seem to harm much in the iOS app.
 static int viewWidth = 1, viewHeight = 1;
 
 class IosSalData : public GenericUnixSalData
@@ -107,7 +107,7 @@ public:
     virtual void UpdateSettings( AllSettings &rSettings ) override
     {
         // Clobber the UI fonts
-        vcl::Font aFont( OUString::fromUtf8( [[[UIFont systemFontOfSize:7] familyName] UTF8String] ), Size( 0, 7 ) );
+        vcl::Font aFont( OUString::fromUtf8( [[[UIFont systemFontOfSize:10] familyName] UTF8String] ), Size( 0, 10 ) );
 
         StyleSettings aStyleSet = rSettings.GetStyleSettings();
         aStyleSet.SetAppFont( aFont );
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 6f755e4139fb..1aeceee16f95 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -19,6 +19,12 @@
 
 #include <config_features.h>
 
+#ifdef IOS
+#include <premac.h>
+#include <UIKit/UIKit.h>
+#include <postmac.h>
+#endif
+
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/thePathSettings.hpp>
 #include <com/sun/star/frame/theGlobalEventBroadcaster.hpp>
@@ -705,6 +711,7 @@ bool Dialog::EventNotify( NotifyEvent& rNEvt )
 //taskbar, menus, etc.
 Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
 {
+#ifndef IOS
     long w = rScreenSize.Width();
     if (w <= 800)
         w -= 15;
@@ -721,6 +728,19 @@ Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
 
     return Size(std::max<long>(w, 640 - 15),
                 std::max<long>(h, 480 - 50));
+#else
+    // Don't bother with ancient magic numbers of unclear relevance on non-desktop apps anyway. It
+    // seems that at least currently in the iOS app, this function is called just once per dialog,
+    // with a rScreenSize parameter of 1x1 (!). This would lead to always returning 625x430 which is
+    // a bit random and needlessly small on an iPad at least. We want something that closely will
+    // just fit on the display in either orientation.
+
+    // We ignore the rScreenSize as it will be the dummy 1x1 from iosinst.cxx (see "Totally wrong of course").
+    (void) rScreenSize;
+
+    const int n = std::min<CGFloat>([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height);
+    return Size(n-10, n-10);
+#endif
 }
 
 void Dialog::SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink)
commit 2292a5dd12bf3b137f36058b0172876e821ce8a4
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Mar 14 00:31:33 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Mar 14 15:23:56 2019 +0200

    Use smaller default font on iOS (in practice used for dialogs in the iOS app)
    
    I suspected all the time that just one single-line change will be what
    is needed to make the dialogs look mostly sane. (Especially Format >
    Character... and Format > Paragraph...) No exotic hacks were needed
    after all, even though I experimented with more or less crazy ones for
    several days before I thought of changing this font size 14 to
    something smaller.
    
    The problem was apparently simply that with the larger default font,
    the dialog controls didn't fit properly in the space provided.
    Especially the four combo boxes on one line in the Font page were
    problematic. (It has three such lines of combo boxes.)
    
    Apparently the dialog machinery isn't especially good at reducing
    width of controls. The Size control shrunk to (almost?) zero width and
    was not visible, the Style control was too narrow to be usable, but
    the Language control was left as unnecessarily wide.
    
    Note that this is a cherry-pick from our vendor branch (cp-6.0). It
    hasn't actually been tested as the iOS app doesn't work at the moment
    if built from the master branches of online and core.
    
    (cherry picked from commit 96dce784c7971f22dcf44b66a242c22b455e32a3)
    
    Change-Id: If5675856345be2ae502346e8c097ef04216e2986

diff --git a/vcl/ios/iosinst.cxx b/vcl/ios/iosinst.cxx
index a475546e9da4..b53bb30b9271 100644
--- a/vcl/ios/iosinst.cxx
+++ b/vcl/ios/iosinst.cxx
@@ -107,7 +107,7 @@ public:
     virtual void UpdateSettings( AllSettings &rSettings ) override
     {
         // Clobber the UI fonts
-        vcl::Font aFont( OUString( "Helvetica" ), Size( 0, 14 ) );
+        vcl::Font aFont( OUString::fromUtf8( [[[UIFont systemFontOfSize:7] familyName] UTF8String] ), Size( 0, 7 ) );
 
         StyleSettings aStyleSet = rSettings.GetStyleSettings();
         aStyleSet.SetAppFont( aFont );


More information about the Libreoffice-commits mailing list