Kaydet (Commit) 60eff2f4 authored tarafından Caolán McNamara's avatar Caolán McNamara

Revert font initialization foo

this reverts 081a0854

because the heights and widths of the non .ui-converted dialogs are all too low
and everything is squished in them

Change-Id: I103eda4b3d43365c02ecedb6f37b995a682b2cf9
üst f6422b3d
...@@ -128,7 +128,6 @@ class Desktop : public Application ...@@ -128,7 +128,6 @@ class Desktop : public Application
// throws an exception upon failure // throws an exception upon failure
private: private:
void RegisterServices( void RegisterServices(
css::uno::Reference< css::uno::XComponentContext > const & context); css::uno::Reference< css::uno::XComponentContext > const & context);
void DeregisterServices(); void DeregisterServices();
......
...@@ -1493,7 +1493,6 @@ int Desktop::Main() ...@@ -1493,7 +1493,6 @@ int Desktop::Main()
the main thread is not yet in the event loop. the main thread is not yet in the event loop.
*/ */
Application::GetDefaultDevice(); Application::GetDefaultDevice();
Application::InitAppFontData();
#if HAVE_FEATURE_EXTENSIONS #if HAVE_FEATURE_EXTENSIONS
// Check if bundled or shared extensions were added /removed // Check if bundled or shared extensions were added /removed
......
...@@ -268,12 +268,6 @@ public: ...@@ -268,12 +268,6 @@ public:
*/ */
virtual void Init(); virtual void Init();
protected:
/** Initialize font data for the application.
*/
static void InitAppFontData();
public:
/** Finish initialization of the application. /** Finish initialization of the application.
@see Init, DeInit @see Init, DeInit
......
...@@ -385,6 +385,8 @@ public: ...@@ -385,6 +385,8 @@ public:
DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* ); DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* );
SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow );
SAL_DLLPRIVATE Window* ImplGetFrameWindow() const; SAL_DLLPRIVATE Window* ImplGetFrameWindow() const;
SalFrame* ImplGetFrame() const; SalFrame* ImplGetFrame() const;
SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData(); SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
......
...@@ -549,7 +549,7 @@ void Application::SetSettings( const AllSettings& rSettings ) ...@@ -549,7 +549,7 @@ void Application::SetSettings( const AllSettings& rSettings )
{ {
nOldDPIX = pFirstFrame->mnDPIX; nOldDPIX = pFirstFrame->mnDPIX;
nOldDPIY = pFirstFrame->mnDPIY; nOldDPIY = pFirstFrame->mnDPIY;
Application::InitAppFontData(); Window::ImplInitAppFontData(pFirstFrame);
} }
Window* pFrame = pFirstFrame; Window* pFrame = pFirstFrame;
while ( pFrame ) while ( pFrame )
...@@ -1653,59 +1653,4 @@ Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM ...@@ -1653,59 +1653,4 @@ Application::createFolderPicker( const Reference< uno::XComponentContext >& xSM
return pSVData->mpDefInst->createFolderPicker( 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -223,6 +223,17 @@ static void ImplCalcMapResolution( const MapMode& rMapMode, ...@@ -223,6 +223,17 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
case MAP_APPFONT: case MAP_APPFONT:
{ {
ImplSVData* pSVData = ImplGetSVData(); 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.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
rMapRes.mnMapScDenomX = nDPIX * 40; rMapRes.mnMapScDenomX = nDPIX * 40;
rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY; rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;
......
...@@ -533,6 +533,50 @@ bool Window::HasMirroredGraphics() const ...@@ -533,6 +533,50 @@ bool Window::HasMirroredGraphics() const
return pOutDev->OutputDevice::HasMirroredGraphics(); 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 ) bool Window::ImplCheckUIFont( const Font& rFont )
{ {
if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) if( ImplGetSVData()->maGDIData.mbNativeFontConfig )
...@@ -1154,6 +1198,10 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste ...@@ -1154,6 +1198,10 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
ImplUpdatePos(); 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() ) if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() )
GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this ); GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment