private void ContextMenuEventHandler(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; if (item.Name == MENU_ITEM_DELETE) { if (Factory.GUIController.ShowQuestion("Are you sure you want to delete this object?") == DialogResult.Yes) { _room.Objects.Remove(_selectedObject); _objectBaselines.Remove(_selectedObject); RemoveObjectRef(_selectedObject); foreach (RoomObject obj in _room.Objects) { if (obj.ID >= _selectedObject.ID) { string oldID = GetItemID(obj); obj.ID--; UpdateObjectRef(obj, oldID); } } OnItemsChanged(this, null); _selectedObject = null; Factory.GUIController.SetPropertyGridObject(_room); SetPropertyGridList(); _room.Modified = true; _panel.Invalidate(); } } else if (item.Name == MENU_ITEM_NEW) { if (_room.Objects.Count >= Room.MAX_OBJECTS) { Factory.GUIController.ShowMessage("This room already has the maximum " + Room.MAX_OBJECTS + " objects.", MessageBoxIcon.Information); return; } RoomObject newObj = new RoomObject(_room); newObj.ID = _room.Objects.Count; newObj.StartX = SetObjectCoordinate(_menuClickX); newObj.StartY = SetObjectCoordinate(_menuClickY); _room.Objects.Add(newObj); AddObjectRef(newObj); OnItemsChanged(this, null); SetSelectedObject(newObj); SetPropertyGridList(); Factory.GUIController.SetPropertyGridObject(newObj); _room.Modified = true; _panel.Invalidate(); } else if (item.Name == MENU_ITEM_OBJECT_COORDS) { int tempx = _selectedObject.StartX; int tempy = _selectedObject.StartY; RoomEditorState.AdjustCoordsToMatchEngine(_room, ref tempx, ref tempy); string textToCopy = tempx.ToString() + ", " + tempy.ToString(); Utilities.CopyTextToClipboard(textToCopy); } }
private void CoordMenuEventHandler(object sender, EventArgs e) { int tempx = _menuClickX; int tempy = _menuClickY; RoomEditorState.AdjustCoordsToMatchEngine(_room, ref tempx, ref tempy); string textToCopy = tempx.ToString() + ", " + tempy.ToString(); Utilities.CopyTextToClipboard(textToCopy); }