void z_MouseUp(object sender, EventArgs e) { PastleObj = SelectedItem; string h = PastleObj.GenerateSaveString(); PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), h); }
private void copyToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectedItem != null) { PastleObj = SelectedItem; string h = PastleObj.GenerateSaveString(); PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), h); } }
private void pastleToolStripMenuItem_Click(object sender, EventArgs e) { if (PastleObj != null) { string h = PastleObj.GenerateSaveString(); PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), h); PastleObj.Name = ObjectProto.GenName(PastleObj.GetTypeSpecifier(), PastleObj.GetTypeSpecifier() == ObjectProto.GetSpec(ObjectTypes.Ray)); int id = -1; if (!(PastleObj is Ray)) { ObjectCollection.Instance.AddObject(PastleObj); } else { ((Ray)PastleObj).Angle = new Angle(((Ray)PastleObj).Angle.GetInDegrees() + 30, false); id = ObjectCollection.Instance.AddRay(PastleObj.Name, PastleObj.Coordinates, ((Ray)PastleObj).Angle, ((Ray)PastleObj).BoundPoint, true); } if (PastleObj is Ray) { SelectedItem = ObjectCollection.Instance.Select(ObjectCollection.Instance.GetRayByID(id)); } else { SelectedItem = ObjectCollection.Instance.Select(PastleObj); } if (!(PastleObj is Ray)) { SystemCoordinates tmp = new SystemCoordinates(PastleObj.Coordinates); Point X = tmp; X.X += 10; X.Y += 10; PastleObj.Coordinates = new SystemCoordinates(X); } PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), PastleObj.GenerateSaveString()); } }
private void Form1_KeyUp(object sender, KeyEventArgs e) { SaveLoad.Instance.HookManager_KeyUp(sender, e); if (e.KeyCode == Keys.Escape) { if (!(activeInstrument is InstrumentSelectAndMove)) { SelectNewInstrument(InstrumentSelectAndMove.Instance); } } if (e.KeyCode == System.Windows.Forms.Keys.LControlKey || e.KeyCode == System.Windows.Forms.Keys.RControlKey || e.KeyCode == System.Windows.Forms.Keys.ControlKey) { ctrl = false; } if (ctrl && e.KeyCode == Keys.C && SelectedItem != null) { PastleObj = SelectedItem; string h = PastleObj.GenerateSaveString(); PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), h); } if (ctrl && e.KeyCode == Keys.V && PastleObj != null) { string h = PastleObj.GenerateSaveString(); PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), h); PastleObj.Name = ObjectProto.GenName(PastleObj.GetTypeSpecifier(), PastleObj.GetTypeSpecifier() == ObjectProto.GetSpec(ObjectTypes.Ray)); int id = -1; if (!(PastleObj is Ray)) { ObjectCollection.Instance.AddObject(PastleObj); } else { ((Ray)PastleObj).Angle = new Angle(((Ray)PastleObj).Angle.GetInDegrees() + 30, false); id = ObjectCollection.Instance.AddRay(PastleObj.Name, PastleObj.Coordinates, ((Ray)PastleObj).Angle, ((Ray)PastleObj).BoundPoint, true); } if (PastleObj is Ray) { SelectedItem = ObjectCollection.Instance.Select(ObjectCollection.Instance.GetRayByID(id)); } else { SelectedItem = ObjectCollection.Instance.Select(PastleObj); } if (!(PastleObj is Ray)) { SystemCoordinates tmp = new SystemCoordinates(PastleObj.Coordinates); Point X = tmp; X.X += 10; X.Y += 10; PastleObj.Coordinates = new SystemCoordinates(X); } PastleObj = SaveLoad.Instance.ConstructObject(PastleObj.GetTypeSpecifier(), PastleObj.GenerateSaveString()); } if (SelectedItem != null && e.KeyCode == Keys.Delete) { X.DeleteObjectRay(SelectedItem); } /*if (e.KeyCode == System.Windows.Forms.Keys.LControlKey || e.KeyCode == System.Windows.Forms.Keys.RControlKey || e.KeyCode == System.Windows.Forms.Keys.ControlKey) * ((InstrumentMirror)instruments_bindage[pictureBox3]).ControlPressed(false);*/ }