renaissance1: #107215# Cleanup.

This commit is contained in:
Andre Fischer 2010-02-12 15:40:43 +01:00
parent ab518ae911
commit a3d0b08067
8 changed files with 40 additions and 58 deletions

View file

@ -328,7 +328,6 @@ void PageCacheManager::ReleaseCache (const ::boost::shared_ptr<Cache>& rpCache)
mpPageCaches->begin(),
mpPageCaches->end(),
PageCacheContainer::CompareWithCache(rpCache)));
OSL_ASSERT(iCacheToChange != mpPageCaches->end());
if (iCacheToChange != mpPageCaches->end())
{
OSL_ASSERT(iCacheToChange->second == rpCache);
@ -345,6 +344,10 @@ void PageCacheManager::ReleaseCache (const ::boost::shared_ptr<Cache>& rpCache)
pResult = rpCache;
}
else
{
OSL_ASSERT(iCacheToChange != mpPageCaches->end());
}
}
return pResult;

View file

@ -199,7 +199,6 @@ public:
void SetPageUnderMouse (const model::SharedPageDescriptor& rpDescriptor);
void SetButtonUnderMouse (const sal_Int32 nButtonIndex);
void AddVisualStateAnimation (const model::SharedPageDescriptor& rpDescriptor);
bool SetState (
const model::SharedPageDescriptor& rpDescriptor,
const model::PageDescriptor::State eState,

View file

@ -97,7 +97,7 @@ private:
void PrepareBackgrounds (OutputDevice& rDevice);
Bitmap CreateBackgroundBitmap(
const OutputDevice& rReferenceDevice,
const Theme::ColorType eType) const;
const Theme::GradientColorType eType) const;
};
} } } // end of namespace sd::slidesorter::view

View file

@ -76,15 +76,27 @@ public:
ButtonBackground,
MouseOverColor,
PageNumberBorder,
Selection,
Selection
};
ColorData GetColor (const ColorType eType);
enum GradientColorType {
NormalPage,
SelectedPage,
MouseOverPage
};
enum ColorClass { Border1, Border2, Fill1, Fill2, Other };
ColorData GetColor (const ColorType eType, const ColorClass eClass = Other);
enum GradientColorClass {
Border1,
Border2,
Fill1,
Fill2
};
ColorData GetGradientColor (
const GradientColorType eType,
const GradientColorClass eClass);
enum IconType {
enum IconType
{
InsertionIndicator,
RawShadow
};

View file

@ -38,7 +38,6 @@
#include "ViewShell.hxx"
#include "SlsViewCacheContext.hxx"
#include "SlsLayeredDevice.hxx"
#include "SlsSelectionPainter.hxx"
#include "view/SlsLayouter.hxx"
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsPageObjectPainter.hxx"
@ -975,32 +974,6 @@ void SlideSorterView::SetButtonUnderMouse (const sal_Int32 nButtonIndex)
void SlideSorterView::AddVisualStateAnimation (const model::SharedPageDescriptor& rpDescriptor)
{
// Stop a state animation for the given descriptor that is still running.
const Animator::AnimationId nId (rpDescriptor->GetVisualState().GetStateAnimationId());
if (nId != Animator::NotAnAnimationId)
{
mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(nId);
}
rpDescriptor->GetVisualState().SetStateAnimationId(
mrSlideSorter.GetController().GetAnimator()->AddAnimation(
::boost::bind(
controller::AnimationFunction::ApplyVisualStateChange,
rpDescriptor,
::boost::ref(*this),
::boost::bind(AnimationFunction::FastInSlowOut_Sine, _1)),
350,
::boost::bind(
&VisualState::SetStateAnimationId,
::boost::ref(rpDescriptor->GetVisualState()),
controller::Animator::NotAnAnimationId)));
}
bool SlideSorterView::SetState (
const model::SharedPageDescriptor& rpDescriptor,
const PageDescriptor::State eState,
@ -1013,15 +986,12 @@ bool SlideSorterView::SetState (
switch(eState)
{
case PageDescriptor::ST_Visible:
RequestRepaint(rpDescriptor);
break;
case PageDescriptor::ST_Selected:
case PageDescriptor::ST_Focused:
case PageDescriptor::ST_MouseOver:
case PageDescriptor::ST_Current:
case PageDescriptor::ST_Excluded:
AddVisualStateAnimation(rpDescriptor);
RequestRepaint(rpDescriptor);
break;
case PageDescriptor::ST_WasSelected:

View file

@ -527,17 +527,12 @@ void PageObjectPainter::PrepareBackgrounds (OutputDevice& rDevice)
Bitmap PageObjectPainter::CreateBackgroundBitmap(
const OutputDevice& rReferenceDevice,
const Theme::ColorType eColorType) const
const Theme::GradientColorType eColorType) const
{
::canvas::tools::ElapsedTime aTimer;
const double nStartTime (aTimer.getElapsedTime());
const Size aSize (mpPageObjectLayouter->GetPageObjectSize());
VirtualDevice aBitmapDevice (rReferenceDevice);
aBitmapDevice.SetOutputSizePixel(aSize);
OSL_TRACE("created bitmap after %fms",(aTimer.getElapsedTime() - nStartTime)*1000);
// Paint the background with a linear gradient that starts some pixels
// below the top and ends some pixels above the bottom.
#if 1
@ -551,8 +546,8 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
nDefaultConstantSize,
(nHeight - nMinimalGradientSize)/2)));
const sal_Int32 nY2 (nHeight-nY1);
const Color aTopColor(mpTheme->GetColor(eColorType, Theme::Fill1));
const Color aBottomColor(mpTheme->GetColor(eColorType, Theme::Fill2));
const Color aTopColor(mpTheme->GetGradientColor(eColorType, Theme::Fill1));
const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::Fill2));
for (sal_Int32 nY=0; nY<nHeight; ++nY)
{
if (nY<=nY1)
@ -577,17 +572,13 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
aBitmapDevice.DrawRect(Rectangle(Point(0,0), aSize));
#endif
OSL_TRACE("filled background after %fms",(aTimer.getElapsedTime() - nStartTime)*1000);
// Paint the border.
aBitmapDevice.SetFillColor();
aBitmapDevice.SetLineColor(mpTheme->GetColor(eColorType, Theme::Border2));
aBitmapDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border2));
aBitmapDevice.DrawRect(Rectangle(Point(0,0),aSize));
aBitmapDevice.SetLineColor(mpTheme->GetColor(eColorType, Theme::Border1));
aBitmapDevice.SetLineColor(mpTheme->GetGradientColor(eColorType, Theme::Border1));
aBitmapDevice.DrawLine(Point(0,0),Point(aSize.Width()-1,0));
OSL_TRACE("painted border after %fms",(aTimer.getElapsedTime() - nStartTime)*1000);
// Get bounding box of the preview around which a shadow is painted.
// Compensate for the border around the preview.
Rectangle aBox (mpPageObjectLayouter->GetBoundingBox(
@ -600,8 +591,6 @@ Bitmap PageObjectPainter::CreateBackgroundBitmap(
aBox.Bottom() += 1;
mpShadowPainter->PaintFrame(aBitmapDevice, aBox);
OSL_TRACE("painted shadow border after %fms",(aTimer.getElapsedTime() - nStartTime)*1000);
return aBitmapDevice.GetBitmap (Point(0,0),aSize);
}

View file

@ -150,9 +150,7 @@ ColorData Theme::GetColorForVisualState (const model::VisualState::State eState)
ColorData Theme::GetColor (
const ColorType eType,
const ColorClass eClass)
ColorData Theme::GetColor (const ColorType eType)
{
switch(eType)
{
@ -170,7 +168,19 @@ ColorData Theme::GetColor (
case Selection:
return StellaBlue;
}
return 0;
}
ColorData Theme::GetGradientColor (
const GradientColorType eType,
const GradientColorClass eClass)
{
switch(eType)
{
case NormalPage:
switch (eClass)
{

View file

@ -60,7 +60,6 @@ SLOFILES = \
$(SLO)$/SlsLayouter.obj \
$(SLO)$/SlsPageObjectLayouter.obj \
$(SLO)$/SlsPageObjectPainter.obj \
$(SLO)$/SlsSelectionPainter.obj \
$(SLO)$/SlsTheme.obj \
$(SLO)$/SlsViewCacheContext.obj \
$(SLO)$/SlsViewOverlay.obj