[Monodevelop-patches-list] r606 - in trunk/MonoDevelop: build/AddIns src/Main/Base/Internal/Codons/MenuItems src/Main/Base/Services

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Jan 20 21:24:40 EST 2004


Author: tberman
Date: 2004-01-20 21:24:39 -0500 (Tue, 20 Jan 2004)
New Revision: 606

Modified:
   trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
   trunk/MonoDevelop/src/Main/Base/Internal/Codons/MenuItems/MenuItemCodon.cs
   trunk/MonoDevelop/src/Main/Base/Services/ResourceService.cs
Log:
lil bit of stockification


Modified: trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
===================================================================
--- trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin	2004-01-21 00:31:07 UTC (rev 605)
+++ trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin	2004-01-21 02:24:39 UTC (rev 606)
@@ -358,7 +358,8 @@
 		</Conditional>
                 <MenuItem id = "SaveAs"
 	                  label = "${res:OpenFileTabEventHandler.ContextMenu.SaveAs}" 
-	                  class = "ICSharpCode.SharpDevelop.Commands.TabStrip.SaveFileAsTab"/>
+	                  icon  = "Icons.16x16.SaveAsIcon"
+			  class = "ICSharpCode.SharpDevelop.Commands.TabStrip.SaveFileAsTab"/>
 
 		<MenuItem id = "SaveSeparator" label = "-" />
                 <Conditional action="Disable">
@@ -584,7 +585,8 @@
 		                          shortcut = "Control|S"
 		                          class = "ICSharpCode.SharpDevelop.Commands.SaveFile"/>
 		                <MenuItem id = "SaveAs"
-		                          label = "${res:XML.MainMenu.FileMenu.SaveAs}" 
+		                          label = "${res:XML.MainMenu.FileMenu.SaveAs}"
+					  icon = "Icons.16x16.SaveAsIcon"
 		                          description = "${res:XML.MainMenu.FileMenu.SaveAs.Description}"
 		                          class = "ICSharpCode.SharpDevelop.Commands.SaveFileAs"/>
 		                <MenuItem id = "SaveAll"

Modified: trunk/MonoDevelop/src/Main/Base/Internal/Codons/MenuItems/MenuItemCodon.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Internal/Codons/MenuItems/MenuItemCodon.cs	2004-01-21 00:31:07 UTC (rev 605)
+++ trunk/MonoDevelop/src/Main/Base/Internal/Codons/MenuItems/MenuItemCodon.cs	2004-01-21 02:24:39 UTC (rev 606)
@@ -138,7 +138,7 @@
 			
 			if (Icon != null && newItem is SdMenuCommand) {
 				ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-				((SdMenuCommand)newItem).Image = new Gtk.Image(resourceService.GetBitmap(Icon));
+				((SdMenuCommand)newItem).Image = resourceService.GetImage(Icon, Gtk.IconSize.Menu);
 			}
 			
 			if (newItem is SdMenuCommand) {

Modified: trunk/MonoDevelop/src/Main/Base/Services/ResourceService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/ResourceService.cs	2004-01-21 00:31:07 UTC (rev 605)
+++ trunk/MonoDevelop/src/Main/Base/Services/ResourceService.cs	2004-01-21 02:24:39 UTC (rev 606)
@@ -46,6 +46,7 @@
 		{
 			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
 			resourceDirctory = propertyService.DataDirectory + Path.DirectorySeparatorChar + "resources";
+			CreateStockMapping ();
 		}
 		
 		Hashtable userStrings = null;
@@ -56,7 +57,21 @@
 		
 		Hashtable localStrings = null;
 		Hashtable localIcons   = null;
-		
+
+		static Hashtable stockMappings = null;
+
+		static void CreateStockMapping ()
+		{
+			stockMappings = new Hashtable ();
+			stockMappings["Icons.16x16.DeleteIcon"] = Gtk.Stock.Delete;
+			stockMappings["Icons.16x16.OpenFile"] = Gtk.Stock.Open;
+			stockMappings["Icons.16x16.SaveIcon"] = Gtk.Stock.Save;
+			stockMappings["Icons.16x16.SaveAsIcon"] = Gtk.Stock.SaveAs;
+			stockMappings["Icons.16x16.PasteIcon"] = Gtk.Stock.Paste;
+			stockMappings["Icons.16x16.CopyIcon"] = Gtk.Stock.Copy;
+			stockMappings["Icons.16x16.CutIcon"] = Gtk.Stock.Cut;
+		}
+
 		void ChangeProperty(object sender, PropertyEventArgs e)
 		{
 			if (e.Key == uiLanguageProperty && e.OldValue != e.NewValue) {
@@ -261,8 +276,6 @@
 			}
 */			
 			Gdk.Pixbuf b = new Gdk.Pixbuf("../data/resources/icons/" + name);
-			Debug.Assert(b != null, "Resource " + name);
-			
 			return b;
 			
 		}
@@ -291,9 +304,16 @@
 			Gdk.Pixbuf b = (Gdk.Pixbuf)icon.GetObject(name);
 			*/
 			Gdk.Pixbuf b = new Gdk.Pixbuf("../data/resources/icons/" + name);
-			Debug.Assert(b != null, "Resource " + name);
 			
 			return b;
 		}
+
+		public Gtk.Image GetImage (string name, Gtk.IconSize size)
+		{
+			string stock = (string)stockMappings[name];
+			if (stock != null)
+				return new Gtk.Image (stock, size);
+			return new Gtk.Image (GetBitmap (name));
+		}
 	}
 }




More information about the Monodevelop-patches-list mailing list