diff --git a/EduNetworkBuilder/ShapeEditor.Designer.cs b/EduNetworkBuilder/ShapeEditor.Designer.cs index c8388ab..70815d1 100644 --- a/EduNetworkBuilder/ShapeEditor.Designer.cs +++ b/EduNetworkBuilder/ShapeEditor.Designer.cs @@ -58,6 +58,8 @@ this.lbShapeList.Size = new System.Drawing.Size(120, 212); this.lbShapeList.TabIndex = 0; this.lbShapeList.SelectedIndexChanged += new System.EventHandler(this.lbShapeList_SelectedIndexChanged); + this.lbShapeList.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbShapeList_MouseDown); + this.lbShapeList.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbShapeList_MouseUp); // // lblShapes // diff --git a/EduNetworkBuilder/ShapeEditor.cs b/EduNetworkBuilder/ShapeEditor.cs index d885f01..84e6031 100644 --- a/EduNetworkBuilder/ShapeEditor.cs +++ b/EduNetworkBuilder/ShapeEditor.cs @@ -54,9 +54,27 @@ namespace EduNetworkBuilder if (one != NetShapeType.none) cbShape.Items.Add(one.ToString()); } + + tbHeight.Leave += DataUpdated; + tbWidth.Leave += DataUpdated; + tbX.Leave += DataUpdated; + tbY.Leave += DataUpdated; + cbFillColor.Leave += DataUpdated; + cbLineColor.Leave += DataUpdated; + cbShape.Leave += DataUpdated; + } + + void DataUpdated(object sender, EventArgs e) + { + ValuesToShape(); } private void lbShapeList_SelectedIndexChanged(object sender, EventArgs e) + { + ChangeSelectionTo(lbShapeList.Text); + } + + void ChangeSelectionTo(string ToSelect) { Network myNet = NB.GetNetwork(); //Fill in the text from the shape @@ -64,7 +82,7 @@ namespace EduNetworkBuilder ShapeForEditing = null; foreach (NetShape oneShape in myNet.Shapes) { - if (oneShape.ToString() == lbShapeList.Text) + if (oneShape.ToString() == ToSelect) ShapeForEditing = oneShape; } FieldsFromShape(ShapeForEditing); @@ -131,5 +149,45 @@ namespace EduNetworkBuilder { Close(); } + + private void lbShapeList_MouseUp(object sender, MouseEventArgs e) + { + if(lbShapeList.SelectedItem != null) + { + //We have an item that we have clicked on + ChangeSelectionTo(lbShapeList.Text); + } + if (e.Button == MouseButtons.Right) + { + //We should make a context menu here. + // Delete + // Move Up + // Move Down + // Move to top + // Move to bottom + if(ShapeForEditing != null) + { + int index = 0; + if (lbShapeList.ContextMenuStrip == null) + { + lbShapeList.ContextMenuStrip = new ContextMenuStrip(); + } + lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("_Delete")); + lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_Delete; + + } + } + //If it is a left mouse button, we simply select the item so we can edit it + } + + void lblShape_Delete(object sender, EventArgs e) + { + + } + + private void lbShapeList_MouseDown(object sender, MouseEventArgs e) + { + + } } }