banshee r3640 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: scottp
Date: Tue Apr  1 21:47:04 2008
New Revision: 3640
URL: http://svn.gnome.org/viewvc/banshee?rev=3640&view=rev

Log:
This fixes BGO #525453

* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs:
Set the indicator column's min and max width to 30.

* src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs: Add constructor
that takes min and max width (we need C# 3! Object initialization
FTW).

* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
Added support for MaxWidth. Some scenearios are still not supported
but I'll get the corner cases later.

Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs	Tue Apr  1 21:47:04 2008
@@ -55,7 +55,7 @@
             SortableColumn artist_column = new SortableColumn (Catalog.GetString ("Artist"), new ColumnCellText ("ArtistName", true), 0.225, "Artist", true);
 
             column_controller.AddRange (
-                new Column (null, "indicator", new ColumnCellPlaybackIndicator (null), 0.05, true),
+                new Column (null, "indicator", new ColumnCellPlaybackIndicator (null), 0.05, true, 30, 30),
                 new SortableColumn (Catalog.GetString ("Track"), new ColumnCellTrackNumber ("TrackNumber", true), 0.10, "Track", true),
                 new SortableColumn (Catalog.GetString ("Title"), new ColumnCellText ("TrackTitle", true), 0.25, "Title", true),
                 artist_column,

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/Column.cs	Tue Apr  1 21:47:04 2008
@@ -73,8 +73,15 @@
         }
         
         public Column (ColumnCell header_cell, string title, ColumnCell cell, double width, bool visible)
+            : this (header_cell, title, cell, width, visible, 0, Int32.MaxValue)
+        {
+        }
+        
+        public Column (ColumnCell header_cell, string title, ColumnCell cell, double width, bool visible, int minWidth, int maxWidth)
             : base (cell.Property, title, width, visible)
         {
+            this.minWidth = minWidth;
+            this.maxWidth = maxWidth;
             this.header_cell = header_cell;
             PackStart(cell);
         }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	Tue Apr  1 21:47:04 2008
@@ -44,6 +44,7 @@
             public int X2;
             public int Width;
             public int MinWidth;
+            public int MaxWidth;
             public int ResizeX1;
             public int ResizeX2;
             public int Index;
@@ -164,12 +165,13 @@
                     }
                 }
                 
-                int min_width = 25;
+                int min_width = column_cache[i].Column.MinWidth;
                 IHeaderCell header_cell = column_cache[i].Column.HeaderCell as IHeaderCell;
                 if (header_cell != null) {
                     min_width = header_cell.MinWidth;
                 }
                 column_cache[i].MinWidth = min_width;
+                column_cache[i].MaxWidth = column_cache[i].Column.MaxWidth;
                 min_header_width += column_cache[i].MinWidth = Math.Max (min_width, column_cache[i].Column.MinWidth);
             }
             
@@ -219,10 +221,15 @@
                 double delta = total_width * percent;
                 
                 // TODO handle max widths
-                if (column_cache[i].ElasticWidth + delta < column_cache[i].MinWidth) {
+                double width = column_cache[i].ElasticWidth + delta;
+                if (width < column_cache[i].MinWidth) {
                     delta = column_cache[i].MinWidth - column_cache[i].ElasticWidth;
                     elastic_columns.RemoveAt (index);
                     index--;
+                } else if (width > column_cache[i].MaxWidth) {
+                    delta = column_cache[i].MaxWidth - column_cache[i].ElasticWidth;
+                    elastic_columns.RemoveAt (index);
+                    index--;
                 }
                 
                 remaining_width -= delta;



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