Author: ivanz
Date: 2007-09-02 09:29:51 -0400 (Sun, 02 Sep 2007)
New Revision: 85192
Modified:
trunk/mwf-designer/ChangeLog
trunk/mwf-designer/src/DesignTime/TypeResolutionService.cs
trunk/mwf-designer/src/Project/Workspace.cs
trunk/mwf-designer/src/UI/MainView.cs
trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs
Log:
2007-09-02 Ivan N. Zlatev <[EMAIL PROTECTED]>
* UI/ToolBoxList/ToolBoxList.cs: Rename default category
from "All Controls" to "All".
* DesignTime/TypeResolutionService.cs: Implement ReferenceAssembly.
* Project/Workspace, UI/MainView.cs: Toolbox categorization.
Modified: trunk/mwf-designer/ChangeLog
===================================================================
--- trunk/mwf-designer/ChangeLog 2007-09-02 11:58:31 UTC (rev 85191)
+++ trunk/mwf-designer/ChangeLog 2007-09-02 13:29:51 UTC (rev 85192)
@@ -1,3 +1,10 @@
+2007-09-02 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
+ * UI/ToolBoxList/ToolBoxList.cs: Rename default category
+ from "All Controls" to "All".
+ * DesignTime/TypeResolutionService.cs: Implement ReferenceAssembly.
+ * Project/Workspace, UI/MainView.cs: Toolbox categorization.
+
2007-08-31 Ivan N. Zlatev <[EMAIL PROTECTED]>
* UI/ToolBoxList/*.cs: A new fancy Toolbox. Patch by J. Pobst.
Modified: trunk/mwf-designer/src/DesignTime/TypeResolutionService.cs
===================================================================
--- trunk/mwf-designer/src/DesignTime/TypeResolutionService.cs 2007-09-02
11:58:31 UTC (rev 85191)
+++ trunk/mwf-designer/src/DesignTime/TypeResolutionService.cs 2007-09-02
13:29:51 UTC (rev 85192)
@@ -124,7 +124,7 @@
public void ReferenceAssembly (AssemblyName name)
{
- // TODO: no notimplemented exception because it is used
indirectly by the toolboxservice
+ _references.AddReference (name.FullName);
}
}
Modified: trunk/mwf-designer/src/Project/Workspace.cs
===================================================================
--- trunk/mwf-designer/src/Project/Workspace.cs 2007-09-02 11:58:31 UTC (rev
85191)
+++ trunk/mwf-designer/src/Project/Workspace.cs 2007-09-02 13:29:51 UTC (rev
85192)
@@ -99,17 +99,97 @@
}
}
+
+ private static readonly Type[] containers = new Type[] {
+ typeof (System.Windows.Forms.FlowLayoutPanel),
+ typeof (System.Windows.Forms.GroupBox),
+ typeof (System.Windows.Forms.Panel),
+ typeof (System.Windows.Forms.SplitContainer),
+ typeof (System.Windows.Forms.TabControl),
+ typeof (System.Windows.Forms.TableLayoutPanel),
+ };
+
+ private static readonly Type[] menusToolbars = new Type[] {
+ typeof (System.Windows.Forms.ContextMenuStrip),
+ typeof (System.Windows.Forms.MenuStrip),
+ typeof (System.Windows.Forms.StatusStrip),
+ typeof (System.Windows.Forms.ToolStrip),
+ typeof (System.Windows.Forms.ToolStripContainer),
+ };
+
+ private static readonly Type[] commonControls = new Type[] {
+ typeof (System.Windows.Forms.Button),
+ typeof (System.Windows.Forms.CheckBox),
+ typeof (System.Windows.Forms.CheckedListBox),
+ typeof (System.Windows.Forms.ComboBox),
+ typeof (System.Windows.Forms.DateTimePicker),
+ typeof (System.Windows.Forms.Label),
+ typeof (System.Windows.Forms.LinkLabel),
+ typeof (System.Windows.Forms.ListBox),
+ typeof (System.Windows.Forms.ListView),
+ typeof (System.Windows.Forms.MaskedTextBox),
+ typeof (System.Windows.Forms.MonthCalendar),
+ typeof (System.Windows.Forms.NotifyIcon),
+ typeof (System.Windows.Forms.NumericUpDown),
+ typeof (System.Windows.Forms.PictureBox),
+ typeof (System.Windows.Forms.ProgressBar),
+ typeof (System.Windows.Forms.RadioButton),
+ typeof (System.Windows.Forms.RichTextBox),
+ typeof (System.Windows.Forms.TextBox),
+ typeof (System.Windows.Forms.ToolTip),
+ typeof (System.Windows.Forms.TreeView),
+ typeof (System.Windows.Forms.WebBrowser),
+ };
+
+ private static readonly Type[] commonComponents = new Type[] {
+ typeof (System.ComponentModel.BackgroundWorker),
+ typeof (System.IO.FileSystemWatcher),
+ typeof (System.Diagnostics.Process),
+ typeof (System.Windows.Forms.ImageList),
+ typeof (System.Windows.Forms.HelpProvider),
+ typeof (System.IO.Ports.SerialPort),
+ typeof (System.Windows.Forms.Timer),
+ };
+
+
public List<ToolboxItem> GetToolboxItems ()
{
List<ToolboxItem> list = new List<ToolboxItem>();
+
foreach (Assembly assembly in _references.Assemblies)
foreach (Type type in assembly.GetTypes())
- if (IsValidType (type) && HasValidCtor
(type))
+ if (IsValidToolType (type) &&
HasPublicEmptyCtor (type))
list.Add (new ToolboxItem
(type));
+
+
+ foreach (Type type in commonComponents) {
+ ToolboxItem tool = new ToolboxItem (type);
+ tool.Properties["Category"] = "Common
Components";
+ list.Add (tool);
+ }
+
+ foreach (Type type in menusToolbars) {
+ ToolboxItem tool = new ToolboxItem (type);
+ tool.Properties["Category"] = "Menus and
Toolbars";
+ list.Add (tool);
+ }
+
+ foreach (Type type in commonControls) {
+ ToolboxItem tool = new ToolboxItem (type);
+ tool.Properties["Category"] = "Common Controls";
+ list.Add (tool);
+ }
+
+ foreach (Type type in containers) {
+ ToolboxItem tool = new ToolboxItem (type);
+ tool.Properties["Category"] = "Containers";
+ list.Add (tool);
+ }
+
return list;
}
- private bool HasValidCtor (Type type)
+ private bool HasPublicEmptyCtor (Type type)
{
bool result = false;
ConstructorInfo[] ctors = type.GetConstructors ();
@@ -121,10 +201,10 @@
return result;
}
- private bool IsValidType (Type type)
+ private bool IsValidToolType (Type type)
{
ToolboxItemAttribute toolboxAttribute =
TypeDescriptor.GetAttributes (type)[typeof (ToolboxItemAttribute)] as
ToolboxItemAttribute;
- if (toolboxAttribute != ToolboxItemAttribute.None &&
+ if (toolboxAttribute.ToolboxItemTypeName !=
ToolboxItemAttribute.None.ToolboxItemTypeName &&
!type.IsAbstract && !type.IsInterface &&
((type.Attributes & TypeAttributes.Public) ==
TypeAttributes.Public) &&
((type.Attributes &
TypeAttributes.NestedFamily) != TypeAttributes.NestedFamily) &&
Modified: trunk/mwf-designer/src/UI/MainView.cs
===================================================================
--- trunk/mwf-designer/src/UI/MainView.cs 2007-09-02 11:58:31 UTC (rev
85191)
+++ trunk/mwf-designer/src/UI/MainView.cs 2007-09-02 13:29:51 UTC (rev
85192)
@@ -115,8 +115,13 @@
private void PopulateToolbox (ToolBoxList toolbox, References
references)
{
toolbox.Clear ();
- foreach (ToolboxItem item in _workspace.GetToolboxItems
())
- toolbox.AddToolboxItem (item);
+ foreach (ToolboxItem item in _workspace.GetToolboxItems
()) {
+ string category = (string)
item.Properties["Category"];
+ if (category != null)
+ toolbox.AddToolboxItem (item, category);
+ else
+ toolbox.AddToolboxItem (item);
+ }
}
private void LoadDocument (string file, Workspace workspace)
Modified: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-09-02
11:58:31 UTC (rev 85191)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-09-02
13:29:51 UTC (rev 85192)
@@ -1,3 +1,30 @@
+//
+// Authors:
+// Jonathan Pobst ([EMAIL PROTECTED]>)
+//
+// (C) 2007 Jonathan Pobst
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -142,7 +169,7 @@
public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem)
{
- AddToolboxItem (toolboxItem, "All Controls");
+ AddToolboxItem (toolboxItem, "All");
}
public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches