+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
//
-// 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);
}
}
}
//
-// 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);
}
}
}
//
-// 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;
}
}
}
//
-// 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;
}
}
}
//
-// 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;
}
}
}
//
-// 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);
}
}
}
//
-// 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);
+ }
}
}
}
+
//
-// 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);
}
}
}
//
-// 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);
}
}
}
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*