banshee r3088 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui



Author: abock
Date: Tue Jan 29 23:26:56 2008
New Revision: 3088
URL: http://svn.gnome.org/viewvc/banshee?rev=3088&view=rev

Log:
2008-01-29  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs:
    Draw the same cairo selections that the track list view uses, overriding
    the crappy GTK selection for the tree view

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs:
    Set up a cairo context and list view graphics for the renderer



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	Tue Jan 29 23:26:56 2008
@@ -87,7 +87,16 @@
                 return;
             }
             
-            if(path != null && path.Equals (view.HighlightedPath) && !view.Selection.PathIsSelected (path)) {
+            bool path_selected = view.Selection.PathIsSelected (path);
+            
+            if (path_selected) {
+                // clear the standard GTK selection
+                drawable.DrawRectangle (widget.Style.BaseGC (StateType.Normal), true, background_area);
+                
+                // draw the hot cairo selection
+                view.Graphics.DrawRowSelection (view.Cr, background_area.X, background_area.Y + 1, 
+                    background_area.Width, background_area.Height - 2);
+            } else if(path != null && path.Equals (view.HighlightedPath)) {
                 drawable.DrawRectangle (widget.Style.BackgroundGC (StateType.Selected), false,
                     new Gdk.Rectangle (background_area.X + 1, background_area.Y + 1, 
                         background_area.Width - 3, background_area.Height - 4));

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	Tue Jan 29 23:26:56 2008
@@ -31,6 +31,10 @@
 using Mono.Unix;
 using Gtk;
 using Gdk;
+using Cairo;
+
+using Hyena.Gui;
+using Hyena.Data.Gui;
 
 using Banshee.ServiceStack;
 using Banshee.Sources;
@@ -47,6 +51,9 @@
         private TreeIter newPlaylistIter = TreeIter.Zero;
         private bool newPlaylistVisible = false;
         
+        private ListViewGraphics graphics;
+        private Cairo.Context cr;
+        
         private TreeStore store;
         private TreeViewColumn focus_column;
         private SourceRowRenderer renderer;
@@ -114,6 +121,29 @@
                 QueueDraw();
             };
         }
+        
+        protected override void OnRealized ()
+        {
+            base.OnRealized ();
+            
+            graphics = new ListViewGraphics (this);
+            graphics.RefreshColors ();
+        }
+        
+        protected override bool OnExposeEvent (EventExpose evnt)
+        {
+            cr = Gdk.CairoHelper.Create (evnt.Window);
+            cr.Rectangle (evnt.Area.X, evnt.Area.Y, evnt.Area.Width, evnt.Area.Width);
+            cr.Clip ();
+            
+            try {
+                return base.OnExposeEvent (evnt);
+            } finally {
+                ((IDisposable)cr.Target).Dispose ();
+                ((IDisposable)cr).Dispose ();
+                cr = null;
+            }
+        }
 
         private TreeIter FindSource(Source source)
         {
@@ -585,7 +615,6 @@
         
         public void HighlightPath(TreePath path)
         {
-            //Selection.SelectPath(path);
             highlight_path = path;
             QueueDraw ();
         }
@@ -612,6 +641,14 @@
         internal TreePath HighlightedPath {
             get { return highlight_path; }
         }
+        
+        internal Cairo.Context Cr {
+            get { return cr; }
+        }
+        
+        internal ListViewGraphics Graphics {
+            get { return graphics; }
+        }
 
         private bool editing_row = false;
         public bool EditingRow {



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