diff options
author | Stefan Knorr (astron) <heinzlesspam@gmail.com> | 2012-06-03 18:13:05 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2012-06-05 13:32:22 +0200 |
commit | 42bb3d50b21f2febe4518262488765aec523c5e5 (patch) | |
tree | 566b5eb5e3c9747af3e2bd6e1792a71fdf9d64f7 /cui | |
parent | f404878976f228859379b803448fe9ce15278fef (diff) |
Make the new About dialog a little nicer
* remove weird bevel from background
* remove hardcoded button text color
* make Close button visible
* move buttons below copyright text
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/about.cxx | 67 | ||||
-rw-r--r-- | cui/source/dialogs/about.src | 7 |
2 files changed, 38 insertions, 36 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 1667ea11e4d7..c0df2381b53e 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -112,7 +112,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : aLicenseButton.SetClickHdl( LINK( this, AboutDialog, HandleClick ) ); aCancelButton.SetClickHdl( LINK( this, AboutDialog, CancelHdl ) ); - aCancelButton.Hide(); FreeResource(); @@ -172,23 +171,21 @@ void AboutDialog::StyleControls() // Description Text aDescriptionText.SetControlFont( aLargeFont ); - aDescriptionText.SetControlForeground( Color( 46, 52, 54 ) ); + 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( 142, 142, 142 ) ); + aVersionText.SetControlForeground( Color( 102, 102, 102 ) ); // Copyright Text - aCopyrightText.SetControlForeground( Color( 142, 142, 142 ) ); + aCopyrightText.SetControlForeground( Color( 102, 102, 102 ) ); aCopyrightTextShadow.SetControlForeground( Color( 255, 255, 255 ) ); aCopyrightText.SetTextSelectable( sal_False ); aCopyrightTextShadow.SetTextSelectable( sal_False ); - // Blue text on website button - aWebsiteButton.SetControlForeground( Color( 27, 102, 215 ) ); - aWebsiteButton.GrabFocus(); + aCancelButton.GrabFocus(); } void AboutDialog::LayoutControls() @@ -198,7 +195,7 @@ void AboutDialog::LayoutControls() // Obtain an appropriate text width from the size of the screen sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4; - sal_Int32 aDialogBorder = 24; + sal_Int32 aDialogBorder = 6; sal_Int32 aContentWidth = aIdealTextWidth + aDialogBorder * 2; sal_Int32 aShadowWidth = aContentWidth * 0.02; sal_Int32 aDialogWidth = aContentWidth + aShadowWidth * 2; @@ -232,15 +229,8 @@ void AboutDialog::LayoutControls() aDescriptionSize = aDescriptionText.CalcMinimumSize(); aDescriptionText.SetSizePixel( aDescriptionSize ); - // Layout Buttons - Size aButtonSize; - Point aButtonPos; - LayoutButtons( aContentWidth, aDialogBorder, aShadowWidth, aDescriptionPos, - aDescriptionText.GetSizePixel().Height(), - aVersionDescriptionSpacing, aButtonPos, aButtonSize ); - // Layout copyright text - Point aCopyrightPos( aShadowWidth + aDialogBorder, aButtonPos.Y() + aButtonSize.Height() + aVersionDescriptionSpacing ); + Point aCopyrightPos( aShadowWidth + aDialogBorder, aDescriptionPos.Y() + aDescriptionText.GetSizePixel().Height() + aVersionDescriptionSpacing ); Size aCopyrightSize = aCopyrightText.GetSizePixel(); aCopyrightSize.Width() = aIdealTextWidth; aCopyrightText.SetPosSizePixel( aCopyrightPos, aCopyrightSize ); @@ -253,6 +243,15 @@ void AboutDialog::LayoutControls() aCopyrightShadowPos.Y() += 1; aCopyrightTextShadow.SetPosSizePixel( aCopyrightShadowPos, aCopyrightSize ); + // Layout Buttons + Size aButtonSize; + Point aButtonPos; + LayoutButtons( aContentWidth, aDialogBorder, aShadowWidth, aCopyrightPos, + aCopyrightText.GetSizePixel().Height() + 1, + aVersionDescriptionSpacing, aButtonPos, aButtonSize ); + + + // Obtain preliminary dimensions for the dialog vcl::RenderGraphicRasterizer aRasterizerBackground = Application::LoadBrandSVG("shell/about"); float aBackgroundWidthHeightRatio = (float)aRasterizerBackground.GetDefaultSizePixel().Width() / @@ -260,7 +259,7 @@ void AboutDialog::LayoutControls() Size aBackgroundSize( aDialogWidth, aDialogWidth / aBackgroundWidthHeightRatio ); // Make sure the dialog is tall enough - sal_Int32 aBottomY = aCopyrightPos.Y() + aCopyrightText.GetSizePixel().Height() + aDialogBorder + aShadowWidth; + sal_Int32 aBottomY = aButtonPos.Y() + aButtonSize.Height() + aDialogBorder + aShadowWidth; // If not, make the dialog taller (and to maintain the aspect ratio of the background also wider) if (aBottomY > aBackgroundSize.Height()) aBackgroundSize.Width() = aBottomY * aBackgroundWidthHeightRatio; @@ -287,28 +286,28 @@ void AboutDialog::LayoutControls() } void AboutDialog::LayoutButtons(sal_Int32 aContentWidth, sal_Int32 aDialogBorder, - sal_Int32 aShadowWidth, Point aDescriptionPos, - sal_Int32 aDescriptionTextHeight, sal_Int32 aVersionDescriptionSpacing, + sal_Int32 aShadowWidth, Point aCopyrightPos, + sal_Int32 aCopyrightTextHeight, sal_Int32 aVersionDescriptionSpacing, Point& aButtonPos, Size& aButtonSize) { // Position credits button sal_Int32 aButtonVPadding = 5; sal_Int32 aButtonHPadding = 4; + sal_Int32 aAdjacentButtonSpacing = 15; sal_Int32 aCreditsButtonWidth = aCreditsButton.CalcMinimumSize().Width(); sal_Int32 aLicenseButtonWidth = aLicenseButton.CalcMinimumSize().Width(); sal_Int32 aWebsiteButtonWidth = aWebsiteButton.CalcMinimumSize().Width(); - sal_Int32 aLargestButtonWidth = 0; + sal_Int32 aCancelButtonWidth = aCancelButton.CalcMinimumSize().Width(); + sal_Int32 aLargestButtonWidth = 70; - if ( aCreditsButtonWidth >= aLicenseButtonWidth - && aCreditsButtonWidth >= aWebsiteButtonWidth ) + if ( aLargestButtonWidth < aCreditsButtonWidth ) aLargestButtonWidth = aCreditsButtonWidth; - - else if ( aLicenseButtonWidth >= aCreditsButtonWidth - && aLicenseButtonWidth >= aWebsiteButtonWidth ) + if ( aLargestButtonWidth < aLicenseButtonWidth ) aLargestButtonWidth = aLicenseButtonWidth; - else if ( aWebsiteButtonWidth >= aCreditsButtonWidth - && aWebsiteButtonWidth >= aLicenseButtonWidth ) + if ( aLargestButtonWidth < aWebsiteButtonWidth ) aLargestButtonWidth = aWebsiteButtonWidth; + if ( aLargestButtonWidth < aCancelButtonWidth ) + aLargestButtonWidth = aCancelButtonWidth; aButtonSize.Width() = aLargestButtonWidth + ( 2 * aButtonHPadding ); aButtonSize.Height() = aWebsiteButton.CalcMinimumSize().Height() + ( 2 * aButtonVPadding ); @@ -316,20 +315,26 @@ void AboutDialog::LayoutButtons(sal_Int32 aContentWidth, sal_Int32 aDialogBorder aCreditsButton.SetSizePixel( aButtonSize ); aLicenseButton.SetSizePixel( aButtonSize ); aWebsiteButton.SetSizePixel( aButtonSize ); + aCancelButton.SetSizePixel( aButtonSize ); - sal_Int32 aButtonSpacing = (aContentWidth - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 3 ) ) / 2; + sal_Int32 aButtonSpacing = (aContentWidth - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 4 ) - ( aAdjacentButtonSpacing * 2) ); if (aButtonSpacing < 1) aButtonSpacing = 6; aButtonPos.X() = aShadowWidth + aDialogBorder; - aButtonPos.Y() = aDescriptionPos.Y() + aDescriptionTextHeight + aVersionDescriptionSpacing; + aButtonPos.Y() = aCopyrightPos.Y() + aCopyrightTextHeight + aVersionDescriptionSpacing; aCreditsButton.SetPosPixel( aButtonPos ); - aButtonPos.X() += aButtonSize.Width() + aButtonSpacing; + aButtonPos.X() += aButtonSize.Width() + aAdjacentButtonSpacing; + aLicenseButton.SetPosPixel( aButtonPos ); + + aButtonPos.X() += aButtonSize.Width() + aAdjacentButtonSpacing; aWebsiteButton.SetPosPixel( aButtonPos ); aButtonPos.X() += aButtonSize.Width() + aButtonSpacing; - aLicenseButton.SetPosPixel( aButtonPos ); + aCancelButton.SetPosPixel( aButtonPos ); + + } void AboutDialog::MoveControl(Control& rControl, sal_Int32 X) diff --git a/cui/source/dialogs/about.src b/cui/source/dialogs/about.src index 1e384968bdf0..21fb6244e240 100644 --- a/cui/source/dialogs/about.src +++ b/cui/source/dialogs/about.src @@ -71,7 +71,7 @@ ModalDialog RID_DEFAULTABOUT }; String ABOUT_STR_VERSION { - Text [ en-US ] = "version %ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX %PRODUCTEXTENSION"; + Text [ en-US ] = "Version %ABOUTBOXPRODUCTVERSION%ABOUTBOXPRODUCTVERSIONSUFFIX %PRODUCTEXTENSION"; }; String ABOUT_STR_DESCRIPTION { @@ -119,14 +119,11 @@ ModalDialog RID_DEFAULTABOUT }; PushButton ABOUT_BTN_WEBSITE { - Text [ en-US ] = "libreoffice.org"; - DefButton = TRUE ; + Text [ en-US ] = "Website"; }; CancelButton ABOUT_BTN_CANCEL { DefButton = TRUE ; - Pos = MAP_APPFONT ( 174 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; Text [ en-US ] = "~Close"; }; FixedImage ABOUT_IMAGE_LOGO |