[banshee/stable-1.6] [TrackInfoDisplay] support forcing size/spacing
- From: Aaron Bockover <abock src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-1.6] [TrackInfoDisplay] support forcing size/spacing
- Date: Sun, 2 May 2010 21:31:14 +0000 (UTC)
commit b0f7ac60b128a02f7c4b6b0ecb19f7db8e051f1d
Author: Aaron Bockover <abockover novell com>
Date: Sun May 2 16:15:24 2010 -0400
[TrackInfoDisplay] support forcing size/spacing
Allow overriding the artwork size with an explicit size, instead of the
default size which is determined by the allocation height. This ensures
that regardless of the allocation, we pull a safe artwork size (e.g.
from valid scale cache).
Additionally allow for configuring the space between text and artwork.
.../Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs | 15 ++++++++++++++-
.../Banshee.Gui.Widgets/TrackInfoDisplay.cs | 13 ++++++++++---
2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs
index 67055ab..42eed54 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs
@@ -50,6 +50,7 @@ namespace Banshee.Gui.Widgets
public ClassicTrackInfoDisplay () : base ()
{
+ ArtworkSpacing = 10;
}
protected ClassicTrackInfoDisplay (IntPtr native) : base (native)
@@ -62,6 +63,18 @@ namespace Banshee.Gui.Widgets
HidePopup ();
}
+ protected override int ArtworkSizeRequest {
+ get { return artwork_size ?? base.ArtworkSizeRequest; }
+ }
+
+ private int? artwork_size;
+ public int ArtworkSize {
+ get { return ArtworkSizeRequest; }
+ set { artwork_size = value; }
+ }
+
+ public int ArtworkSpacing { get; set; }
+
#region Widget Window Management
protected override void OnRealized ()
@@ -160,7 +173,7 @@ namespace Banshee.Gui.Widgets
return;
}
- double offset = Allocation.Height + 10, y = 0;
+ double offset = ArtworkSizeRequest + ArtworkSpacing, y = 0;
double x = Allocation.X + offset;
double width = Allocation.Width - offset;
int fl_width, fl_height, sl_width, sl_height;
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
index 8816833..bfe4445 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
@@ -320,7 +320,8 @@ namespace Banshee.Gui.Widgets
protected virtual void RenderCoverArt (Cairo.Context cr, ImageSurface image)
{
- ArtworkRenderer.RenderThumbnail (cr, image, false, Allocation.X, Allocation.Y,
+ ArtworkRenderer.RenderThumbnail (cr, image, false,
+ Allocation.X, Allocation.Y + ArtworkOffset,
ArtworkSizeRequest, ArtworkSizeRequest,
!IsMissingImage (image), 0.0,
IsMissingImage (image), BackgroundColor);
@@ -328,8 +329,10 @@ namespace Banshee.Gui.Widgets
protected virtual bool IsWithinCoverart (int x, int y)
{
- return x >= Allocation.X && y >= Allocation.Y &&
- x <= (Allocation.X + ArtworkSizeRequest) && y <= (Allocation.Y + ArtworkSizeRequest);
+ return x >= Allocation.X &&
+ y >= Allocation.Y + ArtworkOffset &&
+ x <= (Allocation.X + ArtworkSizeRequest) &&
+ y <= (Allocation.Y + ArtworkOffset + ArtworkSizeRequest);
}
protected bool IsMissingImage (ImageSurface pb)
@@ -343,6 +346,10 @@ namespace Banshee.Gui.Widgets
protected abstract void RenderTrackInfo (Cairo.Context cr, TrackInfo track, bool renderTrack, bool renderArtistAlbum);
+ private int ArtworkOffset {
+ get { return (Allocation.Height - ArtworkSizeRequest) / 2; }
+ }
+
protected virtual int ArtworkSizeRequest {
get { return Allocation.Height; }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]