diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx index a4114ad..2e6f256 100644 --- a/EduNetworkBuilder/Resources/languages/edustrings.resx +++ b/EduNetworkBuilder/Resources/languages/edustrings.resx @@ -2049,4 +2049,12 @@ Cannot place a tree on top of a tree. NB_TreePlacementError = Cannot place a tree on top of a tree. + + Move To End + SE_MoveToEnd = Move to End + + + Move To Top + SE_MoveToTop = Move To Top + \ No newline at end of file diff --git a/EduNetworkBuilder/ShapeEditor.Designer.cs b/EduNetworkBuilder/ShapeEditor.Designer.cs index 70815d1..630b458 100644 --- a/EduNetworkBuilder/ShapeEditor.Designer.cs +++ b/EduNetworkBuilder/ShapeEditor.Designer.cs @@ -51,6 +51,9 @@ // // lbShapeList // + this.lbShapeList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.lbShapeList.FormattingEnabled = true; this.lbShapeList.ItemHeight = 16; this.lbShapeList.Location = new System.Drawing.Point(12, 29); @@ -72,6 +75,7 @@ // // btnDone // + this.btnDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnDone.Location = new System.Drawing.Point(201, 244); this.btnDone.Name = "btnDone"; this.btnDone.Size = new System.Drawing.Size(75, 23); @@ -146,6 +150,7 @@ // // panel1 // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.lblShape); this.panel1.Controls.Add(this.cbShape); this.panel1.Controls.Add(this.lblLine); diff --git a/EduNetworkBuilder/ShapeEditor.cs b/EduNetworkBuilder/ShapeEditor.cs index 84e6031..e5604be 100644 --- a/EduNetworkBuilder/ShapeEditor.cs +++ b/EduNetworkBuilder/ShapeEditor.cs @@ -42,12 +42,6 @@ namespace EduNetworkBuilder cbLineColor.Items.Add(one); } - lbShapeList.Items.Clear(); - foreach(string one in myNet.ShapeDescriptions()) - { - lbShapeList.Items.Add(one); - } - cbShape.Items.Clear(); foreach(NetShapeType one in Enum.GetValues(typeof(NetShapeType))) { @@ -62,6 +56,19 @@ namespace EduNetworkBuilder cbFillColor.Leave += DataUpdated; cbLineColor.Leave += DataUpdated; cbShape.Leave += DataUpdated; + + FillFormItems(); + } + + void FillFormItems() + { + Network myNet = NB.GetNetwork(); + + lbShapeList.Items.Clear(); + foreach (string one in myNet.ShapeDescriptions()) + { + lbShapeList.Items.Add(one); + } } void DataUpdated(object sender, EventArgs e) @@ -172,8 +179,13 @@ namespace EduNetworkBuilder { lbShapeList.ContextMenuStrip = new ContextMenuStrip(); } + lbShapeList.ContextMenuStrip.Items.Clear(); lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("_Delete")); lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_Delete; + lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("SE_MoveToTop")); + lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_MoveToTop; + lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("SE_MoveToEnd")); + lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_MoveToEnd; } } @@ -182,7 +194,34 @@ namespace EduNetworkBuilder void lblShape_Delete(object sender, EventArgs e) { + if(ShapeForEditing != null) + { + Network myNet = NB.GetNetwork(); + myNet.RemoveShape(ShapeForEditing); + FillFormItems(); + } + } + void lblShape_MoveToTop(object sender, EventArgs e) + { + if (ShapeForEditing != null) + { + Network myNet = NB.GetNetwork(); + myNet.RemoveShape(ShapeForEditing); + myNet.Shapes.Insert(0, ShapeForEditing); + FillFormItems(); + } + } + + void lblShape_MoveToEnd(object sender, EventArgs e) + { + if (ShapeForEditing != null) + { + Network myNet = NB.GetNetwork(); + myNet.RemoveShape(ShapeForEditing); + myNet.Shapes.Add(ShapeForEditing); + FillFormItems(); + } } private void lbShapeList_MouseDown(object sender, MouseEventArgs e)