banshee r3740 - in trunk/banshee: . src/Backends/Banshee.Hal src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Core/Banshee.Widgets/Banshee.Widgets src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets



Author: abock
Date: Thu Apr 10 01:45:52 2008
New Revision: 3740
URL: http://svn.gnome.org/viewvc/banshee?rev=3740&view=rev

Log:
2008-04-09  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs:
    * src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs:
    Fix DPI and size request issues

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
    Use the generic CreateLayout cairo method in CairoExtensions

    * src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs: Moved the
    CreateLayout method from the list view to this utils class

    * src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs: Added OnUnrealized



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Backends/Banshee.Hal/Makefile.am
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
   trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs

Modified: trunk/banshee/src/Backends/Banshee.Hal/Makefile.am
==============================================================================
--- trunk/banshee/src/Backends/Banshee.Hal/Makefile.am	(original)
+++ trunk/banshee/src/Backends/Banshee.Hal/Makefile.am	Thu Apr 10 01:45:52 2008
@@ -7,9 +7,9 @@
 	Banshee.HalBackend/BlockDevice.cs \
 	Banshee.HalBackend/CdromDevice.cs \
 	Banshee.HalBackend/Device.cs \
+	Banshee.HalBackend/DeviceMediaCapabilities.cs \
 	Banshee.HalBackend/DiscVolume.cs \
 	Banshee.HalBackend/DiskDevice.cs \
-	Banshee.HalBackend/DeviceMediaCapabilities.cs \
 	Banshee.HalBackend/HardwareManager.cs \
 	Banshee.HalBackend/Volume.cs \
 	Hal/Device.cs \

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs	Thu Apr 10 01:45:52 2008
@@ -174,6 +174,21 @@
             QueueDraw ();
         }
         
+        protected override void OnSizeRequested (ref Requisition requisition)
+        {
+            requisition.Height = ComputeWidgetHeight ();
+        }
+        
+        private int ComputeWidgetHeight ()
+        {
+            int width, height;
+            Pango.Layout layout = new Pango.Layout (PangoContext);
+            layout.SetText ("W");
+            layout.GetPixelSize (out width, out height);
+            layout.Dispose ();
+            return 2 * height;
+        }
+
 #endregion
 
 #region Interaction Events
@@ -379,11 +394,11 @@
             int fl_width, fl_height, sl_width, sl_height;
 
             // Set up the text layouts
-            Pango.Layout first_line_layout = PangoCairoHelper.CreateLayout (cr);
+            Pango.Layout first_line_layout = null;
+            CairoExtensions.CreateLayout (this, cr, ref first_line_layout);
             first_line_layout.Width = (int)(width * Pango.Scale.PangoScale);
             first_line_layout.Ellipsize = Pango.EllipsizeMode.End;
-            first_line_layout.FontDescription = PangoContext.FontDescription.Copy ();
-            
+                        
             Pango.Layout second_line_layout = first_line_layout.Copy ();
             
             // Compute the layout coordinates
@@ -392,6 +407,10 @@
             second_line_layout.SetMarkup (GetSecondLineText (track));
             second_line_layout.GetPixelSize (out sl_width, out sl_height);
             
+            if (fl_height + sl_height > Allocation.Height) {
+                SetSizeRequest (-1, fl_height + sl_height);
+            }
+            
             y = (Allocation.Height - (fl_height + sl_height)) / 2;
             
             // Render the layouts
@@ -404,11 +423,16 @@
             }
 
             if (!renderArtistAlbum) {
+                first_line_layout.Dispose ();
+                second_line_layout.Dispose ();
                 return;
             }
             
             cr.MoveTo (x, y + fl_height);
             PangoCairoHelper.ShowLayout (cr, second_line_layout);
+            
+            first_line_layout.Dispose ();
+            second_line_layout.Dispose ();
         }
         
         public new void QueueDraw ()

Modified: trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs	Thu Apr 10 01:45:52 2008
@@ -89,6 +89,10 @@
             int width, height;
             layout.GetPixelSize (out width, out height);
             
+            if (width > Allocation.Width) {
+                WidthRequest = width;
+            }
+            
             int x = Allocation.X + ((Allocation.Width - width) / 2);
             int y = Allocation.Y + ((Allocation.Height - HeightRequest) / 2);
             Gdk.Rectangle rect = evnt.Area;

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	Thu Apr 10 01:45:52 2008
@@ -66,22 +66,6 @@
             get { return theme; }
         }
         
-        private void CreateLayout (Cairo.Context cairo_context)
-        {
-            if (pango_layout != null) {
-                pango_layout.Dispose ();
-            }
-            
-            pango_layout = PangoCairoHelper.CreateLayout (cairo_context);
-            pango_layout.FontDescription = PangoContext.FontDescription.Copy ();
-            
-            double resolution = Screen.Resolution;
-            if (resolution != -1) {
-                Pango.Context context = PangoCairoHelper.LayoutGetContext (pango_layout);
-                PangoCairoHelper.ContextSetResolution (context, resolution);
-            }
-        }
-        
         protected override void OnStyleSet (Gtk.Style old_style)
         {
             base.OnStyleSet (old_style);
@@ -139,7 +123,7 @@
             cairo_context.Rectangle (clip.X, clip.Y, clip.Width, clip.Height);
             cairo_context.Clip ();
             
-            CreateLayout (cairo_context);
+            CairoExtensions.CreateLayout (this, cairo_context, ref pango_layout);
             Theme.DrawHeaderBackground (cairo_context, header_rendering_alloc);
             
             Rectangle cell_area = new Rectangle ();
@@ -241,7 +225,7 @@
             // Build a cairo context for the primary canvas.
             Cairo.Context tmp_cr = cairo_context;
             cairo_context = CairoHelper.Create (canvas1);
-            CreateLayout (cairo_context);
+            CairoExtensions.CreateLayout (this, cairo_context, ref pango_layout);
             
             // Render the background to the primary canvas.
             Theme.DrawListBackground (cairo_context, canvas_alloc, true);

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CairoExtensions.cs	Thu Apr 10 01:45:52 2008
@@ -48,6 +48,22 @@
     
     public static class CairoExtensions
     {
+        public static void CreateLayout (Gtk.Widget widget, Cairo.Context cairo_context, ref Pango.Layout layout)
+        {
+            if (layout != null) {
+                layout.Dispose ();
+            }
+            
+            layout = PangoCairoHelper.CreateLayout (cairo_context);
+            layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
+            
+            double resolution = widget.Screen.Resolution;
+            if (resolution != -1) {
+                Pango.Context context = PangoCairoHelper.LayoutGetContext (layout);
+                PangoCairoHelper.ContextSetResolution (context, resolution);
+            }
+        }
+    
         public static Cairo.Color GdkColorToCairoColor(Gdk.Color color)
         {
             return GdkColorToCairoColor(color, 1.0);

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs	Thu Apr 10 01:45:52 2008
@@ -84,6 +84,12 @@
             GdkWindow = Parent.GdkWindow;
         }
         
+        protected override void OnUnrealized ()
+        {
+            WidgetFlags &= ~(WidgetFlags.Realized | WidgetFlags.NoWindow);
+            GdkWindow = null;
+        }
+        
         protected override void OnSizeRequested (ref Requisition requisition)
         {
             requisition = size_widget.SizeRequest ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]