public void OnOperationChosen(byte b) { if (b == Op_Delete) { for (int i = 0; i < selected.Count; i++) { editor.RemoveShape(selected[i]); } editor.SetTool(null); return; } if (b == Op_Dupe) { Vector2 delta = new Vector2(-editor.GridSize); for (int i = 0; i < selected.Count; i++) { Shape n = selected[i].Duplicate(); for (int c = 0; c < n.lines.Length; c++) { n.lines[c].from += delta; n.lines[c].to += delta; } selected[i] = n; editor.AddShape(n); } b = Op_Trans; } operating = b != Op_Sel; if (!operating) { done = false; firstChosen = false; return; } operation = b; simpleMenu = new SimpleTextMenu(editor); originSet = b == Op_Trans; if (originSet) { simpleMenu.SetText("Drag and drop. Press ENTER once done."); } else { simpleMenu.SetText("Select Origin"); /*copyTos = new Vector2[selectedTos.Count]; * copyFroms = new Vector2[selectedFroms.Count]; * for (int i = 0; i < copyTos.Length; i++) * copyTos[i] = selectedTos[i].to; * for (int i = 0; i < copyFroms.Length; i++) * copyFroms[i] = selectedFroms[i].from;*/ } editor.SetMenu(simpleMenu); }
public void OnOperationChosen(byte b) { if (b == Op_ToShape) { List <Shape> shapes = new List <Shape>(30); for (int i = 0; i < selectedTos.Count; i++) { if (!shapes.Contains(selectedTos[i].belongTo)) { shapes.Add(selectedTos[i].belongTo); } } for (int i = 0; i < selectedFroms.Count; i++) { if (!shapes.Contains(selectedFroms[i].belongTo)) { shapes.Add(selectedFroms[i].belongTo); } } editor.SetTool(new ShapeSelectTool(editor, shapes)); return; } operating = b != Op_Sel; if (!operating) { done = false; firstChosen = false; return; } operation = b; simpleMenu = new SimpleTextMenu(editor); originSet = b == Op_Trans; if (originSet) { simpleMenu.SetText("Drag and drop. Press ENTER once done."); } else { simpleMenu.SetText("Select Origin"); copyTos = new Vector2[selectedTos.Count]; copyFroms = new Vector2[selectedFroms.Count]; for (int i = 0; i < copyTos.Length; i++) { copyTos[i] = selectedTos[i].to; } for (int i = 0; i < copyFroms.Length; i++) { copyFroms[i] = selectedFroms[i].from; } } editor.SetMenu(simpleMenu); }