Added move shape top (home), bottom (end), up (page up), down (page down) hotkeys

This commit is contained in:
Jaex 2016-11-30 18:51:23 +03:00
parent aceb7c9fd3
commit c4d7098751

View file

@ -427,6 +427,18 @@ private void form_KeyDown(object sender, KeyEventArgs e)
case Keys.Control | Keys.V:
PasteFromClipboard();
break;
case Keys.Home:
MoveCurrentShapeTop();
break;
case Keys.End:
MoveCurrentShapeBottom();
break;
case Keys.PageUp:
MoveCurrentShapeUp();
break;
case Keys.PageDown:
MoveCurrentShapeDown();
break;
}
}
}
@ -1006,6 +1018,86 @@ public void UndoShape()
}
}
public void MoveShapeBottom(BaseShape shape)
{
if (shape != null)
{
for (int i = 0; i < Shapes.Count; i++)
{
if (Shapes[i] == shape)
{
Shapes.Move(i, 0);
return;
}
}
}
}
public void MoveCurrentShapeBottom()
{
MoveShapeBottom(CurrentShape);
}
public void MoveShapeTop(BaseShape shape)
{
if (shape != null)
{
for (int i = 0; i < Shapes.Count; i++)
{
if (Shapes[i] == shape)
{
Shapes.Move(i, Shapes.Count - 1);
return;
}
}
}
}
public void MoveCurrentShapeTop()
{
MoveShapeTop(CurrentShape);
}
public void MoveShapeDown(BaseShape shape)
{
if (shape != null)
{
for (int i = 1; i < Shapes.Count; i++)
{
if (Shapes[i] == shape)
{
Shapes.Move(i, --i);
return;
}
}
}
}
public void MoveCurrentShapeDown()
{
MoveShapeDown(CurrentShape);
}
public void MoveShapeUp(BaseShape shape)
{
if (shape != null)
{
for (int i = 0; i < Shapes.Count - 1; i++)
{
if (Shapes[i] == shape)
{
Shapes.Move(i, ++i);
return;
}
}
}
}
public void MoveCurrentShapeUp()
{
MoveShapeUp(CurrentShape);
}
private bool IsShapeTypeRegion(ShapeType shapeType)
{
switch (shapeType)