Merge pull request #5010 from Unity-Technologies/boehm-gc-alloc-fixed-sre
[mono.git] / mcs / class / System.Drawing / System.Drawing.Printing / PageSettings.cs
index 0d08d76b27533a271be64b9cdfdd56fe13c5b031..330ba62a2d8e2053cf1b03aaa959f9e4236b595a 100644 (file)
@@ -37,11 +37,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Drawing.Printing
 {
-#if NET_2_0
        [Serializable]
-#else
-       [ComVisible (false)]
-#endif
        public class PageSettings : ICloneable
        {
                internal bool color;
@@ -52,11 +48,12 @@ namespace System.Drawing.Printing
 
                // create a new default Margins object (is 1 inch for all margins)
                Margins margins = new Margins();
-\r
-               float hardMarginX;\r
+#pragma warning disable 649
+               float hardMarginX;
                float hardMarginY;
-               RectangleF printableArea;
+               RectangleF printableArea;               
                PrinterSettings printerSettings;
+#pragma warning restore 649
                
                public PageSettings() : this(new PrinterSettings())
                {
@@ -77,7 +74,6 @@ namespace System.Drawing.Printing
                internal PageSettings(PrinterSettings printerSettings, bool color, bool landscape, PaperSize paperSize, PaperSource paperSource, PrinterResolution printerResolution)
                {
                        PrinterSettings = printerSettings;
-                       
                        this.color = color;
                        this.landscape = landscape;
                        this.paperSize = paperSize;
@@ -144,7 +140,8 @@ namespace System.Drawing.Printing
                                return paperSize;
                        }
                        set{
-                               paperSize = value;
+                               if (value != null)
+                                       paperSize = value;
                        }
                }
                
@@ -155,7 +152,8 @@ namespace System.Drawing.Printing
                                return paperSource;
                        }
                        set{
-                               paperSource = value;
+                               if (value != null)
+                                       paperSource = value;
                        }
                }
                
@@ -166,7 +164,8 @@ namespace System.Drawing.Printing
                                return printerResolution;
                        }
                        set{
-                               printerResolution = value;
+                               if (value != null)
+                                       printerResolution = value;
                        }
                }
                
@@ -178,13 +177,12 @@ namespace System.Drawing.Printing
                                printerSettings = value;
                        }
                }               
-#if NET_2_0
                public float HardMarginX {
                        get {
                                return hardMarginX;
                        }
                }
-               \r
+               
                public float HardMarginY {
                        get {
                                return hardMarginY;
@@ -196,16 +194,15 @@ namespace System.Drawing.Printing
                                return printableArea;
                        }
                }
-#endif\r
 
 
                public object Clone ()
                {
                        // We do a deep copy
-                       PrinterResolution pres = new PrinterResolution (this.printerResolution.X, this.printerResolution.Y, this.printerResolution.Kind);
-                       PaperSource psource = new PaperSource (this.paperSource.SourceName, this.paperSource.Kind);
+                       PrinterResolution pres = new PrinterResolution (this.printerResolution.Kind, this.printerResolution.X, this.printerResolution.Y);
+                       PaperSource psource = new PaperSource (this.paperSource.Kind, this.paperSource.SourceName);
                        PaperSize psize = new PaperSize (this.paperSize.PaperName, this.paperSize.Width, this.paperSize.Height);
-                       psize.SetKind (this.paperSize.Kind);
+                       psize.RawKind = (int)this.paperSize.Kind;
 
                        PageSettings ps = new PageSettings (this.printerSettings, this.color, this.landscape,
                                        psize, psource, pres);