Kaydet (Commit) 06f18dc7 authored tarafından Caolán McNamara's avatar Caolán McNamara

ditch used stuff, and make it less horrifically ugly

üst 3344a577
...@@ -90,14 +90,9 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : ...@@ -90,14 +90,9 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ),
aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ),
aInfoLink ( this, ResId( ABOUT_FTXT_LINK, *rId.GetResMgr() ) ), aInfoLink ( this, ResId( ABOUT_FTXT_LINK, *rId.GetResMgr() ) ),
aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ),
aVersionTextStr( ResId( ABOUT_STR_VERSION, *rId.GetResMgr() ) ), aVersionTextStr( ResId( ABOUT_STR_VERSION, *rId.GetResMgr() ) ),
aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ), aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ),
aLinkStr ( ResId( ABOUT_STR_LINK, *rId.GetResMgr() ) ), aLinkStr ( ResId( ABOUT_STR_LINK, *rId.GetResMgr() ) )
aTimer (),
nOff ( 0 ),
m_nDeltaWidth ( 0 ),
m_nPendingScrolls( 0 )
{ {
rtl::OUString sProduct; rtl::OUString sProduct;
utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct;
...@@ -122,28 +117,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : ...@@ -122,28 +117,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
#endif #endif
aVersionText.SetText( sVersion ); aVersionText.SetText( sVersion );
// Initialization call for developers
if ( aAccelStr.Len() && ByteString(U2S(aAccelStr)).IsAlphaAscii() )
{
Accelerator *pAccel = 0, *pPrevAccel = 0, *pFirstAccel = 0;
aAccelStr.ToUpperAscii();
for ( sal_uInt16 i = 0; i < aAccelStr.Len(); ++i )
{
pPrevAccel = pAccel;
pAccel = new Accelerator;
aAccelList.push_back( pAccel );
sal_uInt16 nKey = aAccelStr.GetChar(i) - 'A' + KEY_A;
pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) );
if ( i > 0 )
pPrevAccel->SetAccel( 1, pAccel );
if ( i == 0 )
pFirstAccel = pAccel;
}
pAccel->SetSelectHdl( LINK( this, AboutDialog, AccelSelectHdl ) );
GetpApp()->InsertAccel( pFirstAccel );
}
// set for background and text the correct system color // set for background and text the correct system color
const StyleSettings& rSettings = GetSettings().GetStyleSettings(); const StyleSettings& rSettings = GetSettings().GetStyleSettings();
Color aWhiteCol( rSettings.GetWindowColor() ); Color aWhiteCol( rSettings.GetWindowColor() );
...@@ -183,51 +156,55 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : ...@@ -183,51 +156,55 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
Size aVTSize = aVersionText.CalcMinimumSize(); Size aVTSize = aVersionText.CalcMinimumSize();
long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 );
long nDlgMargin = a6Size.Width() * 3 ; long nDlgMargin = a6Size.Width() * 3 ;
long nCtrlMargin = aVTSize.Height() + ( a6Size.Height() * 2 ); long nCtrlMargin = a6Size.Height() * 2;
long nTextWidth = aOutSiz.Width() - nDlgMargin; long nTextWidth = aOutSiz.Width() - nDlgMargin;
// finally set the aVersionText widget position and size // finally set the aVersionText widget position and size
Size aVTCopySize = aVTSize; Size aVTCopySize = aVTSize;
Point aVTCopyPnt; Point aVTCopyPnt;
aVTCopySize.Width() = nTextWidth; aVTCopySize.Width() = nTextWidth;
aVTCopyPnt.X() = ( aOutSiz.Width() - aVTCopySize.Width() ) / 2; aVTCopyPnt.X() = ( aOutSiz.Width() - aVTCopySize.Width() ) / 2;
aVTCopyPnt.Y() = nY; aVTCopyPnt.Y() = nY;
aVersionText.SetPosSizePixel( aVTCopyPnt, aVTCopySize ); aVersionText.SetPosSizePixel( aVTCopyPnt, aVTCopySize );
nY += aVTSize.Height();
nY += nCtrlMargin; nY += nCtrlMargin;
// OK-Button-Position (at the bottom and centered)
Size aOKSiz = aOKButton.GetSizePixel();
Point aOKPnt = aOKButton.GetPosPixel();
// FixedHyperlink with more info link
Point aLinkPnt = aInfoLink.GetPosPixel();
Size aLinkSize = aInfoLink.GetSizePixel();
// Multiline edit with Copyright-Text // Multiline edit with Copyright-Text
Point aCopyPnt = aCopyrightText.GetPosPixel(); // preferred Version widget size
Size aCopySize = aCopyrightText.GetSizePixel(); Size aCTSize = aCopyrightText.CalcMinimumSize();
aCopySize.Width() = nTextWidth;
aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - 3*aLinkSize.Height() - nCtrlMargin;
aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; Size aCTCopySize = aCTSize;
aCopyPnt.Y() = nY; Point aCTCopyPnt;
aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); aCTCopySize.Width() = nTextWidth;
aCTCopyPnt.X() = ( aOutSiz.Width() - aCTCopySize.Width() ) / 2;
aCTCopyPnt.Y() = nY;
aCopyrightText.SetPosSizePixel( aCTCopyPnt, aCTCopySize );
nY += aCopySize.Height() + aLinkSize.Height(); nY += aCTSize.Height();
nY += nCtrlMargin;
aLinkSize.Width() = aInfoLink.CalcMinimumSize().Width(); // FixedHyperlink with more info link
Size aLinkSize = aInfoLink.CalcMinimumSize();
Point aLinkPnt;
aLinkPnt.X() = ( aOutSiz.Width() - aLinkSize.Width() ) / 2; aLinkPnt.X() = ( aOutSiz.Width() - aLinkSize.Width() ) / 2;
aLinkPnt.Y() = nY; aLinkPnt.Y() = nY;
aInfoLink.SetPosSizePixel( aLinkPnt, aLinkSize ); aInfoLink.SetPosSizePixel( aLinkPnt, aLinkSize );
nY += aLinkSize.Height() + nCtrlMargin; nY += aLinkSize.Height() + nCtrlMargin;
// OK-Button-Position (at the bottom and centered)
Size aOKSiz = aOKButton.GetSizePixel();
Point aOKPnt;
aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2;
aOKPnt.Y() = nY; aOKPnt.Y() = nY;
aOKButton.SetPosPixel( aOKPnt ); aOKButton.SetPosPixel( aOKPnt );
// Change the width of the dialog nY += aOKSiz.Height() + nCtrlMargin;
aOutSiz.Height() = nY;
// Change the size of the dialog
SetOutputSizePixel( aOutSiz ); SetOutputSizePixel( aOutSiz );
FreeResource(); FreeResource();
...@@ -238,50 +215,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : ...@@ -238,50 +215,6 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
AboutDialog::~AboutDialog()
{
// Clearing the developers call
if ( !aAccelList.empty() )
{
GetpApp()->RemoveAccel( aAccelList.front() );
for ( size_t i = 0, n = aAccelList.size(); i < n; ++i )
delete aAccelList[ i ];
aAccelList.clear();
}
}
// -----------------------------------------------------------------------
IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer )
{
(void)pTimer; //unused
++m_nPendingScrolls;
Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN );
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator )
{
(void)pAccelerator; //unused
// init Timer
aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) );
// init scroll mode
nOff = GetOutputSizePixel().Height();
MapMode aMapMode( MAP_PIXEL );
SetMapMode( aMapMode );
// start scroll Timer
aTimer.SetTimeout( SCROLL_TIMER );
aTimer.Start();
return 0;
}
// -----------------------------------------------------------------------
IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
{ {
rtl::OUString sURL=pHyperlink->GetURL(); rtl::OUString sURL=pHyperlink->GetURL();
...@@ -312,15 +245,12 @@ IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) ...@@ -312,15 +245,12 @@ IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
void AboutDialog::Paint( const Rectangle& rRect ) void AboutDialog::Paint( const Rectangle& rRect )
{ {
SetClipRegion( rRect ); SetClipRegion( rRect );
Point aPos( 0, 0 );
Point aPos( m_nDeltaWidth / 2, 0 );
DrawImage( aPos, aAppLogo ); DrawImage( aPos, aAppLogo );
} }
sal_Bool AboutDialog::Close() sal_Bool AboutDialog::Close()
{ {
// stop Timer and finish the dialog
aTimer.Stop();
EndDialog( RET_OK ); EndDialog( RET_OK );
return sal_False; return sal_False;
} }
......
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
#define ABOUT_BTN_OK 1 #define ABOUT_BTN_OK 1
#define ABOUT_FTXT_VERSION 2 #define ABOUT_FTXT_VERSION 2
#define ABOUT_STR_ACCEL 3 #define ABOUT_FTXT_COPYRIGHT 3
#define ABOUT_FTXT_COPYRIGHT 4 #define ABOUT_FTXT_LINK 4
#define ABOUT_STR_VERSION 5
#define ABOUT_FTXT_LINK 5 #define ABOUT_STR_COPYRIGHT 6
#define ABOUT_STR_VERSION 6 #define ABOUT_STR_LINK 7
#define ABOUT_STR_COPYRIGHT 7
#define ABOUT_STR_LINK 8
...@@ -72,14 +72,10 @@ ModalDialog RID_DEFAULTABOUT ...@@ -72,14 +72,10 @@ ModalDialog RID_DEFAULTABOUT
}; };
String ABOUT_STR_COPYRIGHT String ABOUT_STR_COPYRIGHT
{ {
Text[ en-US ] = "Copyright © 2000, 2010 LibreOffice contributors and/or their affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org, which is Copyright 2000, 2010 Oracle and/or its affiliates.\n%OOOVENDOR acknowledges all community members, please find more info at the link below:"; Text[ en-US ] = "Copyright © 2000, 2010 LibreOffice contributors and/or their affiliates. All rights reserved.\n\nThis product was created by %OOOVENDOR, based on OpenOffice.org, which is Copyright 2000, 2010 Oracle and/or its affiliates.\n\n%OOOVENDOR acknowledges all community members, please find more info at the link below:";
}; };
String ABOUT_STR_LINK String ABOUT_STR_LINK
{ {
Text[ en-US ] = "http://www.libreoffice.org/credits.html"; Text[ en-US ] = "http://www.libreoffice.org/credits.html";
}; };
String ABOUT_STR_ACCEL
{
Text = "SDT" ;
};
}; };
...@@ -53,30 +53,18 @@ private: ...@@ -53,30 +53,18 @@ private:
MultiLineEdit aCopyrightText; MultiLineEdit aCopyrightText;
svt::FixedHyperlink aInfoLink; svt::FixedHyperlink aInfoLink;
// ResStringArray aDeveloperAry; // RIP ...
String aAccelStr;
String aVersionData; String aVersionData;
String aVersionTextStr; String aVersionTextStr;
String aCopyrightTextStr; String aCopyrightTextStr;
String aLinkStr; String aLinkStr;
AccelList aAccelList;
AutoTimer aTimer;
long nOff;
long m_nDeltaWidth;
int m_nPendingScrolls;
protected: protected:
virtual sal_Bool Close(); virtual sal_Bool Close();
virtual void Paint( const Rectangle& rRect ); virtual void Paint( const Rectangle& rRect );
public: public:
AboutDialog( Window* pParent, const ResId& rId); AboutDialog( Window* pParent, const ResId& rId);
~AboutDialog();
DECL_LINK( TimerHdl, Timer * );
DECL_LINK( AccelSelectHdl, Accelerator * );
DECL_LINK( HandleHyperlink, svt::FixedHyperlink * ); DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
}; };
......
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