Get move up / move down working for shape editor
This commit is contained in:
parent
40b8798cbd
commit
279fc9b0f3
@ -2061,6 +2061,10 @@
|
||||
<value>Line</value>
|
||||
<comment>SE_Line = Line</comment>
|
||||
</data>
|
||||
<data name="SE_MoveDown" xml:space="preserve">
|
||||
<value>Move Down</value>
|
||||
<comment>SE_MoveDown = Move Down</comment>
|
||||
</data>
|
||||
<data name="SE_MoveToEnd" xml:space="preserve">
|
||||
<value>Move To End</value>
|
||||
<comment>SE_MoveToEnd = Move to End</comment>
|
||||
@ -2069,6 +2073,10 @@
|
||||
<value>Move To Top</value>
|
||||
<comment>SE_MoveToTop = Move To Top</comment>
|
||||
</data>
|
||||
<data name="SE_MoveUp" xml:space="preserve">
|
||||
<value>Move Up</value>
|
||||
<comment>SE_MoveUp = Move Up</comment>
|
||||
</data>
|
||||
<data name="SE_Shape" xml:space="preserve">
|
||||
<value>Shape</value>
|
||||
<comment>SE_Shape = Shape</comment>
|
||||
|
@ -197,8 +197,12 @@ namespace EduNetworkBuilder
|
||||
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;
|
||||
lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("SE_MoveUp"));
|
||||
lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_MoveUp;
|
||||
lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("SE_MoveDown"));
|
||||
lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_MoveDown;
|
||||
lbShapeList.ContextMenuStrip.Items.Add(NB.Translate("SE_MoveToTop"));
|
||||
lbShapeList.ContextMenuStrip.Items[index++].Click += lblShape_MoveToTop;
|
||||
|
||||
lbShapeList.ContextMenuStrip.Visible = true;
|
||||
lbShapeList.ContextMenuStrip.Show(Cursor.Position);
|
||||
@ -228,6 +232,29 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
void lblShapeMove(int delta)
|
||||
{
|
||||
if (delta == 0) return;
|
||||
if (ShapeForEditing == null) return;
|
||||
|
||||
Network myNet = NB.GetNetwork();
|
||||
int index = myNet.Shapes.IndexOf(ShapeForEditing);
|
||||
int newindex = index + delta;
|
||||
myNet.Shapes.Remove(ShapeForEditing);
|
||||
if (newindex < 0) newindex = 0;
|
||||
if (newindex >= myNet.Shapes.Count) myNet.Shapes.Add(ShapeForEditing);
|
||||
else myNet.Shapes.Insert(newindex, ShapeForEditing);
|
||||
FillFormItems();
|
||||
}
|
||||
|
||||
void lblShape_MoveUp(object sender, EventArgs e)
|
||||
{
|
||||
lblShapeMove(-1);
|
||||
}
|
||||
void lblShape_MoveDown(object sender, EventArgs e)
|
||||
{
|
||||
lblShapeMove(1);
|
||||
}
|
||||
void lblShape_MoveToEnd(object sender, EventArgs e)
|
||||
{
|
||||
if (ShapeForEditing != null)
|
||||
|
Loading…
Reference in New Issue
Block a user