desktop/inc/app.hxx | 1 desktop/source/app/app.cxx | 1 extensions/uiconfig/sabpilot/ui/datasourcepage.ui | 7 +- extensions/uiconfig/sabpilot/ui/fieldassignpage.ui | 4 - extensions/uiconfig/sabpilot/ui/selecttypepage.ui | 2 include/vcl/svapp.hxx | 6 -- include/vcl/window.hxx | 2 vcl/source/app/svapp.cxx | 57 --------------------- vcl/source/outdev/map.cxx | 11 ++++ vcl/source/window/window.cxx | 48 +++++++++++++++++ 10 files changed, 70 insertions(+), 69 deletions(-)
New commits: commit ae520fa4c07442d435b02e4066c838f69f7813d4 Author: Caolán McNamara <caol...@redhat.com> Date: Fri May 9 11:15:29 2014 +0100 back to 90 char wide now that the fontsize is fixed Change-Id: I8ae524f6c7b74a09a3bcce982642bd72dadf7bf8 diff --git a/extensions/uiconfig/sabpilot/ui/datasourcepage.ui b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui index f1bfb46..cce60fe 100644 --- a/extensions/uiconfig/sabpilot/ui/datasourcepage.ui +++ b/extensions/uiconfig/sabpilot/ui/datasourcepage.ui @@ -18,7 +18,7 @@ Now, just enter the name under which you want to register the data source in %PRODUCTNAME.</property> <property name="wrap">True</property> - <property name="max_width_chars">70</property> + <property name="max_width_chars">90</property> </object> <packing> <property name="left_attach">0</property> @@ -31,6 +31,7 @@ Now, just enter the name under which you want to register the data source in %PR <object class="GtkGrid" id="grid3"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="row_spacing">6</property> <child> <object class="GtkGrid" id="grid4"> @@ -116,11 +117,13 @@ Now, just enter the name under which you want to register the data source in %PR <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="left_padding">12</property> <child> <object class="GtkGrid" id="grid5"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="row_spacing">6</property> <child> <object class="GtkGrid" id="grid6"> @@ -173,7 +176,7 @@ Now, just enter the name under which you want to register the data source in %PR <property name="yalign">0</property> <property name="label" translatable="yes">Another data source already has this name. As data sources have to have globally unique names, you need to choose another one.</property> <property name="wrap">True</property> - <property name="max_width_chars">70</property> + <property name="max_width_chars">90</property> </object> <packing> <property name="left_attach">0</property> diff --git a/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui b/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui index f0ec0b7..f5cc1d3 100644 --- a/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui +++ b/extensions/uiconfig/sabpilot/ui/fieldassignpage.ui @@ -19,7 +19,7 @@ For instance, you could have stored the e-mail addresses in a field named "email Click the button below to open another dialog where you can enter the settings for your data source.</property> <property name="wrap">True</property> - <property name="max_width_chars">70</property> + <property name="max_width_chars">90</property> </object> <packing> <property name="left_attach">0</property> @@ -52,7 +52,7 @@ Click the button below to open another dialog where you can enter the settings f <property name="xalign">0</property> <property name="yalign">0</property> <property name="wrap">True</property> - <property name="max_width_chars">70</property> + <property name="max_width_chars">90</property> </object> <packing> <property name="left_attach">0</property> diff --git a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui index 8cb4ba3..f61c3a1 100644 --- a/extensions/uiconfig/sabpilot/ui/selecttypepage.ui +++ b/extensions/uiconfig/sabpilot/ui/selecttypepage.ui @@ -246,7 +246,7 @@ This wizard helps you create the data source.</property> <property name="wrap">True</property> - <property name="max_width_chars">70</property> + <property name="max_width_chars">90</property> </object> <packing> <property name="left_attach">0</property> commit 60eff2f44270c04ba95ee16444880c095f4d2b7b Author: Caolán McNamara <caol...@redhat.com> Date: Fri May 9 11:07:34 2014 +0100 Revert font initialization foo this reverts 081a0854635f4bc9f6f743ef4e2675c208405f74 because the heights and widths of the non .ui-converted dialogs are all too low and everything is squished in them Change-Id: I103eda4b3d43365c02ecedb6f37b995a682b2cf9 diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 984d31e..02a94b9 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -128,7 +128,6 @@ class Desktop : public Application // throws an exception upon failure private: - void RegisterServices( css::uno::Reference< css::uno::XComponentContext > const & context); void DeregisterServices(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 018f52d..bb14e03 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1493,7 +1493,6 @@ int Desktop::Main() the main thread is not yet in the event loop. */ Application::GetDefaultDevice(); - Application::InitAppFontData(); #if HAVE_FEATURE_EXTENSIONS // Check if bundled or shared extensions were added /removed diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 5f24c76..b08316c 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -268,12 +268,6 @@ public: */ virtual void Init(); -protected: - /** Initialize font data for the application. - */ - static void InitAppFontData(); - -public: /** Finish initialization of the application. @see Init, DeInit diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index b7cb9b3..745e9e0 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -385,6 +385,8 @@ public: DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* ); + SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); + SAL_DLLPRIVATE Window* ImplGetFrameWindow() const; SalFrame* ImplGetFrame() const; SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData(); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index a750ad0..10458ef 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -549,7 +549,7 @@ void Application::SetSettings( const AllSettings& rSettings ) { nOldDPIX = pFirstFrame->mnDPIX; nOldDPIY = pFirstFrame->mnDPIY; - Application::InitAppFontData(); + Window::ImplInitAppFontData(pFirstFrame); } Window* pFrame = pFirstFrame; while ( pFrame ) @@ -1653,59 +1653,4 @@ Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM return pSVData->mpDefInst->createFolderPicker( xSM ); } -void Application::InitAppFontData() -{ - ImplSVData* pSVData = ImplGetSVData(); - - Window *pWindow = pSVData->mpDefaultWin; - - if (!pWindow) - pWindow = new WorkWindow( NULL, 0 ); - - long nTextHeight = pWindow->GetTextHeight(); - long nTextWidth = pWindow->approximate_char_width() * 8; - long nSymHeight = nTextHeight*4; - // Make the basis wider if the font is too narrow - // such that the dialog looks symmetrical and does not become too narrow. - // Add some extra space when the dialog has the same width, - // as a little more space is better. - if ( nSymHeight > nTextWidth ) - nTextWidth = nSymHeight; - else if ( nSymHeight+5 > nTextWidth ) - nTextWidth = nSymHeight+5; - pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8; - pSVData->maGDIData.mnAppFontY = nTextHeight * 10; - - // FIXME: this is currently only on OS X, check with other - // platforms - if( pSVData->maNWFData.mbNoFocusRects ) - { - // try to find out whether there is a large correction - // of control sizes, if yes, make app font scalings larger - // so dialog positioning is not completely off - ImplControlValue aControlValue; - Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) ); - Rectangle aBoundingRgn( aCtrlRegion ); - Rectangle aContentRgn( aCtrlRegion ); - if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion, - CTRL_STATE_ENABLED, aControlValue, OUString(), - aBoundingRgn, aContentRgn ) ) - { - // comment: the magical +6 is for the extra border in bordered - // (which is the standard) edit fields - if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 ) - pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10; - } - } - - pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX; - if ( pSVData->maAppData.mnDialogScaleX ) - pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100; - - // a temporary WorkWindow was created, we need to delete it - if (!pSVData->mpDefaultWin && pWindow) - delete pWindow; -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 55b0c23a..117429d 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -223,6 +223,17 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, case MAP_APPFONT: { ImplSVData* pSVData = ImplGetSVData(); + if ( !pSVData->maGDIData.mnAppFontX ) + { + if( pSVData->maWinData.mpFirstFrame ) + Window::ImplInitAppFontData( pSVData->maWinData.mpFirstFrame ); + else + { + WorkWindow* pWin = new WorkWindow( NULL, 0 ); + Window::ImplInitAppFontData( pWin ); + delete pWin; + } + } rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX; rMapRes.mnMapScDenomX = nDPIX * 40; rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 53ab027..047b447 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -533,6 +533,50 @@ bool Window::HasMirroredGraphics() const return pOutDev->OutputDevice::HasMirroredGraphics(); } +void Window::ImplInitAppFontData( Window* pWindow ) +{ + ImplSVData* pSVData = ImplGetSVData(); + long nTextHeight = pWindow->GetTextHeight(); + long nTextWidth = pWindow->approximate_char_width() * 8; + long nSymHeight = nTextHeight*4; + // Make the basis wider if the font is too narrow + // such that the dialog looks symmetrical and does not become too narrow. + // Add some extra space when the dialog has the same width, + // as a little more space is better. + if ( nSymHeight > nTextWidth ) + nTextWidth = nSymHeight; + else if ( nSymHeight+5 > nTextWidth ) + nTextWidth = nSymHeight+5; + pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8; + pSVData->maGDIData.mnAppFontY = nTextHeight * 10; + + // FIXME: this is currently only on OS X, check with other + // platforms + if( pSVData->maNWFData.mbNoFocusRects ) + { + // try to find out whether there is a large correction + // of control sizes, if yes, make app font scalings larger + // so dialog positioning is not completely off + ImplControlValue aControlValue; + Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) ); + Rectangle aBoundingRgn( aCtrlRegion ); + Rectangle aContentRgn( aCtrlRegion ); + if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion, + CTRL_STATE_ENABLED, aControlValue, OUString(), + aBoundingRgn, aContentRgn ) ) + { + // comment: the magical +6 is for the extra border in bordered + // (which is the standard) edit fields + if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 ) + pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10; + } + } + + pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX; + if ( pSVData->maAppData.mnDialogScaleX ) + pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100; +} + bool Window::ImplCheckUIFont( const Font& rFont ) { if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) @@ -1154,6 +1198,10 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste ImplUpdatePos(); + // calculate app font res (except for the Intro Window or the default window) + if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) ) + ImplInitAppFontData( this ); + if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() ) GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this ); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits