checkin for Andreas Nahr <ClassDevelopment@A-SoftTech.com>, see ChangeLog for details
authorAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>
Sat, 21 Jun 2003 18:38:39 +0000 (18:38 -0000)
committerAlexandre Pigolkine <pigolkine@mono-cvs.ximian.com>
Sat, 21 Jun 2003 18:38:39 +0000 (18:38 -0000)
svn path=/trunk/mcs/; revision=15541

mcs/class/System.Drawing.Design/ChangeLog
mcs/class/System.Drawing.Design/System.Drawing.Design/BitmapEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/ColorEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/ContentAlignmentEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/CursorEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/FontEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/FontNameEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/IconEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/ImageEditor.cs
mcs/class/System.Drawing.Design/System.Drawing.Design/MetafileEditor.cs
mcs/class/System.Drawing.Design/makefile.gnu

index be8ff58d836b3e0a631b10115c96a60ce6677535..0ea1043c0cf73ea31cc6580074098309267536fb 100644 (file)
@@ -1,3 +1,7 @@
+2003-06-17  Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
+       * Added System.Windows.Forms to makefile.gnu
+
 2003-04-07  Martin Willemoes Hansen <mwh@sysrq.dk>
 
        * Stubed rest of System.Drawing.Design
index c637778d67c9ed623b87feed9770b7ec37ee371a..473b4e8021fc26c965ecca40448cbed429d977ca 100644 (file)
@@ -1,43 +1,39 @@
 //
-// System.Drawing.Design.BitmapEditor
-//
+// System.Drawing.Design.BitmapEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
 using System.IO;
-
+using System.Drawing;
 namespace System.Drawing.Design
 {
        public class BitmapEditor : ImageEditor
        {
-               [MonoTODO]
+
                public BitmapEditor()
                {
                }
 
                protected override string[] GetExtensions()
                {
-                       throw new NotImplementedException();
+                       return new string[] {"*.bmp", "*.gif", "*.jpg", "*.jpeg", "*.png", "*.ico"};
                }
 
-               [MonoTODO]
                protected override string GetFileDialogDescription()
                {
-                       throw new NotImplementedException();
+                       // FIXME: Add multilanguage support
+                       return "All bitmap files";
                }
 
-               [MonoTODO]
                protected override Image LoadFromStream (Stream stream)
                {
-                       throw new NotImplementedException();
-               }
-
-               [MonoTODO]
-               ~BitmapEditor()
-               {
+                       return new Bitmap (stream);
                }
        }
 }
index e4d7c08230eae05c2db2f1547d55c0eb6c9f6402..f04e5c103bdc9685d464276a7108efe9ebfc08d2 100644 (file)
@@ -1,49 +1,54 @@
 //
-// System.Drawing.Design.ColorEditor
-//
+// System.Drawing.Design.ColorEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
+using System.Drawing;
 using System.ComponentModel;
-
 namespace System.Drawing.Design
 {
        public class ColorEditor : UITypeEditor
        {
-               [MonoTODO]
+
                public ColorEditor()
                {
                }
 
                [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();
+                       // TODO IMPLEMENT
+                       return value;
                }
 
-               [MonoTODO]
                public override UITypeEditorEditStyle GetEditStyle (
-                               ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.DropDown;
                }
 
-               [MonoTODO]
                public override bool GetPaintValueSupported (
-                                    ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return true;
                }
 
-               [MonoTODO]
                public override void PaintValue (PaintValueEventArgs e)
                {
-                       throw new NotImplementedException();
+                       Graphics G = e.Graphics;
+                       if (e.Value != null)
+                       {
+                               Color C = (Color) e.Value;
+                               G.FillRectangle(new SolidBrush (C), e.Bounds);
+                       }
+                       G.DrawRectangle (Pens.Black, e.Bounds);
                }
        }
 }
index 9a62ea6fd19196562d253b78d16ba4157e6dc8c6..b9078597a3f5f8140688bf8a6d77de0b7d23878d 100644 (file)
@@ -1,36 +1,37 @@
 //
-// System.Drawing.Design.ContentAlignmentEditor
-//
+// System.Drawing.Design.ContentAlignmentEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
+using System.Drawing;
 using System.ComponentModel;
-
 namespace System.Drawing.Design
 {
        public class ContentAlignmentEditor : UITypeEditor
        {
-               [MonoTODO]
+
                public ContentAlignmentEditor()
                {
                }
 
                [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();
+                       // TODO IMPLEMENT
+                       return value;
                }
 
-               [MonoTODO]
                public override UITypeEditorEditStyle GetEditStyle (
-                               ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.DropDown;
                }
        }
 }
index 4855eba034bec42a63763ca5f83c1dfdf7799a04..22d5ee27ad62d3a70925cdabc7229d1c1e93827e 100644 (file)
@@ -1,36 +1,37 @@
 //
-// System.Drawing.Design.CursorEditor
-//
+// System.Drawing.Design.CursorEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
+using System.Drawing;
 using System.ComponentModel;
-
 namespace System.Drawing.Design
 {
        public class CursorEditor : UITypeEditor
        {
-               [MonoTODO]
+
                public CursorEditor()
                {
                }
 
                [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();
+                       // TODO IMPLEMENT
+                       return value;
                }
-                       
-               [MonoTODO]
+
                public override UITypeEditorEditStyle GetEditStyle (
-                                ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.DropDown;
                }
        }
 }
index 5aaef011e54105f4170b566f0cec15580c76a508..8a31f5c4cb76c66e015e2206c6927805c2d7b3a6 100644 (file)
@@ -1,35 +1,49 @@
 //
-// System.Drawing.Design.FontEditor
-//
+// System.Drawing.Design.FontEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
-using System.ComponentModel;
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
+using System.Drawing;
+using System.ComponentModel;using System.Windows.Forms;
 namespace System.Drawing.Design
 {
        public class FontEditor : UITypeEditor
        {
-               [MonoTODO]
+
+               private FontDialog fontEdit;
+
                public FontEditor()
                {
                }
 
-               [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();
+                       fontEdit = new FontDialog ();
+                       if (value is Font)
+                               fontEdit.Font = (Font) value;
+                       else
+                               // Set default
+                               fontEdit.Font = new Drawing.Font (FontFamily.GenericSansSerif, 12);
+
+                       fontEdit.FontMustExist = true;
+                       DialogResult result = fontEdit.ShowDialog();
+
+                       if (result == DialogResult.OK)
+                               return fontEdit.Font;
+                       else
+                               return value;
                }
 
-               [MonoTODO]
                public override UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.Modal;
                }
        }
 }
index 86bdc2072a53b25075b394fb2bb3e6d9e8b8005f..8a6c3067ee0e0c248bcbf68c9a68e510ee863fec 100644 (file)
@@ -1,33 +1,41 @@
 //
-// System.Drawing.Design.FontNameEditor
-//
+// System.Drawing.Design. FontNameEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
+using System.Drawing;
 using System.ComponentModel;
-
 namespace System.Drawing.Design
 {
        public class FontNameEditor : UITypeEditor
        {
-               [MonoTODO]
-               public FontNameEditor()
+
+               public  FontNameEditor()
                {
                }
 
-               [MonoTODO]
                public override bool GetPaintValueSupported (ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return true;
                }
 
                [MonoTODO]
                public override void PaintValue (PaintValueEventArgs e)
                {
-                       throw new NotImplementedException();
+                       // TODO may not be correct
+                       Graphics G = e.Graphics;
+                       if (e.Value != null)
+                       {
+                               Font F = (Font) e.Value;
+                               G.DrawString("Ab", F, Brushes.Black, e.Bounds);
+                       }
+                       G.DrawRectangle (Pens.Black, e.Bounds);
                }
        }
 }
index b59452786900fb5d95ebf5869944d90c67d56a4b..bf295cc3e1ca9c413f0cccdaa3d247b049f91323 100644 (file)
 //
-// System.Drawing.Design.IconEditor
-//
+// System.Drawing.Design.IconEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
-using System.ComponentModel;
+// (C) 2003 Andreas Nahr
+// 
+using System;
 using System.IO;
+using System.Drawing;
+using System.ComponentModel;
+using System.Windows.Forms;
 
 namespace System.Drawing.Design
 {
+       // Strange thing that this is not inherited from ImageEditor
        public class IconEditor : UITypeEditor
        {
-               [MonoTODO]
+
+               private OpenFileDialog openDialog;
+
                public IconEditor()
                {
                }
 
-               [MonoTODO]
-               protected static string CreateExtensionsString (string[] extensions,
-                                                               string sep)
+               protected static string CreateExtensionsString (string[] extensions, string sep)
                {
-                       throw new NotImplementedException();
+                       if (extensions.Length > 0)
+                       {
+                               string Ext = extensions[0];
+                               for (int x = 1; x < extensions.Length - 1; x++)
+                                       Ext = string.Concat(Ext, sep, extensions[x]);
+                               return Ext;
+                       }
+                       else
+                       {
+                               return string.Empty;
+                       }
                }
 
-               [MonoTODO]
                protected static string CreateFilterEntry (IconEditor e)
                {
-                       throw new NotImplementedException();
+                       string ExtStr = CreateExtensionsString (e.GetExtensions(), ";");
+                       string Desc = e.GetFileDialogDescription() + " (" + ExtStr + ")";
+                       return String.Concat (Desc, "|", ExtStr);
                }
 
-               [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();
+                       openDialog = new OpenFileDialog();
+                       // FIXME: Add multilanguage support
+                       openDialog.Title = "Open image file";
+                       openDialog.CheckFileExists = true;
+                       openDialog.CheckPathExists = true;
+                       openDialog.Filter = CreateFilterEntry (this);
+                       openDialog.Multiselect = false;
+
+                       // Show the dialog
+                       DialogResult result = openDialog.ShowDialog();
+
+                       // Check the result and create a new image from the file
+                       if (result == DialogResult.OK)
+                       {
+                               return LoadFromStream (openDialog.OpenFile());
+                       }
+                       else
+                               return value;
                }
 
-               [MonoTODO]
                public override UITypeEditorEditStyle GetEditStyle (
-                               ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.Modal;
                }
 
-               [MonoTODO]
                protected virtual string[] GetExtensions()
                {
-                       throw new NotImplementedException();
+                       return new string[] {"*.ico"};
                }
 
-               [MonoTODO]
                protected virtual string GetFileDialogDescription()
                {
-                       throw new NotImplementedException();
+                       // FIXME: Add multilanguage support
+                       return "Icon files";
                }
 
-               [MonoTODO]
                public override bool GetPaintValueSupported (
-                                    ITypeDescriptorContext context)
+                       ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return true;
                }
 
-               [MonoTODO]
                protected virtual Icon LoadFromStream (Stream stream)
                {
-                       throw new NotImplementedException();
+                       return new Icon (stream);
                }
 
-               [MonoTODO]
                public override void PaintValue (PaintValueEventArgs e)
                {
-                       throw new NotImplementedException();
+                       Graphics G = e.Graphics;
+                       G.DrawRectangle (Pens.Black, e.Bounds);
+                       if (e.Value != null)
+                       {
+                               Image I = (Image) e.Value;
+                               G.DrawImage (I, e.Bounds);
+                       }
                }
        }
 }
+
index 58f12a55feb21fb7cee8c48a19c5643e7c10ae0e..3766308d7ed5274a188b8c3ef5a065591c09f0d1 100644 (file)
 //
-// System.Drawing.Design.ImageEditor
-//
+// System.Drawing.Design.ImageEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
 using System.IO;
+using System.Drawing;
 using System.ComponentModel;
+using System.Windows.Forms;
 
 namespace System.Drawing.Design
 {
        public class ImageEditor : UITypeEditor
        {
-               [MonoTODO]
+
+               private OpenFileDialog openDialog;
+
                public ImageEditor()
                {
                }
 
-               [MonoTODO]
                public override object EditValue (ITypeDescriptorContext context,
-                                                 IServiceProvider provider,
-                                                 object value)
+                       IServiceProvider provider, object value)
                {
-                       throw new NotImplementedException();    
+                       openDialog = new OpenFileDialog();
+                       // FIXME: Add multilanguage support
+                       openDialog.Title = "Open image file";
+                       openDialog.CheckFileExists = true;
+                       openDialog.CheckPathExists = true;
+                       openDialog.Filter = CreateFilterEntry (this);
+                       openDialog.Multiselect = false;
+
+                       // Show the dialog
+                       DialogResult result = openDialog.ShowDialog();
+
+                       // Check the result and create a new image from the file
+                       if (result == DialogResult.OK)
+                       {
+                               return LoadFromStream (openDialog.OpenFile());
+                       }
+                       else
+                               return value;   
                }
 
-               [MonoTODO]
                public override UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return UITypeEditorEditStyle.Modal;
                }
 
-               [MonoTODO]
                public override bool GetPaintValueSupported (ITypeDescriptorContext context)
                {
-                       throw new NotImplementedException();
+                       return true;
                }
 
-               [MonoTODO]
                public override void PaintValue (PaintValueEventArgs e)
                {
-                       throw new NotImplementedException();
+                       Graphics G = e.Graphics;
+                       if (e.Value != null)
+                       {
+                               Image I = (Image) e.Value;
+                               G.DrawImage (I, e.Bounds);
+                       }
+                       G.DrawRectangle (Pens.Black, e.Bounds);
                }
 
-               [MonoTODO]
                protected static string CreateExtensionsString (string[] extensions, string sep)
                {
-                       throw new NotImplementedException();
+                       if (extensions.Length > 0)
+                       {
+                               string Ext = extensions[0];
+                               for (int x = 1; x < extensions.Length - 1; x++)
+                                       Ext = string.Concat(Ext, sep, extensions[x]);
+                               return Ext;
+                       }
+                       else
+                       {
+                               return string.Empty;
+                       }
                }
 
-               [MonoTODO]
                protected static string CreateFilterEntry (ImageEditor e)
                {
-                       throw new NotImplementedException();
+                       string ExtStr = CreateExtensionsString (e.GetExtensions(), ";");
+                       string Desc = e.GetFileDialogDescription() + " (" + ExtStr + ")";
+                       return String.Concat (Desc, "|", ExtStr);
                }
 
-               [MonoTODO]
                protected virtual string[] GetExtensions()
                {
-                       throw new NotImplementedException();
+                       return new string[] {"*.bmp", "*.gif", "*.jpg", "*.jpeg", "*.png", "*.ico", "*.emf", "*.wmf"};
                }
 
-               [MonoTODO]
                protected virtual string GetFileDialogDescription()
                {
-                       throw new NotImplementedException();
+                       // FIXME: Add multilanguage support
+                       return "All image files";
                }
 
-               [MonoTODO]
                protected virtual Image LoadFromStream (Stream stream)
                {
-                       throw new NotImplementedException();
-               }
-
-               [MonoTODO]
-               ~ImageEditor()
-               {
+                       return new Bitmap (stream);
                }
        }
 }
index 09085ea9acefb0546df8ab29342f08d92babfe96..b73aef05de0dad05b800b5be79a6d4ae9d3ce922 100644 (file)
@@ -1,39 +1,39 @@
 //
-// System.Drawing.Design.MetafileEditor
-//
+// System.Drawing.Design.MetafileEditor.cs
+// 
 // Authors:
-//      Martin Willemoes Hansen (mwh@sysrq.dk)
-//
+//  Martin Willemoes Hansen (mwh@sysrq.dk)
+//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// 
 // (C) 2003 Martin Willemoes Hansen
-//
-
+// (C) 2003 Andreas Nahr
+// 
+using System;
 using System.IO;
-
+using System.Drawing.Imaging;
 namespace System.Drawing.Design
 {
        public class MetafileEditor : ImageEditor
        {
-               [MonoTODO]
+
                public MetafileEditor()
                {
                }
 
-               [MonoTODO]
                protected override string[] GetExtensions()
                {
-                       throw new NotImplementedException();
+                       return new string[] {"*.emf", "*.wmf"};
                }
 
-               [MonoTODO]
                protected override string GetFileDialogDescription()
                {
-                       throw new NotImplementedException();
+                       // FIXME: Add multilanguage support
+                       return "All metafile files";
                }
 
-               [MonoTODO]
                protected override Image LoadFromStream (Stream stream)
                {
-                       throw new NotImplementedException();
+                       return new Metafile (stream);
                }
        }
 }
index 4dd6b139cd3dd23a997cb79e6be4a4c769696ce5..081106ec8713752206d40c86456a0462bb4590be 100644 (file)
@@ -3,7 +3,7 @@ topdir = ../..
 LIBRARY = $(topdir)/class/lib/System.Drawing.Design.dll
 
 LIB_LIST = list.unix
-LIB_FLAGS = -r corlib -r System -r System.Drawing
+LIB_FLAGS = -r corlib -r System -r System.Drawing -r System.Windows.Forms
 
 SOURCES_INCLUDE=*.cs
 SOURCES_EXCLUDE=./Test*