diff options
author | Stefan Knorr (astron) <heinzlesspam@gmail.com> | 2012-07-02 08:37:53 +0200 |
---|---|---|
committer | Stefan Knorr (astron) <heinzlesspam@gmail.com> | 2012-07-03 14:29:45 +0200 |
commit | 7804c249753ce88491979a7058b6cca05421cefa (patch) | |
tree | a3ee81e077854c587da3660c934c50928f52fabe /cui | |
parent | 6b49f186bc79e30d459352d6a4d4c5a6baec384e (diff) |
Get new Branding Stuff into About
Flat_logo.svg based upon the splash screen design by Andrea Sorogna
There were a few more changes that I had to make to the dialog layout
because the background image is gone now, which meant I had to also
* remove the hard-coded font colors
* remove much of the code that referred to laying out the background image
Sorry for doing the umpteenth change to this stuff in this release cycle. :)
Change-Id: I62b3372113033b387ad41ef5720e05c8101444f1
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/about.cxx | 79 |
1 files changed, 16 insertions, 63 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 5b3da4b3839e..daa662836ef9 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -26,8 +26,6 @@ * ************************************************************************/ -// TODO: make the background of the dialog transparent and remove the titlebar - // include --------------------------------------------------------------- #include <vcl/svapp.hxx> @@ -156,7 +154,6 @@ void AboutDialog::StyleControls() aVersionText.SetPaintTransparent( sal_True ); aDescriptionText.SetPaintTransparent( sal_True ); aCopyrightText.SetPaintTransparent( sal_True ); - aCopyrightTextShadow.SetPaintTransparent( sal_True ); Font aLabelFont = GetSettings().GetStyleSettings().GetLabelFont(); Font aLargeFont = aLabelFont; @@ -164,17 +161,13 @@ void AboutDialog::StyleControls() // Description Text aDescriptionText.SetControlFont( aLargeFont ); - aDescriptionText.SetControlForeground( Color( 51, 51, 51 ) ); aDescriptionText.SetTextSelectable( sal_False ); // Version Text aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.2 ) ); aVersionText.SetControlFont( aLargeFont ); - aVersionText.SetControlForeground( Color( 102, 102, 102 ) ); // Copyright Text - aCopyrightText.SetControlForeground( Color( 102, 102, 102 ) ); - aCopyrightTextShadow.SetControlForeground( Color( 255, 255, 255 ) ); aCopyrightText.SetTextSelectable( sal_False ); aCopyrightTextShadow.SetTextSelectable( sal_False ); @@ -189,16 +182,15 @@ void AboutDialog::LayoutControls() sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4; sal_Int32 aDialogBorder = 12; - sal_Int32 aDialogWidth = aIdealTextWidth + aDialogBorder * 2; + Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0); // Render and Position Logo vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo"); float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() / (float)aRasterizerLogo.GetDefaultSizePixel().Height(); - Size aLogoSize( aDialogWidth * 0.6, (aDialogWidth * 0.6) / aLogoWidthHeightRatio ); - Point aLogoPos( ( aDialogWidth - aLogoSize.Width() ) / 2, - aDialogBorder ); + Size aLogoSize( aIdealTextWidth, aIdealTextWidth / aLogoWidthHeightRatio ); + Point aLogoPos( aDialogBorder, aDialogBorder ); aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize ); aLogoImage.SetImage( Image( aLogoBitmap ) ); aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize ); @@ -229,74 +221,35 @@ void AboutDialog::LayoutControls() aCopyrightSize.Width() = aIdealTextWidth; aCopyrightText.SetSizePixel( aCopyrightSize ); - // Position the copyright text shadow 1px below the real text - Point aCopyrightShadowPos = aCopyrightPos; - aCopyrightShadowPos.Y() += 1; - aCopyrightTextShadow.SetPosSizePixel( aCopyrightShadowPos, aCopyrightSize ); - // Layout Buttons Size aButtonSize; Point aButtonPos; sal_Int32 aButtonsWidth = 0; - LayoutButtons( aDialogWidth, aDialogBorder, aCopyrightPos, - aCopyrightText.GetSizePixel().Height() + 1, + LayoutButtons( aDialogSize.Width(), aDialogBorder, aCopyrightPos, + aCopyrightText.GetSizePixel().Height(), aVersionDescriptionSpacing, aButtonPos, aButtonSize, aButtonsWidth ); // Obtain preliminary dimensions for the dialog - vcl::RenderGraphicRasterizer aRasterizerBackground = Application::LoadBrandSVG("shell/about"); - float aBackgroundWidthHeightRatio = (float)aRasterizerBackground.GetDefaultSizePixel().Width() / - (float)aRasterizerBackground.GetDefaultSizePixel().Height(); - Size aBackgroundSize( aDialogWidth, aDialogWidth / aBackgroundWidthHeightRatio ); // Make sure the dialog is tall enough - sal_Int32 aBottomY = aButtonPos.Y() + aButtonSize.Height() + aDialogBorder; - // If not, make the dialog taller (and to maintain the aspect ratio of the background also wider) - if (aButtonsWidth > 0) - { - aBackgroundSize.Width() += aButtonsWidth; - aBackgroundSize.Height() = aBackgroundSize.Width() / aBackgroundWidthHeightRatio; - } + aDialogSize.Height() = aButtonPos.Y() + aButtonSize.Height() + aDialogBorder; - if (aBottomY > aBackgroundSize.Height()) - { - aBackgroundSize.Width() = aBottomY * aBackgroundWidthHeightRatio; - aBackgroundSize.Height() = aBottomY; - } - - // Not pretty, but better than having the buttons in the center of the dialog. - if (aBottomY < aBackgroundSize.Height()) - { - sal_Int32 aHeightDifference = aBackgroundSize.Height() - aBottomY; - - MoveControl(aVersionText, 0, aHeightDifference * 0.25); - MoveControl(aDescriptionText, 0, aHeightDifference * 0.5 ); - MoveControl(aCopyrightText, 0, aHeightDifference * 0.75 ); - MoveControl(aCopyrightTextShadow, 0, aHeightDifference * 0.75 ); - MoveControl(aCreditsButton, 0, aHeightDifference); - MoveControl(aWebsiteButton, 0, aHeightDifference); - MoveControl(aCancelButton, 0, aHeightDifference); - } - - // If needed, adjust all control position to the new width - if (aBackgroundSize.Width() != aDialogWidth) + // If dialog isn't wide enough to accommodate the buttons + if (aButtonsWidth > 0) { - sal_Int32 aWidthDifference = aBackgroundSize.Width() - aDialogWidth; - - MoveControl(aLogoImage, aWidthDifference / 2, 0); - MoveControl(aVersionText, aWidthDifference / 2, 0); - MoveControl(aDescriptionText, aWidthDifference / 2, 0); - MoveControl(aCopyrightText, aWidthDifference / 2, 0); - MoveControl(aCopyrightTextShadow, aWidthDifference / 2, 0); + aDialogSize.Width() += aButtonsWidth; + MoveControl(aLogoImage, aButtonsWidth / 2, 0); + MoveControl(aVersionText, aButtonsWidth / 2, 0); + MoveControl(aDescriptionText, aButtonsWidth / 2, 0); + MoveControl(aCopyrightText, aButtonsWidth / 2, 0); if (aButtonsWidth <= 0) - MoveControl(aCancelButton, aWidthDifference, 0); + MoveControl(aCancelButton, aButtonsWidth, 0); } + SetOutputSizePixel( aDialogSize ); - // Render Background and set final dialog size - aBackgroundBitmap = aRasterizerBackground.Rasterize( aBackgroundSize ); - SetOutputSizePixel( aBackgroundSize ); } void AboutDialog::LayoutButtons(sal_Int32 aDialogWidth, sal_Int32 aDialogBorder, @@ -327,7 +280,7 @@ void AboutDialog::LayoutButtons(sal_Int32 aDialogWidth, sal_Int32 aDialogBorder, aWebsiteButton.SetSizePixel( aButtonSize ); aCancelButton.SetSizePixel( aButtonSize ); - sal_Int32 aButtonSpacing = aDialogWidth - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 4 ) - ( aAdjacentButtonSpacing * 2); + sal_Int32 aButtonSpacing = aDialogWidth - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 3 ) - aAdjacentButtonSpacing ; if (aButtonSpacing < aAdjacentButtonSpacing) { aButtonsWidth = aAdjacentButtonSpacing - aButtonSpacing; |