[Libreoffice-commits] .: Branch 'feature/template-dialog' - 5 commits - sfx2/inc sfx2/source
Rafael Dominguez
rdominguez at kemper.freedesktop.org
Mon Jun 11 21:48:15 PDT 2012
sfx2/inc/sfx2/thumbnailview.hxx | 6 -
sfx2/source/control/thumbnailview.cxx | 149 +++++++++++++---------------------
2 files changed, 61 insertions(+), 94 deletions(-)
New commits:
commit 467e2ea597ed37d63f1dd4ed0937e8a4d3d3ffc9
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Jun 12 00:18:21 2012 -0430
Disable drag&drop tracking and change item select state when clicked.
Change-Id: I7e3f6ec64ee98826d361008fed3e93cfcba39595
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 26849e9..44d0f7d 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -307,6 +307,12 @@ void ThumbnailView::DrawItem (ThumbnailViewItem *pItem, const Rectangle &aRect)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Point aPos = aRect.TopLeft();
+ const Size aSize = aRect.GetSize();
+ DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+
+ Control::SetFillColor();
+
if ( IsColor() )
maVirDev.SetFillColor( maColor );
else if ( IsEnabled() )
@@ -316,12 +322,35 @@ void ThumbnailView::DrawItem (ThumbnailViewItem *pItem, const Rectangle &aRect)
maVirDev.DrawRect( aRect );
+ if ( pItem->mbSelected )
+ {
+ Rectangle aSelRect = aRect;
+ Color aDoubleColor( rStyleSettings.GetHighlightColor() );
+
+ // specify selection output
+ aSelRect.Left() += 4;
+ aSelRect.Top() += 4;
+ aSelRect.Right() -= 4;
+ aSelRect.Bottom() -= 4;
+
+ SetLineColor( aDoubleColor );
+ aSelRect.Left()++;
+ aSelRect.Top()++;
+ aSelRect.Right()--;
+ aSelRect.Bottom()--;
+ DrawRect( aSelRect );
+ aSelRect.Left()++;
+ aSelRect.Top()++;
+ aSelRect.Right()--;
+ aSelRect.Bottom()--;
+ DrawRect( aSelRect );
+ }
+
// Draw thumbnail
Size aImageSize = pItem->maImage.GetSizePixel();
Size aRectSize = aRect.GetSize();
- Point aPos( aRect.Left(), aRect.Top() );
- aPos.X() += (aRectSize.Width()-aImageSize.Width())/2;
- aPos.Y() += (aRectSize.Height()-aImageSize.Height())/2;
+ aPos.X() = aRect.Left() + (aRectSize.Width()-aImageSize.Width())/2;
+ aPos.Y() = aRect.Top() + (aRectSize.Height()-aImageSize.Height())/2;
sal_uInt16 nImageStyle = 0;
if( !IsEnabled() )
@@ -947,33 +976,31 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
if ( rMEvt.IsLeft() )
{
ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) );
- if ( mbSelection )
+
+ if (pItem)
{
- mbHighlight = true;
- if ( pItem )
+ if ( mbSelection )
{
+ mbHighlight = true;
mnHighItemId = mnSelItemId;
ImplHighlightItem( pItem->mnId );
}
-
- return;
- }
- else
- {
- if ( pItem && !rMEvt.IsMod2() )
+ else
{
- if ( rMEvt.GetClicks() == 1 )
+ if ( !rMEvt.IsMod2() )
{
- mbHighlight = true;
- mnHighItemId = mnSelItemId;
- ImplHighlightItem( pItem->mnId );
- StartTracking( STARTTRACK_SCROLLREPEAT );
+ if ( rMEvt.GetClicks() == 1 )
+ {
+ pItem->mbSelected = !pItem->mbSelected;
+ DrawItem(pItem,GetItemRect(pItem->mnId));
+ //StartTracking( STARTTRACK_SCROLLREPEAT );
+ }
+ else if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
}
- else if ( rMEvt.GetClicks() == 2 )
- DoubleClick();
-
- return;
}
+
+ return;
}
}
commit 79a5687f62f38092796ea47f54b81ce9dd6b6358
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Jun 12 00:10:58 2012 -0430
Set MouseButtonUp and MouseButtonDown as default control action.
Change-Id: If105303bb0a4d147e12c6501d412d199f316e971
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 489858a..26849e9 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -982,18 +982,11 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
void ThumbnailView::MouseButtonUp( const MouseEvent& rMEvt )
{
- // because of SelectionMode
- if ( rMEvt.IsLeft() && mbSelection )
- ImplEndTracking( rMEvt.GetPosPixel(), false );
- else
- Control::MouseButtonUp( rMEvt );
+ Control::MouseButtonUp( rMEvt );
}
void ThumbnailView::MouseMove( const MouseEvent& rMEvt )
{
- // because of SelectionMode
- if ( mbSelection )
- ImplTracking( rMEvt.GetPosPixel(), false );
Control::MouseMove( rMEvt );
}
commit 699e7d9e4081942bb0ad73e9be73f90a26d0c2f7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Mon Jun 11 22:35:03 2012 -0430
Remove unneeded methods.
Change-Id: I094bc03dca00fcc0c157fcbb69ea781381dce088
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 28706df..95b2ea9 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -220,10 +220,6 @@ public:
bool IsNoSelection() const { return mbNoSelection; }
- void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
-
- Image GetItemImage( sal_uInt16 nItemId ) const;
-
void SetItemText( sal_uInt16 nItemId, const rtl::OUString &rStr );
rtl::OUString GetItemText( sal_uInt16 nItemId ) const;
@@ -280,8 +276,6 @@ protected:
virtual void Resize();
- virtual void RequestHelp( const HelpEvent& rHEvt );
-
virtual void StateChanged( StateChangedType nStateChange );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 27d1a4a..489858a 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -1184,29 +1184,6 @@ void ThumbnailView::Resize()
Control::Resize();
}
-void ThumbnailView::RequestHelp( const HelpEvent& rHEvt )
-{
- if ( (rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON)) == HELPMODE_QUICK )
- {
- Point aPos = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
- size_t nItemPos = ImplGetItem( aPos );
- if ( nItemPos != THUMBNAILVIEW_ITEM_NOTFOUND )
- {
- Rectangle aItemRect = ImplGetItemRect( nItemPos );
- Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
- aItemRect.Left() = aPt.X();
- aItemRect.Top() = aPt.Y();
- aPt = OutputToScreenPixel( aItemRect.BottomRight() );
- aItemRect.Right() = aPt.X();
- aItemRect.Bottom() = aPt.Y();
- Help::ShowQuickHelp( this, aItemRect, GetItemText( ImplGetItem( nItemPos )->mnId ) );
- return;
- }
- }
-
- Control::RequestHelp( rHEvt );
-}
-
void ThumbnailView::StateChanged( StateChangedType nType )
{
Control::StateChanged( nType );
@@ -1620,36 +1597,6 @@ void ThumbnailView::SetNoSelection()
ImplDraw();
}
-void ThumbnailView::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
-{
- size_t nPos = GetItemPos( nItemId );
-
- if ( nPos == THUMBNAILVIEW_ITEM_NOTFOUND )
- return;
-
- ThumbnailViewItem* pItem = mItemList[nPos];
- pItem->maImage = rImage;
-
- if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
- {
- const Rectangle aRect = ImplGetItemRect(nPos);
- DrawItem( pItem, aRect );
- Invalidate( aRect );
- }
- else
- mbFormat = true;
-}
-
-Image ThumbnailView::GetItemImage( sal_uInt16 nItemId ) const
-{
- size_t nPos = GetItemPos( nItemId );
-
- if ( nPos != THUMBNAILVIEW_ITEM_NOTFOUND )
- return mItemList[nPos]->maImage;
- else
- return Image();
-}
-
void ThumbnailView::SetItemText( sal_uInt16 nItemId, const rtl::OUString& rText )
{
size_t nPos = GetItemPos( nItemId );
commit 12558df99b864798da8d27f6bc5236159b96b881
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Mon Jun 11 22:01:16 2012 -0430
Start ThumbnailItem id from 1 instead of 0.
Change-Id: I62d3da91e7135552452c7ad9208c59cc499da19c
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 741804a..27d1a4a 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -1308,7 +1308,7 @@ void ThumbnailView::Populate ()
}
- InsertItem(i,aImg,aRegionName);
+ InsertItem(i+1,aImg,aRegionName);
}
}
}
commit 99bd77af309f3fbb18c8acb5b862bd3c3291fa5d
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Mon Jun 11 21:55:20 2012 -0430
Fix displaying folder thumbnail.
Change-Id: Ibe9c64268e4034ddbfc30735846e2fe49449bcf5
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index bb5f8b9..741804a 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -1288,15 +1288,21 @@ void ThumbnailView::Populate ()
if (nEntries)
{
/// Preview first 2 thumbnails for folder
- Image aImg = lcl_fetchThumbnail(pTemplates->GetPath(i,0),96,96);
+ Image aImg = lcl_fetchThumbnail(pTemplates->GetPath(i,0),128,128);
if ( nEntries > 2 )
{
Color aWhite(COL_WHITE);
- BitmapEx aResult = lcl_fetchThumbnail(pTemplates->GetPath(i,1),96,96).GetBitmapEx();
- BitmapEx aBmp = aImg.GetBitmapEx();
- aResult.Expand(20,20,&aWhite,sal_True);
- aResult.CopyPixel(Rectangle(24,24,106,106),Rectangle(0,0,96,96),&aBmp);
+ BitmapEx aBmp = lcl_fetchThumbnail(pTemplates->GetPath(i,1),128,128).GetBitmapEx();
+ BitmapEx aResult = aBmp;
+
+ aResult.Erase(aWhite);
+ aBmp.Scale(Size(128,128));
+ aResult.CopyPixel(Rectangle(32,4,128,100),Rectangle(0,0,96,96),&aBmp);
+
+ aBmp = aImg.GetBitmapEx();
+ aBmp.Scale(Size(96,96));
+ aResult.CopyPixel(Rectangle(10,22,106,118), Rectangle(0,0,96,96),&aBmp);
aImg = aResult;
More information about the Libreoffice-commits
mailing list