diff --git a/EduNetworkBuilder/EduNetworkBuilder.csproj b/EduNetworkBuilder/EduNetworkBuilder.csproj
index e6e5646..0f2e852 100644
--- a/EduNetworkBuilder/EduNetworkBuilder.csproj
+++ b/EduNetworkBuilder/EduNetworkBuilder.csproj
@@ -183,6 +183,12 @@
RTFWindow.cs
+
+ Form
+
+
+ ShapeEditor.cs
+
Form
@@ -244,6 +250,9 @@
RTFWindow.cs
+
+ ShapeEditor.cs
+
TranslationWindow.cs
diff --git a/EduNetworkBuilder/NetShape.cs b/EduNetworkBuilder/NetShape.cs
index 7c76dbf..171512f 100644
--- a/EduNetworkBuilder/NetShape.cs
+++ b/EduNetworkBuilder/NetShape.cs
@@ -134,6 +134,14 @@ namespace EduNetworkBuilder
}
+ public override string ToString()
+ {
+ string answer = MyShape.ToString() + " " + LineColor.Name + "/" + FillColor.Name;
+ answer = answer + " X:" + InArea.X + " Y:" + InArea.Y;
+ answer = answer + "W:" + InArea.Width + " H:" + InArea.Height;
+ return answer;
+ }
+
public void Load(XmlNode theNode)
{
foreach (XmlNode Individual in theNode.ChildNodes)
diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs
index ec66c80..d82f267 100644
--- a/EduNetworkBuilder/Network.cs
+++ b/EduNetworkBuilder/Network.cs
@@ -68,7 +68,7 @@ namespace EduNetworkBuilder
private List PacketImages = new List();
private List PingTestStats = new List();
private List BrokenItems = new List();
- private List Shapes = new List(); //For storing simple shapes which are drawn on the network
+ public List Shapes = new List(); //For storing simple shapes which are drawn on the network
public bool IsRandomNetwork = false;
public bool InShapeEditMode = false;
@@ -78,6 +78,8 @@ namespace EduNetworkBuilder
/// WhatFrom: If we are launched from a homework, we remember it here.
///
public SchoolworkClass WhatFrom = null;
+ public List ColorNames = new List() { "Black", "White", "Green", "LightGreen", "Blue", "LightBlue", "Grey", "Brown", "SaddleBrown", "Empty" };
+
public Network(string Name)
{
@@ -1156,6 +1158,16 @@ namespace EduNetworkBuilder
return null;
}
+ public List ShapeDescriptions()
+ {
+ List Descriptions = new List();
+ foreach(NetShape NS in Shapes)
+ {
+ Descriptions.Add(NS.ToString());
+ }
+ return Descriptions;
+ }
+
void KillAllExtraWindows(bool EvenRTF=false)
{
for(int i = Application.OpenForms.Count -1; i >=0; i--)
diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs
index eefe609..f135366 100644
--- a/EduNetworkBuilder/NetworkBuilder.cs
+++ b/EduNetworkBuilder/NetworkBuilder.cs
@@ -60,7 +60,7 @@ namespace EduNetworkBuilder
public PersonClass CurrentUser;
- private List HelpURLs = new List();
+ private List HelpURLs = new List();
public BuilderWindow(string FirstArg="")
{
@@ -100,7 +100,8 @@ namespace EduNetworkBuilder
myNetwork.RegisterDisplayArea(pbNetworkView);
- List ColorNames = new List() { "Black","White","Green","LightGreen","Blue","LightBlue","Grey","Brown","SaddleBrown", "Empty" };
+
+ List ColorNames = myNetwork.ColorNames;
ColorNames.Sort();
cbFillColor.Items.Clear();
cbLineColor.Items.Clear();
diff --git a/EduNetworkBuilder/ShapeEditor.Designer.cs b/EduNetworkBuilder/ShapeEditor.Designer.cs
new file mode 100644
index 0000000..9ed7504
--- /dev/null
+++ b/EduNetworkBuilder/ShapeEditor.Designer.cs
@@ -0,0 +1,232 @@
+namespace EduNetworkBuilder
+{
+ partial class ShapeEditor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lbShapeList = new System.Windows.Forms.ListBox();
+ this.lblShapes = new System.Windows.Forms.Label();
+ this.btnDone = new System.Windows.Forms.Button();
+ this.tbX = new System.Windows.Forms.TextBox();
+ this.lblX = new System.Windows.Forms.Label();
+ this.lblY = new System.Windows.Forms.Label();
+ this.tbY = new System.Windows.Forms.TextBox();
+ this.lblWidth = new System.Windows.Forms.Label();
+ this.lblHeight = new System.Windows.Forms.Label();
+ this.tbWidth = new System.Windows.Forms.TextBox();
+ this.tbHeight = new System.Windows.Forms.TextBox();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.cbFillColor = new System.Windows.Forms.ComboBox();
+ this.cbLineColor = new System.Windows.Forms.ComboBox();
+ this.lblFill = new System.Windows.Forms.Label();
+ this.lblLine = new System.Windows.Forms.Label();
+ this.panel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // lbShapeList
+ //
+ this.lbShapeList.FormattingEnabled = true;
+ this.lbShapeList.ItemHeight = 16;
+ this.lbShapeList.Location = new System.Drawing.Point(12, 29);
+ this.lbShapeList.Name = "lbShapeList";
+ this.lbShapeList.Size = new System.Drawing.Size(120, 164);
+ this.lbShapeList.TabIndex = 0;
+ this.lbShapeList.SelectedIndexChanged += new System.EventHandler(this.lbShapeList_SelectedIndexChanged);
+ //
+ // lblShapes
+ //
+ this.lblShapes.AutoSize = true;
+ this.lblShapes.Location = new System.Drawing.Point(12, 9);
+ this.lblShapes.Name = "lblShapes";
+ this.lblShapes.Size = new System.Drawing.Size(56, 17);
+ this.lblShapes.TabIndex = 1;
+ this.lblShapes.Text = "Shapes";
+ //
+ // btnDone
+ //
+ this.btnDone.Location = new System.Drawing.Point(191, 205);
+ this.btnDone.Name = "btnDone";
+ this.btnDone.Size = new System.Drawing.Size(75, 23);
+ this.btnDone.TabIndex = 2;
+ this.btnDone.Text = "Done";
+ this.btnDone.UseVisualStyleBackColor = true;
+ //
+ // tbX
+ //
+ this.tbX.Location = new System.Drawing.Point(96, 4);
+ this.tbX.Name = "tbX";
+ this.tbX.Size = new System.Drawing.Size(46, 22);
+ this.tbX.TabIndex = 3;
+ //
+ // lblX
+ //
+ this.lblX.AutoSize = true;
+ this.lblX.Location = new System.Drawing.Point(73, 7);
+ this.lblX.Name = "lblX";
+ this.lblX.Size = new System.Drawing.Size(17, 17);
+ this.lblX.TabIndex = 4;
+ this.lblX.Text = "X";
+ //
+ // lblY
+ //
+ this.lblY.AutoSize = true;
+ this.lblY.Location = new System.Drawing.Point(73, 35);
+ this.lblY.Name = "lblY";
+ this.lblY.Size = new System.Drawing.Size(17, 17);
+ this.lblY.TabIndex = 5;
+ this.lblY.Text = "Y";
+ //
+ // tbY
+ //
+ this.tbY.Location = new System.Drawing.Point(96, 32);
+ this.tbY.Name = "tbY";
+ this.tbY.Size = new System.Drawing.Size(47, 22);
+ this.tbY.TabIndex = 6;
+ //
+ // lblWidth
+ //
+ this.lblWidth.AutoSize = true;
+ this.lblWidth.Location = new System.Drawing.Point(46, 63);
+ this.lblWidth.Name = "lblWidth";
+ this.lblWidth.Size = new System.Drawing.Size(44, 17);
+ this.lblWidth.TabIndex = 7;
+ this.lblWidth.Text = "Width";
+ //
+ // lblHeight
+ //
+ this.lblHeight.AutoSize = true;
+ this.lblHeight.Location = new System.Drawing.Point(41, 91);
+ this.lblHeight.Name = "lblHeight";
+ this.lblHeight.Size = new System.Drawing.Size(49, 17);
+ this.lblHeight.TabIndex = 8;
+ this.lblHeight.Text = "Height";
+ //
+ // tbWidth
+ //
+ this.tbWidth.Location = new System.Drawing.Point(96, 60);
+ this.tbWidth.Name = "tbWidth";
+ this.tbWidth.Size = new System.Drawing.Size(47, 22);
+ this.tbWidth.TabIndex = 9;
+ //
+ // tbHeight
+ //
+ this.tbHeight.Location = new System.Drawing.Point(96, 88);
+ this.tbHeight.Name = "tbHeight";
+ this.tbHeight.Size = new System.Drawing.Size(47, 22);
+ this.tbHeight.TabIndex = 10;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.lblLine);
+ this.panel1.Controls.Add(this.lblFill);
+ this.panel1.Controls.Add(this.cbLineColor);
+ this.panel1.Controls.Add(this.cbFillColor);
+ this.panel1.Controls.Add(this.tbHeight);
+ this.panel1.Controls.Add(this.tbWidth);
+ this.panel1.Controls.Add(this.lblHeight);
+ this.panel1.Controls.Add(this.lblWidth);
+ this.panel1.Controls.Add(this.tbY);
+ this.panel1.Controls.Add(this.lblY);
+ this.panel1.Controls.Add(this.lblX);
+ this.panel1.Controls.Add(this.tbX);
+ this.panel1.Location = new System.Drawing.Point(138, 29);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(146, 164);
+ this.panel1.TabIndex = 11;
+ //
+ // cbFillColor
+ //
+ this.cbFillColor.FormattingEnabled = true;
+ this.cbFillColor.Location = new System.Drawing.Point(47, 116);
+ this.cbFillColor.Name = "cbFillColor";
+ this.cbFillColor.Size = new System.Drawing.Size(96, 24);
+ this.cbFillColor.TabIndex = 11;
+ //
+ // cbLineColor
+ //
+ this.cbLineColor.FormattingEnabled = true;
+ this.cbLineColor.Location = new System.Drawing.Point(47, 141);
+ this.cbLineColor.Name = "cbLineColor";
+ this.cbLineColor.Size = new System.Drawing.Size(96, 24);
+ this.cbLineColor.TabIndex = 12;
+ //
+ // lblFill
+ //
+ this.lblFill.AutoSize = true;
+ this.lblFill.Location = new System.Drawing.Point(16, 119);
+ this.lblFill.Name = "lblFill";
+ this.lblFill.Size = new System.Drawing.Size(25, 17);
+ this.lblFill.TabIndex = 13;
+ this.lblFill.Text = "Fill";
+ //
+ // lblLine
+ //
+ this.lblLine.AutoSize = true;
+ this.lblLine.Location = new System.Drawing.Point(6, 144);
+ this.lblLine.Name = "lblLine";
+ this.lblLine.Size = new System.Drawing.Size(35, 17);
+ this.lblLine.TabIndex = 14;
+ this.lblLine.Text = "Line";
+ //
+ // ShapeEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(280, 243);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.btnDone);
+ this.Controls.Add(this.lblShapes);
+ this.Controls.Add(this.lbShapeList);
+ this.Name = "ShapeEditor";
+ this.Text = "ShapeEditor";
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ListBox lbShapeList;
+ private System.Windows.Forms.Label lblShapes;
+ private System.Windows.Forms.Button btnDone;
+ private System.Windows.Forms.TextBox tbX;
+ private System.Windows.Forms.Label lblX;
+ private System.Windows.Forms.Label lblY;
+ private System.Windows.Forms.TextBox tbY;
+ private System.Windows.Forms.Label lblWidth;
+ private System.Windows.Forms.Label lblHeight;
+ private System.Windows.Forms.TextBox tbWidth;
+ private System.Windows.Forms.TextBox tbHeight;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label lblLine;
+ private System.Windows.Forms.Label lblFill;
+ private System.Windows.Forms.ComboBox cbLineColor;
+ private System.Windows.Forms.ComboBox cbFillColor;
+ }
+}
\ No newline at end of file
diff --git a/EduNetworkBuilder/ShapeEditor.cs b/EduNetworkBuilder/ShapeEditor.cs
new file mode 100644
index 0000000..e86a822
--- /dev/null
+++ b/EduNetworkBuilder/ShapeEditor.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace EduNetworkBuilder
+{
+ public partial class ShapeEditor : Form
+ {
+ NetShape ShapeForEditing = null;
+
+ public ShapeEditor()
+ {
+ InitializeComponent();
+ LocalSetup();
+ }
+
+ public ShapeEditor(NetShape WhatToEdit)
+ {
+ InitializeComponent();
+ ShapeForEditing = WhatToEdit;
+ LocalSetup();
+ }
+
+ void LocalSetup()
+ {
+
+ Network myNet = NB.GetNetwork();
+ List ColorNames = myNet.ColorNames;
+ ColorNames.Sort();
+
+ cbFillColor.Items.Clear();
+ cbLineColor.Items.Clear();
+ foreach (string one in ColorNames)
+ {
+ cbFillColor.Items.Add(one);
+ cbLineColor.Items.Add(one);
+ }
+
+ lbShapeList.Items.Clear();
+ foreach(string one in myNet.ShapeDescriptions())
+ {
+ lbShapeList.Items.Add(one);
+ }
+ }
+
+ private void lbShapeList_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Network myNet = NB.GetNetwork();
+ //Fill in the text from the shape
+
+ ShapeForEditing = null;
+ foreach (NetShape oneShape in myNet.Shapes)
+ {
+ if (oneShape.ToString() == lbShapeList.Text)
+ ShapeForEditing = oneShape;
+ }
+ FieldsFromShape(ShapeForEditing);
+ }
+
+ private void FieldsFromShape(NetShape theShape)
+ {
+ ShapeForEditing = theShape;
+ if(ShapeForEditing != null)
+ {
+ tbX.Text = ShapeForEditing.InArea.X.ToString();
+ tbY.Text = ShapeForEditing.InArea.Y.ToString();
+ tbHeight.Text = ShapeForEditing.InArea.Height.ToString();
+ tbWidth.Text = ShapeForEditing.InArea.Width.ToString();
+ cbFillColor.Text = ShapeForEditing.FillColor.Name;
+ cbLineColor.Text = ShapeForEditing.LineColor.Name;
+
+ }
+ }
+ }
+}
diff --git a/EduNetworkBuilder/ShapeEditor.resx b/EduNetworkBuilder/ShapeEditor.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/EduNetworkBuilder/ShapeEditor.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file