public void AddContextMenuItems(MapTab tab, ContextMenuStrip menu) { var myItem = new ToolStripMenuItem(ToString()); var copyPositionItem = new ToolStripMenuItem("Copy Position"); copyPositionItem.Click += (_, __) => { CopyUtilities.CopyPosition(GetPosition()); }; myItem.DropDownItems.Add(copyPositionItem); var pastePositionItem = new ToolStripMenuItem("Paste Position"); pastePositionItem.Click += (_, __) => { if (CopyUtilities.TryPastePosition(out Vector3 v)) { SetPosition(v); } }; myItem.DropDownItems.Add(pastePositionItem); if (tab.graphics.view.mode != MapView.ViewMode.TopDown) { var pivotItem = new ToolStripMenuItem("Make Pivot Point"); pivotItem.Click += (_, __) => Pivot(tab); myItem.DropDownItems.Add(pivotItem); } menu.Items.Add(myItem); } }
public void AddContextMenuItems(MapTab tab, ContextMenuStrip menu) { var myItem = new ToolStripMenuItem($"{triangle.Classification} Triangle 0x{triangle.Address.ToString("x8")}"); var itemCopyTriangleAddress = new ToolStripMenuItem("Copy Triangle Address"); itemCopyTriangleAddress.Click += (_, __) => { if (triangle != null) { Clipboard.SetText($"0x{triangle.Address.ToString("x8")}"); } }; myItem.DropDownItems.Add(itemCopyTriangleAddress); var itemCopyPosition = new ToolStripMenuItem("Copy Position"); itemCopyPosition.Click += (_, __) => { if (triangle != null) { if (tab.graphics.view.mode == MapView.ViewMode.TopDown) { float y = triangle.IsWall() ? mapCursorOnRightClick.Y : (float)triangle.GetHeightOnTriangle(mapCursorOnRightClick.X, mapCursorOnRightClick.Z); CopyUtilities.CopyPosition(new Vector3(mapCursorOnRightClick.X, y, mapCursorOnRightClick.Z)); } } }; myItem.DropDownItems.Add(itemCopyPosition); menu.Items.Add(myItem); }
public void AddContextMenuItems(MapTab tab, ContextMenuStrip menu) { var myItem = new ToolStripMenuItem("Tape Measure"); var copyPositionItem = new ToolStripMenuItem("Copy Position"); copyPositionItem.Click += (_, __) => { Vector2 src = dragA ? parent.a : parent.b; CopyUtilities.CopyPosition(new Vector3(src.X, cursorY, src.Y)); }; myItem.DropDownItems.Add(copyPositionItem); var pastePositionItem = new ToolStripMenuItem("Paste Position"); pastePositionItem.Click += (_, __) => { if (CopyUtilities.TryPastePosition(out Vector3 textVector)) { if (dragA) { parent.a = new Vector2(textVector.X, textVector.Z); } else { parent.b = new Vector2(textVector.X, textVector.Z); } } }; myItem.DropDownItems.Add(pastePositionItem); menu.Items.Add(myItem); } }