private void TransferList_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } TreeListNode node = TransferList.GetNodeAt(e.Location) as TreeListNode; if (node == null || node.GetType() != typeof(TransferNode)) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); TransferNode transfer = node as TransferNode; menu.Items.Add(new ToolStripMenuItem("Copy Hash to Clipboaard", null, (s, o) => { Clipboard.SetText(Utilities.ToBase64String(transfer.Transfer.Details.Hash)); })); menu.Show(TransferList, e.Location); }
private void MessageView_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } MessageNode item = MessageView.GetNodeAt(e.Location) as MessageNode; if (item == null) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); if (item.Message.Header.TargetID == Core.UserID) { menu.Items.Add(new MessageMenuItem(item.Message, "Reply", null, new EventHandler(Message_Reply))); } menu.Items.Add(new MessageMenuItem(item.Message, "Forward", null, new EventHandler(Message_Forward))); menu.Items.Add("-"); menu.Items.Add(new MessageMenuItem(item.Message, "Delete", MailRes.delete, new EventHandler(Message_Delete))); menu.Show(MessageView, e.Location); }
private void PlanList_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } PlanListItem clicked = PlanList.GetItemAt(e.Location) as PlanListItem; if (clicked == null) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); if (Selected.Person == Core.UserID) { menu.Items.Add(new PlanMenuItem("Edit", clicked.Item, null, Plan_Edit)); menu.Items.Add("-"); menu.Items.Add(new PlanMenuItem("Delete", clicked.Item, PlanRes.delete, Plan_Delete)); } else { menu.Items.Add(new PlanMenuItem("Details", clicked.Item, PlanRes.details, Plan_View)); } menu.Show(PlanList, e.Location); }
void ProjectionTreeView_MouseUp(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } var node = PointToNode(new Point(e.X, e.Y)); if (node == null) { return; } HideToolTip(); SelectedNode = node; if (IsProjectionNode(node)) { var nodeFavorite = Nodes.Find(TreeViewConstants.NodeFavorite); bool favorite = node.Parent == nodeFavorite; _contextMenu.Items[TreeViewConstants.ContextAddToFavorite].Visible = !favorite; _contextMenu.Items[TreeViewConstants.ContextRemoveFromFavorite].Visible = favorite; _selectedNode = node; Rectangle r = RectangleToScreen(ClientRectangle); _contextMenu.Show(r.Left + e.X, r.Top + e.Y); } }
private void listView_MouseUp(object sender, MouseEventArgs e) { ListViewItem xy = listView.GetItemAt(e.X, e.Y); if (xy == null) { listView.SelectedItems.Clear(); } if (e.Button == MouseButtons.Right) { //listView.SelectedItems.Clear(); Point point = this.PointToClient(listView.PointToScreen(new Point(e.X, e.Y))); if (xy == null) { if (_contextMenuStripSelectNone != null) { if (OnRightClickToSetContentMenu != null) { OnRightClickToSetContentMenu(_contextMenuStripSelectNone, null); } _contextMenuStripSelectNone.Show(this, point); } } if (xy != null) { if (listView.SelectedIndices.Count == 0) { //no this case } else if (listView.SelectedIndices.Count == 1) { if (_contextMenuStripSelectOne != null) { if (OnRightClickToSetContentMenu != null) { OnRightClickToSetContentMenu(_contextMenuStripSelectOne, null); } _contextMenuStripSelectOne.Show(this, point); } } else { if (_contextMenuStripSelectMany != null) { if (OnRightClickToSetContentMenu != null) { OnRightClickToSetContentMenu(_contextMenuStripSelectMany, null); } _contextMenuStripSelectMany.Show(this, point); } } } } }
private void PostView_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } PostViewNode node = PostView.GetNodeAt(e.Location) as PostViewNode; if (node == null) { return; } PostViewNode parent = node.ParentNode() as PostViewNode; OpPost replyTo = node.Post; if (parent != null) { replyTo = parent.Post; } ContextMenuStripEx menu = new ContextMenuStripEx(); if (!replyTo.Header.Archived) { menu.Items.Add(new PostMenuItem("Reply", replyTo, (s, a) => ReplyPost(replyTo))); } if (node.Post.Header.SourceID == Core.UserID) { if (!replyTo.Header.Archived) { menu.Items.Add(new PostMenuItem("Edit", node.Post, (s, a) => EditPost(node.Post))); menu.Items.Add("-"); } if (parent == null) { if (node.Post.Header.Archived) { menu.Items.Add(new PostMenuItem("Restore", node.Post, (s, a) => Boards.Archive(node.Post, false))); } else { menu.Items.Add(new PostMenuItem("Archive", node.Post, (s, a) => Boards.Archive(node.Post, true))); } } } menu.Show(PostView, e.Location); }
private void GoalTree_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } GoalNode node = GoalTree.GetNodeAt(e.Location) as GoalNode; if (node == null) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); bool owned = IsOwned(node); bool root = false; GoalNode parent = node.ParentNode() as GoalNode; if (parent == null && node.Goal.Person == Core.UserID && Head.Person == Core.UserID) { root = true; } if (owned) { menu.Items.Add(new GoalMenuItem("Edit", node.Goal, null, Goal_Edit)); menu.Items.Add(new GoalMenuItem("View Schedule", node.Goal, PlanRes.Schedule.ToBitmap(), Goal_Schedule)); menu.Items.Add("-"); } if (root) { menu.Items.Add(new GoalMenuItem("Archive", node.Goal, PlanRes.archive, Goal_Archive)); } if (owned) { menu.Items.Add(new GoalMenuItem("Delete", node.Goal, PlanRes.delete, Goal_Delete)); } if (!owned) { menu.Items.Add(new GoalMenuItem("Details", node.Goal, PlanRes.details, Goal_View)); } menu.Show(GoalTree, e.Location); }
private void SharedFiles_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } if (SharedFiles.SelectedItems.Count == 0) { return; } ShareItem item = SharedFiles.SelectedItems[0] as ShareItem; if (item == null) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); if (item.Share.Public) { menu.Items.Add(new ToolStripMenuItem("Make Private", null, new EventHandler(Menu_MakePrivate))); } else { menu.Items.Add(new ToolStripMenuItem("Make Public", null, new EventHandler(Menu_MakePublic))); } menu.Items.Add(new ToolStripMenuItem("Copy File Link", null, new EventHandler(Menu_CopyFileLink))); menu.Items.Add("-"); if (File.Exists(Sharing.GetFilePath(item.Share))) { menu.Items.Add(new ToolStripMenuItem("Open", null, (s, ea) => SharedFiles.SelectedItems.ForEach(i => Sharing.OpenFile(UserID, ((ShareItem)i).Share)))); if (item.Share.SystemPath != null) { menu.Items.Add(new ToolStripMenuItem("Open Containing Folder", null, (s, ea) => Utilities.OpenFolder(Path.GetDirectoryName(item.Share.SystemPath)))); } } else { menu.Items.Add(new ToolStripMenuItem("Try Download", null, (s, ea) => SharedFiles.SelectedItems.ForEach(i => Sharing.DownloadFile(UserID, ((ShareItem)i).Share)))); } if (item.Share.TransferActive) { menu.Items.Add(new ToolStripMenuItem("Transfer Details", null, (s, ea) => TransferView.Show(Core.Network))); } if (Local && item.Share.ClientID == Core.Network.Local.ClientID) { menu.Items.Add(new ToolStripMenuItem("Rename", null, new EventHandler(Menu_Rename))); menu.Items.Add("-"); menu.Items.Add(new ToolStripMenuItem("Remove", null, new EventHandler(Menu_Remove))); } if (menu.Items.Count > 0) { menu.Show(SharedFiles, e.Location); } }
private void BlockRow_MouseClick(object sender, MouseEventArgs e) { foreach (BlockArea area in BlockAreas) { if (area.Local && area.Rect.Contains(e.Location)) { if (View.SelectedBlock != area.Block) { View.SelectedBlock = area.Block; View.RefreshRows(); View.SetDetails(area.Block); } break; } } if (e.Button != MouseButtons.Right) { return; } // create details menu // if local create edit/delete menu ContextMenuStripEx menu = new ContextMenuStripEx(); ToolStripMenuItem details = new ToolStripMenuItem("Details"); string indent = ""; int lastLevel = -1; foreach (BlockArea area in BlockAreas) { if (area.Rect.Contains(e.Location)) { if (lastLevel == -1) { lastLevel = area.Level; } if (area.Level > lastLevel) { lastLevel = area.Level; indent += " "; } details.DropDownItems.Add(new BlockMenuItem(indent + area.Block.Title, area.Block, null, new EventHandler(RClickView))); if (area.Local) { if (UserID != View.Core.UserID) { menu.Items.Add(new BlockMenuItem("Details", area.Block, PlanRes.details, new EventHandler(RClickView))); } else { menu.Items.Add(new BlockMenuItem("Edit", area.Block, null, new EventHandler(RClickEdit))); menu.Items.Add(new BlockMenuItem("Delete", area.Block, PlanRes.delete, new EventHandler(RClickDelete))); } } } } if (details.DropDownItems.Count > 0) { menu.Items.Add(details); } foreach (BlockArea area in GoalAreas) { if (area.Rect.Contains(e.Location)) { menu.Items.Add(new BlockMenuItem("View Goal", area.Goal, PlanRes.Goals.ToBitmap(), new EventHandler(RClickGoal))); break; } } if (menu.Items.Count > 0) { menu.Show(this, e.Location); } }
private void MemberTree_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } MemberNode node = MemberTree.GetNodeAt(e.Location) as MemberNode; if (node == null) { return; } if (Core.Trust != null) { Core.Trust.Research(node.UserID, 0, false); } Core.Locations.Research(node.UserID); ContextMenuStripEx treeMenu = new ContextMenuStripEx(); // views List <MenuItemInfo> quickMenus = new List <MenuItemInfo>(); List <MenuItemInfo> extMenus = new List <MenuItemInfo>(); foreach (var service in ParentView.UI.Services.Values) { if (service is TrustService || service is BuddyService) { continue; } service.GetMenuInfo(InterfaceMenuType.Quick, quickMenus, node.UserID, Room.ProjectID); service.GetMenuInfo(InterfaceMenuType.External, extMenus, node.UserID, Room.ProjectID); } if (quickMenus.Count > 0 || extMenus.Count > 0) { if (treeMenu.Items.Count > 0) { treeMenu.Items.Add("-"); } } foreach (MenuItemInfo info in quickMenus) { treeMenu.Items.Add(new OpMenuItem(node.UserID, Room.ProjectID, info.Path, info)); } if (extMenus.Count > 0) { ToolStripMenuItem viewItem = new ToolStripMenuItem("Views", InterfaceRes.views); foreach (MenuItemInfo info in extMenus) { viewItem.DropDownItems.SortedAdd(new OpMenuItem(node.UserID, Room.ProjectID, info.Path, info)); } treeMenu.Items.Add(viewItem); } // add trust/buddy options at bottom quickMenus.Clear(); ParentView.UI.Services[ServiceIDs.Buddy].GetMenuInfo(InterfaceMenuType.Quick, quickMenus, node.UserID, Room.ProjectID); if (ParentView.UI.Services.ContainsKey(ServiceIDs.Trust)) { ParentView.UI.Services[ServiceIDs.Trust].GetMenuInfo(InterfaceMenuType.Quick, quickMenus, node.UserID, Room.ProjectID); } if (quickMenus.Count > 0) { treeMenu.Items.Add("-"); foreach (MenuItemInfo info in quickMenus) { treeMenu.Items.Add(new OpMenuItem(node.UserID, Room.ProjectID, info.Path, info)); } } // show if (treeMenu.Items.Count > 0) { treeMenu.Show(MemberTree, e.Location); } }
private void BuddyList_MouseClick(object sender, MouseEventArgs e) { if (!Interactive) { return; } // this gets right click to select item BuddyItem clicked = GetItemAt(e.Location) as BuddyItem; if (clicked != null && clicked.User != 0) { Core.Locations.Research(clicked.User); } // right click menu if (e.Button != MouseButtons.Right) { return; } // menu ContextMenuStripEx treeMenu = new ContextMenuStripEx(); if (clicked == null || clicked.User == 0) { if (clicked == null || !clicked.GroupLabel) // blank space clicked, or a buddy/offline label { treeMenu.Items.Add(new ToolStripMenuItem("Add Buddy", BuddyRes.buddy_add, Menu_AddBuddy)); } else { treeMenu.Items.Add(new ToolStripMenuItem("Remove Group", BuddyRes.group_remove, Menu_RemoveGroup)); } treeMenu.Show(this, e.Location); return; } uint project = 0; // views List <MenuItemInfo> quickMenus = new List <MenuItemInfo>(); List <MenuItemInfo> extMenus = new List <MenuItemInfo>(); foreach (var service in UI.Services.Values) { if (service is TrustService || service is BuddyService) { continue; } service.GetMenuInfo(InterfaceMenuType.Quick, quickMenus, clicked.User, project); service.GetMenuInfo(InterfaceMenuType.External, extMenus, clicked.User, project); } foreach (MenuItemInfo info in quickMenus) { treeMenu.Items.Add(new OpMenuItem(clicked.User, project, info.Path, info)); } if (extMenus.Count > 0) { ToolStripMenuItem viewItem = new ToolStripMenuItem("Views", InterfaceRes.views); foreach (MenuItemInfo info in extMenus) { viewItem.DropDownItems.SortedAdd(new OpMenuItem(clicked.User, project, info.Path, info)); } //crit add project specific views treeMenu.Items.Add(viewItem); } if (treeMenu.Items.Count > 0) { treeMenu.Items.Add("-"); } treeMenu.Items.Add(new ToolStripMenuItem("Add to Group", BuddyRes.group_add, Menu_AddGroup)); if (clicked.User != Core.UserID) // if not self { treeMenu.Items.Add(new ToolStripMenuItem("Remove Buddy", BuddyRes.buddy_remove, Menu_RemoveBuddy)); } // add trust options at bottom quickMenus.Clear(); UI.Services[ServiceIDs.Buddy].GetMenuInfo(InterfaceMenuType.Quick, quickMenus, clicked.User, project); if (UI.Services.ContainsKey(ServiceIDs.Trust)) { UI.Services[ServiceIDs.Trust].GetMenuInfo(InterfaceMenuType.Quick, quickMenus, clicked.User, project); } foreach (MenuItemInfo info in quickMenus) { treeMenu.Items.Add(new OpMenuItem(clicked.User, project, info.Path, info)); } // show if (treeMenu.Items.Count > 0) { treeMenu.Show(this, e.Location); } }