banshee r3717 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3717 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Tue, 8 Apr 2008 06:05:59 +0100 (BST)
Author: abock
Date: Tue Apr 8 06:05:58 2008
New Revision: 3717
URL: http://svn.gnome.org/viewvc/banshee?rev=3717&view=rev
Log:
2008-04-08 Aaron Bockover <abock gnome org>
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs:
Properly calculate the row height based on actual pango layout calculations
so that the row height will adapt to DPI changes
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
Recalculate the header size when DPI changes
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellAlbum.cs Tue Apr 8 06:05:58 2008
@@ -39,14 +39,10 @@
public class ColumnCellAlbum : ColumnCell
{
private static int pixbuf_spacing = 4;
+ private static int pixbuf_size = 48;
- private static Gdk.Pixbuf default_cover_pixbuf = IconThemeUtils.LoadIcon (48, "media-optical");
+ private static Gdk.Pixbuf default_cover_pixbuf = IconThemeUtils.LoadIcon (pixbuf_size, "media-optical");
- public int ComputeRowHeight (Widget widget)
- {
- return 54;
- }
-
private ArtworkManager artwork_manager;
public ColumnCellAlbum () : base (null, true)
@@ -66,11 +62,7 @@
AlbumInfo album = (AlbumInfo)BoundObject;
- int pixbuf_size = (int)cellHeight - 8;
- bool is_default = false;
- int x = pixbuf_spacing;
- int y = ((int)cellHeight - pixbuf_size) / 2;
-
+ bool is_default = false;
Gdk.Pixbuf pixbuf = artwork_manager == null ? null : artwork_manager.LookupScale (album.ArtworkId, pixbuf_size);
if (pixbuf == null) {
@@ -78,8 +70,13 @@
is_default = true;
}
- ArtworkRenderer.RenderThumbnail (context.Context, pixbuf, true, x, y, pixbuf_size, pixbuf_size,
- !is_default, context.Theme.Context.Radius);
+ // int pixbuf_render_size = is_default ? pixbuf.Height : (int)cellHeight - 8;
+ int pixbuf_render_size = pixbuf_size;
+ int x = pixbuf_spacing;
+ int y = ((int)cellHeight - pixbuf_render_size) / 2;
+
+ ArtworkRenderer.RenderThumbnail (context.Context, pixbuf, true, x, y,
+ pixbuf_render_size, pixbuf_render_size, !is_default, context.Theme.Context.Radius);
int fl_width = 0, fl_height = 0, sl_width = 0, sl_height = 0;
@@ -131,5 +128,30 @@
Style.PaintLayout (context.Widget.Style, context.Drawable, state, true, context.Clip, context.Widget, "text",
context.Area.X + x, context.Area.Y + y + fl_height, second_line_layout);
}
+
+ public int ComputeRowHeight (Widget widget)
+ {
+ int height;
+ int text_w, text_h;
+
+ Pango.Layout layout = new Pango.Layout (widget.PangoContext);
+ layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
+
+ layout.FontDescription.Weight = Pango.Weight.Bold;
+ layout.SetText ("W");
+ layout.GetPixelSize (out text_w, out text_h);
+ height = text_h;
+
+ layout.FontDescription.Weight = Pango.Weight.Normal;
+ layout.FontDescription.Size = (int)(layout.FontDescription.Size * Pango.Scale.Small);
+ layout.FontDescription.Style = Pango.Style.Italic;
+ layout.SetText ("W");
+ layout.GetPixelSize (out text_w, out text_h);
+ height += text_h;
+
+ layout.Dispose ();
+
+ return (height < pixbuf_size ? pixbuf_size : height) + 6;
+ }
}
}
\ No newline at end of file
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs Tue Apr 8 06:05:58 2008
@@ -546,6 +546,10 @@
row_height = RowHeightProvider != null
? RowHeightProvider (this)
: ColumnCellText.ComputeRowHeight (this);
+
+ header_height = 0;
+ MoveResize (Allocation);
+
RecomputeRowHeight = false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]