banshee r5182 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Widgets



Author: alexk
Date: Thu Apr  2 21:45:19 2009
New Revision: 5182
URL: http://svn.gnome.org/viewvc/banshee?rev=5182&view=rev

Log:
2009-04-02  Alexander Kojevnikov  <alexander kojevnikov com>

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs:
	* src/Libraries/Hyena.Gui/Hyena.Gui/RatingRenderer.cs:
	* src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs: Changed the
	RatingEntry widget to make it easier to edit and reset the ratings.

Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/RatingRenderer.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs	Thu Apr  2 21:45:19 2009
@@ -54,8 +54,9 @@
             // FIXME: Compute font height and set to renderer.Size
 
             renderer.Value = Value;
+            bool is_hovering = hover_bound == BoundObjectParent && hover_bound != null;
             renderer.Render (context.Context, area, context.Theme.Colors.GetWidgetColor (GtkColorClass.Text, state), 
-                hover_bound == BoundObjectParent && hover_bound != null, hover_value, 0.8, 0.45, 0.35);
+                is_hovering, is_hovering, hover_value, 0.8, 0.45, 0.35);
             
             // FIXME: Something is hosed in the view when computing cell dimensions
             // The cell width request is always smaller than the actual cell, so

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/RatingRenderer.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/RatingRenderer.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/RatingRenderer.cs	Thu Apr  2 21:45:19 2009
@@ -52,8 +52,8 @@
         {
         }
         
-        public virtual void Render (Context cr, Gdk.Rectangle area, Color color, bool isHovering, int hoverValue, 
-            double fillOpacity, double hoverFillOpacity, double strokeOpacity)
+        public virtual void Render (Context cr, Gdk.Rectangle area, Color color, bool showEmptyStars, bool isHovering,
+            int hoverValue, double fillOpacity, double hoverFillOpacity, double strokeOpacity)
         {
             if (!(Value > MinRating || (Value == MinRating && isHovering))) {
                 return;
@@ -72,7 +72,7 @@
             cr.LineWidth = 1.0;
             cr.Translate (0.5, 0.5);
                     
-            for (int i = MinRating + 1, s = isHovering ? MaxRating : Value; i <= s; i++, x += Size) {
+            for (int i = MinRating + 1, s = isHovering || showEmptyStars ? MaxRating : Value; i <= s; i++, x += Size) {
                 bool fill = i <= Value && Value > MinRating;
                 bool hover_fill = i <= hoverValue && hoverValue > MinRating;
                 double scale = fill || hover_fill ? Size : Size - 2;
@@ -90,7 +90,11 @@
                 cr.ClosePath ();
                 
                 if (fill || hover_fill) {
-                    cr.Color = fill ? fill_color : hover_fill_color;
+                    if (!isHovering || hoverValue >= Value) {
+                        cr.Color = fill ? fill_color : hover_fill_color;
+                    } else {
+                        cr.Color = hover_fill ? fill_color : hover_fill_color;
+                    }
                     cr.Fill ();
                 } else {
                     cr.Color = stroke_color;

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RatingEntry.cs	Thu Apr  2 21:45:19 2009
@@ -257,9 +257,9 @@
             Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow);
             renderer.Render (cr, Allocation, 
                 CairoExtensions.GdkColorToCairoColor (HasFrame ? Style.Text (State) : Style.Foreground (State)), 
-                AlwaysShowEmptyStars || (PreviewOnHover && hover_value >= renderer.MinRating), hover_value,
+                AlwaysShowEmptyStars, PreviewOnHover && hover_value >= renderer.MinRating, hover_value,
                 State == StateType.Insensitive ? 1 : 0.90, 
-                State == StateType.Insensitive ? 1 : 0.65, 
+                State == StateType.Insensitive ? 1 : 0.55,
                 State == StateType.Insensitive ? 1 : 0.45);
             ((IDisposable)cr.Target).Dispose ();
             ((IDisposable)cr).Dispose ();



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