From ce6e40e099e650263e5b763aece330baacab44a9 Mon Sep 17 00:00:00 2001
From: Tim Young <tim.young@lightsys.org>
Date: Thu, 1 Mar 2018 08:09:40 -0600
Subject: [PATCH] Add the shape of the netshape to the form (circle, rectangle)

---
 EduNetworkBuilder/ShapeEditor.Designer.cs | 56 ++++++++++++++++-------
 EduNetworkBuilder/ShapeEditor.cs          | 14 +++++-
 2 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/EduNetworkBuilder/ShapeEditor.Designer.cs b/EduNetworkBuilder/ShapeEditor.Designer.cs
index 9ed7504..c8388ab 100644
--- a/EduNetworkBuilder/ShapeEditor.Designer.cs
+++ b/EduNetworkBuilder/ShapeEditor.Designer.cs
@@ -44,6 +44,8 @@
             this.cbLineColor = new System.Windows.Forms.ComboBox();
             this.lblFill = new System.Windows.Forms.Label();
             this.lblLine = new System.Windows.Forms.Label();
+            this.cbShape = new System.Windows.Forms.ComboBox();
+            this.lblShape = new System.Windows.Forms.Label();
             this.panel1.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -53,7 +55,7 @@
             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.Size = new System.Drawing.Size(120, 212);
             this.lbShapeList.TabIndex = 0;
             this.lbShapeList.SelectedIndexChanged += new System.EventHandler(this.lbShapeList_SelectedIndexChanged);
             // 
@@ -68,16 +70,17 @@
             // 
             // btnDone
             // 
-            this.btnDone.Location = new System.Drawing.Point(191, 205);
+            this.btnDone.Location = new System.Drawing.Point(201, 244);
             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;
+            this.btnDone.Click += new System.EventHandler(this.btnDone_Click);
             // 
             // tbX
             // 
-            this.tbX.Location = new System.Drawing.Point(96, 4);
+            this.tbX.Location = new System.Drawing.Point(96, 47);
             this.tbX.Name = "tbX";
             this.tbX.Size = new System.Drawing.Size(46, 22);
             this.tbX.TabIndex = 3;
@@ -85,7 +88,7 @@
             // lblX
             // 
             this.lblX.AutoSize = true;
-            this.lblX.Location = new System.Drawing.Point(73, 7);
+            this.lblX.Location = new System.Drawing.Point(73, 50);
             this.lblX.Name = "lblX";
             this.lblX.Size = new System.Drawing.Size(17, 17);
             this.lblX.TabIndex = 4;
@@ -94,7 +97,7 @@
             // lblY
             // 
             this.lblY.AutoSize = true;
-            this.lblY.Location = new System.Drawing.Point(73, 35);
+            this.lblY.Location = new System.Drawing.Point(73, 78);
             this.lblY.Name = "lblY";
             this.lblY.Size = new System.Drawing.Size(17, 17);
             this.lblY.TabIndex = 5;
@@ -102,7 +105,7 @@
             // 
             // tbY
             // 
-            this.tbY.Location = new System.Drawing.Point(96, 32);
+            this.tbY.Location = new System.Drawing.Point(96, 75);
             this.tbY.Name = "tbY";
             this.tbY.Size = new System.Drawing.Size(47, 22);
             this.tbY.TabIndex = 6;
@@ -110,7 +113,7 @@
             // lblWidth
             // 
             this.lblWidth.AutoSize = true;
-            this.lblWidth.Location = new System.Drawing.Point(46, 63);
+            this.lblWidth.Location = new System.Drawing.Point(46, 106);
             this.lblWidth.Name = "lblWidth";
             this.lblWidth.Size = new System.Drawing.Size(44, 17);
             this.lblWidth.TabIndex = 7;
@@ -119,7 +122,7 @@
             // lblHeight
             // 
             this.lblHeight.AutoSize = true;
-            this.lblHeight.Location = new System.Drawing.Point(41, 91);
+            this.lblHeight.Location = new System.Drawing.Point(41, 134);
             this.lblHeight.Name = "lblHeight";
             this.lblHeight.Size = new System.Drawing.Size(49, 17);
             this.lblHeight.TabIndex = 8;
@@ -127,20 +130,22 @@
             // 
             // tbWidth
             // 
-            this.tbWidth.Location = new System.Drawing.Point(96, 60);
+            this.tbWidth.Location = new System.Drawing.Point(96, 103);
             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.Location = new System.Drawing.Point(96, 131);
             this.tbHeight.Name = "tbHeight";
             this.tbHeight.Size = new System.Drawing.Size(47, 22);
             this.tbHeight.TabIndex = 10;
             // 
             // panel1
             // 
+            this.panel1.Controls.Add(this.lblShape);
+            this.panel1.Controls.Add(this.cbShape);
             this.panel1.Controls.Add(this.lblLine);
             this.panel1.Controls.Add(this.lblFill);
             this.panel1.Controls.Add(this.cbLineColor);
@@ -155,13 +160,13 @@
             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.Size = new System.Drawing.Size(146, 212);
             this.panel1.TabIndex = 11;
             // 
             // cbFillColor
             // 
             this.cbFillColor.FormattingEnabled = true;
-            this.cbFillColor.Location = new System.Drawing.Point(47, 116);
+            this.cbFillColor.Location = new System.Drawing.Point(47, 159);
             this.cbFillColor.Name = "cbFillColor";
             this.cbFillColor.Size = new System.Drawing.Size(96, 24);
             this.cbFillColor.TabIndex = 11;
@@ -169,7 +174,7 @@
             // cbLineColor
             // 
             this.cbLineColor.FormattingEnabled = true;
-            this.cbLineColor.Location = new System.Drawing.Point(47, 141);
+            this.cbLineColor.Location = new System.Drawing.Point(47, 184);
             this.cbLineColor.Name = "cbLineColor";
             this.cbLineColor.Size = new System.Drawing.Size(96, 24);
             this.cbLineColor.TabIndex = 12;
@@ -177,7 +182,7 @@
             // lblFill
             // 
             this.lblFill.AutoSize = true;
-            this.lblFill.Location = new System.Drawing.Point(16, 119);
+            this.lblFill.Location = new System.Drawing.Point(16, 162);
             this.lblFill.Name = "lblFill";
             this.lblFill.Size = new System.Drawing.Size(25, 17);
             this.lblFill.TabIndex = 13;
@@ -186,17 +191,34 @@
             // lblLine
             // 
             this.lblLine.AutoSize = true;
-            this.lblLine.Location = new System.Drawing.Point(6, 144);
+            this.lblLine.Location = new System.Drawing.Point(6, 187);
             this.lblLine.Name = "lblLine";
             this.lblLine.Size = new System.Drawing.Size(35, 17);
             this.lblLine.TabIndex = 14;
             this.lblLine.Text = "Line";
             // 
+            // cbShape
+            // 
+            this.cbShape.FormattingEnabled = true;
+            this.cbShape.Location = new System.Drawing.Point(63, 17);
+            this.cbShape.Name = "cbShape";
+            this.cbShape.Size = new System.Drawing.Size(83, 24);
+            this.cbShape.TabIndex = 15;
+            // 
+            // lblShape
+            // 
+            this.lblShape.AutoSize = true;
+            this.lblShape.Location = new System.Drawing.Point(8, 20);
+            this.lblShape.Name = "lblShape";
+            this.lblShape.Size = new System.Drawing.Size(49, 17);
+            this.lblShape.TabIndex = 16;
+            this.lblShape.Text = "Shape";
+            // 
             // 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.ClientSize = new System.Drawing.Size(288, 279);
             this.Controls.Add(this.panel1);
             this.Controls.Add(this.btnDone);
             this.Controls.Add(this.lblShapes);
@@ -228,5 +250,7 @@
         private System.Windows.Forms.Label lblFill;
         private System.Windows.Forms.ComboBox cbLineColor;
         private System.Windows.Forms.ComboBox cbFillColor;
+        private System.Windows.Forms.Label lblShape;
+        private System.Windows.Forms.ComboBox cbShape;
     }
 }
\ No newline at end of file
diff --git a/EduNetworkBuilder/ShapeEditor.cs b/EduNetworkBuilder/ShapeEditor.cs
index e86a822..0b14093 100644
--- a/EduNetworkBuilder/ShapeEditor.cs
+++ b/EduNetworkBuilder/ShapeEditor.cs
@@ -47,6 +47,13 @@ namespace EduNetworkBuilder
             {                
                 lbShapeList.Items.Add(one);
             }
+
+            cbShape.Items.Clear();
+            foreach(NetShapeType one in Enum.GetValues(typeof(NetShapeType)))
+            {
+                if (one != NetShapeType.none)
+                    cbShape.Items.Add(one.ToString());
+            }
         }
 
         private void lbShapeList_SelectedIndexChanged(object sender, EventArgs e)
@@ -74,8 +81,13 @@ namespace EduNetworkBuilder
                 tbWidth.Text = ShapeForEditing.InArea.Width.ToString();
                 cbFillColor.Text = ShapeForEditing.FillColor.Name;
                 cbLineColor.Text = ShapeForEditing.LineColor.Name;
-                
+                cbShape.Text = ShapeForEditing.MyShape.ToString();
             }
         }
+
+        private void btnDone_Click(object sender, EventArgs e)
+        {
+            Close();
+        }
     }
 }