Author: spouliot
Date: 2007-02-28 09:30:40 -0500 (Wed, 28 Feb 2007)
New Revision: 73550

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing/Font.cs
   trunk/mcs/class/System.Drawing/System.Drawing/SystemFonts.cs
Log:
2007-02-28  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * Font.cs: Remove internal SysFontName setter property and add a new
        ctor to replace it.
        * SystemFonts.cs: We can't cache font instance (because anyone can
        dispose them) so we must return new instances each time.



Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2007-02-28 
14:09:09 UTC (rev 73549)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2007-02-28 
14:30:40 UTC (rev 73550)
@@ -1,3 +1,10 @@
+2007-02-28  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * Font.cs: Remove internal SysFontName setter property and add a new
+       ctor to replace it.
+       * SystemFonts.cs: We can't cache font instance (because anyone can
+       dispose them) so we must return new instances each time.
+
 2007-02-27  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * Bitmap.cs: Removed unrequired ctors.

Modified: trunk/mcs/class/System.Drawing/System.Drawing/Font.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Font.cs       2007-02-28 
14:09:09 UTC (rev 73549)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Font.cs       2007-02-28 
14:30:40 UTC (rev 73550)
@@ -364,7 +364,13 @@
                {
                        CreateFont(familyName, emSize, style, unit, charSet, 
isVertical);
                }
-
+#if NET_2_0
+               internal Font (string familyName, float emSize, string 
systemName)
+                       : this (familyName, emSize, FontStyle.Regular, 
GraphicsUnit.Point, DefaultCharSet, false)
+               {
+                       systemFontName = systemName;
+               }
+#endif
                public object Clone ()
                {
                        return new Font (this, Style);
@@ -376,14 +382,6 @@
                        }
                }
 
-#if NET_2_0
-               internal string SysFontName {
-                       set {
-                               systemFontName = value;
-                       }
-               }
-#endif
-
                private bool _bold;
 
                [DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]

Modified: trunk/mcs/class/System.Drawing/System.Drawing/SystemFonts.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/SystemFonts.cs        
2007-02-28 14:09:09 UTC (rev 73549)
+++ trunk/mcs/class/System.Drawing/System.Drawing/SystemFonts.cs        
2007-02-28 14:30:40 UTC (rev 73550)
@@ -1,5 +1,5 @@
 //
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2005, 2007 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -21,39 +21,22 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 // Authors:
+//     Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+//     Sebastien Pouliot  <[EMAIL PROTECTED]>
 //
-//   Jordi Mas i Hernandez <[EMAIL PROTECTED]>
-//
-//
 
 #if NET_2_0
 
-using System;
-using System.Runtime.Serialization;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
+namespace System.Drawing {
 
-namespace System.Drawing
-{
-       public sealed class SystemFonts
-       {
-               private static Font caption = null;
-               private static Font defaultfnt = null;
-               private static Font dialog = null;
-               private static Font icon = null;
-               private static Font menu = null;
-               private static Font message = null;
-               private static Font smallcaption = null;
-               private static Font status = null;
+       public sealed class SystemFonts {
                
                static SystemFonts ()
                {
-
                }
 
                private SystemFonts()
                {
-
                }
 
                public static Font GetFontByName (string name)
@@ -86,85 +69,37 @@
                }
 
                public static Font CaptionFont { 
-                       get {
-                               if (caption == null) {
-                                       caption = new Font ("Microsoft Sans 
Serif", 11);
-                                       caption.SysFontName = "CaptionFont";
-                               }
-                               return caption;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"CaptionFont"); }
                }
 
                public static Font DefaultFont  { 
-                       get {
-                               if (defaultfnt == null) {
-                                       defaultfnt = new Font ("Microsoft Sans 
Serif", 8.25f);
-                                       defaultfnt.SysFontName = "DefaultFont";
-                               }
-                               return defaultfnt;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 8.25f, 
"DefaultFont"); }
                }
 
                public static Font DialogFont  { 
-                       get {
-                               if (dialog == null) {
-                                       dialog = new Font ("Tahoma", 8);
-                                       dialog.SysFontName = "DialogFont";
-                               }
-                               return dialog;
-                       }                       
+                       get { return new Font ("Tahoma", 8, "DialogFont"); }
                }
 
                public static Font IconTitleFont  { 
-                       get {
-                               if (icon == null) {
-                                       icon = new Font ("Microsoft Sans 
Serif", 11);   
-                                       icon.SysFontName = "IconTitleFont";
-                               }
-                               return icon;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"IconTitleFont"); }
                }
 
                public static Font MenuFont  { 
-                       get {
-                               if (menu == null) {
-                                       menu = new Font ("Microsoft Sans 
Serif", 11);
-                                       menu.SysFontName = "MenuFont";
-                               }
-                               return menu;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"MenuFont"); }
                }
 
                public static Font MessageBoxFont  { 
-                       get {
-                               if (message == null) {
-                                       message = new Font ("Microsoft Sans 
Serif", 11);
-                                       message.SysFontName = "MessageBoxFont";
-                               }
-                               return message;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"MessageBoxFont"); }
                }
 
                public static Font SmallCaptionFont  { 
-                       get {
-                               if (smallcaption == null) {
-                                       smallcaption = new Font ("Microsoft 
Sans Serif", 11);
-                                       smallcaption.SysFontName = 
"SmallCaptionFont";
-                               }
-                               return smallcaption;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"SmallCaptionFont"); }
                }
 
                public static Font StatusFont  { 
-                       get {
-                               if (status == null) {
-                                       status = new Font ("Microsoft Sans 
Serif", 11);
-                                       status.SysFontName = "StatusFont";
-                               }
-                               return status;
-                       }                       
+                       get { return new Font ("Microsoft Sans Serif", 11, 
"StatusFont"); }
                }             
        }
 }
 
-#endif
\ No newline at end of file
+#endif

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

Reply via email to