banshee r3484 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Extensions/Banshee.NowPlaying src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying src/Libraries/Hyena.Gui/Hyena.Gui.Theming src/Libraries/Hyena.Gui/Hyena.Widgets



Author: abock
Date: Wed Mar 19 06:39:20 2008
New Revision: 3484
URL: http://svn.gnome.org/viewvc/banshee?rev=3484&view=rev

Log:
2008-03-19  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs: Stubbed
    some stuff out to allow showing separator rows; not complete

    * src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs:
    Pack the video widget into a rounded frame to look sexy

    * src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs:

    * src/Libraries/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs: Respect ShowStroke

    * src/Libraries/Hyena.Gui/Hyena.Gui.Theming/ThemeContext.cs: Added
    ShowStroke property

    * src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs: Allow setting
    a custom fill color and the ability to hide the border/stroke



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
   trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/ThemeContext.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs

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	Wed Mar 19 06:39:20 2008
@@ -69,6 +69,8 @@
             ConfigureDragAndDrop ();
             RefreshList ();
             ConnectEvents ();
+            
+            RowSeparatorFunc = RowSeparatorHandler;
         }
         
 #region Setup Methods        
@@ -92,7 +94,7 @@
         
         private void BuildModel ()
         {
-            store = new TreeStore (typeof (Source), typeof (int));
+            store = new TreeStore (typeof (Source), typeof (int), typeof (bool));
             store.SetSortColumnId (1, SortType.Ascending);
             store.ChangeSortColumn ();
             Model = store;
@@ -279,6 +281,11 @@
             return false;
         }
         
+        private bool RowSeparatorHandler (TreeModel model, TreeIter iter)
+        {
+            return (bool)store.GetValue (iter, 2);
+        }
+        
 #endregion
 
 #region Source <-> Iter Methods
@@ -301,36 +308,67 @@
 
         private TreeIter FindSource (Source source)
         {
+            foreach (TreeIter iter in FindInModel (0, source)) {
+                return iter;
+            }
+            
+            return TreeIter.Zero;
+        }
+        
+        private IEnumerable<TreeIter> FindInModel (int column, object match)
+        {
             TreeIter iter = TreeIter.Zero;
             store.GetIterFirst (out iter);
-            return FindSource (source, iter);
+            return FindInModel (column, match, iter);
         }
         
-        private TreeIter FindSource (Source source, TreeIter iter)
+        private IEnumerable<TreeIter> FindInModel (int column, object match, TreeIter iter)
         {
             if (!store.IterIsValid (iter)) {
-                return TreeIter.Zero;
+                yield break;
             }
             
             do {
-                if ((store.GetValue (iter, 0) as Source) == source) {
-                    return iter;
+                object result = store.GetValue (iter, column);
+                Type result_type = result != null ? result.GetType () : null;
+                if (result_type != null && ((result_type.IsValueType && result.Equals (match)) || result == match)) {
+                    yield return iter;
                 }
                 
                 if (store.IterHasChild (iter)) {
                     TreeIter citer = TreeIter.Zero;
                     store.IterChildren (out citer, iter);
-                    TreeIter result = FindSource (source, citer);
-                    
-                    if (!result.Equals (TreeIter.Zero)) {
-                        return result;
+                    foreach (TreeIter yiter in FindInModel (column, match, citer)) {
+                        if (!yiter.Equals (TreeIter.Zero)) {
+                            yield return yiter;
+                        }
                     }
                 }
             } while (store.IterNext (ref iter));
+        }
+        
+        /*private void AddRowSeparator (int order)
+        {
+            TreeIter iter = store.InsertNode (order);
             
-            return TreeIter.Zero;
+            store.SetValue (iter, 0, null);
+            store.SetValue (iter, 1, order);
+            store.SetValue (iter, 2, true);
         }
-
+        
+        private void ClearRowSeparators ()
+        {
+            Queue<TreeIter> to_remove = new Queue<TreeIter> ();
+            foreach (TreeIter iter in FindInModel (2, true)) {
+                to_remove.Enqueue (iter);
+            }
+            
+            while (to_remove.Count > 0) {
+                TreeIter iter = to_remove.Dequeue ();
+                store.Remove (ref iter);
+            }
+        }*/
+        
 #endregion
 
 #region Add/Remove Sources / SourceManager interaction
@@ -360,13 +398,14 @@
             
             store.SetValue (iter, 0, source);
             store.SetValue (iter, 1, source.Order);
+            store.SetValue (iter, 2, false);
 
             lock (source.Children) {
                 foreach (Source child in source.Children) {
                     AddSource (child, iter);
                 }
             }
-
+            
             source.ChildSourceAdded += OnSourceChildSourceAdded; 
             source.ChildSourceRemoved += OnSourceChildSourceRemoved;
             source.UserNotifyUpdated += OnSourceUserNotifyUpdated;

Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.mdp	Wed Mar 19 06:39:20 2008
@@ -9,7 +9,6 @@
   </Configurations>
   <Contents>
     <File name="Banshee.NowPlaying.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Banshee.NowPlaying" subtype="Directory" buildaction="Compile" />
     <File name="Banshee.NowPlaying/NowPlayingSource.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.NowPlaying/NowPlayingInterface.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.NowPlaying/VideoDisplay.cs" subtype="Code" buildaction="Compile" />
@@ -25,6 +24,7 @@
     <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <ProjectReference type="Gac" localcopy="True" refto="Mono.Cairo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
   </References>
   <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
     <BuildFilesVar Sync="True" Name="SOURCES" />

Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingInterface.cs	Wed Mar 19 06:39:20 2008
@@ -41,13 +41,20 @@
     {   
         private NowPlayingSource source;
         private VideoDisplay video_display;
+        private Hyena.Widgets.RoundedFrame frame;
         
         public NowPlayingInterface ()
         {
             video_display = new VideoDisplay ();
             video_display.Show ();
             
-            PackStart (video_display, true, true, 0);
+            frame = new Hyena.Widgets.RoundedFrame ();
+            frame.SetFillColor (new Cairo.Color (0, 0, 0));
+            frame.DrawBorder = false;
+            frame.Add (video_display);
+            frame.Show ();
+            
+            PackStart (frame, true, true, 0);
         }
         
 #region ISourceContents

Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs	Wed Mar 19 06:39:20 2008
@@ -66,7 +66,6 @@
             video_window.UserData = Handle;
             
             video_window.SetBackPixmap (null, false);
-            Style = Style.Attach (video_window);
             
             ServiceManager.PlayerEngine.VideoWindow = video_window.Handle;
         }
@@ -91,6 +90,8 @@
             GdkWindow.UserData = Handle;
             
             video_window.Reparent (Parent.GdkWindow, Allocation.X, Allocation.Y);
+            
+            Style = Style.Attach (GdkWindow);
         }
         
         protected override void OnUnrealized ()

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs	Wed Mar 19 06:39:20 2008
@@ -162,6 +162,10 @@
             CairoExtensions.RoundedRectangle (cr, alloc.X, alloc.Y, alloc.Width, alloc.Height, Context.Radius, corners);
             cr.Fill ();
             
+            if (!Context.ShowStroke) {
+                return;
+            }
+            
             cr.LineWidth = 1.0;
             cr.Translate (0.5, 0.5);
             cr.Color = border_color;

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/ThemeContext.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/ThemeContext.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Gui.Theming/ThemeContext.cs	Wed Mar 19 06:39:20 2008
@@ -51,6 +51,12 @@
             set { line_width = value; }
         }
 
+        private bool show_stroke = true;
+        public bool ShowStroke {
+            get { return show_stroke; }
+            set { show_stroke = value; }
+        }
+
         private double x;
         public double X {
             get { return x; }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs	Wed Mar 19 06:39:20 2008
@@ -42,19 +42,38 @@
         
         private Widget child;
         private Gdk.Rectangle child_allocation;
+        private bool fill_color_set;
+        private Cairo.Color fill_color;
+        private bool draw_border = true;
         
         public RoundedFrame ()
         {
         }
         
+        public void SetFillColor (Cairo.Color color)
+        {
+            fill_color = color;
+            fill_color_set = true;
+            QueueDraw ();
+        }
+        
+        public void UnsetFillColor ()
+        {
+            fill_color_set = false;
+            QueueDraw ();
+        }
+        
+        public bool DrawBorder {
+            get { return draw_border; }
+            set { draw_border = value; QueueDraw (); }
+        }
+        
 #region Gtk.Widget Overrides
 
         protected override void OnRealized ()
         {
             base.OnRealized ();
-            
             theme = new GtkTheme (this);
-            //theme.RefreshColors ();
         }
 
         protected override void OnSizeRequested (ref Requisition requisition)
@@ -131,7 +150,15 @@
             int width = child_allocation.Width + 2 * frame_width;
             int height = child_allocation.Height + 2 * frame_width;
             
-            theme.DrawFrame (cr, new Gdk.Rectangle (x, y, width, height), true);
+            Gdk.Rectangle rect = new Gdk.Rectangle (x, y, width, height);
+            
+            theme.Context.ShowStroke = draw_border;
+            
+            if (fill_color_set) {
+                theme.DrawFrame (cr, rect, fill_color);
+            } else {
+                theme.DrawFrame (cr, rect, true);
+            }
         }
 
 #endregion



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