Author: jacobilsoe
Date: 2006-09-19 17:01:04 -0400 (Tue, 19 Sep 2006)
New Revision: 65686

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs
Log:
        Added caching of icons. Removed namespace column
        and added the namespace to the class column instead.

2006-09-19 Jacob Ils?\195?\184 Christensen <[EMAIL PROTECTED]>

        * MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs:


Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2006-09-19 
20:30:57 UTC (rev 65685)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2006-09-19 
21:01:04 UTC (rev 65686)
@@ -1,6 +1,12 @@
 2006-09-19 Jacob Ilsø Christensen <[EMAIL PROTECTED]>
 
        * MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs:
+       Added caching of icons. Removed namespace column
+       and added the namespace to the class column instead.
+
+2006-09-19 Jacob Ilsø Christensen <[EMAIL PROTECTED]>
+
+       * MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs:
        Added icons.
 
 2006-09-19 Jacob Ilsø Christensen <[EMAIL PROTECTED]>

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs
   2006-09-19 20:30:57 UTC (rev 65685)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GotoClassDialog.cs
   2006-09-19 21:01:04 UTC (rev 65686)
@@ -18,6 +18,7 @@
 
 using System;
 using System.Collections;
+using System.Collections.Generic;
 
 using MonoDevelop.Ide.Gui;
 using MonoDevelop.Projects;
@@ -31,10 +32,13 @@
        public class GotoClassDialog : Gtk.Dialog
        {
                protected Gtk.TreeView treeview1;
+               private Dictionary<string, Pixbuf> icons;
                
                public GotoClassDialog()
                {
                        Stetic.Gui.Build(this, typeof(GotoClassDialog));
+                       
+                       icons = new Dictionary<string, Pixbuf>();
                        SetupTreeView();                                        
                                                                        
                }
                
@@ -53,20 +57,13 @@
                        classNameColumn.PackStart(cellRenderer, true);
                        classNameColumn.AddAttribute(cellRenderer, "text", 1);  
                
                        treeview1.AppendColumn(classNameColumn);                
        
-                       
-                       TreeViewColumn nameSpaceColumn = new TreeViewColumn();
-                       nameSpaceColumn.Title = "Namespace";                    
-                       cellRenderer = new CellRendererText();
-                       nameSpaceColumn.PackStart(cellRenderer, true);
-                       nameSpaceColumn.AddAttribute(cellRenderer, "text", 2);  
                        
-                       treeview1.AppendColumn(nameSpaceColumn);
-                       
+                                       
                        foreach (CombineEntry combineEntry in 
IdeApp.ProjectOperations.CurrentOpenCombine.Entries)
                        {
                                AddClassesToTreeView(combineEntry, listStore);
                        }                                       
                        
-                       treeModelSort.SetSortColumnId(1, SortType.Ascending);
+                       treeModelSort.SetSortColumnId(2, SortType.Ascending);
                        treeModelSort.ChangeSortColumn();                       
                }
 
@@ -85,12 +82,23 @@
                                IParserContext ctx = 
IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext(project);
 
                                foreach (IClass c in ctx.GetProjectContents())
-                               {                                               
                                                
-                                       
listStore.AppendValues(treeview1.RenderIcon(Services.Icons.GetIcon(c), 
Gtk.IconSize.Menu, ""), c.Name, c.Namespace, c.Region);
+                               {                                               
                                
+                                       Pixbuf pixbuf = 
GetIcon(Services.Icons.GetIcon(c));                             
+                                       listStore.AppendValues(pixbuf, c.Name + 
" (" + c.Namespace + " namespace)", c.Name, c.Region);
                                }
                        }
                }
 
+               private Pixbuf GetIcon(string id)
+               {                                       
+                       if (!icons.ContainsKey(id))
+                       {
+                               icons.Add(id, treeview1.RenderIcon(id, 
IconSize.Menu, "")); 
+                       }
+               
+                       return icons[id];
+               }
+
                private void GotoClass()
                {       
                        IRegion region;
@@ -99,7 +107,7 @@
                        
                        if (treeview1.Selection.GetSelected(out model, out 
iter))
                        {
-                               region = (IRegion)model.GetValue(iter, 3);      
                  
+                               region = (IRegion)model.GetValue(iter, 3);
                        }
                        else                
                        {
@@ -131,4 +139,4 @@
                        Hide();
                }                               
        }
-}
+}
\ No newline at end of file

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to