Visual Designer:

* Objects can now be dragged from the object list onto the designer & a new tab will be created for each object.
This commit is contained in:
Scionwest_cp 2009-11-14 08:59:18 -08:00
parent 12f5776d21
commit 8fde0bcc43
4 changed files with 211 additions and 173 deletions

View file

@ -28,23 +28,47 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panelTitleBar = new System.Windows.Forms.Panel(); this.panelTitleBar = new System.Windows.Forms.Panel();
this.btnClose = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button();
this.lblTitle = new System.Windows.Forms.Label(); this.lblTitle = new System.Windows.Forms.Label();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panelTitleBar.SuspendLayout(); this.panelTitleBar.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panelTitleBar);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.flowLayoutPanel1);
this.splitContainer1.Size = new System.Drawing.Size(229, 228);
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.TabIndex = 0;
//
// panelTitleBar // panelTitleBar
// //
this.panelTitleBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.panelTitleBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.panelTitleBar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panelTitleBar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTitleBar.Controls.Add(this.btnClose); this.panelTitleBar.Controls.Add(this.btnClose);
this.panelTitleBar.Controls.Add(this.lblTitle); this.panelTitleBar.Controls.Add(this.lblTitle);
this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Top; this.panelTitleBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelTitleBar.Location = new System.Drawing.Point(0, 0); this.panelTitleBar.Location = new System.Drawing.Point(0, 0);
this.panelTitleBar.Name = "panelTitleBar"; this.panelTitleBar.Name = "panelTitleBar";
this.panelTitleBar.Size = new System.Drawing.Size(229, 25); this.panelTitleBar.Size = new System.Drawing.Size(229, 25);
this.panelTitleBar.TabIndex = 0; this.panelTitleBar.TabIndex = 1;
// //
// btnClose // btnClose
// //
@ -59,7 +83,6 @@
this.btnClose.TabIndex = 1; this.btnClose.TabIndex = 1;
this.btnClose.Text = "X"; this.btnClose.Text = "X";
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// lblTitle // lblTitle
// //
@ -74,16 +97,27 @@
this.lblTitle.Size = new System.Drawing.Size(0, 18); this.lblTitle.Size = new System.Drawing.Size(0, 18);
this.lblTitle.TabIndex = 0; this.lblTitle.TabIndex = 0;
// //
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(229, 199);
this.flowLayoutPanel1.TabIndex = 5;
//
// VisualContainer // VisualContainer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Gray; this.BackColor = System.Drawing.Color.Gray;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.panelTitleBar); this.Controls.Add(this.splitContainer1);
this.Name = "VisualContainer"; this.Name = "VisualContainer";
this.Size = new System.Drawing.Size(229, 228); this.Size = new System.Drawing.Size(229, 228);
this.Load += new System.EventHandler(this.Container_Load); this.Load += new System.EventHandler(this.Container_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.panelTitleBar.ResumeLayout(false); this.panelTitleBar.ResumeLayout(false);
this.panelTitleBar.PerformLayout(); this.panelTitleBar.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -92,8 +126,11 @@
#endregion #endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel panelTitleBar; private System.Windows.Forms.Panel panelTitleBar;
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Label lblTitle;
public System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
} }
} }

View file

@ -27,6 +27,11 @@ namespace VisualComponents
set { lblTitle.Text = value; } set { lblTitle.Text = value; }
} }
public void AddControl(Control control)
{
this.flowLayoutPanel1.Controls.Add(control);
}
public VisualContainer() public VisualContainer()
{ {
InitializeComponent(); InitializeComponent();

View file

@ -29,38 +29,32 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.containerMain = new System.Windows.Forms.SplitContainer(); this.containerMain = new System.Windows.Forms.SplitContainer();
this.ObjectList = new VisualComponents.VisualContainer(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.containerProperties = new System.Windows.Forms.SplitContainer(); this.containerProperties = new System.Windows.Forms.SplitContainer();
this.VisualEditor = new VisualComponents.VisualContainer(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tabDesigner = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.page1 = new System.Windows.Forms.TabPage();
this.containerLeftPane = new System.Windows.Forms.SplitContainer(); this.containerLeftPane = new System.Windows.Forms.SplitContainer();
this.ObjectExplorer = new VisualComponents.VisualContainer(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tabExplorer = new System.Windows.Forms.TabControl(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.treeView1 = new System.Windows.Forms.TreeView();
this.Properties = new VisualComponents.VisualContainer();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.containerMain.Panel1.SuspendLayout(); this.containerMain.Panel1.SuspendLayout();
this.containerMain.Panel2.SuspendLayout(); this.containerMain.Panel2.SuspendLayout();
this.containerMain.SuspendLayout(); this.containerMain.SuspendLayout();
this.ObjectList.SuspendLayout(); this.groupBox1.SuspendLayout();
this.containerProperties.Panel1.SuspendLayout(); this.containerProperties.Panel1.SuspendLayout();
this.containerProperties.Panel2.SuspendLayout(); this.containerProperties.Panel2.SuspendLayout();
this.containerProperties.SuspendLayout(); this.containerProperties.SuspendLayout();
this.VisualEditor.SuspendLayout(); this.groupBox2.SuspendLayout();
this.tabDesigner.SuspendLayout(); this.tabControl1.SuspendLayout();
this.containerLeftPane.Panel1.SuspendLayout(); this.containerLeftPane.Panel1.SuspendLayout();
this.containerLeftPane.Panel2.SuspendLayout(); this.containerLeftPane.Panel2.SuspendLayout();
this.containerLeftPane.SuspendLayout(); this.containerLeftPane.SuspendLayout();
this.ObjectExplorer.SuspendLayout(); this.groupBox4.SuspendLayout();
this.tabExplorer.SuspendLayout();
this.tabPage1.SuspendLayout();
this.Properties.SuspendLayout();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -72,27 +66,33 @@
// //
// containerMain.Panel1 // containerMain.Panel1
// //
this.containerMain.Panel1.Controls.Add(this.ObjectList); this.containerMain.Panel1.Controls.Add(this.groupBox1);
// //
// containerMain.Panel2 // containerMain.Panel2
// //
this.containerMain.Panel2.Controls.Add(this.containerProperties); this.containerMain.Panel2.Controls.Add(this.containerProperties);
this.containerMain.Size = new System.Drawing.Size(1050, 589); this.containerMain.Size = new System.Drawing.Size(1050, 589);
this.containerMain.SplitterDistance = 112; this.containerMain.SplitterDistance = 133;
this.containerMain.TabIndex = 0; this.containerMain.TabIndex = 0;
// //
// ObjectList // groupBox1
// //
this.ObjectList.BackColor = System.Drawing.Color.Gray; this.groupBox1.Controls.Add(this.flowLayoutPanel1);
this.ObjectList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ObjectList.Controls.Add(this.flowLayoutPanel1); this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.ObjectList.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Name = "groupBox1";
this.ObjectList.IsClosable = false; this.groupBox1.Size = new System.Drawing.Size(133, 589);
this.ObjectList.Location = new System.Drawing.Point(0, 0); this.groupBox1.TabIndex = 0;
this.ObjectList.Name = "ObjectList"; this.groupBox1.TabStop = false;
this.ObjectList.Size = new System.Drawing.Size(112, 589); this.groupBox1.Text = "Object Library";
this.ObjectList.TabIndex = 0; //
this.ObjectList.Title = "Object Toolbox"; // flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 16);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(127, 570);
this.flowLayoutPanel1.TabIndex = 0;
// //
// containerProperties // containerProperties
// //
@ -103,47 +103,49 @@
// //
// containerProperties.Panel1 // containerProperties.Panel1
// //
this.containerProperties.Panel1.Controls.Add(this.VisualEditor); this.containerProperties.Panel1.Controls.Add(this.groupBox2);
// //
// containerProperties.Panel2 // containerProperties.Panel2
// //
this.containerProperties.Panel2.Controls.Add(this.containerLeftPane); this.containerProperties.Panel2.Controls.Add(this.containerLeftPane);
this.containerProperties.Size = new System.Drawing.Size(934, 589); this.containerProperties.Size = new System.Drawing.Size(913, 589);
this.containerProperties.SplitterDistance = 683; this.containerProperties.SplitterDistance = 667;
this.containerProperties.TabIndex = 0; this.containerProperties.TabIndex = 0;
// //
// VisualEditor // groupBox2
// //
this.VisualEditor.BackColor = System.Drawing.Color.Gray; this.groupBox2.Controls.Add(this.tabControl1);
this.VisualEditor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.VisualEditor.Controls.Add(this.tabDesigner); this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.VisualEditor.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Name = "groupBox2";
this.VisualEditor.IsClosable = false; this.groupBox2.Size = new System.Drawing.Size(665, 587);
this.VisualEditor.Location = new System.Drawing.Point(0, 0); this.groupBox2.TabIndex = 0;
this.VisualEditor.Name = "VisualEditor"; this.groupBox2.TabStop = false;
this.VisualEditor.Size = new System.Drawing.Size(681, 587); this.groupBox2.Text = "Visual Designer";
this.VisualEditor.TabIndex = 1;
this.VisualEditor.Title = "Visual Editor";
// //
// tabDesigner // tabControl1
// //
this.tabDesigner.Controls.Add(this.tabPage2); this.tabControl1.AllowDrop = true;
this.tabDesigner.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Controls.Add(this.page1);
this.tabDesigner.Location = new System.Drawing.Point(0, 0); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabDesigner.Name = "tabDesigner"; this.tabControl1.Location = new System.Drawing.Point(3, 16);
this.tabDesigner.SelectedIndex = 0; this.tabControl1.Name = "tabControl1";
this.tabDesigner.Size = new System.Drawing.Size(679, 585); this.tabControl1.SelectedIndex = 0;
this.tabDesigner.TabIndex = 2; this.tabControl1.Size = new System.Drawing.Size(659, 568);
this.tabControl1.TabIndex = 0;
// //
// tabPage2 // page1
// //
this.tabPage2.BackColor = System.Drawing.Color.Silver; this.page1.AllowDrop = true;
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.page1.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.page1.Name = "page1";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.page1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(671, 559); this.page1.Size = new System.Drawing.Size(651, 542);
this.tabPage2.TabIndex = 0; this.page1.TabIndex = 0;
this.tabPage2.Text = "tabPage2"; this.page1.Text = "Empty";
this.page1.UseVisualStyleBackColor = true;
this.page1.DragDrop += new System.Windows.Forms.DragEventHandler(this.page1_DragDrop);
this.page1.DragEnter += new System.Windows.Forms.DragEventHandler(this.page1_DragEnter);
// //
// containerLeftPane // containerLeftPane
// //
@ -154,79 +156,43 @@
// //
// containerLeftPane.Panel1 // containerLeftPane.Panel1
// //
this.containerLeftPane.Panel1.Controls.Add(this.ObjectExplorer); this.containerLeftPane.Panel1.Controls.Add(this.groupBox3);
// //
// containerLeftPane.Panel2 // containerLeftPane.Panel2
// //
this.containerLeftPane.Panel2.Controls.Add(this.Properties); this.containerLeftPane.Panel2.Controls.Add(this.groupBox4);
this.containerLeftPane.Size = new System.Drawing.Size(245, 587); this.containerLeftPane.Size = new System.Drawing.Size(240, 587);
this.containerLeftPane.SplitterDistance = 297; this.containerLeftPane.SplitterDistance = 297;
this.containerLeftPane.TabIndex = 0; this.containerLeftPane.TabIndex = 0;
// //
// ObjectExplorer // groupBox3
// //
this.ObjectExplorer.BackColor = System.Drawing.Color.Gray; this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.ObjectExplorer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.groupBox3.Location = new System.Drawing.Point(0, 0);
this.ObjectExplorer.Controls.Add(this.tabExplorer); this.groupBox3.Name = "groupBox3";
this.ObjectExplorer.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox3.Size = new System.Drawing.Size(240, 297);
this.ObjectExplorer.IsClosable = false; this.groupBox3.TabIndex = 1;
this.ObjectExplorer.Location = new System.Drawing.Point(0, 0); this.groupBox3.TabStop = false;
this.ObjectExplorer.Name = "ObjectExplorer"; this.groupBox3.Text = "Project Explorer";
this.ObjectExplorer.Size = new System.Drawing.Size(245, 297);
this.ObjectExplorer.TabIndex = 0;
this.ObjectExplorer.Title = "Project Explorer";
// //
// tabExplorer // groupBox4
// //
this.tabExplorer.Alignment = System.Windows.Forms.TabAlignment.Bottom; this.groupBox4.Controls.Add(this.propertyGrid1);
this.tabExplorer.Controls.Add(this.tabPage1); this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabExplorer.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox4.Location = new System.Drawing.Point(0, 0);
this.tabExplorer.Location = new System.Drawing.Point(0, 0); this.groupBox4.Name = "groupBox4";
this.tabExplorer.Name = "tabExplorer"; this.groupBox4.Size = new System.Drawing.Size(240, 286);
this.tabExplorer.SelectedIndex = 0; this.groupBox4.TabIndex = 1;
this.tabExplorer.Size = new System.Drawing.Size(243, 295); this.groupBox4.TabStop = false;
this.tabExplorer.TabIndex = 2; this.groupBox4.Text = "Object Properties";
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.Silver;
this.tabPage1.Controls.Add(this.treeView1);
this.tabPage1.Location = new System.Drawing.Point(4, 4);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(235, 269);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Project Objects";
//
// treeView1
//
this.treeView1.BackColor = System.Drawing.Color.Silver;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.Location = new System.Drawing.Point(3, 3);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(229, 263);
this.treeView1.TabIndex = 3;
//
// Properties
//
this.Properties.BackColor = System.Drawing.Color.Gray;
this.Properties.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Properties.Controls.Add(this.propertyGrid1);
this.Properties.Dock = System.Windows.Forms.DockStyle.Fill;
this.Properties.IsClosable = false;
this.Properties.Location = new System.Drawing.Point(0, 0);
this.Properties.Name = "Properties";
this.Properties.Size = new System.Drawing.Size(245, 286);
this.Properties.TabIndex = 1;
this.Properties.Title = "Properties";
// //
// propertyGrid1 // propertyGrid1
// //
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid1.Location = new System.Drawing.Point(0, 0); this.propertyGrid1.Location = new System.Drawing.Point(3, 16);
this.propertyGrid1.Name = "propertyGrid1"; this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(243, 284); this.propertyGrid1.Size = new System.Drawing.Size(234, 267);
this.propertyGrid1.TabIndex = 2; this.propertyGrid1.TabIndex = 0;
// //
// menuStrip1 // menuStrip1
// //
@ -256,16 +222,9 @@
this.closeToolStripMenuItem.Text = "Close"; this.closeToolStripMenuItem.Text = "Close";
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click); this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
// //
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 25);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(110, 562);
this.flowLayoutPanel1.TabIndex = 3;
//
// frmMain // frmMain
// //
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1050, 613); this.ClientSize = new System.Drawing.Size(1050, 613);
@ -280,19 +239,16 @@
this.containerMain.Panel1.ResumeLayout(false); this.containerMain.Panel1.ResumeLayout(false);
this.containerMain.Panel2.ResumeLayout(false); this.containerMain.Panel2.ResumeLayout(false);
this.containerMain.ResumeLayout(false); this.containerMain.ResumeLayout(false);
this.ObjectList.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.containerProperties.Panel1.ResumeLayout(false); this.containerProperties.Panel1.ResumeLayout(false);
this.containerProperties.Panel2.ResumeLayout(false); this.containerProperties.Panel2.ResumeLayout(false);
this.containerProperties.ResumeLayout(false); this.containerProperties.ResumeLayout(false);
this.VisualEditor.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.tabDesigner.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.containerLeftPane.Panel1.ResumeLayout(false); this.containerLeftPane.Panel1.ResumeLayout(false);
this.containerLeftPane.Panel2.ResumeLayout(false); this.containerLeftPane.Panel2.ResumeLayout(false);
this.containerLeftPane.ResumeLayout(false); this.containerLeftPane.ResumeLayout(false);
this.ObjectExplorer.ResumeLayout(false); this.groupBox4.ResumeLayout(false);
this.tabExplorer.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.Properties.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -305,20 +261,17 @@
private System.Windows.Forms.SplitContainer containerMain; private System.Windows.Forms.SplitContainer containerMain;
private System.Windows.Forms.SplitContainer containerProperties; private System.Windows.Forms.SplitContainer containerProperties;
private System.Windows.Forms.SplitContainer containerLeftPane; private System.Windows.Forms.SplitContainer containerLeftPane;
private VisualComponents.VisualContainer ObjectExplorer;
private VisualComponents.VisualContainer Properties;
private VisualComponents.VisualContainer VisualEditor;
private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
private VisualComponents.VisualContainer ObjectList; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TabControl tabExplorer; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TabControl tabDesigner; private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage page1;
} }
} }

View file

@ -6,14 +6,28 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using ManagedScripting;
using MUDEngine;
using MUDEngine.Objects;
using MUDEngine.Objects.Environment;
using MUDEngine.FileSystem;
namespace VisualDesigner namespace VisualDesigner
{ {
public partial class frmMain : Form public partial class frmMain : Form
{ {
ScriptingEngine engine = new ScriptingEngine();
ScriptObject currentScript;
Type[] types;
object movingObject;
public frmMain() public frmMain()
{ {
InitializeComponent(); InitializeComponent();
engine.LoadAssembly(Application.StartupPath + "/MUDEngine.dll");
types = engine.GetAssembly.GetTypes();
currentScript = new ScriptObject();
} }
private void closeToolStripMenuItem_Click(object sender, EventArgs e) private void closeToolStripMenuItem_Click(object sender, EventArgs e)
@ -24,46 +38,75 @@ namespace VisualDesigner
private void frmMain_Load(object sender, EventArgs e) private void frmMain_Load(object sender, EventArgs e)
{ {
//Load the engine //Load the engine
System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile(Application.StartupPath + "/MUDEngine.dll"); engine.LoadAssembly(Application.StartupPath + "/MUDEngine.dll");
Type[] types = assem.GetTypes(); Type[] foundTypes = engine.GetAssembly.GetTypes();
Button button = new Button(); Button button = new Button();
this.flowLayoutPanel1.Controls.Add(button);
foreach (Type t in types) List<Type> tempTypes = new List<Type>();
ListBox lst = new ListBox();
lst.Sorted = true;
foreach (Type t in foundTypes)
{ {
if (t.BaseType.Name == "BaseObject") if (t.BaseType.Name == "BaseObject")
{ {
button = new Button(); tempTypes.Add(t);
button.Width = flowLayoutPanel1.Width - 10; lst.Items.Add(t.Name);
button.Text = t.Name;
button.Click += new EventHandler(newObject_Click);
this.flowLayoutPanel1.Controls.Add(button);
} }
} }
foreach (string t in lst.Items)
{
button = new Button();
button.Width = flowLayoutPanel1.Width - 10;
button.Text = t;
button.AllowDrop = true;
button.MouseDown += new MouseEventHandler(newObject_MouseDown);
flowLayoutPanel1.Controls.Add(button);
}
propertyGrid1.ViewForeColor = Color.Blue;
propertyGrid1.SelectedObject = engine;
} }
void newObject_Click(object sender, EventArgs e) void newObject_MouseDown(object sender, MouseEventArgs e)
{ {
Button button = (Button)sender; Button button = (Button)sender;
System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile(Application.StartupPath + "/MUDEngine.dll"); movingObject = button;
Type[] types = assem.GetTypes(); DoDragDrop(button, DragDropEffects.Copy);
bool found = false; }
foreach (Type t in types) private void page1_DragDrop(object sender, DragEventArgs e)
{
if (movingObject is Button)
{ {
if (t.Name == button.Text) Button button = (Button)movingObject;
{
//Found it
found = true;
ManagedScripting.ScriptingEngine engine = new ManagedScripting.ScriptingEngine(); foreach (Type t in types)
engine.LoadAssembly(Application.StartupPath + "/MUDEngine.dll"); {
engine.InstanceObject(t, null); if (t.Name == button.Text)
ManagedScripting.ScriptObject obj = engine.GetObject(t.Name); {
propertyGrid1.SelectedObject = obj.Instance; engine.InstanceObject(t, null);
currentScript = engine.GetObject(t.Name);
propertyGrid1.SelectedObject = currentScript.Instance;
if (page1.Text == "Empty")
{
page1.Text = currentScript.Name;
}
else
{
TabPage tab = new TabPage(currentScript.Name);
tabControl1.TabPages.Add(tab);
}
}
} }
} }
} }
private void page1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
} }
} }