Kaydet (Commit) d4dc0293 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Template Manager: better show the folder overlay.

Still to be improved:
 - Add some shadow
 - White background colors is may be not ideal

Change-Id: Id89320ebef8ee95ed24a844bbd98e3bd6bebc678
üst 31f1a12c
...@@ -118,10 +118,6 @@ protected: ...@@ -118,10 +118,6 @@ protected:
virtual void Resize(); virtual void Resize();
virtual void Paint( const Rectangle& rRect );
virtual void DrawItem (ThumbnailViewItem *pItem);
DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*); DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
protected: protected:
......
...@@ -225,6 +225,8 @@ public: ...@@ -225,6 +225,8 @@ public:
Color GetColor() const { return maColor; } Color GetColor() const { return maColor; }
void SetTransparence( double nTransparence );
bool IsColor() const { return maColor.GetTransparency() == 0; } bool IsColor() const { return maColor.GetTransparency() == 0; }
Size CalcWindowSizePixel(sal_uInt16 nCalcCols, sal_uInt16 nCalcLines, Size CalcWindowSizePixel(sal_uInt16 nCalcCols, sal_uInt16 nCalcLines,
...@@ -304,6 +306,7 @@ protected: ...@@ -304,6 +306,7 @@ protected:
ScrollBar* mpScrBar; ScrollBar* mpScrBar;
Rectangle maItemListRect; Rectangle maItemListRect;
long mnHeaderHeight; long mnHeaderHeight;
long mnFooterHeight;
long mnItemWidth; long mnItemWidth;
long mnItemHeight; long mnItemHeight;
long mnItemPadding; long mnItemPadding;
...@@ -321,6 +324,7 @@ protected: ...@@ -321,6 +324,7 @@ protected:
bool mbIsTransientChildrenDisabled : 1; bool mbIsTransientChildrenDisabled : 1;
bool mbHasVisibleItems : 1; bool mbHasVisibleItems : 1;
Color maColor; Color maColor;
double mnTransparence;
Link maItemStateHdl; Link maItemStateHdl;
ThumbnailItemAttributes *mpItemAttrs; ThumbnailItemAttributes *mpItemAttrs;
......
...@@ -53,6 +53,7 @@ struct ThumbnailItemAttributes ...@@ -53,6 +53,7 @@ struct ThumbnailItemAttributes
{ {
sal_uInt32 nMaxTextLenght; sal_uInt32 nMaxTextLenght;
basegfx::BColor aFillColor; basegfx::BColor aFillColor;
double nFillTransparence;
basegfx::BColor aHighlightColor; basegfx::BColor aHighlightColor;
basegfx::B2DVector aFontSize; basegfx::B2DVector aFontSize;
drawinglayer::attribute::FontAttribute aFontAttr; drawinglayer::attribute::FontAttribute aFontAttr;
......
...@@ -268,19 +268,11 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width ...@@ -268,19 +268,11 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width
void TemplateAbstractView::Resize() void TemplateAbstractView::Resize()
{ {
mpItemView->SetSizePixel(GetSizePixel()); Size aSize = GetSizePixel();
} aSize.setHeight(aSize.getHeight() * 0.5);
aSize.setWidth(aSize.getWidth() - 20);
void TemplateAbstractView::Paint(const Rectangle &rRect) Point aPos(10, 10);
{ mpItemView->SetPosSizePixel(aPos, aSize);
if (!mpItemView->IsVisible())
ThumbnailView::Paint(rRect);
}
void TemplateAbstractView::DrawItem(ThumbnailViewItem *pItem)
{
if (!mpItemView->IsVisible())
ThumbnailView::DrawItem(pItem);
} }
IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem) IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem)
......
...@@ -230,7 +230,10 @@ void TemplateLocalView::showOverlay (bool bVisible) ...@@ -230,7 +230,10 @@ void TemplateLocalView::showOverlay (bool bVisible)
} }
mpItemView->Clear(); mpItemView->Clear();
SetTransparence(0.0);
} }
else
SetTransparence(0.5);
} }
void TemplateLocalView::filterTemplatesByApp (const FILTER_APPLICATION &eApp) void TemplateLocalView::filterTemplatesByApp (const FILTER_APPLICATION &eApp)
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <sfx2/templateviewitem.hxx> #include <sfx2/templateviewitem.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
...@@ -140,7 +141,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p ...@@ -140,7 +141,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p
com::sun::star::lang::Locale(), com::sun::star::lang::Locale(),
Color(COL_BLACK).getBColor() ) ); Color(COL_BLACK).getBColor() ) );
pProcessor->process(aSeq); Primitive2DSequence aTranspSeq(1);
aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, pAttrs->nFillTransparence));
pProcessor->process(aTranspSeq);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/point/b2dpoint.hxx> #include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/vector/b2dvector.hxx> #include <basegfx/vector/b2dvector.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx>
...@@ -18,9 +20,11 @@ ...@@ -18,9 +20,11 @@
#include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <sfx2/sfxresid.hxx> #include <sfx2/sfxresid.hxx>
#include <sfx2/templateviewitem.hxx> #include <sfx2/templateviewitem.hxx>
#include <vcl/edit.hxx> #include <vcl/edit.hxx>
#include <vcl/scrbar.hxx>
#include "templateview.hrc" #include "templateview.hrc"
...@@ -39,6 +43,7 @@ TemplateView::TemplateView (Window *pParent) ...@@ -39,6 +43,7 @@ TemplateView::TemplateView (Window *pParent)
mpEditName(new Edit(this, WB_BORDER | WB_HIDE)) mpEditName(new Edit(this, WB_BORDER | WB_HIDE))
{ {
mnHeaderHeight = 30; mnHeaderHeight = 30;
mnFooterHeight = 5;
} }
TemplateView::~TemplateView () TemplateView::~TemplateView ()
...@@ -57,7 +62,7 @@ void TemplateView::Paint (const Rectangle &rRect) ...@@ -57,7 +62,7 @@ void TemplateView::Paint (const Rectangle &rRect)
ThumbnailView::Paint(rRect); ThumbnailView::Paint(rRect);
int nCount = 0; int nCount = 0;
int nMaxCount = 1; int nMaxCount = 2;
if (mbRenderTitle) if (mbRenderTitle)
++nMaxCount; ++nMaxCount;
...@@ -78,11 +83,14 @@ void TemplateView::Paint (const Rectangle &rRect) ...@@ -78,11 +83,14 @@ void TemplateView::Paint (const Rectangle &rRect)
mpItemAttrs->aFontSize.getX(), mpItemAttrs->aFontSize.getY(), mpItemAttrs->aFontSize.getX(), mpItemAttrs->aFontSize.getY(),
double( aPos.X() ), double( aPos.Y() ) ) ); double( aPos.X() ), double( aPos.Y() ) ) );
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
B2DVector aFontSize;
FontAttribute aFontAttr = getFontAttributeFromVclFont(aFontSize, rStyleSettings.GetTitleFont(), false, false);
aSeq[nCount++] = Primitive2DReference( aSeq[nCount++] = Primitive2DReference(
new TextSimplePortionPrimitive2D(aTextMatrix, new TextSimplePortionPrimitive2D(aTextMatrix,
maName,0,maName.getLength(), maName,0,maName.getLength(),
std::vector< double >( ), std::vector< double >( ),
mpItemAttrs->aFontAttr, aFontAttr,
com::sun::star::lang::Locale(), com::sun::star::lang::Locale(),
Color(COL_BLACK).getBColor() ) ); Color(COL_BLACK).getBColor() ) );
} }
...@@ -93,7 +101,7 @@ void TemplateView::Paint (const Rectangle &rRect) ...@@ -93,7 +101,7 @@ void TemplateView::Paint (const Rectangle &rRect)
aPos.Y() = (mnHeaderHeight - aImageSize.Height())/2; aPos.Y() = (mnHeaderHeight - aImageSize.Height())/2;
aPos.X() = aWinSize.Width() - aImageSize.Width() - aPos.Y(); aPos.X() = aWinSize.Width() - aImageSize.Width() - aPos.Y();
aSeq[nCount] = Primitive2DReference( new FillBitmapPrimitive2D( aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D(
createTranslateB2DHomMatrix(aPos.X(),aPos.Y()), createTranslateB2DHomMatrix(aPos.X(),aPos.Y()),
FillBitmapAttribute(maCloseImg.GetBitmapEx(), FillBitmapAttribute(maCloseImg.GetBitmapEx(),
B2DPoint(0,0), B2DPoint(0,0),
...@@ -101,6 +109,10 @@ void TemplateView::Paint (const Rectangle &rRect) ...@@ -101,6 +109,10 @@ void TemplateView::Paint (const Rectangle &rRect)
false) false)
)); ));
// TODO Draw some shadow
Rectangle aBounds(Point(0, 0), Size(aWinSize.getWidth() - 1, aWinSize.getHeight() - 1));
B2DPolygon aBoundsPolygon(Polygon(aBounds, 5, 5).getB2DPolygon());
aSeq[nCount] = Primitive2DReference( new PolyPolygonHairlinePrimitive2D(B2DPolyPolygon(aBoundsPolygon), Color(0,0,0).getBColor()));
mpProcessor->process(aSeq); mpProcessor->process(aSeq);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
...@@ -138,7 +139,10 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces ...@@ -138,7 +139,10 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
Color(COL_BLACK).getBColor() ) ); Color(COL_BLACK).getBColor() ) );
} }
pProcessor->process(aSeq); Primitive2DSequence aTranspSeq(1);
aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, pAttrs->nFillTransparence));
pProcessor->process(aTranspSeq);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
...@@ -85,6 +86,7 @@ void ThumbnailView::ImplInit() ...@@ -85,6 +86,7 @@ void ThumbnailView::ImplInit()
{ {
mpScrBar = NULL; mpScrBar = NULL;
mnHeaderHeight = 0; mnHeaderHeight = 0;
mnFooterHeight = 0;
mnItemWidth = 0; mnItemWidth = 0;
mnItemHeight = 0; mnItemHeight = 0;
mnItemPadding = 0; mnItemPadding = 0;
...@@ -100,6 +102,7 @@ void ThumbnailView::ImplInit() ...@@ -100,6 +102,7 @@ void ThumbnailView::ImplInit()
mbHasVisibleItems = false; mbHasVisibleItems = false;
maFilterFunc = ViewFilterAll(); maFilterFunc = ViewFilterAll();
maColor = GetSettings().GetStyleSettings().GetFieldColor(); maColor = GetSettings().GetStyleSettings().GetFieldColor();
mnTransparence = 0.0;
// Create the processor and process the primitives // Create the processor and process the primitives
const drawinglayer::geometry::ViewInformation2D aNewViewInfos; const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
...@@ -162,6 +165,7 @@ void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackgr ...@@ -162,6 +165,7 @@ void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackgr
mpItemAttrs = new ThumbnailItemAttributes; mpItemAttrs = new ThumbnailItemAttributes;
mpItemAttrs->aFillColor = maColor.getBColor(); mpItemAttrs->aFillColor = maColor.getBColor();
mpItemAttrs->nFillTransparence = mnTransparence;
mpItemAttrs->aHighlightColor = rStyleSettings.GetHighlightColor().getBColor(); mpItemAttrs->aHighlightColor = rStyleSettings.GetHighlightColor().getBColor();
mpItemAttrs->aFontAttr = getFontAttributeFromVclFont(mpItemAttrs->aFontSize,GetFont(),false,true); mpItemAttrs->aFontAttr = getFontAttributeFromVclFont(mpItemAttrs->aFontSize,GetFont(),false,true);
mpItemAttrs->nMaxTextLenght = -1; mpItemAttrs->nMaxTextLenght = -1;
...@@ -373,7 +377,7 @@ void ThumbnailView::CalculateItemPositions () ...@@ -373,7 +377,7 @@ void ThumbnailView::CalculateItemPositions ()
long nLines = (nCurCount+mnCols-1)/mnCols; long nLines = (nCurCount+mnCols-1)/mnCols;
Point aPos( aWinSize.Width() - nScrBarWidth - mnScrBarOffset, mnHeaderHeight ); Point aPos( aWinSize.Width() - nScrBarWidth - mnScrBarOffset, mnHeaderHeight );
Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight ); Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight - mnFooterHeight );
mpScrBar->SetPosSizePixel( aPos, aSize ); mpScrBar->SetPosSizePixel( aPos, aSize );
mpScrBar->SetRangeMax( (nCurCount+mnCols-1)/mnCols); mpScrBar->SetRangeMax( (nCurCount+mnCols-1)/mnCols);
...@@ -558,7 +562,10 @@ void ThumbnailView::Paint( const Rectangle &aRect) ...@@ -558,7 +562,10 @@ void ThumbnailView::Paint( const Rectangle &aRect)
B2DPolyPolygon(Polygon(aRect,5,5).getB2DPolygon()), B2DPolyPolygon(Polygon(aRect,5,5).getB2DPolygon()),
maColor.getBColor())); maColor.getBColor()));
mpProcessor->process(aSeq); Primitive2DSequence aTranspSeq(1);
aTranspSeq[0] = Primitive2DReference( new UnifiedTransparencePrimitive2D(aSeq, mnTransparence));
mpProcessor->process(aTranspSeq);
// draw items // draw items
for ( size_t i = 0; i < nItemCount; i++ ) for ( size_t i = 0; i < nItemCount; i++ )
...@@ -909,6 +916,15 @@ void ThumbnailView::SetColor( const Color& rColor ) ...@@ -909,6 +916,15 @@ void ThumbnailView::SetColor( const Color& rColor )
Invalidate(); Invalidate();
} }
void ThumbnailView::SetTransparence( double nTransparence )
{
mnTransparence = nTransparence;
mpItemAttrs->nFillTransparence = nTransparence;
if ( IsReallyVisible() && IsUpdateMode() )
Invalidate();
}
bool ThumbnailView::StartDrag( const CommandEvent& rCEvt, Region& rRegion ) bool ThumbnailView::StartDrag( const CommandEvent& rCEvt, Region& rRegion )
{ {
if ( rCEvt.GetCommand() != COMMAND_STARTDRAG ) if ( rCEvt.GetCommand() != COMMAND_STARTDRAG )
......
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