Kaydet (Commit) 7804c249 authored tarafından Stefan Knorr (astron)'s avatar Stefan Knorr (astron)

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
üst 6b49f186
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
* *
************************************************************************/ ************************************************************************/
// TODO: make the background of the dialog transparent and remove the titlebar
// include --------------------------------------------------------------- // include ---------------------------------------------------------------
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -156,7 +154,6 @@ void AboutDialog::StyleControls() ...@@ -156,7 +154,6 @@ void AboutDialog::StyleControls()
aVersionText.SetPaintTransparent( sal_True ); aVersionText.SetPaintTransparent( sal_True );
aDescriptionText.SetPaintTransparent( sal_True ); aDescriptionText.SetPaintTransparent( sal_True );
aCopyrightText.SetPaintTransparent( sal_True ); aCopyrightText.SetPaintTransparent( sal_True );
aCopyrightTextShadow.SetPaintTransparent( sal_True );
Font aLabelFont = GetSettings().GetStyleSettings().GetLabelFont(); Font aLabelFont = GetSettings().GetStyleSettings().GetLabelFont();
Font aLargeFont = aLabelFont; Font aLargeFont = aLabelFont;
...@@ -164,17 +161,13 @@ void AboutDialog::StyleControls() ...@@ -164,17 +161,13 @@ void AboutDialog::StyleControls()
// Description Text // Description Text
aDescriptionText.SetControlFont( aLargeFont ); aDescriptionText.SetControlFont( aLargeFont );
aDescriptionText.SetControlForeground( Color( 51, 51, 51 ) );
aDescriptionText.SetTextSelectable( sal_False ); aDescriptionText.SetTextSelectable( sal_False );
// Version Text // Version Text
aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.2 ) ); aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.2 ) );
aVersionText.SetControlFont( aLargeFont ); aVersionText.SetControlFont( aLargeFont );
aVersionText.SetControlForeground( Color( 102, 102, 102 ) );
// Copyright Text // Copyright Text
aCopyrightText.SetControlForeground( Color( 102, 102, 102 ) );
aCopyrightTextShadow.SetControlForeground( Color( 255, 255, 255 ) );
aCopyrightText.SetTextSelectable( sal_False ); aCopyrightText.SetTextSelectable( sal_False );
aCopyrightTextShadow.SetTextSelectable( sal_False ); aCopyrightTextShadow.SetTextSelectable( sal_False );
...@@ -189,16 +182,15 @@ void AboutDialog::LayoutControls() ...@@ -189,16 +182,15 @@ void AboutDialog::LayoutControls()
sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4; sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4;
sal_Int32 aDialogBorder = 12; sal_Int32 aDialogBorder = 12;
sal_Int32 aDialogWidth = aIdealTextWidth + aDialogBorder * 2; Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0);
// Render and Position Logo // Render and Position Logo
vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo"); vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo");
float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() / float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() /
(float)aRasterizerLogo.GetDefaultSizePixel().Height(); (float)aRasterizerLogo.GetDefaultSizePixel().Height();
Size aLogoSize( aDialogWidth * 0.6, (aDialogWidth * 0.6) / aLogoWidthHeightRatio ); Size aLogoSize( aIdealTextWidth, aIdealTextWidth / aLogoWidthHeightRatio );
Point aLogoPos( ( aDialogWidth - aLogoSize.Width() ) / 2, Point aLogoPos( aDialogBorder, aDialogBorder );
aDialogBorder );
aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize ); aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
aLogoImage.SetImage( Image( aLogoBitmap ) ); aLogoImage.SetImage( Image( aLogoBitmap ) );
aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize ); aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
...@@ -229,74 +221,35 @@ void AboutDialog::LayoutControls() ...@@ -229,74 +221,35 @@ void AboutDialog::LayoutControls()
aCopyrightSize.Width() = aIdealTextWidth; aCopyrightSize.Width() = aIdealTextWidth;
aCopyrightText.SetSizePixel( aCopyrightSize ); 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 // Layout Buttons
Size aButtonSize; Size aButtonSize;
Point aButtonPos; Point aButtonPos;
sal_Int32 aButtonsWidth = 0; sal_Int32 aButtonsWidth = 0;
LayoutButtons( aDialogWidth, aDialogBorder, aCopyrightPos, LayoutButtons( aDialogSize.Width(), aDialogBorder, aCopyrightPos,
aCopyrightText.GetSizePixel().Height() + 1, aCopyrightText.GetSizePixel().Height(),
aVersionDescriptionSpacing, aButtonPos, aButtonSize, aButtonsWidth ); aVersionDescriptionSpacing, aButtonPos, aButtonSize, aButtonsWidth );
// Obtain preliminary dimensions for the dialog // 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 // Make sure the dialog is tall enough
sal_Int32 aBottomY = aButtonPos.Y() + aButtonSize.Height() + aDialogBorder; aDialogSize.Height() = 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;
}
if (aBottomY > aBackgroundSize.Height()) // If dialog isn't wide enough to accommodate the buttons
{ if (aButtonsWidth > 0)
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)
{ {
sal_Int32 aWidthDifference = aBackgroundSize.Width() - aDialogWidth; aDialogSize.Width() += aButtonsWidth;
MoveControl(aLogoImage, aButtonsWidth / 2, 0);
MoveControl(aLogoImage, aWidthDifference / 2, 0); MoveControl(aVersionText, aButtonsWidth / 2, 0);
MoveControl(aVersionText, aWidthDifference / 2, 0); MoveControl(aDescriptionText, aButtonsWidth / 2, 0);
MoveControl(aDescriptionText, aWidthDifference / 2, 0); MoveControl(aCopyrightText, aButtonsWidth / 2, 0);
MoveControl(aCopyrightText, aWidthDifference / 2, 0);
MoveControl(aCopyrightTextShadow, aWidthDifference / 2, 0);
if (aButtonsWidth <= 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, void AboutDialog::LayoutButtons(sal_Int32 aDialogWidth, sal_Int32 aDialogBorder,
...@@ -327,7 +280,7 @@ 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 ); aWebsiteButton.SetSizePixel( aButtonSize );
aCancelButton.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) if (aButtonSpacing < aAdjacentButtonSpacing)
{ {
aButtonsWidth = aAdjacentButtonSpacing - aButtonSpacing; aButtonsWidth = aAdjacentButtonSpacing - aButtonSpacing;
......
This diff was suppressed by a .gitattributes entry.
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